Added save states to zerozone.c, yunsun16.c, dominob.c, dogfgt.c and bogeyman.c

Out of whatsnew: I also added driver_data struct to these drivers (and to bombjack.c & blktiger.c as well) BUT, as in bionicc.c, some memory pointers (spriteram, paletteram or nvram) are commented out due to use of generic handlers
This commit is contained in:
Fabio Priuli 2009-11-20 15:29:53 +00:00
parent d536755b09
commit d20689a4f8
20 changed files with 886 additions and 534 deletions

5
.gitattributes vendored
View File

@ -2335,10 +2335,13 @@ src/mame/includes/beathead.h svneol=native#text/plain
src/mame/includes/beezer.h svneol=native#text/plain
src/mame/includes/bigevglf.h svneol=native#text/plain
src/mame/includes/bionicc.h svneol=native#text/plain
src/mame/includes/blktiger.h svneol=native#text/plain
src/mame/includes/blmbycar.h svneol=native#text/plain
src/mame/includes/blockade.h svneol=native#text/plain
src/mame/includes/blstroid.h svneol=native#text/plain
src/mame/includes/blueprnt.h svneol=native#text/plain
src/mame/includes/bogeyman.h svneol=native#text/plain
src/mame/includes/bombjack.h svneol=native#text/plain
src/mame/includes/brkthru.h svneol=native#text/plain
src/mame/includes/bsktball.h svneol=native#text/plain
src/mame/includes/btime.h svneol=native#text/plain
@ -2623,7 +2626,9 @@ src/mame/includes/wrally.h svneol=native#text/plain
src/mame/includes/wwfwfest.h svneol=native#text/plain
src/mame/includes/xmen.h svneol=native#text/plain
src/mame/includes/xybots.h svneol=native#text/plain
src/mame/includes/yunsun16.h svneol=native#text/plain
src/mame/includes/zaxxon.h svneol=native#text/plain
src/mame/includes/zerozone.h svneol=native#text/plain
src/mame/layout/280zzzap.lay svneol=native#text/plain
src/mame/layout/abaseb.lay svneol=native#text/plain
src/mame/layout/ampoker2.lay svneol=native#text/plain

View File

@ -1,15 +1,15 @@
/***************************************************************************
Black Tiger
Black Tiger
Driver provided by Paul Leaman
Driver provided by Paul Leaman
Thanks to Ishmair for providing information about the screen
layout on level 3.
Thanks to Ishmair for providing information about the screen
layout on level 3.
Notes:
- sprites/tile priority is a guess. I didn't find a PROM that would simply
translate to the scheme I implemented.
Notes:
- sprites/tile priority is a guess. I didn't find a PROM that would simply
translate to the scheme I implemented.
***************************************************************************/
@ -17,24 +17,7 @@ Notes:
#include "cpu/z80/z80.h"
#include "sound/2203intf.h"
#include "cpu/mcs51/mcs51.h"
extern UINT8 *blktiger_txvideoram;
WRITE8_HANDLER( blktiger_screen_layout_w );
READ8_HANDLER( blktiger_bgvideoram_r );
WRITE8_HANDLER( blktiger_bgvideoram_w );
WRITE8_HANDLER( blktiger_txvideoram_w );
WRITE8_HANDLER( blktiger_video_control_w );
WRITE8_HANDLER( blktiger_video_enable_w );
WRITE8_HANDLER( blktiger_bgvideoram_bank_w );
WRITE8_HANDLER( blktiger_scrollx_w );
WRITE8_HANDLER( blktiger_scrolly_w );
VIDEO_START( blktiger );
VIDEO_UPDATE( blktiger );
VIDEO_EOF( blktiger );
#include "blktiger.h"
/**************************************************
@ -43,30 +26,32 @@ Protection comms between main cpu and i8751
**************************************************/
static UINT8 z80_latch,i8751_latch;
static READ8_HANDLER( blktiger_from_mcu_r )
{
return i8751_latch;
blktiger_state *state = (blktiger_state *)space->machine->driver_data;
return state->i8751_latch;
}
static WRITE8_HANDLER( blktiger_to_mcu_w )
{
blktiger_state *state = (blktiger_state *)space->machine->driver_data;
cputag_set_input_line(space->machine, "mcu", MCS51_INT1_LINE, ASSERT_LINE);
z80_latch = data;
state->z80_latch = data;
}
static READ8_HANDLER( blktiger_from_main_r )
{
blktiger_state *state = (blktiger_state *)space->machine->driver_data;
cputag_set_input_line(space->machine, "mcu", MCS51_INT1_LINE, CLEAR_LINE);
//printf("%02x read\n",latch);
return z80_latch;
return state->z80_latch;
}
static WRITE8_HANDLER( blktiger_to_main_w )
{
blktiger_state *state = (blktiger_state *)space->machine->driver_data;
//printf("%02x write\n",data);
i8751_latch = data;
state->i8751_latch = data;
}
@ -90,7 +75,7 @@ static ADDRESS_MAP_START( blktiger_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0xbfff) AM_ROMBANK(1)
AM_RANGE(0xc000, 0xcfff) AM_READWRITE(blktiger_bgvideoram_r, blktiger_bgvideoram_w)
AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(blktiger_txvideoram_w) AM_BASE(&blktiger_txvideoram)
AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(blktiger_txvideoram_w) AM_BASE_MEMBER(blktiger_state, txvideoram)
AM_RANGE(0xd800, 0xdbff) AM_RAM_WRITE(paletteram_xxxxBBBBRRRRGGGG_split1_w) AM_BASE(&paletteram)
AM_RANGE(0xdc00, 0xdfff) AM_RAM_WRITE(paletteram_xxxxBBBBRRRRGGGG_split2_w) AM_BASE(&paletteram_2)
AM_RANGE(0xe000, 0xfdff) AM_RAM
@ -151,7 +136,7 @@ ADDRESS_MAP_END
static INPUT_PORTS_START( blktiger )
PORT_START("IN0") /* IN0 */
PORT_START("IN0")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */
@ -161,7 +146,7 @@ static INPUT_PORTS_START( blktiger )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_START("IN1") /* IN1 */
PORT_START("IN1")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
@ -171,7 +156,7 @@ static INPUT_PORTS_START( blktiger )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */
PORT_START("IN2") /* IN2 */
PORT_START("IN2")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_COCKTAIL
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_COCKTAIL
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_COCKTAIL
@ -181,7 +166,7 @@ static INPUT_PORTS_START( blktiger )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* probably unused */
PORT_START("DSW0") /* DSW0 */
PORT_START("DSW0")
PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) ) PORT_DIPLOCATION( "SW1:1,2,3" )
PORT_DIPSETTING( 0x00, DEF_STR( 4C_1C ) )
PORT_DIPSETTING( 0x01, DEF_STR( 3C_1C ) )
@ -207,7 +192,7 @@ static INPUT_PORTS_START( blktiger )
PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_START("DSW1") /* DSW1 */
PORT_START("DSW1")
PORT_DIPNAME( 0x03, 0x03, DEF_STR( Lives ) ) PORT_DIPLOCATION( "SW2:1,2" )
PORT_DIPSETTING( 0x02, "2" )
PORT_DIPSETTING( 0x03, "3" )
@ -295,12 +280,47 @@ static const ym2203_interface ym2203_config =
static MACHINE_START( blktiger )
{
blktiger_state *state = (blktiger_state *)machine->driver_data;
/* configure bankswitching */
memory_configure_bank(machine, 1, 0, 16, memory_region(machine, "maincpu") + 0x10000, 0x4000);
state_save_register_global(machine, state->scroll_bank);
state_save_register_global(machine, state->screen_layout);
state_save_register_global(machine, state->chon);
state_save_register_global(machine, state->objon);
state_save_register_global(machine, state->bgon);
state_save_register_global(machine, state->z80_latch);
state_save_register_global(machine, state->i8751_latch);
state_save_register_global_array(machine, state->scroll_x);
state_save_register_global_array(machine, state->scroll_y);
}
static MACHINE_RESET( blktiger )
{
blktiger_state *state = (blktiger_state *)machine->driver_data;
/* configure bankswitching */
memory_configure_bank(machine, 1, 0, 16, memory_region(machine, "maincpu") + 0x10000, 0x4000);
state->scroll_x[0] = 0;
state->scroll_x[1] = 0;
state->scroll_y[0] = 0;
state->scroll_y[1] = 0;
state->scroll_bank = 0;
state->screen_layout = 0;
state->chon = 0;
state->objon = 0;
state->bgon = 0;
state->z80_latch = 0;
state->i8751_latch = 0;
}
static MACHINE_DRIVER_START( blktiger )
/* driver data */
MDRV_DRIVER_DATA(blktiger_state)
/* basic machine hardware */
MDRV_CPU_ADD("maincpu", Z80, XTAL_24MHz/4) /* verified on pcb */
MDRV_CPU_PROGRAM_MAP(blktiger_map)
@ -316,6 +336,7 @@ static MACHINE_DRIVER_START( blktiger )
//MDRV_CPU_VBLANK_INT("screen", irq0_line_hold)
MDRV_MACHINE_START(blktiger)
MDRV_MACHINE_RESET(blktiger)
/* video hardware */
MDRV_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM)

View File

@ -15,56 +15,46 @@
#include "deprecat.h"
#include "cpu/m6502/m6502.h"
#include "sound/ay8910.h"
extern UINT8 *bogeyman_videoram2, *bogeyman_colorram2;
#include "bogeyman.h"
extern WRITE8_HANDLER( bogeyman_videoram_w );
extern WRITE8_HANDLER( bogeyman_colorram_w );
extern WRITE8_HANDLER( bogeyman_videoram2_w );
extern WRITE8_HANDLER( bogeyman_colorram2_w );
extern WRITE8_HANDLER( bogeyman_paletteram_w );
extern PALETTE_INIT( bogeyman );
extern VIDEO_START( bogeyman );
extern VIDEO_UPDATE( bogeyman );
/* Read/Write Handlers */
// Sound section is copied from Mysterious Stones driver by Nicola, Mike, Brad
static int psg_latch;
static WRITE8_HANDLER( bogeyman_8910_latch_w )
{
psg_latch = data;
bogeyman_state *state = (bogeyman_state *)space->machine->driver_data;
state->psg_latch = data;
}
static WRITE8_HANDLER( bogeyman_8910_control_w )
{
static int last;
bogeyman_state *state = (bogeyman_state *)space->machine->driver_data;
// bit 0 is flipscreen
flip_screen_set(space->machine, data & 0x01);
// bit 5 goes to 8910 #0 BDIR pin
if ((last & 0x20) == 0x20 && (data & 0x20) == 0x00)
ay8910_data_address_w(devtag_get_device(space->machine, "ay1"), last >> 4, psg_latch);
if ((state->last_write & 0x20) == 0x20 && (data & 0x20) == 0x00)
ay8910_data_address_w(devtag_get_device(space->machine, "ay1"), state->last_write >> 4, state->psg_latch);
// bit 7 goes to 8910 #1 BDIR pin
if ((last & 0x80) == 0x80 && (data & 0x80) == 0x00)
ay8910_data_address_w(devtag_get_device(space->machine, "ay2"), last >> 6, psg_latch);
if ((state->last_write & 0x80) == 0x80 && (data & 0x80) == 0x00)
ay8910_data_address_w(devtag_get_device(space->machine, "ay2"), state->last_write >> 6, state->psg_latch);
last = data;
state->last_write = data;
}
/* Memory Map */
static ADDRESS_MAP_START( bogeyman_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x17ff) AM_RAM
AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(bogeyman_videoram2_w) AM_BASE(&bogeyman_videoram2)
AM_RANGE(0x1c00, 0x1fff) AM_RAM_WRITE(bogeyman_colorram2_w) AM_BASE(&bogeyman_colorram2)
AM_RANGE(0x2000, 0x20ff) AM_RAM_WRITE(bogeyman_videoram_w) AM_BASE(&videoram)
AM_RANGE(0x2100, 0x21ff) AM_RAM_WRITE(bogeyman_colorram_w) AM_BASE(&colorram)
AM_RANGE(0x2800, 0x2bff) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
AM_RANGE(0x1800, 0x1bff) AM_RAM_WRITE(bogeyman_videoram2_w) AM_BASE_MEMBER(bogeyman_state, videoram2)
AM_RANGE(0x1c00, 0x1fff) AM_RAM_WRITE(bogeyman_colorram2_w) AM_BASE_MEMBER(bogeyman_state, colorram2)
AM_RANGE(0x2000, 0x20ff) AM_RAM_WRITE(bogeyman_videoram_w) AM_BASE_MEMBER(bogeyman_state, videoram)
AM_RANGE(0x2100, 0x21ff) AM_RAM_WRITE(bogeyman_colorram_w) AM_BASE_MEMBER(bogeyman_state, colorram)
AM_RANGE(0x2800, 0x2bff) AM_RAM AM_BASE_MEMBER(bogeyman_state, spriteram) AM_SIZE(&spriteram_size)
AM_RANGE(0x3000, 0x300f) AM_RAM_WRITE(bogeyman_paletteram_w) AM_BASE(&paletteram)
AM_RANGE(0x3800, 0x3800) AM_READ_PORT("P1") AM_WRITE(bogeyman_8910_control_w)
AM_RANGE(0x3801, 0x3801) AM_READ_PORT("P2") AM_WRITE(bogeyman_8910_latch_w)
@ -215,12 +205,36 @@ GFXDECODE_END
/* Machine Driver */
static MACHINE_START( bogeyman )
{
bogeyman_state *state = (bogeyman_state *)machine->driver_data;
state_save_register_global(machine, state->psg_latch);
state_save_register_global(machine, state->last_write);
}
static MACHINE_RESET( bogeyman )
{
bogeyman_state *state = (bogeyman_state *)machine->driver_data;
state->psg_latch = 0;
state->last_write = 0;
}
static MACHINE_DRIVER_START( bogeyman )
/* driver data */
MDRV_DRIVER_DATA(bogeyman_state)
// basic machine hardware
MDRV_CPU_ADD("maincpu", M6502, 1500000) /* Verified */
MDRV_CPU_PROGRAM_MAP(bogeyman_map)
MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold, 16) // Controls sound
MDRV_MACHINE_START(bogeyman)
MDRV_MACHINE_RESET(bogeyman)
// video hardware
MDRV_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK)
@ -281,4 +295,4 @@ ROM_END
/* Game Driver */
GAME( 1985, bogeyman, 0, bogeyman, bogeyman, 0, ROT0, "Technos Japan", "Bogey Manor", GAME_IMPERFECT_COLORS )
GAME( 1985, bogeyman, 0, bogeyman, bogeyman, 0, ROT0, "Technos Japan", "Bogey Manor", GAME_IMPERFECT_COLORS | GAME_SUPPORTS_SAVE )

View File

@ -98,53 +98,44 @@ Dip Locations and factory settings verified with manual
#include "driver.h"
#include "cpu/z80/z80.h"
#include "sound/ay8910.h"
extern WRITE8_HANDLER( bombjack_videoram_w );
extern WRITE8_HANDLER( bombjack_colorram_w );
extern WRITE8_HANDLER( bombjack_background_w );
extern WRITE8_HANDLER( bombjack_flipscreen_w );
extern VIDEO_START( bombjack );
extern VIDEO_UPDATE( bombjack );
static UINT8 latch;
static MACHINE_START( bombjack )
{
state_save_register_global(machine, latch);
}
#include "bombjack.h"
static TIMER_CALLBACK( soundlatch_callback )
{
latch = param;
bombjack_state *state = (bombjack_state *)machine->driver_data;
state->latch = param;
}
static WRITE8_HANDLER( bombjack_soundlatch_w )
{
/* make all the CPUs synchronize, and only AFTER that write the new command to the latch */
timer_call_after_resynch(space->machine, NULL, data,soundlatch_callback);
timer_call_after_resynch(space->machine, NULL, data, soundlatch_callback);
}
static READ8_HANDLER( bombjack_soundlatch_r )
{
bombjack_state *state = (bombjack_state *)space->machine->driver_data;
int res;
res = latch;
latch = 0;
res = state->latch;
state->latch = 0;
return res;
}
/*************************************
*
* Address maps
*
*************************************/
static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0x8fff) AM_RAM
AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(bombjack_videoram_w) AM_BASE(&videoram)
AM_RANGE(0x9400, 0x97ff) AM_RAM_WRITE(bombjack_colorram_w) AM_BASE(&colorram)
AM_RANGE(0x9820, 0x987f) AM_WRITEONLY AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
AM_RANGE(0x9000, 0x93ff) AM_RAM_WRITE(bombjack_videoram_w) AM_BASE_MEMBER(bombjack_state, videoram)
AM_RANGE(0x9400, 0x97ff) AM_RAM_WRITE(bombjack_colorram_w) AM_BASE_MEMBER(bombjack_state, colorram)
AM_RANGE(0x9820, 0x987f) AM_WRITEONLY AM_BASE_MEMBER(bombjack_state, spriteram) AM_SIZE(&spriteram_size)
AM_RANGE(0x9a00, 0x9a00) AM_WRITENOP
AM_RANGE(0x9c00, 0x9cff) AM_WRITE(paletteram_xxxxBBBBGGGGRRRR_le_w) AM_BASE(&paletteram)
AM_RANGE(0x9e00, 0x9e00) AM_WRITE(bombjack_background_w)
@ -174,6 +165,12 @@ static ADDRESS_MAP_START( audio_io_map, ADDRESS_SPACE_IO, 8 )
ADDRESS_MAP_END
/*************************************
*
* Input ports
*
*************************************/
static INPUT_PORTS_START( bombjack )
PORT_START("P1")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT ) PORT_8WAY
@ -253,6 +250,12 @@ INPUT_PORTS_END
/*************************************
*
* Graphics definitions
*
*************************************/
static const gfx_layout charlayout1 =
{
8,8, /* 8*8 characters */
@ -317,8 +320,35 @@ GFXDECODE_END
/*************************************
*
* Machine driver
*
*************************************/
static MACHINE_START( bombjack )
{
bombjack_state *state = (bombjack_state *)machine->driver_data;
state_save_register_global(machine, state->latch);
state_save_register_global(machine, state->background_image);
}
static MACHINE_RESET( bombjack )
{
bombjack_state *state = (bombjack_state *)machine->driver_data;
state->latch = 0;
state->background_image = 0;
}
static MACHINE_DRIVER_START( bombjack )
/* driver data */
MDRV_DRIVER_DATA(bombjack_state)
/* basic machine hardware */
MDRV_CPU_ADD("maincpu", Z80, 4000000) /* 4 MHz */
MDRV_CPU_PROGRAM_MAP(main_map)
@ -330,6 +360,7 @@ static MACHINE_DRIVER_START( bombjack )
MDRV_CPU_VBLANK_INT("screen", nmi_line_pulse)
MDRV_MACHINE_START(bombjack)
MDRV_MACHINE_RESET(bombjack)
/* video hardware */
MDRV_SCREEN_ADD("screen", RASTER)
@ -360,11 +391,11 @@ MACHINE_DRIVER_END
/***************************************************************************
Game driver(s)
***************************************************************************/
/*************************************
*
* ROM definition(s)
*
*************************************/
ROM_START( bombjack )
ROM_REGION( 0x10000, "maincpu", 0 )
@ -427,5 +458,11 @@ ROM_START( bombjack2 )
ROM_END
GAME( 1984, bombjack, 0, bombjack, bombjack, 0, ROT90, "Tehkan", "Bomb Jack (set 1)", GAME_SUPPORTS_SAVE )
GAME( 1984, bombjack2,bombjack, bombjack, bombjack, 0, ROT90, "Tehkan", "Bomb Jack (set 2)", GAME_SUPPORTS_SAVE )
/*************************************
*
* Game driver(s)
*
*************************************/
GAME( 1984, bombjack, 0, bombjack, bombjack, 0, ROT90, "Tehkan", "Bomb Jack (set 1)", GAME_SUPPORTS_SAVE )
GAME( 1984, bombjack2, bombjack, bombjack, bombjack, 0, ROT90, "Tehkan", "Bomb Jack (set 2)", GAME_SUPPORTS_SAVE )

View File

@ -14,23 +14,22 @@ driver by Nicola Salmoria
#include "sound/ay8910.h"
static UINT8 *sharedram;
static READ8_HANDLER( sharedram_r )
{
return sharedram[offset];
dogfgt_state *state = (dogfgt_state *)space->machine->driver_data;
return state->sharedram[offset];
}
static WRITE8_HANDLER( sharedram_w )
{
sharedram[offset] = data;
dogfgt_state *state = (dogfgt_state *)space->machine->driver_data;
state->sharedram[offset] = data;
}
static WRITE8_HANDLER( subirqtrigger_w )
{
/* bit 0 used but unknown */
if (data & 0x04)
cputag_set_input_line(space->machine, "sub", 0, ASSERT_LINE);
}
@ -40,36 +39,33 @@ static WRITE8_HANDLER( sub_irqack_w )
cputag_set_input_line(space->machine, "sub", 0, CLEAR_LINE);
}
static int soundlatch;
static WRITE8_HANDLER( dogfgt_soundlatch_w )
{
soundlatch = data;
dogfgt_state *state = (dogfgt_state *)space->machine->driver_data;
state->soundlatch = data;
}
static WRITE8_HANDLER( dogfgt_soundcontrol_w )
{
static int last;
dogfgt_state *state = (dogfgt_state *)space->machine->driver_data;
/* bit 5 goes to 8910 #0 BDIR pin */
if ((last & 0x20) == 0x20 && (data & 0x20) == 0x00)
ay8910_data_address_w(devtag_get_device(space->machine, "ay1"), last >> 4, soundlatch);
if ((state->last_snd_ctrl & 0x20) == 0x20 && (data & 0x20) == 0x00)
ay8910_data_address_w(devtag_get_device(space->machine, "ay1"), state->last_snd_ctrl >> 4, state->soundlatch);
/* bit 7 goes to 8910 #1 BDIR pin */
if ((last & 0x80) == 0x80 && (data & 0x80) == 0x00)
ay8910_data_address_w(devtag_get_device(space->machine, "ay2"), last >> 6, soundlatch);
if ((state->last_snd_ctrl & 0x80) == 0x80 && (data & 0x80) == 0x00)
ay8910_data_address_w(devtag_get_device(space->machine, "ay2"), state->last_snd_ctrl >> 6, state->soundlatch);
last = data;
state->last_snd_ctrl = data;
}
static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x07ff) AM_READWRITE(sharedram_r, sharedram_w) AM_BASE(&sharedram)
AM_RANGE(0x0f80, 0x0fdf) AM_WRITE(SMH_RAM) AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
AM_RANGE(0x1000, 0x17ff) AM_WRITE(dogfgt_bgvideoram_w) AM_BASE(&dogfgt_bgvideoram)
AM_RANGE(0x0000, 0x07ff) AM_READWRITE(sharedram_r, sharedram_w) AM_BASE_MEMBER(dogfgt_state, sharedram)
AM_RANGE(0x0f80, 0x0fdf) AM_WRITE(SMH_RAM) AM_BASE_MEMBER(dogfgt_state, spriteram) AM_SIZE(&spriteram_size)
AM_RANGE(0x1000, 0x17ff) AM_WRITE(dogfgt_bgvideoram_w) AM_BASE_MEMBER(dogfgt_state, bgvideoram)
AM_RANGE(0x1800, 0x1800) AM_READ_PORT("P1")
AM_RANGE(0x1800, 0x1800) AM_WRITE(dogfgt_1800_w) /* text color, flip screen & coin counters */
AM_RANGE(0x1810, 0x1810) AM_READ_PORT("P2")
@ -215,9 +211,42 @@ GFXDECODE_END
static MACHINE_START( dogfgt )
{
dogfgt_state *state = (dogfgt_state *)machine->driver_data;
state_save_register_global(machine, state->bm_plane);
state_save_register_global(machine, state->lastflip);
state_save_register_global(machine, state->pixcolor);
state_save_register_global(machine, state->lastpixcolor);
state_save_register_global(machine, state->soundlatch);
state_save_register_global(machine, state->last_snd_ctrl);
state_save_register_global_array(machine, state->scroll);
}
static MACHINE_RESET( dogfgt )
{
dogfgt_state *state = (dogfgt_state *)machine->driver_data;
int i;
state->bm_plane = 0;
state->lastflip = 0;
state->pixcolor = 0;
state->lastpixcolor = 0;
state->soundlatch = 0;
state->last_snd_ctrl = 0;
for (i = 0; i < 3; i++)
state->scroll[i] = 0;
}
static MACHINE_DRIVER_START( dogfgt )
/* driver data */
MDRV_DRIVER_DATA(dogfgt_state)
/* basic machine hardware */
MDRV_CPU_ADD("maincpu", M6502, 1500000) /* 1.5 MHz ???? */
MDRV_CPU_PROGRAM_MAP(main_map)
@ -228,6 +257,9 @@ static MACHINE_DRIVER_START( dogfgt )
MDRV_QUANTUM_TIME(HZ(6000))
MDRV_MACHINE_START(dogfgt)
MDRV_MACHINE_RESET(dogfgt)
/* video hardware */
MDRV_SCREEN_ADD("screen", RASTER)
MDRV_SCREEN_REFRESH_RATE(60)
@ -325,5 +357,5 @@ ROM_END
GAME( 1984, dogfgt, 0, dogfgt, dogfgt, 0, ROT0, "Technos Japan", "Acrobatic Dog-Fight", 0 )
GAME( 1984, dogfgtj, dogfgt, dogfgt, dogfgt, 0, ROT0, "Technos Japan", "Dog-Fight (Japan)", 0 )
GAME( 1984, dogfgt, 0, dogfgt, dogfgt, 0, ROT0, "Technos Japan", "Acrobatic Dog-Fight", GAME_SUPPORTS_SAVE )
GAME( 1984, dogfgtj, dogfgt, dogfgt, dogfgt, 0, ROT0, "Technos Japan", "Dog-Fight (Japan)", GAME_SUPPORTS_SAVE )

View File

@ -1,31 +1,32 @@
/***************************************************************************
Domino Block
Driver by Tomasz Slanina
some bits by David Haywood
Fixed Dip Switches and additional infos by Stephh
Domino Block
Based on the Arkanoid driver
Driver by Tomasz Slanina
some bits by David Haywood
Fixed Dip Switches and additional infos by Stephh
This is a hacked up version of Arkanoid with high colour backgrounds
and gameplay modifications. It runs on custom Korean hardware.
Based on the Arkanoid driver
Button 1 = 'use Domino' - The ball will bounce along the bricks in a
horizontal line without coming down
until a "hole" or a grey or gold brick
This is a hacked up version of Arkanoid with high colour backgrounds
and gameplay modifications. It runs on custom Korean hardware.
Button 2 = 'use Rocket' - Your paddle will jump to the top of the screen
then back down, destroying everything in its path
Button 1 = 'use Domino' - The ball will bounce along the bricks in a
horizontal line without coming down
until a "hole" or a grey or gold brick
Bonus Lives always at 200000, 500000, then every 300000 (no Dip Switch)
Button 2 = 'use Rocket' - Your paddle will jump to the top of the screen
then back down, destroying everything in its path
There are 6 stages of 5 rounds. When these 30 levels are completed,
you'll have to complete round 1 of each stage with a smaller bat.
When this stage 7 is completed, the game ends but you can't enter
your initials if you have achieved a high score !
Bonus Lives always at 200000, 500000, then every 300000 (no Dip Switch)
It's funny to see that this game, as 'arkanoid', does NOT allow you
to enter "SEX" as initials (which will be replaced by "H !") ;)
There are 6 stages of 5 rounds. When these 30 levels are completed,
you'll have to complete round 1 of each stage with a smaller bat.
When this stage 7 is completed, the game ends but you can't enter
your initials if you have achieved a high score !
It's funny to see that this game, as 'arkanoid', does NOT allow you
to enter "SEX" as initials (which will be replaced by "H !") ;)
***************************************************************************/
@ -33,36 +34,49 @@
#include "cpu/z80/z80.h"
#include "sound/ay8910.h"
typedef struct _dominob_state dominob_state;
struct _dominob_state
{
/* memory pointers */
UINT8 * spriteram;
UINT8 * videoram;
UINT8 * bgram;
// UINT8 * paletteram; // currently this uses generic palette handling
/* input-related */
//UINT8 paddle_select;
//UINT8 paddle_value;
};
static VIDEO_START( dominob )
{
machine->gfx[0]->color_granularity=8;
machine->gfx[0]->color_granularity = 8;
}
static UINT8 *bgram;
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 )
{
dominob_state *state = (dominob_state *)machine->driver_data;
int offs;
for (offs = 0;offs < spriteram_size;offs += 4)
for (offs = 0; offs < spriteram_size; offs += 4)
{
int sx,sy,code;
int sx, sy, code;
sx = spriteram[offs];
sy = 248 - spriteram[offs + 1];
sx = state->spriteram[offs];
sy = 248 - state->spriteram[offs + 1];
if (flip_screen_x_get(machine)) sx = 248 - sx;
if (flip_screen_y_get(machine)) sy = 248 - sy;
code = spriteram[offs + 3] + ((spriteram[offs + 2] & 0x03) << 8) ;
code = state->spriteram[offs + 3] + ((state->spriteram[offs + 2] & 0x03) << 8) ;
drawgfx_transpen(bitmap,cliprect,machine->gfx[0],
2 * code,
((spriteram[offs + 2] & 0xf8) >> 3) ,
((state->spriteram[offs + 2] & 0xf8) >> 3) ,
flip_screen_x_get(machine),flip_screen_y_get(machine),
sx,sy + (flip_screen_y_get(machine) ? 8 : -8),0);
drawgfx_transpen(bitmap,cliprect,machine->gfx[0],
2 * code + 1,
((spriteram[offs + 2] & 0xf8) >> 3) ,
((state->spriteram[offs + 2] & 0xf8) >> 3) ,
flip_screen_x_get(machine),flip_screen_y_get(machine),
sx,sy,0);
}
@ -71,37 +85,38 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
static VIDEO_UPDATE( dominob )
{
dominob_state *state = (dominob_state *)screen->machine->driver_data;
int x,y;
int index = 0;
/* Convert to tilemaps? */
for (y = 0; y < 256 / 32; y++)
{
int x,y;
int index=0;
for(y=0;y<256/32;y++)
for(x=0;x<256/32;x++)
{
drawgfx_opaque( bitmap,
cliprect,
screen->machine->gfx[1],
bgram[index]+256*(bgram[index+1]&0xf),
bgram[index+1]>>4,
0, 0,
x*32,y*32);
index+=2;
}
for (x = 0; x < 256 / 32; x++)
{
drawgfx_opaque(bitmap,
cliprect,
screen->machine->gfx[1],
state->bgram[index] + 256 * (state->bgram[index + 1] & 0xf),
state->bgram[index + 1] >> 4,
0, 0,
x * 32, y * 32);
index += 2;
}
}
for (y = 0; y < 32; y++)
{
int x,y;
for(y=0;y<32;y++)
for(x=0;x<32;x++)
{
drawgfx_transpen( bitmap,
cliprect,
screen->machine->gfx[0],
videoram[(y*32+x)*2+1]+(videoram[(y*32+x)*2]&7)*256,
(videoram[(y*32+x)*2]>>3),
0, 0,
x*8,y*8,0);
}
for (x = 0; x < 32; x++)
{
drawgfx_transpen( bitmap,
cliprect,
screen->machine->gfx[0],
state->videoram[(y * 32 + x) * 2 + 1] + (state->videoram[(y * 32 + x) * 2] & 7) * 256,
(state->videoram[(y * 32 + x) * 2] >> 3),
0, 0,
x * 8, y * 8,0);
}
}
draw_sprites(screen->machine, bitmap, cliprect);
@ -110,9 +125,6 @@ static VIDEO_UPDATE( dominob )
}
//UINT8 dominob_paddle_select;
//UINT8 dominob_paddle_value;
static WRITE8_HANDLER( dominob_d008_w )
{
/* is there a purpose on this ? always set to 0x00 (read from 0xc47b in RAM) */
@ -129,10 +141,10 @@ static ADDRESS_MAP_START( memmap, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0xd010, 0xd010) AM_READ_PORT("IN1") AM_WRITENOP
AM_RANGE(0xd018, 0xd018) AM_READ_PORT("IN2") AM_WRITENOP
AM_RANGE(0xe000, 0xe7ff) AM_RAM AM_BASE(&videoram)
AM_RANGE(0xe800, 0xe83f) AM_RAM AM_BASE(&spriteram) AM_SIZE(&spriteram_size)
AM_RANGE(0xe000, 0xe7ff) AM_RAM AM_BASE_MEMBER(dominob_state, videoram)
AM_RANGE(0xe800, 0xe83f) AM_RAM AM_BASE_MEMBER(dominob_state, spriteram) AM_SIZE(&spriteram_size)
AM_RANGE(0xe840, 0xefff) AM_RAM
AM_RANGE(0xf000, 0xf07f) AM_RAM AM_BASE(&bgram)
AM_RANGE(0xf000, 0xf07f) AM_RAM AM_BASE_MEMBER(dominob_state, bgram)
AM_RANGE(0xf080, 0xf7ff) AM_RAM
AM_RANGE(0xf800, 0xfbff) AM_WRITE(paletteram_xxxxRRRRGGGGBBBB_le_w) AM_READ(SMH_RAM) AM_BASE(&paletteram)
AM_RANGE(0xfc00, 0xffff) AM_RAM
@ -244,6 +256,9 @@ static const ay8910_interface ay8910_config =
static MACHINE_DRIVER_START( dominob )
/* driver data */
MDRV_DRIVER_DATA(dominob_state)
/* basic machine hardware */
MDRV_CPU_ADD("maincpu", Z80,8000000/2)
MDRV_CPU_PROGRAM_MAP(memmap)
@ -297,4 +312,4 @@ ROM_START( dominob )
ROM_CONTINUE(0xc0000,0x40000) // 1ST AND 2ND HALF IDENTICAL
ROM_END
GAME( 1990, dominob, 0, dominob, dominob, 0, ROT0, "Wonwoo Systems", "Domino Block", 0 )
GAME( 1990, dominob, 0, dominob, dominob, 0, ROT0, "Wonwoo Systems", "Domino Block", GAME_SUPPORTS_SAVE )

View File

@ -86,25 +86,12 @@ Stephh's notes (based on the games M68000 code and some tests) :
***************************************************************************/
#include "driver.h"
#include "yunsun16.h"
#include "cpu/z80/z80.h"
#include "cpu/m68000/m68000.h"
#include "sound/okim6295.h"
#include "sound/3812intf.h"
/* Variables defined in video: */
extern UINT16 *yunsun16_vram_0, *yunsun16_vram_1;
extern UINT16 *yunsun16_scroll_0, *yunsun16_scroll_1;
extern UINT16 *yunsun16_priority;
/* Functions defined in video: */
WRITE16_HANDLER( yunsun16_vram_0_w );
WRITE16_HANDLER( yunsun16_vram_1_w );
VIDEO_START( yunsun16 );
VIDEO_UPDATE( yunsun16 );
/***************************************************************************
@ -131,21 +118,21 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x800018, 0x800019) AM_READ_PORT("SYSTEM")
AM_RANGE(0x80001a, 0x80001b) AM_READ_PORT("DSW1")
AM_RANGE(0x80001c, 0x80001d) AM_READ_PORT("DSW2")
AM_RANGE(0x800030, 0x800031) AM_WRITE(SMH_NOP ) // ? (value: don't care)
AM_RANGE(0x800100, 0x800101) AM_WRITE(SMH_NOP ) // ? $9100
AM_RANGE(0x800102, 0x800103) AM_WRITE(SMH_NOP ) // ? $9080
AM_RANGE(0x800104, 0x800105) AM_WRITE(SMH_NOP ) // ? $90c0
AM_RANGE(0x80010a, 0x80010b) AM_WRITE(SMH_NOP ) // ? $9000
AM_RANGE(0x80010c, 0x80010f) AM_RAM AM_BASE(&yunsun16_scroll_1 ) // Scrolling
AM_RANGE(0x800114, 0x800117) AM_RAM AM_BASE(&yunsun16_scroll_0 ) // Scrolling
AM_RANGE(0x800154, 0x800155) AM_RAM AM_BASE(&yunsun16_priority ) // Priority
AM_RANGE(0x800180, 0x800181) AM_WRITE(yunsun16_sound_bank_w ) // Sound
AM_RANGE(0x800188, 0x800189) AM_DEVREADWRITE8("oki", okim6295_r, okim6295_w, 0x00ff ) // Sound
AM_RANGE(0x8001fe, 0x8001ff) AM_WRITE(SMH_NOP ) // ? 0 (during int)
AM_RANGE(0x800030, 0x800031) AM_WRITE(SMH_NOP) // ? (value: don't care)
AM_RANGE(0x800100, 0x800101) AM_WRITE(SMH_NOP) // ? $9100
AM_RANGE(0x800102, 0x800103) AM_WRITE(SMH_NOP) // ? $9080
AM_RANGE(0x800104, 0x800105) AM_WRITE(SMH_NOP) // ? $90c0
AM_RANGE(0x80010a, 0x80010b) AM_WRITE(SMH_NOP) // ? $9000
AM_RANGE(0x80010c, 0x80010f) AM_RAM AM_BASE_MEMBER(yunsun16_state, scrollram_1) // Scrolling
AM_RANGE(0x800114, 0x800117) AM_RAM AM_BASE_MEMBER(yunsun16_state, scrollram_0) // Scrolling
AM_RANGE(0x800154, 0x800155) AM_RAM AM_BASE_MEMBER(yunsun16_state, priorityram) // Priority
AM_RANGE(0x800180, 0x800181) AM_WRITE(yunsun16_sound_bank_w) // Sound
AM_RANGE(0x800188, 0x800189) AM_DEVREADWRITE8("oki", okim6295_r, okim6295_w, 0x00ff) // Sound
AM_RANGE(0x8001fe, 0x8001ff) AM_WRITE(SMH_NOP) // ? 0 (during int)
AM_RANGE(0x900000, 0x903fff) AM_RAM_WRITE(paletteram16_xRRRRRGGGGGBBBBB_word_w) AM_BASE(&paletteram16) // Palette
AM_RANGE(0x908000, 0x90bfff) AM_RAM_WRITE(yunsun16_vram_1_w) AM_BASE(&yunsun16_vram_1 ) // Layer 1
AM_RANGE(0x90c000, 0x90ffff) AM_RAM_WRITE(yunsun16_vram_0_w) AM_BASE(&yunsun16_vram_0 ) // Layer 0
AM_RANGE(0x910000, 0x910fff) AM_RAM AM_BASE(&spriteram16) AM_SIZE(&spriteram_size ) // Sprites
AM_RANGE(0x908000, 0x90bfff) AM_RAM_WRITE(yunsun16_vram_1_w) AM_BASE_MEMBER(yunsun16_state, vram_1) // Layer 1
AM_RANGE(0x90c000, 0x90ffff) AM_RAM_WRITE(yunsun16_vram_0_w) AM_BASE_MEMBER(yunsun16_state, vram_0) // Layer 0
AM_RANGE(0x910000, 0x910fff) AM_RAM AM_BASE_MEMBER(yunsun16_state, spriteram16) AM_SIZE(&spriteram_size) // Sprites
AM_RANGE(0xff0000, 0xffffff) AM_RAM
ADDRESS_MAP_END
@ -160,8 +147,8 @@ number 0 on each voice. That sample is 00000-00000.
*/
if ((data & 0xff) != 0x3a)
{
soundlatch_w(space, 0, data & 0xff);
cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
soundlatch_w(space, 0, data & 0xff);
cputag_set_input_line(space->machine, "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
}
}
}
@ -567,6 +554,14 @@ GFXDECODE_END
***************************************************************************/
static MACHINE_RESET( yunsun16 )
{
yunsun16_state *state = (yunsun16_state *)machine->driver_data;
state->sprites_scrolldx = -0x40;
state->sprites_scrolldy = -0x0f;
}
/***************************************************************************
Magic Bubble
***************************************************************************/
@ -583,6 +578,9 @@ static const ym3812_interface magicbub_ym3812_intf =
static MACHINE_DRIVER_START( magicbub )
/* driver data */
MDRV_DRIVER_DATA(yunsun16_state)
/* basic machine hardware */
MDRV_CPU_ADD("maincpu", M68000, 16000000)
MDRV_CPU_PROGRAM_MAP(main_map)
@ -592,6 +590,8 @@ static MACHINE_DRIVER_START( magicbub )
MDRV_CPU_PROGRAM_MAP(sound_map)
MDRV_CPU_IO_MAP(sound_port_map)
MDRV_MACHINE_RESET(yunsun16)
/* video hardware */
MDRV_SCREEN_ADD("screen", RASTER)
MDRV_SCREEN_REFRESH_RATE(60)
@ -627,11 +627,16 @@ MACHINE_DRIVER_END
static MACHINE_DRIVER_START( shocking )
/* driver data */
MDRV_DRIVER_DATA(yunsun16_state)
/* basic machine hardware */
MDRV_CPU_ADD("maincpu", M68000, 16000000)
MDRV_CPU_PROGRAM_MAP(main_map)
MDRV_CPU_VBLANK_INT("screen", irq2_line_hold)
MDRV_MACHINE_RESET(yunsun16)
/* video hardware */
MDRV_SCREEN_ADD("screen", RASTER)
MDRV_SCREEN_REFRESH_RATE(60)
@ -920,9 +925,8 @@ ROM_END
***************************************************************************/
GAME( 199?, magicbub, 0, magicbub, magicbub, magicbub, ROT0, "Yun Sung", "Magic Bubble", GAME_NO_COCKTAIL )
GAME( 199?, magicbuba,magicbub, magicbub, magicbua, magicbub, ROT0, "Yun Sung", "Magic Bubble (Adult version)", GAME_NO_COCKTAIL )
GAME( 1996, paprazzi, 0, shocking, paprazzi, 0, ROT270, "Yun Sung", "Paparazzi", GAME_NO_COCKTAIL )
GAME( 1997, shocking, 0, shocking, shocking, 0, ROT0, "Yun Sung", "Shocking", GAME_NO_COCKTAIL )
GAME( 1998, bombkick, 0, shocking, bombkick, 0, ROT0, "Yun Sung", "Bomb Kick", GAME_NO_COCKTAIL )
GAME( 199?, magicbub, 0, magicbub, magicbub, magicbub, ROT0, "Yun Sung", "Magic Bubble", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
GAME( 199?, magicbuba,magicbub, magicbub, magicbua, magicbub, ROT0, "Yun Sung", "Magic Bubble (Adult version)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
GAME( 1996, paprazzi, 0, shocking, paprazzi, 0, ROT270, "Yun Sung", "Paparazzi", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
GAME( 1997, shocking, 0, shocking, shocking, 0, ROT0, "Yun Sung", "Shocking", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )
GAME( 1998, bombkick, 0, shocking, bombkick, 0, ROT0, "Yun Sung", "Bomb Kick", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE )

View File

@ -1,43 +1,38 @@
/***************************************************************************
/*********************************************************************************
Zero Zone memory map
Zero Zone memory map
driver by Brad Oliver
driver by Brad Oliver
CPU 1 : 68000, uses irq 1
CPU 1 : 68000, uses irq 1
0x000000 - 0x01ffff : ROM
0x080000 - 0x08000f : input ports and dipswitches
0x088000 - 0x0881ff : palette RAM, 256 total colors
0x09ce00 - 0x09d9ff : video ram, 48x32
0x0c0000 - 0x0cffff : RAM
0x0f8000 - 0x0f87ff : RAM (unused?)
0x000000 - 0x01ffff : ROM
0x080000 - 0x08000f : input ports and dipswitches
0x088000 - 0x0881ff : palette RAM, 256 total colors
0x09ce00 - 0x09d9ff : video ram, 48x32
0x0c0000 - 0x0cffff : RAM
0x0f8000 - 0x0f87ff : RAM (unused?)
Stephh's notes :
Stephh's notes :
IMO, the game only has 2 buttons (1 to rotate the pieces and 1 for help).
The 3rd button (when the Dip Switch is activated) subs one "line"
(0x0c0966 for player 1 and 0x0c1082 for player 2) each time it is pressed.
As I don't see why such thing would REALLY exist, I've added the
IPF_CHEAT flag for the Dip Switch and the 3rd button of each player.
IMO, the game only has 2 buttons (1 to rotate the pieces and 1 for help).
The 3rd button (when the Dip Switch is activated) subs one "line"
(0x0c0966 for player 1 and 0x0c1082 for player 2) each time it is pressed.
As I don't see why such thing would REALLY exist, I've added the
IPF_CHEAT flag for the Dip Switch and the 3rd button of each player.
TODO:
* adpcm samples don't seem to be playing at the proper tempo - too fast?
TODO:
* adpcm samples don't seem to be playing at the proper tempo - too fast?
***************************************************************************/
*********************************************************************************/
#include "driver.h"
#include "zerozone.h"
#include "cpu/z80/z80.h"
#include "cpu/m68000/m68000.h"
#include "sound/okim6295.h"
VIDEO_START( zerozone );
VIDEO_UPDATE( zerozone );
WRITE16_HANDLER( zerozone_tilemap_w );
WRITE16_HANDLER( zerozone_tilebank_w );
extern UINT16 *zerozone_videoram;
static READ16_HANDLER( zerozone_input_r )
{
switch (offset)
@ -52,8 +47,7 @@ static READ16_HANDLER( zerozone_input_r )
return input_port_read(space->machine, "DSWA");
}
logerror("CPU #0 PC %06x: warning - read unmapped memory address %06x\n",cpu_get_pc(space->cpu),0x800000+offset);
logerror("CPU #0 PC %06x: warning - read unmapped memory address %06x\n", cpu_get_pc(space->cpu), 0x800000 + offset);
return 0x00;
}
@ -73,7 +67,7 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x084000, 0x084001) AM_WRITE(zerozone_sound_w)
AM_RANGE(0x088000, 0x0881ff) AM_RAM_WRITE(paletteram16_RRRRGGGGBBBBRGBx_word_w) AM_BASE(&paletteram16)
AM_RANGE(0x098000, 0x098001) AM_RAM /* Watchdog? */
AM_RANGE(0x09ce00, 0x09ffff) AM_RAM_WRITE(zerozone_tilemap_w) AM_BASE(&zerozone_videoram) AM_SIZE(&videoram_size)
AM_RANGE(0x09ce00, 0x09ffff) AM_RAM_WRITE(zerozone_tilemap_w) AM_BASE_MEMBER(zerozone_state, videoram) AM_SIZE(&videoram_size)
AM_RANGE(0x0b4000, 0x0b4001) AM_WRITE(zerozone_tilebank_w)
AM_RANGE(0x0c0000, 0x0cffff) AM_RAM
AM_RANGE(0x0f8000, 0x0f87ff) AM_RAM /* Never read from */
@ -173,8 +167,17 @@ static GFXDECODE_START( zerozone )
GFXDECODE_END
static MACHINE_RESET( zerozone )
{
zerozone_state *state = (zerozone_state *)machine->driver_data;
state->tilebank = 0;
}
static MACHINE_DRIVER_START( zerozone )
/* driver data */
MDRV_DRIVER_DATA(zerozone_state)
/* basic machine hardware */
MDRV_CPU_ADD("maincpu", M68000, 10000000) /* 10 MHz */
MDRV_CPU_PROGRAM_MAP(main_map)
@ -185,6 +188,8 @@ static MACHINE_DRIVER_START( zerozone )
MDRV_QUANTUM_TIME(HZ(600))
MDRV_MACHINE_RESET(zerozone)
/* video hardware */
MDRV_SCREEN_ADD("screen", RASTER)
MDRV_SCREEN_REFRESH_RATE(60)
@ -249,5 +254,5 @@ ROM_START( lvgirl94 )
ROM_END
GAME( 1993, zerozone, 0, zerozone, zerozone, 0, ROT0, "Comad", "Zero Zone", 0 )
GAME( 1994, lvgirl94, 0, zerozone, zerozone, 0, ROT0, "Comad", "Las Vegas Girl (Girl '94)", 0 )
GAME( 1993, zerozone, 0, zerozone, zerozone, 0, ROT0, "Comad", "Zero Zone", GAME_SUPPORTS_SAVE )
GAME( 1994, lvgirl94, 0, zerozone, zerozone, 0, ROT0, "Comad", "Las Vegas Girl (Girl '94)", GAME_SUPPORTS_SAVE )

View File

@ -0,0 +1,45 @@
/***************************************************************************
Black Tiger
***************************************************************************/
typedef struct _blktiger_state blktiger_state;
struct _blktiger_state
{
/* memory pointers */
UINT8 * txvideoram;
// UINT8 * spriteram; // currently this uses generic buffer_spriteram_w
// UINT8 * paletteram; // currently this uses generic palette handling
// UINT8 * paletteram2; // currently this uses generic palette handling
/* video-related */
tilemap *tx_tilemap, *bg_tilemap8x4, *bg_tilemap4x8;
UINT32 scroll_bank;
UINT8 scroll_x[2];
UINT8 scroll_y[2];
UINT8 *scroll_ram;
UINT8 screen_layout;
UINT8 chon, objon, bgon;
/* mcu-related */
UINT8 z80_latch, i8751_latch;
};
/*----------- defined in video/blktiger.c -----------*/
WRITE8_HANDLER( blktiger_screen_layout_w );
READ8_HANDLER( blktiger_bgvideoram_r );
WRITE8_HANDLER( blktiger_bgvideoram_w );
WRITE8_HANDLER( blktiger_txvideoram_w );
WRITE8_HANDLER( blktiger_video_control_w );
WRITE8_HANDLER( blktiger_video_enable_w );
WRITE8_HANDLER( blktiger_bgvideoram_bank_w );
WRITE8_HANDLER( blktiger_scrollx_w );
WRITE8_HANDLER( blktiger_scrolly_w );
VIDEO_START( blktiger );
VIDEO_UPDATE( blktiger );
VIDEO_EOF( blktiger );

View File

@ -0,0 +1,37 @@
/*************************************************************************
Bogey Manor
*************************************************************************/
typedef struct _bogeyman_state bogeyman_state;
struct _bogeyman_state
{
/* memory pointers */
UINT8 * videoram;
UINT8 * videoram2;
UINT8 * colorram;
UINT8 * colorram2;
UINT8 * spriteram;
// UINT8 * paletteram; // currently this uses generic palette handling
/* video-related */
tilemap *bg_tilemap, *fg_tilemap;
/* misc */
int psg_latch;
int last_write;
};
/* defined in video/bogeyman.c */
WRITE8_HANDLER( bogeyman_videoram_w );
WRITE8_HANDLER( bogeyman_colorram_w );
WRITE8_HANDLER( bogeyman_videoram2_w );
WRITE8_HANDLER( bogeyman_colorram2_w );
WRITE8_HANDLER( bogeyman_paletteram_w );
PALETTE_INIT( bogeyman );
VIDEO_START( bogeyman );
VIDEO_UPDATE( bogeyman );

View File

@ -0,0 +1,33 @@
/*************************************************************************
Bomb Jack
*************************************************************************/
typedef struct _bombjack_state bombjack_state;
struct _bombjack_state
{
/* memory pointers */
UINT8 * videoram;
UINT8 * colorram;
UINT8 * spriteram;
// UINT8 * paletteram; // currently this uses generic palette handling
/* video-related */
tilemap *fg_tilemap, *bg_tilemap;
UINT8 background_image;
/* sound-related */
UINT8 latch;
};
/* defined in video/bombjack.c */
WRITE8_HANDLER( bombjack_videoram_w );
WRITE8_HANDLER( bombjack_colorram_w );
WRITE8_HANDLER( bombjack_background_w );
WRITE8_HANDLER( bombjack_flipscreen_w );
VIDEO_START( bombjack );
VIDEO_UPDATE( bombjack );

View File

@ -1,6 +1,31 @@
/*----------- defined in video/dogfgt.c -----------*/
extern UINT8 *dogfgt_bgvideoram;
#define PIXMAP_COLOR_BASE (16 + 32)
#define BITMAPRAM_SIZE 0x6000
typedef struct _dogfgt_state dogfgt_state;
struct _dogfgt_state
{
/* memory pointers */
UINT8 * spriteram;
UINT8 * bgvideoram;
UINT8 * sharedram;
// UINT8 * paletteram; // currently this uses generic palette handling
/* video-related */
bitmap_t *pixbitmap;
tilemap *bg_tilemap;
UINT8 *bitmapram;
int bm_plane, pixcolor;
int scroll[4];
int lastflip, lastpixcolor;
/* sound-related */
int soundlatch, last_snd_ctrl;
};
/*----------- defined in video/dogfgt.c -----------*/
WRITE8_HANDLER( dogfgt_plane_select_w );
READ8_HANDLER( dogfgt_bitmapram_r );

View File

@ -0,0 +1,31 @@
/*************************************************************************
Yun Sung 16 Bit Games
*************************************************************************/
typedef struct _yunsun16_state yunsun16_state;
struct _yunsun16_state
{
/* memory pointers */
UINT16 * vram_0;
UINT16 * vram_1;
UINT16 * scrollram_0;
UINT16 * scrollram_1;
UINT16 * priorityram;
// UINT16 * paletteram16; // currently this uses generic palette handling
UINT16 * spriteram16;
/* other video-related elements */
tilemap *tilemap_0, *tilemap_1;
int sprites_scrolldx, sprites_scrolldy;
};
/* defined in video/yunsun16.c */
WRITE16_HANDLER( yunsun16_vram_0_w );
WRITE16_HANDLER( yunsun16_vram_1_w );
VIDEO_START( yunsun16 );
VIDEO_UPDATE( yunsun16 );

View File

@ -0,0 +1,23 @@
/*************************************************************************
Zero Zone
*************************************************************************/
typedef struct _zerozone_state zerozone_state;
struct _zerozone_state
{
/* memory pointers */
UINT16 * videoram;
// UINT16 * paletteram16; // currently this uses generic palette handling
/* video-related */
UINT16 tilebank;
tilemap *zz_tilemap;
};
WRITE16_HANDLER( zerozone_tilemap_w );
WRITE16_HANDLER( zerozone_tilebank_w );
VIDEO_START( zerozone );
VIDEO_UPDATE( zerozone );

View File

@ -1,17 +1,10 @@
#include "driver.h"
#include "blktiger.h"
UINT8 *blktiger_txvideoram;
#define BGRAM_BANK_SIZE 0x1000
#define BGRAM_BANKS 4
static UINT32 blktiger_scroll_bank;
static UINT8 *scroll_ram;
static UINT8 screen_layout;
static UINT8 chon,objon,bgon;
static tilemap *tx_tilemap,*bg_tilemap8x4,*bg_tilemap4x8;
/***************************************************************************
@ -33,6 +26,7 @@ static TILEMAP_MAPPER( bg4x8_scan )
static TILE_GET_INFO( get_bg_tile_info )
{
blktiger_state *state = (blktiger_state *)machine->driver_data;
/* the tile priority table is a guess compiled by looking at the game. It
was not derived from a PROM so it could be wrong. */
static const UINT8 split_table[16] =
@ -42,11 +36,11 @@ static TILE_GET_INFO( get_bg_tile_info )
0,0,0,0,
0,0,0,0
};
UINT8 attr = scroll_ram[2*tile_index + 1];
UINT8 attr = state->scroll_ram[2 * tile_index + 1];
int color = (attr & 0x78) >> 3;
SET_TILE_INFO(
1,
scroll_ram[2*tile_index] + ((attr & 0x07) << 8),
state->scroll_ram[2 * tile_index] + ((attr & 0x07) << 8),
color,
(attr & 0x80) ? TILE_FLIPX : 0);
tileinfo->group = split_table[color];
@ -54,10 +48,11 @@ static TILE_GET_INFO( get_bg_tile_info )
static TILE_GET_INFO( get_tx_tile_info )
{
UINT8 attr = blktiger_txvideoram[tile_index + 0x400];
blktiger_state *state = (blktiger_state *)machine->driver_data;
UINT8 attr = state->txvideoram[tile_index + 0x400];
SET_TILE_INFO(
0,
blktiger_txvideoram[tile_index] + ((attr & 0xe0) << 3),
state->txvideoram[tile_index] + ((attr & 0xe0) << 3),
attr & 0x1f,
0);
}
@ -71,29 +66,26 @@ static TILE_GET_INFO( get_tx_tile_info )
VIDEO_START( blktiger )
{
scroll_ram = auto_alloc_array(machine, UINT8, BGRAM_BANK_SIZE * BGRAM_BANKS);
blktiger_state *state = (blktiger_state *)machine->driver_data;
tx_tilemap = tilemap_create(machine, get_tx_tile_info,tilemap_scan_rows,8,8,32,32);
bg_tilemap8x4 = tilemap_create(machine, get_bg_tile_info,bg8x4_scan, 16,16,128,64);
bg_tilemap4x8 = tilemap_create(machine, get_bg_tile_info,bg4x8_scan, 16,16,64,128);
state->scroll_ram = auto_alloc_array(machine, UINT8, BGRAM_BANK_SIZE * BGRAM_BANKS);
tilemap_set_transparent_pen(tx_tilemap,3);
state->tx_tilemap = tilemap_create(machine, get_tx_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
state->bg_tilemap8x4 = tilemap_create(machine, get_bg_tile_info, bg8x4_scan, 16, 16, 128, 64);
state->bg_tilemap4x8 = tilemap_create(machine, get_bg_tile_info, bg4x8_scan, 16, 16, 64, 128);
tilemap_set_transmask(bg_tilemap8x4,0,0xffff,0x8000); /* split type 0 is totally transparent in front half */
tilemap_set_transmask(bg_tilemap8x4,1,0xfff0,0x800f); /* split type 1 has pens 4-15 transparent in front half */
tilemap_set_transmask(bg_tilemap8x4,2,0xff00,0x80ff); /* split type 1 has pens 8-15 transparent in front half */
tilemap_set_transmask(bg_tilemap8x4,3,0xf000,0x8fff); /* split type 1 has pens 12-15 transparent in front half */
tilemap_set_transmask(bg_tilemap4x8,0,0xffff,0x8000);
tilemap_set_transmask(bg_tilemap4x8,1,0xfff0,0x800f);
tilemap_set_transmask(bg_tilemap4x8,2,0xff00,0x80ff);
tilemap_set_transmask(bg_tilemap4x8,3,0xf000,0x8fff);
tilemap_set_transparent_pen(state->tx_tilemap, 3);
state_save_register_global(machine, blktiger_scroll_bank);
state_save_register_global(machine, screen_layout);
state_save_register_global(machine, chon);
state_save_register_global(machine, objon);
state_save_register_global(machine, bgon);
state_save_register_global_pointer(machine, scroll_ram, BGRAM_BANK_SIZE * BGRAM_BANKS);
tilemap_set_transmask(state->bg_tilemap8x4, 0, 0xffff, 0x8000); /* split type 0 is totally transparent in front half */
tilemap_set_transmask(state->bg_tilemap8x4, 1, 0xfff0, 0x800f); /* split type 1 has pens 4-15 transparent in front half */
tilemap_set_transmask(state->bg_tilemap8x4, 2, 0xff00, 0x80ff); /* split type 1 has pens 8-15 transparent in front half */
tilemap_set_transmask(state->bg_tilemap8x4, 3, 0xf000, 0x8fff); /* split type 1 has pens 12-15 transparent in front half */
tilemap_set_transmask(state->bg_tilemap4x8, 0, 0xffff, 0x8000);
tilemap_set_transmask(state->bg_tilemap4x8, 1, 0xfff0, 0x800f);
tilemap_set_transmask(state->bg_tilemap4x8, 2, 0xff00, 0x80ff);
tilemap_set_transmask(state->bg_tilemap4x8, 3, 0xf000, 0x8fff);
state_save_register_global_pointer(machine, state->scroll_ram, BGRAM_BANK_SIZE * BGRAM_BANKS);
}
@ -106,55 +98,60 @@ VIDEO_START( blktiger )
WRITE8_HANDLER( blktiger_txvideoram_w )
{
blktiger_txvideoram[offset] = data;
tilemap_mark_tile_dirty(tx_tilemap,offset & 0x3ff);
blktiger_state *state = (blktiger_state *)space->machine->driver_data;
state->txvideoram[offset] = data;
tilemap_mark_tile_dirty(state->tx_tilemap,offset & 0x3ff);
}
READ8_HANDLER( blktiger_bgvideoram_r )
{
return scroll_ram[offset + blktiger_scroll_bank];
blktiger_state *state = (blktiger_state *)space->machine->driver_data;
return state->scroll_ram[offset + state->scroll_bank];
}
WRITE8_HANDLER( blktiger_bgvideoram_w )
{
offset += blktiger_scroll_bank;
blktiger_state *state = (blktiger_state *)space->machine->driver_data;
offset += state->scroll_bank;
scroll_ram[offset] = data;
tilemap_mark_tile_dirty(bg_tilemap8x4,offset/2);
tilemap_mark_tile_dirty(bg_tilemap4x8,offset/2);
state->scroll_ram[offset] = data;
tilemap_mark_tile_dirty(state->bg_tilemap8x4, offset / 2);
tilemap_mark_tile_dirty(state->bg_tilemap4x8, offset / 2);
}
WRITE8_HANDLER( blktiger_bgvideoram_bank_w )
{
blktiger_scroll_bank = (data % BGRAM_BANKS) * BGRAM_BANK_SIZE;
blktiger_state *state = (blktiger_state *)space->machine->driver_data;
state->scroll_bank = (data % BGRAM_BANKS) * BGRAM_BANK_SIZE;
}
WRITE8_HANDLER( blktiger_scrolly_w )
{
static UINT8 scroll[2];
blktiger_state *state = (blktiger_state *)space->machine->driver_data;
int scrolly;
scroll[offset] = data;
scrolly = scroll[0] | (scroll[1] << 8);
tilemap_set_scrolly(bg_tilemap8x4,0,scrolly);
tilemap_set_scrolly(bg_tilemap4x8,0,scrolly);
state->scroll_y[offset] = data;
scrolly = state->scroll_y[0] | (state->scroll_y[1] << 8);
tilemap_set_scrolly(state->bg_tilemap8x4, 0, scrolly);
tilemap_set_scrolly(state->bg_tilemap4x8, 0, scrolly);
}
WRITE8_HANDLER( blktiger_scrollx_w )
{
static UINT8 scroll[2];
blktiger_state *state = (blktiger_state *)space->machine->driver_data;
int scrollx;
scroll[offset] = data;
scrollx = scroll[0] | (scroll[1] << 8);
tilemap_set_scrollx(bg_tilemap8x4,0,scrollx);
tilemap_set_scrollx(bg_tilemap4x8,0,scrollx);
state->scroll_x[offset] = data;
scrollx = state->scroll_x[0] | (state->scroll_x[1] << 8);
tilemap_set_scrollx(state->bg_tilemap8x4, 0, scrollx);
tilemap_set_scrollx(state->bg_tilemap4x8, 0, scrollx);
}
WRITE8_HANDLER( blktiger_video_control_w )
{
blktiger_state *state = (blktiger_state *)space->machine->driver_data;
/* bits 0 and 1 are coin counters */
coin_counter_w(0,data & 1);
coin_counter_w(1,data & 2);
@ -166,24 +163,27 @@ WRITE8_HANDLER( blktiger_video_control_w )
flip_screen_set(space->machine, data & 0x40);
/* bit 7 enables characters? Just a guess */
chon = ~data & 0x80;
state->chon = ~data & 0x80;
}
WRITE8_HANDLER( blktiger_video_enable_w )
{
blktiger_state *state = (blktiger_state *)space->machine->driver_data;
/* not sure which is which, but I think that bit 1 and 2 enable background and sprites */
/* bit 1 enables bg ? */
bgon = ~data & 0x02;
state->bgon = ~data & 0x02;
/* bit 2 enables sprites ? */
objon = ~data & 0x04;
state->objon = ~data & 0x04;
}
WRITE8_HANDLER( blktiger_screen_layout_w )
{
screen_layout = data;
tilemap_set_enable(bg_tilemap8x4, screen_layout);
tilemap_set_enable(bg_tilemap4x8,!screen_layout);
blktiger_state *state = (blktiger_state *)space->machine->driver_data;
state->screen_layout = data;
tilemap_set_enable(state->bg_tilemap8x4, state->screen_layout);
tilemap_set_enable(state->bg_tilemap4x8, !state->screen_layout);
}
@ -194,8 +194,9 @@ WRITE8_HANDLER( blktiger_screen_layout_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 )
{
// blktiger_state *state = (blktiger_state *)machine->driver_data;
int offs;
/* Draw the sprites. */
@ -225,19 +226,21 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
VIDEO_UPDATE( blktiger )
{
bitmap_fill(bitmap,cliprect,1023);
blktiger_state *state = (blktiger_state *)screen->machine->driver_data;
if (bgon)
tilemap_draw(bitmap,cliprect,screen_layout ? bg_tilemap8x4 : bg_tilemap4x8,TILEMAP_DRAW_LAYER1,0);
bitmap_fill(bitmap, cliprect, 1023);
if (objon)
draw_sprites(screen->machine, bitmap,cliprect);
if (state->bgon)
tilemap_draw(bitmap, cliprect, state->screen_layout ? state->bg_tilemap8x4 : state->bg_tilemap4x8, TILEMAP_DRAW_LAYER1, 0);
if (bgon)
tilemap_draw(bitmap,cliprect,screen_layout ? bg_tilemap8x4 : bg_tilemap4x8,TILEMAP_DRAW_LAYER0,0);
if (state->objon)
draw_sprites(screen->machine, bitmap, cliprect);
if (chon)
tilemap_draw(bitmap,cliprect,tx_tilemap,0,0);
if (state->bgon)
tilemap_draw(bitmap, cliprect, state->screen_layout ? state->bg_tilemap8x4 : state->bg_tilemap4x8, TILEMAP_DRAW_LAYER0, 0);
if (state->chon)
tilemap_draw(bitmap, cliprect, state->tx_tilemap, 0, 0);
return 0;
}

View File

@ -1,8 +1,6 @@
#include "driver.h"
#include "bogeyman.h"
UINT8 *bogeyman_videoram2, *bogeyman_colorram2;
static tilemap *bg_tilemap, *fg_tilemap;
PALETTE_INIT( bogeyman )
{
@ -10,9 +8,9 @@ PALETTE_INIT( bogeyman )
/* first 16 colors are RAM */
for (i = 0;i < 256;i++)
for (i = 0; i < 256; i++)
{
int bit0,bit1,bit2,r,g,b;
int bit0, bit1, bit2, r, g, b;
/* red component */
bit0 = (color_prom[0] >> 0) & 0x01;
@ -32,33 +30,41 @@ PALETTE_INIT( bogeyman )
bit2 = (color_prom[256] >> 3) & 0x01;
b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette_set_color(machine,i+16,MAKE_RGB(r,g,b));
palette_set_color(machine, i + 16, MAKE_RGB(r,g,b));
color_prom++;
}
}
WRITE8_HANDLER( bogeyman_videoram_w )
{
videoram[offset] = data;
tilemap_mark_tile_dirty(bg_tilemap, offset);
bogeyman_state *state = (bogeyman_state *)space->machine->driver_data;
state->videoram[offset] = data;
tilemap_mark_tile_dirty(state->bg_tilemap, offset);
}
WRITE8_HANDLER( bogeyman_colorram_w )
{
colorram[offset] = data;
tilemap_mark_tile_dirty(bg_tilemap, offset);
bogeyman_state *state = (bogeyman_state *)space->machine->driver_data;
state->colorram[offset] = data;
tilemap_mark_tile_dirty(state->bg_tilemap, offset);
}
WRITE8_HANDLER( bogeyman_videoram2_w )
{
bogeyman_videoram2[offset] = data;
tilemap_mark_tile_dirty(fg_tilemap, offset);
bogeyman_state *state = (bogeyman_state *)space->machine->driver_data;
state->videoram2[offset] = data;
tilemap_mark_tile_dirty(state->fg_tilemap, offset);
}
WRITE8_HANDLER( bogeyman_colorram2_w )
{
bogeyman_colorram2[offset] = data;
tilemap_mark_tile_dirty(fg_tilemap, offset);
bogeyman_state *state = (bogeyman_state *)space->machine->driver_data;
state->colorram2[offset] = data;
tilemap_mark_tile_dirty(state->fg_tilemap, offset);
}
WRITE8_HANDLER( bogeyman_paletteram_w )
@ -69,9 +75,10 @@ WRITE8_HANDLER( bogeyman_paletteram_w )
static TILE_GET_INFO( get_bg_tile_info )
{
int attr = colorram[tile_index];
int gfxbank = ((((attr & 0x01) << 8) + videoram[tile_index]) / 0x80) + 3;
int code = videoram[tile_index] & 0x7f;
bogeyman_state *state = (bogeyman_state *)machine->driver_data;
int attr = state->colorram[tile_index];
int gfxbank = ((((attr & 0x01) << 8) + state->videoram[tile_index]) / 0x80) + 3;
int code = state->videoram[tile_index] & 0x7f;
int color = (attr >> 1) & 0x07;
SET_TILE_INFO(gfxbank, code, color, 0);
@ -79,8 +86,9 @@ static TILE_GET_INFO( get_bg_tile_info )
static TILE_GET_INFO( get_fg_tile_info )
{
int attr = bogeyman_colorram2[tile_index];
int tile = bogeyman_videoram2[tile_index] | ((attr & 0x03) << 8);
bogeyman_state *state = (bogeyman_state *)machine->driver_data;
int attr = state->colorram2[tile_index];
int tile = state->videoram2[tile_index] | ((attr & 0x03) << 8);
int gfxbank = tile / 0x200;
int code = tile & 0x1ff;
@ -89,31 +97,30 @@ static TILE_GET_INFO( get_fg_tile_info )
VIDEO_START( bogeyman )
{
bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows,
16, 16, 16, 16);
bogeyman_state *state = (bogeyman_state *)machine->driver_data;
state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 16, 16, 16, 16);
state->fg_tilemap = tilemap_create(machine, get_fg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
fg_tilemap = tilemap_create(machine, get_fg_tile_info, tilemap_scan_rows,
8, 8, 32, 32);
tilemap_set_transparent_pen(fg_tilemap, 0);
tilemap_set_transparent_pen(state->fg_tilemap, 0);
}
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 )
{
bogeyman_state *state = (bogeyman_state *)machine->driver_data;
int offs;
for (offs = 0; offs < spriteram_size; offs += 4)
{
int attr = spriteram[offs];
int attr = state->spriteram[offs];
if (attr & 0x01)
{
int code = spriteram[offs + 1] + ((attr & 0x40) << 2);
int code = state->spriteram[offs + 1] + ((attr & 0x40) << 2);
int color = (attr & 0x08) >> 3;
int flipx = !(attr & 0x04);
int flipy = attr & 0x02;
int sx = spriteram[offs + 3];
int sy = (240 - spriteram[offs + 2]) & 0xff;
int sx = state->spriteram[offs + 3];
int sy = (240 - state->spriteram[offs + 2]) & 0xff;
int multi = attr & 0x10;
if (multi) sy -= 16;
@ -146,8 +153,10 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
VIDEO_UPDATE( bogeyman )
{
tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
bogeyman_state *state = (bogeyman_state *)screen->machine->driver_data;
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
draw_sprites(screen->machine, bitmap, cliprect);
tilemap_draw(bitmap, cliprect, fg_tilemap, 0, 0);
tilemap_draw(bitmap, cliprect, state->fg_tilemap, 0, 0);
return 0;
}

View File

@ -7,29 +7,30 @@
***************************************************************************/
#include "driver.h"
static UINT8 background_image;
static tilemap *fg_tilemap, *bg_tilemap;
#include "bombjack.h"
WRITE8_HANDLER( bombjack_videoram_w )
{
videoram[offset] = data;
tilemap_mark_tile_dirty(fg_tilemap, offset);
bombjack_state *state = (bombjack_state *)space->machine->driver_data;
state->videoram[offset] = data;
tilemap_mark_tile_dirty(state->fg_tilemap, offset);
}
WRITE8_HANDLER( bombjack_colorram_w )
{
colorram[offset] = data;
tilemap_mark_tile_dirty(fg_tilemap, offset);
bombjack_state *state = (bombjack_state *)space->machine->driver_data;
state->colorram[offset] = data;
tilemap_mark_tile_dirty(state->fg_tilemap, offset);
}
WRITE8_HANDLER( bombjack_background_w )
{
if (background_image != data)
bombjack_state *state = (bombjack_state *)space->machine->driver_data;
if (state->background_image != data)
{
background_image = data;
tilemap_mark_all_tiles_dirty(bg_tilemap);
state->background_image = data;
tilemap_mark_all_tiles_dirty(state->bg_tilemap);
}
}
@ -44,10 +45,11 @@ WRITE8_HANDLER( bombjack_flipscreen_w )
static TILE_GET_INFO( get_bg_tile_info )
{
bombjack_state *state = (bombjack_state *)machine->driver_data;
UINT8 *tilerom = memory_region(machine, "gfx4");
int offs = (background_image & 0x07) * 0x200 + tile_index;
int code = (background_image & 0x10) ? tilerom[offs] : 0;
int offs = (state->background_image & 0x07) * 0x200 + tile_index;
int code = (state->background_image & 0x10) ? tilerom[offs] : 0;
int attr = tilerom[offs + 0x100];
int color = attr & 0x0f;
int flags = (attr & 0x80) ? TILE_FLIPY : 0;
@ -57,27 +59,25 @@ static TILE_GET_INFO( get_bg_tile_info )
static TILE_GET_INFO( get_fg_tile_info )
{
int code = videoram[tile_index] + 16 * (colorram[tile_index] & 0x10);
int color = colorram[tile_index] & 0x0f;
bombjack_state *state = (bombjack_state *)machine->driver_data;
int code = state->videoram[tile_index] + 16 * (state->colorram[tile_index] & 0x10);
int color = state->colorram[tile_index] & 0x0f;
SET_TILE_INFO(0, code, color, 0);
}
VIDEO_START( bombjack )
{
bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows,
16, 16, 16, 16);
bombjack_state *state = (bombjack_state *)machine->driver_data;
state->bg_tilemap = tilemap_create(machine, get_bg_tile_info, tilemap_scan_rows, 16, 16, 16, 16);
state->fg_tilemap = tilemap_create(machine, get_fg_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
fg_tilemap = tilemap_create(machine, get_fg_tile_info, tilemap_scan_rows,
8, 8, 32, 32);
tilemap_set_transparent_pen(fg_tilemap, 0);
state_save_register_global(machine, background_image);
tilemap_set_transparent_pen(state->fg_tilemap, 0);
}
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 )
{
bombjack_state *state = (bombjack_state *)machine->driver_data;
int offs;
for (offs = spriteram_size - 4; offs >= 0; offs -= 4)
@ -99,16 +99,19 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
int sx,sy,flipx,flipy;
sx = spriteram[offs+3];
if (spriteram[offs] & 0x80)
sy = 225-spriteram[offs+2];
sx = state->spriteram[offs + 3];
if (state->spriteram[offs] & 0x80)
sy = 225 - state->spriteram[offs + 2];
else
sy = 241-spriteram[offs+2];
flipx = spriteram[offs+1] & 0x40;
flipy = spriteram[offs+1] & 0x80;
sy = 241 - state->spriteram[offs + 2];
flipx = state->spriteram[offs + 1] & 0x40;
flipy = state->spriteram[offs + 1] & 0x80;
if (flip_screen_get(machine))
{
if (spriteram[offs+1] & 0x20)
if (state->spriteram[offs + 1] & 0x20)
{
sx = 224 - sx;
sy = 224 - sy;
@ -122,9 +125,9 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
flipy = !flipy;
}
drawgfx_transpen(bitmap,cliprect,machine->gfx[(spriteram[offs] & 0x80) ? 3 : 2],
spriteram[offs] & 0x7f,
spriteram[offs+1] & 0x0f,
drawgfx_transpen(bitmap,cliprect,machine->gfx[(state->spriteram[offs] & 0x80) ? 3 : 2],
state->spriteram[offs] & 0x7f,
state->spriteram[offs + 1] & 0x0f,
flipx,flipy,
sx,sy,0);
}
@ -132,8 +135,9 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
VIDEO_UPDATE( bombjack )
{
tilemap_draw(bitmap, cliprect, bg_tilemap, 0, 0);
tilemap_draw(bitmap, cliprect, fg_tilemap, 0, 0);
bombjack_state *state = (bombjack_state *)screen->machine->driver_data;
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
tilemap_draw(bitmap, cliprect, state->fg_tilemap, 0, 0);
draw_sprites(screen->machine, bitmap, cliprect);
return 0;
}

View File

@ -2,19 +2,6 @@
#include "dogfgt.h"
UINT8 *dogfgt_bgvideoram;
static UINT8 *bitmapram;
static int bm_plane;
static bitmap_t *pixbitmap;
static int pixcolor;
static tilemap *bg_tilemap;
#define PIXMAP_COLOR_BASE (16+32)
#define BITMAPRAM_SIZE 0x6000
/***************************************************************************
Convert the color PROMs into a more useable format.
@ -29,11 +16,9 @@ PALETTE_INIT( dogfgt )
int i;
/* first 16 colors are RAM */
for (i = 0;i < 64;i++)
for (i = 0; i < 64; i++)
{
int bit0,bit1,bit2,r,g,b;
int bit0, bit1, bit2, r, g, b;
/* red component */
bit0 = (*color_prom >> 0) & 0x01;
@ -51,7 +36,7 @@ PALETTE_INIT( dogfgt )
bit2 = (*color_prom >> 7) & 0x01;
b = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2;
palette_set_color(machine,i+16,MAKE_RGB(r,g,b));
palette_set_color(machine, i + 16, MAKE_RGB(r,g,b));
color_prom++;
}
}
@ -65,10 +50,11 @@ PALETTE_INIT( dogfgt )
static TILE_GET_INFO( get_tile_info )
{
dogfgt_state *state = (dogfgt_state *)machine->driver_data;
SET_TILE_INFO(
0,
dogfgt_bgvideoram[tile_index],
dogfgt_bgvideoram[tile_index + 0x400] & 0x03,
state->bgvideoram[tile_index],
state->bgvideoram[tile_index + 0x400] & 0x03,
0);
}
@ -81,11 +67,14 @@ static TILE_GET_INFO( get_tile_info )
VIDEO_START( dogfgt )
{
bg_tilemap = tilemap_create(machine, get_tile_info,tilemap_scan_rows,16,16,32,32);
dogfgt_state *state = (dogfgt_state *)machine->driver_data;
state->bg_tilemap = tilemap_create(machine, get_tile_info, tilemap_scan_rows, 16, 16, 32, 32);
bitmapram = auto_alloc_array(machine, UINT8, BITMAPRAM_SIZE);
state->bitmapram = auto_alloc_array(machine, UINT8, BITMAPRAM_SIZE);
state_save_register_global_pointer(machine, state->bitmapram, BITMAPRAM_SIZE);
pixbitmap = video_screen_auto_bitmap_alloc(machine->primary_screen);
state->pixbitmap = video_screen_auto_bitmap_alloc(machine->primary_screen);
state_save_register_global_bitmap(machine, state->pixbitmap);
}
@ -97,85 +86,95 @@ VIDEO_START( dogfgt )
WRITE8_HANDLER( dogfgt_plane_select_w )
{
bm_plane = data;
dogfgt_state *state = (dogfgt_state *)space->machine->driver_data;
state->bm_plane = data;
}
READ8_HANDLER( dogfgt_bitmapram_r )
{
if (bm_plane > 2)
dogfgt_state *state = (dogfgt_state *)space->machine->driver_data;
if (state->bm_plane > 2)
{
popmessage("bitmapram_r offs %04x plane %d\n",offset,bm_plane);
popmessage("bitmapram_r offs %04x plane %d\n", offset, state->bm_plane);
return 0;
}
return bitmapram[offset + BITMAPRAM_SIZE/3 * bm_plane];
return state->bitmapram[offset + BITMAPRAM_SIZE / 3 * state->bm_plane];
}
static WRITE8_HANDLER( internal_bitmapram_w )
{
int x,y,subx;
dogfgt_state *state = (dogfgt_state *)space->machine->driver_data;
int x, y, subx;
state->bitmapram[offset] = data;
bitmapram[offset] = data;
offset &= (BITMAPRAM_SIZE/3-1);
offset &= (BITMAPRAM_SIZE / 3 - 1);
x = 8 * (offset / 256);
y = offset % 256;
for (subx = 0;subx < 8;subx++)
for (subx = 0; subx < 8; subx++)
{
int i,color = 0;
int i, color = 0;
for (i = 0; i < 3; i++)
color |= ((state->bitmapram[offset + BITMAPRAM_SIZE / 3 * i] >> subx) & 1) << i;
for (i = 0;i < 3;i++)
color |= ((bitmapram[offset + BITMAPRAM_SIZE/3 * i] >> subx) & 1) << i;
if (flip_screen_get(space->machine))
*BITMAP_ADDR16(pixbitmap, y^0xff, (x+subx)^0xff) = PIXMAP_COLOR_BASE + 8*pixcolor + color;
*BITMAP_ADDR16(state->pixbitmap, y ^ 0xff, (x + subx) ^ 0xff) = PIXMAP_COLOR_BASE + 8 * state->pixcolor + color;
else
*BITMAP_ADDR16(pixbitmap, y, x+subx) = PIXMAP_COLOR_BASE + 8*pixcolor + color;
*BITMAP_ADDR16(state->pixbitmap, y, x + subx) = PIXMAP_COLOR_BASE + 8 * state->pixcolor + color;
}
}
WRITE8_HANDLER( dogfgt_bitmapram_w )
{
if (bm_plane > 2)
dogfgt_state *state = (dogfgt_state *)space->machine->driver_data;
if (state->bm_plane > 2)
{
popmessage("bitmapram_w offs %04x plane %d\n",offset,bm_plane);
popmessage("bitmapram_w offs %04x plane %d\n", offset, state->bm_plane);
return;
}
internal_bitmapram_w(space,offset + BITMAPRAM_SIZE/3 * bm_plane,data);
internal_bitmapram_w(space, offset + BITMAPRAM_SIZE / 3 * state->bm_plane, data);
}
WRITE8_HANDLER( dogfgt_bgvideoram_w )
{
dogfgt_bgvideoram[offset] = data;
tilemap_mark_tile_dirty(bg_tilemap,offset & 0x3ff);
dogfgt_state *state = (dogfgt_state *)space->machine->driver_data;
state->bgvideoram[offset] = data;
tilemap_mark_tile_dirty(state->bg_tilemap, offset & 0x3ff);
}
WRITE8_HANDLER( dogfgt_scroll_w )
{
static int scroll[4];
dogfgt_state *state = (dogfgt_state *)space->machine->driver_data;
scroll[offset] = data;
tilemap_set_scrollx(bg_tilemap,0,scroll[0] + 256 * scroll[1] + 256);
tilemap_set_scrolly(bg_tilemap,0,scroll[2] + 256 * scroll[3]);
state->scroll[offset] = data;
tilemap_set_scrollx(state->bg_tilemap, 0, state->scroll[0] + 256 * state->scroll[1] + 256);
tilemap_set_scrolly(state->bg_tilemap, 0, state->scroll[2] + 256 * state->scroll[3]);
}
WRITE8_HANDLER( dogfgt_1800_w )
{
dogfgt_state *state = (dogfgt_state *)space->machine->driver_data;
/* bits 0 and 1 are probably text color (not verified because PROM is missing) */
pixcolor = ((data & 0x01) << 1) | ((data & 0x02) >> 1);
state->pixcolor = ((data & 0x01) << 1) | ((data & 0x02) >> 1);
/* bits 4 and 5 are coin counters */
coin_counter_w(0,data & 0x10);
coin_counter_w(1,data & 0x20);
coin_counter_w(0, data & 0x10);
coin_counter_w(1, data & 0x20);
/* bit 7 is screen flip */
flip_screen_set(space->machine, data & 0x80);
/* other bits unused? */
logerror("PC %04x: 1800 = %02x\n",cpu_get_pc(space->cpu),data);
logerror("PC %04x: 1800 = %02x\n", cpu_get_pc(space->cpu), data);
}
@ -185,20 +184,21 @@ WRITE8_HANDLER( dogfgt_1800_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 )
{
dogfgt_state *state = (dogfgt_state *)machine->driver_data;
int offs;
for (offs = 0;offs < spriteram_size;offs += 4)
for (offs = 0; offs < spriteram_size; offs += 4)
{
if (spriteram[offs] & 0x01)
if (state->spriteram[offs] & 0x01)
{
int sx,sy,flipx,flipy;
int sx, sy, flipx, flipy;
sx = spriteram[offs+3];
sy = (240 - spriteram[offs+2]) & 0xff;
flipx = spriteram[offs] & 0x04;
flipy = spriteram[offs] & 0x02;
sx = state->spriteram[offs + 3];
sy = (240 - state->spriteram[offs + 2]) & 0xff;
flipx = state->spriteram[offs] & 0x04;
flipy = state->spriteram[offs] & 0x02;
if (flip_screen_get(machine))
{
sx = 240 - sx;
@ -208,8 +208,8 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan
}
drawgfx_transpen(bitmap,cliprect,machine->gfx[1],
spriteram[offs+1] + ((spriteram[offs] & 0x30) << 4),
(spriteram[offs] & 0x08) >> 3,
state->spriteram[offs + 1] + ((state->spriteram[offs] & 0x30) << 4),
(state->spriteram[offs] & 0x08) >> 3,
flipx,flipy,
sx,sy,0);
}
@ -219,26 +219,25 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan
VIDEO_UPDATE( dogfgt )
{
static int lastflip,lastpixcolor;
dogfgt_state *state = (dogfgt_state *)screen->machine->driver_data;
int offs;
if (lastflip != flip_screen_get(screen->machine) || lastpixcolor != pixcolor)
if (state->lastflip != flip_screen_get(screen->machine) || state->lastpixcolor != state->pixcolor)
{
const address_space *space = cputag_get_address_space(screen->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
lastflip = flip_screen_get(screen->machine);
lastpixcolor = pixcolor;
state->lastflip = flip_screen_get(screen->machine);
state->lastpixcolor = state->pixcolor;
for (offs = 0;offs < BITMAPRAM_SIZE;offs++)
internal_bitmapram_w(space,offs,bitmapram[offs]);
for (offs = 0; offs < BITMAPRAM_SIZE; offs++)
internal_bitmapram_w(space, offs, state->bitmapram[offs]);
}
tilemap_draw(bitmap,cliprect,bg_tilemap,0,0);
tilemap_draw(bitmap, cliprect, state->bg_tilemap, 0, 0);
draw_sprites(screen->machine, bitmap, cliprect);
copybitmap_trans(bitmap,pixbitmap,0,0,0,0,cliprect,PIXMAP_COLOR_BASE + 8*pixcolor);
copybitmap_trans(bitmap, state->pixbitmap, 0, 0, 0, 0, cliprect, PIXMAP_COLOR_BASE + 8 * state->pixcolor);
return 0;
}

View File

@ -21,12 +21,7 @@
***************************************************************************/
#include "driver.h"
/* Variables that driver has access to: */
UINT16 *yunsun16_vram_0, *yunsun16_vram_1;
UINT16 *yunsun16_scroll_0, *yunsun16_scroll_1;
UINT16 *yunsun16_priority;
#include "yunsun16.h"
/***************************************************************************
@ -37,8 +32,6 @@ UINT16 *yunsun16_priority;
***************************************************************************/
static tilemap *tilemap_0, *tilemap_1;
#define TMAP_GFX (0)
#define TILES_PER_PAGE_X (0x10)
#define TILES_PER_PAGE_Y (0x10)
@ -56,8 +49,9 @@ static TILEMAP_MAPPER( yunsun16_tilemap_scan_pages )
static TILE_GET_INFO( get_tile_info_0 )
{
UINT16 code = yunsun16_vram_0[ 2 * tile_index + 0 ];
UINT16 attr = yunsun16_vram_0[ 2 * tile_index + 1 ];
yunsun16_state *state = (yunsun16_state *)machine->driver_data;
UINT16 code = state->vram_0[2 * tile_index + 0];
UINT16 attr = state->vram_0[2 * tile_index + 1];
SET_TILE_INFO(
TMAP_GFX,
code,
@ -67,8 +61,9 @@ static TILE_GET_INFO( get_tile_info_0 )
static TILE_GET_INFO( get_tile_info_1 )
{
UINT16 code = yunsun16_vram_1[ 2 * tile_index + 0 ];
UINT16 attr = yunsun16_vram_1[ 2 * tile_index + 1 ];
yunsun16_state *state = (yunsun16_state *)machine->driver_data;
UINT16 code = state->vram_1[2 * tile_index + 0];
UINT16 attr = state->vram_1[2 * tile_index + 1];
SET_TILE_INFO(
TMAP_GFX,
code,
@ -78,14 +73,18 @@ static TILE_GET_INFO( get_tile_info_1 )
WRITE16_HANDLER( yunsun16_vram_0_w )
{
COMBINE_DATA(&yunsun16_vram_0[offset]);
tilemap_mark_tile_dirty(tilemap_0,offset/2);
yunsun16_state *state = (yunsun16_state *)space->machine->driver_data;
COMBINE_DATA(&state->vram_0[offset]);
tilemap_mark_tile_dirty(state->tilemap_0, offset / 2);
}
WRITE16_HANDLER( yunsun16_vram_1_w )
{
COMBINE_DATA(&yunsun16_vram_1[offset]);
tilemap_mark_tile_dirty(tilemap_1,offset/2);
yunsun16_state *state = (yunsun16_state *)space->machine->driver_data;
COMBINE_DATA(&state->vram_1[offset]);
tilemap_mark_tile_dirty(state->tilemap_1, offset / 2);
}
@ -97,30 +96,26 @@ WRITE16_HANDLER( yunsun16_vram_1_w )
***************************************************************************/
static int sprites_scrolldx, sprites_scrolldy;
VIDEO_START( yunsun16 )
{
tilemap_0 = tilemap_create( machine, get_tile_info_0,yunsun16_tilemap_scan_pages,
yunsun16_state *state = (yunsun16_state *)machine->driver_data;
16,16,
TILES_PER_PAGE_X*PAGES_PER_TMAP_X,TILES_PER_PAGE_Y*PAGES_PER_TMAP_Y);
state->tilemap_0 = tilemap_create(machine, get_tile_info_0,yunsun16_tilemap_scan_pages,
16,16, TILES_PER_PAGE_X*PAGES_PER_TMAP_X,TILES_PER_PAGE_Y*PAGES_PER_TMAP_Y);
state->tilemap_1 = tilemap_create(machine, get_tile_info_1,yunsun16_tilemap_scan_pages,
16,16, TILES_PER_PAGE_X*PAGES_PER_TMAP_X,TILES_PER_PAGE_Y*PAGES_PER_TMAP_Y);
tilemap_1 = tilemap_create( machine, get_tile_info_1,yunsun16_tilemap_scan_pages,
state_save_register_global(machine, state->sprites_scrolldx);
state_save_register_global(machine, state->sprites_scrolldy);
16,16,
TILES_PER_PAGE_X*PAGES_PER_TMAP_X,TILES_PER_PAGE_Y*PAGES_PER_TMAP_Y);
tilemap_set_scrolldx(state->tilemap_0, -0x34, 0);
tilemap_set_scrolldx(state->tilemap_1, -0x38, 0);
sprites_scrolldx = -0x40;
sprites_scrolldy = -0x0f;
tilemap_set_scrolldx(tilemap_0,-0x34,0);
tilemap_set_scrolldx(tilemap_1,-0x38,0);
tilemap_set_scrolldy(state->tilemap_0, -0x10, 0);
tilemap_set_scrolldy(state->tilemap_1, -0x10, 0);
tilemap_set_scrolldy(tilemap_0,-0x10,0);
tilemap_set_scrolldy(tilemap_1,-0x10,0);
tilemap_set_transparent_pen(tilemap_0,0xff);
tilemap_set_transparent_pen(tilemap_1,0xff);
tilemap_set_transparent_pen(state->tilemap_0, 0xff);
tilemap_set_transparent_pen(state->tilemap_1, 0xff);
}
@ -144,37 +139,43 @@ VIDEO_START( yunsun16 )
***************************************************************************/
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 )
{
yunsun16_state *state = (yunsun16_state *)machine->driver_data;
int offs;
const rectangle *visarea = video_screen_get_visible_area(machine->primary_screen);
int max_x = visarea->max_x+1;
int max_y = visarea->max_y+1;
int max_x = visarea->max_x + 1;
int max_y = visarea->max_y + 1;
int pri = *yunsun16_priority & 3;
int pri = *state->priorityram & 3;
int pri_mask;
switch( pri )
switch (pri)
{
case 1: pri_mask = (1<<1)|(1<<2)|(1<<3); break;
case 2: pri_mask = (1<<2)|(1<<3); break;
case 1:
pri_mask = (1 << 1) | (1 << 2) | (1 << 3);
break;
case 2:
pri_mask = (1 << 2) | (1 << 3);
break;
case 3:
default: pri_mask = 0;
default:
pri_mask = 0;
break;
}
for ( offs = (spriteram_size-8)/2 ; offs >= 0; offs -= 8/2 )
for (offs = (spriteram_size - 8) / 2 ; offs >= 0; offs -= 8 / 2)
{
int x = spriteram16[offs + 0];
int y = spriteram16[offs + 1];
int code = spriteram16[offs + 2];
int attr = spriteram16[offs + 3];
int flipx = attr & 0x20;
int flipy = attr & 0x40;
int x = state->spriteram16[offs + 0];
int y = state->spriteram16[offs + 1];
int code = state->spriteram16[offs + 2];
int attr = state->spriteram16[offs + 3];
int flipx = attr & 0x20;
int flipy = attr & 0x40;
x += sprites_scrolldx;
y += sprites_scrolldy;
x += state->sprites_scrolldx;
y += state->sprites_scrolldy;
if (flip_screen_get(machine)) // not used?
{
@ -182,13 +183,13 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan
flipy = !flipy; y = max_y - y - 16;
}
pdrawgfx_transpen( bitmap,cliprect,machine->gfx[1],
pdrawgfx_transpen(bitmap,cliprect,machine->gfx[1],
code,
attr & 0x1f,
flipx, flipy,
x,y,
machine->priority_bitmap,
pri_mask,15 );
pri_mask,15);
}
}
@ -204,31 +205,33 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap,const rectan
VIDEO_UPDATE( yunsun16 )
{
tilemap_set_scrollx(tilemap_0, 0, yunsun16_scroll_0[ 0 ]);
tilemap_set_scrolly(tilemap_0, 0, yunsun16_scroll_0[ 1 ]);
yunsun16_state *state = (yunsun16_state *)screen->machine->driver_data;
tilemap_set_scrollx(tilemap_1, 0, yunsun16_scroll_1[ 0 ]);
tilemap_set_scrolly(tilemap_1, 0, yunsun16_scroll_1[ 1 ]);
tilemap_set_scrollx(state->tilemap_0, 0, state->scrollram_0[0]);
tilemap_set_scrolly(state->tilemap_0, 0, state->scrollram_0[1]);
// popmessage("%04X", *yunsun16_priority);
tilemap_set_scrollx(state->tilemap_1, 0, state->scrollram_1[0]);
tilemap_set_scrolly(state->tilemap_1, 0, state->scrollram_1[1]);
bitmap_fill(screen->machine->priority_bitmap,cliprect,0);
//popmessage("%04X", *state->priorityram);
if((*yunsun16_priority & 0x0c) == 4)
bitmap_fill(screen->machine->priority_bitmap, cliprect, 0);
if ((*state->priorityram & 0x0c) == 4)
{
/* The color of the this layer's transparent pen goes below everything */
tilemap_draw(bitmap,cliprect,tilemap_0, TILEMAP_DRAW_OPAQUE, 0);
tilemap_draw(bitmap,cliprect,tilemap_0, 0, 1);
tilemap_draw(bitmap,cliprect,tilemap_1, 0, 2);
tilemap_draw(bitmap, cliprect, state->tilemap_0, TILEMAP_DRAW_OPAQUE, 0);
tilemap_draw(bitmap, cliprect, state->tilemap_0, 0, 1);
tilemap_draw(bitmap, cliprect, state->tilemap_1, 0, 2);
}
else if((*yunsun16_priority & 0x0c) == 8)
else if ((*state->priorityram & 0x0c) == 8)
{
/* The color of the this layer's transparent pen goes below everything */
tilemap_draw(bitmap,cliprect,tilemap_1, TILEMAP_DRAW_OPAQUE, 0);
tilemap_draw(bitmap,cliprect,tilemap_1, 0, 1);
tilemap_draw(bitmap,cliprect,tilemap_0, 0, 2);
tilemap_draw(bitmap, cliprect, state->tilemap_1, TILEMAP_DRAW_OPAQUE, 0);
tilemap_draw(bitmap, cliprect, state->tilemap_1, 0, 1);
tilemap_draw(bitmap, cliprect, state->tilemap_0, 0, 2);
}
draw_sprites(screen->machine, bitmap,cliprect);
draw_sprites(screen->machine, bitmap, cliprect);
return 0;
}

View File

@ -5,46 +5,53 @@
***************************************************************************/
#include "driver.h"
UINT16 *zerozone_videoram;
static UINT16 zerozone_tilebank;
static tilemap *zerozone_tilemap;
#include "zerozone.h"
WRITE16_HANDLER( zerozone_tilemap_w )
{
COMBINE_DATA(&zerozone_videoram[offset]);
tilemap_mark_tile_dirty(zerozone_tilemap,offset);
zerozone_state *state = (zerozone_state *)space->machine->driver_data;
COMBINE_DATA(&state->videoram[offset]);
tilemap_mark_tile_dirty(state->zz_tilemap,offset);
}
WRITE16_HANDLER(zerozone_tilebank_w)
{
zerozone_state *state = (zerozone_state *)space->machine->driver_data;
// popmessage ("Data %04x",data);
zerozone_tilebank = data & 0x7;
tilemap_mark_all_tiles_dirty(zerozone_tilemap);
state->tilebank = data & 0x07;
tilemap_mark_all_tiles_dirty(state->zz_tilemap);
}
static TILE_GET_INFO( get_zerozone_tile_info )
{
int tileno,colour;
tileno = zerozone_videoram[tile_index] & 0x07ff;
colour = zerozone_videoram[tile_index] & 0xf000;
zerozone_state *state = (zerozone_state *)machine->driver_data;
int tileno = state->videoram[tile_index] & 0x07ff;
int colour = state->videoram[tile_index] & 0xf000;
if (zerozone_videoram[tile_index] & 0x0800) tileno += zerozone_tilebank * 0x800;
if (state->videoram[tile_index] & 0x0800)
tileno += state->tilebank * 0x800;
SET_TILE_INFO(0,tileno,colour>>12,0);
SET_TILE_INFO(0, tileno, colour >> 12, 0);
}
VIDEO_START( zerozone )
{
zerozone_state *state = (zerozone_state *)machine->driver_data;
// i'm not 100% sure it should be opaque, pink title screen looks strange in las vegas girls
// but if its transparent other things look incorrect
zerozone_tilemap = tilemap_create(machine, get_zerozone_tile_info,tilemap_scan_cols, 8, 8, 64,32);
state->zz_tilemap = tilemap_create(machine, get_zerozone_tile_info, tilemap_scan_cols, 8, 8, 64, 32);
state_save_register_global(machine, state->tilebank);
}
VIDEO_UPDATE( zerozone )
{
tilemap_draw(bitmap,cliprect,zerozone_tilemap,0,0);
zerozone_state *state = (zerozone_state *)screen->machine->driver_data;
tilemap_draw(bitmap, cliprect, state->zz_tilemap, 0, 0);
return 0;
}