Difference between revisions of "68000 Second Processor"
(Initial page.) |
m (Corrected link to mdfs.net) |
||
Line 60: | Line 60: | ||
== See also == | == See also == | ||
* [[68000 BBC BASIC]] | * [[68000 BBC BASIC]] | ||
− | * [http://mdfs.net/tube/ | + | * [http://mdfs.net/tube/68000 mdfs.net] |
[[User:Jgharston|Jgharston]] ([[User talk:Jgharston|talk]]) 19:03, 25 August 2019 (CEST) | [[User:Jgharston|Jgharston]] ([[User talk:Jgharston|talk]]) 19:03, 25 August 2019 (CEST) |
Latest revision as of 03:07, 3 September 2019
CiscOS API Calls
Programs communicate with the kernal and MOS with the TRAP 12 opcode with parameters arranged as for an ARM/RISC OS SWI call, with A0=SWI number.
D0: SWI R0 A0: SWI number D1: SWI R1 A1: SWI R8 ; rarely used D2: SWI R2 A2: SWI R9 ; rarely used D3: SWI R3 A3: SWI R10 ; only for OS_CallASWIR10 D4: SWI R4 A4: 'RISC OS R12' ; private workspace pointer D5: SWI R5 A5: SWI R12 ; only for OS_CallASWIR12 D6: SWI R6 A6=>stack frame D7: SWI R7 A7=>stack On exit: If VC, D0=any returned data If VS, D0=>error block: EQUW errnum:EQUS errstr:EQUB 0 All registers that are not used by the SWI call are preserved, including A0.
The BASIC SYS
command only passes and returns R0-R7, which are
passed through D0-D7.
Examples
MOV #ASC"B",D0 MOV #0,A0 ; OS_WriteC TRAP 12 ; Writes "B" to the current output stream MOV #ASC"B"+256,A0 ; OS_WriteI+ASC"B" TRAP 12 ; Writes "B" to the current output stream MOV #5,D0 ; Read file info MOV filename,D1 ; D1=>filename MOV #8,A0 ; A0=OS_File TRAP 12 ; Read information on the specified file/object BVS erroroccured
A0 is preserved, so multiple non-X calls can be concatonated:
MOV #0,A0 ; OS_WriteC MOV ASC"H" TRAP 12 ; H MOV ASC"E" TRAP 12 ; E MOV ASC"L" TRAP 12 ; L TRAP 12 ; L MOV ASC"O" TRAP 12 ; O