From 857201e210a0073159bf30375445192924628d55 Mon Sep 17 00:00:00 2001 From: Dirk Best Date: Mon, 2 Apr 2018 11:55:56 +0200 Subject: slapshot: Use ADC0808 device for opwolf3 --- src/mame/drivers/slapshot.cpp | 44 ++++++++++--------------------------------- src/mame/includes/slapshot.h | 27 +++++++++++++------------- 2 files changed, 23 insertions(+), 48 deletions(-) diff --git a/src/mame/drivers/slapshot.cpp b/src/mame/drivers/slapshot.cpp index 3d5f6c91d63..61252006259 100644 --- a/src/mame/drivers/slapshot.cpp +++ b/src/mame/drivers/slapshot.cpp @@ -139,6 +139,7 @@ Region byte at offset 0x031: #include "cpu/m68000/m68000.h" #include "cpu/z80/z80.h" +#include "machine/adc0808.h" #include "machine/timekpr.h" #include "sound/2610intf.h" #include "screen.h" @@ -186,39 +187,6 @@ READ16_MEMBER(slapshot_state::service_input_r) } } - -READ16_MEMBER(slapshot_state::opwolf3_adc_r) -{ - static const char *const adcnames[] = { "GUN1X", "GUN1Y", "GUN2X", "GUN2Y" }; - - return ioport(adcnames[offset])->read() << 8; -} - -WRITE16_MEMBER(slapshot_state::opwolf3_adc_req_w) -{ - switch (offset) - { - case 0: - /* gun outputs... not 100% sure they are correct yet */ - /* p2 gun recoil seems ever so slighty slower than p1 */ - /* also you get a false fire every once in a while on the p1 gun */ - - if (((data & 0x100) == 0x100) && ((data & 0x400)==0)) - output().set_value("Player1_Gun_Recoil",1); - else - output().set_value("Player1_Gun_Recoil",0); - - if (((data & 0x100) == 0x100) && ((data & 0x400)==0x400)) - output().set_value("Player2_Gun_Recoil",1); - else - output().set_value("Player2_Gun_Recoil",0); - break; - } - - /* 4 writes a frame - one for each analogue port */ - m_maincpu->set_input_line(3, HOLD_LINE); -} - WRITE8_MEMBER(slapshot_state::coin_control_w) { machine().bookkeeping().coin_lockout_w(0, ~data & 0x01); @@ -292,7 +260,8 @@ void slapshot_state::opwolf3_map(address_map &map) map(0xc00000, 0xc0000f).rw(m_tc0640fio, FUNC(tc0640fio_device::halfword_byteswap_r), FUNC(tc0640fio_device::halfword_byteswap_w)); map(0xc00020, 0xc0002f).r(this, FUNC(slapshot_state::service_input_r)); /* service mirror */ map(0xd00000, 0xd00003).rw(this, FUNC(slapshot_state::msb_sound_r), FUNC(slapshot_state::msb_sound_w)); - map(0xe00000, 0xe00007).rw(this, FUNC(slapshot_state::opwolf3_adc_r), FUNC(slapshot_state::opwolf3_adc_req_w)); + map(0xe00000, 0xe0000f).rw("adc", FUNC(adc0808_device::data_r), FUNC(adc0808_device::address_offset_start_w)).umask16(0xff00); +// map(0xe80000, 0xe80001) // gun recoil here? } @@ -545,6 +514,13 @@ MACHINE_CONFIG_START(slapshot_state::opwolf3) MCFG_QUANTUM_TIME(attotime::from_hz(600)) + MCFG_DEVICE_ADD("adc", ADC0809, 500000) // unknown clock + MCFG_ADC0808_EOC_FF_CB(INPUTLINE("maincpu", 3)) + MCFG_ADC0808_IN0_CB(IOPORT("GUN1X")) + MCFG_ADC0808_IN1_CB(IOPORT("GUN1Y")) + MCFG_ADC0808_IN2_CB(IOPORT("GUN2X")) + MCFG_ADC0808_IN3_CB(IOPORT("GUN2Y")) + MCFG_DEVICE_ADD("tc0640fio", TC0640FIO, 0) MCFG_TC0640FIO_READ_1_CB(IOPORT("COINS")) MCFG_TC0640FIO_READ_2_CB(IOPORT("BUTTONS")) diff --git a/src/mame/includes/slapshot.h b/src/mame/includes/slapshot.h index cf031cbc9c9..0b861761c33 100644 --- a/src/mame/includes/slapshot.h +++ b/src/mame/includes/slapshot.h @@ -41,6 +41,17 @@ public: m_spriteram(*this,"spriteram"), m_spriteext(*this,"spriteext") { } + + void opwolf3(machine_config &config); + void slapshot(machine_config &config); + DECLARE_DRIVER_INIT(slapshot); + +protected: + virtual void machine_start() override; + virtual void video_start() override; + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + +private: /* devices */ required_device m_maincpu; required_device m_tc0140syt; @@ -75,27 +86,15 @@ public: DECLARE_READ16_MEMBER(msb_sound_r); DECLARE_WRITE8_MEMBER(coin_control_w); - // opwolf specific - DECLARE_READ16_MEMBER(opwolf3_adc_r); - DECLARE_WRITE16_MEMBER(opwolf3_adc_req_w); - - DECLARE_DRIVER_INIT(slapshot); - virtual void machine_start() override; - virtual void video_start() override; - uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); DECLARE_WRITE_LINE_MEMBER(screen_vblank_taito_no_buffer); void draw_sprites( screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int *primasks, int y_offset ); - void taito_handle_sprite_buffering( ); - void taito_update_sprites_active_area( ); + void taito_handle_sprite_buffering(); + void taito_update_sprites_active_area(); INTERRUPT_GEN_MEMBER(interrupt); - void opwolf3(machine_config &config); - void slapshot(machine_config &config); void opwolf3_map(address_map &map); void opwolf3_z80_sound_map(address_map &map); void slapshot_map(address_map &map); -protected: - virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; }; -- cgit v1.2.3