1
0
Fork 0
mirror of https://github.com/pnx/m16vm synced 2026-06-16 03:44:55 +02:00

src/syscall: define write system call

This commit is contained in:
Henrik Hautakoski 2018-10-28 14:23:01 +01:00
parent 837bd8f892
commit fa30f39d55
No known key found for this signature in database
GPG key ID: 839F3A7EAFAEAFAA
2 changed files with 13 additions and 2 deletions

View file

@ -20,7 +20,14 @@
#include <stdio.h>
#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 :

View file

@ -23,10 +23,14 @@
#include <stdint.h>
#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 */