nemu/src/syscall/text.c

27 lines
621 B
C

#include <syscall.h>
#include <display.h>
#include <math.h>
void syscall_locate(cpu_status_t* status){
int x = status->r[4];
int y = status->r[5];
status->cursor_x = (x-1)*6;
status->cursor_y = (y-1)*8;
}
void syscall_print(cpu_status_t* status){
int i = 0;
while(1){
int c = cpu_read8(status, status->r[4]+i);
printf("%c",c);
int e = floor((status->cursor_y*128+status->cursor_x+i*6)/8);
status->vram[e] = 0b10000000;
i++;
if(c == 0x00){
printf("\n");
break;
}
}
display_update(status->display, status);
}