mirror of
https://github.com/mamedev/mame.git
synced 2024-11-16 07:48:32 +01:00
Add preliminary MSM665xx execution core
This commit is contained in:
parent
e19fc2e326
commit
2211d9459e
2 changed files with 3125 additions and 19 deletions
File diff suppressed because it is too large
Load diff
|
@ -39,6 +39,8 @@ protected:
|
|||
virtual std::unique_ptr<util::disasm_interface> create_disassembler() override;
|
||||
|
||||
virtual void execute_run() override;
|
||||
virtual u32 execute_min_cycles() const noexcept override { return 2; }
|
||||
virtual u32 execute_max_cycles() const noexcept override { return 42; }
|
||||
|
||||
virtual space_config_vector memory_space_config() const override;
|
||||
|
||||
|
@ -63,6 +65,93 @@ protected:
|
|||
void memscon_w(u8 data);
|
||||
|
||||
private:
|
||||
u16 addr_lr(u8 n) const noexcept { return 0x0200 + (n & 7) + (m_lrb & 0x00ff) * 8; }
|
||||
u16 addr_er(u8 n) const noexcept { return 0x0200 + (n & 3) * 2 + (m_lrb & 0x00ff) * 8; }
|
||||
u16 addr_pr(u8 n) const noexcept { return 0x0200 + (n & 3) * 2 + (m_psw & 0x0007) * 8; }
|
||||
|
||||
void set_adr_fix8(u8 fix8) noexcept { m_adr = 0x0200 | fix8; m_seg = 0; }
|
||||
void set_adr_off8(u8 off8) noexcept { m_adr = (m_lrb & 0xff00) | off8; m_seg = get_seg(m_adr); }
|
||||
void set_adr_sfr8(u8 sfr8) noexcept { m_adr = sfr8; m_seg = 0; }
|
||||
|
||||
u16 get_seg(u16 addr) const noexcept;
|
||||
|
||||
u8 data_read_byte(u16 seg, u16 adr) { return s16(seg) < 0 ? m_program_space.read_byte(u32(seg) << 16 | adr) : m_data_space.read_byte(u32(seg) << 16 | adr); }
|
||||
u16 data_read_word(u16 seg, u16 adr) { return s16(seg) < 0 ? m_program_space.read_word_unaligned(u32(seg) << 16 | adr) : m_data_space.read_word(u32(seg) << 16 | adr); }
|
||||
void data_write_byte(u16 seg, u16 adr, u8 data) { m_data_space.write_byte(u32(seg) << 16 | adr, data); }
|
||||
void data_write_word(u16 seg, u16 adr, u16 data) { m_data_space.write_word(u32(seg) << 16 | adr, data); }
|
||||
|
||||
void next_inst() { m_inst = m_fetch_byte; m_state = s_inst_decode[BIT(m_psw, 12)][m_inst]; m_ppc = u32(m_csr) << 16 | u16(m_pc - 1); debugger_instruction_hook(m_ppc); }
|
||||
void next_inst_and_store_byte(u8 data) { m_inst = m_fetch_byte; m_state = s_inst_decode[BIT(m_psw, 12)][m_inst]; data_write_byte(m_seg, m_adr, data); m_ppc = u32(m_csr) << 16 | u16(m_pc - 1); debugger_instruction_hook(m_ppc); }
|
||||
void next_inst_and_store_word(u16 data) { m_inst = m_fetch_byte; m_state = s_inst_decode[BIT(m_psw, 12)][m_inst]; data_write_word(m_seg, m_adr, data); m_ppc = u32(m_csr) << 16 | u16(m_pc - 1); debugger_instruction_hook(m_ppc); }
|
||||
void prefetch() { m_fetch_byte = m_program_cache.read_byte(u32(m_csr) << 16 | m_pc); ++m_pc; }
|
||||
|
||||
void acc_load_byte(u8 data) noexcept
|
||||
{
|
||||
m_acc = (m_acc & 0xff00) | data;
|
||||
if (data == 0)
|
||||
m_psw |= 0x4000;
|
||||
else
|
||||
m_psw &= 0xbfff;
|
||||
m_psw &= 0xefff;
|
||||
}
|
||||
|
||||
void acc_load_word(u16 data) noexcept
|
||||
{
|
||||
m_acc = data;
|
||||
if (data == 0)
|
||||
m_psw |= 0x4000;
|
||||
else
|
||||
m_psw &= 0xbfff;
|
||||
m_psw |= 0x1000;
|
||||
}
|
||||
|
||||
void setzs_byte(u8 data) noexcept
|
||||
{
|
||||
if (data == 0)
|
||||
m_psw |= 0x4000;
|
||||
else
|
||||
m_psw &= 0xbfff;
|
||||
if (s8(data) < 0)
|
||||
m_psw |= 0x0800;
|
||||
else
|
||||
m_psw &= 0xf7ff;
|
||||
}
|
||||
|
||||
void setzs_word(u16 data) noexcept
|
||||
{
|
||||
if (data == 0)
|
||||
m_psw |= 0x4000;
|
||||
else
|
||||
m_psw &= 0xbfff;
|
||||
if (s16(data) < 0)
|
||||
m_psw |= 0x0800;
|
||||
else
|
||||
m_psw &= 0xf7ff;
|
||||
}
|
||||
|
||||
u16 do_add(u16 n1, u16 n2, bool c = false) noexcept;
|
||||
u8 do_addb(u8 n1, u8 n2, bool c = false) noexcept;
|
||||
u16 do_sub(u16 n1, u16 n2, bool c = false) noexcept;
|
||||
u8 do_subb(u8 n1, u8 n2, bool c = false) noexcept;
|
||||
u16 do_aluop_word(u16 n1, u16 n2) noexcept;
|
||||
u8 do_aluop_byte(u8 n1, u8 n2) noexcept;
|
||||
u16 do_inc(u16 n) noexcept;
|
||||
u8 do_incb(u8 n) noexcept;
|
||||
u16 do_dec(u16 n) noexcept;
|
||||
u8 do_decb(u8 n) noexcept;
|
||||
u16 do_rol(u16 n) noexcept;
|
||||
u8 do_rolb(u8 n) noexcept;
|
||||
u16 do_ror(u16 n) noexcept;
|
||||
u8 do_rorb(u8 n) noexcept;
|
||||
void do_mul(u16 n) noexcept;
|
||||
void do_div(u16 n) noexcept;
|
||||
void do_divb(u8 n) noexcept;
|
||||
void do_divq(u16 n) noexcept;
|
||||
|
||||
enum class inst_state : u8;
|
||||
static const inst_state s_inst_decode[2][0x100];
|
||||
static const inst_state s_prefixed_inst_decode[2][0x100];
|
||||
|
||||
address_space_config m_program_config;
|
||||
address_space_config m_data_config;
|
||||
memory_access<20, 0, 0, ENDIANNESS_LITTLE>::cache m_program_cache;
|
||||
|
@ -81,6 +170,13 @@ private:
|
|||
u8 m_tsr;
|
||||
u8 m_romwin;
|
||||
u8 m_memscon;
|
||||
|
||||
inst_state m_state;
|
||||
u8 m_inst;
|
||||
u8 m_fetch_byte;
|
||||
u16 m_adr;
|
||||
u16 m_seg;
|
||||
u16 m_tmp[2];
|
||||
s32 m_icount;
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue