sm500: added device start/reset (nw)

This commit is contained in:
hap 2017-06-24 17:14:32 +02:00
parent c7301ced32
commit 4cc7afc65c
4 changed files with 58 additions and 0 deletions

View File

@ -78,6 +78,8 @@ public:
protected:
sm500_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock, int stack_levels, int o_mask, int prgwidth, address_map_constructor program, int datawidth, address_map_constructor data);
virtual void device_start() override;
virtual void device_reset() override;
virtual offs_t disasm_disassemble(std::ostream &stream, offs_t pc, const u8 *oprom, const u8 *opram, u32 options) override;
virtual void execute_one() override;
virtual void get_opcode_param() override;
@ -124,6 +126,8 @@ protected:
virtual void op_exksa();
virtual void op_exkfa();
virtual void op_idiv() override;
virtual void op_rmf();
virtual void op_smf();
virtual void op_comcn();

View File

@ -44,6 +44,53 @@ sm500_device::sm500_device(const machine_config &mconfig, device_type type, cons
}
//-------------------------------------------------
// device_start - device-specific startup
//-------------------------------------------------
void sm500_device::device_start()
{
// common init (not everything is used though)
sm510_base_device::device_start();
// init/zerofill
memset(m_ox, 0, sizeof(m_ox));
memset(m_o, 0, sizeof(m_o));
m_cn = 0;
m_mx = 0;
m_cb = 0;
m_s = 0;
m_rsub = false;
// register for savestates
save_item(NAME(m_ox));
save_item(NAME(m_o));
save_item(NAME(m_cn));
save_item(NAME(m_mx));
save_item(NAME(m_cb));
save_item(NAME(m_s));
save_item(NAME(m_rsub));
}
//-------------------------------------------------
// device_reset - device-specific reset
//-------------------------------------------------
void sm500_device::device_reset()
{
// common reset
sm510_base_device::device_reset();
// SM500 specific
op_idiv();
m_cb = 0;
m_rsub = false;
}
// disasm
offs_t sm500_device::disasm_disassemble(std::ostream &stream, offs_t pc, const u8 *oprom, const u8 *opram, u32 options)
{

View File

@ -183,6 +183,12 @@ void sm500_device::op_exkfa()
// Divider manipulation instructions
void sm500_device::op_idiv()
{
// IDIV: reset divider low 9 bits
m_div &= 0x3f;
}
// Bit manipulation instructions

View File

@ -250,6 +250,7 @@ void sm510_base_device::op_atr()
{
// ATR: output ACC to R
m_r = m_acc;
clock_melody();
}