summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2018-04-02 21:20:17 -0400
committer AJR <ajrhacker@users.noreply.github.com>2018-04-02 21:20:17 -0400
commit7c14f1f53ad3f13cc15923dc6a8f5a7615fb6b97 (patch)
tree8b132846a49016cb6b8647a0043f8229792e702c
parente5a6298428d689058990b54de0afe54387622250 (diff)
eprom.cpp: Add ADC0809 device (nw)
-rw-r--r--src/mame/drivers/eprom.cpp58
-rw-r--r--src/mame/includes/eprom.h6
2 files changed, 36 insertions, 28 deletions
diff --git a/src/mame/drivers/eprom.cpp b/src/mame/drivers/eprom.cpp
index 42649a3b55f..760a1800b12 100644
--- a/src/mame/drivers/eprom.cpp
+++ b/src/mame/drivers/eprom.cpp
@@ -80,12 +80,14 @@ READ16_MEMBER(eprom_state::special_port1_r)
}
-READ16_MEMBER(eprom_state::adc_r)
+READ8_MEMBER(eprom_state::adc_r)
{
- static const char *const adcnames[] = { "ADC0", "ADC1", "ADC2", "ADC3" };
- int result = ioport(adcnames[m_last_offset & 3])->read();
+ if (!m_adc.found())
+ return 0xff;
- m_last_offset = offset;
+ uint8_t result = m_adc->data_r(space, 0);
+ if (!machine().side_effects_disabled())
+ m_adc->address_offset_start_w(space, offset, 0);
return result;
}
@@ -154,7 +156,7 @@ void eprom_state::main_map(address_map &map)
map(0x1f0000, 0x1fffff).w("eeprom", FUNC(eeprom_parallel_28xx_device::unlock_write16));
map(0x260000, 0x26000f).portr("260000");
map(0x260010, 0x26001f).r(this, FUNC(eprom_state::special_port1_r));
- map(0x260020, 0x26002f).r(this, FUNC(eprom_state::adc_r));
+ map(0x260020, 0x260027).mirror(0x8).r(this, FUNC(eprom_state::adc_r)).umask16(0x00ff);
map(0x260031, 0x260031).r(m_jsa, FUNC(atari_jsa_base_device::main_response_r));
map(0x2e0000, 0x2e0001).w("watchdog", FUNC(watchdog_timer_device::reset16_w));
map(0x360000, 0x360001).w(this, FUNC(eprom_state::video_int_ack_w));
@@ -180,7 +182,7 @@ void eprom_state::guts_map(address_map &map)
map(0x1f0000, 0x1fffff).w("eeprom", FUNC(eeprom_parallel_28xx_device::unlock_write16));
map(0x260000, 0x26000f).portr("260000");
map(0x260010, 0x26001f).r(this, FUNC(eprom_state::special_port1_r));
- map(0x260020, 0x26002f).r(this, FUNC(eprom_state::adc_r));
+ map(0x260020, 0x260027).mirror(0x8).r(this, FUNC(eprom_state::adc_r)).umask16(0x00ff);
map(0x260031, 0x260031).r(m_jsa, FUNC(atari_jsa_ii_device::main_response_r));
map(0x2e0000, 0x2e0001).w("watchdog", FUNC(watchdog_timer_device::reset16_w));
map(0x360000, 0x360001).w(this, FUNC(eprom_state::video_int_ack_w));
@@ -211,7 +213,7 @@ void eprom_state::extra_map(address_map &map)
map(0x16cc00, 0x16cc01).rw(this, FUNC(eprom_state::sync_r), FUNC(eprom_state::sync_w<false>)).share("sync_data");
map(0x260000, 0x26000f).portr("260000");
map(0x260010, 0x26001f).r(this, FUNC(eprom_state::special_port1_r));
- map(0x260020, 0x26002f).r(this, FUNC(eprom_state::adc_r));
+ map(0x260020, 0x260027).mirror(0x8).r(this, FUNC(eprom_state::adc_r)).umask16(0x00ff);
map(0x260031, 0x260031).r(m_jsa, FUNC(atari_jsa_base_device::main_response_r));
map(0x360000, 0x360001).w(this, FUNC(eprom_state::video_int_ack_w));
map(0x360010, 0x360011).w(this, FUNC(eprom_state::eprom_latch_w));
@@ -241,7 +243,7 @@ static INPUT_PORTS_START( eprom )
PORT_SERVICE( 0x0002, IP_ACTIVE_LOW )
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_ATARI_JSA_SOUND_TO_MAIN_READY("jsa") /* Input buffer full (@260030) */
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_ATARI_JSA_MAIN_TO_SOUND_READY("jsa") /* Output buffer full (@360030) */
- PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_UNUSED ) /* ADEOC, end of conversion */
+ PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("adc", adc0808_device, eoc_r)
PORT_BIT( 0x00e0, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
@@ -250,20 +252,16 @@ static INPUT_PORTS_START( eprom )
PORT_BIT( 0xf000, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("ADC0") /* ADC0 @ 0x260020 */
- PORT_BIT( 0x00ff, 0x0080, IPT_AD_STICK_Y ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1)
- PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1)
PORT_START("ADC1") /* ADC1 @ 0x260022 */
- PORT_BIT( 0x00ff, 0x0080, IPT_AD_STICK_X ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_REVERSE PORT_PLAYER(1)
- PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_REVERSE PORT_PLAYER(1)
PORT_START("ADC2") /* ADC0 @ 0x260024 */
- PORT_BIT( 0x00ff, 0x0080, IPT_AD_STICK_Y ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(2)
- PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(2)
PORT_START("ADC3") /* ADC1 @ 0x260026 */
- PORT_BIT( 0x00ff, 0x0080, IPT_AD_STICK_X ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_REVERSE PORT_PLAYER(2)
- PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_REVERSE PORT_PLAYER(2)
INPUT_PORTS_END
@@ -284,7 +282,7 @@ static INPUT_PORTS_START( klaxp )
PORT_SERVICE( 0x0002, IP_ACTIVE_LOW )
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_ATARI_JSA_SOUND_TO_MAIN_READY("jsa") /* Input buffer full (@260030) */
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_ATARI_JSA_MAIN_TO_SOUND_READY("jsa") /* Output buffer full (@360030) */
- PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_UNUSED ) /* ADEOC, end of conversion */
+ PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x00e0, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
@@ -311,7 +309,7 @@ static INPUT_PORTS_START( guts )
PORT_SERVICE( 0x0002, IP_ACTIVE_LOW )
PORT_BIT( 0x0004, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_ATARI_JSA_SOUND_TO_MAIN_READY("jsa") /* Input buffer full (@260030) */
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_CUSTOM ) PORT_ATARI_JSA_MAIN_TO_SOUND_READY("jsa") /* Output buffer full (@360030) */
- PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_UNUSED ) /* ADEOC, end of conversion */
+ PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_CUSTOM ) PORT_READ_LINE_DEVICE_MEMBER("adc", adc0808_device, eoc_r)
PORT_BIT( 0x00e0, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
@@ -320,20 +318,16 @@ static INPUT_PORTS_START( guts )
PORT_BIT( 0xf000, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("ADC0") /* ADC0 @ 0x260020 */
- PORT_BIT( 0x00ff, 0x0080, IPT_AD_STICK_Y ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1)
- PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1)
PORT_START("ADC1") /* ADC1 @ 0x260022 */
- PORT_BIT( 0x00ff, 0x0080, IPT_AD_STICK_X ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1) PORT_REVERSE
- PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(1) PORT_REVERSE
PORT_START("ADC2") /* ADC0 @ 0x260024 */
- PORT_BIT( 0x00ff, 0x0080, IPT_AD_STICK_Y ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(2)
- PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(2)
PORT_START("ADC3") /* ADC1 @ 0x260026 */
- PORT_BIT( 0x00ff, 0x0080, IPT_AD_STICK_X ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(2) PORT_REVERSE
- PORT_BIT( 0xff00, IP_ACTIVE_LOW, IPT_UNUSED )
+ PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x10,0xf0) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_PLAYER(2) PORT_REVERSE
INPUT_PORTS_END
@@ -399,6 +393,12 @@ MACHINE_CONFIG_START(eprom_state::eprom)
MCFG_QUANTUM_TIME(attotime::from_hz(6000))
+ MCFG_DEVICE_ADD("adc", ADC0809, ATARI_CLOCK_14MHz/16)
+ MCFG_ADC0808_IN0_CB(IOPORT("ADC0"))
+ MCFG_ADC0808_IN1_CB(IOPORT("ADC1"))
+ MCFG_ADC0808_IN2_CB(IOPORT("ADC2"))
+ MCFG_ADC0808_IN3_CB(IOPORT("ADC3"))
+
MCFG_EEPROM_2804_ADD("eeprom")
MCFG_EEPROM_28XX_LOCK_AFTER_WRITE(true)
@@ -484,6 +484,12 @@ MACHINE_CONFIG_START(eprom_state::guts)
MCFG_QUANTUM_TIME(attotime::from_hz(600))
+ MCFG_DEVICE_ADD("adc", ADC0809, ATARI_CLOCK_14MHz/16)
+ MCFG_ADC0808_IN0_CB(IOPORT("ADC0"))
+ MCFG_ADC0808_IN1_CB(IOPORT("ADC1"))
+ MCFG_ADC0808_IN2_CB(IOPORT("ADC2"))
+ MCFG_ADC0808_IN3_CB(IOPORT("ADC3"))
+
MCFG_EEPROM_2804_ADD("eeprom")
MCFG_EEPROM_28XX_LOCK_AFTER_WRITE(true)
diff --git a/src/mame/includes/eprom.h b/src/mame/includes/eprom.h
index 6cb77995af6..3f1e0f5e91a 100644
--- a/src/mame/includes/eprom.h
+++ b/src/mame/includes/eprom.h
@@ -10,6 +10,7 @@
#pragma once
+#include "machine/adc0808.h"
#include "machine/atarigen.h"
#include "audio/atarijsa.h"
#include "video/atarimo.h"
@@ -23,6 +24,7 @@ public:
m_alpha_tilemap(*this, "alpha"),
m_mob(*this, "mob"),
m_jsa(*this, "jsa"),
+ m_adc(*this, "adc"),
m_extra(*this, "extra")
{ }
@@ -36,7 +38,7 @@ protected:
virtual void update_interrupts() override;
virtual void scanline_update(screen_device &screen, int scanline) override;
DECLARE_READ16_MEMBER(special_port1_r);
- DECLARE_READ16_MEMBER(adc_r);
+ DECLARE_READ8_MEMBER(adc_r);
DECLARE_WRITE16_MEMBER(eprom_latch_w);
DECLARE_READ16_MEMBER(sync_r);
template<bool maincpu> DECLARE_WRITE16_MEMBER(sync_w);
@@ -60,7 +62,7 @@ private:
int m_screen_intensity;
int m_video_disable;
uint16_t m_sync_data;
- int m_last_offset;
+ optional_device<adc0808_device> m_adc;
optional_device<cpu_device> m_extra;
static const atari_motion_objects_config s_mob_config;
static const atari_motion_objects_config s_guts_mob_config;