Syscalls - gtrxAC/gxarch GitHub Wiki

gxarch has 3 system calls for managing graphics and sound. Syscalls are done with the sys instruction. They work a bit like functions, they receive arguments given with the arg instruction. Each syscall has a numeric ID, just like instructions. There are constants for syscall IDs starting with SYS_ in common.gxs.

0 SYS_DRAW <sx> <sy> <width> <height> <x> <y> Draw

Draws a part of the tileset starting at (sx, sy) with size width × height on the screen starting at (x, y).

1 SYS_END End frame

Finishes drawing the current frame, shows it on screen, updates keyboard and mouse related registers, and waits 1/60 sec before starting to draw the next frame (60 fps).

2 SYS_SOUND <type> <freq> <sust> <decay> Play sound

Plays a sound of the specified type, frequency, sustain and delay. Frequency and time values are currently in unspecified units. There are 4 sound types, each with constants in common.gxs. There can be one sound of each type playing at the same time, giving 4 sound channels.

  • 0 SND_SQUARE
  • 1 SND_SAWTOOTH
  • 2 SND_SINE
  • 3 SND_NOISE
⚠️ **GitHub.com Fallback** ⚠️