summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/mcr68.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/drivers/mcr68.c')
-rw-r--r--src/mame/drivers/mcr68.c157
1 files changed, 75 insertions, 82 deletions
diff --git a/src/mame/drivers/mcr68.c b/src/mame/drivers/mcr68.c
index 8708efd4912..3e350d9a620 100644
--- a/src/mame/drivers/mcr68.c
+++ b/src/mame/drivers/mcr68.c
@@ -77,7 +77,7 @@ READ8_DEVICE_HANDLER( zwackery_port_2_r )
}
-static READ16_HANDLER( zwackery_6840_r )
+READ16_MEMBER(mcr68_state::zwackery_6840_r)
{
/* Zwackery does a timer test: */
/* It loads $1388 into one of the timers clocked by E */
@@ -87,8 +87,8 @@ static READ16_HANDLER( zwackery_6840_r )
/* It expects D1 to end up between 0 and 5; in order to */
/* make this happen, we must assume that reads from the */
/* 6840 take 14 additional cycles */
- device_adjust_icount(&space->device(), -14);
- return mcr68_6840_upper_r(space,offset,0xffff);
+ device_adjust_icount(&space.device(), -14);
+ return mcr68_6840_upper_r(&space,offset,0xffff);
}
@@ -99,12 +99,11 @@ static READ16_HANDLER( zwackery_6840_r )
*
*************************************/
-static WRITE16_HANDLER( xenophobe_control_w )
+WRITE16_MEMBER(mcr68_state::xenophobe_control_w)
{
- mcr68_state *state = space->machine().driver_data<mcr68_state>();
- COMBINE_DATA(&state->m_control_word);
-/* soundsgood_reset_w(~state->m_control_word & 0x0020);*/
- soundsgood_data_w(space, offset, ((state->m_control_word & 0x000f) << 1) | ((state->m_control_word & 0x0010) >> 4));
+ COMBINE_DATA(&m_control_word);
+/* soundsgood_reset_w(~m_control_word & 0x0020);*/
+ soundsgood_data_w(&space, offset, ((m_control_word & 0x000f) << 1) | ((m_control_word & 0x0010) >> 4));
}
@@ -115,12 +114,11 @@ static WRITE16_HANDLER( xenophobe_control_w )
*
*************************************/
-static WRITE16_HANDLER( blasted_control_w )
+WRITE16_MEMBER(mcr68_state::blasted_control_w)
{
- mcr68_state *state = space->machine().driver_data<mcr68_state>();
- COMBINE_DATA(&state->m_control_word);
-/* soundsgood_reset_w(~state->m_control_word & 0x0020);*/
- soundsgood_data_w(space, offset, (state->m_control_word >> 8) & 0x1f);
+ COMBINE_DATA(&m_control_word);
+/* soundsgood_reset_w(~m_control_word & 0x0020);*/
+ soundsgood_data_w(&space, offset, (m_control_word >> 8) & 0x1f);
}
@@ -131,35 +129,33 @@ static WRITE16_HANDLER( blasted_control_w )
*
*************************************/
-static READ16_HANDLER( spyhunt2_port_0_r )
+READ16_MEMBER(mcr68_state::spyhunt2_port_0_r)
{
- mcr68_state *state = space->machine().driver_data<mcr68_state>();
static const char *const portnames[] = { "AN1", "AN2", "AN3", "AN4" };
- int result = input_port_read(space->machine(), "IN0");
- int which = (state->m_control_word >> 3) & 3;
- int analog = input_port_read(space->machine(), portnames[which]);
+ int result = input_port_read(machine(), "IN0");
+ int which = (m_control_word >> 3) & 3;
+ int analog = input_port_read(machine(), portnames[which]);
- return result | ((soundsgood_status_r(space, 0) & 1) << 5) | (analog << 8);
+ return result | ((soundsgood_status_r(&space, 0) & 1) << 5) | (analog << 8);
}
-static READ16_HANDLER( spyhunt2_port_1_r )
+READ16_MEMBER(mcr68_state::spyhunt2_port_1_r)
{
- int result = input_port_read(space->machine(), "IN1");
- return result | ((turbocs_status_r(space, 0) & 1) << 7);
+ int result = input_port_read(machine(), "IN1");
+ return result | ((turbocs_status_r(&space, 0) & 1) << 7);
}
-static WRITE16_HANDLER( spyhunt2_control_w )
+WRITE16_MEMBER(mcr68_state::spyhunt2_control_w)
{
- mcr68_state *state = space->machine().driver_data<mcr68_state>();
- COMBINE_DATA(&state->m_control_word);
+ COMBINE_DATA(&m_control_word);
-/* turbocs_reset_w(~state->m_control_word & 0x0080);*/
- turbocs_data_w(space, offset, (state->m_control_word >> 8) & 0x001f);
+/* turbocs_reset_w(~m_control_word & 0x0080);*/
+ turbocs_data_w(&space, offset, (m_control_word >> 8) & 0x001f);
- soundsgood_reset_w(space->machine(), ~state->m_control_word & 0x2000);
- soundsgood_data_w(space, offset, (state->m_control_word >> 8) & 0x001f);
+ soundsgood_reset_w(machine(), ~m_control_word & 0x2000);
+ soundsgood_data_w(&space, offset, (m_control_word >> 8) & 0x001f);
}
@@ -197,21 +193,20 @@ static WRITE16_HANDLER( spyhunt2_control_w )
static const UINT8 translate49[7] = { 0x7, 0x3, 0x1, 0x0, 0xc, 0xe, 0xf };
-static READ16_HANDLER( archrivl_port_1_r )
+READ16_MEMBER(mcr68_state::archrivl_port_1_r)
{
- return (translate49[input_port_read(space->machine(), "49WAYY2") >> 4] << 12) |
- (translate49[input_port_read(space->machine(), "49WAYX2") >> 4] << 8) |
- (translate49[input_port_read(space->machine(), "49WAYY1") >> 4] << 4) |
- (translate49[input_port_read(space->machine(), "49WAYX1") >> 4] << 0);
+ return (translate49[input_port_read(machine(), "49WAYY2") >> 4] << 12) |
+ (translate49[input_port_read(machine(), "49WAYX2") >> 4] << 8) |
+ (translate49[input_port_read(machine(), "49WAYY1") >> 4] << 4) |
+ (translate49[input_port_read(machine(), "49WAYX1") >> 4] << 0);
}
-static WRITE16_HANDLER( archrivl_control_w )
+WRITE16_MEMBER(mcr68_state::archrivl_control_w)
{
- mcr68_state *state = space->machine().driver_data<mcr68_state>();
- COMBINE_DATA(&state->m_control_word);
- williams_cvsd_reset_w(space->machine(), ~state->m_control_word & 0x0400);
- williams_cvsd_data_w(space->machine(), state->m_control_word & 0x3ff);
+ COMBINE_DATA(&m_control_word);
+ williams_cvsd_reset_w(machine(), ~m_control_word & 0x0400);
+ williams_cvsd_data_w(machine(), m_control_word & 0x3ff);
}
@@ -222,60 +217,58 @@ static WRITE16_HANDLER( archrivl_control_w )
*
*************************************/
-static WRITE16_HANDLER( pigskin_protection_w )
+WRITE16_MEMBER(mcr68_state::pigskin_protection_w)
{
- mcr68_state *state = space->machine().driver_data<mcr68_state>();
/* ignore upper-byte only */
if (ACCESSING_BITS_0_7)
{
/* track the last 5 bytes */
- state->m_protection_data[0] = state->m_protection_data[1];
- state->m_protection_data[1] = state->m_protection_data[2];
- state->m_protection_data[2] = state->m_protection_data[3];
- state->m_protection_data[3] = state->m_protection_data[4];
- state->m_protection_data[4] = data & 0xff;
+ m_protection_data[0] = m_protection_data[1];
+ m_protection_data[1] = m_protection_data[2];
+ m_protection_data[2] = m_protection_data[3];
+ m_protection_data[3] = m_protection_data[4];
+ m_protection_data[4] = data & 0xff;
- logerror("%06X:protection_w=%02X\n", cpu_get_previouspc(&space->device()), data & 0xff);
+ logerror("%06X:protection_w=%02X\n", cpu_get_previouspc(&space.device()), data & 0xff);
}
}
-static READ16_HANDLER( pigskin_protection_r )
+READ16_MEMBER(mcr68_state::pigskin_protection_r)
{
- mcr68_state *state = space->machine().driver_data<mcr68_state>();
/* based on the last 5 bytes return a value */
- if (state->m_protection_data[4] == 0xe3 && state->m_protection_data[3] == 0x94)
+ if (m_protection_data[4] == 0xe3 && m_protection_data[3] == 0x94)
return 0x00; /* must be <= 1 */
- if (state->m_protection_data[4] == 0xc7 && state->m_protection_data[3] == 0x7b && state->m_protection_data[2] == 0x36)
+ if (m_protection_data[4] == 0xc7 && m_protection_data[3] == 0x7b && m_protection_data[2] == 0x36)
return 0x00; /* must be <= 1 */
- if (state->m_protection_data[4] == 0xc7 && state->m_protection_data[3] == 0x7b)
+ if (m_protection_data[4] == 0xc7 && m_protection_data[3] == 0x7b)
return 0x07; /* must be > 5 */
- if (state->m_protection_data[4] == 0xc7 && state->m_protection_data[3] == 0x1f && state->m_protection_data[2] == 0x03 &&
- state->m_protection_data[1] == 0x25 && state->m_protection_data[0] == 0x36)
+ if (m_protection_data[4] == 0xc7 && m_protection_data[3] == 0x1f && m_protection_data[2] == 0x03 &&
+ m_protection_data[1] == 0x25 && m_protection_data[0] == 0x36)
return 0x00; /* must be < 3 */
logerror("Protection read after unrecognized sequence: %02X %02X %02X %02X %02X\n",
- state->m_protection_data[0], state->m_protection_data[1], state->m_protection_data[2], state->m_protection_data[3], state->m_protection_data[4]);
+ m_protection_data[0], m_protection_data[1], m_protection_data[2], m_protection_data[3], m_protection_data[4]);
return 0x00;
}
-static READ16_HANDLER( pigskin_port_1_r )
+READ16_MEMBER(mcr68_state::pigskin_port_1_r)
{
/* see archrivl_port_1_r for 49-way joystick description */
- return input_port_read(space->machine(), "IN1") |
- (translate49[input_port_read(space->machine(), "49WAYX1") >> 4] << 12) |
- (translate49[input_port_read(space->machine(), "49WAYY1") >> 4] << 8);
+ return input_port_read(machine(), "IN1") |
+ (translate49[input_port_read(machine(), "49WAYX1") >> 4] << 12) |
+ (translate49[input_port_read(machine(), "49WAYY1") >> 4] << 8);
}
-static READ16_HANDLER( pigskin_port_2_r )
+READ16_MEMBER(mcr68_state::pigskin_port_2_r)
{
/* see archrivl_port_1_r for 49-way joystick description */
- return input_port_read(space->machine(), "DSW") |
- (translate49[input_port_read(space->machine(), "49WAYX2") >> 4] << 12) |
- (translate49[input_port_read(space->machine(), "49WAYY2") >> 4] << 8);
+ return input_port_read(machine(), "DSW") |
+ (translate49[input_port_read(machine(), "49WAYX2") >> 4] << 12) |
+ (translate49[input_port_read(machine(), "49WAYY2") >> 4] << 8);
}
@@ -286,11 +279,11 @@ static READ16_HANDLER( pigskin_port_2_r )
*
*************************************/
-static READ16_HANDLER( trisport_port_1_r )
+READ16_MEMBER(mcr68_state::trisport_port_1_r)
{
- int xaxis = (INT8)input_port_read(space->machine(), "AN1");
- int yaxis = (INT8)input_port_read(space->machine(), "AN2");
- int result = input_port_read(space->machine(), "IN1");
+ int xaxis = (INT8)input_port_read(machine(), "AN1");
+ int yaxis = (INT8)input_port_read(machine(), "AN2");
+ int result = input_port_read(machine(), "IN1");
result |= (xaxis & 0x3c) << 6;
result |= (yaxis & 0x3c) << 10;
@@ -335,7 +328,7 @@ static ADDRESS_MAP_START( zwackery_map, AS_PROGRAM, 16, mcr68_state )
AM_RANGE(0x000000, 0x037fff) AM_ROM
AM_RANGE(0x080000, 0x080fff) AM_RAM
AM_RANGE(0x084000, 0x084fff) AM_RAM
- AM_RANGE(0x100000, 0x10000f) AM_READWRITE_LEGACY(zwackery_6840_r, mcr68_6840_upper_w)
+ AM_RANGE(0x100000, 0x10000f) AM_READ(zwackery_6840_r) AM_WRITE_LEGACY(mcr68_6840_upper_w)
AM_RANGE(0x104000, 0x104007) AM_DEVREADWRITE8("pia0", pia6821_device, read, write, 0xff00)
AM_RANGE(0x108000, 0x108007) AM_DEVREADWRITE8("pia1", pia6821_device, read, write, 0x00ff)
AM_RANGE(0x10c000, 0x10c007) AM_DEVREADWRITE8("pia2", pia6821_device, read, write, 0x00ff)
@@ -356,16 +349,16 @@ static ADDRESS_MAP_START( pigskin_map, AS_PROGRAM, 16, mcr68_state )
ADDRESS_MAP_UNMAP_HIGH
ADDRESS_MAP_GLOBAL_MASK(0x1fffff)
AM_RANGE(0x000000, 0x03ffff) AM_ROM
- AM_RANGE(0x080000, 0x08ffff) AM_READ_LEGACY(pigskin_port_1_r)
- AM_RANGE(0x0a0000, 0x0affff) AM_READ_LEGACY(pigskin_port_2_r)
+ AM_RANGE(0x080000, 0x08ffff) AM_READ(pigskin_port_1_r)
+ AM_RANGE(0x0a0000, 0x0affff) AM_READ(pigskin_port_2_r)
AM_RANGE(0x0c0000, 0x0c007f) AM_WRITE_LEGACY(mcr68_paletteram_w) AM_BASE_GENERIC(paletteram)
AM_RANGE(0x0e0000, 0x0effff) AM_WRITE_LEGACY(watchdog_reset16_w)
AM_RANGE(0x100000, 0x100fff) AM_RAM_WRITE_LEGACY(mcr68_videoram_w) AM_BASE(m_videoram)
- AM_RANGE(0x120000, 0x120001) AM_READWRITE_LEGACY(pigskin_protection_r, pigskin_protection_w)
+ AM_RANGE(0x120000, 0x120001) AM_READWRITE(pigskin_protection_r, pigskin_protection_w)
AM_RANGE(0x140000, 0x143fff) AM_RAM
AM_RANGE(0x160000, 0x1607ff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
AM_RANGE(0x180000, 0x18000f) AM_READWRITE_LEGACY(mcr68_6840_upper_r, mcr68_6840_upper_w)
- AM_RANGE(0x1a0000, 0x1affff) AM_WRITE_LEGACY(archrivl_control_w)
+ AM_RANGE(0x1a0000, 0x1affff) AM_WRITE(archrivl_control_w)
AM_RANGE(0x1e0000, 0x1effff) AM_READ_PORT("IN0")
ADDRESS_MAP_END
@@ -381,14 +374,14 @@ static ADDRESS_MAP_START( trisport_map, AS_PROGRAM, 16, mcr68_state )
ADDRESS_MAP_UNMAP_HIGH
ADDRESS_MAP_GLOBAL_MASK(0x1fffff)
AM_RANGE(0x000000, 0x03ffff) AM_ROM
- AM_RANGE(0x080000, 0x08ffff) AM_READ_LEGACY(trisport_port_1_r)
+ AM_RANGE(0x080000, 0x08ffff) AM_READ(trisport_port_1_r)
AM_RANGE(0x0a0000, 0x0affff) AM_READ_PORT("DSW")
AM_RANGE(0x100000, 0x103fff) AM_RAM AM_SHARE("nvram")
AM_RANGE(0x120000, 0x12007f) AM_WRITE_LEGACY(mcr68_paletteram_w) AM_BASE_GENERIC(paletteram)
AM_RANGE(0x140000, 0x1407ff) AM_RAM AM_BASE_SIZE(m_spriteram, m_spriteram_size)
AM_RANGE(0x160000, 0x160fff) AM_RAM_WRITE_LEGACY(mcr68_videoram_w) AM_BASE(m_videoram)
AM_RANGE(0x180000, 0x18000f) AM_READWRITE_LEGACY(mcr68_6840_upper_r, mcr68_6840_upper_w)
- AM_RANGE(0x1a0000, 0x1affff) AM_WRITE_LEGACY(archrivl_control_w)
+ AM_RANGE(0x1a0000, 0x1affff) AM_WRITE(archrivl_control_w)
AM_RANGE(0x1c0000, 0x1cffff) AM_WRITE_LEGACY(watchdog_reset16_w)
AM_RANGE(0x1e0000, 0x1effff) AM_READ_PORT("IN0")
ADDRESS_MAP_END
@@ -1573,7 +1566,7 @@ static DRIVER_INIT( xenophob )
state->m_timing_factor = attotime::from_hz(machine.device("maincpu")->unscaled_clock() / 10) * (256 + 16);
/* install control port handler */
- machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x0c0000, 0x0cffff, FUNC(xenophobe_control_w));
+ machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x0c0000, 0x0cffff, write16_delegate(FUNC(mcr68_state::xenophobe_control_w),state));
}
@@ -1586,9 +1579,9 @@ static DRIVER_INIT( spyhunt2 )
state->m_timing_factor = attotime::from_hz(machine.device("maincpu")->unscaled_clock() / 10) * (256 + 16);
/* analog port handling is a bit tricky */
- machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x0c0000, 0x0cffff, FUNC(spyhunt2_control_w));
- machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x0d0000, 0x0dffff, FUNC(spyhunt2_port_0_r));
- machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x0e0000, 0x0effff, FUNC(spyhunt2_port_1_r));
+ machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x0c0000, 0x0cffff, write16_delegate(FUNC(mcr68_state::spyhunt2_control_w),state));
+ machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x0d0000, 0x0dffff, read16_delegate(FUNC(mcr68_state::spyhunt2_port_0_r),state));
+ machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x0e0000, 0x0effff, read16_delegate(FUNC(mcr68_state::spyhunt2_port_1_r),state));
}
@@ -1603,7 +1596,7 @@ static DRIVER_INIT( blasted )
state->m_timing_factor = attotime::from_hz(machine.device("maincpu")->unscaled_clock() / 10) * (256 + 16);
/* handle control writes */
- machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x0c0000, 0x0cffff, FUNC(blasted_control_w));
+ machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x0c0000, 0x0cffff, write16_delegate(FUNC(mcr68_state::blasted_control_w),state));
/* 6840 is mapped to the lower 8 bits */
machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x0a0000, 0x0a000f, FUNC(mcr68_6840_lower_r), FUNC(mcr68_6840_lower_w));
@@ -1618,7 +1611,7 @@ static DRIVER_INIT( intlaser )
state->m_timing_factor = attotime::from_hz(machine.device("maincpu")->unscaled_clock() / 10) * (256 + 16);
/* handle control writes */
- machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x0c0000, 0x0cffff, FUNC(blasted_control_w));
+ machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x0c0000, 0x0cffff, write16_delegate(FUNC(mcr68_state::blasted_control_w),state));
}
@@ -1633,10 +1626,10 @@ static DRIVER_INIT( archrivl )
state->m_timing_factor = attotime::from_hz(machine.device("maincpu")->unscaled_clock() / 10) * (256 + 16);
/* handle control writes */
- machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x0c0000, 0x0cffff, FUNC(archrivl_control_w));
+ machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x0c0000, 0x0cffff, write16_delegate(FUNC(mcr68_state::archrivl_control_w),state));
/* 49-way joystick handling is a bit tricky */
- machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x0e0000, 0x0effff, FUNC(archrivl_port_1_r));
+ machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x0e0000, 0x0effff, read16_delegate(FUNC(mcr68_state::archrivl_port_1_r),state));
/* 6840 is mapped to the lower 8 bits */
machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x0a0000, 0x0a000f, FUNC(mcr68_6840_lower_r), FUNC(mcr68_6840_lower_w));