Showing changes from revision #1 to #2:
Added | Removed | Changed
RISC OS provide numerous SWIs that perform many different operations. Most SWIs functions are specified by their name. e.g. OS_RemoveCursors removes cursors. However, there are two SWIs that perform a wide variety of different operations. They are OS_Byte and OS_Word.
This document provides information on OS_Word.
OS_Word is used to either read or write a large number of status variables at once.
The OS_Word SWI always uses two registers. The registers upon entry are detailed below:
Register | Use |
---|---|
R0 | Reason code. Used to specify the operation to be performed. (0 – 255) |
R1 | Parameter 2. Pointer to parameter block, that can be used to stored the returned data |
Where OS_Byte is used to return small amounts of data (usually byte sized – hence the name), OS_Word usually returns larger amounts of data. The value passed in R1 points to an area of memory where the data returned from the SWI can be stored.
The size of parameter block required is dependant on the reason code. In addition, some reason codes, contain a sub-reason code, which specifies the size of parameter block.
The value passed by R0 specifies the operation to be performed. The reason code must be a value from 0 to 255. In some cases, sub-reason codes are used to further specify the operation to be performed.
OS_Word is a vectored SWI, but before its vector is called, interrupts are disabled. Most OS_Word routines are so short that there is no need to re-enable interrupts, and instead rely on RISC OS to do this when control is returned to the program that issued the SWI.
Because the interrupts are not re-enabled, the routines are also used by interrupt handling routines.
If you wish to replace an OS_Word routine, you must ensure that the replacement routine:
Because the OS_Word is a vectored SWI, it is possible to add your own OS_Word calls by installing a routine on the software vector that OS_Word uses.
For more information, read the Software Vectors section.
There is no *Command that provides access to OS_Word’s functionality.