1
0
mirror of https://github.com/RevCurtisP/C02.git synced 2024-11-25 06:31:25 +00:00

Modified run6502 File Open to pass mode in X

This commit is contained in:
Curtis F Kaylor 2020-09-21 20:01:43 -04:00
parent 17e487d4a5
commit 083c83ee94

View File

@ -444,12 +444,14 @@ static int seterror(int chan) {
/* Set File Name */ /* Set File Name */
static int setname(M6502 *mpu, word addr, char *name) { static int setname(M6502 *mpu, word addr, char *name) {
int i; int i;
if (DEBUG) fprintf(stderr, "copying name from address $%04x\n", addr);
for (i=0; i<STRLEN; i++) { for (i=0; i<STRLEN; i++) {
char c = mpu->memory[addr + i & 0xFFFF]; char c = mpu->memory[addr + i & 0xFFFF];
if (c) name[i] = c; if (c) name[i] = c;
else break; else break;
} }
name[i] = 0; //Terminate String name[i] = 0; //Terminate String
if (DEBUG) fprintf(stderr, "copied %d characters\n", i);
return 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 x = setname(mpu, yx, filename); //Set filename and Return Length
if (DEBUG) fprintf(stderr, "filename set to '%s'\n", filename); if (DEBUG) fprintf(stderr, "filename set to '%s'\n", filename);
break; break;
case 'O': //Open file - Y = mode case 'O': //Open file - Y = Drive#, X = Mode (0x80 = Write)
strcpy(mode, modes[y>>7]); strcpy(mode, modes[x >> 7]); //Set Mode based on Negative Flag
x = 0; //File channel (none) x = 0; //File channel (none)
y = 0; //Error code (none) y = 0; //Error code (none)
chan = uniocb(); if (chan <0) {y = -chan; break;} chan = uniocb(); if (chan <0) {y = -chan; break;}