The following code is an example of how to implement a syscall without much effort using the CASIO SDK:
(f. i. to check out, if it is of some use, before you include it in your library and headerfiles)
After defining some function pointer types every syscall declaration needs two lines.
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// NEVER try undocumented syscall numbers randomly!
// mostly the calc will do nothing or hang, if the parameters are not chosen correctly.
// but someday you will call the sector erase syscall, which will kill your calc permanently!
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// the following definitions are only needed once #define SCA 0xD201D002 #define SCB 0x422B0009 #define SCE 0x80010070 // 0x80010070 is the fx-9860-syscall-entry point // 0x80020070 is the fx-CG-syscall-entry point (but remember: the syscall numbers are different!) // now define some function pointer types // (for every syscall's interface a different function pointer type is required) // the following type is for syscalls, which return an int and require no input. typedef int(*sc_iv)(void); // the following type is for syscalls, which return an int and require an int-pointer as input (like GetKey). typedef int(*sc_ipi)(int*); // example 1 const unsigned int sc0998[] = { SCA, SCB, SCE, 0x0998 }; #define App_DYNA (*(sc_iv)sc0998) // now you could use App_DYNA(); // to call the built-in DYNA. // or // example 2 const unsigned int sc090F[] = { SCA, SCB, SCE, 0x090F }; #define GetKey (*(sc_ipi)sc090F) // to call GetKey( &key );for reference:
this are the assembler instructions, which represent the int arrays of the type
"const unsigned int scSyscallNo[] = { SCA, SCB, SCE, SyscallNo };"
mov.l #h'80010070, r2 mov.l #SyscallNo, r0 jmp @r2 nop