mirror of
https://github.com/holub/mame
synced 2025-04-20 23:42:22 +03:00
Merge branch 'master' of https://github.com/mamedev/mame
This commit is contained in:
commit
b58f781202
@ -44,6 +44,7 @@ void sm510_base_device::device_start()
|
||||
m_read_ba.resolve_safe(1);
|
||||
m_read_b.resolve_safe(1);
|
||||
m_write_s.resolve_safe();
|
||||
m_write_r.resolve_safe();
|
||||
|
||||
// zerofill
|
||||
memset(m_stack, 0, sizeof(m_stack));
|
||||
@ -60,6 +61,7 @@ void sm510_base_device::device_start()
|
||||
m_w = 0;
|
||||
// m_div = 0;
|
||||
m_1s = false;
|
||||
m_k_active = false;
|
||||
m_bp = false;
|
||||
m_bc = false;
|
||||
m_halt = false;
|
||||
@ -79,6 +81,7 @@ void sm510_base_device::device_start()
|
||||
save_item(NAME(m_w));
|
||||
save_item(NAME(m_div));
|
||||
save_item(NAME(m_1s));
|
||||
save_item(NAME(m_k_active));
|
||||
save_item(NAME(m_bp));
|
||||
save_item(NAME(m_bc));
|
||||
save_item(NAME(m_halt));
|
||||
@ -115,6 +118,7 @@ void sm510_base_device::device_reset()
|
||||
m_bp = true;
|
||||
m_bc = false;
|
||||
|
||||
m_write_r(0, 0, 0xff);
|
||||
// y=0(bs), r=0
|
||||
}
|
||||
|
||||
@ -143,6 +147,9 @@ void sm510_base_device::execute_set_input(int line, int state)
|
||||
{
|
||||
if (line != 0)
|
||||
return;
|
||||
|
||||
// set K input lines active state
|
||||
m_k_active = (state != 0);
|
||||
}
|
||||
|
||||
TIMER_CALLBACK_MEMBER(sm510_base_device::div_timer_cb)
|
||||
@ -184,15 +191,21 @@ void sm510_base_device::increment_pc()
|
||||
|
||||
void sm510_base_device::execute_run()
|
||||
{
|
||||
// nothing to do if in halt mode
|
||||
if (m_halt)
|
||||
{
|
||||
m_icount = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
while (m_icount > 0)
|
||||
{
|
||||
if (m_halt)
|
||||
{
|
||||
// wake up from K input (note: 1S signal is handled above)
|
||||
if (m_k_active)
|
||||
wake_me_up();
|
||||
else
|
||||
{
|
||||
// got nothing to do
|
||||
m_icount = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// remember previous state
|
||||
m_prev_op = m_op;
|
||||
m_prev_pc = m_pc;
|
||||
|
@ -30,6 +30,13 @@
|
||||
#define MCFG_SM510_WRITE_S_CB(_devcb) \
|
||||
sm510_base_device::set_write_s_callback(*device, DEVCB_##_devcb);
|
||||
|
||||
// 2-bit R melody output port
|
||||
#define MCFG_SM510_WRITE_R_CB(_devcb) \
|
||||
sm510_base_device::set_write_r_callback(*device, DEVCB_##_devcb);
|
||||
|
||||
// when in halt state, any K input going High can wake up the CPU,
|
||||
// driver is required to use execute_set_input(SM510_INPUT_LINE_K, state)
|
||||
#define SM510_INPUT_LINE_K 0
|
||||
|
||||
|
||||
// pinout reference
|
||||
@ -54,6 +61,7 @@ public:
|
||||
, m_read_ba(*this)
|
||||
, m_read_b(*this)
|
||||
, m_write_s(*this)
|
||||
, m_write_r(*this)
|
||||
{ }
|
||||
|
||||
// static configuration helpers
|
||||
@ -61,6 +69,7 @@ public:
|
||||
template<class _Object> static devcb_base &set_read_ba_callback(device_t &device, _Object object) { return downcast<sm510_base_device &>(device).m_read_ba.set_callback(object); }
|
||||
template<class _Object> static devcb_base &set_read_b_callback(device_t &device, _Object object) { return downcast<sm510_base_device &>(device).m_read_b.set_callback(object); }
|
||||
template<class _Object> static devcb_base &set_write_s_callback(device_t &device, _Object object) { return downcast<sm510_base_device &>(device).m_write_s.set_callback(object); }
|
||||
template<class _Object> static devcb_base &set_write_r_callback(device_t &device, _Object object) { return downcast<sm510_base_device &>(device).m_write_r.set_callback(object); }
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
@ -111,6 +120,7 @@ protected:
|
||||
UINT8 m_w;
|
||||
UINT16 m_div;
|
||||
bool m_1s;
|
||||
bool m_k_active;
|
||||
bool m_bp;
|
||||
bool m_bc;
|
||||
bool m_halt;
|
||||
@ -120,6 +130,7 @@ protected:
|
||||
devcb_read_line m_read_ba;
|
||||
devcb_read_line m_read_b;
|
||||
devcb_write8 m_write_s;
|
||||
devcb_write8 m_write_r;
|
||||
|
||||
// misc internal helpers
|
||||
void increment_pc();
|
||||
|
@ -223,20 +223,20 @@ void sm510_base_device::op_atbp()
|
||||
|
||||
void sm510_base_device::op_atl()
|
||||
{
|
||||
// ATL: input L to ACC
|
||||
// ATL: output ACC to L
|
||||
op_illegal();
|
||||
}
|
||||
|
||||
void sm510_base_device::op_atfc()
|
||||
{
|
||||
// ATFC: input Y to ACC
|
||||
// ATFC: output ACC to Y
|
||||
op_illegal();
|
||||
}
|
||||
|
||||
void sm510_base_device::op_atr()
|
||||
{
|
||||
// ATR: output ACC to R
|
||||
op_illegal();
|
||||
m_write_r(0, m_acc & 3, 0xff);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user