#include <syscall.h>

void syscall_bdisp_allclr_ddvram(cpu_status_t* status){
    for(int i=0; i< 1024;i++){
        status->vram[i] = 0;
    }
    display_clear(status->display);
}

void syscall_bdisp_putdisp_dd(cpu_status_t* status){
    display_update(status->display,status);
}

void syscall_get_vram_address(cpu_status_t* status){
    status->r[0]=0x01100000;
}

void syscall_save_disp(cpu_status_t* status){
    if(status->r[4] == 1) memcpy(status->saved_disps[0],status->vram,1024);
    if(status->r[4] == 5) memcpy(status->saved_disps[1],status->vram,1024);
    if(status->r[4] == 6) memcpy(status->saved_disps[2],status->vram,1024);
}

void syscall_restore_disp(cpu_status_t* status){
    if(status->r[4] == 1) memcpy(status->vram ,status->saved_disps[0],1024);
    if(status->r[4] == 5) memcpy(status->vram ,status->saved_disps[1],1024);
    if(status->r[4] == 6) memcpy(status->vram ,status->saved_disps[2],1024);
}

void syscall_bdisp_allclr_vram(cpu_status_t* status){
    for(int i=0; i< 1024;i++){
        status->vram[i] = 0;
    }
}