1
1

Add emul_memdump() and stop automatically on ROM write

Dieser Commit ist enthalten in:
Virgil Dupras 2020-04-09 08:26:41 -04:00
Ursprung 6f082b0b13
Commit b69ca4488e
3 geänderte Dateien mit 13 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -41,6 +41,9 @@ static void mem_write(int unused, uint16_t addr, uint8_t val)
{
if (addr < m.ramstart) {
fprintf(stderr, "Writing to ROM (%d)!\n", addr);
emul_memdump();
fprintf(stderr, "Press any key to continue...\n");
while (getchar() > 0x100);
}
m.mem[addr] = val;
}
@ -102,6 +105,14 @@ void emul_trace(ushort addr)
}
}
void emul_memdump()
{
fprintf(stderr, "Dumping memory to memdump. PC %04x\n", m.cpu.PC);
FILE *fp = fopen("memdump", "w");
fwrite(m.mem, 0x10000, 1, fp);
fclose(fp);
}
void emul_printdebug()
{
fprintf(stderr, "Min SP: %04x\n", m.minsp);

Datei anzeigen

@ -31,4 +31,5 @@ bool emul_step();
bool emul_steps(unsigned int steps);
void emul_loop();
void emul_trace(ushort addr);
void emul_memdump();
void emul_printdebug();

Datei anzeigen

@ -102,10 +102,7 @@ int main(int argc, char *argv[])
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);
emul_memdump();
c = 0; // don't send to RC2014
}
if (c == 4) { // CTRL+D