1
0
mirror of https://github.com/pevans/erc-c.git synced 2024-07-19 15:29:27 +00:00

Show the individual flags of the P register

This commit is contained in:
Peter Evans 2018-01-19 13:14:02 -06:00
parent 6b160c6ca2
commit a9cf25853d

View File

@ -14,7 +14,7 @@ static char s_inst[4],
s_oper[10],
s_value[3],
s_label[13],
s_state[51],
s_state[54],
s_bytes[12];
static vm_8bit jump_table[MOS6502_MEMSIZE];
@ -321,10 +321,18 @@ mos6502_dis_opcode(mos6502 *cpu, FILE *stream, int address)
// what the PC was at the point of this opcode sequence; two,
// the opcode;
snprintf(s_state, sizeof(s_state) - 1,
"pc:%02x%02x cy:%02d val:%2s a:%02x x:%02x y:%02x p:%02x s:%02x",
"pc:%02x%02x cy:%02d val:%2s a:%02x x:%02x y:%02x p:%c%c-%c%c%c%c%c s:%02x",
cpu->PC >> 8, cpu->PC & 0xff,
mos6502_cycles(cpu, opcode), s_value,
cpu->A, cpu->X, cpu->Y, cpu->P, cpu->S);
cpu->A, cpu->X, cpu->Y,
cpu->P & MOS_NEGATIVE ? 'N' : 'n',
cpu->P & MOS_OVERFLOW ? 'O' : 'o',
cpu->P & MOS_BREAK ? 'B' : 'b',
cpu->P & MOS_DECIMAL ? 'D' : 'd',
cpu->P & MOS_INTERRUPT ? 'I' : 'i',
cpu->P & MOS_ZERO ? 'Z' : 'z',
cpu->P & MOS_CARRY ? 'C' : 'c',
cpu->S);
// And three, the operand, if any. Remembering that the operand
// should be shown in little-endian order.
@ -339,7 +347,7 @@ mos6502_dis_opcode(mos6502 *cpu, FILE *stream, int address)
}
}
fprintf(stream, "%s %4s %-9s ; %-51s | %s\n",
fprintf(stream, "%s %4s %-9s ; %-54s | %s\n",
s_label, s_inst, s_oper, s_state, s_bytes);
if (mos6502_would_jump(inst_code)) {