correct program counter sequence in debug view

This commit is contained in:
hap 2015-03-07 17:14:27 +01:00
parent fe3695a94a
commit 80475a9e4e
2 changed files with 13 additions and 5 deletions

View File

@ -86,7 +86,7 @@ protected:
// device_disasm_interface overrides
virtual UINT32 disasm_min_opcode_bytes() const { return 2; }
virtual UINT32 disasm_max_opcode_bytes() const { return 2; }
virtual UINT32 disasm_max_opcode_bytes() const { return 2+1; }
virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options);
void state_string_export(const device_state_entry &entry, astring &string);

View File

@ -75,6 +75,15 @@ static const UINT32 s_flags[] =
0, 0
};
// next program counter in sequence (relative)
static const INT8 s_next_pc[0x40] =
{
1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 32+1,
-32, -31, -30, -29, -28, -27, -26, -25, -24, -23, -22, -21, -20, -19, -18, -17,
-15, -14, -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, -1
};
static const UINT8 hmcs40_mnemonic[0x400] =
{
@ -171,9 +180,7 @@ static const UINT8 hmcs40_mnemonic[0x400] =
CPU_DISASSEMBLE(hmcs40)
{
int pos = 0;
UINT16 op = (oprom[pos] | oprom[pos + 1] << 8) & 0x3ff;
pos++;
UINT16 op = (oprom[0] | oprom[1] << 8) & 0x3ff;
char *dst = buffer;
UINT8 instr = hmcs40_mnemonic[op];
INT8 bits = s_bits[instr];
@ -201,6 +208,7 @@ CPU_DISASSEMBLE(hmcs40)
else
dst += sprintf(dst, "%d", param);
}
int pos = s_next_pc[pc & 0x3f] & DASMFLAG_LENGTHMASK;
return pos | s_flags[instr] | DASMFLAG_SUPPORTED;
}