summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2017-06-18 20:15:13 -0400
committer AJR <ajrhacker@users.noreply.github.com>2017-06-18 20:15:13 -0400
commite14c43ae7e8c11d0fd729d0da267959264d798f4 (patch)
tree6c6ddb1f8f935755a6ae14fe02f475213110393c
parent50ab64de8a7d8533f3ccff54da3277fa6d5787f6 (diff)
norautp: Make 8255 handshaking work (nw)
-rw-r--r--src/mame/drivers/norautp.cpp36
-rw-r--r--src/mame/includes/norautp.h13
2 files changed, 32 insertions, 17 deletions
diff --git a/src/mame/drivers/norautp.cpp b/src/mame/drivers/norautp.cpp
index d0a611f3063..ec3ef54ac88 100644
--- a/src/mame/drivers/norautp.cpp
+++ b/src/mame/drivers/norautp.cpp
@@ -549,10 +549,8 @@
#include "cpu/i8085/i8085.h"
#include "cpu/z80/z80.h"
-#include "machine/i8255.h"
#include "machine/nvram.h"
-#include "screen.h"
#include "speaker.h"
#include "noraut11.lh"
@@ -724,6 +722,23 @@ WRITE8_MEMBER(norautp_state::counterlamps_w)
//}
+WRITE_LINE_MEMBER(norautp_state::ppi2_obf_w)
+{
+ machine().scheduler().synchronize(timer_expired_delegate(FUNC(norautp_state::ppi2_ack), this), state);
+}
+
+TIMER_CALLBACK_MEMBER(norautp_state::ppi2_ack)
+{
+ m_ppi8255[2]->pc6_w(param);
+ if (param == 0)
+ {
+ uint8_t np_addr = m_ppi8255[2]->pb_r();
+ uint8_t vram_data = m_ppi8255[2]->pa_r();
+ m_np_vram[np_addr] = vram_data;
+ }
+}
+
+#ifdef UNUSED_FUNCTION // old implementation
/*game waits for /OBF signal (bit 7) to be set.*/
READ8_MEMBER(norautp_state::test_r)
{
@@ -749,6 +764,7 @@ WRITE8_MEMBER(norautp_state::vram_addr_w)
{
m_np_addr = data;
}
+#endif
/* game waits for bit 4 (0x10) to be reset.*/
READ8_MEMBER(norautp_state::test2_r)
@@ -823,10 +839,10 @@ static ADDRESS_MAP_START( norautp_portmap, AS_IO, 8, norautp_state )
ADDRESS_MAP_GLOBAL_MASK(0xff)
AM_RANGE(0x60, 0x63) AM_MIRROR(0x1c) AM_DEVREADWRITE("ppi8255_0", i8255_device, read, write)
AM_RANGE(0xa0, 0xa3) AM_MIRROR(0x1c) AM_DEVREADWRITE("ppi8255_1", i8255_device, read, write)
-// AM_RANGE(0xc0, 0xc3) AM_MIRROR(0x3c) AM_DEVREADWRITE("ppi8255_2", i8255_device, read, write)
- AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x3c) AM_READWRITE(vram_data_r, vram_data_w)
- AM_RANGE(0xc1, 0xc1) AM_MIRROR(0x3c) AM_WRITE(vram_addr_w)
- AM_RANGE(0xc2, 0xc2) AM_MIRROR(0x3c) AM_READ(test_r)
+ AM_RANGE(0xc0, 0xc3) AM_MIRROR(0x3c) AM_DEVREADWRITE("ppi8255_2", i8255_device, read, write)
+ //AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x3c) AM_READWRITE(vram_data_r, vram_data_w)
+ //AM_RANGE(0xc1, 0xc1) AM_MIRROR(0x3c) AM_WRITE(vram_addr_w)
+ //AM_RANGE(0xc2, 0xc2) AM_MIRROR(0x3c) AM_READ(test_r)
AM_RANGE(0xef, 0xef) AM_READ(test2_r)
ADDRESS_MAP_END
@@ -1230,14 +1246,10 @@ static MACHINE_CONFIG_START( noraut_base )
MCFG_I8255_IN_PORTB_CB(IOPORT("IN1"))
MCFG_I8255_OUT_PORTC_CB(WRITE8(norautp_state, soundlamps_w))
- //MCFG_DEVICE_ADD("ppi8255_2", I8255, 0)
+ MCFG_DEVICE_ADD("ppi8255_2", I8255, 0)
/* (c0-c3) Group A Mode 2 (5-lines handshacked bidirectional port)
Group B Mode 0, output; (see below for lines PC0-PC2) */
- //MCFG_I8255_IN_PORTA_CB(READ8(norautp_state, vram_data_r)) // VRAM data read
- //MCFG_I8255_OUT_PORTA_CB(WRITE8(norautp_state, vram_data_w)) // VRAM data write
- //MCFG_I8255_OUT_PORTB_CB(WRITE8(norautp_state, vram_addr_w)) // VRAM address write
- //MCFG_I8255_IN_PORTC_CB(READ8(norautp_state, ppi2_portc_r))
- //MCFG_I8255_OUT_PORTC_CB(WRITE8(norautp_state, ppi2_portc_w))
+ MCFG_I8255_OUT_PORTC_CB(WRITELINE(norautp_state, ppi2_obf_w)) MCFG_DEVCB_BIT(7)
/* PPI-2 is configured as mixed mode2 and mode0 output.
It means that port A should be bidirectional and port B just as output.
Port C as hshk regs, and P0-P2 as input (norautp, norautjp) or output (other sets). */
diff --git a/src/mame/includes/norautp.h b/src/mame/includes/norautp.h
index 02d95c3e0c1..10413195098 100644
--- a/src/mame/includes/norautp.h
+++ b/src/mame/includes/norautp.h
@@ -1,6 +1,8 @@
// license:BSD-3-Clause
// copyright-holders:Angelo Salese, Roberto Fresca
+#include "machine/i8255.h"
#include "sound/discrete.h"
+#include "screen.h"
/* Discrete Sound Input Nodes */
@@ -14,16 +16,15 @@ public:
norautp_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag) ,
m_maincpu(*this, "maincpu"),
+ m_ppi8255(*this, "ppi8255_%u", 0),
m_discrete(*this, "discrete"),
m_gfxdecode(*this, "gfxdecode"),
+ m_screen(*this, "screen"),
m_palette(*this, "palette") { }
std::unique_ptr<uint16_t[]> m_np_vram;
- uint16_t m_np_addr;
- DECLARE_READ8_MEMBER(test_r);
- DECLARE_READ8_MEMBER(vram_data_r);
- DECLARE_WRITE8_MEMBER(vram_data_w);
- DECLARE_WRITE8_MEMBER(vram_addr_w);
+ DECLARE_WRITE_LINE_MEMBER(ppi2_obf_w);
+ TIMER_CALLBACK_MEMBER(ppi2_ack);
DECLARE_READ8_MEMBER(test2_r);
DECLARE_WRITE8_MEMBER(mainlamps_w);
DECLARE_WRITE8_MEMBER(soundlamps_w);
@@ -35,8 +36,10 @@ public:
DECLARE_PALETTE_INIT(norautp);
uint32_t screen_update_norautp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
required_device<cpu_device> m_maincpu;
+ required_device_array<i8255_device, 3> m_ppi8255;
required_device<discrete_device> m_discrete;
required_device<gfxdecode_device> m_gfxdecode;
+ required_device<screen_device> m_screen;
required_device<palette_device> m_palette;
};