diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/devices/machine/74259.cpp | 11 | ||||
-rw-r--r-- | src/devices/machine/74259.h | 1 | ||||
-rw-r--r-- | src/mame/drivers/neogeo.cpp | 78 | ||||
-rw-r--r-- | src/mame/drivers/neogeocd.cpp | 6 | ||||
-rw-r--r-- | src/mame/drivers/shougi.cpp | 13 | ||||
-rw-r--r-- | src/mame/includes/neogeo.h | 10 | ||||
-rw-r--r-- | src/mame/video/neogeo.cpp | 8 |
7 files changed, 54 insertions, 73 deletions
diff --git a/src/devices/machine/74259.cpp b/src/devices/machine/74259.cpp index 3c32a9f167d..e8632baf940 100644 --- a/src/devices/machine/74259.cpp +++ b/src/devices/machine/74259.cpp @@ -281,6 +281,17 @@ WRITE8_MEMBER(addressable_latch_device::write_a0) } //------------------------------------------------- +// write_a3 - write handler that uses three +// lowest bits of address bus as address and +// fourth lowest as data input +//------------------------------------------------- + +WRITE8_MEMBER(addressable_latch_device::write_a3) +{ + write_bit(offset & 7, (offset & 8) >> 3); +} + +//------------------------------------------------- // write_nibble - write handler using LSB of // data as input and next three bits as address // (offset is ignored) diff --git a/src/devices/machine/74259.h b/src/devices/machine/74259.h index a5ff2029539..1569bb299ae 100644 --- a/src/devices/machine/74259.h +++ b/src/devices/machine/74259.h @@ -75,6 +75,7 @@ public: DECLARE_WRITE8_MEMBER(write_d0); DECLARE_WRITE8_MEMBER(write_d7); DECLARE_WRITE8_MEMBER(write_a0); + DECLARE_WRITE8_MEMBER(write_a3); DECLARE_WRITE8_MEMBER(write_nibble); DECLARE_WRITE8_MEMBER(clear); diff --git a/src/mame/drivers/neogeo.cpp b/src/mame/drivers/neogeo.cpp index 1151c1ab23b..f793dd47655 100644 --- a/src/mame/drivers/neogeo.cpp +++ b/src/mame/drivers/neogeo.cpp @@ -464,6 +464,7 @@ #include "emu.h" #include "includes/neogeo.h" +#include "machine/74259.h" #include "machine/nvram.h" #include "machine/watchdog.h" #include "softlist.h" @@ -737,9 +738,9 @@ READ16_MEMBER(neogeo_state::unmapped_r) * *************************************/ -void neogeo_state::set_save_ram_unlock( uint8_t data ) +WRITE_LINE_MEMBER(neogeo_state::set_save_ram_unlock) { - m_save_ram_unlocked = data; + m_save_ram_unlocked = state; } @@ -848,50 +849,18 @@ READ8_MEMBER(neogeo_state::audio_cpu_bank_select_r) * *************************************/ -WRITE8_MEMBER(neogeo_state::system_control_w) -{ - uint8_t bit = (offset >> 3) & 0x01; - - switch (offset & 0x07) - { - default: - case 0x00: - set_screen_shadow(bit); - break; - - case 0x01: - if (m_type == NEOGEO_CD) - printf("NeoCD: write to regular vector change address? %d\n", bit); // what IS going on with "neocdz doubledr" and why do games write here if it's hooked up to nothing? - else - m_use_cart_vectors = bit; - break; - case 0x05: - if (m_type == NEOGEO_MVS) - { - m_use_cart_audio = bit; - m_sprgen->neogeo_set_fixed_layer_source(bit); - m_bank_audio_main->set_entry(m_use_cart_audio); - } - break; - - case 0x06: - if (m_type == NEOGEO_MVS) - set_save_ram_unlock(bit); - break; - - case 0x07: - set_palette_bank(bit); - break; +WRITE_LINE_MEMBER(neogeo_state::set_use_cart_vectors) +{ + m_use_cart_vectors = state; +} - case 0x02: // memory card 1: write enable/disable - case 0x03: // memory card 2: write disable/enable - case 0x04: // memory card: register select enable/set to normal (what does it mean?) - logerror("PC: %x Unmapped system control write. Offset: %x Data: %x\n", space.device().safe_pc(), offset & 0x07, bit); - break; - } - if (LOG_VIDEO_SYSTEM && ((offset & 0x07) != 0x06)) logerror("PC: %x System control write. Offset: %x Data: %x\n", space.device().safe_pc(), offset & 0x07, bit); +WRITE_LINE_MEMBER(neogeo_state::set_use_cart_audio) +{ + m_use_cart_audio = state; + m_sprgen->neogeo_set_fixed_layer_source(state); + m_bank_audio_main->set_entry(m_use_cart_audio); } @@ -1398,13 +1367,6 @@ void neogeo_state::neogeo_postload() void neogeo_state::machine_reset() { - offs_t offs; - address_space &space = m_maincpu->space(AS_PROGRAM); - - // reset system control registers - for (offs = 0; offs < 8; offs++) - system_control_w(space, offs, 0); - // disable audiocpu nmi m_audio_cpu_nmi_enabled = false; m_audio_cpu_nmi_pending = false; @@ -1458,7 +1420,7 @@ ADDRESS_MAP_START( neogeo_main_map, AS_PROGRAM, 16, neogeo_state ) AM_RANGE(0x360000, 0x37ffff) AM_READ(unmapped_r) AM_RANGE(0x380000, 0x380001) AM_MIRROR(0x01fffe) AM_READ_PORT("SYSTEM") AM_RANGE(0x380000, 0x38007f) AM_MIRROR(0x01ff80) AM_WRITE8(io_control_w, 0x00ff) - AM_RANGE(0x3a0000, 0x3a001f) AM_MIRROR(0x01ffe0) AM_READ(unmapped_r) AM_WRITE8(system_control_w, 0x00ff) + AM_RANGE(0x3a0000, 0x3a001f) AM_MIRROR(0x01ffe0) AM_READ(unmapped_r) AM_DEVWRITE8("systemlatch", hc259_device, write_a3, 0x00ff) // BITW1 (system control registers) AM_RANGE(0x3c0000, 0x3c0007) AM_MIRROR(0x01fff8) AM_READ(video_register_r) AM_RANGE(0x3c0000, 0x3c000f) AM_MIRROR(0x01fff0) AM_WRITE(video_register_w) AM_RANGE(0x3e0000, 0x3fffff) AM_READ(unmapped_r) @@ -1495,7 +1457,7 @@ static ADDRESS_MAP_START( aes_main_map, AS_PROGRAM, 16, aes_state ) AM_RANGE(0x360000, 0x37ffff) AM_READ(unmapped_r) AM_RANGE(0x380000, 0x380001) AM_MIRROR(0x01fffe) AM_READ(aes_in2_r) AM_RANGE(0x380000, 0x38007f) AM_MIRROR(0x01ff80) AM_WRITE8(io_control_w, 0x00ff) - AM_RANGE(0x3a0000, 0x3a001f) AM_MIRROR(0x01ffe0) AM_READ(unmapped_r) AM_WRITE8(system_control_w, 0x00ff) + AM_RANGE(0x3a0000, 0x3a001f) AM_MIRROR(0x01ffe0) AM_READ(unmapped_r) AM_DEVWRITE8("systemlatch", hc259_device, write_a3, 0x00ff) AM_RANGE(0x3c0000, 0x3c0007) AM_MIRROR(0x01fff8) AM_READ(video_register_r) AM_RANGE(0x3c0000, 0x3c000f) AM_MIRROR(0x01fff0) AM_WRITE(video_register_w) AM_RANGE(0x3e0000, 0x3fffff) AM_READ(unmapped_r) @@ -1652,6 +1614,14 @@ MACHINE_CONFIG_START( neogeo_base ) MCFG_CPU_PROGRAM_MAP(audio_map) MCFG_CPU_IO_MAP(audio_io_map) + MCFG_DEVICE_ADD("systemlatch", HC259, 0) + MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(neogeo_state, set_screen_shadow)) + MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(neogeo_state, set_use_cart_vectors)) + MCFG_ADDRESSABLE_LATCH_Q2_OUT_CB(NOOP) // memory card 1: write enable/disable + MCFG_ADDRESSABLE_LATCH_Q3_OUT_CB(NOOP) // memory card 2: write disable/enable + MCFG_ADDRESSABLE_LATCH_Q4_OUT_CB(NOOP) // memory card: register select enable/set to normal (what does it mean?) + MCFG_ADDRESSABLE_LATCH_Q7_OUT_CB(WRITELINE(neogeo_state, set_palette_bank)) + MCFG_WATCHDOG_ADD("watchdog") /* video hardware */ @@ -1686,6 +1656,10 @@ MACHINE_CONFIG_DERIVED( neogeo_arcade, neogeo_base ) MCFG_CPU_MODIFY("maincpu") MCFG_CPU_PROGRAM_MAP(main_map_slot) + MCFG_DEVICE_MODIFY("systemlatch") + MCFG_ADDRESSABLE_LATCH_Q5_OUT_CB(WRITELINE(neogeo_state, set_use_cart_audio)) + MCFG_ADDRESSABLE_LATCH_Q6_OUT_CB(WRITELINE(neogeo_state, set_save_ram_unlock)) + MCFG_WATCHDOG_MODIFY("watchdog") MCFG_WATCHDOG_TIME_INIT(attotime::from_ticks(3244030, NEOGEO_MASTER_CLOCK)) MCFG_UPD4990A_ADD("upd4990a", XTAL_32_768kHz, NOOP, NOOP) diff --git a/src/mame/drivers/neogeocd.cpp b/src/mame/drivers/neogeocd.cpp index 1da84ea7094..0953db35f10 100644 --- a/src/mame/drivers/neogeocd.cpp +++ b/src/mame/drivers/neogeocd.cpp @@ -28,6 +28,7 @@ #include "includes/neogeo.h" #include "machine/nvram.h" #include "imagedev/chd_cd.h" +#include "machine/74259.h" #include "machine/megacdcd.h" #include "softlist.h" @@ -895,7 +896,7 @@ static ADDRESS_MAP_START( neocd_main_map, AS_PROGRAM, 16, ngcd_state ) AM_RANGE(0x360000, 0x37ffff) AM_READ(unmapped_r) AM_RANGE(0x380000, 0x380001) AM_MIRROR(0x01fffe) AM_READ(aes_in2_r) AM_RANGE(0x380000, 0x38007f) AM_MIRROR(0x01ff80) AM_WRITE8(io_control_w, 0x00ff) - AM_RANGE(0x3a0000, 0x3a001f) AM_MIRROR(0x01ffe0) AM_READ(unmapped_r) AM_WRITE8(system_control_w, 0x00ff) + AM_RANGE(0x3a0000, 0x3a001f) AM_MIRROR(0x01ffe0) AM_READ(unmapped_r) AM_DEVWRITE8("systemlatch", hc259_device, write_a3, 0x00ff) AM_RANGE(0x3c0000, 0x3c0007) AM_MIRROR(0x01fff8) AM_READ(video_register_r) AM_RANGE(0x3c0000, 0x3c000f) AM_MIRROR(0x01fff0) AM_WRITE(video_register_w) AM_RANGE(0x3e0000, 0x3fffff) AM_READ(unmapped_r) @@ -1046,6 +1047,9 @@ static MACHINE_CONFIG_DERIVED( neocd, neogeo_base ) MCFG_CPU_PROGRAM_MAP(neocd_audio_map) MCFG_CPU_IO_MAP(neocd_audio_io_map) + MCFG_DEVICE_MODIFY("systemlatch") + MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(LOGGER("NeoCD: write to regular vector change address?")) // what IS going on with "neocdz doubledr" and why do games write here if it's hooked up to nothing? + MCFG_SCREEN_MODIFY("screen") MCFG_SCREEN_UPDATE_DRIVER(ngcd_state, screen_update_neocd) diff --git a/src/mame/drivers/shougi.cpp b/src/mame/drivers/shougi.cpp index be853dd5849..cc7e04ad10a 100644 --- a/src/mame/drivers/shougi.cpp +++ b/src/mame/drivers/shougi.cpp @@ -96,7 +96,6 @@ public: m_maincpu(*this, "maincpu"), m_subcpu(*this, "sub"), m_alpha_8201(*this, "alpha_8201"), - m_mainlatch(*this, "mainlatch"), m_videoram(*this, "videoram") { } @@ -104,14 +103,12 @@ public: required_device<cpu_device> m_maincpu; required_device<cpu_device> m_subcpu; required_device<alpha_8201_device> m_alpha_8201; - required_device<ls259_device> m_mainlatch; required_shared_ptr<uint8_t> m_videoram; uint8_t m_nmi_enabled; int m_r; - DECLARE_WRITE8_MEMBER(control_w); DECLARE_WRITE_LINE_MEMBER(nmi_enable_w); DECLARE_READ8_MEMBER(semaphore_r); @@ -230,14 +227,6 @@ uint32_t shougi_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap // maincpu side -WRITE8_MEMBER(shougi_state::control_w) -{ - // 4800-480f connected to the 74LS259, A3 is data line - // so 4800-4807 write 0, and 4808-480f write 1 - m_mainlatch->write_bit(offset & 7, BIT(offset, 3)); -} - - WRITE_LINE_MEMBER(shougi_state::nmi_enable_w) { m_nmi_enabled = state; @@ -254,7 +243,7 @@ WRITE_LINE_MEMBER(shougi_state::nmi_enable_w) static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8, shougi_state ) AM_RANGE(0x0000, 0x3fff) AM_ROM AM_RANGE(0x4000, 0x43ff) AM_RAM /* 2114 x 2 (0x400 x 4bit each) */ - AM_RANGE(0x4800, 0x480f) AM_WRITE(control_w) + AM_RANGE(0x4800, 0x480f) AM_DEVWRITE("mainlatch", ls259_device, write_a3) AM_RANGE(0x4800, 0x4800) AM_READ_PORT("DSW") AM_RANGE(0x5000, 0x5000) AM_READ_PORT("P1") AM_RANGE(0x5800, 0x5800) AM_READ_PORT("P2") AM_DEVWRITE("watchdog", watchdog_timer_device, reset_w) /* game won't boot if watchdog doesn't work */ diff --git a/src/mame/includes/neogeo.h b/src/mame/includes/neogeo.h index 7243bcd8e13..affd2ebb6d9 100644 --- a/src/mame/includes/neogeo.h +++ b/src/mame/includes/neogeo.h @@ -89,13 +89,15 @@ public: TIMER_CALLBACK_MEMBER(vblank_interrupt_callback); // MVS-specific + DECLARE_WRITE_LINE_MEMBER(set_save_ram_unlock); DECLARE_WRITE16_MEMBER(save_ram_w); DECLARE_CUSTOM_INPUT_MEMBER(kizuna4p_start_r); uint32_t screen_update_neogeo(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); DECLARE_WRITE8_MEMBER(io_control_w); - DECLARE_WRITE8_MEMBER(system_control_w); + DECLARE_WRITE_LINE_MEMBER(set_use_cart_vectors); + DECLARE_WRITE_LINE_MEMBER(set_use_cart_audio); DECLARE_READ16_MEMBER(banked_vectors_r); DECLARE_WRITE16_MEMBER(write_banksel); DECLARE_WRITE16_MEMBER(write_bankprot); @@ -105,6 +107,9 @@ public: DECLARE_WRITE16_MEMBER(write_bankprot_kof10th); DECLARE_READ16_MEMBER(read_lorom_kof10th); + DECLARE_WRITE_LINE_MEMBER(set_screen_shadow); + DECLARE_WRITE_LINE_MEMBER(set_palette_bank); + DECLARE_DRIVER_INIT(neogeo); protected: @@ -201,11 +206,8 @@ private: void create_rgb_lookups(); void set_pens(); - void set_screen_shadow(int data); - void set_palette_bank(int data); void audio_cpu_check_nmi(); - void set_save_ram_unlock(uint8_t data); void set_output_latch(uint8_t data); void set_output_data(uint8_t data); diff --git a/src/mame/video/neogeo.cpp b/src/mame/video/neogeo.cpp index ad0481ac655..79ff2235298 100644 --- a/src/mame/video/neogeo.cpp +++ b/src/mame/video/neogeo.cpp @@ -74,16 +74,16 @@ void neogeo_state::set_pens() } -void neogeo_state::set_screen_shadow(int data) +WRITE_LINE_MEMBER(neogeo_state::set_screen_shadow) { - m_screen_shadow = data; + m_screen_shadow = state; set_pens(); } -void neogeo_state::set_palette_bank(int data) +WRITE_LINE_MEMBER(neogeo_state::set_palette_bank) { - m_palette_bank = data ? 0x1000 : 0; + m_palette_bank = state ? 0x1000 : 0; set_pens(); } |