os-z80/kernel/syscalls.z80
2023-02-03 09:24:28 -06:00

43 lines
537 B
Z80 Assembly

.global syscall
syscall:
push af
push ix
sla a
ld ix, syscall_table
add a, ixl
ld ixl, a
ld a, (ix+0)
ld (syscall_jump+1), a
ld a, (ix+1)
ld (syscall_jump+2), a
pop ix
pop af
syscall_jump: jp 0x0
print:
ld a, (hl)
cp 0
ret z
ld bc, 0x200
out (c), a
inc hl
jp print
gff:
.align 8
syscall_table:
.dc.w print ; 0
.dc.w get_free_frame ; 1
.dc.w set_frame ; 2
.dc.w new_process ; 3
.dc.w yield ; 4
.dc.w mb_send ; 5
.dc.w mb_read ; 6
.dc.w get_free_mailbox ; 7
.dc.w proc_map_set ; 8
.dc.w proc_map_load ; 9
.dc.w find_first_card ; 10