sm510d: get rid of half-broken param fetch (nw)

This commit is contained in:
hap 2017-05-09 22:59:07 +02:00
parent b461d1cdbe
commit fa74509843
3 changed files with 11 additions and 10 deletions

View File

@ -148,7 +148,7 @@ protected:
// device_disasm_interface overrides
virtual u32 disasm_min_opcode_bytes() const override { return 1; }
virtual u32 disasm_max_opcode_bytes() const override { return 0x40; } // actually 2, but debugger doesn't like non-linear pc
virtual u32 disasm_max_opcode_bytes() const override { return 2; }
address_space_config m_program_config;
address_space_config m_data_config;
@ -164,7 +164,7 @@ protected:
u16 m_op, m_prev_op;
u8 m_param;
int m_stack_levels;
u16 m_stack[2];
u16 m_stack[4]; // max 4
int m_icount;
u8 m_acc;

View File

@ -2,7 +2,7 @@
// copyright-holders:hap, Jonathan Gevaryahu
/*
Sharp SM510/SM500 MCU family disassembler
Sharp SM5xx MCU family disassembler
*/
@ -175,7 +175,6 @@ static offs_t sm510_common_disasm(const u8 *lut_mnemonic, const u8 *lut_extended
// get raw opcode
u8 op = oprom[0];
u8 instr = lut_mnemonic[op];
s8 s_next_pc = ((pclen==6)?s_next_pc_6[pc & 0x3f]:s_next_pc_7[pc & 0x7f]);
int len = 1;
int bits = s_bits[instr];
@ -183,9 +182,8 @@ static offs_t sm510_common_disasm(const u8 *lut_mnemonic, const u8 *lut_extended
u16 param = mask;
if (bits >= 8)
{
// note: disasm view shows correct parameter, but raw view does not
// note2: oprom array negative index doesn't work either :(
param = oprom[s_next_pc];
// note: doesn't work with lfsr pc
param = oprom[1];
len++;
}
@ -218,7 +216,10 @@ static offs_t sm510_common_disasm(const u8 *lut_mnemonic, const u8 *lut_extended
// show param offset
if (bits >= 8)
util::stream_format(stream, " [$%03X]", pc + s_next_pc);
{
s8 next_pc_delta = ((pclen == 6) ? s_next_pc_6[pc & 0x3f] : s_next_pc_7[pc & 0x7f]);
util::stream_format(stream, " [$%03X]", pc + next_pc_delta);
}
}
return len | s_flags[instr] | DASMFLAG_SUPPORTED;

View File

@ -75,7 +75,7 @@ void sm590_device::op_debm()
void sm590_device::op_tc()
{
// TC: skip next if carry
m_skip = m_c;
m_skip = bool(m_c);
}
void sm590_device::op_rta()
@ -108,7 +108,7 @@ void sm590_device::op_ads()
{
// ADS: add RAM to ACC, skip next on carry
m_acc += ram_r();
m_skip = (m_c == 1);
m_skip = bool(m_acc & 0x10);
m_acc &= 0xf;
}