From c4372853bd3af9cebd8f7cdc5cb48cea0b59e3ad Mon Sep 17 00:00:00 2001 From: Daniel Loffgren Date: Sat, 19 Dec 2015 23:43:16 +0000 Subject: [PATCH] Added freeze/restore debug command handlers to the debugger git-svn-id: svn+ssh://svn.phoenixbox.net/svn/apple1/trunk@75 64f78de7-aa59-e511-a0e8-0002a5492df0 --- apple1/main.c | 22 ++++++++++++++++++++++ apple1/pia.c | 4 ++++ 2 files changed, 26 insertions(+) diff --git a/apple1/main.c b/apple1/main.c index f352fa8..45e98e1 100644 --- a/apple1/main.c +++ b/apple1/main.c @@ -155,6 +155,8 @@ int main(int argc, const char * argv[]) if (v6502_compareDebuggerCommand(command, commandLen, "help")) { printf("woz Print relevant woz monitor parameters and registers.\n"); printf("nonstop Read or toggle nonstop mode. Nonstop mode is considerably less efficient, but may be required for some software that expects runtime to continue while simultaneously waiting for keyboard input.\n"); + printf("freeze Dump the entire contents of memory, and the current cpu state, into a file for later loading.\n"); + printf("restore Restore memory and cpu state from a freeze file.\n"); } continue; } @@ -189,6 +191,26 @@ int main(int argc, const char * argv[]) // printf("Currently set to %d", continuousMode); // } } + else if (v6502_compareDebuggerCommand(command, commandLen, "freeze")) { + command = trimheadtospc(command, commandLen); + + if(command[0]) { + saveFreeze(pia, command); + } + else { + printf("A filename is required to save freeze.\n"); + } + } + else if (v6502_compareDebuggerCommand(command, commandLen, "restore")) { + command = trimheadtospc(command, commandLen); + + if(command[0]) { + loadFreeze(pia, command); + } + else { + printf("A filename is required to load freeze.\n"); + } + } else if (command[0] != ';') { currentLineText = command; as6502_executeAsmLineOnCPU(cpu, command, strlen(command)); diff --git a/apple1/pia.c b/apple1/pia.c index 6b3f6ad..e914281 100644 --- a/apple1/pia.c +++ b/apple1/pia.c @@ -33,6 +33,10 @@ void saveFreeze(a1pia *pia, const char *fname) { fclose(f); } +void loadFreeze(a1pia *pia, const char *fname) { + // TODO: implement me +} + char asciiCharFromCursesKey(int key) { return (char)key; }