1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2025-01-05 02:30:56 +00:00

Prepare universal I/O for PLVM

This commit is contained in:
David Schmenk 2024-08-21 15:10:32 -07:00
parent 93fc68b736
commit 88981cfd4f
4 changed files with 55 additions and 34 deletions

View File

@ -192,8 +192,8 @@ $(DRAWL): lisp/s-expr.pla lisp/drawl.pla
vmsrc/lib6502/lib6502.a: vmsrc/lib6502/lib6502.h vmsrc/lib6502/lib6502.c
make -C vmsrc/lib6502
$(PLVM): vmsrc/plvm.c vmsrc/cmdsys.c vmsrc/lib6502/lib6502.a
cc vmsrc/plvm.c vmsrc/cmdsys.c vmsrc/lib6502/lib6502.a -o $(PLVM)
$(PLVM): vmsrc/plvm.c vmsrc/cmdsys.c vmsrc/sysio.c vmsrc/lib6502/lib6502.a
cc vmsrc/plvm.c vmsrc/cmdsys.c vmsrc/sysio.c vmsrc/lib6502/lib6502.a -o $(PLVM)
$(PLVMZP_APL): FORCE
-mkdir -p rel
@ -265,7 +265,7 @@ test: samplesrc/test.pla samplesrc/testlib.pla $(PLVM) $(PLASM)
acme --setpc 4094 -o $(TEST) samplesrc/test.a
./$(PLASM) -AMOW samplesrc/testlib.pla
acme --setpc 4094 -o $(TESTLIB) samplesrc/testlib.a
./$(PLVM) test.mod
./$(PLVM) test
$(ED): toolsrc/ed.pla $(PLVM02) $(PLASM) toolsrc/ed.pla
./$(PLASM) -AMOW toolsrc/ed.pla

View File

@ -491,8 +491,8 @@ int load_mod(M6502 *mpu, byte *mod)
char filename[128], string[17];
dcitos(mod, filename);
printf("Load module %s\n", filename);
if (strlen(filename) > 4 && (filename[strlen(filename) - 4] != '.'))
if (trace) printf("Load module %s\n", filename);
if (strlen(filename) < 4 || (filename[strlen(filename) - 4] != '.'))
strcat(filename, ".mod");
fd = open(filename, O_RDONLY, 0);
if (fd <= 0 && filename[0] != '/' && strlen(filename) < 17)
@ -770,38 +770,9 @@ int load_mod(M6502 *mpu, byte *mod)
/*
* Native CMDSYS routines
*/
int vm_syscall(M6502 *mpu, uword address, byte data)
{
return address + 1;
}
void syscall6502(M6502 *mpu)
{
uword params;
byte cmd, status;
PULL_ESTK(params);
PULL_ESTK(cmd);
status = 0;
switch (cmd)
{
}
PUSH_ESTK(status);
}
void sysexecmod(M6502 *mpu)
{
}
void sysopen(M6502 *mpu)
{
}
void sysclose(M6502 *mpu)
{
}
void sysread(M6502 *mpu)
{
}
void syswrite(M6502 *mpu)
{
}
void syslookuptbl(M6502 *mpu)
{
uword sym, addr;

View File

@ -113,3 +113,13 @@ extern int vm_iidef(M6502 *mpu, uword address, byte data);
extern int vm_exdef(M6502 *mpu, uword address, byte data);
extern int vm_natvdef(M6502 *mpu, uword address, byte data);
extern void vm_interp(M6502 *mpu, code *vm_ip);
/*
* System I/O routines
*/
extern void sysio_init(void);
extern void syscall6502(M6502 *mpu);
extern void sysopen(M6502 *mpu);
extern void sysclose(M6502 *mpu);
extern void sysread(M6502 *mpu);
extern void syswrite(M6502 *mpu);

40
src/vmsrc/sysio.c Normal file
View File

@ -0,0 +1,40 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <ctype.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <termios.h>
#include "plvm.h"
void syscall6502(M6502 *mpu)
{
uword params;
byte cmd, status;
PULL_ESTK(params);
PULL_ESTK(cmd);
status = 0;
switch (cmd)
{
}
PUSH_ESTK(status);
}
void sysopen(M6502 *mpu)
{
}
void sysclose(M6502 *mpu)
{
}
void sysread(M6502 *mpu)
{
}
void syswrite(M6502 *mpu)
{
}
void sysio_init(void)
{
}