From f937957d7a827e8a0b58bd547079d7b064aaa431 Mon Sep 17 00:00:00 2001 From: AJR Date: Fri, 16 Feb 2024 21:02:47 -0500 Subject: popper: Add addressable latch device --- src/mame/omori/popper.cpp | 48 +++++++++++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/src/mame/omori/popper.cpp b/src/mame/omori/popper.cpp index 63a6cd1f1fd..929dadbdb18 100644 --- a/src/mame/omori/popper.cpp +++ b/src/mame/omori/popper.cpp @@ -40,6 +40,7 @@ #include "emu.h" #include "cpu/z80/z80.h" +#include "machine/74259.h" #include "sound/ay8910.h" #include "video/resnet.h" #include "emupal.h" @@ -108,11 +109,11 @@ private: TILE_GET_INFO_MEMBER(layer0_tile_info); TILE_GET_INFO_MEMBER(layer1_tile_info); - void nmi_control_w(uint8_t data); - void crt_direction_w(uint8_t data); - void back_color_select_w(uint8_t data); - void vram_page_select_w(uint8_t data); - void intcycle_w(offs_t offset, uint8_t data); + void nmi_control_w(int state); + void crt_direction_w(int state); + void back_color_select_w(int state); + void vram_page_select_w(int state); + template void intcycle_w(int state); uint8_t subcpu_nmi_r(); uint8_t subcpu_reset_r(); void ay1_w(offs_t offset, uint8_t data); @@ -137,11 +138,7 @@ void popper_state::main_map(address_map &map) map(0xd000, 0xd7ff).ram().share("sprite_ram"); map(0xd800, 0xdfff).ram().share("shared"); map(0xe000, 0xe003).mirror(0x03fc).r(FUNC(popper_state::inputs_r)); - map(0xe000, 0xe000).mirror(0x1ff8).w(FUNC(popper_state::nmi_control_w)); - map(0xe001, 0xe001).mirror(0x1ff8).w(FUNC(popper_state::crt_direction_w)); - map(0xe002, 0xe002).mirror(0x1ff8).w(FUNC(popper_state::back_color_select_w)); - map(0xe003, 0xe003).mirror(0x1ff8).w(FUNC(popper_state::vram_page_select_w)); - map(0xe004, 0xe007).mirror(0x1ff8).w(FUNC(popper_state::intcycle_w)); + map(0xe000, 0xe007).mirror(0x1ff8).w("outlatch", FUNC(addressable_latch_device::write_d0)); map(0xe400, 0xe400).mirror(0x03ff).r(FUNC(popper_state::subcpu_nmi_r)); map(0xe800, 0xf7ff).noprw(); map(0xf800, 0xf800).mirror(0x03ff).r(FUNC(popper_state::subcpu_reset_r)); @@ -307,19 +304,19 @@ TIMER_CALLBACK_MEMBER(popper_state::scanline_tick) m_scanline_timer->adjust(m_screen->time_until_pos(y + 1, 0)); } -void popper_state::crt_direction_w(uint8_t data) +void popper_state::crt_direction_w(int state) { - flip_screen_set(data); + flip_screen_set(state); } -void popper_state::back_color_select_w(uint8_t data) +void popper_state::back_color_select_w(int state) { - m_back_color = data & 1; + m_back_color = state; } -void popper_state::vram_page_select_w(uint8_t data) +void popper_state::vram_page_select_w(int state) { - m_vram_page = data & 1; + m_vram_page = state; } uint32_t popper_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) @@ -491,15 +488,16 @@ void popper_state::ay1_w(offs_t offset, uint8_t data) // MACHINE EMULATION //************************************************************************** -void popper_state::nmi_control_w(uint8_t data) +void popper_state::nmi_control_w(int state) { - m_nmi_enable = data & 1; + m_nmi_enable = state; } -void popper_state::intcycle_w(offs_t offset, uint8_t data) +template +void popper_state::intcycle_w(int state) { // set to 0 and apparently not used by the game - logerror("intcycle_w: %d = %02x\n", offset, data); + logerror("intcycle_w<%d> = %d\n", N, state); } uint8_t popper_state::watchdog_clear_r() @@ -548,6 +546,16 @@ void popper_state::popper(machine_config &config) config.set_perfect_quantum(m_maincpu); + ls259_device &outlatch(LS259(config, "outlatch")); + outlatch.q_out_cb<0>().set(FUNC(popper_state::nmi_control_w)); + outlatch.q_out_cb<1>().set(FUNC(popper_state::crt_direction_w)); + outlatch.q_out_cb<2>().set(FUNC(popper_state::back_color_select_w)); + outlatch.q_out_cb<3>().set(FUNC(popper_state::vram_page_select_w)); + outlatch.q_out_cb<4>().set(FUNC(popper_state::intcycle_w<0>)); + outlatch.q_out_cb<5>().set(FUNC(popper_state::intcycle_w<1>)); + outlatch.q_out_cb<6>().set(FUNC(popper_state::intcycle_w<2>)); + outlatch.q_out_cb<7>().set(FUNC(popper_state::intcycle_w<3>)); + // video hardware SCREEN(config, m_screen, SCREEN_TYPE_RASTER); m_screen->set_raw(XTAL(18'432'000)/3, 384, 48, 328, 264, 16, 240); -- cgit v1.2.3