mirror of
https://github.com/RevCurtisP/C02.git
synced 2024-11-28 10:51:14 +00:00
Added -w and -a options to run6502
This commit is contained in:
parent
71fa944e55
commit
af46a68f26
@ -382,8 +382,21 @@ static int doSave(int argc, char **argv, M6502 *mpu) /* -l addr size file */
|
|||||||
return 3;
|
return 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static int doArgs(int argc, char **argv, M6502 *mpu) /* -a addr */
|
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;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -391,9 +404,9 @@ static int doWrite(int argc, char **argv, M6502 *mpu) /* -a addr "string" */
|
|||||||
{
|
{
|
||||||
int addr = htol(argv[1]);
|
int addr = htol(argv[1]);
|
||||||
int size = strlen(argv[2]);
|
int size = strlen(argv[2]);
|
||||||
char *args = malloc(size);
|
char *s = malloc(size);
|
||||||
strcpy(args, argv[1]);
|
strcpy(s, argv[2]);
|
||||||
write(mpu, addr, size, args);
|
write(mpu, addr, size, s);
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user