Renaming and documentating header

This commit is contained in:
Toby Jaffey 2025-12-12 20:42:26 +00:00
parent 9880eadf4f
commit 8158ac647c
19 changed files with 305 additions and 225 deletions

View file

@ -214,8 +214,8 @@ int main(int argc, char *argv[]) {
uvm32_clearError(vmst); // allow to continue
} else {
isrunning = false;
memdump("host-ram.dump", vmst->memory, UVM32_MEMORY_SIZE);
printf("memory dumped to host-ram.dump, pc=0x%08x\n", vmst->core.pc);
memdump("host-ram.dump", uvm32_getMemory(vmst), UVM32_MEMORY_SIZE);
printf("memory dumped to host-ram.dump, pc=0x%08x\n", uvm32_getProgramCounter(vmst));
if (extram_buf != NULL) {
memdump("host-extram.dump", (uint8_t *)extram_buf, extram_len);
printf("extram dumped to host-extram.dump\n");
@ -225,41 +225,41 @@ int main(int argc, char *argv[]) {
case UVM32_EVT_SYSCALL:
switch(evt.data.syscall.code) {
case UVM32_SYSCALL_PRINTBUF: {
uvm32_evt_syscall_buf_t buf = uvm32_getbuf(vmst, &evt, ARG0, ARG1);
uvm32_slice_t buf = uvm32_arg_getbuf(vmst, &evt, ARG0, ARG1);
while(buf.len--) {
printf("%02x", *buf.ptr++);
}
} break;
case UVM32_SYSCALL_YIELD: {
// uint32_t yield_typ = uvm32_getval(vmst, &evt, ARG0);
// uint32_t yield_typ = uvm32_arg_getval(vmst, &evt, ARG0);
// printf("YIELD type=%d\n", yield_typ);
// uvm32_setval(vmst, &evt, RET, 123);
// uvm32_arg_setval(vmst, &evt, RET, 123);
} break;
case UVM32_SYSCALL_PRINT: {
const char *str = uvm32_getcstr(vmst, &evt, ARG0);
const char *str = uvm32_arg_getcstr(vmst, &evt, ARG0);
printf("%s", str);
} break;
case UVM32_SYSCALL_PRINTLN: {
const char *str = uvm32_getcstr(vmst, &evt, ARG0);
const char *str = uvm32_arg_getcstr(vmst, &evt, ARG0);
printf("%s\n", str);
} break;
case UVM32_SYSCALL_PRINTDEC:
printf("%d", uvm32_getval(vmst, &evt, ARG0));
printf("%d", uvm32_arg_getval(vmst, &evt, ARG0));
break;
case UVM32_SYSCALL_PUTC:
printf("%c", uvm32_getval(vmst, &evt, ARG0));
printf("%c", uvm32_arg_getval(vmst, &evt, ARG0));
break;
case UVM32_SYSCALL_PRINTHEX:
printf("%08x", uvm32_getval(vmst, &evt, ARG0));
printf("%08x", uvm32_arg_getval(vmst, &evt, ARG0));
break;
case UVM32_SYSCALL_MILLIS: {
uvm32_setval(vmst, &evt, RET, SDL_GetTicks());
uvm32_arg_setval(vmst, &evt, RET, SDL_GetTicks());
} break;
case UVM32_SYSCALL_GETC: {
uvm32_setval(vmst, &evt, RET, 0xFFFFFFFF);
uvm32_arg_setval(vmst, &evt, RET, 0xFFFFFFFF);
} break;
case UVM32_SYSCALL_RENDER: {
uvm32_evt_syscall_buf_t buf = uvm32_getbuf(vmst, &evt, ARG0, ARG1);
uvm32_slice_t buf = uvm32_arg_getbuf(vmst, &evt, ARG0, ARG1);
// copy into texture
void* dst;
@ -284,9 +284,9 @@ int main(int argc, char *argv[]) {
case UVM32_SYSCALL_GETKEY:
if (last_keyvalid) {
uint32_t code = (last_keypressed ? 0x80000000 : 0) | last_keyscancode;
uvm32_setval(vmst, &evt, RET, code);
uvm32_arg_setval(vmst, &evt, RET, code);
} else {
uvm32_setval(vmst, &evt, RET, 0xFFFFFFFF);
uvm32_arg_setval(vmst, &evt, RET, 0xFFFFFFFF);
}
last_keyvalid = false;
break;