Converted cabal, mappy, toypop and zaxxon to use driver_data structure [Atari Ace]

---------- Forwarded message ----------
From: Atari Ace <atari_ace@verizon.net>
Date: Sun, Nov 29, 2009 at 3:28 AM
Subject: [patch] Convert cabal/mappy/toypop/zaxxon to use driver_data
To: submit@mamedev.org
Cc: atariace@hotmail.com


Hi mamedev,

This patch is a resubmit of my earlier patch to have mappy and zaxxon
store their state in driver_data.  It extends the patch to toypop
(which uses some mappy code), and also converts cabal which I also did
some time ago.  cabal.h and toypop.h are new header files.

~aa
This commit is contained in:
Phil Bennett 2009-12-01 10:56:22 +00:00
parent dc5bb22a05
commit 0cd4d21890
15 changed files with 471 additions and 307 deletions

2
.gitattributes vendored
View File

@ -2363,6 +2363,7 @@ src/mame/includes/bublbobl.h svneol=native#text/plain
src/mame/includes/buggychl.h svneol=native#text/plain src/mame/includes/buggychl.h svneol=native#text/plain
src/mame/includes/bwing.h svneol=native#text/plain src/mame/includes/bwing.h svneol=native#text/plain
src/mame/includes/bzone.h svneol=native#text/plain src/mame/includes/bzone.h svneol=native#text/plain
src/mame/includes/cabal.h svneol=native#text/plain
src/mame/includes/canyon.h svneol=native#text/plain src/mame/includes/canyon.h svneol=native#text/plain
src/mame/includes/capbowl.h svneol=native#text/plain src/mame/includes/capbowl.h svneol=native#text/plain
src/mame/includes/carjmbre.h svneol=native#text/plain src/mame/includes/carjmbre.h svneol=native#text/plain
@ -2651,6 +2652,7 @@ src/mame/includes/tnzs.h svneol=native#text/plain
src/mame/includes/toaplan1.h svneol=native#text/plain src/mame/includes/toaplan1.h svneol=native#text/plain
src/mame/includes/toaplan2.h svneol=native#text/plain src/mame/includes/toaplan2.h svneol=native#text/plain
src/mame/includes/toobin.h svneol=native#text/plain src/mame/includes/toobin.h svneol=native#text/plain
src/mame/includes/toypop.h svneol=native#text/plain
src/mame/includes/trackfld.h svneol=native#text/plain src/mame/includes/trackfld.h svneol=native#text/plain
src/mame/includes/triplhnt.h svneol=native#text/plain src/mame/includes/triplhnt.h svneol=native#text/plain
src/mame/includes/tubep.h svneol=native#text/plain src/mame/includes/tubep.h svneol=native#text/plain

View File

@ -173,7 +173,6 @@ struct _generic_pointers
UINT32 spriteram2_size; UINT32 spriteram2_size;
generic_ptr buffered_spriteram; /* buffered spriteram */ generic_ptr buffered_spriteram; /* buffered spriteram */
generic_ptr buffered_spriteram2;/* secondary buffered spriteram */ generic_ptr buffered_spriteram2;/* secondary buffered spriteram */
generic_ptr buffered_spriteram3;/* tertiary buffered spriteram */
generic_ptr paletteram; /* palette RAM */ generic_ptr paletteram; /* palette RAM */
generic_ptr paletteram2; /* secondary palette RAM */ generic_ptr paletteram2; /* secondary palette RAM */
bitmap_t * tmpbitmap; /* temporary bitmap */ bitmap_t * tmpbitmap; /* temporary bitmap */

View File

@ -65,16 +65,6 @@
/*************************************
*
* Local sound states
*
*************************************/
static UINT8 sound_state[3];
/************************************* /*************************************
* *
* Zaxxon sound hardware description * Zaxxon sound hardware description
@ -123,9 +113,10 @@ MACHINE_DRIVER_END
WRITE8_DEVICE_HANDLER( zaxxon_sound_a_w ) WRITE8_DEVICE_HANDLER( zaxxon_sound_a_w )
{ {
zaxxon_state *state = (zaxxon_state *)device->machine->driver_data;
const device_config *samples = devtag_get_device(device->machine, "samples"); const device_config *samples = devtag_get_device(device->machine, "samples");
UINT8 diff = data ^ sound_state[0]; UINT8 diff = data ^ state->sound_state[0];
sound_state[0] = data; state->sound_state[0] = data;
/* PLAYER SHIP A/B: volume */ /* PLAYER SHIP A/B: volume */
sample_set_volume(samples, 10, 0.5 + 0.157 * (data & 0x03)); sample_set_volume(samples, 10, 0.5 + 0.157 * (data & 0x03));
@ -158,9 +149,10 @@ WRITE8_DEVICE_HANDLER( zaxxon_sound_a_w )
WRITE8_DEVICE_HANDLER( zaxxon_sound_b_w ) WRITE8_DEVICE_HANDLER( zaxxon_sound_b_w )
{ {
zaxxon_state *state = (zaxxon_state *)device->machine->driver_data;
const device_config *samples = devtag_get_device(device->machine, "samples"); const device_config *samples = devtag_get_device(device->machine, "samples");
UINT8 diff = data ^ sound_state[1]; UINT8 diff = data ^ state->sound_state[1];
sound_state[1] = data; state->sound_state[1] = data;
/* S-EXP: channel 4 */ /* S-EXP: channel 4 */
if ((diff & 0x10) && !(data & 0x10)) sample_start(samples, 4, 4, FALSE); if ((diff & 0x10) && !(data & 0x10)) sample_start(samples, 4, 4, FALSE);
@ -175,9 +167,10 @@ WRITE8_DEVICE_HANDLER( zaxxon_sound_b_w )
WRITE8_DEVICE_HANDLER( zaxxon_sound_c_w ) WRITE8_DEVICE_HANDLER( zaxxon_sound_c_w )
{ {
zaxxon_state *state = (zaxxon_state *)device->machine->driver_data;
const device_config *samples = devtag_get_device(device->machine, "samples"); const device_config *samples = devtag_get_device(device->machine, "samples");
UINT8 diff = data ^ sound_state[2]; UINT8 diff = data ^ state->sound_state[2];
sound_state[2] = data; state->sound_state[2] = data;
/* SHOT: channel 7 */ /* SHOT: channel 7 */
if ((diff & 0x01) && !(data & 0x01)) sample_start(samples, 7, 7, FALSE); if ((diff & 0x01) && !(data & 0x01)) sample_start(samples, 7, 7, FALSE);
@ -232,9 +225,10 @@ MACHINE_DRIVER_END
WRITE8_DEVICE_HANDLER( congo_sound_b_w ) WRITE8_DEVICE_HANDLER( congo_sound_b_w )
{ {
zaxxon_state *state = (zaxxon_state *)device->machine->driver_data;
const device_config *samples = devtag_get_device(device->machine, "samples"); const device_config *samples = devtag_get_device(device->machine, "samples");
UINT8 diff = data ^ sound_state[1]; UINT8 diff = data ^ state->sound_state[1];
sound_state[1] = data; state->sound_state[1] = data;
/* bit 7 = mute */ /* bit 7 = mute */
@ -245,9 +239,10 @@ WRITE8_DEVICE_HANDLER( congo_sound_b_w )
WRITE8_DEVICE_HANDLER( congo_sound_c_w ) WRITE8_DEVICE_HANDLER( congo_sound_c_w )
{ {
zaxxon_state *state = (zaxxon_state *)device->machine->driver_data;
const device_config *samples = devtag_get_device(device->machine, "samples"); const device_config *samples = devtag_get_device(device->machine, "samples");
UINT8 diff = data ^ sound_state[2]; UINT8 diff = data ^ state->sound_state[2];
sound_state[2] = data; state->sound_state[2] = data;
/* BASS DRUM: channel 1 */ /* BASS DRUM: channel 1 */
if ((diff & 0x01) && !(data & 0x01)) sample_start(samples, 1, 1, FALSE); if ((diff & 0x01) && !(data & 0x01)) sample_start(samples, 1, 1, FALSE);

View File

@ -47,22 +47,15 @@ Dip locations verified with Fabtek manual for the trackball version
#include "driver.h" #include "driver.h"
#include "cpu/m68000/m68000.h" #include "cpu/m68000/m68000.h"
#include "cpu/z80/z80.h" #include "cpu/z80/z80.h"
#include "audio/seibu.h"
#include "sound/2151intf.h" #include "sound/2151intf.h"
#include "sound/msm5205.h" #include "sound/msm5205.h"
#include "audio/seibu.h"
extern VIDEO_START( cabal ); #include "includes/cabal.h"
extern VIDEO_UPDATE( cabal );
WRITE16_HANDLER( cabal_flipscreen_w );
WRITE16_HANDLER( cabal_background_videoram16_w );
WRITE16_HANDLER( cabal_text_videoram16_w );
static int cabal_sound_command1, cabal_sound_command2;
static MACHINE_RESET( cabalbl ) static MACHINE_RESET( cabalbl )
{ {
cabal_sound_command1 = cabal_sound_command2 = 0xff; cabal_state *state = (cabal_state *)machine->driver_data;
state->sound_command1 = state->sound_command2 = 0xff;
} }
@ -70,40 +63,43 @@ static MACHINE_RESET( cabalbl )
static WRITE16_HANDLER( cabalbl_sndcmd_w ) static WRITE16_HANDLER( cabalbl_sndcmd_w )
{ {
cabal_state *state = (cabal_state *)space->machine->driver_data;
switch (offset) switch (offset)
{ {
case 0x0: case 0x0:
cabal_sound_command1 = data; state->sound_command1 = data;
break; break;
case 0x1: /* ?? */ case 0x1: /* ?? */
cabal_sound_command2 = data & 0xff; state->sound_command2 = data & 0xff;
break; break;
} }
} }
static int last[4];
static WRITE16_HANDLER( track_reset_w ) static WRITE16_HANDLER( track_reset_w )
{ {
cabal_state *state = (cabal_state *)space->machine->driver_data;
int i; int i;
static const char *const track_names[] = { "IN0", "IN1", "IN2", "IN3" }; static const char *const track_names[] = { "IN0", "IN1", "IN2", "IN3" };
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
last[i] = input_port_read(space->machine, track_names[i]); state->last[i] = input_port_read(space->machine, track_names[i]);
} }
static READ16_HANDLER( track_r ) static READ16_HANDLER( track_r )
{ {
cabal_state *state = (cabal_state *)space->machine->driver_data;
switch (offset) switch (offset)
{ {
default: default:
case 0: return (( input_port_read(space->machine, "IN0") - last[0]) & 0x00ff) | (((input_port_read(space->machine, "IN2") - last[2]) & 0x00ff) << 8); /* X lo */ case 0: return (( input_port_read(space->machine, "IN0") - state->last[0]) & 0x00ff) | (((input_port_read(space->machine, "IN2") - state->last[2]) & 0x00ff) << 8); /* X lo */
case 1: return (((input_port_read(space->machine, "IN0") - last[0]) & 0xff00) >> 8) | (( input_port_read(space->machine, "IN2") - last[2]) & 0xff00); /* X hi */ case 1: return (((input_port_read(space->machine, "IN0") - state->last[0]) & 0xff00) >> 8) | (( input_port_read(space->machine, "IN2") - state->last[2]) & 0xff00); /* X hi */
case 2: return (( input_port_read(space->machine, "IN1") - last[1]) & 0x00ff) | (((input_port_read(space->machine, "IN3") - last[3]) & 0x00ff) << 8); /* Y lo */ case 2: return (( input_port_read(space->machine, "IN1") - state->last[1]) & 0x00ff) | (((input_port_read(space->machine, "IN3") - state->last[3]) & 0x00ff) << 8); /* Y lo */
case 3: return (((input_port_read(space->machine, "IN1") - last[1]) & 0xff00) >> 8) | (( input_port_read(space->machine, "IN3") - last[3]) & 0xff00); /* Y hi */ case 3: return (((input_port_read(space->machine, "IN1") - state->last[1]) & 0xff00) >> 8) | (( input_port_read(space->machine, "IN3") - state->last[3]) & 0xff00); /* Y hi */
} }
} }
@ -126,10 +122,10 @@ static WRITE16_HANDLER( cabalbl_sound_irq_trigger_word_w )
static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 16 ) static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x00000, 0x3ffff) AM_ROM AM_RANGE(0x00000, 0x3ffff) AM_ROM
AM_RANGE(0x40000, 0x437ff) AM_RAM AM_RANGE(0x40000, 0x437ff) AM_RAM
AM_RANGE(0x43800, 0x43fff) AM_RAM_WRITE(SMH_RAM) AM_BASE_SIZE_GENERIC(spriteram) AM_RANGE(0x43800, 0x43fff) AM_RAM_WRITE(SMH_RAM) AM_BASE_MEMBER(cabal_state,spriteram) AM_SIZE_MEMBER(cabal_state,spriteram_size)
AM_RANGE(0x44000, 0x4ffff) AM_RAM AM_RANGE(0x44000, 0x4ffff) AM_RAM
AM_RANGE(0x60000, 0x607ff) AM_RAM_WRITE(cabal_text_videoram16_w) AM_BASE_GENERIC(colorram) AM_RANGE(0x60000, 0x607ff) AM_RAM_WRITE(cabal_text_videoram16_w) AM_BASE_MEMBER(cabal_state,colorram)
AM_RANGE(0x80000, 0x801ff) AM_RAM_WRITE(cabal_background_videoram16_w) AM_BASE_GENERIC(videoram) AM_SIZE_GENERIC(videoram) AM_RANGE(0x80000, 0x801ff) AM_RAM_WRITE(cabal_background_videoram16_w) AM_BASE_MEMBER(cabal_state,videoram)
AM_RANGE(0x80200, 0x803ff) AM_RAM_WRITE(SMH_RAM) AM_RANGE(0x80200, 0x803ff) AM_RAM_WRITE(SMH_RAM)
AM_RANGE(0xa0000, 0xa0001) AM_READ_PORT("DSW") AM_RANGE(0xa0000, 0xa0001) AM_READ_PORT("DSW")
AM_RANGE(0xa0008, 0xa000f) AM_READ(track_r) AM_RANGE(0xa0008, 0xa000f) AM_READ(track_r)
@ -145,10 +141,10 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( cabalbl_main_map, ADDRESS_SPACE_PROGRAM, 16 ) static ADDRESS_MAP_START( cabalbl_main_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x00000, 0x3ffff) AM_ROM AM_RANGE(0x00000, 0x3ffff) AM_ROM
AM_RANGE(0x40000, 0x437ff) AM_RAM AM_RANGE(0x40000, 0x437ff) AM_RAM
AM_RANGE(0x43800, 0x43fff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram) AM_RANGE(0x43800, 0x43fff) AM_RAM AM_BASE_MEMBER(cabal_state,spriteram) AM_SIZE_MEMBER(cabal_state,spriteram_size)
AM_RANGE(0x44000, 0x4ffff) AM_RAM AM_RANGE(0x44000, 0x4ffff) AM_RAM
AM_RANGE(0x60000, 0x607ff) AM_RAM_WRITE(cabal_text_videoram16_w) AM_BASE_GENERIC(colorram) AM_RANGE(0x60000, 0x607ff) AM_RAM_WRITE(cabal_text_videoram16_w) AM_BASE_MEMBER(cabal_state,colorram)
AM_RANGE(0x80000, 0x801ff) AM_RAM_WRITE(cabal_background_videoram16_w) AM_BASE_GENERIC(videoram) AM_SIZE_GENERIC(videoram) AM_RANGE(0x80000, 0x801ff) AM_RAM_WRITE(cabal_background_videoram16_w) AM_BASE_MEMBER(cabal_state,videoram)
AM_RANGE(0x80200, 0x803ff) AM_RAM AM_RANGE(0x80200, 0x803ff) AM_RAM
AM_RANGE(0xa0000, 0xa0001) AM_READ_PORT("DSW") AM_RANGE(0xa0000, 0xa0001) AM_READ_PORT("DSW")
AM_RANGE(0xa0008, 0xa0009) AM_READ_PORT("JOY") AM_RANGE(0xa0008, 0xa0009) AM_READ_PORT("JOY")
@ -166,12 +162,16 @@ ADDRESS_MAP_END
static READ8_HANDLER( cabalbl_snd2_r ) static READ8_HANDLER( cabalbl_snd2_r )
{ {
return BITSWAP8(cabal_sound_command2, 7,2,4,5,3,6,1,0); cabal_state *state = (cabal_state *)space->machine->driver_data;
return BITSWAP8(state->sound_command2, 7,2,4,5,3,6,1,0);
} }
static READ8_HANDLER( cabalbl_snd1_r ) static READ8_HANDLER( cabalbl_snd1_r )
{ {
return BITSWAP8(cabal_sound_command1, 7,2,4,5,3,6,1,0); cabal_state *state = (cabal_state *)space->machine->driver_data;
return BITSWAP8(state->sound_command1, 7,2,4,5,3,6,1,0);
} }
static WRITE8_HANDLER( cabalbl_coin_w ) static WRITE8_HANDLER( cabalbl_coin_w )
@ -486,6 +486,8 @@ static const msm5205_interface msm5205_interface_2 =
static MACHINE_DRIVER_START( cabal ) static MACHINE_DRIVER_START( cabal )
MDRV_DRIVER_DATA(cabal_state)
/* basic machine hardware */ /* basic machine hardware */
MDRV_CPU_ADD("maincpu", M68000, XTAL_20MHz/2) /* verified on pcb */ MDRV_CPU_ADD("maincpu", M68000, XTAL_20MHz/2) /* verified on pcb */
MDRV_CPU_PROGRAM_MAP(main_map) MDRV_CPU_PROGRAM_MAP(main_map)
@ -528,6 +530,8 @@ MACHINE_DRIVER_END
/* the bootleg has different sound hardware (2 extra Z80s for ADPCM playback) */ /* the bootleg has different sound hardware (2 extra Z80s for ADPCM playback) */
static MACHINE_DRIVER_START( cabalbl ) static MACHINE_DRIVER_START( cabalbl )
MDRV_DRIVER_DATA(cabal_state)
/* basic machine hardware */ /* basic machine hardware */
MDRV_CPU_ADD("maincpu", M68000, XTAL_20MHz/2) /* verified on pcb */ MDRV_CPU_ADD("maincpu", M68000, XTAL_20MHz/2) /* verified on pcb */
MDRV_CPU_PROGRAM_MAP(cabalbl_main_map) MDRV_CPU_PROGRAM_MAP(cabalbl_main_map)

View File

@ -584,7 +584,6 @@ TODO:
***************************************************************************/ ***************************************************************************/
static int mux;
static READ8_HANDLER( in0_l ) { return input_port_read(space->machine, "IN0"); } // P1 joystick static READ8_HANDLER( in0_l ) { return input_port_read(space->machine, "IN0"); } // P1 joystick
static READ8_HANDLER( in0_h ) { return input_port_read(space->machine, "IN0") >> 4; } // P2 joystick static READ8_HANDLER( in0_h ) { return input_port_read(space->machine, "IN0") >> 4; } // P2 joystick
static READ8_HANDLER( in1_l ) { return input_port_read(space->machine, "IN1"); } // fire and start buttons static READ8_HANDLER( in1_l ) { return input_port_read(space->machine, "IN1"); } // fire and start buttons
@ -592,13 +591,28 @@ static READ8_HANDLER( in1_h ) { return input_port_read(space->machine, "IN1") >>
static READ8_HANDLER( in2 ) { return input_port_read(space->machine, "DSW0"); } // test, cocktail, optional buttons static READ8_HANDLER( in2 ) { return input_port_read(space->machine, "DSW0"); } // test, cocktail, optional buttons
static READ8_HANDLER( dipA_l ) { return input_port_read(space->machine, "DSW1"); } // dips A static READ8_HANDLER( dipA_l ) { return input_port_read(space->machine, "DSW1"); } // dips A
static READ8_HANDLER( dipA_h ) { return input_port_read(space->machine, "DSW1") >> 4; } // dips A static READ8_HANDLER( dipA_h ) { return input_port_read(space->machine, "DSW1") >> 4; } // dips A
static READ8_HANDLER( dipB_mux ) { return input_port_read(space->machine, "DSW2") >> (4*mux); } // dips B static READ8_HANDLER( dipB_mux ) // dips B
{
mappy_state *state = (mappy_state *)space->machine->driver_data;
return input_port_read(space->machine, "DSW2") >> (4*state->mux);
}
static READ8_HANDLER( dipB_muxi ) // dips B static READ8_HANDLER( dipB_muxi ) // dips B
{ {
mappy_state *state = (mappy_state *)space->machine->driver_data;
// bits are interleaved in Phozon // bits are interleaved in Phozon
return BITSWAP8(input_port_read(space->machine, "DSW2"),6,4,2,0,7,5,3,1) >> (4*mux); return BITSWAP8(input_port_read(space->machine, "DSW2"),6,4,2,0,7,5,3,1) >> (4*state->mux);
} }
static WRITE8_HANDLER( out_mux ) { mux = data & 1; }
static WRITE8_HANDLER( out_mux )
{
mappy_state *state = (mappy_state *)space->machine->driver_data;
state->mux = data & 1;
}
static WRITE8_HANDLER( out_lamps ) static WRITE8_HANDLER( out_lamps )
{ {
set_led_status(space->machine, 0,data & 1); set_led_status(space->machine, 0,data & 1);
@ -851,8 +865,8 @@ static INTERRUPT_GEN( mappy_interrupt_1 )
static ADDRESS_MAP_START( superpac_cpu1_map, ADDRESS_SPACE_PROGRAM, 8 ) static ADDRESS_MAP_START( superpac_cpu1_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_RAM_WRITE(superpac_videoram_w) AM_BASE(&mappy_videoram) /* video RAM */ AM_RANGE(0x0000, 0x07ff) AM_RAM_WRITE(superpac_videoram_w) AM_BASE_MEMBER(mappy_state,videoram) /* video RAM */
AM_RANGE(0x0800, 0x1fff) AM_RAM AM_BASE(&mappy_spriteram) /* work RAM with embedded sprite RAM */ AM_RANGE(0x0800, 0x1fff) AM_RAM AM_BASE_MEMBER(mappy_state,spriteram) /* work RAM with embedded sprite RAM */
AM_RANGE(0x2000, 0x2000) AM_READWRITE(superpac_flipscreen_r, superpac_flipscreen_w) AM_RANGE(0x2000, 0x2000) AM_READWRITE(superpac_flipscreen_r, superpac_flipscreen_w)
AM_RANGE(0x4000, 0x43ff) AM_RAM AM_DEVWRITE("namco", mappy_snd_sharedram_w) AM_SHARE(1) /* shared RAM with the sound CPU */ AM_RANGE(0x4000, 0x43ff) AM_RAM AM_DEVWRITE("namco", mappy_snd_sharedram_w) AM_SHARE(1) /* shared RAM with the sound CPU */
AM_RANGE(0x4800, 0x4bff) AM_READWRITE(namcoio_r, namcoio_w) /* custom I/O chips interface */ AM_RANGE(0x4800, 0x4bff) AM_READWRITE(namcoio_r, namcoio_w) /* custom I/O chips interface */
@ -862,8 +876,8 @@ static ADDRESS_MAP_START( superpac_cpu1_map, ADDRESS_SPACE_PROGRAM, 8 )
ADDRESS_MAP_END ADDRESS_MAP_END
static ADDRESS_MAP_START( phozon_cpu1_map, ADDRESS_SPACE_PROGRAM, 8 ) static ADDRESS_MAP_START( phozon_cpu1_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_RAM_WRITE(superpac_videoram_w) AM_SHARE(2) AM_BASE(&mappy_videoram) /* video RAM */ AM_RANGE(0x0000, 0x07ff) AM_RAM_WRITE(superpac_videoram_w) AM_SHARE(2) AM_BASE_MEMBER(mappy_state,videoram) /* video RAM */
AM_RANGE(0x0800, 0x1fff) AM_RAM AM_BASE(&mappy_spriteram) AM_SHARE(3) /* shared RAM with CPU #2/sprite RAM*/ AM_RANGE(0x0800, 0x1fff) AM_RAM AM_BASE_MEMBER(mappy_state,spriteram) AM_SHARE(3) /* shared RAM with CPU #2/sprite RAM*/
AM_RANGE(0x4000, 0x43ff) AM_RAM AM_DEVWRITE("namco", mappy_snd_sharedram_w) AM_SHARE(1) /* shared RAM with the sound CPU */ AM_RANGE(0x4000, 0x43ff) AM_RAM AM_DEVWRITE("namco", mappy_snd_sharedram_w) AM_SHARE(1) /* shared RAM with the sound CPU */
AM_RANGE(0x4800, 0x4bff) AM_READWRITE(namcoio_r, namcoio_w) /* custom I/O chips interface */ AM_RANGE(0x4800, 0x4bff) AM_READWRITE(namcoio_r, namcoio_w) /* custom I/O chips interface */
AM_RANGE(0x5000, 0x500f) AM_WRITE(phozon_latch_w) /* various control bits */ AM_RANGE(0x5000, 0x500f) AM_WRITE(phozon_latch_w) /* various control bits */
@ -872,8 +886,8 @@ static ADDRESS_MAP_START( phozon_cpu1_map, ADDRESS_SPACE_PROGRAM, 8 )
ADDRESS_MAP_END ADDRESS_MAP_END
static ADDRESS_MAP_START( mappy_cpu1_map, ADDRESS_SPACE_PROGRAM, 8 ) static ADDRESS_MAP_START( mappy_cpu1_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x0fff) AM_RAM_WRITE(mappy_videoram_w) AM_BASE(&mappy_videoram) /* video RAM */ AM_RANGE(0x0000, 0x0fff) AM_RAM_WRITE(mappy_videoram_w) AM_BASE_MEMBER(mappy_state,videoram) /* video RAM */
AM_RANGE(0x1000, 0x27ff) AM_RAM AM_BASE(&mappy_spriteram) /* work RAM with embedded sprite RAM */ AM_RANGE(0x1000, 0x27ff) AM_RAM AM_BASE_MEMBER(mappy_state,spriteram) /* work RAM with embedded sprite RAM */
AM_RANGE(0x3800, 0x3fff) AM_WRITE(mappy_scroll_w) /* scroll */ AM_RANGE(0x3800, 0x3fff) AM_WRITE(mappy_scroll_w) /* scroll */
AM_RANGE(0x4000, 0x43ff) AM_RAM AM_DEVWRITE("namco", mappy_snd_sharedram_w) AM_SHARE(1) /* shared RAM with the sound CPU */ AM_RANGE(0x4000, 0x43ff) AM_RAM AM_DEVWRITE("namco", mappy_snd_sharedram_w) AM_SHARE(1) /* shared RAM with the sound CPU */
AM_RANGE(0x4800, 0x4bff) AM_READWRITE(namcoio_r, namcoio_w) /* custom I/O chips interface */ AM_RANGE(0x4800, 0x4bff) AM_READWRITE(namcoio_r, namcoio_w) /* custom I/O chips interface */
@ -1499,6 +1513,8 @@ static const namco_interface namco_config =
static MACHINE_DRIVER_START( superpac ) static MACHINE_DRIVER_START( superpac )
MDRV_DRIVER_DATA(mappy_state)
/* basic machine hardware */ /* basic machine hardware */
MDRV_CPU_ADD("maincpu", M6809, PIXEL_CLOCK/4) /* 1.536 MHz */ MDRV_CPU_ADD("maincpu", M6809, PIXEL_CLOCK/4) /* 1.536 MHz */
MDRV_CPU_PROGRAM_MAP(superpac_cpu1_map) MDRV_CPU_PROGRAM_MAP(superpac_cpu1_map)
@ -1546,6 +1562,8 @@ MACHINE_DRIVER_END
static MACHINE_DRIVER_START( phozon ) static MACHINE_DRIVER_START( phozon )
MDRV_DRIVER_DATA(mappy_state)
/* basic machine hardware */ /* basic machine hardware */
MDRV_CPU_ADD("maincpu", M6809, PIXEL_CLOCK/4) /* MAIN CPU */ MDRV_CPU_ADD("maincpu", M6809, PIXEL_CLOCK/4) /* MAIN CPU */
MDRV_CPU_PROGRAM_MAP(phozon_cpu1_map) MDRV_CPU_PROGRAM_MAP(phozon_cpu1_map)
@ -1587,6 +1605,8 @@ MACHINE_DRIVER_END
static MACHINE_DRIVER_START( mappy ) static MACHINE_DRIVER_START( mappy )
MDRV_DRIVER_DATA(mappy_state)
/* basic machine hardware */ /* basic machine hardware */
MDRV_CPU_ADD("maincpu", M6809, PIXEL_CLOCK/4) /* 1.536 MHz */ MDRV_CPU_ADD("maincpu", M6809, PIXEL_CLOCK/4) /* 1.536 MHz */
MDRV_CPU_PROGRAM_MAP(mappy_cpu1_map) MDRV_CPU_PROGRAM_MAP(mappy_cpu1_map)

View File

@ -34,21 +34,7 @@ TODO:
#include "cpu/m68000/m68000.h" #include "cpu/m68000/m68000.h"
#include "machine/namcoio.h" #include "machine/namcoio.h"
#include "sound/namco.h" #include "sound/namco.h"
#include "includes/mappy.h" #include "includes/toypop.h"
// video\toypop.c
extern UINT16 *toypop_bg_image;
extern UINT8 *toypop_videoram;
WRITE8_HANDLER( toypop_videoram_w );
READ16_HANDLER( toypop_merged_background_r );
WRITE16_HANDLER( toypop_merged_background_w );
WRITE8_HANDLER( toypop_palettebank_w );
WRITE16_HANDLER( toypop_flipscreen_w );
VIDEO_START( toypop );
VIDEO_UPDATE( toypop );
PALETTE_INIT( toypop );
/*************************************************************************** /***************************************************************************
@ -126,10 +112,6 @@ static DRIVER_INIT( 58_56_56 )
/***************************************************************************/ /***************************************************************************/
static int interrupt_enable_68k;
static UINT8 *toypop_m68000_sharedram;
static READ8_DEVICE_HANDLER( toypop_sound_sharedram_r ) static READ8_DEVICE_HANDLER( toypop_sound_sharedram_r )
{ {
return namco_soundregs[offset]; return namco_soundregs[offset];
@ -145,13 +127,17 @@ static WRITE8_DEVICE_HANDLER( toypop_sound_sharedram_w )
static READ16_HANDLER( toypop_m68000_sharedram_r ) static READ16_HANDLER( toypop_m68000_sharedram_r )
{ {
return toypop_m68000_sharedram[offset]; toypop_state *state = (toypop_state *)space->machine->driver_data;
return state->m68000_sharedram[offset];
} }
static WRITE16_HANDLER( toypop_m68000_sharedram_w ) static WRITE16_HANDLER( toypop_m68000_sharedram_w )
{ {
if (ACCESSING_BITS_0_7) if (ACCESSING_BITS_0_7)
toypop_m68000_sharedram[offset] = data & 0xff; {
toypop_state *state = (toypop_state *)space->machine->driver_data;
state->m68000_sharedram[offset] = data & 0xff;
}
} }
static READ8_HANDLER( toypop_main_interrupt_enable_r ) static READ8_HANDLER( toypop_main_interrupt_enable_r )
@ -214,11 +200,12 @@ static WRITE8_HANDLER( toypop_m68000_assert_w )
static TIMER_CALLBACK( disable_interrupts ) static TIMER_CALLBACK( disable_interrupts )
{ {
toypop_state *state = (toypop_state *)machine->driver_data;
cpu_interrupt_enable(cputag_get_cpu(machine, "maincpu"), 0); cpu_interrupt_enable(cputag_get_cpu(machine, "maincpu"), 0);
cputag_set_input_line(machine, "maincpu", 0, CLEAR_LINE); cputag_set_input_line(machine, "maincpu", 0, CLEAR_LINE);
cpu_interrupt_enable(cputag_get_cpu(machine, "audiocpu"), 0); cpu_interrupt_enable(cputag_get_cpu(machine, "audiocpu"), 0);
cputag_set_input_line(machine, "audiocpu", 0, CLEAR_LINE); cputag_set_input_line(machine, "audiocpu", 0, CLEAR_LINE);
interrupt_enable_68k = 0; state->interrupt_enable_68k = 0;
} }
static MACHINE_RESET( toypop ) static MACHINE_RESET( toypop )
@ -230,18 +217,21 @@ static MACHINE_RESET( toypop )
static INTERRUPT_GEN( toypop_m68000_interrupt ) static INTERRUPT_GEN( toypop_m68000_interrupt )
{ {
if (interrupt_enable_68k) toypop_state *state = (toypop_state *)device->machine->driver_data;
if (state->interrupt_enable_68k)
cpu_set_input_line(device, 6, HOLD_LINE); cpu_set_input_line(device, 6, HOLD_LINE);
} }
static WRITE16_HANDLER( toypop_m68000_interrupt_enable_w ) static WRITE16_HANDLER( toypop_m68000_interrupt_enable_w )
{ {
interrupt_enable_68k = 1; toypop_state *state = (toypop_state *)space->machine->driver_data;
state->interrupt_enable_68k = 1;
} }
static WRITE16_HANDLER( toypop_m68000_interrupt_disable_w ) static WRITE16_HANDLER( toypop_m68000_interrupt_disable_w )
{ {
interrupt_enable_68k = 0; toypop_state *state = (toypop_state *)space->machine->driver_data;
state->interrupt_enable_68k = 0;
} }
@ -253,9 +243,9 @@ static WRITE16_HANDLER( toypop_m68000_interrupt_disable_w )
*************************************/ *************************************/
static ADDRESS_MAP_START( liblrabl_map, ADDRESS_SPACE_PROGRAM, 8 ) static ADDRESS_MAP_START( liblrabl_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_RAM_WRITE(toypop_videoram_w) AM_BASE(&toypop_videoram) /* video RAM */ AM_RANGE(0x0000, 0x07ff) AM_RAM_WRITE(toypop_videoram_w) AM_BASE_MEMBER(toypop_state,videoram) /* video RAM */
AM_RANGE(0x0800, 0x1fff) AM_RAM AM_BASE(&mappy_spriteram) /* general RAM, area 1 */ AM_RANGE(0x0800, 0x1fff) AM_RAM AM_BASE_MEMBER(toypop_state,spriteram) /* general RAM, area 1 */
AM_RANGE(0x2800, 0x2fff) AM_RAM AM_BASE(&toypop_m68000_sharedram) /* shared RAM with the 68000 CPU */ AM_RANGE(0x2800, 0x2fff) AM_RAM AM_BASE_MEMBER(toypop_state,m68000_sharedram) /* shared RAM with the 68000 CPU */
AM_RANGE(0x6000, 0x63ff) AM_DEVREADWRITE("namco", toypop_sound_sharedram_r, toypop_sound_sharedram_w) /* shared RAM with sound CPU */ AM_RANGE(0x6000, 0x63ff) AM_DEVREADWRITE("namco", toypop_sound_sharedram_r, toypop_sound_sharedram_w) /* shared RAM with sound CPU */
AM_RANGE(0x6800, 0x683f) AM_READWRITE(namcoio_r, namcoio_w) /* custom I/O */ AM_RANGE(0x6800, 0x683f) AM_READWRITE(namcoio_r, namcoio_w) /* custom I/O */
AM_RANGE(0x7000, 0x7000) AM_WRITE(toypop_main_interrupt_enable_w) /* enable interrupt */ AM_RANGE(0x7000, 0x7000) AM_WRITE(toypop_main_interrupt_enable_w) /* enable interrupt */
@ -269,9 +259,9 @@ static ADDRESS_MAP_START( liblrabl_map, ADDRESS_SPACE_PROGRAM, 8 )
ADDRESS_MAP_END ADDRESS_MAP_END
static ADDRESS_MAP_START( toypop_map, ADDRESS_SPACE_PROGRAM, 8 ) static ADDRESS_MAP_START( toypop_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_RAM_WRITE(toypop_videoram_w) AM_BASE(&toypop_videoram) /* video RAM */ AM_RANGE(0x0000, 0x07ff) AM_RAM_WRITE(toypop_videoram_w) AM_BASE_MEMBER(toypop_state,videoram) /* video RAM */
AM_RANGE(0x0800, 0x1fff) AM_RAM AM_BASE(&mappy_spriteram) /* general RAM, area 1 */ AM_RANGE(0x0800, 0x1fff) AM_RAM AM_BASE_MEMBER(toypop_state,spriteram) /* general RAM, area 1 */
AM_RANGE(0x2800, 0x2fff) AM_RAM AM_BASE(&toypop_m68000_sharedram) /* shared RAM with the 68000 CPU */ AM_RANGE(0x2800, 0x2fff) AM_RAM AM_BASE_MEMBER(toypop_state,m68000_sharedram) /* shared RAM with the 68000 CPU */
AM_RANGE(0x6000, 0x603f) AM_READWRITE(namcoio_r, namcoio_w) /* custom I/O */ AM_RANGE(0x6000, 0x603f) AM_READWRITE(namcoio_r, namcoio_w) /* custom I/O */
AM_RANGE(0x6800, 0x6bff) AM_DEVREADWRITE("namco", toypop_sound_sharedram_r, toypop_sound_sharedram_w) /* shared RAM with sound CPU */ AM_RANGE(0x6800, 0x6bff) AM_DEVREADWRITE("namco", toypop_sound_sharedram_r, toypop_sound_sharedram_w) /* shared RAM with sound CPU */
AM_RANGE(0x7000, 0x7000) AM_READWRITE(toypop_main_interrupt_enable_r, toypop_main_interrupt_disable_w) /* disable interrupt */ AM_RANGE(0x7000, 0x7000) AM_READWRITE(toypop_main_interrupt_enable_r, toypop_main_interrupt_disable_w) /* disable interrupt */
@ -312,7 +302,7 @@ static ADDRESS_MAP_START( m68k_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x100000, 0x100fff) AM_READWRITE(toypop_m68000_sharedram_r, toypop_m68000_sharedram_w) /* shared RAM with the main CPU */ AM_RANGE(0x100000, 0x100fff) AM_READWRITE(toypop_m68000_sharedram_r, toypop_m68000_sharedram_w) /* shared RAM with the main CPU */
AM_RANGE(0x180000, 0x187fff) AM_READWRITE(toypop_merged_background_r, toypop_merged_background_w) /* RAM that has to be merged with the background image */ AM_RANGE(0x180000, 0x187fff) AM_READWRITE(toypop_merged_background_r, toypop_merged_background_w) /* RAM that has to be merged with the background image */
AM_RANGE(0x18fffc, 0x18ffff) AM_WRITE(toypop_flipscreen_w) /* flip mode */ AM_RANGE(0x18fffc, 0x18ffff) AM_WRITE(toypop_flipscreen_w) /* flip mode */
AM_RANGE(0x190000, 0x1dffff) AM_RAM AM_BASE(&toypop_bg_image) /* RAM containing the background image */ AM_RANGE(0x190000, 0x1dffff) AM_RAM AM_BASE_MEMBER(toypop_state,bg_image) /* RAM containing the background image */
AM_RANGE(0x300000, 0x300001) AM_WRITE(toypop_m68000_interrupt_enable_w) /* interrupt enable */ AM_RANGE(0x300000, 0x300001) AM_WRITE(toypop_m68000_interrupt_enable_w) /* interrupt enable */
AM_RANGE(0x380000, 0x380001) AM_WRITE(toypop_m68000_interrupt_disable_w)/* interrupt disable */ AM_RANGE(0x380000, 0x380001) AM_WRITE(toypop_m68000_interrupt_disable_w)/* interrupt disable */
ADDRESS_MAP_END ADDRESS_MAP_END
@ -540,6 +530,8 @@ static const namco_interface namco_config =
static MACHINE_DRIVER_START( liblrabl ) static MACHINE_DRIVER_START( liblrabl )
MDRV_DRIVER_DATA(toypop_state)
/* basic machine hardware */ /* basic machine hardware */
MDRV_CPU_ADD("maincpu", M6809, 1536000) /* 1.536 MHz (measured on Libble Rabble board) */ MDRV_CPU_ADD("maincpu", M6809, 1536000) /* 1.536 MHz (measured on Libble Rabble board) */
MDRV_CPU_PROGRAM_MAP(liblrabl_map) MDRV_CPU_PROGRAM_MAP(liblrabl_map)

View File

@ -306,12 +306,12 @@
#include "driver.h" #include "driver.h"
#include "cpu/z80/z80.h" #include "cpu/z80/z80.h"
#include "sound/sn76496.h"
#include "sound/samples.h"
#include "machine/segacrpt.h" #include "machine/segacrpt.h"
#include "machine/8255ppi.h" #include "machine/8255ppi.h"
#include "audio/segasnd.h" #include "audio/segasnd.h"
#include "sound/sn76496.h" #include "includes/zaxxon.h"
#include "sound/samples.h"
#include "zaxxon.h"
@ -336,21 +336,6 @@
/*************************************
*
* Global variables
*
*************************************/
static UINT8 int_enabled;
static UINT8 coin_status[3];
static UINT8 coin_enable[3];
static UINT8 razmataz_dial_pos[2];
static UINT16 razmataz_counter;
/************************************* /*************************************
* *
* Interrupt generation * Interrupt generation
@ -367,15 +352,19 @@ static INPUT_CHANGED( service_switch )
static INTERRUPT_GEN( vblank_int ) static INTERRUPT_GEN( vblank_int )
{ {
if (int_enabled) zaxxon_state *state = (zaxxon_state *)device->machine->driver_data;
if (state->int_enabled)
cpu_set_input_line(device, 0, ASSERT_LINE); cpu_set_input_line(device, 0, ASSERT_LINE);
} }
static WRITE8_HANDLER( int_enable_w ) static WRITE8_HANDLER( int_enable_w )
{ {
int_enabled = data & 1; zaxxon_state *state = (zaxxon_state *)space->machine->driver_data;
if (!int_enabled)
state->int_enabled = data & 1;
if (!state->int_enabled)
cputag_set_input_line(space->machine, "maincpu", 0, CLEAR_LINE); cputag_set_input_line(space->machine, "maincpu", 0, CLEAR_LINE);
} }
@ -389,10 +378,12 @@ static WRITE8_HANDLER( int_enable_w )
static MACHINE_START( zaxxon ) static MACHINE_START( zaxxon )
{ {
zaxxon_state *state = (zaxxon_state *)machine->driver_data;
/* register for save states */ /* register for save states */
state_save_register_global(machine, int_enabled); state_save_register_global(machine, state->int_enabled);
state_save_register_global_array(machine, coin_status); state_save_register_global_array(machine, state->coin_status);
state_save_register_global_array(machine, coin_enable); state_save_register_global_array(machine, state->coin_enable);
} }
@ -412,16 +403,19 @@ static MACHINE_RESET( razmataz )
static READ8_HANDLER( razmataz_counter_r ) static READ8_HANDLER( razmataz_counter_r )
{ {
zaxxon_state *state = (zaxxon_state *)space->machine->driver_data;
/* this behavior is really unknown; however, the code is using this */ /* this behavior is really unknown; however, the code is using this */
/* counter as a sort of timeout when talking to the sound board */ /* counter as a sort of timeout when talking to the sound board */
/* it needs to be increasing at a reasonable rate but not too fast */ /* it needs to be increasing at a reasonable rate but not too fast */
/* or else the sound will mess up */ /* or else the sound will mess up */
return razmataz_counter++ >> 8; return state->razmataz_counter++ >> 8;
} }
static CUSTOM_INPUT( razmataz_dial_r ) static CUSTOM_INPUT( razmataz_dial_r )
{ {
zaxxon_state *state = (zaxxon_state *)field->port->machine->driver_data;
static const char *const dialname[2] = { "DIAL0", "DIAL1" }; static const char *const dialname[2] = { "DIAL0", "DIAL1" };
int num = (FPTR)param; int num = (FPTR)param;
int delta, res; int delta, res;
@ -431,14 +425,14 @@ static CUSTOM_INPUT( razmataz_dial_r )
if (delta < 0x80) if (delta < 0x80)
{ {
// right // right
razmataz_dial_pos[num] -= delta; state->razmataz_dial_pos[num] -= delta;
res = (razmataz_dial_pos[num] << 1) | 1; res = (state->razmataz_dial_pos[num] << 1) | 1;
} }
else else
{ {
// left // left
razmataz_dial_pos[num] += delta; state->razmataz_dial_pos[num] += delta;
res = (razmataz_dial_pos[num] << 1); res = (state->razmataz_dial_pos[num] << 1);
} }
return res; return res;
@ -462,22 +456,30 @@ static WRITE8_HANDLER( zaxxon_coin_counter_w )
// the coin input, which then needs to be explicitly cleared by the game. // the coin input, which then needs to be explicitly cleared by the game.
static WRITE8_HANDLER( zaxxon_coin_enable_w ) static WRITE8_HANDLER( zaxxon_coin_enable_w )
{ {
coin_enable[offset] = data & 1; zaxxon_state *state = (zaxxon_state *)space->machine->driver_data;
if (!coin_enable[offset])
coin_status[offset] = 0; state->coin_enable[offset] = data & 1;
if (!state->coin_enable[offset])
state->coin_status[offset] = 0;
} }
static INPUT_CHANGED( zaxxon_coin_inserted ) static INPUT_CHANGED( zaxxon_coin_inserted )
{ {
if (newval) if (newval)
coin_status[(int)(FPTR)param] = coin_enable[(int)(FPTR)param]; {
zaxxon_state *state = (zaxxon_state *)field->port->machine->driver_data;
state->coin_status[(int)(FPTR)param] = state->coin_enable[(int)(FPTR)param];
}
} }
static CUSTOM_INPUT( zaxxon_coin_r ) static CUSTOM_INPUT( zaxxon_coin_r )
{ {
return coin_status[(int)(FPTR)param]; zaxxon_state *state = (zaxxon_state *)field->port->machine->driver_data;
return state->coin_status[(int)(FPTR)param];
} }
@ -492,8 +494,8 @@ static CUSTOM_INPUT( zaxxon_coin_r )
static ADDRESS_MAP_START( zaxxon_map, ADDRESS_SPACE_PROGRAM, 8 ) static ADDRESS_MAP_START( zaxxon_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x5fff) AM_ROM AM_RANGE(0x0000, 0x5fff) AM_ROM
AM_RANGE(0x6000, 0x6fff) AM_RAM AM_RANGE(0x6000, 0x6fff) AM_RAM
AM_RANGE(0x8000, 0x83ff) AM_MIRROR(0x1c00) AM_RAM_WRITE(zaxxon_videoram_w) AM_BASE_GENERIC(videoram) AM_RANGE(0x8000, 0x83ff) AM_MIRROR(0x1c00) AM_RAM_WRITE(zaxxon_videoram_w) AM_BASE_MEMBER(zaxxon_state,videoram)
AM_RANGE(0xa000, 0xa0ff) AM_MIRROR(0x1f00) AM_RAM AM_BASE_SIZE_GENERIC(spriteram) AM_RANGE(0xa000, 0xa0ff) AM_MIRROR(0x1f00) AM_RAM AM_BASE_MEMBER(zaxxon_state,spriteram)
AM_RANGE(0xc000, 0xc000) AM_MIRROR(0x18fc) AM_READ_PORT("SW00") AM_RANGE(0xc000, 0xc000) AM_MIRROR(0x18fc) AM_READ_PORT("SW00")
AM_RANGE(0xc001, 0xc001) AM_MIRROR(0x18fc) AM_READ_PORT("SW01") AM_RANGE(0xc001, 0xc001) AM_MIRROR(0x18fc) AM_READ_PORT("SW01")
AM_RANGE(0xc002, 0xc002) AM_MIRROR(0x18fc) AM_READ_PORT("DSW02") AM_RANGE(0xc002, 0xc002) AM_MIRROR(0x18fc) AM_READ_PORT("DSW02")
@ -515,8 +517,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( congo_map, ADDRESS_SPACE_PROGRAM, 8 ) static ADDRESS_MAP_START( congo_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0x8fff) AM_RAM AM_RANGE(0x8000, 0x8fff) AM_RAM
AM_RANGE(0xa000, 0xa3ff) AM_MIRROR(0x1800) AM_RAM_WRITE(zaxxon_videoram_w) AM_BASE_GENERIC(videoram) AM_RANGE(0xa000, 0xa3ff) AM_MIRROR(0x1800) AM_RAM_WRITE(zaxxon_videoram_w) AM_BASE_MEMBER(zaxxon_state,videoram)
AM_RANGE(0xa400, 0xa7ff) AM_MIRROR(0x1800) AM_RAM_WRITE(congo_colorram_w) AM_BASE_GENERIC(colorram) AM_RANGE(0xa400, 0xa7ff) AM_MIRROR(0x1800) AM_RAM_WRITE(congo_colorram_w) AM_BASE_MEMBER(zaxxon_state,colorram)
AM_RANGE(0xc000, 0xc000) AM_MIRROR(0x1fc4) AM_READ_PORT("SW00") AM_RANGE(0xc000, 0xc000) AM_MIRROR(0x1fc4) AM_READ_PORT("SW00")
AM_RANGE(0xc001, 0xc001) AM_MIRROR(0x1fc4) AM_READ_PORT("SW01") AM_RANGE(0xc001, 0xc001) AM_MIRROR(0x1fc4) AM_READ_PORT("SW01")
AM_RANGE(0xc002, 0xc002) AM_MIRROR(0x1fc4) AM_READ_PORT("DSW02") AM_RANGE(0xc002, 0xc002) AM_MIRROR(0x1fc4) AM_READ_PORT("DSW02")
@ -984,6 +986,8 @@ GFXDECODE_END
static MACHINE_DRIVER_START( root ) static MACHINE_DRIVER_START( root )
MDRV_DRIVER_DATA(zaxxon_state)
/* basic machine hardware */ /* basic machine hardware */
MDRV_CPU_ADD("maincpu", Z80, MASTER_CLOCK/16) MDRV_CPU_ADD("maincpu", Z80, MASTER_CLOCK/16)
MDRV_CPU_PROGRAM_MAP(zaxxon_map) MDRV_CPU_PROGRAM_MAP(zaxxon_map)
@ -1556,6 +1560,8 @@ static DRIVER_INIT( futspy )
static DRIVER_INIT( razmataz ) static DRIVER_INIT( razmataz )
{ {
zaxxon_state *state = (zaxxon_state *)machine->driver_data;
nprinces_decode(machine, "maincpu"); nprinces_decode(machine, "maincpu");
/* additional input ports are wired */ /* additional input ports are wired */
@ -1570,8 +1576,8 @@ static DRIVER_INIT( razmataz )
memory_install_readwrite8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xe03c, 0xe03c, 0, 0x1f00, sega_usb_status_r, sega_usb_data_w); memory_install_readwrite8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xe03c, 0xe03c, 0, 0x1f00, sega_usb_status_r, sega_usb_data_w);
/* additional state saving */ /* additional state saving */
state_save_register_global_array(machine, razmataz_dial_pos); state_save_register_global_array(machine, state->razmataz_dial_pos);
state_save_register_global(machine, razmataz_counter); state_save_register_global(machine, state->razmataz_counter);
} }

22
src/mame/includes/cabal.h Normal file
View File

@ -0,0 +1,22 @@
typedef struct _cabal_state cabal_state;
struct _cabal_state
{
UINT16 *spriteram;
UINT16 *colorram;
UINT16 *videoram;
size_t spriteram_size;
tilemap *background_layer;
tilemap *text_layer;
int sound_command1;
int sound_command2;
int last[4];
};
/*----------- defined in video/cabal.c -----------*/
extern VIDEO_START( cabal );
extern VIDEO_UPDATE( cabal );
WRITE16_HANDLER( cabal_flipscreen_w );
WRITE16_HANDLER( cabal_background_videoram16_w );
WRITE16_HANDLER( cabal_text_videoram16_w );

View File

@ -1,3 +1,16 @@
typedef struct _mappy_state mappy_state;
struct _mappy_state
{
UINT8 *videoram;
UINT8 *spriteram;
tilemap *bg_tilemap;
bitmap_t *sprite_bitmap;
UINT8 scroll;
int mux;
};
/*----------- defined in video/mappy.c -----------*/ /*----------- defined in video/mappy.c -----------*/
extern UINT8 *mappy_videoram; extern UINT8 *mappy_videoram;
@ -18,4 +31,4 @@ WRITE8_HANDLER( mappy_videoram_w );
WRITE8_HANDLER( mappy_scroll_w ); WRITE8_HANDLER( mappy_scroll_w );
READ8_HANDLER( superpac_flipscreen_r ); READ8_HANDLER( superpac_flipscreen_r );
WRITE8_HANDLER( superpac_flipscreen_w ); WRITE8_HANDLER( superpac_flipscreen_w );
void mappy_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int xoffs, int yoffs, int transcolor); void mappy_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, UINT8 *spriteram, int xoffs, int yoffs, int transcolor);

View File

@ -0,0 +1,25 @@
typedef struct _toypop_state toypop_state;
struct _toypop_state
{
UINT8 *videoram;
UINT8 *spriteram;
UINT16 *bg_image;
UINT8 *m68000_sharedram;
tilemap *bg_tilemap;
int bitmapflip;
int palettebank;
int interrupt_enable_68k;
};
/*----------- defined in video/toypop.c -----------*/
WRITE8_HANDLER( toypop_videoram_w );
READ16_HANDLER( toypop_merged_background_r );
WRITE16_HANDLER( toypop_merged_background_w );
WRITE8_HANDLER( toypop_palettebank_w );
WRITE16_HANDLER( toypop_flipscreen_w );
VIDEO_START( toypop );
VIDEO_UPDATE( toypop );
PALETTE_INIT( toypop );

View File

@ -4,6 +4,36 @@
***************************************************************************/ ***************************************************************************/
typedef struct _zaxxon_state zaxxon_state;
struct _zaxxon_state
{
UINT8 *colorram;
UINT8 *videoram;
UINT8 *spriteram;
UINT8 int_enabled;
UINT8 coin_status[3];
UINT8 coin_enable[3];
UINT8 razmataz_dial_pos[2];
UINT16 razmataz_counter;
UINT8 sound_state[3];
UINT8 bg_enable;
UINT8 bg_color;
UINT16 bg_position;
UINT8 fg_color;
UINT8 congo_fg_bank;
UINT8 congo_color_bank;
UINT8 congo_custom[4];
const UINT8 *color_codes;
tilemap *fg_tilemap;
tilemap *bg_tilemap;
};
/*----------- defined in audio/zaxxon.c -----------*/ /*----------- defined in audio/zaxxon.c -----------*/
WRITE8_DEVICE_HANDLER( zaxxon_sound_a_w ); WRITE8_DEVICE_HANDLER( zaxxon_sound_a_w );

View File

@ -7,13 +7,13 @@
***************************************************************************/ ***************************************************************************/
#include "driver.h" #include "driver.h"
#include "includes/cabal.h"
static tilemap *background_layer,*text_layer;
static TILE_GET_INFO( get_back_tile_info ) static TILE_GET_INFO( get_back_tile_info )
{ {
int tile = machine->generic.videoram.u16[tile_index]; cabal_state *state = (cabal_state *)machine->driver_data;
int tile = state->videoram[tile_index];
int color = (tile>>12)&0xf; int color = (tile>>12)&0xf;
tile &= 0xfff; tile &= 0xfff;
@ -27,7 +27,9 @@ static TILE_GET_INFO( get_back_tile_info )
static TILE_GET_INFO( get_text_tile_info ) static TILE_GET_INFO( get_text_tile_info )
{ {
int tile = machine->generic.colorram.u16[tile_index]; cabal_state *state = (cabal_state *)machine->driver_data;
int tile = state->colorram[tile_index];
int color = (tile>>10); int color = (tile>>10);
tile &= 0x3ff; tile &= 0x3ff;
@ -42,11 +44,13 @@ static TILE_GET_INFO( get_text_tile_info )
VIDEO_START( cabal ) VIDEO_START( cabal )
{ {
background_layer = tilemap_create(machine, get_back_tile_info,tilemap_scan_rows,16,16,16,16); cabal_state *state = (cabal_state *)machine->driver_data;
text_layer = tilemap_create(machine, get_text_tile_info,tilemap_scan_rows, 8,8,32,32);
tilemap_set_transparent_pen(text_layer,3); state->background_layer = tilemap_create(machine, get_back_tile_info,tilemap_scan_rows,16,16,16,16);
tilemap_set_transparent_pen(background_layer,15); state->text_layer = tilemap_create(machine, get_text_tile_info,tilemap_scan_rows, 8,8,32,32);
tilemap_set_transparent_pen(state->text_layer,3);
tilemap_set_transparent_pen(state->background_layer,15);
} }
@ -56,9 +60,10 @@ WRITE16_HANDLER( cabal_flipscreen_w )
{ {
if (ACCESSING_BITS_0_7) if (ACCESSING_BITS_0_7)
{ {
cabal_state *state = (cabal_state *)space->machine->driver_data;
int flip = (data & 0x20) ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0; int flip = (data & 0x20) ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0;
tilemap_set_flip(background_layer,flip); tilemap_set_flip(state->background_layer,flip);
tilemap_set_flip(text_layer,flip); tilemap_set_flip(state->text_layer,flip);
flip_screen_set(space->machine, data & 0x20); flip_screen_set(space->machine, data & 0x20);
} }
@ -66,14 +71,16 @@ WRITE16_HANDLER( cabal_flipscreen_w )
WRITE16_HANDLER( cabal_background_videoram16_w ) WRITE16_HANDLER( cabal_background_videoram16_w )
{ {
COMBINE_DATA(&space->machine->generic.videoram.u16[offset]); cabal_state *state = (cabal_state *)space->machine->driver_data;
tilemap_mark_tile_dirty(background_layer,offset); COMBINE_DATA(&state->videoram[offset]);
tilemap_mark_tile_dirty(state->background_layer,offset);
} }
WRITE16_HANDLER( cabal_text_videoram16_w ) WRITE16_HANDLER( cabal_text_videoram16_w )
{ {
COMBINE_DATA(&space->machine->generic.colorram.u16[offset]); cabal_state *state = (cabal_state *)space->machine->driver_data;
tilemap_mark_tile_dirty(text_layer,offset); COMBINE_DATA(&state->colorram[offset]);
tilemap_mark_tile_dirty(state->text_layer,offset);
} }
@ -100,10 +107,11 @@ WRITE16_HANDLER( cabal_text_videoram16_w )
static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect) static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
{ {
UINT16 *spriteram16 = machine->generic.spriteram.u16; cabal_state *state = (cabal_state *)machine->driver_data;
int offs,data0,data1,data2; int offs,data0,data1,data2;
UINT16 *spriteram16 = state->spriteram;
for( offs = machine->generic.spriteram_size/2 - 4; offs >= 0; offs -= 4 ) for( offs = state->spriteram_size/2 - 4; offs >= 0; offs -= 4 )
{ {
data0 = spriteram16[offs]; data0 = spriteram16[offs];
data1 = spriteram16[offs+1]; data1 = spriteram16[offs+1];
@ -140,9 +148,10 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
VIDEO_UPDATE( cabal ) VIDEO_UPDATE( cabal )
{ {
tilemap_draw(bitmap,cliprect,background_layer,TILEMAP_DRAW_OPAQUE,0); cabal_state *state = (cabal_state *)screen->machine->driver_data;
tilemap_draw(bitmap,cliprect,state->background_layer,TILEMAP_DRAW_OPAQUE,0);
draw_sprites(screen->machine,bitmap,cliprect); draw_sprites(screen->machine,bitmap,cliprect);
tilemap_draw(bitmap,cliprect,text_layer,0,0); tilemap_draw(bitmap,cliprect,state->text_layer,0,0);
return 0; return 0;
} }

View File

@ -3,15 +3,6 @@
#include "includes/mappy.h" #include "includes/mappy.h"
UINT8 *mappy_videoram;
UINT8 *mappy_spriteram;
static UINT8 mappy_scroll;
static tilemap *bg_tilemap;
static bitmap_t *sprite_bitmap;
/*************************************************************************** /***************************************************************************
Convert the color PROMs. Convert the color PROMs.
@ -279,36 +270,42 @@ static TILEMAP_MAPPER( mappy_tilemap_scan )
static TILE_GET_INFO( superpac_get_tile_info ) static TILE_GET_INFO( superpac_get_tile_info )
{ {
UINT8 attr = mappy_videoram[tile_index + 0x400]; mappy_state *state = (mappy_state *)machine->driver_data;
UINT8 attr = state->videoram[tile_index + 0x400];
tileinfo->category = (attr & 0x40) >> 6; tileinfo->category = (attr & 0x40) >> 6;
tileinfo->group = attr & 0x3f; tileinfo->group = attr & 0x3f;
SET_TILE_INFO( SET_TILE_INFO(
0, 0,
mappy_videoram[tile_index], state->videoram[tile_index],
attr & 0x3f, attr & 0x3f,
0); 0);
} }
static TILE_GET_INFO( phozon_get_tile_info ) static TILE_GET_INFO( phozon_get_tile_info )
{ {
UINT8 attr = mappy_videoram[tile_index + 0x400]; mappy_state *state = (mappy_state *)machine->driver_data;
UINT8 attr = state->videoram[tile_index + 0x400];
tileinfo->category = (attr & 0x40) >> 6; tileinfo->category = (attr & 0x40) >> 6;
tileinfo->group = attr & 0x3f; tileinfo->group = attr & 0x3f;
SET_TILE_INFO( SET_TILE_INFO(
0, 0,
mappy_videoram[tile_index] + ((attr & 0x80) << 1), state->videoram[tile_index] + ((attr & 0x80) << 1),
attr & 0x3f, attr & 0x3f,
0); 0);
} }
static TILE_GET_INFO( mappy_get_tile_info ) static TILE_GET_INFO( mappy_get_tile_info )
{ {
UINT8 attr = mappy_videoram[tile_index + 0x800]; mappy_state *state = (mappy_state *)machine->driver_data;
UINT8 attr = state->videoram[tile_index + 0x800];
tileinfo->category = (attr & 0x40) >> 6; tileinfo->category = (attr & 0x40) >> 6;
tileinfo->group = attr & 0x3f; tileinfo->group = attr & 0x3f;
SET_TILE_INFO( SET_TILE_INFO(
0, 0,
mappy_videoram[tile_index], state->videoram[tile_index],
attr & 0x3f, attr & 0x3f,
0); 0);
} }
@ -323,27 +320,33 @@ static TILE_GET_INFO( mappy_get_tile_info )
VIDEO_START( superpac ) VIDEO_START( superpac )
{ {
bg_tilemap = tilemap_create(machine, superpac_get_tile_info,superpac_tilemap_scan,8,8,36,28); mappy_state *state = (mappy_state *)machine->driver_data;
sprite_bitmap = video_screen_auto_bitmap_alloc(machine->primary_screen);
colortable_configure_tilemap_groups(machine->colortable, bg_tilemap, machine->gfx[0], 31); state->bg_tilemap = tilemap_create(machine, superpac_get_tile_info,superpac_tilemap_scan,8,8,36,28);
state->sprite_bitmap = video_screen_auto_bitmap_alloc(machine->primary_screen);
colortable_configure_tilemap_groups(machine->colortable, state->bg_tilemap, machine->gfx[0], 31);
} }
VIDEO_START( phozon ) VIDEO_START( phozon )
{ {
bg_tilemap = tilemap_create(machine, phozon_get_tile_info,superpac_tilemap_scan,8,8,36,28); mappy_state *state = (mappy_state *)machine->driver_data;
colortable_configure_tilemap_groups(machine->colortable, bg_tilemap, machine->gfx[0], 15); state->bg_tilemap = tilemap_create(machine, phozon_get_tile_info,superpac_tilemap_scan,8,8,36,28);
state_save_register_global(machine, mappy_scroll); colortable_configure_tilemap_groups(machine->colortable, state->bg_tilemap, machine->gfx[0], 15);
state_save_register_global(machine, state->scroll);
} }
VIDEO_START( mappy ) VIDEO_START( mappy )
{ {
bg_tilemap = tilemap_create(machine, mappy_get_tile_info,mappy_tilemap_scan,8,8,36,60); mappy_state *state = (mappy_state *)machine->driver_data;
colortable_configure_tilemap_groups(machine->colortable, bg_tilemap, machine->gfx[0], 31); state->bg_tilemap = tilemap_create(machine, mappy_get_tile_info,mappy_tilemap_scan,8,8,36,60);
tilemap_set_scroll_cols(bg_tilemap, 36);
colortable_configure_tilemap_groups(machine->colortable, state->bg_tilemap, machine->gfx[0], 31);
tilemap_set_scroll_cols(state->bg_tilemap, 36);
} }
@ -356,14 +359,18 @@ VIDEO_START( mappy )
WRITE8_HANDLER( superpac_videoram_w ) WRITE8_HANDLER( superpac_videoram_w )
{ {
mappy_videoram[offset] = data; mappy_state *state = (mappy_state *)space->machine->driver_data;
tilemap_mark_tile_dirty(bg_tilemap,offset & 0x3ff);
state->videoram[offset] = data;
tilemap_mark_tile_dirty(state->bg_tilemap,offset & 0x3ff);
} }
WRITE8_HANDLER( mappy_videoram_w ) WRITE8_HANDLER( mappy_videoram_w )
{ {
mappy_videoram[offset] = data; mappy_state *state = (mappy_state *)space->machine->driver_data;
tilemap_mark_tile_dirty(bg_tilemap,offset & 0x7ff);
state->videoram[offset] = data;
tilemap_mark_tile_dirty(state->bg_tilemap,offset & 0x7ff);
} }
WRITE8_HANDLER( superpac_flipscreen_w ) WRITE8_HANDLER( superpac_flipscreen_w )
@ -379,7 +386,9 @@ READ8_HANDLER( superpac_flipscreen_r )
WRITE8_HANDLER( mappy_scroll_w ) WRITE8_HANDLER( mappy_scroll_w )
{ {
mappy_scroll = offset >> 3; mappy_state *state = (mappy_state *)space->machine->driver_data;
state->scroll = offset >> 3;
} }
@ -391,9 +400,9 @@ WRITE8_HANDLER( mappy_scroll_w )
***************************************************************************/ ***************************************************************************/
/* also used by toypop.c */ /* also used by toypop.c */
void mappy_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int xoffs, int yoffs, int transcolor) void mappy_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, UINT8 *spriteram_base, int xoffs, int yoffs, int transcolor)
{ {
UINT8 *spriteram = mappy_spriteram + 0x780; UINT8 *spriteram = spriteram_base + 0x780;
UINT8 *spriteram_2 = spriteram + 0x800; UINT8 *spriteram_2 = spriteram + 0x800;
UINT8 *spriteram_3 = spriteram_2 + 0x800; UINT8 *spriteram_3 = spriteram_2 + 0x800;
int offs; int offs;
@ -469,9 +478,9 @@ spriteram_3
1 -------x X position MSB 1 -------x X position MSB
*/ */
static void phozon_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect ) static void phozon_draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, UINT8 *spriteram_base )
{ {
UINT8 *spriteram = mappy_spriteram + 0x780; UINT8 *spriteram = spriteram_base + 0x780;
UINT8 *spriteram_2 = spriteram + 0x800; UINT8 *spriteram_2 = spriteram + 0x800;
UINT8 *spriteram_3 = spriteram_2 + 0x800; UINT8 *spriteram_3 = spriteram_2 + 0x800;
int offs; int offs;
@ -528,19 +537,21 @@ static void phozon_draw_sprites(running_machine *machine, bitmap_t *bitmap, cons
VIDEO_UPDATE( superpac ) VIDEO_UPDATE( superpac )
{ {
mappy_state *state = (mappy_state *)screen->machine->driver_data;
bitmap_t *sprite_bitmap = state->sprite_bitmap;
int x,y; int x,y;
tilemap_set_scrolldx(bg_tilemap, 0, 96); tilemap_set_scrolldx(state->bg_tilemap, 0, 96);
tilemap_set_scrolldy(bg_tilemap, 0, 0); tilemap_set_scrolldy(state->bg_tilemap, 0, 0);
tilemap_draw(bitmap,cliprect,bg_tilemap,TILEMAP_DRAW_OPAQUE | TILEMAP_DRAW_ALL_CATEGORIES,0); tilemap_draw(bitmap,cliprect,state->bg_tilemap,TILEMAP_DRAW_OPAQUE | TILEMAP_DRAW_ALL_CATEGORIES,0);
bitmap_fill(sprite_bitmap,cliprect,15); bitmap_fill(sprite_bitmap,cliprect,15);
mappy_draw_sprites(screen->machine,sprite_bitmap,cliprect,0,0,15); mappy_draw_sprites(screen->machine,sprite_bitmap,cliprect,state->spriteram,0,0,15);
copybitmap_trans(bitmap,sprite_bitmap,0,0,0,0,cliprect,15); copybitmap_trans(bitmap,sprite_bitmap,0,0,0,0,cliprect,15);
/* Redraw the high priority characters */ /* Redraw the high priority characters */
tilemap_draw(bitmap,cliprect,bg_tilemap,1,0); tilemap_draw(bitmap,cliprect,state->bg_tilemap,1,0);
/* sprite color 0 still has priority over that (ghost eyes in Pac 'n Pal) */ /* sprite color 0 still has priority over that (ghost eyes in Pac 'n Pal) */
for (y = 0;y < sprite_bitmap->height;y++) for (y = 0;y < sprite_bitmap->height;y++)
@ -556,36 +567,39 @@ VIDEO_UPDATE( superpac )
VIDEO_UPDATE( phozon ) VIDEO_UPDATE( phozon )
{ {
mappy_state *state = (mappy_state *)screen->machine->driver_data;
/* flip screen control is embedded in RAM */ /* flip screen control is embedded in RAM */
flip_screen_set(screen->machine, mappy_spriteram[0x1f7f-0x800] & 1); flip_screen_set(screen->machine, state->spriteram[0x1f7f-0x800] & 1);
tilemap_set_scrolldx(bg_tilemap, 0, 96); tilemap_set_scrolldx(state->bg_tilemap, 0, 96);
tilemap_set_scrolldy(bg_tilemap, 0, 0); tilemap_set_scrolldy(state->bg_tilemap, 0, 0);
tilemap_draw(bitmap,cliprect,bg_tilemap,TILEMAP_DRAW_OPAQUE | TILEMAP_DRAW_ALL_CATEGORIES,0); tilemap_draw(bitmap,cliprect,state->bg_tilemap,TILEMAP_DRAW_OPAQUE | TILEMAP_DRAW_ALL_CATEGORIES,0);
phozon_draw_sprites(screen->machine,bitmap,cliprect); phozon_draw_sprites(screen->machine,bitmap,cliprect,state->spriteram);
/* Redraw the high priority characters */ /* Redraw the high priority characters */
tilemap_draw(bitmap,cliprect,bg_tilemap,1,0); tilemap_draw(bitmap,cliprect,state->bg_tilemap,1,0);
return 0; return 0;
} }
VIDEO_UPDATE( mappy ) VIDEO_UPDATE( mappy )
{ {
mappy_state *state = (mappy_state *)screen->machine->driver_data;
int offs; int offs;
tilemap_set_scrolldx(bg_tilemap, 0, 96); tilemap_set_scrolldx(state->bg_tilemap, 0, 96);
tilemap_set_scrolldy(bg_tilemap, 0, 0); tilemap_set_scrolldy(state->bg_tilemap, 0, 0);
for (offs = 2;offs < 34;offs++) for (offs = 2;offs < 34;offs++)
tilemap_set_scrolly(bg_tilemap,offs,mappy_scroll); tilemap_set_scrolly(state->bg_tilemap,offs,state->scroll);
tilemap_draw(bitmap,cliprect,bg_tilemap,TILEMAP_DRAW_OPAQUE | TILEMAP_DRAW_ALL_CATEGORIES,0); tilemap_draw(bitmap,cliprect,state->bg_tilemap,TILEMAP_DRAW_OPAQUE | TILEMAP_DRAW_ALL_CATEGORIES,0);
mappy_draw_sprites(screen->machine,bitmap,cliprect,0,0,15); mappy_draw_sprites(screen->machine,bitmap,cliprect,state->spriteram,0,0,15);
/* Redraw the high priority characters */ /* Redraw the high priority characters */
tilemap_draw(bitmap,cliprect,bg_tilemap,1,0); tilemap_draw(bitmap,cliprect,state->bg_tilemap,1,0);
return 0; return 0;
} }

View File

@ -8,13 +8,7 @@
#include "driver.h" #include "driver.h"
#include "includes/mappy.h" #include "includes/mappy.h"
#include "includes/toypop.h"
UINT8 *toypop_videoram;
static tilemap *bg_tilemap;
UINT16 *toypop_bg_image;
static int bitmapflip,palettebank;
/*************************************************************************** /***************************************************************************
@ -102,11 +96,12 @@ static TILEMAP_MAPPER( tilemap_scan )
static TILE_GET_INFO( get_tile_info ) static TILE_GET_INFO( get_tile_info )
{ {
UINT8 attr = toypop_videoram[tile_index + 0x400]; toypop_state *state = (toypop_state *)machine->driver_data;
UINT8 attr = state->videoram[tile_index + 0x400];
SET_TILE_INFO( SET_TILE_INFO(
0, 0,
toypop_videoram[tile_index], state->videoram[tile_index],
(attr & 0x3f) + 0x40 * palettebank, (attr & 0x3f) + 0x40 * state->palettebank,
0); 0);
} }
@ -120,9 +115,10 @@ static TILE_GET_INFO( get_tile_info )
VIDEO_START( toypop ) VIDEO_START( toypop )
{ {
bg_tilemap = tilemap_create(machine, get_tile_info,tilemap_scan,8,8,36,28); toypop_state *state = (toypop_state *)machine->driver_data;
state->bg_tilemap = tilemap_create(machine,get_tile_info,tilemap_scan,8,8,36,28);
tilemap_set_transparent_pen(bg_tilemap, 0); tilemap_set_transparent_pen(state->bg_tilemap, 0);
} }
@ -135,51 +131,58 @@ VIDEO_START( toypop )
WRITE8_HANDLER( toypop_videoram_w ) WRITE8_HANDLER( toypop_videoram_w )
{ {
toypop_videoram[offset] = data; toypop_state *state = (toypop_state *)space->machine->driver_data;
tilemap_mark_tile_dirty(bg_tilemap,offset & 0x3ff); state->videoram[offset] = data;
tilemap_mark_tile_dirty(state->bg_tilemap,offset & 0x3ff);
} }
WRITE8_HANDLER( toypop_palettebank_w ) WRITE8_HANDLER( toypop_palettebank_w )
{ {
if (palettebank != (offset & 1)) toypop_state *state = (toypop_state *)space->machine->driver_data;
if (state->palettebank != (offset & 1))
{ {
palettebank = offset & 1; state->palettebank = offset & 1;
tilemap_mark_all_tiles_dirty_all(space->machine); tilemap_mark_all_tiles_dirty_all(space->machine);
} }
} }
WRITE16_HANDLER( toypop_flipscreen_w ) WRITE16_HANDLER( toypop_flipscreen_w )
{ {
bitmapflip = offset & 1; toypop_state *state = (toypop_state *)space->machine->driver_data;
state->bitmapflip = offset & 1;
} }
READ16_HANDLER( toypop_merged_background_r ) READ16_HANDLER( toypop_merged_background_r )
{ {
toypop_state *state = (toypop_state *)space->machine->driver_data;
int data1, data2; int data1, data2;
// 0x0a0b0c0d is read as 0xabcd // 0x0a0b0c0d is read as 0xabcd
data1 = toypop_bg_image[2*offset]; data1 = state->bg_image[2*offset];
data2 = toypop_bg_image[2*offset + 1]; data2 = state->bg_image[2*offset + 1];
return ((data1 & 0xf00) << 4) | ((data1 & 0xf) << 8) | ((data2 & 0xf00) >> 4) | (data2 & 0xf); return ((data1 & 0xf00) << 4) | ((data1 & 0xf) << 8) | ((data2 & 0xf00) >> 4) | (data2 & 0xf);
} }
WRITE16_HANDLER( toypop_merged_background_w ) WRITE16_HANDLER( toypop_merged_background_w )
{ {
toypop_state *state = (toypop_state *)space->machine->driver_data;
// 0xabcd is written as 0x0a0b0c0d in the background image // 0xabcd is written as 0x0a0b0c0d in the background image
if (ACCESSING_BITS_8_15) if (ACCESSING_BITS_8_15)
toypop_bg_image[2*offset] = ((data & 0xf00) >> 8) | ((data & 0xf000) >> 4); state->bg_image[2*offset] = ((data & 0xf00) >> 8) | ((data & 0xf000) >> 4);
if (ACCESSING_BITS_0_7) if (ACCESSING_BITS_0_7)
toypop_bg_image[2*offset+1] = (data & 0xf) | ((data & 0xf0) << 4); state->bg_image[2*offset+1] = (data & 0xf) | ((data & 0xf0) << 4);
} }
static void draw_background(bitmap_t *bitmap) static void draw_background(running_machine *machine, bitmap_t *bitmap)
{ {
toypop_state *state = (toypop_state *)machine->driver_data;
int offs, x, y; int offs, x, y;
pen_t pen_base = 0x300 + 0x10*palettebank; pen_t pen_base = 0x300 + 0x10*state->palettebank;
// copy the background image from RAM (0x190200-0x19FDFF) to bitmap // copy the background image from RAM (0x190200-0x19FDFF) to bitmap
if (bitmapflip) if (state->bitmapflip)
{ {
offs = 0xFDFE/2; offs = 0xFDFE/2;
for (y = 0; y < 224; y++) for (y = 0; y < 224; y++)
@ -187,7 +190,7 @@ static void draw_background(bitmap_t *bitmap)
UINT16 *scanline = BITMAP_ADDR16(bitmap, y, 0); UINT16 *scanline = BITMAP_ADDR16(bitmap, y, 0);
for (x = 0; x < 288; x+=2) for (x = 0; x < 288; x+=2)
{ {
UINT16 data = toypop_bg_image[offs]; UINT16 data = state->bg_image[offs];
scanline[x] = pen_base | (data & 0x0f); scanline[x] = pen_base | (data & 0x0f);
scanline[x+1] = pen_base | (data >> 8); scanline[x+1] = pen_base | (data >> 8);
offs--; offs--;
@ -202,7 +205,7 @@ static void draw_background(bitmap_t *bitmap)
UINT16 *scanline = BITMAP_ADDR16(bitmap, y, 0); UINT16 *scanline = BITMAP_ADDR16(bitmap, y, 0);
for (x = 0; x < 288; x+=2) for (x = 0; x < 288; x+=2)
{ {
UINT16 data = toypop_bg_image[offs]; UINT16 data = state->bg_image[offs];
scanline[x] = pen_base | (data >> 8); scanline[x] = pen_base | (data >> 8);
scanline[x+1] = pen_base | (data & 0x0f); scanline[x+1] = pen_base | (data & 0x0f);
offs++; offs++;
@ -222,8 +225,9 @@ static void draw_background(bitmap_t *bitmap)
VIDEO_UPDATE( toypop ) VIDEO_UPDATE( toypop )
{ {
draw_background(bitmap); toypop_state *state = (toypop_state *)screen->machine->driver_data;
tilemap_draw(bitmap,cliprect,bg_tilemap,0,0); draw_background(screen->machine, bitmap);
mappy_draw_sprites(screen->machine, bitmap, cliprect, -31, -8, 0xff); tilemap_draw(bitmap,cliprect,state->bg_tilemap,0,0);
mappy_draw_sprites(screen->machine, bitmap, cliprect, state->spriteram, -31, -8, 0xff);
return 0; return 0;
} }

View File

@ -5,23 +5,8 @@
***************************************************************************/ ***************************************************************************/
#include "driver.h" #include "driver.h"
#include "zaxxon.h"
#include "video/resnet.h" #include "video/resnet.h"
#include "includes/zaxxon.h"
static const UINT8 *color_codes;
static UINT8 bg_enable;
static UINT8 bg_color;
static UINT16 bg_position;
static UINT8 fg_color;
static UINT8 congo_fg_bank;
static UINT8 congo_color_bank;
static UINT8 congo_custom[4];
static tilemap *fg_tilemap;
static tilemap *bg_tilemap;
/************************************* /*************************************
@ -32,6 +17,7 @@ static tilemap *bg_tilemap;
PALETTE_INIT( zaxxon ) PALETTE_INIT( zaxxon )
{ {
zaxxon_state *state = (zaxxon_state *)machine->driver_data;
static const int resistances[3] = { 1000, 470, 220 }; static const int resistances[3] = { 1000, 470, 220 };
double rweights[3], gweights[3], bweights[2]; double rweights[3], gweights[3], bweights[2];
int i; int i;
@ -69,7 +55,7 @@ PALETTE_INIT( zaxxon )
} }
/* color_prom now points to the beginning of the character color codes */ /* color_prom now points to the beginning of the character color codes */
color_codes = &color_prom[256]; state->color_codes = &color_prom[256];
} }
@ -87,32 +73,39 @@ static TILE_GET_INFO( get_bg_tile_info )
int eff_index = tile_index & (size - 1); int eff_index = tile_index & (size - 1);
int code = source[eff_index] + 256 * (source[eff_index + size] & 3); int code = source[eff_index] + 256 * (source[eff_index + size] & 3);
int color = source[eff_index + size] >> 4; int color = source[eff_index + size] >> 4;
SET_TILE_INFO(1, code, color, 0); SET_TILE_INFO(1, code, color, 0);
} }
static TILE_GET_INFO( zaxxon_get_fg_tile_info ) static TILE_GET_INFO( zaxxon_get_fg_tile_info )
{ {
zaxxon_state *state = (zaxxon_state *)machine->driver_data;
int sx = tile_index % 32; int sx = tile_index % 32;
int sy = tile_index / 32; int sy = tile_index / 32;
int code = machine->generic.videoram.u8[tile_index]; int code = state->videoram[tile_index];
int color = color_codes[sx + 32 * (sy / 4)] & 0x0f; int color = state->color_codes[sx + 32 * (sy / 4)] & 0x0f;
SET_TILE_INFO(0, code, color * 2, 0); SET_TILE_INFO(0, code, color * 2, 0);
} }
static TILE_GET_INFO( razmataz_get_fg_tile_info ) static TILE_GET_INFO( razmataz_get_fg_tile_info )
{ {
int code = machine->generic.videoram.u8[tile_index]; zaxxon_state *state = (zaxxon_state *)machine->driver_data;
int color = color_codes[code] & 0x0f; int code = state->videoram[tile_index];
int color = state->color_codes[code] & 0x0f;
SET_TILE_INFO(0, code, color * 2, 0); SET_TILE_INFO(0, code, color * 2, 0);
} }
static TILE_GET_INFO( congo_get_fg_tile_info ) static TILE_GET_INFO( congo_get_fg_tile_info )
{ {
int code = machine->generic.videoram.u8[tile_index] + (congo_fg_bank << 8); zaxxon_state *state = (zaxxon_state *)machine->driver_data;
int color = machine->generic.colorram.u8[tile_index] & 0x1f; int code = state->videoram[tile_index] + (state->congo_fg_bank << 8);
int color = state->colorram[tile_index] & 0x1f;
SET_TILE_INFO(0, code, color * 2, 0); SET_TILE_INFO(0, code, color * 2, 0);
} }
@ -126,29 +119,31 @@ static TILE_GET_INFO( congo_get_fg_tile_info )
static void video_start_common(running_machine *machine, tile_get_info_func fg_tile_info) static void video_start_common(running_machine *machine, tile_get_info_func fg_tile_info)
{ {
zaxxon_state *state = (zaxxon_state *)machine->driver_data;
/* reset globals */ /* reset globals */
bg_enable = 0; state->bg_enable = 0;
bg_color = 0; state->bg_color = 0;
bg_position = 0; state->bg_position = 0;
fg_color = 0; state->fg_color = 0;
congo_fg_bank = 0; state->congo_fg_bank = 0;
congo_color_bank = 0; state->congo_color_bank = 0;
memset(congo_custom, 0, sizeof(congo_custom)); memset(state->congo_custom, 0, sizeof(state->congo_custom));
/* create a background and foreground tilemap */ /* create a background and foreground tilemap */
bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8,8, 32,512); state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 8,8, 32,512);
fg_tilemap = tilemap_create(machine, fg_tile_info, tilemap_scan_rows, 8,8, 32,32); state->fg_tilemap = tilemap_create(machine, fg_tile_info, tilemap_scan_rows, 8,8, 32,32);
/* configure the foreground tilemap */ /* configure the foreground tilemap */
tilemap_set_transparent_pen(fg_tilemap, 0); tilemap_set_transparent_pen(state->fg_tilemap, 0);
tilemap_set_scrolldx(fg_tilemap, 0, video_screen_get_width(machine->primary_screen) - 256); tilemap_set_scrolldx(state->fg_tilemap, 0, video_screen_get_width(machine->primary_screen) - 256);
tilemap_set_scrolldy(fg_tilemap, 0, video_screen_get_height(machine->primary_screen) - 256); tilemap_set_scrolldy(state->fg_tilemap, 0, video_screen_get_height(machine->primary_screen) - 256);
/* register for save states */ /* register for save states */
state_save_register_global(machine, bg_enable); state_save_register_global(machine, state->bg_enable);
state_save_register_global(machine, bg_color); state_save_register_global(machine, state->bg_color);
state_save_register_global(machine, bg_position); state_save_register_global(machine, state->bg_position);
state_save_register_global(machine, fg_color); state_save_register_global(machine, state->fg_color);
} }
@ -166,14 +161,16 @@ VIDEO_START( razmataz )
VIDEO_START( congo ) VIDEO_START( congo )
{ {
zaxxon_state *state = (zaxxon_state *)machine->driver_data;
/* allocate our own spriteram since it is not accessible by the main CPU */ /* allocate our own spriteram since it is not accessible by the main CPU */
machine->generic.spriteram.u8 = auto_alloc_array(machine, UINT8, 0x100); state->spriteram = auto_alloc_array(machine, UINT8, 0x100);
/* register for save states */ /* register for save states */
state_save_register_global(machine, congo_fg_bank); state_save_register_global(machine, state->congo_fg_bank);
state_save_register_global(machine, congo_color_bank); state_save_register_global(machine, state->congo_color_bank);
state_save_register_global_array(machine, congo_custom); state_save_register_global_array(machine, state->congo_custom);
state_save_register_global_pointer(machine, machine->generic.spriteram.u8, 0x100); state_save_register_global_pointer(machine, state->spriteram, 0x100);
video_start_common(machine, congo_get_fg_tile_info); video_start_common(machine, congo_get_fg_tile_info);
} }
@ -188,57 +185,71 @@ VIDEO_START( congo )
WRITE8_HANDLER( zaxxon_flipscreen_w ) WRITE8_HANDLER( zaxxon_flipscreen_w )
{ {
zaxxon_state *state = (zaxxon_state *)space->machine->driver_data;
/* low bit controls flip; background and sprite flip are handled at render time */ /* low bit controls flip; background and sprite flip are handled at render time */
flip_screen_set_no_update(space->machine, ~data & 1); flip_screen_set_no_update(space->machine, ~data & 1);
tilemap_set_flip(fg_tilemap, flip_screen_get(space->machine) ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0); tilemap_set_flip(state->fg_tilemap, flip_screen_get(space->machine) ? (TILEMAP_FLIPX | TILEMAP_FLIPY) : 0);
} }
WRITE8_HANDLER( zaxxon_fg_color_w ) WRITE8_HANDLER( zaxxon_fg_color_w )
{ {
zaxxon_state *state = (zaxxon_state *)space->machine->driver_data;
/* low bit selects high color palette index */ /* low bit selects high color palette index */
fg_color = (data & 1) * 0x80; state->fg_color = (data & 1) * 0x80;
tilemap_set_palette_offset(fg_tilemap, fg_color + (congo_color_bank << 8)); tilemap_set_palette_offset(state->fg_tilemap, state->fg_color + (state->congo_color_bank << 8));
} }
WRITE8_HANDLER( zaxxon_bg_position_w ) WRITE8_HANDLER( zaxxon_bg_position_w )
{ {
zaxxon_state *state = (zaxxon_state *)space->machine->driver_data;
/* 11 bits of scroll position are stored */ /* 11 bits of scroll position are stored */
if (offset == 0) if (offset == 0)
bg_position = (bg_position & 0x700) | ((data << 0) & 0x0ff); state->bg_position = (state->bg_position & 0x700) | ((data << 0) & 0x0ff);
else else
bg_position = (bg_position & 0x0ff) | ((data << 8) & 0x700); state->bg_position = (state->bg_position & 0x0ff) | ((data << 8) & 0x700);
} }
WRITE8_HANDLER( zaxxon_bg_color_w ) WRITE8_HANDLER( zaxxon_bg_color_w )
{ {
zaxxon_state *state = (zaxxon_state *)space->machine->driver_data;
/* low bit selects high color palette index */ /* low bit selects high color palette index */
bg_color = (data & 1) * 0x80; state->bg_color = (data & 1) * 0x80;
} }
WRITE8_HANDLER( zaxxon_bg_enable_w ) WRITE8_HANDLER( zaxxon_bg_enable_w )
{ {
zaxxon_state *state = (zaxxon_state *)space->machine->driver_data;
/* low bit enables/disables the background layer */ /* low bit enables/disables the background layer */
bg_enable = data & 1; state->bg_enable = data & 1;
} }
WRITE8_HANDLER( congo_fg_bank_w ) WRITE8_HANDLER( congo_fg_bank_w )
{ {
zaxxon_state *state = (zaxxon_state *)space->machine->driver_data;
/* low bit controls the topmost character bit */ /* low bit controls the topmost character bit */
congo_fg_bank = data & 1; state->congo_fg_bank = data & 1;
tilemap_mark_all_tiles_dirty(fg_tilemap); tilemap_mark_all_tiles_dirty(state->fg_tilemap);
} }
WRITE8_HANDLER( congo_color_bank_w ) WRITE8_HANDLER( congo_color_bank_w )
{ {
zaxxon_state *state = (zaxxon_state *)space->machine->driver_data;
/* low bit controls the topmost bit into the color PROM */ /* low bit controls the topmost bit into the color PROM */
congo_color_bank = data & 1; state->congo_color_bank = data & 1;
tilemap_set_palette_offset(fg_tilemap, fg_color + (congo_color_bank << 8)); tilemap_set_palette_offset(state->fg_tilemap, state->fg_color + (state->congo_color_bank << 8));
} }
@ -251,15 +262,19 @@ WRITE8_HANDLER( congo_color_bank_w )
WRITE8_HANDLER( zaxxon_videoram_w ) WRITE8_HANDLER( zaxxon_videoram_w )
{ {
space->machine->generic.videoram.u8[offset] = data; zaxxon_state *state = (zaxxon_state *)space->machine->driver_data;
tilemap_mark_tile_dirty(fg_tilemap, offset);
state->videoram[offset] = data;
tilemap_mark_tile_dirty(state->fg_tilemap, offset);
} }
WRITE8_HANDLER( congo_colorram_w ) WRITE8_HANDLER( congo_colorram_w )
{ {
space->machine->generic.colorram.u8[offset] = data; zaxxon_state *state = (zaxxon_state *)space->machine->driver_data;
tilemap_mark_tile_dirty(fg_tilemap, offset);
state->colorram[offset] = data;
tilemap_mark_tile_dirty(state->fg_tilemap, offset);
} }
@ -272,14 +287,16 @@ WRITE8_HANDLER( congo_colorram_w )
WRITE8_HANDLER( congo_sprite_custom_w ) WRITE8_HANDLER( congo_sprite_custom_w )
{ {
congo_custom[offset] = data; zaxxon_state *state = (zaxxon_state *)space->machine->driver_data;
UINT8 *spriteram = state->spriteram;
state->congo_custom[offset] = data;
/* seems to trigger on a write of 1 to the 4th byte */ /* seems to trigger on a write of 1 to the 4th byte */
if (offset == 3 && data == 0x01) if (offset == 3 && data == 0x01)
{ {
UINT8 *spriteram = space->machine->generic.spriteram.u8; UINT16 saddr = state->congo_custom[0] | (state->congo_custom[1] << 8);
UINT16 saddr = congo_custom[0] | (congo_custom[1] << 8); int count = state->congo_custom[2];
int count = congo_custom[2];
/* count cycles (just a guess) */ /* count cycles (just a guess) */
cpu_adjust_icount(space->cpu, -count * 5); cpu_adjust_icount(space->cpu, -count * 5);
@ -307,11 +324,13 @@ WRITE8_HANDLER( congo_sprite_custom_w )
static void draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int skew) static void draw_background(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int skew)
{ {
zaxxon_state *state = (zaxxon_state *)machine->driver_data;
/* only draw if enabled */ /* only draw if enabled */
if (bg_enable) if (state->bg_enable)
{ {
bitmap_t *pixmap = tilemap_get_pixmap(bg_tilemap); bitmap_t *pixmap = tilemap_get_pixmap(state->bg_tilemap);
int colorbase = bg_color + (congo_color_bank << 8); int colorbase = state->bg_color + (state->congo_color_bank << 8);
int xmask = pixmap->width - 1; int xmask = pixmap->width - 1;
int ymask = pixmap->height - 1; int ymask = pixmap->height - 1;
int flipmask = flip_screen_get(machine) ? 0xff : 0x00; int flipmask = flip_screen_get(machine) ? 0xff : 0x00;
@ -337,7 +356,7 @@ static void draw_background(running_machine *machine, bitmap_t *bitmap, const re
/* base of the source row comes from VF plus the scroll value */ /* base of the source row comes from VF plus the scroll value */
/* this is done by the 3 4-bit adders at U56, U74, U75 */ /* this is done by the 3 4-bit adders at U56, U74, U75 */
srcy = vf + ((bg_position << 1) ^ 0xfff) + 1; srcy = vf + ((state->bg_position << 1) ^ 0xfff) + 1;
src = (UINT16 *)pixmap->base + (srcy & ymask) * pixmap->rowpixels; src = (UINT16 *)pixmap->base + (srcy & ymask) * pixmap->rowpixels;
/* loop over visible colums */ /* loop over visible colums */
@ -423,7 +442,9 @@ INLINE int find_minimum_x(UINT8 value, int flip)
static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, UINT16 flipxmask, UINT16 flipymask) static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, UINT16 flipxmask, UINT16 flipymask)
{ {
UINT8 *spriteram = machine->generic.spriteram.u8; zaxxon_state *state = (zaxxon_state *)machine->driver_data;
UINT8 *spriteram = state->spriteram;
const gfx_element *gfx = machine->gfx[2];
int flip = flip_screen_get(machine); int flip = flip_screen_get(machine);
int flipmask = flip ? 0xff : 0x00; int flipmask = flip ? 0xff : 0x00;
int offs; int offs;
@ -435,14 +456,14 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
int flipy = (spriteram[offs + (flipymask >> 8)] ^ flipmask) & flipymask; int flipy = (spriteram[offs + (flipymask >> 8)] ^ flipmask) & flipymask;
int flipx = (spriteram[offs + (flipxmask >> 8)] ^ flipmask) & flipxmask; int flipx = (spriteram[offs + (flipxmask >> 8)] ^ flipmask) & flipxmask;
int code = spriteram[offs + 1]; int code = spriteram[offs + 1];
int color = (spriteram[offs + 2] & 0x1f) + (congo_color_bank << 5); int color = (spriteram[offs + 2] & 0x1f) + (state->congo_color_bank << 5);
int sx = find_minimum_x(spriteram[offs + 3], flip); int sx = find_minimum_x(spriteram[offs + 3], flip);
/* draw with 256 pixel offsets to ensure we wrap properly */ /* draw with 256 pixel offsets to ensure we wrap properly */
drawgfx_transpen(bitmap, cliprect, machine->gfx[2], code, color, flipx, flipy, sx, sy, 0); drawgfx_transpen(bitmap, cliprect, gfx, code, color, flipx, flipy, sx, sy, 0);
drawgfx_transpen(bitmap, cliprect, machine->gfx[2], code, color, flipx, flipy, sx, sy - 0x100, 0); drawgfx_transpen(bitmap, cliprect, gfx, code, color, flipx, flipy, sx, sy - 0x100, 0);
drawgfx_transpen(bitmap, cliprect, machine->gfx[2], code, color, flipx, flipy, sx - 0x100, sy, 0); drawgfx_transpen(bitmap, cliprect, gfx, code, color, flipx, flipy, sx - 0x100, sy, 0);
drawgfx_transpen(bitmap, cliprect, machine->gfx[2], code, color, flipx, flipy, sx - 0x100, sy - 0x100, 0); drawgfx_transpen(bitmap, cliprect, gfx, code, color, flipx, flipy, sx - 0x100, sy - 0x100, 0);
} }
} }
@ -456,35 +477,43 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
VIDEO_UPDATE( zaxxon ) VIDEO_UPDATE( zaxxon )
{ {
zaxxon_state *state = (zaxxon_state *)screen->machine->driver_data;
draw_background(screen->machine, bitmap, cliprect, TRUE); draw_background(screen->machine, bitmap, cliprect, TRUE);
draw_sprites(screen->machine, bitmap, cliprect, 0x140, 0x180); draw_sprites(screen->machine, bitmap, cliprect, 0x140, 0x180);
tilemap_draw(bitmap, cliprect, fg_tilemap, 0, 0); tilemap_draw(bitmap, cliprect, state->fg_tilemap, 0, 0);
return 0; return 0;
} }
VIDEO_UPDATE( futspy ) VIDEO_UPDATE( futspy )
{ {
zaxxon_state *state = (zaxxon_state *)screen->machine->driver_data;
draw_background(screen->machine, bitmap, cliprect, TRUE); draw_background(screen->machine, bitmap, cliprect, TRUE);
draw_sprites(screen->machine, bitmap, cliprect, 0x180, 0x180); draw_sprites(screen->machine, bitmap, cliprect, 0x180, 0x180);
tilemap_draw(bitmap, cliprect, fg_tilemap, 0, 0); tilemap_draw(bitmap, cliprect, state->fg_tilemap, 0, 0);
return 0; return 0;
} }
VIDEO_UPDATE( razmataz ) VIDEO_UPDATE( razmataz )
{ {
zaxxon_state *state = (zaxxon_state *)screen->machine->driver_data;
draw_background(screen->machine, bitmap, cliprect, FALSE); draw_background(screen->machine, bitmap, cliprect, FALSE);
draw_sprites(screen->machine, bitmap, cliprect, 0x140, 0x180); draw_sprites(screen->machine, bitmap, cliprect, 0x140, 0x180);
tilemap_draw(bitmap, cliprect, fg_tilemap, 0, 0); tilemap_draw(bitmap, cliprect, state->fg_tilemap, 0, 0);
return 0; return 0;
} }
VIDEO_UPDATE( congo ) VIDEO_UPDATE( congo )
{ {
zaxxon_state *state = (zaxxon_state *)screen->machine->driver_data;
draw_background(screen->machine, bitmap, cliprect, TRUE); draw_background(screen->machine, bitmap, cliprect, TRUE);
draw_sprites(screen->machine, bitmap, cliprect, 0x280, 0x180); draw_sprites(screen->machine, bitmap, cliprect, 0x280, 0x180);
tilemap_draw(bitmap, cliprect, fg_tilemap, 0, 0); tilemap_draw(bitmap, cliprect, state->fg_tilemap, 0, 0);
return 0; return 0;
} }