commit 122a51b65051fe6df64614562e80b910198be5bf
parent ca3c2f0f1666282ff9d4bb42d9bb935035f2d4ca
Author: Martin Kloeckner <mjkloeckner@gmail.com>
Date: Sun, 12 Oct 2025 19:07:53 -0300
put `0x` prefix on hex values
Diffstat:
| M | 6502.c | | | 19 | ++++++++++--------- |
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/6502.c b/6502.c
@@ -135,20 +135,21 @@ void print_reg(uint8_t reg) {
putchar((reg & (0x01 << (i - 1))) ? '1' : '0');
putchar(' ');
}
- putchar('\n');
}
void CPU_dump(void) {
INS aux = decode[MEM_read(cpu.pc)];
- printf(" a: %02X (%3d) N V - B D I Z C\n"
- " x: %02X (%3d) ", cpu.ac, cpu.ac, cpu.x, cpu.x);
+ printf("+--------------------------------------------+\n");
+ printf("| A: 0x%02X (%03d) N V - B D I Z C |\n"
+ "| X: 0x%02X (%03d) ", cpu.ac, cpu.ac, cpu.x, cpu.x);
print_reg(cpu.st);
- printf(" y: %02X (%3d)\n"
- " sp: %02X\n"
- " pc: %04X -> %02X (%s)(%s)\n"
- "\033[5A", cpu.y, cpu.y, cpu.sp, cpu.pc, mem.ram[cpu.pc], aux.name,
- CPU_mode_name(aux.mode));
+ printf("|\n");
+ printf("| Y: 0x%02X (%03d) |\n"
+ "| SP: 0x%02X (%03d) |\n"
+ "| PC: 0x%04X -> 0x%02X (%s) |\n",
+ cpu.y, cpu.y, cpu.sp, cpu.sp, cpu.pc, mem.ram[cpu.pc], aux.name);
+ printf("+--------------------------------------------+\n\033[7A");
}
uint16_t CPU_get_pc(void) {
@@ -175,7 +176,7 @@ int MEM_load_from_file(char *path) {
fp = fopen(path, "rb");
if(fp == NULL) {
- fprintf(stderr, "ERROR: file \"%s\" not found.\n", path);
+ fprintf(stderr, "[ERROR]: file \"%s\" not found.\n", path);
return 2;
}