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

Added -w and -a options to run6502

This commit is contained in:
Curtis F Kaylor 2021-09-25 14:01:44 -04:00
parent 71fa944e55
commit af46a68f26

View File

@ -382,8 +382,21 @@ static int doSave(int argc, char **argv, M6502 *mpu) /* -l addr size file */
return 3;
}
static int doArgs(int argc, char **argv, M6502 *mpu) /* -a addr */
{
int addr = htol(argv[1]);
int size = strlen(argv[2]);
int quoted = 0;
char *s = malloc(size);
strcpy(s, argv[2]);
for(int i=0; i<size; i++) {
if (s[i] == '\'') quoted = !quoted;
else if (!quoted && s[i]==' ') s[i] = 0;
}
write(mpu, addr, size, s);
return 2;
return 1;
}
@ -391,9 +404,9 @@ static int doWrite(int argc, char **argv, M6502 *mpu) /* -a addr "string" */
{
int addr = htol(argv[1]);
int size = strlen(argv[2]);
char *args = malloc(size);
strcpy(args, argv[1]);
write(mpu, addr, size, args);
char *s = malloc(size);
strcpy(s, argv[2]);
write(mpu, addr, size, s);
return 2;
}