diff --git a/src/emu/cpu/hmcs40/hmcs40.h b/src/emu/cpu/hmcs40/hmcs40.h index 301cbb2ba92..65a07a8e309 100644 --- a/src/emu/cpu/hmcs40/hmcs40.h +++ b/src/emu/cpu/hmcs40/hmcs40.h @@ -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); diff --git a/src/emu/cpu/hmcs40/hmcs40d.c b/src/emu/cpu/hmcs40/hmcs40d.c index 37934578d5d..bdc815145a4 100644 --- a/src/emu/cpu/hmcs40/hmcs40d.c +++ b/src/emu/cpu/hmcs40/hmcs40d.c @@ -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; }