stylx
Posts: 49
Joined: Thu Oct 25, 2012 10:06 pm

Re: RISC OS released on Raspberry Pi

Wed Oct 31, 2012 5:05 pm

I recently installed a 4G SD card using !HForm it's hidden a way under a folder marked caution just follow the on screen instructions !HForm auto detects your memory card. I selected to format it under the risc os native filesystem . I not sure But I read some where you can use up to 32G though I could be wrong

NigelJK
Posts: 65
Joined: Wed Sep 05, 2012 1:44 pm

Re: RISC OS released on Raspberry Pi

Wed Oct 31, 2012 7:40 pm

In general if you want to programme on RiscOS you'll be better off using BBCBasic. This is an interpreted language. The interpreter + programme fit inside the processor cache normally so they run very swiftly (and I have it on good authority that over 99% of the programmes written in BBCBasic still run on the latest versions of RiscOS and testing of my own code bears this out, with no code changes required).
BBCBasic has always had the facility to 'embed' machine code into the body of a programme (and the indirect method mentioned earlier is the thin skin of this), I've used it in the past when speed was of the essence but don't see the point now that the interpreter and programme fit in the cache so you're effectively running machine code directly.

pygmy_giant
Posts: 1562
Joined: Sun Mar 04, 2012 12:49 am

Re: RISC OS released on Raspberry Pi

Wed Oct 31, 2012 10:29 pm

Thanks - having a go.

If I want I2C / GPIO access would I be better off using SWIs or val = ?address% and ?address% = val%

Do I have to use annoying linuxy virtual memory mapping chinanigans or is it direct access?

Which SWIs should I use and how?

stylx
Posts: 49
Joined: Thu Oct 25, 2012 10:06 pm

Re: RISC OS released on Raspberry Pi

Wed Oct 31, 2012 11:32 pm

Just a thought, but wasn't the PI ment to be an educational platform?
If you broke down the program in to basic, you could show the students how to communicate with the GPIOs and then how to write a I2C and SPI interface,etc
Programming in basic would give then a start in how these interfaces actually work, No dumb down little black boxes like they do in Python. Programming little boxes isn't very enlightening to anyone.

Sorry for the rant ..I just think people should known how things work

theom
Posts: 73
Joined: Wed Jun 13, 2012 2:53 pm

Re: RISC OS released on Raspberry Pi

Thu Nov 01, 2012 1:00 am

You need to use the SWIs because of memory protection - BASIC runs in user mode, which doesn't have direct poke access to the hardware. A SWI is a transition from user to supervisor mode, which provides the appropriate privileges.

You can access the hardware direct by switching into supervisor mode yourself, but you need to be in assembler (or C) to do this as BASIC doesn't run in supervisor mode. It's possible to use a small snippet of assembler in a BASIC program if you want this (for an example, look at the BASIC code of the !CPUSetup program inside !Boot which does this to poke the processor registers)

NigelJK
Posts: 65
Joined: Wed Sep 05, 2012 1:44 pm

Re: RISC OS released on Raspberry Pi

Thu Nov 01, 2012 4:23 pm

If you need to interface with the WIMP (AKA GUI) then you're going to have to use SWI's all over the place anyway. You will be very close to the machine at this point and fun and games will ensue as you have to have all your bytes lined up correctly or no joy.

nr.
Posts: 144
Joined: Wed Oct 03, 2012 8:51 am
Location: The Fens
Contact: Website

Re: RISC OS released on Raspberry Pi

Thu Nov 01, 2012 6:18 pm

theom wrote:(for an example, look at the BASIC code of the !CPUSetup program inside !Boot which does this to poke the processor registers)
Please indulge a dreadful RISCOS newbie question here, but how would I do that? I've looked around the !Boot folder, and can't find !CPUSetup anywhere that I can open as a BASIC file.

Ta,
--
nr.

User avatar
Burngate
Posts: 6013
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: RISC OS released on Raspberry Pi

Thu Nov 01, 2012 6:40 pm

The easy way:
Menu-click (middle mouse button) on !boot, App !boot > Find > and type in !CPUsetup (or just !CPU* saves typing!)
I've just found it in SDFS::RISCOSpi.$.!Boot.RO500.Hook.Res.Configure
(I think. My Pi is the other side of the house from where I'm sitting, and I'm fed up walking back and forth)
Shift-double-clicking it shows that inside is !RunImage, a BASIC file 10106 bytes long, and appears to be a fully Wimp-aware application. Well worth studying to see how things can be done.

pygmy_giant
Posts: 1562
Joined: Sun Mar 04, 2012 12:49 am

Re: RISC OS released on Raspberry Pi

Thu Nov 01, 2012 7:10 pm

Thanks for all the info - how does one embed an SWI call into BASIC?

Specifically, how does one write / read from BSC I2C FIFOs via SWI ?

More generally, is there a reference resource explaining and describing SWIs ?

User avatar
Burngate
Posts: 6013
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: RISC OS released on Raspberry Pi

Thu Nov 01, 2012 7:47 pm

pygmy_giant wrote:Thanks for all the info - how does one embed an SWI call into BASIC?

Specifically, how does one write / read from BSC I2C FIFOs via SWI ?

More generally, is there a reference resource explaining and describing SWIs ?
Ah.

On my bookshelf I've got the Programmer's Reference Manual and the BBC BASIC Reference manual.
I believe you can get the electronic copies, but you might have to search.

An example swi in BASIC is

Code: Select all

SYS  "Wimp_PollIdle",mask%,block% TO reason%
I've just dragged that out of !CPUsetup.!RunImage
SYS calls the swi vector, Wimp_PollIdle translates to the swi number, mask% and block% are put into two of the registers and reason% is returned from one of the registers

Which swi you need for the I2C FIFOs I've no idea!

User avatar
Burngate
Posts: 6013
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: RISC OS released on Raspberry Pi

Thu Nov 01, 2012 7:51 pm

Part of the format of a module (of which there are lots in RISC OS) is a section on swi number-to-name translation.
Hopefully the module name, and its swis should be fairly explanatory. I'd try doing Help Modules to see if anything seems useful

pygmy_giant
Posts: 1562
Joined: Sun Mar 04, 2012 12:49 am

Re: RISC OS released on Raspberry Pi

Thu Nov 01, 2012 8:03 pm

Thanks - I will hunt around for suitable references. I chanced upon some electronic refereence guides in RISCOS itself - I will also give them a second look and also will try to find out how others have managed I2C.

I would like to acheive this via BASIC for nostalgic reasons, but if that's not possible I might revert to C.

nr.
Posts: 144
Joined: Wed Oct 03, 2012 8:51 am
Location: The Fens
Contact: Website

Re: RISC OS released on Raspberry Pi

Thu Nov 01, 2012 8:24 pm

That's great information, thanks. I'm having happy memories of POKE36879 now. I'm also keen to see if I can get at the GPIO pins in BASIC, as I kind of think that getting a program to do something physical (switching a motor on, flashing a light etc.) is far more engaging than outputting stuff to a screen. This is my excuse for continuing to fiddle with this stuff, so I can tell my kids that I'm doing it to make their experience of computing more fun. Funny, how 30 years ago it was kids asking their parents to get a VIC-20 to "help with the household accounts". Now it's the parents making excuses to the children.
--
nr.

Steve Drain
Posts: 105
Joined: Tue Oct 30, 2012 2:08 pm
Location: Exeter UK

Re: RISC OS released on Raspberry Pi

Thu Nov 01, 2012 8:42 pm

pygmy_giant wrote: I would like to acheive this via BASIC for nostalgic reasons, but if that's not possible I might revert to C.
You can use BASIC with the IIC bus using SWI "OS_IICOp". If you go to the ROOL site and search for that name you will get all the detail. I wrote some test code in BASIC for the Ciseco SliceOfPI/O before I wrote similar functionality into a module with its own SWIs. I have uploaded this in a zip to http://www.kappa.me.uk/Lapdock/RPIO.zip. It is very short, but commented and might give you a flavour.
Last edited by Steve Drain on Thu Nov 01, 2012 8:44 pm, edited 1 time in total.

pygmy_giant
Posts: 1562
Joined: Sun Mar 04, 2012 12:49 am

Re: RISC OS released on Raspberry Pi

Thu Nov 01, 2012 8:43 pm

Many thanks! :D

SEDev
Posts: 34
Joined: Thu Aug 02, 2012 10:55 pm

Re: RISC OS released on Raspberry Pi

Fri Nov 02, 2012 12:52 am

NigelJK wrote:If you need to interface with the WIMP (AKA GUI) then you're going to have to use SWI's all over the place anyway.
You could use BASIC libraries/extensions such as DrWimp/AppBasic/Basalt to program the WIMP. They hide a lot of the SWI specifics by providing providing wrapper functions (DrWimp, AppBasic) or new BASIC keywords (Basalt) that you can use instead of the raw SWIs.
pygmy_giant wrote:More generally, is there a reference resource explaining and describing SWIs ?
There is an ISO for the RISC OS 4.39 installation (160 MB) here:

http://support.riscos.com/Support/439INSTALLV2.ISO

This is for the other branch of RISC OS so not much use with RO 5, but it does contain the PRMs (Programmer's Reference Manual) in PDF and HTML format, look in the 'Manuals' directory.

You can either burn it onto a CD or use CDFaker (http://www.huber-net.de/cdfaker.html) to mount the ISO directly.

Another useful reference are the StrongHelp manuals at http://www.riscos.info/downloads/stronghelp/manuals/ . With these manuals installed you can place the cursor in the name of a SWI and press c-H (Zap) or F1 (StrongED) and a page describing that SWI will be opened automatically. Absolutely invaluable!

theom
Posts: 73
Joined: Wed Jun 13, 2012 2:53 pm

Re: RISC OS released on Raspberry Pi

Fri Nov 02, 2012 1:22 am

If you want programming info, you might like to look on the Pi distro itself:

$.Documents.Books has the full text of about a foot of shelf space:
First Steps to Programming RISC OS
Beginners Guide to the WIMP
PRMs (the Programmers' Reference Manuals)

The OS StrongHelp manual is on the distro too.

Matt Harris
Posts: 6
Joined: Fri Dec 23, 2011 11:22 pm

Re: RISC OS released on Raspberry Pi

Fri Nov 02, 2012 10:08 am

SEDev wrote:There is an ISO for the RISC OS 4.39 installation (160 MB) here:

http://support.riscos.com/Support/439INSTALLV2.ISO

This is for the other branch of RISC OS so not much use with RO 5, but it does contain the PRMs (Programmer's Reference Manual) in PDF and HTML format, look in the 'Manuals' directory.
The PDF's can also be downloaded directly from:

http://foundation.riscos.com/Private/index.htm

That saves downloading the full .iso file mentioned earlier

stylx
Posts: 49
Joined: Thu Oct 25, 2012 10:06 pm

Re: RISC OS released on Raspberry Pi

Fri Nov 02, 2012 4:09 pm

I saw tank's module, looks great. But how do you use it. I install the module with RMLoad and it work's great , but How do I use it from basic.
I tried SYS "GPIO_WriteData" 7, -1 and some other combinations but keep getting a error.
is there a chance tank could give us a 101 on GPIO module he wrote.
Or am I missing something

User avatar
Burngate
Posts: 6013
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: RISC OS released on Raspberry Pi

Fri Nov 02, 2012 5:08 pm

stylx wrote:I saw tank's module, looks great. But how do you use it. I install the module with RMLoad and it work's great , but How do I use it from basic.
I tried SYS "GPIO_WriteData" 7, -1 and some other combinations but keep getting a error.
is there a chance tank could give us a 101 on GPIO module he wrote.
Or am I missing something
Yes, a comma!
SYS "GPIO_WriteData", 7, -1

User avatar
Burngate
Posts: 6013
Joined: Thu Sep 29, 2011 4:34 pm
Location: Berkshire UK Tralfamadore
Contact: Website

Re: RISC OS released on Raspberry Pi

Fri Nov 02, 2012 5:17 pm

SYS "GPIO_WriteData", 7, -1
The basic keyword SYS takes several arguments separated by commas, each being put into one of the Arm registers
But first, the one in quotes is translated (by the OS) into a number

In fact, I believe (though I can't be bothered right now to look it up - my coffee's getting cold) you can put in up to 14 arguments, one for each of the registers R0 - R13
You can also return the contents of the registers in up to the same number of arguments after the keyword TO

EDIT
Okay, I've looked it up.
In BASIC you can use R0 to R7 inclusive, though the routine can use R8 and R9 as well (according to RISC OS 3 PRM vol 1 p.23)

Steve Drain
Posts: 105
Joined: Tue Oct 30, 2012 2:08 pm
Location: Exeter UK

Re: RISC OS released on Raspberry Pi

Fri Nov 02, 2012 6:41 pm

Burngate wrote: In BASIC you can use R0 to R7 inclusive, though the routine can use R8 and R9 as well (according to RISC OS 3 PRM vol 1 p.23)
The versions of BASIC you will find on the Pi allow R0 to R9 to be passed and returned.
Note that any blank values (between commas or absent) are passed as 0.
There is quite bit more about using SYS to call SWIs, but this is probably not the place for a tutorial. :)

NigelJK
Posts: 65
Joined: Wed Sep 05, 2012 1:44 pm

Re: RISC OS released on Raspberry Pi

Fri Nov 02, 2012 6:51 pm

There's a thread on the programming forum for programming in BBCBasic. Not only could it do with a little bumping it 's also the correct place for this kind of chat. I'm already on that thread so I do monitor it in case I can contribute.

User avatar
liz
Raspberry Pi Foundation Employee & Forum Moderator
Raspberry Pi Foundation Employee & Forum Moderator
Posts: 5201
Joined: Thu Jul 28, 2011 7:22 pm
Contact: Website

Re: RISC OS released on Raspberry Pi

Fri Nov 02, 2012 6:59 pm

I should probably reassure everyone here that we're well aware of (and very excited about) the RISC OS for Pi release - but we haven't put anything about it on the front page yet because Steve and Ben from RISC OS Open asked us to hold off for a bit so they could put some fixes in. We'll be making a big fuss about it on the front page on Monday, but we've already put it on the downloads page (link at the top of this page), and I hope some people will download it over the weekend out of curiosity!
Director of Communications, Raspberry Pi

User avatar
bob_binz
Posts: 441
Joined: Thu Feb 02, 2012 7:58 pm
Location: Stockport, UK

Re: RISC OS released on Raspberry Pi

Fri Nov 02, 2012 7:15 pm

liz wrote:... and I hope some people will download it over the weekend out of curiosity!
I downloaded it out of curiosity, and was very impressed by the speed that it loads. Unfortunately, this was the first time I've ever seen RISC OS, and didn't really know how to proceed. I managed to get a connected, re-configured range-extender to get me on the network (no WiFi support, it seems) but that's about it. How do I:

Run Basic?

Shutdown?

Get stuff?

Install stuff?

Run the got and installed stuff?

I hope I'm not being ignorant. I'd love to see a get-started with RISC guide. If there's already one listed in the forums, sorry!

Return to “RISCOS”