summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/rotaryf.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/drivers/rotaryf.cpp')
-rw-r--r--src/mame/drivers/rotaryf.cpp41
1 files changed, 28 insertions, 13 deletions
diff --git a/src/mame/drivers/rotaryf.cpp b/src/mame/drivers/rotaryf.cpp
index 666657ded91..8aba57fac63 100644
--- a/src/mame/drivers/rotaryf.cpp
+++ b/src/mame/drivers/rotaryf.cpp
@@ -17,6 +17,7 @@ driver by Barry Rodewald
#include "emu.h"
#include "cpu/i8085/i8085.h"
+#include "machine/i8255.h"
#include "sound/samples.h"
#include "sound/sn76477.h"
@@ -42,8 +43,9 @@ public:
required_shared_ptr<uint8_t> m_videoram;
- DECLARE_READ8_MEMBER(port29_r);
- DECLARE_WRITE8_MEMBER(port28_w);
+ DECLARE_READ8_MEMBER(portb_r);
+ DECLARE_WRITE8_MEMBER(porta_w);
+ DECLARE_WRITE8_MEMBER(portc_w);
DECLARE_WRITE8_MEMBER(port30_w);
bool m_flipscreen;
@@ -75,11 +77,13 @@ static const char *const rotaryf_sample_names[] =
void rotaryf_state::machine_start()
{
+ m_last = 0xff;
+
save_item(NAME(m_flipscreen));
save_item(NAME(m_last));
}
-READ8_MEMBER( rotaryf_state::port29_r )
+READ8_MEMBER(rotaryf_state::portb_r)
{
uint8_t data = ioport("INPUTS")->read();
@@ -88,7 +92,7 @@ READ8_MEMBER( rotaryf_state::port29_r )
return (data & 0xCD) | ((data & 0x01) << 1) | ((data & 0x0c) << 2);
}
-WRITE8_MEMBER( rotaryf_state::port28_w )
+WRITE8_MEMBER(rotaryf_state::porta_w)
{
uint8_t rising_bits = data & ~m_last;
@@ -111,7 +115,17 @@ WRITE8_MEMBER( rotaryf_state::port28_w )
m_last = data;
}
-WRITE8_MEMBER( rotaryf_state::port30_w )
+WRITE8_MEMBER(rotaryf_state::portc_w)
+{
+ if (data == 0xff)
+ return;
+
+ machine().bookkeeping().coin_counter_w(0, BIT(data, 1));
+
+ // bit 5 set when game starts, but isn't coin lockout?
+}
+
+WRITE8_MEMBER(rotaryf_state::port30_w)
{
/* bit 0 = player 2 is playing */
@@ -184,18 +198,13 @@ static ADDRESS_MAP_START( rotaryf_map, AS_PROGRAM, 8, rotaryf_state )
ADDRESS_MAP_END
static ADDRESS_MAP_START( rotaryf_io_map, AS_IO, 8, rotaryf_state )
- AM_RANGE(0x21, 0x21) AM_READ_PORT("COIN")
- AM_RANGE(0x26, 0x26) AM_READ_PORT("DSW")
- AM_RANGE(0x29, 0x29) AM_READ(port29_r)
-
AM_RANGE(0x02, 0x02) AM_WRITENOP
AM_RANGE(0x04, 0x04) AM_WRITENOP
AM_RANGE(0x07, 0x07) AM_WRITENOP
AM_RANGE(0x20, 0x20) AM_WRITENOP
- AM_RANGE(0x21, 0x21) AM_WRITENOP
- AM_RANGE(0x28, 0x28) AM_WRITE(port28_w)
- AM_RANGE(0x2a, 0x2a) AM_WRITENOP
- AM_RANGE(0x2b, 0x2b) AM_WRITENOP
+ AM_RANGE(0x21, 0x21) AM_READ_PORT("COIN") AM_WRITENOP
+ AM_RANGE(0x26, 0x26) AM_READ_PORT("DSW")
+ AM_RANGE(0x28, 0x2b) AM_DEVREADWRITE("ppi", i8255_device, read, write)
AM_RANGE(0x30, 0x30) AM_WRITE(port30_w)
ADDRESS_MAP_END
@@ -254,6 +263,12 @@ static MACHINE_CONFIG_START( rotaryf )
MCFG_CPU_IO_MAP(rotaryf_io_map)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", rotaryf_state, rotaryf_interrupt, "screen", 0, 1)
+ MCFG_DEVICE_ADD("ppi", I8255, 0)
+ MCFG_I8255_OUT_PORTA_CB(WRITE8(rotaryf_state, porta_w))
+ MCFG_I8255_IN_PORTB_CB(READ8(rotaryf_state, portb_r))
+ MCFG_I8255_OUT_PORTC_CB(WRITE8(rotaryf_state, portc_w))
+ //MCFG_I8255_TRISTATE_PORTC_CB(CONSTANT(0))
+
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_SIZE(32*8, 262) /* vert size is a guess, taken from mw8080bw */