#include <syscall.h>
#include <stdio.h>

int syscall_handle(cpu_status_t* status, uint32_t origin){
    uint32_t id = status->r[0];
    printf("\e[32mpc: %8x syscall %8x\e[39m\n", origin, (uint32_t)status->r[0]);
    if(id == 0x3fa) NULL;
    else if(id == 0x144) syscall_bdisp_allclr_ddvram(status);
    else if(id == 0x143) syscall_bdisp_allclr_vram(status);
    else if(id == 0x807) syscall_locate(status);
    else if(id == 0x808) syscall_print(status);
    else if(id == 0x135) syscall_get_vram_address(status);
    else if(id == 0xacd) syscall_malloc(status);
    else if(id == 0x90f) syscall_getkey(status);
    else if(id == 0x028) syscall_bdisp_putdisp_dd(status);
    else if(id == 0x813) syscall_save_disp(status);
    else if(id == 0x814) syscall_restore_disp(status);
    status->pc = status->pr;
}