From e95e28db8a02d76fcc0dd4fa5a237c86e70dbbb4 Mon Sep 17 00:00:00 2001 From: Dirk Best Date: Mon, 2 Apr 2018 21:37:21 +0200 Subject: jedi: Use ADC0808 device --- src/mame/drivers/jedi.cpp | 36 +++++++++++------------------------- 1 file changed, 11 insertions(+), 25 deletions(-) diff --git a/src/mame/drivers/jedi.cpp b/src/mame/drivers/jedi.cpp index b5652d946a3..54be8592c90 100644 --- a/src/mame/drivers/jedi.cpp +++ b/src/mame/drivers/jedi.cpp @@ -115,6 +115,7 @@ #include "emu.h" #include "cpu/m6502/m6502.h" #include "machine/74259.h" +#include "machine/adc0808.h" #include "machine/nvram.h" #include "machine/watchdog.h" #include "includes/jedi.h" @@ -207,26 +208,6 @@ WRITE8_MEMBER(jedi_state::rom_banksel_w) * *************************************/ -READ8_MEMBER(jedi_state::a2d_data_r) -{ - uint8_t ret = 0; - - switch (m_a2d_select) - { - case 0: ret = ioport("STICKY")->read(); break; - case 2: ret = ioport("STICKX")->read(); break; - } - - return ret; -} - - -WRITE8_MEMBER(jedi_state::a2d_select_w) -{ - m_a2d_select = offset; -} - - WRITE_LINE_MEMBER(jedi_state::coin_counter_left_w) { machine().bookkeeping().coin_counter_w(0, state); @@ -274,10 +255,9 @@ void jedi_state::main_map(address_map &map) map(0x0c01, 0x0c01).mirror(0x03fe).portr("0c01").nopw(); map(0x1000, 0x13ff).noprw(); map(0x1400, 0x1400).mirror(0x03ff).r(this, FUNC(jedi_state::jedi_audio_ack_latch_r)).nopw(); - map(0x1800, 0x1800).mirror(0x03ff).r(this, FUNC(jedi_state::a2d_data_r)).nopw(); + map(0x1800, 0x1800).mirror(0x03ff).r("adc", FUNC(adc0808_device::data_r)).nopw(); map(0x1c00, 0x1c01).mirror(0x007e).nopr().w(this, FUNC(jedi_state::nvram_enable_w)); - map(0x1c80, 0x1c82).mirror(0x0078).nopr().w(this, FUNC(jedi_state::a2d_select_w)); - map(0x1c83, 0x1c87).mirror(0x0078).noprw(); + map(0x1c80, 0x1c87).mirror(0x0078).nopr().w("adc", FUNC(adc0808_device::address_offset_start_w)); map(0x1d00, 0x1d00).mirror(0x007f).noprw(); /* write: NVRAM store */ map(0x1d80, 0x1d80).mirror(0x007f).nopr().w("watchdog", FUNC(watchdog_timer_device::reset_w)); map(0x1e00, 0x1e00).mirror(0x007f).nopr().w(this, FUNC(jedi_state::main_irq_ack_w)); @@ -321,10 +301,10 @@ static INPUT_PORTS_START( jedi ) PORT_BIT( 0x60, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF,jedi_state,jedi_audio_comm_stat_r, nullptr) PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_VBLANK("screen") - PORT_START("STICKY") /* analog Y */ + PORT_START("STICKY") PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) - PORT_START("STICKX") /* analog X */ + PORT_START("STICKX") PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) INPUT_PORTS_END @@ -346,6 +326,12 @@ MACHINE_CONFIG_START(jedi_state::jedi) MCFG_NVRAM_ADD_0FILL("nvram") + MCFG_DEVICE_ADD("adc", ADC0809, JEDI_AUDIO_CPU_OSC / 2 / 9) + MCFG_ADC0808_IN0_CB(IOPORT("STICKY")) + MCFG_ADC0808_IN1_CB(NOOP) // SPARE + MCFG_ADC0808_IN2_CB(IOPORT("STICKX")) + MCFG_ADC0808_IN3_CB(NOOP) // SPARE + MCFG_DEVICE_ADD("outlatch", LS259, 0) // 14J MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(WRITELINE(jedi_state, coin_counter_left_w)) MCFG_ADDRESSABLE_LATCH_Q1_OUT_CB(WRITELINE(jedi_state, coin_counter_right_w)) -- cgit v1.2.3