Difference between revisions of "Syscalls"

From WikiPrizm
Jump to navigationJump to search
(Redirected page to Syscall Reference)
 
Line 1: Line 1:
#REDIRECT [[Syscall_Reference]]
+
''If you are looking for the list of syscalls, see [[:Category:Syscalls]] instead.''
 +
 
 +
The version of [[CASIOWIN]] on the Prizm supports [https://en.wikipedia.org/wiki/System_call system calls], like on previous models such as the fx-9860G and similar. On this Wiki, system calls are usually abbreviated as syscalls.
 +
 
 +
Most of the addresses on the table of system calls are entry-points to functions, but some of the addresses point to data like glyph tables.
 +
 
 +
A list of the known syscalls that correspond to functions is available [[:Category:Syscalls|here]].
 +
 
 +
== Calling convention ==
 +
 
 +
To access a system call, code should jump to 0x80020070 with the syscall number in register R0. After the syscall is executed, it will jump back to the calling code.
 +
 
 +
MOV.L  syscall_number, R0
 +
MOV.L  #H'80020070, R2
 +
JMP    @R2
 +
NOP
 +
NOP    ; execution will resume here
 +
 
 +
The NOP after the JMP is necessary because in the SH-4 instruction set, JMP is a delayed branch instruction (the instruction after the JMP will execute before the jump occurs). The second NOP could really be anything (your code).
 +
 
 +
== Syscall numbers ==
 +
 
 +
The numbers for the syscalls are documented on the Wiki page for each one. Note that the syscalls documented, and their numbers, refer to the Prizm models (fx-CG10 and fx-CG20), not the fx-9860G and alikes! Some syscalls have corresponding versions in the CASIOWIN that runs on these previous models, but others are new and others have changed behavior.

Revision as of 14:00, 18 November 2014

If you are looking for the list of syscalls, see Category:Syscalls instead.

The version of CASIOWIN on the Prizm supports system calls, like on previous models such as the fx-9860G and similar. On this Wiki, system calls are usually abbreviated as syscalls.

Most of the addresses on the table of system calls are entry-points to functions, but some of the addresses point to data like glyph tables.

A list of the known syscalls that correspond to functions is available here.

Calling convention

To access a system call, code should jump to 0x80020070 with the syscall number in register R0. After the syscall is executed, it will jump back to the calling code.

MOV.L   syscall_number, R0
MOV.L   #H'80020070, R2
JMP     @R2
NOP
NOP     ; execution will resume here

The NOP after the JMP is necessary because in the SH-4 instruction set, JMP is a delayed branch instruction (the instruction after the JMP will execute before the jump occurs). The second NOP could really be anything (your code).

Syscall numbers

The numbers for the syscalls are documented on the Wiki page for each one. Note that the syscalls documented, and their numbers, refer to the Prizm models (fx-CG10 and fx-CG20), not the fx-9860G and alikes! Some syscalls have corresponding versions in the CASIOWIN that runs on these previous models, but others are new and others have changed behavior.