mirror of
https://github.com/pevans/erc-c.git
synced 2025-02-07 03:30:28 +00:00
Add hidump, hires_dump commands
This commit is contained in:
parent
64afcb2040
commit
64306fa5a6
@ -5,5 +5,6 @@
|
|||||||
#include "vm_bits.h"
|
#include "vm_bits.h"
|
||||||
|
|
||||||
extern void apple2_hires_draw(apple2 *, int);
|
extern void apple2_hires_draw(apple2 *, int);
|
||||||
|
extern void apple2_hires_dump(apple2 *, FILE *);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -82,6 +82,7 @@ extern DEBUG_CMD(dblock);
|
|||||||
extern DEBUG_CMD(disasm);
|
extern DEBUG_CMD(disasm);
|
||||||
extern DEBUG_CMD(hdump);
|
extern DEBUG_CMD(hdump);
|
||||||
extern DEBUG_CMD(help);
|
extern DEBUG_CMD(help);
|
||||||
|
extern DEBUG_CMD(hidump);
|
||||||
extern DEBUG_CMD(jump);
|
extern DEBUG_CMD(jump);
|
||||||
extern DEBUG_CMD(printaddr);
|
extern DEBUG_CMD(printaddr);
|
||||||
extern DEBUG_CMD(printstate);
|
extern DEBUG_CMD(printstate);
|
||||||
|
@ -705,3 +705,47 @@ apple2_hires_draw(apple2 *mach, int row)
|
|||||||
prev = curr;
|
prev = curr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
apple2_hires_dump(apple2 *mach, FILE *stream)
|
||||||
|
{
|
||||||
|
int row, col, base, bit;
|
||||||
|
char dotsym;
|
||||||
|
vm_8bit byte;
|
||||||
|
|
||||||
|
fprintf(stream, "HIRES DUMP\n\nBytes:\n");
|
||||||
|
|
||||||
|
for (row = 0; row < 192; row++) {
|
||||||
|
base = addresses[row];
|
||||||
|
|
||||||
|
fprintf(stream, "%3d [", row);
|
||||||
|
|
||||||
|
for (col = 0; col < 40; col++) {
|
||||||
|
fprintf(stream, "%02X", mos6502_get(mach->cpu, base + col));
|
||||||
|
|
||||||
|
if (col < 39) {
|
||||||
|
fprintf(stream, " ");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf(stream, "]\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf(stream, "\nDots:\n");
|
||||||
|
|
||||||
|
for (row = 0; row < 192; row++) {
|
||||||
|
base = addresses[row];
|
||||||
|
|
||||||
|
fprintf(stream, "%3d [", row);
|
||||||
|
|
||||||
|
for (col = 0; col < 40; col++) {
|
||||||
|
byte = mos6502_get(mach->cpu, base + col);
|
||||||
|
dotsym = (byte & 0x80) ? '#' : '%';
|
||||||
|
for (bit = 0; bit < 7; bit++) {
|
||||||
|
fprintf(stream, "%c", ((byte >> bit) & 1) ? dotsym : '_');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf(stream, "]\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
|
|
||||||
#include "apple2.h"
|
#include "apple2.h"
|
||||||
|
#include "apple2.hires.h"
|
||||||
#include "mos6502.h"
|
#include "mos6502.h"
|
||||||
#include "mos6502.dis.h"
|
#include "mos6502.dis.h"
|
||||||
#include "vm_debug.h"
|
#include "vm_debug.h"
|
||||||
@ -43,6 +44,8 @@ vm_debug_cmd cmdtable[] = {
|
|||||||
"Print out this list of commands", },
|
"Print out this list of commands", },
|
||||||
{ "hdump", "hd", vm_debug_cmd_hdump, 2, "<from> <to>",
|
{ "hdump", "hd", vm_debug_cmd_hdump, 2, "<from> <to>",
|
||||||
"Hex dump memory in a given region", },
|
"Hex dump memory in a given region", },
|
||||||
|
{ "hidump", "hid", vm_debug_cmd_hidump, 1, "<file>",
|
||||||
|
"Dump hires graphics memory to file", },
|
||||||
{ "jump", "j", vm_debug_cmd_jump, 1, "<addr>",
|
{ "jump", "j", vm_debug_cmd_jump, 1, "<addr>",
|
||||||
"Jump to <addr> for next execution", },
|
"Jump to <addr> for next execution", },
|
||||||
{ "printaddr", "pa", vm_debug_cmd_printaddr, 1, "<addr>",
|
{ "printaddr", "pa", vm_debug_cmd_printaddr, 1, "<addr>",
|
||||||
@ -245,13 +248,8 @@ vm_debug_execute(const char *str)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
args.addr1 = vm_debug_addr(vm_debug_next_arg(&ebuf));
|
args.target = vm_debug_next_arg(&ebuf);
|
||||||
|
args.addr1 = vm_debug_addr(args.target);
|
||||||
// Oh no
|
|
||||||
if (args.addr1 == -1) {
|
|
||||||
free(orig);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -471,3 +469,18 @@ DEBUG_CMD(hdump)
|
|||||||
|
|
||||||
vm_segment_hexdump(cpu->rmem, stream, args->addr1, args->addr2);
|
vm_segment_hexdump(cpu->rmem, stream, args->addr1, args->addr2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEBUG_CMD(hidump)
|
||||||
|
{
|
||||||
|
FILE *stream;
|
||||||
|
|
||||||
|
stream = fopen(args->target, "w");
|
||||||
|
if (stream == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
apple2 *mach = (apple2 *)vm_di_get(VM_MACHINE);
|
||||||
|
apple2_hires_dump(mach, stream);
|
||||||
|
|
||||||
|
fclose(stream);
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user