OSWORD
Categories:
Function | Address | Vector | Description |
---|---|---|---|
OSWORD | FFF1 | 20C | OS call specified by contents of A and parameter block |
The OSWORD routines are very similar in concept to the OSBYTE routines. The major difference arises in the way of passing parameters. Instead of being passed in the X and Y registers, they are placed in a parameter block, The address of this parameter block is sent to the routine in the X (for the low byte) and Y (for the high byte) registers.
Entry parameters
Register | Value |
---|---|
A | OSWORD routine ID |
X | Low byte of parameter block address |
Y | High byte of parameter block address |
OSWORD Specification
Only OSWORD 0x00 returns a result in the Y register and the Carry flag. The registers are preserved for all other calls.
OSWORD calls with numbers 0x15…0x7F must only have a maximum of 16 bytes in the control block.
OSWORD calls with numbers greater than 0x7F must contain the number of parameters to send in the first byte of the control block and the number of parameters to receive in the second byte. Both of these must include the first two bytes so their values are in the range of 0x02…0x7f.
Note the first two values in the parameter block are required to instruct the Tube software how big the block is when the OSWord is issued from a coprocessor.
Due to a limitation in the host side of the Tube software these values cannot exceed 128 bytes in either direction.
OSWORD calls with numbers &E0 to &FF are "available for use by the user" and are passed directly to USERV (0x0200) on the 6502 I/O processor. This makes them easier to implement as only USERV needs to be hooked into instead of WORDV, and 0xF0/0xF1 is already prepared pointing at the control block.
All other unrecognised OSWORD calls are offered to the paged ROMs.
Although not enforced by the API, the convention for high-numbered OSWORD calls is for the control block contents to be:
XY+ | On entry | On exit | Range |
---|---|---|---|
0 | send block length, depends on subreason code | preserved | 0x02…0x7F |
1 | return block length, depends on subreason code | preserved | 0x02…0x7F |
2 | action | set to zero | |
3 | must be zero | result | |
4… | request data | result data |