1
0
mirror of https://github.com/dschmenk/PLASMA.git synced 2026-04-19 09:23:06 +00:00

Fix STRCAT - can load 4th scripts fro sys/scripts

This commit is contained in:
David Schmenk
2024-08-24 15:49:38 -07:00
parent 2cb60895b8
commit 0cdcb66888
2 changed files with 11 additions and 6 deletions
+8 -3
View File
@@ -492,7 +492,6 @@ int load_mod(M6502 *mpu, byte *mod)
char filename[128], string[17];
dcitos(mod, filename);
if (trace) printf("Load module %s\n", filename);
/*
if (strlen(filename) < 4 || (filename[strlen(filename) - 4] != '.'))
strcat(filename, ".mod");
@@ -508,6 +507,7 @@ int load_mod(M6502 *mpu, byte *mod)
strcat(filename, string);
fd = open(filename, O_RDONLY, 0);
}
if (trace) printf("Load module %s: %d\n", filename, fd);
if ((fd > 0) && (len = read(fd, header, 128)) > 0)
{
moddep = header + 1;
@@ -789,11 +789,16 @@ void sysexecmod(M6502 *mpu)
void syslookuptbl(M6502 *mpu)
{
uword sym, addr;
char symbol[32];
PULL_ESTK(sym);
addr = lookup_sym(mem_6502 + sym);
PUSH_ESTK(addr);
if (trace) printf("LOOKUPSYM\n");
/*if (trace)*/
{
dcitos(mem_6502 + sym, symbol);
printf("LOOKUPSYM: %s => $%04X\n", symbol, addr);
}
}
void syscall6502(M6502 *mpu)
{
@@ -831,7 +836,7 @@ void sysstrcat(M6502 *mpu)
uword src, dst;
PULL_ESTK(src);
PULL_ESTK(dst);
memcpy(mem_6502 + dst + mem_6502[dst] + 1, mem_6502 + src + 1, mem_6502[src] - 1);
memcpy(mem_6502 + dst + mem_6502[dst] + 1, mem_6502 + src + 1, mem_6502[src]);
mem_6502[dst] += mem_6502[src];
PUSH_ESTK(dst);
if (trace) printf("STRCAT\n");
+3 -3
View File
@@ -13,7 +13,7 @@
#include <termios.h>
#include "plvm.h"
char keyqueue = 0;
byte keyqueue = 0;
int nlfd[4];
char nlmask[4], nlchar[4];
/*
@@ -87,7 +87,7 @@ void syskeypressed(M6502 *mpu)
{
int n;
if (ioctl(STDIN_FILENO, FIONREAD, &n) == 0 && n > 0)
if (!(keyqueue & 0x80) && (ioctl(STDIN_FILENO, FIONREAD, &n) == 0) && (n > 0))
keyqueue = getchar() | 0x80;
PUSH_ESTK(keyqueue);
}
@@ -262,7 +262,7 @@ void sysopen(M6502 *mpu)
fd = open(filename, O_RDWR);
if (trace) printf("FILEIO:OPEN(%s): %d\n", filename, fd);
if (fd > 255) fprintf(stderr, "FILEIO:OPEN fd out of range!\n");
if (fd < 0) *perr = errno;
if (fd < 0){ fd = 0; *perr = errno;}
PUSH_ESTK(fd);
}
void sysclose(M6502 *mpu)