From fa30f39d553814228755556da3ffa6bd760d5292 Mon Sep 17 00:00:00 2001 From: Henrik Hautakoski Date: Sun, 28 Oct 2018 14:23:01 +0100 Subject: [PATCH] src/syscall: define write system call --- src/syscall.c | 9 ++++++++- src/syscall.h | 6 +++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/syscall.c b/src/syscall.c index 5f4207f..0378772 100644 --- a/src/syscall.c +++ b/src/syscall.c @@ -20,7 +20,14 @@ #include #include "syscall.h" -void syscall_write(int16_t value, int8_t op) { +void vm_syscall(int16_t number, int8_t op, uint16_t* regs) { + + if (number == SYS_WRITE) { + vm_syscall_write(op, regs[15]); + } +} + +void vm_syscall_write(int8_t op, int16_t value) { switch(op) { case SYSW_INT16 : diff --git a/src/syscall.h b/src/syscall.h index ced4461..0c64bd6 100644 --- a/src/syscall.h +++ b/src/syscall.h @@ -23,10 +23,14 @@ #include +#define SYS_WRITE 10 + #define SYSW_INT16 0x0 #define SYSW_INT8 0x1 #define SYSW_CHAR 0x2 -void syscall_write(int16_t value, int8_t op); +void vm_syscall(int16_t number, int8_t op, uint16_t* regs); + +void vm_syscall_write(int8_t op, int16_t value); #endif /* SYSCALL_H */