replace tabs with spaces to better match nestest.log
This commit is contained in:
parent
ca5a09cd94
commit
70937cd61f
63
cpu.c
63
cpu.c
@ -841,8 +841,8 @@ XAS(uint16_t arg)
|
|||||||
static void
|
static void
|
||||||
interpret(void)
|
interpret(void)
|
||||||
{
|
{
|
||||||
uint8_t op;
|
uint8_t op, spaces;
|
||||||
uint16_t arg, mem, deref;
|
uint16_t arg;
|
||||||
enum addressing_mode mode;
|
enum addressing_mode mode;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
@ -854,16 +854,13 @@ interpret(void)
|
|||||||
for (uint8_t i = 0; i < opcodes[op].bytes - 1; i++)
|
for (uint8_t i = 0; i < opcodes[op].bytes - 1; i++)
|
||||||
printf(" %02X", peek(regs.pc + i));
|
printf(" %02X", peek(regs.pc + i));
|
||||||
|
|
||||||
if (opcodes[op].unofficial) {
|
if (opcodes[op].bytes == 1)
|
||||||
if (opcodes[op].bytes == 1)
|
printf(" ");
|
||||||
printf(" ");
|
else if (opcodes[op].bytes == 2)
|
||||||
else if (opcodes[op].bytes == 2)
|
printf(" ");
|
||||||
printf(" ");
|
else if (opcodes[op].bytes == 3)
|
||||||
else if (opcodes[op].bytes == 3)
|
putchar(' ');
|
||||||
putchar(' ');
|
putchar((opcodes[op].unofficial) ? '*' : ' ');
|
||||||
putchar('*');
|
|
||||||
} else
|
|
||||||
putchar('\t');
|
|
||||||
printf("%s ", opcodes[op].name);
|
printf("%s ", opcodes[op].name);
|
||||||
|
|
||||||
mode = opcodes[op].mode;
|
mode = opcodes[op].mode;
|
||||||
@ -896,27 +893,53 @@ interpret(void)
|
|||||||
printf("($%04X) = %04X", arg, peek16(arg));
|
printf("($%04X) = %04X", arg, peek16(arg));
|
||||||
break;
|
break;
|
||||||
case AM_IND_X:
|
case AM_IND_X:
|
||||||
printf("($%02X,X) @ %02X = %04X", peek(regs.pc - 1), peek(regs.pc - 1) + regs.x, arg);
|
printf("($%02X,X) @ %02X = %04X", peek(regs.pc - 1), (peek(regs.pc - 1) + regs.x) & 0xFF, arg);
|
||||||
break;
|
break;
|
||||||
case AM_IND_Y:
|
case AM_IND_Y:
|
||||||
printf("($%02X),Y = %04X @ %04X", peek(regs.pc - 1), (uint16_t)(arg - regs.y), arg);
|
printf("($%02X),Y = %04X @ %04X", peek(regs.pc - 1), (uint16_t)(arg - regs.y), arg);
|
||||||
break;
|
break;
|
||||||
case AM_ACC:
|
case AM_ACC:
|
||||||
case AM_NONE:
|
case AM_NONE:
|
||||||
putchar('\t');
|
printf(" ");
|
||||||
break;
|
|
||||||
default:
|
|
||||||
printf("\t\t\t\t");
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
spaces = 9;
|
||||||
|
|
||||||
if (opcodes[op].memread || opcodes[op].memwrite)
|
if (opcodes[op].memread || opcodes[op].memwrite)
|
||||||
printf(" = %02X", peek(arg));
|
printf(" = %02X", peek(arg));
|
||||||
|
else
|
||||||
|
spaces += 5;
|
||||||
|
|
||||||
if (mode != AM_IND && mode != AM_ABS_X && mode != AM_ABS_Y)
|
if (mode != AM_IND && mode != AM_ABS_X && mode != AM_ABS_Y)
|
||||||
putchar('\t');
|
spaces += 7;
|
||||||
if (mode != AM_IND_X && mode != AM_IND_Y)
|
|
||||||
printf("\t\t");
|
switch (opcodes[op].mode) {
|
||||||
|
case AM_IND_X:
|
||||||
|
spaces -= 12;
|
||||||
|
break;
|
||||||
|
case AM_IND_Y:
|
||||||
|
spaces -= 14;
|
||||||
|
break;
|
||||||
|
case AM_ZP:
|
||||||
|
spaces += 4;
|
||||||
|
break;
|
||||||
|
case AM_ZP_X:
|
||||||
|
case AM_ZP_Y:
|
||||||
|
case AM_REL:
|
||||||
|
case AM_ABS:
|
||||||
|
spaces += 2;
|
||||||
|
break;
|
||||||
|
case AM_IMM:
|
||||||
|
case AM_ACC:
|
||||||
|
case AM_NONE:
|
||||||
|
spaces += 3;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
while (spaces--) putchar(' ');
|
||||||
|
|
||||||
printf("A:%02X X:%02X Y:%02X P:%02X SP:%02X CYC:%d\n",
|
printf("A:%02X X:%02X Y:%02X P:%02X SP:%02X CYC:%d\n",
|
||||||
regs.a, regs.x, regs.y, STATUS_TO_INT(), regs.sp, cycles);
|
regs.a, regs.x, regs.y, STATUS_TO_INT(), regs.sp, cycles);
|
||||||
|
Loading…
Reference in New Issue
Block a user