From c5bca1ef5b742e8e325134e4583d49817d3a566a Mon Sep 17 00:00:00 2001 From: 0xmac Date: Tue, 17 Dec 2024 13:10:31 +0100 Subject: [PATCH] Added function key functions --- src/events.c | 47 +++++++++++++++++++++++++++++++++++++---------- 1 file changed, 37 insertions(+), 10 deletions(-) diff --git a/src/events.c b/src/events.c index 30a8289..382a3a8 100644 --- a/src/events.c +++ b/src/events.c @@ -5,6 +5,9 @@ extern float displayScale; extern int clocksteps; +extern uint8_t halt; +extern uint8_t showDebug; +extern uint8_t showHelp; extern void resetSystem(); extern void irq6502(); @@ -29,30 +32,54 @@ void pollEvents(sfRenderWindow *window){ break; case sfEvtKeyPressed: switch (event.key.code){ - case sfKeyEscape: + case sfKeyF1: /* Close Window or show help*/ sfRenderWindow_close(window); break; - case sfKeyF2: + + case sfKeyF2: /* Show Key Help */ + showHelp = !showHelp; + break; + + case sfKeyF3: /* Show Debug Menu */ + showDebug = !showDebug; + break; + + case sfKeyF4: /* CPU Halt */ + halt = !halt; + break; + + case sfKeyF5: /* CPU Reset */ + resetSystem(); + break; + + case sfKeyF6: /* Scale -- */ if (displayscale > 1) displayscale--; updateRenderStates(); break; - case sfKeyF3: + + case sfKeyF7: /* Scale ++ */ displayscale++; updateRenderStates(); break; - case sfKeyF5: - resetSystem(); - break; - case sfKeyF8: + + case sfKeyF8: /* CPU Singlestep */ for (int i = 0; i < clocksteps; i++) step6502(); break; - case sfKeyF12: - irq6502(); + + case sfKeyF9: /* CPU Save Snapshot */ break; - case sfKeyF11: + + case sfKeyF10: /* CPU Load recent or given snapshot */ + break; + + case sfKeyF11: /* CPU NMI */ nmi6502(); break; + case sfKeyF12: /* CPU IRQ */ + irq6502(); + break; + default: currentKey = event.key.code; break;