norautp: Make 8255 handshaking work (nw)

This commit is contained in:
AJR 2017-06-18 20:15:13 -04:00
parent 50ab64de8a
commit e14c43ae7e
2 changed files with 32 additions and 17 deletions

View File

@ -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). */

View File

@ -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;
};