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; }