mcr.cpp, mcr3.cpp: moved some globals into the state class, started splitting some in subclasses (nw)

This commit is contained in:
Ivan Vangelista 2017-12-20 20:33:40 +01:00
parent f33a4cb7dd
commit f28df852dd
7 changed files with 335 additions and 381 deletions

View File

@ -286,23 +286,13 @@
#include "emu.h"
#include "includes/mcr.h"
#include "audio/midway.h"
#include "machine/nvram.h"
#include "sound/samples.h"
#include "screen.h"
#include "speaker.h"
#include "dpoker.lh"
static uint8_t input_mux;
static uint8_t last_op4;
static uint8_t dpoker_coin_status;
static uint8_t dpoker_output;
WRITE8_MEMBER(mcr_state::mcr_control_port_w)
{
/*
@ -320,7 +310,7 @@ WRITE8_MEMBER(mcr_state::mcr_control_port_w)
machine().bookkeeping().coin_counter_w(0, (data >> 0) & 1);
machine().bookkeeping().coin_counter_w(1, (data >> 1) & 1);
machine().bookkeeping().coin_counter_w(2, (data >> 2) & 1);
mcr_cocktail_flip = (data >> 6) & 1;
m_mcr_cocktail_flip = (data >> 6) & 1;
}
@ -337,7 +327,7 @@ READ8_MEMBER(mcr_state::solarfox_ip0_r)
/* mode, they will respond. However, if you try it in a 2-player */
/* game in cocktail mode, they don't work at all. So we fake-mux */
/* the controls through player 1's ports */
if (mcr_cocktail_flip)
if (m_mcr_cocktail_flip)
return ioport("ssio:IP0")->read() | 0x08;
else
return ((ioport("ssio:IP0")->read() & ~0x14) | 0x08) | ((ioport("ssio:IP0")->read() & 0x08) >> 1) | ((ioport("ssio:IP2")->read() & 0x01) << 4);
@ -347,7 +337,7 @@ READ8_MEMBER(mcr_state::solarfox_ip0_r)
READ8_MEMBER(mcr_state::solarfox_ip1_r)
{
/* same deal as above */
if (mcr_cocktail_flip)
if (m_mcr_cocktail_flip)
return ioport("ssio:IP1")->read() | 0xf0;
else
return (ioport("ssio:IP1")->read() >> 4) | 0xf0;
@ -374,39 +364,39 @@ READ8_MEMBER(mcr_state::kick_ip1_r)
*
*************************************/
TIMER_DEVICE_CALLBACK_MEMBER(mcr_state::dpoker_hopper_callback)
TIMER_DEVICE_CALLBACK_MEMBER(mcr_dpoker_state::hopper_callback)
{
if (dpoker_output & 0x40)
if (m_output & 0x40)
{
// hopper timing is a guesstimate
dpoker_coin_status ^= 8;
m_dpoker_hopper_timer->adjust(attotime::from_msec((dpoker_coin_status & 8) ? 100 : 250));
m_coin_status ^= 8;
m_hopper_timer->adjust(attotime::from_msec((m_coin_status & 8) ? 100 : 250));
}
else
{
dpoker_coin_status &= ~8;
m_coin_status &= ~8;
}
machine().bookkeeping().coin_counter_w(3, dpoker_coin_status & 8);
machine().bookkeeping().coin_counter_w(3, m_coin_status & 8);
}
TIMER_DEVICE_CALLBACK_MEMBER(mcr_state::dpoker_coin_in_callback)
TIMER_DEVICE_CALLBACK_MEMBER(mcr_dpoker_state::coin_in_callback)
{
dpoker_coin_status &= ~2;
m_coin_status &= ~2;
}
INPUT_CHANGED_MEMBER(mcr_state::dpoker_coin_in_hit)
INPUT_CHANGED_MEMBER(mcr_dpoker_state::coin_in_hit)
{
if (newval)
{
// The game waits for coin release before it accepts another.
// It probably does this to prevent tampering, good old coin-on-a-string won't work here.
dpoker_coin_status |= 2;
m_dpoker_coin_in_timer->adjust(attotime::from_msec(100));
m_coin_status |= 2;
m_coin_in_timer->adjust(attotime::from_msec(100));
}
}
READ8_MEMBER(mcr_state::dpoker_ip0_r)
READ8_MEMBER(mcr_dpoker_state::ip0_r)
{
// d0: Coin-in Hit
// d1: Coin-in Release
@ -415,13 +405,13 @@ READ8_MEMBER(mcr_state::dpoker_ip0_r)
// d6: Coin-drop Hit
// d7: Coin-drop Release
uint8_t p0 = ioport("ssio:IP0")->read();
p0 |= (dpoker_coin_status >> 1 & 1);
p0 ^= (p0 << 1 & 0x80) | dpoker_coin_status;
p0 |= (m_coin_status >> 1 & 1);
p0 ^= (p0 << 1 & 0x80) | m_coin_status;
return p0;
}
WRITE8_MEMBER(mcr_state::dpoker_lamps1_w)
WRITE8_MEMBER(mcr_dpoker_state::lamps1_w)
{
// cpanel button lamps (white)
output().set_lamp_value(0, data >> 0 & 1); // hold 1
@ -434,7 +424,7 @@ WRITE8_MEMBER(mcr_state::dpoker_lamps1_w)
output().set_lamp_value(7, data >> 3 & 1); // stand
}
WRITE8_MEMBER(mcr_state::dpoker_lamps2_w)
WRITE8_MEMBER(mcr_dpoker_state::lamps2_w)
{
// d5: button lamp: service or change
output().set_lamp_value(8, data >> 5 & 1);
@ -446,7 +436,7 @@ WRITE8_MEMBER(mcr_state::dpoker_lamps2_w)
// d6, d7: unused?
}
WRITE8_MEMBER(mcr_state::dpoker_output_w)
WRITE8_MEMBER(mcr_dpoker_state::output_w)
{
// d0: ? coin return
// d1: ? divertor (active low)
@ -454,15 +444,15 @@ WRITE8_MEMBER(mcr_state::dpoker_output_w)
// d6: assume hopper coin flow
// d7: assume hopper motor
if (data & 0x40 & ~dpoker_output)
m_dpoker_hopper_timer->adjust(attotime::from_msec(500));
if (data & 0x40 & ~m_output)
m_hopper_timer->adjust(attotime::from_msec(500));
// other bits: unused?
dpoker_output = data;
m_output = data;
}
WRITE8_MEMBER(mcr_state::dpoker_meters_w)
WRITE8_MEMBER(mcr_dpoker_state::meters_w)
{
// meters?
}
@ -477,13 +467,13 @@ WRITE8_MEMBER(mcr_state::dpoker_meters_w)
WRITE8_MEMBER(mcr_state::wacko_op4_w)
{
input_mux = data & 1;
m_input_mux = data & 1;
}
READ8_MEMBER(mcr_state::wacko_ip1_r)
{
if (!input_mux)
if (!m_input_mux)
return ioport("ssio:IP1")->read();
else
return ioport("ssio:IP1.ALT")->read();
@ -492,7 +482,7 @@ READ8_MEMBER(mcr_state::wacko_ip1_r)
READ8_MEMBER(mcr_state::wacko_ip2_r)
{
if (!input_mux)
if (!m_input_mux)
return ioport("ssio:IP2")->read();
else
return ioport("ssio:IP2.ALT")->read();
@ -620,14 +610,14 @@ WRITE8_MEMBER(mcr_state::dotron_op4_w)
*/
/* bit 5 = SEL1 (J1-1) on the Lamp Sequencer board */
if (((last_op4 ^ data) & 0x20) && (data & 0x20))
if (((m_last_op4 ^ data) & 0x20) && (data & 0x20))
{
/* bit 2 -> J1-4 = enable */
/* bit 1 -> J1-5 = sequence select */
/* bit 0 -> J1-6 = speed (0=slow, 1=fast) */
logerror("Lamp: en=%d seq=%d speed=%d\n", (data >> 2) & 1, (data >> 1) & 1, data & 1);
}
last_op4 = data;
m_last_op4 = data;
/* 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) */
@ -638,14 +628,14 @@ WRITE8_MEMBER(mcr_state::dotron_op4_w)
/*************************************
*
* NFL Football Tron I/O ports
* NFL Football I/O ports
*
*************************************/
READ8_MEMBER(mcr_state::nflfoot_ip2_r)
READ8_MEMBER(mcr_nflfoot_state::ip2_r)
{
/* bit 7 = J3-2 on IPU board = TXDA on SIO */
uint8_t val = m_sio_txda << 7;
uint8_t val = m_ipu_sio_txda << 7;
if (space.device().safe_pc() != 0x107)
logerror("%04X:ip2_r = %02X\n", space.device().safe_pc(), val);
@ -653,15 +643,15 @@ READ8_MEMBER(mcr_state::nflfoot_ip2_r)
}
WRITE8_MEMBER(mcr_state::nflfoot_op4_w)
WRITE8_MEMBER(mcr_nflfoot_state::op4_w)
{
logerror("%04X:op4_w(%d%d%d)\n", space.device().safe_pc(), (data >> 7) & 1, (data >> 6) & 1, (data >> 5) & 1);
/* bit 7 = J3-7 on IPU board = /RXDA on SIO */
m_sio->rxa_w(!((data >> 7) & 1));
m_ipu_sio->rxa_w(!((data >> 7) & 1));
/* bit 6 = J3-3 on IPU board = CTSA on SIO */
m_sio->ctsa_w((data >> 6) & 1);
m_ipu_sio->ctsa_w((data >> 6) & 1);
/* 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) */
@ -679,21 +669,21 @@ WRITE8_MEMBER(mcr_state::nflfoot_op4_w)
READ8_MEMBER(mcr_state::demoderb_ip1_r)
{
return ioport("ssio:IP1")->read() |
(ioport(input_mux ? "ssio:IP1.ALT2" : "ssio:IP1.ALT1")->read() << 2);
(ioport(m_input_mux ? "ssio:IP1.ALT2" : "ssio:IP1.ALT1")->read() << 2);
}
READ8_MEMBER(mcr_state::demoderb_ip2_r)
{
return ioport("ssio:IP2")->read() |
(ioport(input_mux ? "ssio:IP2.ALT2" : "ssio:IP2.ALT1")->read() << 2);
(ioport(m_input_mux ? "ssio:IP2.ALT2" : "ssio:IP2.ALT1")->read() << 2);
}
WRITE8_MEMBER(mcr_state::demoderb_op4_w)
{
if (data & 0x40) input_mux = 1;
if (data & 0x80) input_mux = 0;
if (data & 0x40) m_input_mux = 1;
if (data & 0x80) m_input_mux = 0;
m_turbo_cheap_squeak->write(space, offset, data);
}
@ -790,22 +780,22 @@ ADDRESS_MAP_END
*************************************/
/* address map verified from schematics */
static ADDRESS_MAP_START( ipu_91695_map, AS_PROGRAM, 8, mcr_state )
static ADDRESS_MAP_START( ipu_91695_map, AS_PROGRAM, 8, mcr_nflfoot_state )
ADDRESS_MAP_UNMAP_HIGH
AM_RANGE(0x0000, 0x3fff) AM_ROM
AM_RANGE(0xe000, 0xffff) AM_RAM
ADDRESS_MAP_END
/* I/O verified from schematics */
static ADDRESS_MAP_START( ipu_91695_portmap, AS_IO, 8, mcr_state )
static ADDRESS_MAP_START( ipu_91695_portmap, AS_IO, 8, mcr_nflfoot_state )
ADDRESS_MAP_UNMAP_HIGH
ADDRESS_MAP_GLOBAL_MASK(0xff)
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", 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(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(0x1c, 0x1f) AM_MIRROR(0xe0) AM_READWRITE(mcr_ipu_watchdog_r, mcr_ipu_watchdog_w)
AM_RANGE(0x10, 0x13) AM_MIRROR(0xe0) AM_WRITE(ipu_laserdisk_w)
AM_RANGE(0x1c, 0x1f) AM_MIRROR(0xe0) AM_READWRITE(ipu_watchdog_r, ipu_watchdog_w)
ADDRESS_MAP_END
@ -944,8 +934,8 @@ INPUT_PORTS_END
static INPUT_PORTS_START( dpoker )
PORT_START("ssio:IP0")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, mcr_state, dpoker_coin_in_hit, nullptr)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SPECIAL ) // see dpoker_ip0_r
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED_MEMBER(DEVICE_SELF, mcr_dpoker_state, coin_in_hit, nullptr)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_SPECIAL ) // see ip0_r
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SPECIAL ) // "
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_SPECIAL ) // "
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_GAMBLE_KEYIN )
@ -1772,8 +1762,6 @@ static MACHINE_CONFIG_START( mcr_90009 )
MCFG_WATCHDOG_ADD("watchdog")
MCFG_WATCHDOG_VBLANK_INIT("screen", 16)
MCFG_MACHINE_START_OVERRIDE(mcr_state,mcr)
MCFG_MACHINE_RESET_OVERRIDE(mcr_state,mcr)
MCFG_NVRAM_ADD_1FILL("nvram")
/* video hardware */
@ -1790,8 +1778,6 @@ static MACHINE_CONFIG_START( mcr_90009 )
MCFG_PALETTE_ADD("palette", 32)
MCFG_PALETTE_FORMAT(xxxxRRRRBBBBGGGG)
MCFG_VIDEO_START_OVERRIDE(mcr_state,mcr)
/* sound hardware */
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
MCFG_SOUND_ADD("ssio", MIDWAY_SSIO, 0)
@ -1804,8 +1790,8 @@ MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( mcr_90009_dp, mcr_90009 )
/* basic machine hardware */
MCFG_TIMER_DRIVER_ADD("dp_coinin", mcr_state, dpoker_coin_in_callback)
MCFG_TIMER_DRIVER_ADD("dp_hopper", mcr_state, dpoker_hopper_callback)
MCFG_TIMER_DRIVER_ADD("coinin", mcr_dpoker_state, coin_in_callback)
MCFG_TIMER_DRIVER_ADD("hopper", mcr_dpoker_state, hopper_callback)
MACHINE_CONFIG_END
@ -1881,14 +1867,12 @@ MACHINE_CONFIG_END
static MACHINE_CONFIG_DERIVED( mcr_91490_ipu, mcr_91490_snt )
/* basic machine hardware */
MCFG_MACHINE_START_OVERRIDE(mcr_state,nflfoot)
MCFG_CPU_ADD("ipu", Z80, 7372800/2)
MCFG_Z80_DAISY_CHAIN(mcr_ipu_daisy_chain)
MCFG_CPU_PROGRAM_MAP(ipu_91695_map)
MCFG_CPU_IO_MAP(ipu_91695_portmap)
MCFG_TIMER_MODIFY("scantimer")
MCFG_TIMER_DRIVER_CALLBACK(mcr_state, mcr_ipu_interrupt)
MCFG_TIMER_DRIVER_CALLBACK(mcr_nflfoot_state, ipu_interrupt)
MCFG_DEVICE_ADD("ipu_ctc", Z80CTC, 7372800/2 /* same as "ipu" */)
MCFG_Z80CTC_INTR_CB(INPUTLINE("ipu", INPUT_LINE_IRQ0))
@ -1901,8 +1885,8 @@ static MACHINE_CONFIG_DERIVED( mcr_91490_ipu, mcr_91490_snt )
MCFG_DEVICE_ADD("ipu_sio", Z80SIO0, 7372800/2)
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))
MCFG_Z80DART_OUT_TXDA_CB(WRITELINE(mcr_nflfoot_state, sio_txda_w))
MCFG_Z80DART_OUT_TXDB_CB(WRITELINE(mcr_nflfoot_state, sio_txdb_w))
MACHINE_CONFIG_END
@ -2772,19 +2756,18 @@ ROM_END
void mcr_state::mcr_init(int cpuboard, int vidboard, int ssioboard)
{
mcr_cpu_board = cpuboard;
mcr_sprite_board = vidboard;
m_mcr_cpu_board = cpuboard;
m_mcr_sprite_board = vidboard;
mcr12_sprite_xoffs = 0;
mcr12_sprite_xoffs_flip = 0;
m_mcr12_sprite_xoffs = 0;
m_mcr12_sprite_xoffs_flip = 0;
save_item(NAME(input_mux));
save_item(NAME(last_op4));
save_item(NAME(m_input_mux));
save_item(NAME(m_last_op4));
midway_ssio_device *ssio = machine().device<midway_ssio_device>("ssio");
if (ssio != nullptr)
if (m_ssio.found())
{
ssio->set_custom_output(0, 0xff, write8_delegate(FUNC(mcr_state::mcr_control_port_w), this));
m_ssio->set_custom_output(0, 0xff, write8_delegate(FUNC(mcr_state::mcr_control_port_w), this));
}
}
@ -2792,28 +2775,28 @@ void mcr_state::mcr_init(int cpuboard, int vidboard, int ssioboard)
DRIVER_INIT_MEMBER(mcr_state,solarfox)
{
mcr_init(90009, 91399, 90908);
mcr12_sprite_xoffs = 16;
m_mcr12_sprite_xoffs = 16;
machine().device<midway_ssio_device>("ssio")->set_custom_input(0, 0x1c, read8_delegate(FUNC(mcr_state::solarfox_ip0_r),this));
machine().device<midway_ssio_device>("ssio")->set_custom_input(1, 0xff, read8_delegate(FUNC(mcr_state::solarfox_ip1_r),this));
m_ssio->set_custom_input(0, 0x1c, read8_delegate(FUNC(mcr_state::solarfox_ip0_r), this));
m_ssio->set_custom_input(1, 0xff, read8_delegate(FUNC(mcr_state::solarfox_ip1_r), this));
}
DRIVER_INIT_MEMBER(mcr_state,kick)
{
mcr_init(90009, 91399, 90908);
mcr12_sprite_xoffs_flip = 16;
m_mcr12_sprite_xoffs_flip = 16;
machine().device<midway_ssio_device>("ssio")->set_custom_input(1, 0xf0, read8_delegate(FUNC(mcr_state::kick_ip1_r),this));
m_ssio->set_custom_input(1, 0xf0, read8_delegate(FUNC(mcr_state::kick_ip1_r), this));
}
DRIVER_INIT_MEMBER(mcr_state,dpoker)
DRIVER_INIT_MEMBER(mcr_dpoker_state,dpoker)
{
mcr_init(90009, 91399, 90908);
mcr12_sprite_xoffs_flip = 16;
m_mcr12_sprite_xoffs_flip = 16;
machine().device<midway_ssio_device>("ssio")->set_custom_input(0, 0x8e, read8_delegate(FUNC(mcr_state::dpoker_ip0_r),this));
m_ssio->set_custom_input(0, 0x8e, read8_delegate(FUNC(mcr_dpoker_state::ip0_r),this));
// meter ram, is it battery backed?
m_maincpu->space(AS_PROGRAM).install_ram(0x8000, 0x81ff);
@ -2823,16 +2806,16 @@ DRIVER_INIT_MEMBER(mcr_state,dpoker)
m_maincpu->space(AS_IO).install_read_port(0x28, 0x28, "P28");
m_maincpu->space(AS_IO).install_read_port(0x2c, 0x2c, "P2C");
m_maincpu->space(AS_IO).install_write_handler(0x2c, 0x2c, write8_delegate(FUNC(mcr_state::dpoker_lamps1_w),this));
m_maincpu->space(AS_IO).install_write_handler(0x30, 0x30, write8_delegate(FUNC(mcr_state::dpoker_lamps2_w),this));
m_maincpu->space(AS_IO).install_write_handler(0x34, 0x34, write8_delegate(FUNC(mcr_state::dpoker_output_w),this));
m_maincpu->space(AS_IO).install_write_handler(0x3f, 0x3f, write8_delegate(FUNC(mcr_state::dpoker_meters_w),this));
m_maincpu->space(AS_IO).install_write_handler(0x2c, 0x2c, write8_delegate(FUNC(mcr_dpoker_state::lamps1_w),this));
m_maincpu->space(AS_IO).install_write_handler(0x30, 0x30, write8_delegate(FUNC(mcr_dpoker_state::lamps2_w),this));
m_maincpu->space(AS_IO).install_write_handler(0x34, 0x34, write8_delegate(FUNC(mcr_dpoker_state::output_w),this));
m_maincpu->space(AS_IO).install_write_handler(0x3f, 0x3f, write8_delegate(FUNC(mcr_dpoker_state::meters_w),this));
dpoker_coin_status = 0;
dpoker_output = 0;
m_coin_status = 0;
m_output = 0;
save_item(NAME(dpoker_coin_status));
save_item(NAME(dpoker_output));
save_item(NAME(m_coin_status));
save_item(NAME(m_output));
}
@ -2846,9 +2829,9 @@ DRIVER_INIT_MEMBER(mcr_state,wacko)
{
mcr_init(90010, 91399, 90913);
machine().device<midway_ssio_device>("ssio")->set_custom_input(1, 0xff, read8_delegate(FUNC(mcr_state::wacko_ip1_r),this));
machine().device<midway_ssio_device>("ssio")->set_custom_input(2, 0xff, read8_delegate(FUNC(mcr_state::wacko_ip2_r),this));
machine().device<midway_ssio_device>("ssio")->set_custom_output(4, 0x01, write8_delegate(FUNC(mcr_state::wacko_op4_w),this));
m_ssio->set_custom_input(1, 0xff, read8_delegate(FUNC(mcr_state::wacko_ip1_r),this));
m_ssio->set_custom_input(2, 0xff, read8_delegate(FUNC(mcr_state::wacko_ip2_r),this));
m_ssio->set_custom_output(4, 0x01, write8_delegate(FUNC(mcr_state::wacko_op4_w),this));
}
@ -2856,7 +2839,7 @@ DRIVER_INIT_MEMBER(mcr_state,twotiger)
{
mcr_init(90010, 91399, 90913);
machine().device<midway_ssio_device>("ssio")->set_custom_output(4, 0xff, write8_delegate(FUNC(mcr_state::twotiger_op4_w),this));
m_ssio->set_custom_output(4, 0xff, write8_delegate(FUNC(mcr_state::twotiger_op4_w),this));
m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xe800, 0xefff, 0, 0x1000, 0, read8_delegate(FUNC(mcr_state::twotiger_videoram_r),this), write8_delegate(FUNC(mcr_state::twotiger_videoram_w),this));
}
@ -2865,8 +2848,8 @@ DRIVER_INIT_MEMBER(mcr_state,kroozr)
{
mcr_init(90010, 91399, 91483);
machine().device<midway_ssio_device>("ssio")->set_custom_input(1, 0x47, read8_delegate(FUNC(mcr_state::kroozr_ip1_r),this));
machine().device<midway_ssio_device>("ssio")->set_custom_output(4, 0x34, write8_delegate(FUNC(mcr_state::kroozr_op4_w),this));
m_ssio->set_custom_input(1, 0x47, read8_delegate(FUNC(mcr_state::kroozr_ip1_r),this));
m_ssio->set_custom_output(4, 0x34, write8_delegate(FUNC(mcr_state::kroozr_op4_w),this));
}
@ -2874,7 +2857,7 @@ DRIVER_INIT_MEMBER(mcr_state,journey)
{
mcr_init(91475, 91464, 90913);
machine().device<midway_ssio_device>("ssio")->set_custom_output(4, 0x01, write8_delegate(FUNC(mcr_state::journey_op4_w),this));
m_ssio->set_custom_output(4, 0x01, write8_delegate(FUNC(mcr_state::journey_op4_w),this));
}
@ -2888,19 +2871,19 @@ DRIVER_INIT_MEMBER(mcr_state,dotrone)
{
mcr_init(91490, 91464, 91657);
machine().device<midway_ssio_device>("ssio")->set_custom_output(4, 0xff, write8_delegate(FUNC(mcr_state::dotron_op4_w),this));
m_ssio->set_custom_output(4, 0xff, write8_delegate(FUNC(mcr_state::dotron_op4_w),this));
}
DRIVER_INIT_MEMBER(mcr_state,nflfoot)
DRIVER_INIT_MEMBER(mcr_nflfoot_state,nflfoot)
{
mcr_init(91490, 91464, 91657);
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));
m_ssio->set_custom_input(2, 0x80, read8_delegate(FUNC(mcr_nflfoot_state::ip2_r),this));
m_ssio->set_custom_output(4, 0xff, write8_delegate(FUNC(mcr_nflfoot_state::op4_w),this));
save_item(NAME(m_sio_txda));
save_item(NAME(m_sio_txdb));
save_item(NAME(m_ipu_sio_txda));
save_item(NAME(m_ipu_sio_txdb));
}
@ -2908,9 +2891,9 @@ DRIVER_INIT_MEMBER(mcr_state,demoderb)
{
mcr_init(91490, 91464, 90913);
machine().device<midway_ssio_device>("ssio")->set_custom_input(1, 0xfc, read8_delegate(FUNC(mcr_state::demoderb_ip1_r),this));
machine().device<midway_ssio_device>("ssio")->set_custom_input(2, 0xfc, read8_delegate(FUNC(mcr_state::demoderb_ip2_r),this));
machine().device<midway_ssio_device>("ssio")->set_custom_output(4, 0xff, write8_delegate(FUNC(mcr_state::demoderb_op4_w),this));
m_ssio->set_custom_input(1, 0xfc, read8_delegate(FUNC(mcr_state::demoderb_ip1_r),this));
m_ssio->set_custom_input(2, 0xfc, read8_delegate(FUNC(mcr_state::demoderb_ip2_r),this));
m_ssio->set_custom_output(4, 0xff, write8_delegate(FUNC(mcr_state::demoderb_op4_w),this));
/* the SSIO Z80 doesn't have any program to execute */
machine().device<cpu_device>("ssio:cpu")->suspend(SUSPEND_REASON_DISABLE, 1);
@ -2925,11 +2908,11 @@ DRIVER_INIT_MEMBER(mcr_state,demoderb)
*************************************/
/* 90009 CPU board + 91399 video gen + 90908 sound I/O */
GAME( 1981, solarfox, 0, mcr_90009, solarfox, mcr_state, solarfox, ROT90 ^ ORIENTATION_FLIP_Y, "Bally Midway", "Solar Fox (upright)", MACHINE_SUPPORTS_SAVE )
GAME( 1981, kick, 0, mcr_90009, kick, mcr_state, kick, ORIENTATION_SWAP_XY, "Midway", "Kick (upright)", MACHINE_SUPPORTS_SAVE )
GAME( 1981, kickman, kick, mcr_90009, kick, mcr_state, kick, ORIENTATION_SWAP_XY, "Midway", "Kickman (upright)", MACHINE_SUPPORTS_SAVE )
GAME( 1981, kickc, kick, mcr_90009, kickc, mcr_state, kick, ROT90, "Midway", "Kick (cocktail)", MACHINE_SUPPORTS_SAVE )
GAMEL(1985, dpoker, 0, mcr_90009_dp, dpoker, mcr_state, dpoker, ROT0, "Bally", "Draw Poker (Bally, 03-20)", MACHINE_SUPPORTS_SAVE, layout_dpoker )
GAME( 1981, solarfox, 0, mcr_90009, solarfox, mcr_state, solarfox, ROT90 ^ ORIENTATION_FLIP_Y, "Bally Midway", "Solar Fox (upright)", MACHINE_SUPPORTS_SAVE )
GAME( 1981, kick, 0, mcr_90009, kick, mcr_state, kick, ORIENTATION_SWAP_XY, "Midway", "Kick (upright)", MACHINE_SUPPORTS_SAVE )
GAME( 1981, kickman, kick, mcr_90009, kick, mcr_state, kick, ORIENTATION_SWAP_XY, "Midway", "Kickman (upright)", MACHINE_SUPPORTS_SAVE )
GAME( 1981, kickc, kick, mcr_90009, kickc, mcr_state, kick, ROT90, "Midway", "Kick (cocktail)", MACHINE_SUPPORTS_SAVE )
GAMEL(1985, dpoker, 0, mcr_90009_dp, dpoker, mcr_dpoker_state, dpoker, ROT0, "Bally", "Draw Poker (Bally, 03-20)", MACHINE_SUPPORTS_SAVE, layout_dpoker )
/* 90010 CPU board + 91399 video gen + 90913 sound I/O */
GAME( 1981, shollow, 0, mcr_90010, shollow, mcr_state, mcr_90010, ROT90, "Bally Midway", "Satan's Hollow (set 1)", MACHINE_SUPPORTS_SAVE )
@ -2965,7 +2948,7 @@ GAME( 1983, dotrona, dotron, mcr_91490, dotron, mcr_state, mcr_91490, O
GAME( 1983, dotrone, dotron, mcr_91490_snt, dotrone, mcr_state, dotrone, ORIENTATION_FLIP_X, "Bally Midway", "Discs of Tron (Environmental)", MACHINE_SUPPORTS_SAVE )
/* 91490 CPU board + 91464 video gen + 91657 sound I/O + Squawk n' Talk + IPU laserdisk interface */
GAME( 1983, nflfoot, 0, mcr_91490_ipu, nflfoot, mcr_state, nflfoot, ROT0, "Bally Midway", "NFL Football", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE )
GAME( 1983, nflfoot, 0, mcr_91490_ipu, nflfoot, mcr_nflfoot_state, nflfoot, ROT0, "Bally Midway", "NFL Football", MACHINE_NOT_WORKING | MACHINE_SUPPORTS_SAVE )
/* 91490 CPU board + 91464 video gen + 90913 sound I/O + Turbo Cheap Squeak */
GAME( 1984, demoderb, 0, mcr_91490_tcs, demoderb, mcr_state, demoderb, ROT0, "Bally Midway", "Demolition Derby", MACHINE_SUPPORTS_SAVE )

View File

@ -106,12 +106,8 @@
#include "emu.h"
#include "includes/mcr.h"
#include "includes/mcr3.h"
#include "audio/midway.h"
#include "audio/csd.h"
#include "cpu/z80/z80.h"
#include "machine/nvram.h"
#include "machine/z80ctc.h"
#include "speaker.h"
@ -138,7 +134,7 @@ WRITE8_MEMBER(mcr3_state::mcrmono_control_port_w)
*/
machine().bookkeeping().coin_counter_w(0, (data >> 0) & 1);
mcr_cocktail_flip = (data >> 6) & 1;
m_mcr_cocktail_flip = (data >> 6) & 1;
}
@ -611,7 +607,7 @@ static INPUT_PORTS_START( demoderm )
INPUT_PORTS_END
/* inputs not verfied yet, DIP switches from manual */
/* inputs not verified yet, DIP switches from manual */
static INPUT_PORTS_START( sarge )
PORT_START("MONO.IP0") /* J2 1-8 */
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 )
@ -1101,8 +1097,6 @@ static MACHINE_CONFIG_START( mcrmono )
MCFG_WATCHDOG_ADD("watchdog")
MCFG_WATCHDOG_VBLANK_INIT("screen", 16)
MCFG_MACHINE_START_OVERRIDE(mcr3_state,mcr)
MCFG_MACHINE_RESET_OVERRIDE(mcr3_state,mcr)
MCFG_NVRAM_ADD_0FILL("nvram")
// sound hardware
@ -1120,8 +1114,6 @@ static MACHINE_CONFIG_START( mcrmono )
MCFG_GFXDECODE_ADD("gfxdecode", "palette", mcr3)
MCFG_PALETTE_ADD("palette", 64)
MCFG_VIDEO_START_OVERRIDE(mcr3_state,mcrmono)
MACHINE_CONFIG_END
@ -1635,9 +1627,9 @@ DRIVER_INIT_MEMBER(mcr3_state,stargrds)
DRIVER_INIT_MEMBER(mcr3_state,spyhunt)
{
mcr_common_init();
machine().device<midway_ssio_device>("ssio")->set_custom_input(1, 0x60, read8_delegate(FUNC(mcr3_state::spyhunt_ip1_r),this));
machine().device<midway_ssio_device>("ssio")->set_custom_input(2, 0xff, read8_delegate(FUNC(mcr3_state::spyhunt_ip2_r),this));
machine().device<midway_ssio_device>("ssio")->set_custom_output(4, 0xff, write8_delegate(FUNC(mcr3_state::spyhunt_op4_w),this));
m_ssio->set_custom_input(1, 0x60, read8_delegate(FUNC(mcr3_state::spyhunt_ip1_r),this));
m_ssio->set_custom_input(2, 0xff, read8_delegate(FUNC(mcr3_state::spyhunt_ip2_r),this));
m_ssio->set_custom_output(4, 0xff, write8_delegate(FUNC(mcr3_state::spyhunt_op4_w),this));
m_spyhunt_lamp.resolve();
@ -1659,9 +1651,9 @@ DRIVER_INIT_MEMBER(mcr3_state,crater)
DRIVER_INIT_MEMBER(mcr3_state,turbotag)
{
mcr_common_init();
machine().device<midway_ssio_device>("ssio")->set_custom_input(1, 0x60, read8_delegate(FUNC(mcr3_state::spyhunt_ip1_r),this));
machine().device<midway_ssio_device>("ssio")->set_custom_input(2, 0xff, read8_delegate(FUNC(mcr3_state::turbotag_ip2_r),this));
machine().device<midway_ssio_device>("ssio")->set_custom_output(4, 0xff, write8_delegate(FUNC(mcr3_state::spyhunt_op4_w),this));
m_ssio->set_custom_input(1, 0x60, read8_delegate(FUNC(mcr3_state::spyhunt_ip1_r),this));
m_ssio->set_custom_input(2, 0xff, read8_delegate(FUNC(mcr3_state::turbotag_ip2_r),this));
m_ssio->set_custom_output(4, 0xff, write8_delegate(FUNC(mcr3_state::spyhunt_op4_w),this));
m_spyhunt_lamp.resolve();

View File

@ -27,50 +27,21 @@ public:
mcr_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_ipu(*this, "ipu"),
m_watchdog(*this, "watchdog"),
m_spriteram(*this, "spriteram"),
m_videoram(*this, "videoram"),
m_paletteram(*this, "paletteram"),
m_sio(*this, "ipu_sio"),
m_ctc(*this, "ctc"),
m_ssio(*this, "ssio"),
m_cheap_squeak_deluxe(*this, "csd"),
m_sounds_good(*this, "sg"),
m_turbo_cheap_squeak(*this, "tcs"),
m_squawk_n_talk(*this, "snt"),
m_dpoker_coin_in_timer(*this, "dp_coinin"),
m_dpoker_hopper_timer(*this, "dp_hopper"),
m_samples(*this, "samples"),
m_gfxdecode(*this, "gfxdecode"),
m_palette(*this, "palette")
{ }
required_device<z80_device> m_maincpu;
optional_device<cpu_device> m_ipu;
required_device<watchdog_timer_device> m_watchdog;
optional_shared_ptr<uint8_t> m_spriteram;
optional_shared_ptr<uint8_t> m_videoram;
optional_shared_ptr<uint8_t> m_paletteram;
optional_device<z80dart_device> m_sio;
optional_device<midway_ssio_device> m_ssio;
optional_device<midway_cheap_squeak_deluxe_device> m_cheap_squeak_deluxe;
optional_device<midway_sounds_good_device> m_sounds_good;
optional_device<midway_turbo_cheap_squeak_device> m_turbo_cheap_squeak;
optional_device<midway_squawk_n_talk_device> m_squawk_n_talk;
optional_device<timer_device> m_dpoker_coin_in_timer;
optional_device<timer_device> m_dpoker_hopper_timer;
optional_device<samples_device> m_samples;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
int m_sio_txda;
int m_sio_txdb;
DECLARE_WRITE8_MEMBER(mcr_control_port_w);
DECLARE_WRITE8_MEMBER(mcr_ipu_laserdisk_w);
DECLARE_READ8_MEMBER(mcr_ipu_watchdog_r);
DECLARE_WRITE8_MEMBER(mcr_ipu_watchdog_w);
DECLARE_WRITE8_MEMBER(mcr_paletteram9_w);
DECLARE_WRITE8_MEMBER(mcr_90009_videoram_w);
DECLARE_WRITE8_MEMBER(mcr_90010_videoram_w);
@ -79,11 +50,6 @@ public:
DECLARE_WRITE8_MEMBER(mcr_91490_videoram_w);
DECLARE_READ8_MEMBER(solarfox_ip0_r);
DECLARE_READ8_MEMBER(solarfox_ip1_r);
DECLARE_READ8_MEMBER(dpoker_ip0_r);
DECLARE_WRITE8_MEMBER(dpoker_lamps1_w);
DECLARE_WRITE8_MEMBER(dpoker_lamps2_w);
DECLARE_WRITE8_MEMBER(dpoker_output_w);
DECLARE_WRITE8_MEMBER(dpoker_meters_w);
DECLARE_READ8_MEMBER(kick_ip1_r);
DECLARE_WRITE8_MEMBER(wacko_op4_w);
DECLARE_READ8_MEMBER(wacko_ip1_r);
@ -93,62 +59,140 @@ public:
DECLARE_WRITE8_MEMBER(journey_op4_w);
DECLARE_WRITE8_MEMBER(twotiger_op4_w);
DECLARE_WRITE8_MEMBER(dotron_op4_w);
DECLARE_READ8_MEMBER(nflfoot_ip2_r);
DECLARE_WRITE8_MEMBER(nflfoot_op4_w);
DECLARE_READ8_MEMBER(demoderb_ip1_r);
DECLARE_READ8_MEMBER(demoderb_ip2_r);
DECLARE_WRITE8_MEMBER(demoderb_op4_w);
DECLARE_INPUT_CHANGED_MEMBER(dpoker_coin_in_hit);
DECLARE_DRIVER_INIT(mcr_91490);
DECLARE_DRIVER_INIT(kroozr);
DECLARE_DRIVER_INIT(solarfox);
DECLARE_DRIVER_INIT(kick);
DECLARE_DRIVER_INIT(dpoker);
DECLARE_DRIVER_INIT(twotiger);
DECLARE_DRIVER_INIT(demoderb);
DECLARE_DRIVER_INIT(wacko);
DECLARE_DRIVER_INIT(mcr_90010);
DECLARE_DRIVER_INIT(dotrone);
DECLARE_DRIVER_INIT(nflfoot);
DECLARE_DRIVER_INIT(journey);
uint32_t screen_update_mcr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_DEVICE_CALLBACK_MEMBER(mcr_interrupt);
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
virtual void video_start() override;
TILE_GET_INFO_MEMBER(mcr_90009_get_tile_info);
TILE_GET_INFO_MEMBER(mcr_90010_get_tile_info);
TILE_GET_INFO_MEMBER(mcr_91490_get_tile_info);
DECLARE_MACHINE_START(mcr);
DECLARE_MACHINE_RESET(mcr);
DECLARE_VIDEO_START(mcr);
DECLARE_MACHINE_START(nflfoot);
uint32_t screen_update_mcr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(ipu_watchdog_reset);
TIMER_DEVICE_CALLBACK_MEMBER(dpoker_hopper_callback);
TIMER_DEVICE_CALLBACK_MEMBER(dpoker_coin_in_callback);
TIMER_DEVICE_CALLBACK_MEMBER(mcr_interrupt);
TIMER_DEVICE_CALLBACK_MEMBER(mcr_ipu_interrupt);
DECLARE_WRITE_LINE_MEMBER(sio_txda_w);
DECLARE_WRITE_LINE_MEMBER(sio_txdb_w);
void mcr_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_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);
int8_t m_mcr12_sprite_xoffs_flip;
uint8_t m_input_mux;
uint8_t m_last_op4;
tilemap_t *m_bg_tilemap;
uint8_t m_mcr_cocktail_flip;
required_device<z80_device> m_maincpu;
optional_shared_ptr<uint8_t> m_spriteram;
optional_shared_ptr<uint8_t> m_videoram;
optional_shared_ptr<uint8_t> m_paletteram;
required_device<z80ctc_device> m_ctc;
optional_device<midway_ssio_device> m_ssio;
optional_device<midway_cheap_squeak_deluxe_device> m_cheap_squeak_deluxe;
optional_device<midway_sounds_good_device> m_sounds_good;
optional_device<midway_turbo_cheap_squeak_device> m_turbo_cheap_squeak;
optional_device<midway_squawk_n_talk_device> m_squawk_n_talk;
optional_device<samples_device> m_samples;
required_device<gfxdecode_device> m_gfxdecode;
required_device<palette_device> m_palette;
private:
uint32_t m_mcr_cpu_board;
uint32_t m_mcr_sprite_board;
int8_t m_mcr12_sprite_xoffs;
};
/*----------- defined in machine/mcr.c -----------*/
class mcr_dpoker_state : public mcr_state
{
public:
mcr_dpoker_state(const machine_config &mconfig, device_type type, const char *tag)
: mcr_state(mconfig, type, tag),
m_coin_in_timer(*this, "coinin"),
m_hopper_timer(*this, "hopper") {}
DECLARE_READ8_MEMBER(ip0_r);
DECLARE_WRITE8_MEMBER(lamps1_w);
DECLARE_WRITE8_MEMBER(lamps2_w);
DECLARE_WRITE8_MEMBER(output_w);
DECLARE_WRITE8_MEMBER(meters_w);
DECLARE_INPUT_CHANGED_MEMBER(coin_in_hit);
TIMER_DEVICE_CALLBACK_MEMBER(hopper_callback);
TIMER_DEVICE_CALLBACK_MEMBER(coin_in_callback);
DECLARE_DRIVER_INIT(dpoker);
private:
uint8_t m_coin_status;
uint8_t m_output;
required_device<timer_device> m_coin_in_timer;
required_device<timer_device> m_hopper_timer;
};
class mcr_nflfoot_state : public mcr_state
{
public:
mcr_nflfoot_state(const machine_config &mconfig, device_type type, const char *tag)
: mcr_state(mconfig, type, tag),
m_ipu(*this, "ipu"),
m_ipu_sio(*this, "ipu_sio"),
m_ipu_ctc(*this, "ipu_ctc"),
m_ipu_pio0(*this, "ipu_pio0"),
m_ipu_pio1(*this, "ipu_pio1") {}
DECLARE_WRITE_LINE_MEMBER(sio_txda_w);
DECLARE_WRITE_LINE_MEMBER(sio_txdb_w);
DECLARE_WRITE8_MEMBER(ipu_laserdisk_w);
DECLARE_READ8_MEMBER(ipu_watchdog_r);
DECLARE_WRITE8_MEMBER(ipu_watchdog_w);
DECLARE_READ8_MEMBER(ip2_r);
DECLARE_WRITE8_MEMBER(op4_w);
TIMER_CALLBACK_MEMBER(ipu_watchdog_reset);
TIMER_DEVICE_CALLBACK_MEMBER(ipu_interrupt);
DECLARE_DRIVER_INIT(nflfoot);
protected:
virtual void machine_start() override;
private:
int m_ipu_sio_txda;
int m_ipu_sio_txdb;
emu_timer *m_ipu_watchdog_timer;
required_device<cpu_device> m_ipu;
required_device<z80dart_device> m_ipu_sio;
required_device<z80ctc_device> m_ipu_ctc;
required_device<z80pio_device> m_ipu_pio0;
required_device<z80pio_device> m_ipu_pio1;
};
/*----------- defined in machine/mcr.cpp -----------*/
extern const z80_daisy_config mcr_daisy_chain[];
extern const z80_daisy_config mcr_ipu_daisy_chain[];
extern uint8_t mcr_cocktail_flip;
extern const gfx_layout mcr_bg_layout;
extern const gfx_layout mcr_sprite_layout;
extern uint32_t mcr_cpu_board;
extern uint32_t mcr_sprite_board;
/*----------- defined in video/mcr.c -----------*/
extern int8_t mcr12_sprite_xoffs;
extern int8_t mcr12_sprite_xoffs_flip;

View File

@ -15,6 +15,7 @@ class mcr3_state : public mcr_state
public:
mcr3_state(const machine_config &mconfig, device_type type, const char *tag)
: mcr_state(mconfig, type, tag),
m_cheap_squeak_deluxe(*this, "csd"),
m_spyhunt_alpharam(*this, "spyhunt_alpha"),
m_maxrpm_adc(*this, "adc"),
m_lamplatch(*this, "lamplatch"),
@ -22,26 +23,6 @@ public:
m_screen(*this, "screen")
{ }
optional_shared_ptr<uint8_t> m_spyhunt_alpharam;
optional_device<adc0844_device> m_maxrpm_adc;
optional_device<cd4099_device> m_lamplatch;
output_finder<8> m_spyhunt_lamp;
required_device<screen_device> m_screen;
uint8_t m_input_mux;
uint8_t m_latched_input;
uint8_t m_last_op4;
uint8_t m_maxrpm_adc_control;
uint8_t m_maxrpm_last_shift;
int8_t m_maxrpm_p1_shift;
int8_t m_maxrpm_p2_shift;
uint8_t m_spyhunt_sprite_color_mask;
int16_t m_spyhunt_scroll_offset;
int16_t m_spyhunt_scrollx;
int16_t m_spyhunt_scrolly;
tilemap_t *m_bg_tilemap;
tilemap_t *m_alpha_tilemap;
DECLARE_WRITE8_MEMBER(mcr3_videoram_w);
DECLARE_WRITE8_MEMBER(spyhunt_videoram_w);
DECLARE_WRITE8_MEMBER(spyhunt_alpharam_w);
@ -77,16 +58,38 @@ public:
DECLARE_DRIVER_INIT(rampage);
DECLARE_DRIVER_INIT(spyhunt);
DECLARE_DRIVER_INIT(sarge);
DECLARE_VIDEO_START(spyhunt);
DECLARE_PALETTE_INIT(spyhunt);
uint32_t screen_update_mcr3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_spyhunt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
protected:
virtual void video_start() override;
private:
optional_device<midway_cheap_squeak_deluxe_device> m_cheap_squeak_deluxe;
optional_shared_ptr<uint8_t> m_spyhunt_alpharam;
optional_device<adc0844_device> m_maxrpm_adc;
optional_device<cd4099_device> m_lamplatch;
output_finder<8> m_spyhunt_lamp;
required_device<screen_device> m_screen;
uint8_t m_latched_input;
uint8_t m_maxrpm_adc_control;
uint8_t m_maxrpm_last_shift;
int8_t m_maxrpm_p1_shift;
int8_t m_maxrpm_p2_shift;
uint8_t m_spyhunt_sprite_color_mask;
int16_t m_spyhunt_scroll_offset;
int16_t m_spyhunt_scrollx;
int16_t m_spyhunt_scrolly;
tilemap_t *m_alpha_tilemap;
TILE_GET_INFO_MEMBER(mcrmono_get_bg_tile_info);
TILEMAP_MAPPER_MEMBER(spyhunt_bg_scan);
TILE_GET_INFO_MEMBER(spyhunt_get_bg_tile_info);
TILE_GET_INFO_MEMBER(spyhunt_get_alpha_tile_info);
DECLARE_VIDEO_START(mcrmono);
DECLARE_VIDEO_START(spyhunt);
DECLARE_PALETTE_INIT(spyhunt);
uint32_t screen_update_mcr3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
uint32_t screen_update_spyhunt(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
void mcr3_update_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int color_mask, int code_xor, int dx, int dy, int interlaced);
void mcr_common_init();
};

View File

@ -7,34 +7,12 @@
***************************************************************************/
#include "emu.h"
#include "audio/midway.h"
#include "includes/mcr.h"
#define VERBOSE 0
#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
/*************************************
*
* Global variables
*
*************************************/
uint8_t mcr_cocktail_flip;
uint32_t mcr_cpu_board;
uint32_t mcr_sprite_board;
/*************************************
*
* Statics
*
*************************************/
static emu_timer *ipu_watchdog_timer;
/*************************************
*
* Graphics declarations
@ -99,23 +77,23 @@ const z80_daisy_config mcr_ipu_daisy_chain[] =
*
*************************************/
MACHINE_START_MEMBER(mcr_state,mcr)
void mcr_state::machine_start()
{
save_item(NAME(mcr_cocktail_flip));
save_item(NAME(m_mcr_cocktail_flip));
}
MACHINE_START_MEMBER(mcr_state,nflfoot)
void mcr_nflfoot_state::machine_start()
{
/* allocate a timer for the IPU watchdog */
ipu_watchdog_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mcr_state::ipu_watchdog_reset),this));
m_ipu_watchdog_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mcr_nflfoot_state::ipu_watchdog_reset), this));
}
MACHINE_RESET_MEMBER(mcr_state,mcr)
void mcr_state::machine_reset()
{
/* reset cocktail flip */
mcr_cocktail_flip = 0;
m_mcr_cocktail_flip = 0;
}
@ -128,37 +106,35 @@ MACHINE_RESET_MEMBER(mcr_state,mcr)
TIMER_DEVICE_CALLBACK_MEMBER(mcr_state::mcr_interrupt)
{
z80ctc_device *ctc = machine().device<z80ctc_device>("ctc");
int scanline = param;
/* CTC line 2 is connected to VBLANK, which is once every 1/2 frame */
/* for the 30Hz interlaced display */
if(scanline == 0 || scanline == 240)
{
ctc->trg2(1);
ctc->trg2(0);
m_ctc->trg2(1);
m_ctc->trg2(0);
}
/* CTC line 3 is connected to 493, which is signalled once every */
/* frame at 30Hz */
if (scanline == 0)
{
ctc->trg3(1);
ctc->trg3(0);
m_ctc->trg3(1);
m_ctc->trg3(0);
}
}
TIMER_DEVICE_CALLBACK_MEMBER(mcr_state::mcr_ipu_interrupt)
TIMER_DEVICE_CALLBACK_MEMBER(mcr_nflfoot_state::ipu_interrupt)
{
z80ctc_device *ctc = machine().device<z80ctc_device>("ctc");
int scanline = param;
/* CTC line 3 is connected to 493, which is signalled once every */
/* frame at 30Hz */
if (scanline == 0)
{
ctc->trg3(1);
ctc->trg3(0);
m_ctc->trg3(1);
m_ctc->trg3(0);
}
}
@ -169,20 +145,20 @@ TIMER_DEVICE_CALLBACK_MEMBER(mcr_state::mcr_ipu_interrupt)
*
*************************************/
WRITE_LINE_MEMBER(mcr_state::sio_txda_w)
WRITE_LINE_MEMBER(mcr_nflfoot_state::sio_txda_w)
{
m_sio_txda = !state;
m_ipu_sio_txda = !state;
}
WRITE_LINE_MEMBER(mcr_state::sio_txdb_w)
WRITE_LINE_MEMBER(mcr_nflfoot_state::sio_txdb_w)
{
// disc player
m_sio_txdb = !state;
m_ipu_sio_txdb = !state;
m_sio->rxb_w(state);
m_ipu_sio->rxb_w(state);
}
WRITE8_MEMBER(mcr_state::mcr_ipu_laserdisk_w)
WRITE8_MEMBER(mcr_nflfoot_state::ipu_laserdisk_w)
{
/* bit 3 enables (1) LD video regardless of PIX SW */
/* bit 2 enables (1) LD right channel audio */
@ -193,27 +169,26 @@ WRITE8_MEMBER(mcr_state::mcr_ipu_laserdisk_w)
}
TIMER_CALLBACK_MEMBER(mcr_state::ipu_watchdog_reset)
TIMER_CALLBACK_MEMBER(mcr_nflfoot_state::ipu_watchdog_reset)
{
logerror("ipu_watchdog_reset\n");
m_ipu->set_input_line(INPUT_LINE_RESET, PULSE_LINE);
machine().device("ipu_ctc")->reset();
machine().device("ipu_pio0")->reset();
machine().device("ipu_pio1")->reset();
machine().device("ipu_sio")->reset();
m_ipu_ctc->reset();
m_ipu_pio0->reset();
m_ipu_pio1->reset();
m_ipu_sio->reset();
}
READ8_MEMBER(mcr_state::mcr_ipu_watchdog_r)
READ8_MEMBER(mcr_nflfoot_state::ipu_watchdog_r)
{
/* watchdog counter is clocked by 7.3728MHz crystal / 16 */
/* watchdog is tripped when 14-bit counter overflows => / 32768 = 14.0625Hz*/
ipu_watchdog_timer->adjust(attotime::from_hz(7372800 / 16 / 32768));
m_ipu_watchdog_timer->adjust(attotime::from_hz(7372800 / 16 / 32768));
return 0xff;
}
WRITE8_MEMBER(mcr_state::mcr_ipu_watchdog_w)
WRITE8_MEMBER(mcr_nflfoot_state::ipu_watchdog_w)
{
mcr_ipu_watchdog_r(space,0);
ipu_watchdog_r(space,0);
}

View File

@ -11,12 +11,6 @@
#include "screen.h"
int8_t mcr12_sprite_xoffs;
int8_t mcr12_sprite_xoffs_flip;
static tilemap_t *bg_tilemap;
/*************************************
*
* Tilemap callbacks
@ -31,8 +25,7 @@ static tilemap_t *bg_tilemap;
*/
TILE_GET_INFO_MEMBER(mcr_state::mcr_90009_get_tile_info)
{
uint8_t *videoram = m_videoram;
SET_TILE_INFO_MEMBER(0, videoram[tile_index], 0, 0);
SET_TILE_INFO_MEMBER(0, m_videoram[tile_index], 0, 0);
/* sprite color base is constant 0x10 */
tileinfo.category = 1;
@ -54,8 +47,7 @@ TILE_GET_INFO_MEMBER(mcr_state::mcr_90009_get_tile_info)
*/
TILE_GET_INFO_MEMBER(mcr_state::mcr_90010_get_tile_info)
{
uint8_t *videoram = m_videoram;
int data = videoram[tile_index * 2] | (videoram[tile_index * 2 + 1] << 8);
int data = m_videoram[tile_index * 2] | (m_videoram[tile_index * 2 + 1] << 8);
int code = data & 0x1ff;
int color = (data >> 11) & 3;
SET_TILE_INFO_MEMBER(0, code, color, TILE_FLIPYX(data >> 9));
@ -80,8 +72,7 @@ TILE_GET_INFO_MEMBER(mcr_state::mcr_90010_get_tile_info)
*/
TILE_GET_INFO_MEMBER(mcr_state::mcr_91490_get_tile_info)
{
uint8_t *videoram = m_videoram;
int data = videoram[tile_index * 2] | (videoram[tile_index * 2 + 1] << 8);
int data = m_videoram[tile_index * 2] | (m_videoram[tile_index * 2 + 1] << 8);
int code = data & 0x3ff;
int color = (data >> 12) & 3;
SET_TILE_INFO_MEMBER(0, code, color, TILE_FLIPYX(data >> 10));
@ -98,25 +89,25 @@ TILE_GET_INFO_MEMBER(mcr_state::mcr_91490_get_tile_info)
*
*************************************/
VIDEO_START_MEMBER(mcr_state,mcr)
void mcr_state::video_start()
{
/* the tilemap callback is based on the CPU board */
switch (mcr_cpu_board)
switch (m_mcr_cpu_board)
{
case 90009:
bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(mcr_state::mcr_90009_get_tile_info),this), TILEMAP_SCAN_ROWS, 16,16, 32,30);
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(mcr_state::mcr_90009_get_tile_info),this), TILEMAP_SCAN_ROWS, 16,16, 32,30);
break;
case 90010:
bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(mcr_state::mcr_90010_get_tile_info),this), TILEMAP_SCAN_ROWS, 16,16, 32,30);
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(mcr_state::mcr_90010_get_tile_info),this), TILEMAP_SCAN_ROWS, 16,16, 32,30);
break;
case 91475:
bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(mcr_state::mcr_90010_get_tile_info),this), TILEMAP_SCAN_ROWS, 16,16, 32,30);
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(mcr_state::mcr_90010_get_tile_info),this), TILEMAP_SCAN_ROWS, 16,16, 32,30);
break;
case 91490:
bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(mcr_state::mcr_91490_get_tile_info),this), TILEMAP_SCAN_ROWS, 16,16, 32,30);
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(mcr_state::mcr_91490_get_tile_info),this), TILEMAP_SCAN_ROWS, 16,16, 32,30);
break;
default:
@ -188,22 +179,20 @@ WRITE8_MEMBER(mcr_state::mcr_paletteram9_w)
WRITE8_MEMBER(mcr_state::mcr_90009_videoram_w)
{
uint8_t *videoram = m_videoram;
videoram[offset] = data;
bg_tilemap->mark_tile_dirty(offset);
m_videoram[offset] = data;
m_bg_tilemap->mark_tile_dirty(offset);
}
WRITE8_MEMBER(mcr_state::mcr_90010_videoram_w)
{
uint8_t *videoram = m_videoram;
videoram[offset] = data;
bg_tilemap->mark_tile_dirty(offset / 2);
m_videoram[offset] = data;
m_bg_tilemap->mark_tile_dirty(offset / 2);
/* palette RAM is mapped into the upper 0x80 bytes here */
if ((offset & 0x780) == 0x780)
{
if (mcr_cpu_board != 91475)
if (m_mcr_cpu_board != 91475)
mcr_set_color((offset / 2) & 0x3f, data | ((offset & 1) << 8));
else
journey_set_color((offset / 2) & 0x3f, data | ((offset & 1) << 8));
@ -213,20 +202,18 @@ WRITE8_MEMBER(mcr_state::mcr_90010_videoram_w)
READ8_MEMBER(mcr_state::twotiger_videoram_r)
{
uint8_t *videoram = m_videoram;
/* Two Tigers swizzles the address bits on videoram */
int effoffs = ((offset << 1) & 0x7fe) | ((offset >> 10) & 1);
return videoram[effoffs];
return m_videoram[effoffs];
}
WRITE8_MEMBER(mcr_state::twotiger_videoram_w)
{
uint8_t *videoram = m_videoram;
/* Two Tigers swizzles the address bits on videoram */
int effoffs = ((offset << 1) & 0x7fe) | ((offset >> 10) & 1);
videoram[effoffs] = data;
bg_tilemap->mark_tile_dirty(effoffs / 2);
m_videoram[effoffs] = data;
m_bg_tilemap->mark_tile_dirty(effoffs / 2);
/* palette RAM is mapped into the upper 0x80 bytes here */
if ((effoffs & 0x780) == 0x780)
@ -236,9 +223,8 @@ WRITE8_MEMBER(mcr_state::twotiger_videoram_w)
WRITE8_MEMBER(mcr_state::mcr_91490_videoram_w)
{
uint8_t *videoram = m_videoram;
videoram[offset] = data;
bg_tilemap->mark_tile_dirty(offset / 2);
m_videoram[offset] = data;
m_bg_tilemap->mark_tile_dirty(offset / 2);
}
@ -255,39 +241,35 @@ WRITE8_MEMBER(mcr_state::mcr_91490_videoram_w)
void mcr_state::render_sprites_91399(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
uint8_t *spriteram = m_spriteram;
gfx_element *gfx = m_gfxdecode->gfx(1);
int offs;
/* render the sprites into the bitmap, ORing together */
for (offs = 0; offs < m_spriteram.bytes(); offs += 4)
for (int offs = 0; offs < m_spriteram.bytes(); offs += 4)
{
int code, x, y, sx, sy, hflip, vflip;
/* extract the bits of information */
code = spriteram[offs + 1] & 0x3f;
hflip = (spriteram[offs + 1] & 0x40) ? 31 : 0;
vflip = (spriteram[offs + 1] & 0x80) ? 31 : 0;
sx = (spriteram[offs + 2] - 4) * 2;
sy = (240 - spriteram[offs]) * 2;
int code = m_spriteram[offs + 1] & 0x3f;
int hflip = (m_spriteram[offs + 1] & 0x40) ? 31 : 0;
int vflip = (m_spriteram[offs + 1] & 0x80) ? 31 : 0;
int sx = (m_spriteram[offs + 2] - 4) * 2;
int sy = (240 - m_spriteram[offs]) * 2;
/* apply cocktail mode */
if (mcr_cocktail_flip)
if (m_mcr_cocktail_flip)
{
hflip ^= 31;
vflip ^= 31;
sx = 466 - sx + mcr12_sprite_xoffs_flip;
sx = 466 - sx + m_mcr12_sprite_xoffs_flip;
sy = 450 - sy;
}
else
sx += mcr12_sprite_xoffs;
sx += m_mcr12_sprite_xoffs;
/* clamp within 512 */
sx &= 0x1ff;
sy &= 0x1ff;
/* loop over lines in the sprite */
for (y = 0; y < 32; y++, sy = (sy + 1) & 0x1ff)
for (int y = 0; y < 32; y++, sy = (sy + 1) & 0x1ff)
if (sy >= cliprect.min_y && sy <= cliprect.max_y)
{
const uint8_t *src = gfx->get_data(code) + gfx->rowbytes() * (y ^ vflip);
@ -295,7 +277,7 @@ void mcr_state::render_sprites_91399(screen_device &screen, bitmap_ind16 &bitmap
uint8_t *pri = &screen.priority().pix8(sy);
/* loop over columns */
for (x = 0; x < 32; x++)
for (int x = 0; x < 32; x++)
{
int tx = (sx + x) & 0x1ff;
int pix = pri[tx] | src[x ^ hflip];
@ -327,25 +309,21 @@ void mcr_state::render_sprites_91399(screen_device &screen, bitmap_ind16 &bitmap
void mcr_state::render_sprites_91464(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int primask, int sprmask, int colormask)
{
uint8_t *spriteram = m_spriteram;
gfx_element *gfx = m_gfxdecode->gfx(1);
int offs;
/* render the sprites into the bitmap, working from topmost to bottommost */
for (offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4)
for (int offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4)
{
int code, color, x, y, sx, sy, hflip, vflip;
/* extract the bits of information */
code = (spriteram[offs + 2] + 256 * ((spriteram[offs + 1] >> 3) & 0x01)) % gfx->elements();
color = (((~spriteram[offs + 1] & 3) << 4) & sprmask) | colormask;
hflip = (spriteram[offs + 1] & 0x10) ? 31 : 0;
vflip = (spriteram[offs + 1] & 0x20) ? 31 : 0;
sx = (spriteram[offs + 3] - 3) * 2;
sy = (241 - spriteram[offs]) * 2;
int code = (m_spriteram[offs + 2] + 256 * ((m_spriteram[offs + 1] >> 3) & 0x01)) % gfx->elements();
int color = (((~m_spriteram[offs + 1] & 3) << 4) & sprmask) | colormask;
int hflip = (m_spriteram[offs + 1] & 0x10) ? 31 : 0;
int vflip = (m_spriteram[offs + 1] & 0x20) ? 31 : 0;
int sx = (m_spriteram[offs + 3] - 3) * 2;
int sy = (241 - m_spriteram[offs]) * 2;
/* apply cocktail mode */
if (mcr_cocktail_flip)
if (m_mcr_cocktail_flip)
{
hflip ^= 31;
vflip ^= 31;
@ -358,7 +336,7 @@ void mcr_state::render_sprites_91464(screen_device &screen, bitmap_ind16 &bitmap
sy &= 0x1ff;
/* loop over lines in the sprite */
for (y = 0; y < 32; y++, sy = (sy + 1) & 0x1ff)
for (int y = 0; y < 32; y++, sy = (sy + 1) & 0x1ff)
if (sy >= 2 && sy >= cliprect.min_y && sy <= cliprect.max_y)
{
const uint8_t *src = gfx->get_data(code) + gfx->rowbytes() * (y ^ vflip);
@ -366,7 +344,7 @@ void mcr_state::render_sprites_91464(screen_device &screen, bitmap_ind16 &bitmap
uint8_t *pri = &screen.priority().pix8(sy);
/* loop over columns */
for (x = 0; x < 32; x++)
for (int x = 0; x < 32; x++)
{
int tx = (sx + x) & 0x1ff;
int pix = pri[tx];
@ -402,30 +380,30 @@ void mcr_state::render_sprites_91464(screen_device &screen, bitmap_ind16 &bitmap
uint32_t mcr_state::screen_update_mcr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
/* update the flip state */
bg_tilemap->set_flip(mcr_cocktail_flip ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0);
m_bg_tilemap->set_flip(m_mcr_cocktail_flip ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0);
/* draw the background */
screen.priority().fill(0, cliprect);
bg_tilemap->draw(screen, bitmap, cliprect, 0, 0x00);
bg_tilemap->draw(screen, bitmap, cliprect, 1, 0x10);
bg_tilemap->draw(screen, bitmap, cliprect, 2, 0x20);
bg_tilemap->draw(screen, bitmap, cliprect, 3, 0x30);
m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0x00);
m_bg_tilemap->draw(screen, bitmap, cliprect, 1, 0x10);
m_bg_tilemap->draw(screen, bitmap, cliprect, 2, 0x20);
m_bg_tilemap->draw(screen, bitmap, cliprect, 3, 0x30);
/* update the sprites and render them */
switch (mcr_sprite_board)
switch (m_mcr_sprite_board)
{
case 91399:
render_sprites_91399(screen, bitmap, cliprect);
break;
case 91464:
if (mcr_cpu_board == 91442)
if (m_mcr_cpu_board == 91442)
render_sprites_91464(screen, bitmap, cliprect, 0x00, 0x30, 0x00);
else if (mcr_cpu_board == 91475)
else if (m_mcr_cpu_board == 91475)
render_sprites_91464(screen, bitmap, cliprect, 0x00, 0x30, 0x40);
else if (mcr_cpu_board == 91490)
else if (m_mcr_cpu_board == 91490)
render_sprites_91464(screen, bitmap, cliprect, 0x00, 0x30, 0x00);
else if (mcr_cpu_board == 91721)
else if (m_mcr_cpu_board == 91721)
render_sprites_91464(screen, bitmap, cliprect, 0x00, 0x30, 0x00);
break;
}

View File

@ -21,8 +21,7 @@
#ifdef UNUSED_FUNCTION
TILE_GET_INFO_MEMBER(mcr3_state::get_bg_tile_info)
{
uint8_t *videoram = m_videoram;
int data = videoram[tile_index * 2] | (videoram[tile_index * 2 + 1] << 8);
int data = m_videoram[tile_index * 2] | (m_videoram[tile_index * 2 + 1] << 8);
int code = (data & 0x3ff) | ((data >> 4) & 0x400);
int color = (data >> 12) & 3;
SET_TILE_INFO_MEMBER(0, code, color, TILE_FLIPYX((data >> 10) & 3));
@ -32,8 +31,7 @@ TILE_GET_INFO_MEMBER(mcr3_state::get_bg_tile_info)
TILE_GET_INFO_MEMBER(mcr3_state::mcrmono_get_bg_tile_info)
{
uint8_t *videoram = m_videoram;
int data = videoram[tile_index * 2] | (videoram[tile_index * 2 + 1] << 8);
int data = m_videoram[tile_index * 2] | (m_videoram[tile_index * 2 + 1] << 8);
int code = (data & 0x3ff) | ((data >> 4) & 0x400);
int color = ((data >> 12) & 3) ^ 3;
SET_TILE_INFO_MEMBER(0, code, color, TILE_FLIPYX(data >> 10));
@ -49,8 +47,7 @@ TILEMAP_MAPPER_MEMBER(mcr3_state::spyhunt_bg_scan)
TILE_GET_INFO_MEMBER(mcr3_state::spyhunt_get_bg_tile_info)
{
uint8_t *videoram = m_videoram;
int data = videoram[tile_index];
int data = m_videoram[tile_index];
int code = (data & 0x3f) | ((data >> 1) & 0x40);
SET_TILE_INFO_MEMBER(0, code, 0, (data & 0x40) ? TILE_FLIPY : 0);
}
@ -71,9 +68,7 @@ TILE_GET_INFO_MEMBER(mcr3_state::spyhunt_get_alpha_tile_info)
PALETTE_INIT_MEMBER(mcr3_state,spyhunt)
{
int i;
for (i = 0; i < palette.entries(); i++)
for (int i = 0; i < palette.entries(); i++)
{
palette.set_pen_color(i,rgb_t::black());
}
@ -93,16 +88,7 @@ PALETTE_INIT_MEMBER(mcr3_state,spyhunt)
*
*************************************/
#ifdef UNUSED_FUNCTION
VIDEO_START_MEMBER(mcr3_state,mcr3)
{
// initialize the background tilemap
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(mcr3_state::get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 16,16, 32,30);
}
#endif
VIDEO_START_MEMBER(mcr3_state,mcrmono)
void mcr3_state::video_start()
{
// initialize the background tilemap
m_bg_tilemap = &machine().tilemap().create(*m_gfxdecode, tilemap_get_info_delegate(FUNC(mcr3_state::mcrmono_get_bg_tile_info),this), TILEMAP_SCAN_ROWS, 16,16, 32,30);
@ -137,16 +123,14 @@ VIDEO_START_MEMBER(mcr3_state,spyhunt)
WRITE8_MEMBER(mcr3_state::mcr3_videoram_w)
{
uint8_t *videoram = m_videoram;
videoram[offset] = data;
m_videoram[offset] = data;
m_bg_tilemap->mark_tile_dirty(offset / 2);
}
WRITE8_MEMBER(mcr3_state::spyhunt_videoram_w)
{
uint8_t *videoram = m_videoram;
videoram[offset] = data;
m_videoram[offset] = data;
m_bg_tilemap->mark_tile_dirty(offset);
}
@ -190,18 +174,13 @@ WRITE8_MEMBER(mcr3_state::spyhunt_scroll_value_w)
void mcr3_state::mcr3_update_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int color_mask, int code_xor, int dx, int dy, int interlaced)
{
uint8_t *spriteram = m_spriteram;
int offs;
m_screen->priority().fill(1, cliprect);
/* loop over sprite RAM */
for (offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4)
for (int offs = m_spriteram.bytes() - 4; offs >= 0; offs -= 4)
{
int code, color, flipx, flipy, sx, sy, flags;
/* skip if zero */
if (spriteram[offs] == 0)
if (m_spriteram[offs] == 0)
continue;
/*
@ -216,13 +195,13 @@ void mcr3_state::mcr3_update_sprites(screen_device &screen, bitmap_ind16 &bitmap
*/
/* extract the bits of information */
flags = spriteram[offs + 1];
code = spriteram[offs + 2] + 256 * ((flags >> 3) & 0x01);
color = ~flags & color_mask;
flipx = flags & 0x10;
flipy = flags & 0x20;
sx = (spriteram[offs + 3] - 3) * 2;
sy = (241 - spriteram[offs]);
int flags = m_spriteram[offs + 1];
int code = m_spriteram[offs + 2] + 256 * ((flags >> 3) & 0x01);
int color = ~flags & color_mask;
int flipx = flags & 0x10;
int flipy = flags & 0x20;
int sx = (m_spriteram[offs + 3] - 3) * 2;
int sy = (241 - m_spriteram[offs]);
if (interlaced == 1) sy *= 2;
@ -233,7 +212,7 @@ void mcr3_state::mcr3_update_sprites(screen_device &screen, bitmap_ind16 &bitmap
/* sprites use color 0 for background pen and 8 for the 'under tile' pen.
The color 8 is used to cover over other sprites. */
if (!mcr_cocktail_flip)
if (!m_mcr_cocktail_flip)
{
/* first draw the sprite, visible */
m_gfxdecode->gfx(1)->prio_transmask(bitmap,cliprect, code, color, flipx, flipy, sx, sy,
@ -267,7 +246,7 @@ void mcr3_state::mcr3_update_sprites(screen_device &screen, bitmap_ind16 &bitmap
uint32_t mcr3_state::screen_update_mcr3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
{
/* update the flip state */
m_bg_tilemap->set_flip(mcr_cocktail_flip ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0);
m_bg_tilemap->set_flip(m_mcr_cocktail_flip ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0);
/* draw the background */
m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);