Let's ignore for a minute the fact that the first thing I did was to accidentally delete a whole load of important system files from the RISC OS Pi. Once you delete a file on RISC OS it seems that there is no way back. No surprises there. Surprisingly it seems that the system managed to soldier on without various important files, complaining only now and again that it didn't know what it was doing. I did, however, have the sense to repair the install in Noobs. This took a couple of hours.
Finally I had a working version of RISC OS again. I haven't installed any apps on the device at all yet (not even the screen- shot software).
|RISC OS straight out of the box.|
I decided that my main goal was to write some code to manage the function keys, in other words, to bind some macros to the programmable function keys to perform various jobs.
To do this I would need to write some BASIC code.
You can write code in the 'Edit' program in your Apps folder. In the Edit menu, navigate to 'Set type' and type 'BASIC'. then save the file somewhere sensible on your SD card.
|How to save text files as executable BASIC files.|
|My first line of code.|
My first macro creates a nice-looking command prompt environment. If you didn't already know, by pressing F12 in RISC OS you enter a command prompt which allows you to enter operating system commands. Let's do something with this.
The code is:
*key 1 *basic|M: MODE 12:COLOUR 40+128:CLS:COLOUR0:*desktop|Mhelp|M
It's all one line, but it means:
- Bind to function key 1 (F1 key).
- Switch to ARM BASIC.
- Enter Graphics mode 12.
- Set the background colour to cyan (a sort of bluey-green).
- Clear the screen to this colour.
- Set foreground (text) colour to black.
- Switch out of ARM BASIC back to the OS command prompt.
- Pull up some help messages.
NOTE: The colon (:) is a statement separator in ARM BASIC, and the pipe M (|M) is a carriage return.
So what does it do?
Well, it brings up a rather nice looking command prompt. Run the program and then press F12 to enter the command prompt and F1 to run the script.
|My first 'Hello World' program in RISC OS.|
Automating the process.
You can add other macro bindings to the other function keys, so it would be useful to have them all available (ie pre-bound to the function keys) when the system boots. To do this add your BASIC script file to the !BOOT folder.
Here's how to make a BASIC script run when the computer loads:
- Open the Apps folder
- Open !Boot
- Open the 'Boot' folder.
- Open the 'Run' folder.
- Drag your BASIC script file to the 'Run at startup' list.
Your program will auto-load when the machine boots up and your macros will be automatically bound to the function keys.
|Working out how to use RISC OS Pi|
Other things I have discovered about RISC OS today
- The pressing SHIFT+'break' key on your keyboard acts just like the 'break' key on your BBC Microcomputer. I think this is the same as pressing CRTL+SHIFT+F12. I never owned an Archimedes computer so I can't tell you how they behaved.
- Don't set a hard drive password for RISC OS. Terrible things will happen if you do.
- Don't delete important system files by accident or on purpose. Nothing good will come of this.
- Don't use RISC OS for any web-based thing that requires a password. I don't think that security is at the heart of this OS as it is in modern operating systems.
Follow this link for more of my RISC OS adventures on the Raspberry Pi, or for my general Raspberry Pi adventures.
#RaspberryPi #RPi #RISCOS #RISC