summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2018-04-02 09:45:16 -0400
committer AJR <ajrhacker@users.noreply.github.com>2018-04-02 09:45:16 -0400
commit856529cf8911d1397991df62dbd98b7a9623b161 (patch)
tree4cdefaea09af6f926927af483c26d877f4db66f2
parent644d60d6872d9bf9e12609c23e87f0e618362bcf (diff)
apache3: Use ADC device (nw)
-rw-r--r--src/mame/drivers/tatsumi.cpp14
-rw-r--r--src/mame/includes/tatsumi.h9
-rw-r--r--src/mame/machine/tatsumi.cpp21
3 files changed, 18 insertions, 26 deletions
diff --git a/src/mame/drivers/tatsumi.cpp b/src/mame/drivers/tatsumi.cpp
index 82438786cf3..ef387f51640 100644
--- a/src/mame/drivers/tatsumi.cpp
+++ b/src/mame/drivers/tatsumi.cpp
@@ -144,6 +144,7 @@
#include "cpu/nec/nec.h"
#include "cpu/z80/z80.h"
+#include "machine/adc0808.h"
#include "machine/i8255.h"
#include "machine/nvram.h"
#include "sound/ym2151.h"
@@ -227,7 +228,7 @@ void apache3_state::apache3_v20_map(address_map &map)
map(0x06000, 0x06001).portr("IN0"); // esw
map(0x08000, 0x08001).r(this, FUNC(apache3_state::tatsumi_hack_ym2151_r)).w("ymsnd", FUNC(ym2151_device::write));
map(0x0a000, 0x0a000).r(this, FUNC(apache3_state::tatsumi_hack_oki_r)).w(m_oki, FUNC(okim6295_device::write));
- map(0x0e000, 0x0e007).rw(this, FUNC(apache3_state::apache3_adc_r), FUNC(apache3_state::apache3_adc_w)); //adc select
+ map(0x0e000, 0x0e007).rw("adc", FUNC(adc0808_device::data_r), FUNC(adc0808_device::address_offset_start_w));
map(0xf0000, 0xfffff).rom();
}
@@ -866,6 +867,15 @@ MACHINE_CONFIG_START(apache3_state::apache3)
MCFG_NVRAM_ADD_0FILL("nvram")
MCFG_MACHINE_RESET_OVERRIDE(apache3_state, apache3)
+ MCFG_DEVICE_ADD("adc", M58990, 1000000) // unknown clock
+ MCFG_ADC0808_IN0_CB(IOPORT("STICK_X"))
+ MCFG_ADC0808_IN1_CB(IOPORT("STICK_Y"))
+ MCFG_ADC0808_IN2_CB(GND) // VSP1
+ MCFG_ADC0808_IN4_CB(READ8(apache3_state, apache3_vr1_r))
+ MCFG_ADC0808_IN5_CB(IOPORT("THROTTLE"))
+ MCFG_ADC0808_IN6_CB(GND) // RPSNC
+ MCFG_ADC0808_IN7_CB(GND) // LPSNC
+
MCFG_DEVICE_ADD("ppi", I8255, 0)
/* video hardware */
@@ -1383,10 +1393,8 @@ DRIVER_INIT_MEMBER(apache3_state,apache3)
tatsumi_reset();
- m_apache3_adc = 0;
m_apache3_rot_idx = 0;
- save_item(NAME(m_apache3_adc));
save_item(NAME(m_apache3_rot_idx));
save_item(NAME(m_apache3_rotate_ctrl));
diff --git a/src/mame/includes/tatsumi.h b/src/mame/includes/tatsumi.h
index c0a8580e9f1..e59535ab043 100644
--- a/src/mame/includes/tatsumi.h
+++ b/src/mame/includes/tatsumi.h
@@ -63,7 +63,8 @@ public:
: tatsumi_state(mconfig, type, tag),
m_subcpu2(*this, "sub2"),
m_apache3_g_ram(*this, "apache3_g_ram"),
- m_apache3_z80_ram(*this, "apache3_z80_ram")
+ m_apache3_z80_ram(*this, "apache3_z80_ram"),
+ m_vr1(*this, "VR1")
{
}
@@ -74,8 +75,7 @@ public:
DECLARE_WRITE16_MEMBER(apache3_v30_v20_w);
DECLARE_READ16_MEMBER(apache3_z80_r);
DECLARE_WRITE16_MEMBER(apache3_z80_w);
- DECLARE_READ8_MEMBER(apache3_adc_r);
- DECLARE_WRITE8_MEMBER(apache3_adc_w);
+ DECLARE_READ8_MEMBER(apache3_vr1_r);
DECLARE_WRITE16_MEMBER(apache3_rotate_w);
DECLARE_WRITE16_MEMBER(apache3_road_z_w);
DECLARE_WRITE8_MEMBER(apache3_road_x_w);
@@ -100,8 +100,9 @@ private:
required_shared_ptr<uint16_t> m_apache3_g_ram;
required_shared_ptr<uint8_t> m_apache3_z80_ram;
+ required_ioport m_vr1;
+
uint16_t m_apache3_rotate_ctrl[12];
- uint8_t m_apache3_adc;
int m_apache3_rot_idx;
std::unique_ptr<uint8_t[]> m_apache3_road_x_ram;
uint8_t m_apache3_road_z;
diff --git a/src/mame/machine/tatsumi.cpp b/src/mame/machine/tatsumi.cpp
index 3052a41d5a6..3b4a1dd5835 100644
--- a/src/mame/machine/tatsumi.cpp
+++ b/src/mame/machine/tatsumi.cpp
@@ -102,26 +102,9 @@ WRITE16_MEMBER(apache3_state::apache3_z80_w)
m_apache3_z80_ram[offset] = data & 0xff;
}
-READ8_MEMBER(apache3_state::apache3_adc_r)
+READ8_MEMBER(apache3_state::apache3_vr1_r)
{
- switch (m_apache3_adc)
- {
- case 0: return ioport("STICK_X")->read();
- case 1: return ioport("STICK_Y")->read();
- case 2: return 0; // VSP1
- case 3: return 0;
- case 4: return (uint8_t)((255./100) * (100 - ioport("VR1")->read()));
- case 5: return ioport("THROTTLE")->read();
- case 6: return 0; // RPSNC
- case 7: return 0; // LPSNC
- }
-
- return 0;
-}
-
-WRITE8_MEMBER(apache3_state::apache3_adc_w)
-{
- m_apache3_adc = offset;
+ return (uint8_t)((255./100) * (100 - m_vr1->read()));
}
/* Ground/sky rotation control