summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2018-04-02 11:28:09 -0400
committer AJR <ajrhacker@users.noreply.github.com>2018-04-02 11:28:09 -0400
commit05e1095b7e54a30cdf1bf052e6880cda99a7f327 (patch)
tree2cbcf91ad00b5e3ac37d426df46d3604e1519749
parentb2394d416b027d04d935f19481bca0ce46e27448 (diff)
foodf: Use ADC0809 device (nw)
-rw-r--r--src/mame/drivers/foodf.cpp45
-rw-r--r--src/mame/includes/foodf.h3
2 files changed, 15 insertions, 33 deletions
diff --git a/src/mame/drivers/foodf.cpp b/src/mame/drivers/foodf.cpp
index c6e6de22a46..01bdbcce39b 100644
--- a/src/mame/drivers/foodf.cpp
+++ b/src/mame/drivers/foodf.cpp
@@ -78,13 +78,14 @@
#include "emu.h"
#include "includes/foodf.h"
#include "cpu/m68000/m68000.h"
+#include "machine/adc0808.h"
#include "machine/atarigen.h"
#include "machine/watchdog.h"
#include "sound/pokey.h"
#include "speaker.h"
-#define MASTER_CLOCK 12096000
+#define MASTER_CLOCK 12.096_MHz_XTAL
/*************************************
@@ -141,7 +142,6 @@ TIMER_DEVICE_CALLBACK_MEMBER(foodf_state::scanline_update_timer)
void foodf_state::machine_start()
{
atarigen_state::machine_start();
- save_item(NAME(m_whichport));
}
@@ -181,27 +181,6 @@ WRITE8_MEMBER(foodf_state::digital_w)
/*************************************
*
- * Analog inputs
- *
- *************************************/
-
-READ16_MEMBER(foodf_state::analog_r)
-{
- static const char *const portnames[] = { "STICK0_X", "STICK1_X", "STICK0_Y", "STICK1_Y" };
-
- return ioport(portnames[m_whichport])->read();
-}
-
-
-WRITE16_MEMBER(foodf_state::analog_w)
-{
- m_whichport = offset ^ 3;
-}
-
-
-
-/*************************************
- *
* Main CPU memory handlers
*
*************************************/
@@ -216,8 +195,8 @@ void foodf_state::main_map(address_map &map)
map(0x01c000, 0x01c0ff).mirror(0x3e3f00).ram().share("spriteram");
map(0x800000, 0x8007ff).mirror(0x03f800).ram().w(m_playfield_tilemap, FUNC(tilemap_device::write16)).share("playfield");
map(0x900000, 0x9001ff).mirror(0x03fe00).rw(m_nvram, FUNC(x2212_device::read), FUNC(x2212_device::write)).umask16(0x00ff);
- map(0x940000, 0x940007).mirror(0x023ff8).r(this, FUNC(foodf_state::analog_r));
- map(0x944000, 0x944007).mirror(0x023ff8).w(this, FUNC(foodf_state::analog_w));
+ map(0x940001, 0x940001).mirror(0x023ffe).r("adc", FUNC(adc0809_device::data_r));
+ map(0x944000, 0x944007).mirror(0x023ff8).w("adc", FUNC(adc0809_device::address_offset_start_w)).umask16(0x00ff);
map(0x948000, 0x948001).mirror(0x023ffe).portr("SYSTEM");
map(0x948001, 0x948001).mirror(0x023ffe).w(this, FUNC(foodf_state::digital_w));
map(0x950000, 0x9501ff).mirror(0x023e00).w(this, FUNC(foodf_state::foodf_paletteram_w)).share("paletteram");
@@ -237,19 +216,19 @@ void foodf_state::main_map(address_map &map)
*************************************/
static INPUT_PORTS_START( foodf )
- PORT_START("STICK0_X") /* IN0 */
+ PORT_START("STICK0_X")
PORT_BIT( 0xff, 0x7f, IPT_AD_STICK_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_REVERSE PORT_PLAYER(1)
- PORT_START("STICK1_X") /* IN1 */
+ PORT_START("STICK1_X")
PORT_BIT( 0xff, 0x7f, IPT_AD_STICK_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_REVERSE PORT_COCKTAIL PORT_PLAYER(2)
- PORT_START("STICK0_Y") /* IN2 */
+ PORT_START("STICK0_Y")
PORT_BIT( 0xff, 0x7f, IPT_AD_STICK_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_REVERSE PORT_PLAYER(1)
- PORT_START("STICK1_Y") /* IN3 */
+ PORT_START("STICK1_Y")
PORT_BIT( 0xff, 0x7f, IPT_AD_STICK_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(10) PORT_REVERSE PORT_COCKTAIL PORT_PLAYER(2)
- PORT_START("SYSTEM") /* IN4 */
+ PORT_START("SYSTEM")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_START1 )
@@ -343,6 +322,12 @@ MACHINE_CONFIG_START(foodf_state::foodf)
MCFG_CPU_ADD("maincpu", M68000, MASTER_CLOCK/2)
MCFG_CPU_PROGRAM_MAP(main_map)
+ MCFG_DEVICE_ADD("adc", ADC0809, MASTER_CLOCK/16)
+ MCFG_ADC0808_IN0_CB(IOPORT("STICK1_Y"))
+ MCFG_ADC0808_IN1_CB(IOPORT("STICK0_Y"))
+ MCFG_ADC0808_IN2_CB(IOPORT("STICK1_X"))
+ MCFG_ADC0808_IN3_CB(IOPORT("STICK0_X"))
+
MCFG_X2212_ADD_AUTOSAVE("nvram")
MCFG_WATCHDOG_ADD("watchdog")
diff --git a/src/mame/includes/foodf.h b/src/mame/includes/foodf.h
index b76869a0944..a143498f1f5 100644
--- a/src/mame/includes/foodf.h
+++ b/src/mame/includes/foodf.h
@@ -33,8 +33,6 @@ protected:
virtual void update_interrupts() override;
DECLARE_WRITE16_MEMBER(nvram_recall_w);
DECLARE_WRITE8_MEMBER(digital_w);
- DECLARE_READ16_MEMBER(analog_r);
- DECLARE_WRITE16_MEMBER(analog_w);
DECLARE_WRITE16_MEMBER(foodf_paletteram_w);
void foodf_set_flip(int flip);
DECLARE_READ8_MEMBER(pot_r);
@@ -53,7 +51,6 @@ private:
double m_bweights[2];
uint8_t m_playfield_flip;
- uint8_t m_whichport;
required_shared_ptr<uint16_t> m_spriteram;
};