mirror of
https://github.com/holub/mame
synced 2025-10-06 09:00:04 +03:00
(MAME) nflfoot: Refactored to use z80dart. (nw)
This commit is contained in:
parent
ed6cb5ba4a
commit
c8664d0f57
@ -298,14 +298,6 @@ static UINT8 last_op4;
|
|||||||
static UINT8 dpoker_coin_status;
|
static UINT8 dpoker_coin_status;
|
||||||
static UINT8 dpoker_output;
|
static UINT8 dpoker_output;
|
||||||
|
|
||||||
static UINT8 nflfoot_serial_out_active;
|
|
||||||
static UINT8 nflfoot_serial_out_bits;
|
|
||||||
static UINT8 nflfoot_serial_out_numbits;
|
|
||||||
|
|
||||||
static UINT8 nflfoot_serial_in_active;
|
|
||||||
static UINT16 nflfoot_serial_in_bits;
|
|
||||||
static UINT8 nflfoot_serial_in_numbits;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
WRITE8_MEMBER(mcr_state::mcr_control_port_w)
|
WRITE8_MEMBER(mcr_state::mcr_control_port_w)
|
||||||
@ -647,30 +639,10 @@ WRITE8_MEMBER(mcr_state::dotron_op4_w)
|
|||||||
*
|
*
|
||||||
*************************************/
|
*************************************/
|
||||||
|
|
||||||
WRITE16_MEMBER(mcr_state::mcr_ipu_sio_transmit)
|
|
||||||
{
|
|
||||||
logerror("ipu_sio_transmit: %02X\n", data);
|
|
||||||
|
|
||||||
/* create a 10-bit value with a '1','0' sequence for the start bit */
|
|
||||||
nflfoot_serial_in_active = TRUE;
|
|
||||||
nflfoot_serial_in_bits = (data << 2) | 1;
|
|
||||||
nflfoot_serial_in_numbits = 10;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
READ8_MEMBER(mcr_state::nflfoot_ip2_r)
|
READ8_MEMBER(mcr_state::nflfoot_ip2_r)
|
||||||
{
|
{
|
||||||
/* bit 7 = J3-2 on IPU board = TXDA on SIO */
|
/* bit 7 = J3-2 on IPU board = TXDA on SIO */
|
||||||
UINT8 val = 0x80;
|
UINT8 val = m_sio_txda << 7;
|
||||||
|
|
||||||
/* we only do this if we have active data */
|
|
||||||
if (nflfoot_serial_in_active)
|
|
||||||
{
|
|
||||||
val = (nflfoot_serial_in_bits & 1) ? 0x00 : 0x80;
|
|
||||||
nflfoot_serial_in_bits >>= 1;
|
|
||||||
if (--nflfoot_serial_in_numbits == 0)
|
|
||||||
nflfoot_serial_in_active = FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (space.device().safe_pc() != 0x107)
|
if (space.device().safe_pc() != 0x107)
|
||||||
logerror("%04X:ip2_r = %02X\n", space.device().safe_pc(), val);
|
logerror("%04X:ip2_r = %02X\n", space.device().safe_pc(), val);
|
||||||
@ -680,42 +652,13 @@ READ8_MEMBER(mcr_state::nflfoot_ip2_r)
|
|||||||
|
|
||||||
WRITE8_MEMBER(mcr_state::nflfoot_op4_w)
|
WRITE8_MEMBER(mcr_state::nflfoot_op4_w)
|
||||||
{
|
{
|
||||||
z80sio_device *sio = machine().device<z80sio_device>("ipu_sio");
|
|
||||||
|
|
||||||
/* bit 7 = J3-7 on IPU board = /RXDA on SIO */
|
|
||||||
logerror("%04X:op4_w(%d%d%d)\n", space.device().safe_pc(), (data >> 7) & 1, (data >> 6) & 1, (data >> 5) & 1);
|
logerror("%04X:op4_w(%d%d%d)\n", space.device().safe_pc(), (data >> 7) & 1, (data >> 6) & 1, (data >> 5) & 1);
|
||||||
|
|
||||||
/* look for a non-zero start bit to go active */
|
/* bit 7 = J3-7 on IPU board = /RXDA on SIO */
|
||||||
if (!nflfoot_serial_out_active && (data & 0x80))
|
m_sio->rxa_w(!((data >> 7) & 1));
|
||||||
{
|
|
||||||
nflfoot_serial_out_active = TRUE;
|
|
||||||
nflfoot_serial_out_bits = 0;
|
|
||||||
nflfoot_serial_out_numbits = 0;
|
|
||||||
logerror(" -- serial active\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
/* accumulate bits as they are written */
|
|
||||||
else if (nflfoot_serial_out_active)
|
|
||||||
{
|
|
||||||
/* if we've accumulated less than 8, just add to the pile */
|
|
||||||
if (nflfoot_serial_out_numbits < 8)
|
|
||||||
{
|
|
||||||
nflfoot_serial_out_bits = (nflfoot_serial_out_bits >> 1) | (~data & 0x80);
|
|
||||||
nflfoot_serial_out_numbits++;
|
|
||||||
logerror(" -- accumulated %d bits\n", nflfoot_serial_out_numbits);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* once we have 8, the final bit is a stop bit, feed it to the SIO */
|
|
||||||
else
|
|
||||||
{
|
|
||||||
logerror(" -- stop bit = %d; final value = %02X\n", (data >> 7) & 1, nflfoot_serial_out_bits);
|
|
||||||
nflfoot_serial_out_active = FALSE;
|
|
||||||
sio->receive_data(0, nflfoot_serial_out_bits);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* bit 6 = J3-3 on IPU board = CTSA on SIO */
|
/* bit 6 = J3-3 on IPU board = CTSA on SIO */
|
||||||
sio->set_cts(0, (data >> 6) & 1);
|
m_sio->ctsa_w((data >> 6) & 1);
|
||||||
|
|
||||||
/* bit 4 = SEL0 (J1-8) on squawk n talk board */
|
/* bit 4 = SEL0 (J1-8) on squawk n talk board */
|
||||||
/* bits 3-0 = MD3-0 connected to squawk n talk (J1-4,3,2,1) */
|
/* bits 3-0 = MD3-0 connected to squawk n talk (J1-4,3,2,1) */
|
||||||
@ -855,7 +798,7 @@ static ADDRESS_MAP_START( ipu_91695_portmap, AS_IO, 8, mcr_state )
|
|||||||
ADDRESS_MAP_UNMAP_HIGH
|
ADDRESS_MAP_UNMAP_HIGH
|
||||||
ADDRESS_MAP_GLOBAL_MASK(0xff)
|
ADDRESS_MAP_GLOBAL_MASK(0xff)
|
||||||
AM_RANGE(0x00, 0x03) AM_MIRROR(0xe0) AM_DEVREADWRITE("ipu_pio0", z80pio_device, read, write)
|
AM_RANGE(0x00, 0x03) AM_MIRROR(0xe0) AM_DEVREADWRITE("ipu_pio0", z80pio_device, read, write)
|
||||||
AM_RANGE(0x04, 0x07) AM_MIRROR(0xe0) AM_DEVREADWRITE("ipu_sio", z80sio_device, read, write)
|
AM_RANGE(0x04, 0x07) AM_MIRROR(0xe0) AM_DEVREADWRITE("ipu_sio", z80dart_device, cd_ba_r, cd_ba_w)
|
||||||
AM_RANGE(0x08, 0x0b) AM_MIRROR(0xe0) AM_DEVREADWRITE("ipu_ctc", z80ctc_device, read, write)
|
AM_RANGE(0x08, 0x0b) AM_MIRROR(0xe0) AM_DEVREADWRITE("ipu_ctc", z80ctc_device, read, write)
|
||||||
AM_RANGE(0x0c, 0x0f) AM_MIRROR(0xe0) AM_DEVREADWRITE("ipu_pio1", z80pio_device, read, write)
|
AM_RANGE(0x0c, 0x0f) AM_MIRROR(0xe0) AM_DEVREADWRITE("ipu_pio1", z80pio_device, read, write)
|
||||||
AM_RANGE(0x10, 0x13) AM_MIRROR(0xe0) AM_WRITE(mcr_ipu_laserdisk_w)
|
AM_RANGE(0x10, 0x13) AM_MIRROR(0xe0) AM_WRITE(mcr_ipu_laserdisk_w)
|
||||||
@ -1962,7 +1905,10 @@ static MACHINE_CONFIG_DERIVED( mcr_91490_ipu, mcr_91490_snt )
|
|||||||
MCFG_DEVICE_ADD("ipu_pio1", Z80PIO, 7372800/2)
|
MCFG_DEVICE_ADD("ipu_pio1", Z80PIO, 7372800/2)
|
||||||
MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("ipu", INPUT_LINE_IRQ0))
|
MCFG_Z80PIO_OUT_INT_CB(INPUTLINE("ipu", INPUT_LINE_IRQ0))
|
||||||
|
|
||||||
MCFG_Z80SIO_ADD("ipu_sio", 7372800/2 /* same as "ipu" */, nflfoot_sio_intf)
|
MCFG_Z80SIO0_ADD("ipu_sio", 7372800/2, 0, 0, 0, 0)
|
||||||
|
MCFG_Z80DART_OUT_INT_CB(INPUTLINE("ipu", INPUT_LINE_IRQ0))
|
||||||
|
MCFG_Z80DART_OUT_TXDA_CB(WRITELINE(mcr_state, sio_txda_w))
|
||||||
|
MCFG_Z80DART_OUT_TXDB_CB(WRITELINE(mcr_state, sio_txdb_w))
|
||||||
MACHINE_CONFIG_END
|
MACHINE_CONFIG_END
|
||||||
|
|
||||||
|
|
||||||
@ -2929,15 +2875,8 @@ DRIVER_INIT_MEMBER(mcr_state,nflfoot)
|
|||||||
machine().device<midway_ssio_device>("ssio")->set_custom_input(2, 0x80, read8_delegate(FUNC(mcr_state::nflfoot_ip2_r),this));
|
machine().device<midway_ssio_device>("ssio")->set_custom_input(2, 0x80, read8_delegate(FUNC(mcr_state::nflfoot_ip2_r),this));
|
||||||
machine().device<midway_ssio_device>("ssio")->set_custom_output(4, 0xff, write8_delegate(FUNC(mcr_state::nflfoot_op4_w),this));
|
machine().device<midway_ssio_device>("ssio")->set_custom_output(4, 0xff, write8_delegate(FUNC(mcr_state::nflfoot_op4_w),this));
|
||||||
|
|
||||||
nflfoot_serial_out_active = FALSE;
|
save_item(NAME(m_sio_txda));
|
||||||
nflfoot_serial_in_active = FALSE;
|
save_item(NAME(m_sio_txdb));
|
||||||
|
|
||||||
save_item(NAME(nflfoot_serial_out_active));
|
|
||||||
save_item(NAME(nflfoot_serial_out_bits));
|
|
||||||
save_item(NAME(nflfoot_serial_out_numbits));
|
|
||||||
save_item(NAME(nflfoot_serial_in_active));
|
|
||||||
save_item(NAME(nflfoot_serial_in_bits));
|
|
||||||
save_item(NAME(nflfoot_serial_in_numbits));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#include "cpu/z80/z80daisy.h"
|
#include "cpu/z80/z80daisy.h"
|
||||||
#include "machine/z80ctc.h"
|
#include "machine/z80ctc.h"
|
||||||
#include "machine/z80pio.h"
|
#include "machine/z80pio.h"
|
||||||
#include "machine/z80sio.h"
|
#include "machine/z80dart.h"
|
||||||
#include "audio/midway.h"
|
#include "audio/midway.h"
|
||||||
#include "sound/samples.h"
|
#include "sound/samples.h"
|
||||||
|
|
||||||
@ -28,6 +28,7 @@ public:
|
|||||||
m_spriteram(*this, "spriteram"),
|
m_spriteram(*this, "spriteram"),
|
||||||
m_videoram(*this, "videoram"),
|
m_videoram(*this, "videoram"),
|
||||||
m_paletteram(*this, "paletteram"),
|
m_paletteram(*this, "paletteram"),
|
||||||
|
m_sio(*this, "ipu_sio"),
|
||||||
m_ssio(*this, "ssio"),
|
m_ssio(*this, "ssio"),
|
||||||
m_chip_squeak_deluxe(*this, "csd"),
|
m_chip_squeak_deluxe(*this, "csd"),
|
||||||
m_sounds_good(*this, "sg"),
|
m_sounds_good(*this, "sg"),
|
||||||
@ -37,7 +38,9 @@ public:
|
|||||||
m_dpoker_hopper_timer(*this, "dp_hopper"),
|
m_dpoker_hopper_timer(*this, "dp_hopper"),
|
||||||
m_samples(*this, "samples"),
|
m_samples(*this, "samples"),
|
||||||
m_gfxdecode(*this, "gfxdecode"),
|
m_gfxdecode(*this, "gfxdecode"),
|
||||||
m_palette(*this, "palette") { }
|
m_palette(*this, "palette"),
|
||||||
|
m_sio_txda(0),
|
||||||
|
m_sio_txdb(0) { }
|
||||||
|
|
||||||
// these should be required but can't because mcr68 shares with us
|
// these should be required but can't because mcr68 shares with us
|
||||||
// once the sound boards are properly device-ified, fix this
|
// once the sound boards are properly device-ified, fix this
|
||||||
@ -47,6 +50,7 @@ public:
|
|||||||
optional_shared_ptr<UINT8> m_videoram;
|
optional_shared_ptr<UINT8> m_videoram;
|
||||||
optional_shared_ptr<UINT8> m_paletteram;
|
optional_shared_ptr<UINT8> m_paletteram;
|
||||||
|
|
||||||
|
optional_device<z80dart_device> m_sio;
|
||||||
optional_device<midway_ssio_device> m_ssio;
|
optional_device<midway_ssio_device> m_ssio;
|
||||||
optional_device<midway_chip_squeak_deluxe_device> m_chip_squeak_deluxe;
|
optional_device<midway_chip_squeak_deluxe_device> m_chip_squeak_deluxe;
|
||||||
optional_device<midway_sounds_good_device> m_sounds_good;
|
optional_device<midway_sounds_good_device> m_sounds_good;
|
||||||
@ -118,21 +122,22 @@ public:
|
|||||||
TIMER_DEVICE_CALLBACK_MEMBER(dpoker_coin_in_callback);
|
TIMER_DEVICE_CALLBACK_MEMBER(dpoker_coin_in_callback);
|
||||||
TIMER_DEVICE_CALLBACK_MEMBER(mcr_interrupt);
|
TIMER_DEVICE_CALLBACK_MEMBER(mcr_interrupt);
|
||||||
TIMER_DEVICE_CALLBACK_MEMBER(mcr_ipu_interrupt);
|
TIMER_DEVICE_CALLBACK_MEMBER(mcr_ipu_interrupt);
|
||||||
DECLARE_WRITE16_MEMBER(mcr_ipu_sio_transmit);
|
DECLARE_WRITE_LINE_MEMBER(sio_txda_w);
|
||||||
DECLARE_WRITE_LINE_MEMBER(ipu_ctc_interrupt);
|
DECLARE_WRITE_LINE_MEMBER(sio_txdb_w);
|
||||||
DECLARE_WRITE8_MEMBER(ipu_break_changed);
|
|
||||||
void mcr_set_color(int index, int data);
|
void mcr_set_color(int index, int data);
|
||||||
void journey_set_color(int index, int data);
|
void journey_set_color(int index, int data);
|
||||||
void render_sprites_91399(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
void render_sprites_91399(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||||
void render_sprites_91464(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int primask, int sprmask, int colormask);
|
void render_sprites_91464(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int primask, int sprmask, int colormask);
|
||||||
void mcr_init(int cpuboard, int vidboard, int ssioboard);
|
void mcr_init(int cpuboard, int vidboard, int ssioboard);
|
||||||
|
|
||||||
|
int m_sio_txda;
|
||||||
|
int m_sio_txdb;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*----------- defined in machine/mcr.c -----------*/
|
/*----------- defined in machine/mcr.c -----------*/
|
||||||
|
|
||||||
extern const z80_daisy_config mcr_daisy_chain[];
|
extern const z80_daisy_config mcr_daisy_chain[];
|
||||||
extern const z80_daisy_config mcr_ipu_daisy_chain[];
|
extern const z80_daisy_config mcr_ipu_daisy_chain[];
|
||||||
extern const z80sio_interface nflfoot_sio_intf;
|
|
||||||
extern UINT8 mcr_cocktail_flip;
|
extern UINT8 mcr_cocktail_flip;
|
||||||
|
|
||||||
extern const gfx_layout mcr_bg_layout;
|
extern const gfx_layout mcr_bg_layout;
|
||||||
|
@ -92,22 +92,6 @@ const z80_daisy_config mcr_ipu_daisy_chain[] =
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
WRITE_LINE_MEMBER(mcr_state::ipu_ctc_interrupt)
|
|
||||||
{
|
|
||||||
m_ipu->set_input_line(0, state);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
const z80sio_interface nflfoot_sio_intf =
|
|
||||||
{
|
|
||||||
DEVCB_DRIVER_LINE_MEMBER(mcr_state,ipu_ctc_interrupt), /* interrupt handler */
|
|
||||||
DEVCB_NULL, /* DTR changed handler */
|
|
||||||
DEVCB_NULL, /* RTS changed handler */
|
|
||||||
DEVCB_DRIVER_MEMBER(mcr_state,ipu_break_changed), /* BREAK changed handler */
|
|
||||||
DEVCB_DRIVER_MEMBER16(mcr_state,mcr_ipu_sio_transmit)/* transmit handler */
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************
|
/*************************************
|
||||||
*
|
*
|
||||||
@ -185,17 +169,18 @@ TIMER_DEVICE_CALLBACK_MEMBER(mcr_state::mcr_ipu_interrupt)
|
|||||||
*
|
*
|
||||||
*************************************/
|
*************************************/
|
||||||
|
|
||||||
WRITE8_MEMBER(mcr_state::ipu_break_changed)
|
WRITE_LINE_MEMBER(mcr_state::sio_txda_w)
|
||||||
{
|
{
|
||||||
/* channel B is connected to the CED player */
|
m_sio_txda = !state;
|
||||||
if (offset == 1)
|
|
||||||
{
|
|
||||||
logerror("DTR changed -> %d\n", data);
|
|
||||||
if (data == 1)
|
|
||||||
downcast<z80sio_device *>(machine().device("ipu_sio"))->receive_data(1, 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WRITE_LINE_MEMBER(mcr_state::sio_txdb_w)
|
||||||
|
{
|
||||||
|
// disc player
|
||||||
|
m_sio_txdb = !state;
|
||||||
|
|
||||||
|
m_sio->rxb_w(state);
|
||||||
|
}
|
||||||
|
|
||||||
WRITE8_MEMBER(mcr_state::mcr_ipu_laserdisk_w)
|
WRITE8_MEMBER(mcr_state::mcr_ipu_laserdisk_w)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user