MODIFYING BBC MICRO PROGRAMS FOR RISCOS ON THE RASPBERRY PI
Programs written wholly in BASIC 2 or BASIC 4 will be good candidates for running on the Raspberry Pi.
PROBLEMS WITH BASIC PROGRAMS FROM THE BBC MICRO
Other programs will change the value of PAGE as they run, sometimes having two or more working programs in memory at once, switching between them by changing the value in PAGE.
On a Raspberry Pi the value of PAGE will be completely different and if it is set to match a BBC micro value the Pi's memory will be corrupted.
Thankfully the Raspberry Pi has much more RAM available than on a BBC micro, which means that changing PAGE to make a program work will not be needed. There will be no need to move a program down in memory. All references to PAGE can usefully be removed and the program will still work on the Pi.
DIRECT MEMORY ACCESS
These locations are not available in RISCOS.
This memory access can be accommodated in RISCOS by the following method, assuming the area at &900 is being referenced. At the start of the program add the line
xxxx DIM M900 256
where xxxx is the program line number. This line reserves 256 bytes of memory and the start address of this is stored in the variable M900. To reference this memory change all occurrences of ?&9xx to M900?xx, $&900="..." to $M900="..." and so on.
USER DEFINED CHARACTERS
Another 'trick' used by some programmers was to use VDU128 to display the user character 224. This worked on a BBC micro because its operating system would treat characters in the range 128 to 159 as characters 224 to 255. Characters 128 to 159 could be obtained by pressing the appropriate function key when entering the program and this saved memory. When converting such a program to run in RISCOS all references to characters in the range 128 to 159 could be changed to be in the range 224 to 255. This is tedious. A quicker method is sometimes possible and that is to define characters 128 to 159 to be the same as characters 224 to 255.
For RISCOS only use the keyword WAIT could be used for delays but for backwards compatibility a delay procedure should be written or the INKEY() keyword used.
All the other BBC modes on the Raspberry Pi are 64 colour modes. This means that the colour numbers for BBC programs will be different when run on the Pi. There is no way around this but to change the colour numbers. Generally 8 variables are defined to hold the colour numbers and used where necessary. When red is needed, which is colour number 1 on the BBC micro, the variable Red% is used instead; this is actually colour number 3 on the Pi.
VDU19 commands to change the colour shown for a particular logical colour in a mode will not work. The actual colour must be used in its place.
Programs which rely on the effects of GCOL3,x may not work correctly. There is no work around for this problem as RISCOS does not use colours from a pallette as does the BBC micro.
OPERATING SYSTEM CALLS
6502 MACHINE CODE
Any programs that *LOAD machine code to a particular memory address will not work on RISCOS.
In many cases, due to the speed of the Raspberry Pi, converting the machine code routine to BASIC will prove to be satisfactory.
|© 2018 - 2023 flaxcottage.com|