witch: Take the "Hopper Active" DSW value into proper account; no longer must it be low

Add ticket_dispenser_device::motor_w as a proper WRITE_LINE method, first step towards eliminating the m_active_bit=0x80 nonsense (nw) (#1485 please take note)
This commit is contained in:
AJR 2016-10-08 14:27:04 -04:00
parent 48ff916037
commit df5405de65
3 changed files with 22 additions and 3 deletions

View File

@ -274,6 +274,7 @@ public:
int m_scrollx;
int m_scrolly;
UINT8 m_reg_a002;
UINT8 m_motor_active;
DECLARE_WRITE8_MEMBER(gfx0_vram_w);
DECLARE_WRITE8_MEMBER(gfx0_cram_w);
DECLARE_WRITE8_MEMBER(gfx1_vram_w);
@ -295,6 +296,7 @@ public:
virtual void video_start() override;
UINT32 screen_update_witch(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
virtual void machine_reset() override;
};
@ -420,8 +422,7 @@ WRITE8_MEMBER(witch_state::write_a006)
if (data == 0)
return;
// TODO: this assumes the "Hopper Active" DSW is "Low"
m_hopper->write(space, 0, !BIT(data, 1) ? 0x80 : 0);
m_hopper->motor_w(!BIT(data, 1) ^ m_motor_active);
// TODO: Bit 3 = Attendant Pay
@ -695,6 +696,7 @@ void witch_state::video_start()
save_item(NAME(m_scrollx));
save_item(NAME(m_scrolly));
save_item(NAME(m_reg_a002));
save_item(NAME(m_motor_active));
}
void witch_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect)
@ -756,6 +758,12 @@ UINT32 witch_state::screen_update_witch(screen_device &screen, bitmap_ind16 &bit
return 0;
}
void witch_state::machine_reset()
{
// Keep track of the "Hopper Active" DSW value because the program will use it
m_motor_active = (ioport("YM_PortB")->read() & 0x08) ? 0 : 1;
}
static MACHINE_CONFIG_START( witch, witch_state )
/* basic machine hardware */
MCFG_CPU_ADD("maincpu", Z80, CPU_CLOCK) /* 3 MHz */

View File

@ -98,6 +98,7 @@ void ticket_dispenser_device::static_set_senses(device_t &device, UINT8 motor_se
//-------------------------------------------------
// read - read the status line via the active bit
// (legacy method)
//-------------------------------------------------
READ8_MEMBER( ticket_dispenser_device::read )
@ -119,7 +120,7 @@ READ_LINE_MEMBER( ticket_dispenser_device::line_r )
//-------------------------------------------------
// write - write the control line via the active
// bit
// bit (legacy method)
//-------------------------------------------------
WRITE8_MEMBER( ticket_dispenser_device::write )
@ -147,6 +148,15 @@ WRITE8_MEMBER( ticket_dispenser_device::write )
}
}
//-------------------------------------------------
// motor_w - write the control line as a proper
// line
//-------------------------------------------------
WRITE_LINE_MEMBER( ticket_dispenser_device::motor_w )
{
write(machine().driver_data()->generic_space(), 0, state ? m_active_bit : 0);
}
//**************************************************************************

View File

@ -64,6 +64,7 @@ public:
DECLARE_READ8_MEMBER( read );
DECLARE_READ_LINE_MEMBER( line_r );
DECLARE_WRITE8_MEMBER( write );
DECLARE_WRITE_LINE_MEMBER( motor_w );
protected:
// device-level overrides