Mercurial > repos > blastem
comparison blastem.c @ 395:0b5f93358a93
Add debugger command for saving Z80 RAM to a file
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Tue, 11 Jun 2013 23:10:33 -0700 |
parents | 1b80b90399da |
children | c26e48a93fa3 |
comparison
equal
deleted
inserted
replaced
394:d5f1840273b5 | 395:0b5f93358a93 |
---|---|
516 } else if(location & 2) { | 516 } else if(location & 2) { |
517 ym_address_write_part2(gen->ym, value); | 517 ym_address_write_part2(gen->ym, value); |
518 } else { | 518 } else { |
519 ym_address_write_part1(gen->ym, value); | 519 ym_address_write_part1(gen->ym, value); |
520 } | 520 } |
521 } else { | |
522 printf("68K write to unhandled Z80 address %X\n", location); | |
523 exit(1); | |
521 } | 524 } |
522 } | 525 } |
523 } else { | 526 } else { |
524 location &= 0x1FFF; | 527 location &= 0x1FFF; |
525 if (location < 0x100) { | 528 if (location < 0x100) { |
1427 break; | 1430 break; |
1428 case 'q': | 1431 case 'q': |
1429 puts("Quitting"); | 1432 puts("Quitting"); |
1430 exit(0); | 1433 exit(0); |
1431 break; | 1434 break; |
1435 case 's': { | |
1436 param = find_param(input_buf); | |
1437 if (!param) { | |
1438 fputs("s command requires a file name\n", stderr); | |
1439 break; | |
1440 } | |
1441 FILE * f = fopen(param, "wb"); | |
1442 if (f) { | |
1443 if(fwrite(z80_ram, 1, sizeof(z80_ram), f) != sizeof(z80_ram)) { | |
1444 fputs("Error writing file\n", stderr); | |
1445 } | |
1446 fclose(f); | |
1447 } else { | |
1448 fprintf(stderr, "Could not open %s for writing\n", param); | |
1449 } | |
1450 break; | |
1451 } | |
1432 default: | 1452 default: |
1433 fprintf(stderr, "Unrecognized debugger command %s\n", input_buf); | 1453 fprintf(stderr, "Unrecognized debugger command %s\n", input_buf); |
1434 break; | 1454 break; |
1435 } | 1455 } |
1436 } | 1456 } |