summaryrefslogtreecommitdiff
path: root/emu
diff options
context:
space:
mode:
Diffstat (limited to 'emu')
-rw-r--r--emu/6522.h1
-rw-r--r--emu/emul.c19
2 files changed, 20 insertions, 0 deletions
diff --git a/emu/6522.h b/emu/6522.h
index d3bade7..27e191c 100644
--- a/emu/6522.h
+++ b/emu/6522.h
@@ -38,6 +38,7 @@ typedef struct via_6522_t
uint8_t ddrb;
uint8_t pcr;
uint8_t ier;
+ uint8_t ifr;
bool debug;
diff --git a/emu/emul.c b/emu/emul.c
index 21ab58b..7086737 100644
--- a/emu/emul.c
+++ b/emu/emul.c
@@ -81,6 +81,7 @@ static void print_help( void )
"(f) fini (continue to next rts)\n"
"(c) for continue running\n"
"(b) break to single stepping\n"
+ "(d) toggle debug output\n"
"(+) speed up\n"
"(-) speed down\n"
"(p) push the button\n"
@@ -124,6 +125,19 @@ void emul_run( emul_t *emul, int nof_steps )
case SDLK_s:
cpu_6502_run_steps( emul->cpu, 1 );
break;
+ case SDLK_d:
+ if( emul->speed < 250 ) {
+ emul->debug = !emul->debug;
+ fprintf( stderr, "debug mode is %s\n", ( emul->debug) ? "on" : "off" );
+ if( emul->debug ) {
+ emul->cpu->debug_flags |= DEBUG_STATUS;
+ } else {
+ emul->cpu->debug_flags &= ~DEBUG_STATUS;
+ }
+ } else {
+ fprintf( stderr, "enabling debug mode now not possible, CPU is too fast!\n" );
+ }
+ break;
case SDLK_EQUALS:
case SDLK_KP_EQUALS:
case SDLK_PLUS:
@@ -133,6 +147,11 @@ void emul_run( emul_t *emul, int nof_steps )
emul->speed = CPU_FREQUENCY;
}
fprintf( stderr, "CPU speed is %1.6f MHz now\n", ( (double)emul->speed / 1000000 ) );
+ if( emul->speed > 250 ) {
+ emul->debug = false;
+ emul->cpu->debug_flags &= ~DEBUG_STATUS;;
+ fprintf( stderr, "disabling debug mode because the CPU is too fast now!\n" );
+ }
break;
case SDLK_MINUS:
case SDLK_KP_MINUS: