diff --git a/emul/hw/rc2014/README.md b/emul/hw/rc2014/README.md index 2cef11f..d4ac64b 100644 --- a/emul/hw/rc2014/README.md +++ b/emul/hw/rc2014/README.md @@ -9,3 +9,7 @@ Run `make` to build. Run `./classic /path/to/rom` (for example, `os.bin` from RC2014's recipe). Serial I/O is hooked to stdin/stdout. `CTRL+D` to quit. + +## Memory dump + +You can press `CTRL+E` to dump the whole 64K of memory into `memdump`. diff --git a/emul/hw/rc2014/classic.c b/emul/hw/rc2014/classic.c index 1f58e49..561c259 100644 --- a/emul/hw/rc2014/classic.c +++ b/emul/hw/rc2014/classic.c @@ -101,6 +101,13 @@ int main(int argc, char *argv[]) if (!tosend) { char c; if (read(fileno(stdin), &c, 1) == 1) { + if (c == 5) { + fprintf(stderr, "Dumping memory to memdump\n"); + FILE *fp = fopen("memdump", "w"); + fwrite(m->mem, 0x10000, 1, fp); + fclose(fp); + c = 0; // don't send to RC2014 + } if (c == 4) { // CTRL+D // Stop here break;