Difference between revisions of "Syscalls"

From Casio Universal Wiki
Jump to: navigation, search
(Created page with "The system call documentation can be download here[http://www.casiopeia.net/forum/downloads.php?view=detail&df_id=72]. To use system calls in the official SDK, you can either...")
 
 
Line 1: Line 1:
The system call documentation can be download here[http://www.casiopeia.net/forum/downloads.php?view=detail&df_id=72].
+
The system call documentation can be downloaded here[http://www.casiopeia.net/forum/downloads.php?view=detail&df_id=72].
  
 
To use system calls in the official SDK, you can either use instant the system call implementation or a .src-file.
 
To use system calls in the official SDK, you can either use instant the system call implementation or a .src-file.
Line 10: Line 10:
  
 
=== Instant system call implementation ===
 
=== Instant system call implementation ===
 +
Source [http://www.casiopeia.net/forum/viewtopic.php?f=20&t=1376]
 
<pre>
 
<pre>
 
// the following definitions are only needed once
 
// the following definitions are only needed once

Latest revision as of 11:02, April 6, 2013

The system call documentation can be downloaded here[1].

To use system calls in the official SDK, you can either use instant the system call implementation or a .src-file.

The effect of both implementations is the same, these asm lines are generated:

mov.l   #h'80010070, r2
mov.l   #SyscallNo, r0
jmp     @r2
nop

Instant system call implementation

Source [2]

// the following definitions are only needed once
#define SCA 0xD201D002
#define SCB 0x422B0009
#define SCE 0x80010070
// 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 );