Technical details
RISC OS was designed initially for code written in assembler, and for use by BASIC. Its legacy of the BBC MOS influenced many of the interfaces that were used in the earliest systems, and these are not as suited to modern systems. Because of this, and to take advantage the opportunity to re-work some interfaces, some of the interfaces in 64 bit RISC OS differ from those in the 32 bit variant.
The differences relate primarily to entry and exit conditions for SWI calls and vectors. The changes will allow easier use of the system calls from high level languages, and may allow for easier transition to other architectures.
Areas which have changed
Registers
Where registers between R0 and R9 are used for vectors, SWIs, upcalls, events and other interfaces, these map directly to the registers X0 to X9. Initially these registers should be expected to contain values which are 32 bit (despite the 64 bit nature of these registers).
Register R12, which is usually passed to extension interfaces as a private word pointer, or context value, is passed in X12.
Processor flags
Some interfaces in RISC OS, like OS_ReadC, return part of their state in ARM processor flags. This made them easier to call in assembler, but does not work as well with high level languages. The convention of returning with the overflow (V) flag set to indicate a call error, with an error pointer in the first register is retained, however.
Instead of returing state in the carry, zero, or negative flags, RISC OS 64 bit interfaces return the additional state in an extra register, or with a modified return in an existing register.
Rarely, there are interfaces which have different state on entry. The vector CnPV is an example of this. These interfaces have been updated to include an additional register on entry to perform different operations.
Interface changes
SWI calls
Within 64 bit RISC OS, SWI calls are issued through the
SVC
(supervisor call) instruction, using parameter 0.
The SWI number is passed in register X10.
Input SWIs
OS_ReadC
In 64 bit RISC OS, OS_ReadC does not return the escape state in processor flags.
On exit, X1 will be set to the following values:
Value | Meaning |
---|---|
0 | A character was read (value in X0) |
1 | An escape condition occurred (value in X0 is 27) |
OS_ReadLine
In 64 bit RISC OS, OS_ReadLine does not return the escape state in processor flags.
On exit, X0 will be set to the following values:
Value | Meaning |
---|---|
0 | A line was read |
1 | An escape condition occurred (no line was read) |
OS_ReadEscapeState
In 64 bit RISC OS, OS_ReadEscapeState does not return the escape state in processor flags.
On exit, X0 will be set to the following values:
Value | Meaning |
---|---|
0 | No escape condition has occurred |
1 | An escape condition has occurred |
OS_Byte 129
In 64 bit RISC OS, OS_Byte 129 (read key state) does not return the read state in processor flags. The state of the carry flag had not been documented in the PRMs, and is not carried forward into 64 bit RISC OS.
OS_Confirm
In 64 bit RISC OS, OS_Confirm does not return the escape and acknowledgement state in processor flags.
On exit, X1 will be set to the following values:
Value | Meaning |
---|---|
-1 | An escape condition was detected |
0 | A negative response was given (not 'y') |
1 | A positive response was given |
Buffering SWIs
OS_Byte 138/153
In 64 bit RISC OS, OS_Byte 138/153 (insert into buffer/insert into input buffer) does not return the insertion state in processor flags.
On exit, X2 will be set to the following values:
Value | Meaning |
---|---|
0-255 | Value was inserted |
-1 | Value could not be inserted |
OS_Byte 145/152
In 64 bit RISC OS, OS_Byte 145/152 (read or examine buffer) does not return the read state in processor flags.
On exit, X2 will be set to the following values:
Value | Meaning |
---|---|
0-255 | Character read from, or available in, the buffer |
-1 | No character was available |
File system SWIs
OS_BGet
In 64 bit RISC OS, OS_BGet does not return the read state in processor flags.
On exit, X0 will be set to the following values:
Value | Meaning |
---|---|
-1 | No byte was read |
0-255 | Value read |
Output SWIs
VDUXV
In 64 bit RISC OS, VDUXV does not return the redirection to printer in the processor flags.
On entry, X1 will be set to 0.
On entry, X1 will be set to -1 to send to printer.
Graphics SWIs
OS_CheckModeValid
In 64 bit RISC OS, OS_CheckModeValid does not return the validity state in processor flags.
On exit, X0 will be set to the following values:
Value | Meaning |
---|---|
-1 | Mode does not exist; X1 contains the mode to use, or -2 if no alternative exists |
-2 | Mode exists, but is not selectable |
other | Mode exists and is selectable |
OS_ReadModeVariable
In 64 bit RISC OS, OS_ReadModeVariable does not return the validity state in processor flags.
On exit, X1 will be set to the following values:
Value | Meaning |
---|---|
-1 | Mode or variable number is invalid |
other | Mode and variable exist |
Memory SWIs
OS_ValidateAddress
In 64 bit RISC OS, OS_ValidateAddress does not return the validity state in processor flags.
On exit, X0 will be set to the following values:
Value | Meaning |
---|---|
0 | Memory is not valid |
1 | Memory is valid |