mirror of
https://github.com/DavidBuchanan314/6502-emu.git
synced 2025-01-13 09:30:00 +00:00
Added -f flag to step through emulation at max possible speed (i.e. without the delay loop)
This commit is contained in:
parent
649b7f8349
commit
a25ad398e8
14
6502-emu.c
14
6502-emu.c
@ -19,7 +19,7 @@ void step_delay()
|
||||
nanosleep(&req, &rem);
|
||||
}
|
||||
|
||||
void run_cpu(long cycle_stop, int verbose, int mem_dump, int break_pc)
|
||||
void run_cpu(long cycle_stop, int verbose, int mem_dump, int break_pc, int fast)
|
||||
{
|
||||
long cycles = 0;
|
||||
int cycles_per_step = (CPU_FREQ / (ONE_SECOND / STEP_DURATION));
|
||||
@ -37,7 +37,7 @@ void run_cpu(long cycle_stop, int verbose, int mem_dump, int break_pc)
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
step_delay(); // remove this for more speed
|
||||
if (!fast) step_delay();
|
||||
}
|
||||
end:
|
||||
return;
|
||||
@ -70,7 +70,7 @@ int hextoint(char *str) {
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int a, x, y, sp, sr, pc, load_addr;
|
||||
int verbose, interactive, mem_dump, break_pc;
|
||||
int verbose, interactive, mem_dump, break_pc, fast;
|
||||
long cycles;
|
||||
int opt;
|
||||
|
||||
@ -80,13 +80,14 @@ int main(int argc, char *argv[])
|
||||
cycles = 0;
|
||||
load_addr = 0xC000;
|
||||
break_pc = -1;
|
||||
fast = 0;
|
||||
a = 0;
|
||||
x = 0;
|
||||
y = 0;
|
||||
sp = 0;
|
||||
sr = 0;
|
||||
pc = -RST_VEC; // negative implies indirect
|
||||
while ((opt = getopt(argc, argv, "vima:b:x:y:r:p:s:g:c:l:")) != -1) {
|
||||
while ((opt = getopt(argc, argv, "vimfa:b:x:y:r:p:s:g:c:l:")) != -1) {
|
||||
switch (opt) {
|
||||
case 'v':
|
||||
verbose = 1;
|
||||
@ -97,6 +98,9 @@ int main(int argc, char *argv[])
|
||||
case 'm':
|
||||
mem_dump = 1;
|
||||
break;
|
||||
case 'f':
|
||||
fast = 1;
|
||||
break;
|
||||
case 'b':
|
||||
break_pc = hextoint(optarg);
|
||||
break;
|
||||
@ -147,7 +151,7 @@ int main(int argc, char *argv[])
|
||||
init_uart();
|
||||
|
||||
reset_cpu(a, x, y, sp, sr, pc);
|
||||
run_cpu(cycles, verbose, mem_dump, break_pc);
|
||||
run_cpu(cycles, verbose, mem_dump, break_pc, fast);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user