diff options
Diffstat (limited to 'src/mame/drivers/othello.cpp')
-rw-r--r-- | src/mame/drivers/othello.cpp | 57 |
1 files changed, 24 insertions, 33 deletions
diff --git a/src/mame/drivers/othello.cpp b/src/mame/drivers/othello.cpp index 21b4dd7a93d..9d0439c2d17 100644 --- a/src/mame/drivers/othello.cpp +++ b/src/mame/drivers/othello.cpp @@ -117,7 +117,8 @@ private: DECLARE_READ8_MEMBER(n7751_rom_r); DECLARE_READ8_MEMBER(n7751_command_r); DECLARE_WRITE8_MEMBER(n7751_p2_w); - DECLARE_WRITE8_MEMBER(n7751_rom_control_w); + template<int Shift> void n7751_rom_addr_w(uint8_t data); + void n7751_rom_select_w(uint8_t data); DECLARE_PALETTE_INIT(othello); MC6845_UPDATE_ROW(crtc_update_row); @@ -280,36 +281,24 @@ void othello_state::audio_portmap(address_map &map) map(0x08, 0x08).w(FUNC(othello_state::ay_select_w)); } -WRITE8_MEMBER(othello_state::n7751_rom_control_w) +template<int Shift> +void othello_state::n7751_rom_addr_w(uint8_t data) { - /* P4 - address lines 0-3 */ - /* P5 - address lines 4-7 */ - /* P6 - address lines 8-11 */ - /* P7 - ROM selects */ - switch (offset) - { - case 0: - m_sound_addr = (m_sound_addr & ~0x00f) | ((data & 0x0f) << 0); - break; - - case 1: - m_sound_addr = (m_sound_addr & ~0x0f0) | ((data & 0x0f) << 4); - break; - - case 2: - m_sound_addr = (m_sound_addr & ~0xf00) | ((data & 0x0f) << 8); - break; - - case 3: - m_sound_addr &= 0xfff; - { - if (!BIT(data, 0)) m_sound_addr |= 0x0000; - if (!BIT(data, 1)) m_sound_addr |= 0x1000; - if (!BIT(data, 2)) m_sound_addr |= 0x2000; - if (!BIT(data, 3)) m_sound_addr |= 0x3000; - } - break; - } + // P4 - address lines 0-3 + // P5 - address lines 4-7 + // P6 - address lines 8-11 + m_sound_addr = (m_sound_addr & ~(0x00f << Shift)) | ((data & 0x0f) << Shift); +} + +void othello_state::n7751_rom_select_w(uint8_t data) +{ + // P7 - ROM selects + m_sound_addr &= 0xfff; + + if (!BIT(data, 0)) m_sound_addr |= 0x0000; + if (!BIT(data, 1)) m_sound_addr |= 0x1000; + if (!BIT(data, 2)) m_sound_addr |= 0x2000; + if (!BIT(data, 3)) m_sound_addr |= 0x3000; } READ8_MEMBER(othello_state::n7751_rom_r) @@ -325,7 +314,7 @@ READ8_MEMBER(othello_state::n7751_command_r) WRITE8_MEMBER(othello_state::n7751_p2_w) { /* write to P2; low 4 bits go to 8243 */ - m_i8243->p2_w(space, offset, data & 0x0f); + m_i8243->p2_w(data & 0x0f); /* output of bit $80 indicates we are ready (1) or busy (0) */ /* no other outputs are used */ @@ -419,8 +408,10 @@ MACHINE_CONFIG_START(othello_state::othello) MCFG_MCS48_PORT_PROG_OUT_CB(WRITELINE(m_i8243, i8243_device, prog_w)) I8243(config, m_i8243); - m_i8243->read_handler().set_constant(0); - m_i8243->write_handler().set(FUNC(othello_state::n7751_rom_control_w)); + m_i8243->p4_out_cb().set(FUNC(othello_state::n7751_rom_addr_w<0>)); + m_i8243->p5_out_cb().set(FUNC(othello_state::n7751_rom_addr_w<4>)); + m_i8243->p6_out_cb().set(FUNC(othello_state::n7751_rom_addr_w<8>)); + m_i8243->p7_out_cb().set(FUNC(othello_state::n7751_rom_select_w)); /* video hardware */ MCFG_SCREEN_ADD("screen", RASTER) |