Raspberry Pi RISC OS System Programming Book
Pages: 1 2
patric aristide (434) 418 posts |
This sounds like interesting news from the author of
http://www.raspberrypi.org/phpBB3/viewtopic.php?f=55&t=32241&start=25 |
GavinWraith (26) 1563 posts |
This is a welcome development. I bought a copy of Raspberry Pi Assembly Language. Bruce Smith must have been working hard to produce it in the short time since RISC OS has been available on the Raspberry Pi. It is clearly based on Archimedes Assembly Language. It is well written and nicely laid out, IMHO. It lacks any material on coprocessor or floating point instructions. VFP does not figure in the index. Maybe we can look forward to such material in the proposed new book? Another topic that I would like to see is an expansion of the Program Environment section of PRM Vol 1, with illustrations, and discussion of how shared libraries work. |
Rick Murray (539) 13840 posts |
Indeed; though I would second a comment already made in that 26 bit modes should be relegated to an appendix. The old PC+PSR stuff has no relevance on anything later than a RiscPC, and that is >15 years old. The current crop of machines that people will be buying for RISC OS use (mostly the RPi due to its price, mind you!) have no support for such things. It may be worth mentioning the older ways, as there is a lot of old code out there that people may stumble across, but it’s 32 bit all the way now. Additionally, I would like to see some coverage of VFP/Neon/SIMD. This isn’t so much RISC OS as covering newer expansions to the capabilities of typical ARM devices. I too wish him luck and will wait patiently to see what arrives. |
Bruce Smith (1838) 31 posts |
Hi, just noticed this entry from some time ago. The manuscript for this book is pretty well two-thirds finished and I hope to have something ‘out’ by November (hopefully 2013!). One of the entries talks about covering VFP. Accessing the floating point unit under Rasbian OS is easy using GCC as the assembler supports the extended instruction set, but the GCC incarnation under RISC OS does not seem to support it. Does anyone know if it is supported elsewhere, or whether it is a cross-compiling exercise? I am including usage in assembler, BASIC and also C. Whilst I have a reasonable knowledge of C I have not used it in a RISC OS environment and would be keen to know more about calling of SWI’s. Is anybody has a C program or two they could throw my way to demo this – for inclusion in the book, I would be very grateful. Would save me a lot of learning time. |
Trevor Johnson (329) 1645 posts |
It might do. Does your assembler usage include VFP? |
Bruce Smith (1838) 31 posts |
Thanks for that pointer Trevor. Had a skim read – there’s a lot there to look at so I will take a bit more time over it. The sample programs for my Raspbian book are all in assembler, and illustrate fundamentals of programming the co-processor in the Raspberry Pi. Some brief details here at entries for Chapters 22 and 23. I will take on board what the posts say though and see what else I can add. |
Jeffrey Lee (213) 6048 posts |
AFAIK the current state of VFP on the Pi is:
Using SWIs from C is pretty straightforward, although there are a few different ways of doing it. I don’t have any example programs, but I can point you at a few bits of code to use as a reference.
|
Bruce Smith (1838) 31 posts |
Jeffrey – thank you for that information, very useful and much appreciated. Thank you for taking the time. |
Bruce Smith (1838) 31 posts |
WIMP World |
Rick Murray (539) 13840 posts |
That’s right. The reasons are complicated, but if you want to run a multitasking program from a TaskWindow, save it then call Filer_Run. You won’t be able to call Wimp_Initialise.
I think the benefit of a library is you don’t need to bog yourself down with complications. Want to push text into an icon? Forget memory blocks, dealing with indirected icons and the like… Just call the SetIconText function. Much simpler. |
Bruce Smith (1838) 31 posts |
Thanks Rick, seems to me that is very sound advice, and I will go down that route for the purpose of the book. I think this sort of advice is what people are looking for when they are exploring RISC OS at the onset and will avoid the sort of frustrations I was experiencing today (but then isn’t that programming!). |
Colin (478) 2433 posts |
I don’t want to confuse things but there are 2 ways of wimp programming the basic method is to use the wimp calls and a template editor the other is to use the toolbox. With the toolbox you can save a lot of programming effort – just combine gadgets/menus/windows together graphically in ResEd and style guide compliance is all taken care of. You can even test the user interface without writing any code. I don’t see the need to introduce someone new to wimp swis or template based libraries – to me its like starting someone with assembler. Just my 2p. |
Steve Drain (222) 1620 posts |
@Colin |
Rick Murray (539) 13840 posts |
While the Toolbox is a nice idea for larger programs, isn’t it a bit heavy handed for short and demo programs? |
Colin (478) 2433 posts |
There is obviously an element of preference in choosing one route or the other in may cases it’s down to what you know. I think most people are brought up with the wimp swis so stick with them. Over the years I have used both extensively and find the toolbox simpler from the smallest to the largest program even just using toolbox swis in BASIC. On top of that ResEd is so much nicer to use than any template editor I’ve used and has the added benefit of stopping people putting a slabbed border around text fields – yuck! |
Steve Drain (222) 1620 posts |
Agreed. With the Toolbox modules already resident a short program can be very short indeed. The shortest Toolbox program I can write, the MinApp example, is 6 lines of BASIC supported by Basalt. It does not actually do anything by it looks impressive. ;-) |
Rick Murray (539) 13840 posts |
And, just out of interest, what happens when you want to run some sort of effects or behaviour that is not catered for by the Toolbox? Can you use Wimp SWIs on parts of toolbox windows to do stuff to the icons directly? |
Rick Murray (539) 13840 posts |
Ooh, but the PRMs are hardcore nerd. That said, a lot of RISC OS is hardcore nerd. Where else would you get several volumes which is basically “here are all the software interrupts, have fun!” ? Until you are really comfortable with calling SWIs (don’t forget reading flags), you won’t want to get too close to SWIs. But, then, you’ll be missing all the fun stuff.
That works too. ;-) |
GavinWraith (26) 1563 posts |
Bruce should contact Pete Nowosad ( pete_nowosad@msn.com ) if, as I think he should, he is going to say something about VFP in RISC OS on the Raspberry Pi. As far as I know Charm is the only language so far to use it. You can get some idea of what is required by looking at the files fp, vfp, maths in lib.src in the Charm distribution. While I am at it, let me encourage Bruce to look at RiscLua, whose abstraction facilities make it very easy to hide complicated detail. This is a short wimp program:
Of course it hides all the sys calls inside the wimp.task library. |
Colin (478) 2433 posts |
Rick.
Gadgets are not icons but you can get a list of icons used to implement the gadget so I suppose you can modify that. It’s not something I’ve needed to do. It may be that the toolbox can do what you are thinking it can’t. If you mean by effect changing how normal gadgets look – don’t. That works too. ;-) You can’t get a go at the inside Jeffrey Lee’s commandeered it all :-) Keep going Jeffrey we appreciate it. High level paradigms work in assembler too. You knew I’d say that didn’t you :-) |
WPB (1391) 352 posts |
Generally, you can get at the icon and window handles and do what you need to do. There are some things that are a nightmare, though. Trying to hang a Wimp-based menu off a Toolbox-based menu being the one that springs to mind. Been there, tried that. Ouch. But I definitely think it would be a shame to write a book about Wimp programming for RISC OS without mentioning the Toolbox. I think it’s great. Also if you’re talking about C, OSLib definitely needs a mention. |
Bruce Smith (1838) 31 posts |
Thanks for everyone’s comments, they are very much appreciated. (Apologies for delay in replying – time zones…) I had originally earmarked three chapters for coverage of WIMP and despite the issues I see no reason to change my mind – I just need to come at it at a different angle and showing the reader the different options available and how best to put them into action. I am trying to aim the book at the gap between beginner and PRM nerd. I expect the person to understand a bit about programming but not just how to do it on the RPi for example. The idea being to wipe away the frustration a lot of those starting out on RISC OS have. The WIMP as it turns out is both a useful and typical example! This is not for hard core expert but someone who wants to learn. @SteveYour offer of help is gratefully accepted with regards to the Toolbox etc and coming at the why, how and where with some examples would be great. If you want to drop me an email with some thoughts that would be great. (email@brucesmith.info). The MinApp example sounds good. @GavinThanks I will get onto that, and I will probably include details on RiscLua etc as a way of broadening horizons @WHD / @RickI will include coverage of Dr Wimp in both BASIC and C flavours as I think it is a great example of what you can do with BASIC and RISC OS. I can’t believe the amount of work that has gone into the project and how easy it was to use. It may not be the most elegant solution but it does what it sez on the tin. I also have a chapter about using Assembler, BASIC and C with RISC OS and swi calls form all – so OSLib gets coverage. @ColinI love assembler, but also think its important to show users how the basics all come together. And one of the chapters will be about describing some of the more important SWIs and the order process and reason for making everything happen, and appreciate the sophistication of the the application they are utilizing. @ALLThanks very much for the comments which I greatly appreciate and hopefully I can include all the above in the chapters about WIMP. I do think its important to show what is available and provide a balanced view so that the reader can investigate further and make up their own mind. Diversity is what we need! |
WPB (1391) 352 posts |
Just in case it got lost in the flurry of responses up above, and so that Steve isn’t seen to be blowing his own trumpet ;), I’ll just throw Basalt out there again. It has great support for the Toolbox, and deserves a mention next to !AppBasic and other Toolbox-related libraries, etc. |
Bruce Smith (1838) 31 posts |
Noted. Everything will get a mention promise you – and if anyone has copy or examples of use they can send me I will look to include them as well. |
Bruce Smith (1838) 31 posts |
Interrupt Examples |
Pages: 1 2