Difference between revisions of "OSWORD"
m (→Specification) |
(→Specification) |
||
Line 29: | Line 29: | ||
byte of the parameter block, inclusive of the first two bytes. There are | byte of the parameter block, inclusive of the first two bytes. There are | ||
some calls that break this and will not work in all cases. | some calls that break this and will not work in all cases. | ||
+ | |||
+ | While it is not enforced by the API, the convention for high-numbered OSWORDs | ||
+ | is for the control block contents to be: | ||
+ | |||
+ | * XY?0: length of sent block (required) | ||
+ | * XY?1: length of received block (required) | ||
+ | * XY?2: action | ||
+ | * XY?3: result, set to zero when calling | ||
+ | * XY!4 onwards: parameter data | ||
+ | |||
+ | Then calls are made with code along the lines of: | ||
+ | * <code>!XY%=&2008:XY%?2=6:XY%!4=data:CALL OSWORD:result=XY%?3</code> | ||
OSWORD calls with numbers &E0 to &FF are "available for use by the user" | OSWORD calls with numbers &E0 to &FF are "available for use by the user" | ||
Line 36: | Line 48: | ||
<ref name="appnote-004">Acorn Computers (June 1992), | <ref name="appnote-004">Acorn Computers (June 1992), | ||
''Application note 004: Tube application note'', p.5.</ref> | ''Application note 004: Tube application note'', p.5.</ref> | ||
+ | This makes them easier to implement as only USERV needs to be hooked into | ||
+ | instead of WORDV. | ||
==Calling from BBC BASIC== | ==Calling from BBC BASIC== |
Revision as of 13:53, 27 April 2020
Miscellaneous actions with a control block
Specification
6502 | Z80 | 6809 | PDP11 | 80x86 | 32016 | ARM | On entry: | On exit: |
A | A | A | R0 | AL | R1 | R0 | = function code | undefined |
XY | HL | X | R1 | BX | R2 | R1 | =>control block | undefined, control block updated |
Control block for calls>&7F | ||||||||
&00 | Length of sent control block | |||||||
&01 | Length of received control block | |||||||
&02... | Any other parameters |
OSWORD &00 is the only call that is allowed to return data in registers. All other calls return data in the control block.
OSWORD calls with numbers &15-&7F must only have a maximum of 16 bytes in the control block. OSWORD calls with numbers greater than &7F must contain the number of parameters to send in the first byte of the parameter block, and the number of parameters to receive in the second byte of the parameter block, inclusive of the first two bytes. There are some calls that break this and will not work in all cases.
While it is not enforced by the API, the convention for high-numbered OSWORDs is for the control block contents to be:
- XY?0: length of sent block (required)
- XY?1: length of received block (required)
- XY?2: action
- XY?3: result, set to zero when calling
- XY!4 onwards: parameter data
Then calls are made with code along the lines of:
-
!XY%=&2008:XY%?2=6:XY%!4=data:CALL OSWORD:result=XY%?3
OSWORD calls with numbers &E0 to &FF are "available for use by the user" and are passed directly to USERV on the 6502 I/O processor.[1] [2] This makes them easier to implement as only USERV needs to be hooked into instead of WORDV.
Calling from BBC BASIC
-
INPUT
calls OSWORD &00 -
=TIME
calls OSWORD &01 -
TIME=
calls OSWORD &02 -
SOUND
calls OSWORD &07 -
ENVELOPE
calls OSWORD &08 -
=POINT
calls OSWORD &09 -
=TIME$
calls OSWORD &0E -
TIME$=
calls OSWORD &0F
Entry points
- BBC BASIC Entry Address: &FFF1
- 6502 Entry Address: &FFF1, vectors via &020C
- Z80 Entry Address: &FFF1, vectors via &FFF2
- 6809 Entry Address: &FFF1, vectors via &FFF2
- 80x86 Entry Address: INT &4A, vectors via &0000:0128
- 32000 Entry Address: SVC &07
- PDP-11 Entry Address: EMT 3, vector &03
- ARM Entry Address: SWI &07 "OS_Word", vector &07
See Also
References
Jgharston 17:03, 6 November 2009 (UTC)