From 083c83ee9492b593a8508998b0c1ac4ea917d3c3 Mon Sep 17 00:00:00 2001 From: Curtis F Kaylor Date: Mon, 21 Sep 2020 20:01:43 -0400 Subject: [PATCH] Modified run6502 File Open to pass mode in X --- lib6502/run6502.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib6502/run6502.c b/lib6502/run6502.c index 4ba8a0a..a7594c0 100644 --- a/lib6502/run6502.c +++ b/lib6502/run6502.c @@ -444,12 +444,14 @@ static int seterror(int chan) { /* Set File Name */ static int setname(M6502 *mpu, word addr, char *name) { int i; + if (DEBUG) fprintf(stderr, "copying name from address $%04x\n", addr); for (i=0; imemory[addr + i & 0xFFFF]; if (c) name[i] = c; else break; } name[i] = 0; //Terminate String + if (DEBUG) fprintf(stderr, "copied %d characters\n", i); return i; } @@ -619,8 +621,8 @@ static int fTrap(M6502 *mpu, word addr, byte data) { x = setname(mpu, yx, filename); //Set filename and Return Length if (DEBUG) fprintf(stderr, "filename set to '%s'\n", filename); break; - case 'O': //Open file - Y = mode - strcpy(mode, modes[y>>7]); + case 'O': //Open file - Y = Drive#, X = Mode (0x80 = Write) + strcpy(mode, modes[x >> 7]); //Set Mode based on Negative Flag x = 0; //File channel (none) y = 0; //Error code (none) chan = uniocb(); if (chan <0) {y = -chan; break;}