diff options
author | Mike Pavone <pavone@retrodev.com> | 2013-06-11 23:10:33 -0700 |
---|---|---|
committer | Mike Pavone <pavone@retrodev.com> | 2013-06-11 23:10:33 -0700 |
commit | 3e255b7a16a1fc3e5c1259ece508639a578fee06 (patch) | |
tree | cd6a1841011bc301ac8d86f18158ee8fd24a65b2 | |
parent | 5a8394fa5da42c6a9a5f12610cd1985268cb18db (diff) |
Add debugger command for saving Z80 RAM to a file
-rw-r--r-- | blastem.c | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -518,6 +518,9 @@ m68k_context * io_write(uint32_t location, m68k_context * context, uint8_t value } else { ym_address_write_part1(gen->ym, value); } + } else { + printf("68K write to unhandled Z80 address %X\n", location); + exit(1); } } } else { @@ -1429,6 +1432,23 @@ z80_context * zdebugger(z80_context * context, uint16_t address) puts("Quitting"); exit(0); break; + case 's': { + param = find_param(input_buf); + if (!param) { + fputs("s command requires a file name\n", stderr); + break; + } + FILE * f = fopen(param, "wb"); + if (f) { + if(fwrite(z80_ram, 1, sizeof(z80_ram), f) != sizeof(z80_ram)) { + fputs("Error writing file\n", stderr); + } + fclose(f); + } else { + fprintf(stderr, "Could not open %s for writing\n", param); + } + break; + } default: fprintf(stderr, "Unrecognized debugger command %s\n", input_buf); break; |