Converted Act Fancer, Trio the Punch and Mad Motor to use the common deco video functions [David Haywood]

This commit is contained in:
Angelo Salese 2011-03-27 23:33:36 +00:00
parent 41562709b6
commit b40cf676fc
11 changed files with 141 additions and 487 deletions

View File

@ -29,7 +29,7 @@
#include "sound/3812intf.h"
#include "sound/okim6295.h"
#include "includes/actfancr.h"
#include "video/decbac06.h"
/******************************************************************************/
@ -65,10 +65,12 @@ static WRITE8_HANDLER( actfancr_sound_w )
static ADDRESS_MAP_START( actfan_map, AS_PROGRAM, 8 )
AM_RANGE(0x000000, 0x02ffff) AM_ROM
AM_RANGE(0x060000, 0x06001f) AM_WRITE(actfancr_pf1_control_w)
AM_RANGE(0x062000, 0x063fff) AM_READWRITE(actfancr_pf1_data_r, actfancr_pf1_data_w) AM_BASE_MEMBER(actfancr_state, pf1_data)
AM_RANGE(0x070000, 0x07001f) AM_WRITE(actfancr_pf2_control_w)
AM_RANGE(0x072000, 0x0727ff) AM_READWRITE(actfancr_pf2_data_r, actfancr_pf2_data_w) AM_BASE_MEMBER(actfancr_state, pf2_data)
AM_RANGE(0x060000, 0x060007) AM_DEVWRITE("tilegen1", deco_bac06_pf_control0_8bit_w)
AM_RANGE(0x060010, 0x06001f) AM_DEVWRITE("tilegen1", deco_bac06_pf_control1_8bit_swap_w)
AM_RANGE(0x062000, 0x063fff) AM_DEVREADWRITE("tilegen1", deco_bac06_pf_data_8bit_swap_r, deco_bac06_pf_data_8bit_swap_w)
AM_RANGE(0x070000, 0x070007) AM_DEVWRITE("tilegen2", deco_bac06_pf_control0_8bit_w)
AM_RANGE(0x070010, 0x07001f) AM_DEVWRITE("tilegen2", deco_bac06_pf_control1_8bit_swap_w)
AM_RANGE(0x072000, 0x0727ff) AM_DEVREADWRITE("tilegen2", deco_bac06_pf_data_8bit_swap_r, deco_bac06_pf_data_8bit_swap_w)
AM_RANGE(0x100000, 0x1007ff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram)
AM_RANGE(0x110000, 0x110001) AM_WRITE(buffer_spriteram_w)
AM_RANGE(0x120000, 0x1205ff) AM_RAM_WRITE(paletteram_xxxxBBBBGGGGRRRR_le_w) AM_BASE_GENERIC(paletteram)
@ -83,12 +85,14 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( triothep_map, AS_PROGRAM, 8 )
AM_RANGE(0x000000, 0x03ffff) AM_ROM
AM_RANGE(0x040000, 0x04001f) AM_WRITE(actfancr_pf2_control_w)
AM_RANGE(0x044000, 0x045fff) AM_READWRITE(actfancr_pf2_data_r, actfancr_pf2_data_w) AM_BASE_MEMBER(actfancr_state, pf2_data)
AM_RANGE(0x046400, 0x0467ff) AM_WRITENOP /* Pf2 rowscroll - is it used? */
AM_RANGE(0x060000, 0x06001f) AM_WRITE(actfancr_pf1_control_w)
AM_RANGE(0x064000, 0x0647ff) AM_READWRITE(actfancr_pf1_data_r, actfancr_pf1_data_w) AM_BASE_MEMBER(actfancr_state, pf1_data)
AM_RANGE(0x066400, 0x0667ff) AM_WRITEONLY AM_BASE_MEMBER(actfancr_state, pf1_rowscroll_data)
AM_RANGE(0x040000, 0x040007) AM_DEVWRITE("tilegen2", deco_bac06_pf_control0_8bit_w)
AM_RANGE(0x040010, 0x04001f) AM_DEVWRITE("tilegen2", deco_bac06_pf_control1_8bit_swap_w)
AM_RANGE(0x044000, 0x045fff) AM_DEVREADWRITE("tilegen2", deco_bac06_pf_data_8bit_swap_r, deco_bac06_pf_data_8bit_swap_w)
AM_RANGE(0x046400, 0x0467ff) AM_DEVREADWRITE("tilegen2", deco_bac06_pf_rowscroll_8bit_swap_r, deco_bac06_pf_rowscroll_8bit_swap_w)
AM_RANGE(0x060000, 0x060007) AM_DEVWRITE("tilegen1", deco_bac06_pf_control0_8bit_w)
AM_RANGE(0x060010, 0x06001f) AM_DEVWRITE("tilegen1", deco_bac06_pf_control1_8bit_swap_w)
AM_RANGE(0x064000, 0x0647ff) AM_DEVREADWRITE("tilegen1", deco_bac06_pf_data_8bit_swap_r, deco_bac06_pf_data_8bit_swap_w)
AM_RANGE(0x066400, 0x0667ff) AM_DEVREADWRITE("tilegen1", deco_bac06_pf_rowscroll_8bit_swap_r, deco_bac06_pf_rowscroll_8bit_swap_w)
AM_RANGE(0x100000, 0x100001) AM_WRITE(actfancr_sound_w)
AM_RANGE(0x110000, 0x110001) AM_WRITE(buffer_spriteram_w)
AM_RANGE(0x120000, 0x1207ff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram)
@ -296,14 +300,7 @@ static MACHINE_START( triothep )
static MACHINE_RESET( actfancr )
{
actfancr_state *state = machine->driver_data<actfancr_state>();
int i;
state->flipscreen = 0;
for (i = 0; i < 0x20; i++)
{
state->control_1[i] = 0;
state->control_2[i] = 0;
}
}
static MACHINE_RESET( triothep )
@ -343,6 +340,11 @@ static MACHINE_CONFIG_START( actfancr, actfancr_state )
MCFG_GFXDECODE(actfan)
MCFG_PALETTE_LENGTH(768)
MCFG_DEVICE_ADD("tilegen1", deco_bac06_, 0)
deco_bac06_device_config::set_gfx_region_wide(device, 2,2,1);
MCFG_DEVICE_ADD("tilegen2", deco_bac06_, 0)
deco_bac06_device_config::set_gfx_region_wide(device, 0,0,0);
MCFG_VIDEO_START(actfancr)
/* sound hardware */
@ -389,6 +391,11 @@ static MACHINE_CONFIG_START( triothep, actfancr_state )
MCFG_GFXDECODE(triothep)
MCFG_PALETTE_LENGTH(768)
MCFG_DEVICE_ADD("tilegen1", deco_bac06_, 0)
deco_bac06_device_config::set_gfx_region_wide(device, 2,2,0);
MCFG_DEVICE_ADD("tilegen2", deco_bac06_, 0)
deco_bac06_device_config::set_gfx_region_wide(device, 0,0,0);
MCFG_VIDEO_START(triothep)
/* sound hardware */
@ -578,55 +585,8 @@ ROM_END
/******************************************************************************/
static READ8_HANDLER( cycle_r )
{
actfancr_state *state = space->machine->driver_data<actfancr_state>();
int pc = cpu_get_pc(space->cpu);
int ret = state->main_ram[0x26];
if (offset == 1)
return state->main_ram[0x27];
if (pc == 0xe29a && ret == 0)
{
device_spin_until_interrupt(space->cpu);
return 1;
}
return ret;
}
static READ8_HANDLER( cyclej_r )
{
actfancr_state *state = space->machine->driver_data<actfancr_state>();
int pc = cpu_get_pc(space->cpu);
int ret = state->main_ram[0x26];
if (offset == 1)
return state->main_ram[0x27];
if (pc == 0xe2b1 && ret == 0)
{
device_spin_until_interrupt(space->cpu);
return 1;
}
return ret;
}
static DRIVER_INIT( actfancr )
{
machine->device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x1f0026, 0x1f0027, FUNC(cycle_r));
}
static DRIVER_INIT( actfancrj )
{
machine->device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x1f0026, 0x1f0027, FUNC(cyclej_r));
}
GAME( 1989, actfancr, 0, actfancr, actfancr, actfancr, ROT0, "Data East Corporation", "Act-Fancer Cybernetick Hyper Weapon (World revision 2)", GAME_SUPPORTS_SAVE )
GAME( 1989, actfancr1,actfancr, actfancr, actfancr, actfancr, ROT0, "Data East Corporation", "Act-Fancer Cybernetick Hyper Weapon (World revision 1)", GAME_SUPPORTS_SAVE )
GAME( 1989, actfancrj,actfancr, actfancr, actfancr, actfancrj,ROT0, "Data East Corporation", "Act-Fancer Cybernetick Hyper Weapon (Japan revision 1)", GAME_SUPPORTS_SAVE )
GAME( 1989, actfancr, 0, actfancr, actfancr, 0, ROT0, "Data East Corporation", "Act-Fancer Cybernetick Hyper Weapon (World revision 2)", GAME_SUPPORTS_SAVE )
GAME( 1989, actfancr1,actfancr, actfancr, actfancr, 0, ROT0, "Data East Corporation", "Act-Fancer Cybernetick Hyper Weapon (World revision 1)", GAME_SUPPORTS_SAVE )
GAME( 1989, actfancrj,actfancr, actfancr, actfancr, 0, ROT0, "Data East Corporation", "Act-Fancer Cybernetick Hyper Weapon (Japan revision 1)", GAME_SUPPORTS_SAVE )
GAME( 1989, triothep, 0, triothep, triothep, 0, ROT0, "Data East Corporation", "Trio The Punch - Never Forget Me... (World)", GAME_SUPPORTS_SAVE )
GAME( 1989, triothepj,triothep, triothep, triothep, 0, ROT0, "Data East Corporation", "Trio The Punch - Never Forget Me... (Japan)", GAME_SUPPORTS_SAVE )

View File

@ -1303,11 +1303,11 @@ static MACHINE_CONFIG_START( dec0_base, dec0_state )
MCFG_PALETTE_LENGTH(1024)
MCFG_DEVICE_ADD("tilegen1", deco_bac06_, 0)
deco_bac06_device_config::set_gfx_region(device, 0,0);
deco_bac06_device_config::set_gfx_region_wide(device, 0,0,0);
MCFG_DEVICE_ADD("tilegen2", deco_bac06_, 0)
deco_bac06_device_config::set_gfx_region(device, 0,1);
deco_bac06_device_config::set_gfx_region_wide(device, 0,1,0);
MCFG_DEVICE_ADD("tilegen3", deco_bac06_, 0)
deco_bac06_device_config::set_gfx_region(device, 0,2);
deco_bac06_device_config::set_gfx_region_wide(device, 0,2,0);
MCFG_VIDEO_START(dec0)
MACHINE_CONFIG_END

View File

@ -1994,9 +1994,9 @@ static MACHINE_CONFIG_START( cobracom, dec8_state )
MCFG_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM)
MCFG_DEVICE_ADD("tilegen1", deco_bac06_, 0)
deco_bac06_device_config::set_gfx_region(device, 2,2);
deco_bac06_device_config::set_gfx_region_wide(device, 2,2,0);
MCFG_DEVICE_ADD("tilegen2", deco_bac06_, 0)
deco_bac06_device_config::set_gfx_region(device, 3,3);
deco_bac06_device_config::set_gfx_region_wide(device, 3,3,0);
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(58)
@ -2046,7 +2046,7 @@ static MACHINE_CONFIG_START( ghostb, dec8_state )
MCFG_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM)
MCFG_DEVICE_ADD("tilegen1", deco_bac06_, 0)
deco_bac06_device_config::set_gfx_region(device, 2,2);
deco_bac06_device_config::set_gfx_region_wide(device, 2,2,0);
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(58)
@ -2100,7 +2100,7 @@ static MACHINE_CONFIG_START( oscar, dec8_state )
MCFG_VIDEO_ATTRIBUTES(VIDEO_BUFFERS_SPRITERAM)
MCFG_DEVICE_ADD("tilegen1", deco_bac06_, 0)
deco_bac06_device_config::set_gfx_region(device, 2,2);
deco_bac06_device_config::set_gfx_region_wide(device, 2,2,0);
MCFG_SCREEN_ADD("screen", RASTER)
MCFG_SCREEN_REFRESH_RATE(58)

View File

@ -19,6 +19,7 @@
#include "sound/2151intf.h"
#include "sound/okim6295.h"
#include "includes/madmotor.h"
#include "video/decbac06.h"
/******************************************************************************/
@ -36,17 +37,23 @@ static WRITE16_HANDLER( madmotor_sound_w )
/******************************************************************************/
static ADDRESS_MAP_START( madmotor_map, AS_PROGRAM, 16 )
AM_RANGE(0x000000, 0x07ffff) AM_ROM
AM_RANGE(0x180000, 0x18001f) AM_WRITEONLY AM_BASE_MEMBER(madmotor_state, pf1_control)
AM_RANGE(0x184000, 0x1847ff) AM_RAM AM_BASE_MEMBER(madmotor_state, pf1_rowscroll)
AM_RANGE(0x188000, 0x189fff) AM_RAM_WRITE(madmotor_pf1_data_w) AM_BASE_MEMBER(madmotor_state, pf1_data)
AM_RANGE(0x180000, 0x180007) AM_DEVWRITE("tilegen1", deco_bac06_pf_control_0_w) /* text layer */
AM_RANGE(0x180010, 0x180017) AM_DEVWRITE("tilegen1", deco_bac06_pf_control_1_w)
AM_RANGE(0x184000, 0x18407f) AM_DEVREADWRITE("tilegen1", deco_bac06_pf_colscroll_r, deco_bac06_pf_colscroll_w)
AM_RANGE(0x184080, 0x1843ff) AM_RAM
AM_RANGE(0x184400, 0x1847ff) AM_DEVREADWRITE("tilegen1", deco_bac06_pf_rowscroll_r, deco_bac06_pf_rowscroll_w)
AM_RANGE(0x188000, 0x189fff) AM_DEVREADWRITE("tilegen1", deco_bac06_pf_data_r, deco_bac06_pf_data_w)
AM_RANGE(0x18c000, 0x18c001) AM_NOP
AM_RANGE(0x190000, 0x19001f) AM_WRITEONLY AM_BASE_MEMBER(madmotor_state, pf2_control)
AM_RANGE(0x198000, 0x1987ff) AM_RAM_WRITE(madmotor_pf2_data_w) AM_BASE_MEMBER(madmotor_state, pf2_data)
AM_RANGE(0x190000, 0x190007) AM_DEVWRITE("tilegen2", deco_bac06_pf_control_0_w) /* text layer */
AM_RANGE(0x190010, 0x190017) AM_DEVWRITE("tilegen2", deco_bac06_pf_control_1_w)
AM_RANGE(0x198000, 0x1987ff) AM_DEVREADWRITE("tilegen2", deco_bac06_pf_data_r, deco_bac06_pf_data_w)
AM_RANGE(0x19c000, 0x19c001) AM_READNOP
AM_RANGE(0x1a0000, 0x1a001f) AM_WRITEONLY AM_BASE_MEMBER(madmotor_state, pf3_control)
AM_RANGE(0x1a4000, 0x1a4fff) AM_RAM_WRITE(madmotor_pf3_data_w) AM_BASE_MEMBER(madmotor_state, pf3_data)
AM_RANGE(0x1a0000, 0x1a0007) AM_DEVWRITE("tilegen3", deco_bac06_pf_control_0_w) /* text layer */
AM_RANGE(0x1a0010, 0x1a0017) AM_DEVWRITE("tilegen3", deco_bac06_pf_control_1_w)
AM_RANGE(0x1a4000, 0x1a4fff) AM_DEVREADWRITE("tilegen3", deco_bac06_pf_data_r, deco_bac06_pf_data_w)
AM_RANGE(0x3e0000, 0x3e3fff) AM_RAM
AM_RANGE(0x3e8000, 0x3e87ff) AM_RAM AM_BASE_SIZE_MEMBER(madmotor_state, spriteram, spriteram_size)
AM_RANGE(0x3f0000, 0x3f07ff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_BASE_GENERIC(paletteram)
@ -267,6 +274,13 @@ static MACHINE_CONFIG_START( madmotor, madmotor_state )
MCFG_GFXDECODE(madmotor)
MCFG_PALETTE_LENGTH(1024)
MCFG_DEVICE_ADD("tilegen1", deco_bac06_, 0)
deco_bac06_device_config::set_gfx_region_wide(device, 0,0,0);
MCFG_DEVICE_ADD("tilegen2", deco_bac06_, 0)
deco_bac06_device_config::set_gfx_region_wide(device, 0,1,0);
MCFG_DEVICE_ADD("tilegen3", deco_bac06_, 0)
deco_bac06_device_config::set_gfx_region_wide(device, 0,2,1);
MCFG_VIDEO_START(madmotor)
/* sound hardware */

View File

@ -11,16 +11,11 @@ public:
: driver_device(machine, config) { }
/* memory pointers */
UINT8 * pf1_data;
UINT8 * pf2_data;
UINT8 * pf1_rowscroll_data;
UINT8 * main_ram;
// UINT8 * spriteram; // currently this uses buffered_spriteram
// UINT8 * paletteram; // currently this uses generic palette handling
/* video-related */
tilemap_t *pf1_tilemap, *pf1_alt_tilemap, *pf2_tilemap;
UINT8 control_1[0x20], control_2[0x20];
int flipscreen;
/* misc */

View File

@ -11,19 +11,11 @@ public:
: driver_device(machine, config) { }
/* memory pointers */
UINT16 * pf1_rowscroll;
UINT16 * pf1_data;
UINT16 * pf2_data;
UINT16 * pf3_data;
UINT16 * pf1_control;
UINT16 * pf2_control;
UINT16 * pf3_control;
UINT16 * spriteram;
// UINT16 * paletteram; // this currently uses generic palette handlers
size_t spriteram_size;
/* video-related */
tilemap_t *pf1_tilemap, *pf2_tilemap, *pf3_tilemap, *pf3a_tilemap;
int flipscreen;
/* devices */
@ -34,9 +26,5 @@ public:
/*----------- defined in video/madmotor.c -----------*/
WRITE16_HANDLER( madmotor_pf1_data_w );
WRITE16_HANDLER( madmotor_pf2_data_w );
WRITE16_HANDLER( madmotor_pf3_data_w );
VIDEO_START( madmotor );
SCREEN_UPDATE( madmotor );

View File

@ -6,171 +6,39 @@
#include "emu.h"
#include "includes/actfancr.h"
static TILEMAP_MAPPER( actfancr_scan )
{
/* logical (col,row) -> memory offset */
return (col & 0x0f) + ((row & 0x0f) << 4) + ((col & 0xf0) << 4);
}
static TILEMAP_MAPPER( actfancr_scan2 )
{
/* logical (col,row) -> memory offset */
return (col & 0x0f) + ((row & 0x0f) << 4) + ((row & 0x10) << 4) + ((col & 0x70) << 5);
}
static TILE_GET_INFO( get_tile_info )
{
actfancr_state *state = machine->driver_data<actfancr_state>();
int tile = state->pf1_data[2 * tile_index] + (state->pf1_data[2 * tile_index + 1] << 8);
int color = tile >> 12;
tile = tile & 0xfff;
SET_TILE_INFO(
2,
tile,
color,
0);
}
static TILEMAP_MAPPER( triothep_scan )
{
/* logical (col,row) -> memory offset */
return (col & 0x0f) + ((row & 0x0f) << 4) + ((row & 0x10) << 4) + ((col & 0x10) << 5);
}
static TILE_GET_INFO( get_trio_tile_info )
{
actfancr_state *state = machine->driver_data<actfancr_state>();
int tile = state->pf1_data[2 * tile_index] + (state->pf1_data[2 * tile_index + 1] << 8);
int color = tile >> 12;
tile = tile & 0xfff;
SET_TILE_INFO(
2,
tile,
color,
0);
}
static TILE_GET_INFO( get_pf2_tile_info )
{
actfancr_state *state = machine->driver_data<actfancr_state>();
int tile = state->pf2_data[2 * tile_index] + (state->pf2_data[2 * tile_index + 1] << 8);
int color = tile >> 12;
tile = tile & 0xfff;
SET_TILE_INFO(
0,
tile,
color,
0);
}
#include "video/decbac06.h"
/******************************************************************************/
static void register_savestate( running_machine *machine )
{
actfancr_state *state = machine->driver_data<actfancr_state>();
state->save_item(NAME(state->control_1));
state->save_item(NAME(state->control_2));
state->save_item(NAME(state->flipscreen));
}
VIDEO_START( actfancr )
{
actfancr_state *state = machine->driver_data<actfancr_state>();
state->pf1_tilemap = tilemap_create(machine, get_tile_info, actfancr_scan, 16, 16, 256, 16);
state->pf1_alt_tilemap = tilemap_create(machine, get_tile_info, actfancr_scan2, 16, 16, 128, 32);
state->pf2_tilemap = tilemap_create(machine, get_pf2_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
tilemap_set_transparent_pen(state->pf2_tilemap, 0);
register_savestate(machine);
}
VIDEO_START( triothep )
{
actfancr_state *state = machine->driver_data<actfancr_state>();
state->pf1_tilemap = tilemap_create(machine, get_trio_tile_info, triothep_scan, 16, 16, 32, 32);
state->pf2_tilemap = tilemap_create(machine, get_pf2_tile_info, tilemap_scan_rows, 8, 8, 32, 32);
state->pf1_alt_tilemap = NULL;
tilemap_set_transparent_pen(state->pf2_tilemap, 0);
register_savestate(machine);
}
/******************************************************************************/
WRITE8_HANDLER( actfancr_pf1_control_w )
{
actfancr_state *state = space->machine->driver_data<actfancr_state>();
state->control_1[offset] = data;
}
WRITE8_HANDLER( actfancr_pf2_control_w )
{
actfancr_state *state = space->machine->driver_data<actfancr_state>();
state->control_2[offset] = data;
}
WRITE8_HANDLER( actfancr_pf1_data_w )
{
actfancr_state *state = space->machine->driver_data<actfancr_state>();
state->pf1_data[offset] = data;
tilemap_mark_tile_dirty(state->pf1_tilemap, offset / 2);
if (state->pf1_alt_tilemap)
tilemap_mark_tile_dirty(state->pf1_alt_tilemap, offset / 2);
}
READ8_HANDLER( actfancr_pf1_data_r )
{
actfancr_state *state = space->machine->driver_data<actfancr_state>();
return state->pf1_data[offset];
}
WRITE8_HANDLER( actfancr_pf2_data_w )
{
actfancr_state *state = space->machine->driver_data<actfancr_state>();
state->pf2_data[offset] = data;
tilemap_mark_tile_dirty(state->pf2_tilemap, offset / 2);
}
READ8_HANDLER( actfancr_pf2_data_r )
{
actfancr_state *state = space->machine->driver_data<actfancr_state>();
return state->pf2_data[offset];
}
/******************************************************************************/
SCREEN_UPDATE( actfancr )
{
actfancr_state *state = screen->machine->driver_data<actfancr_state>();
UINT8 *buffered_spriteram = screen->machine->generic.buffered_spriteram.u8;
int offs, mult;
int scrollx = (state->control_1[0x10] + (state->control_1[0x11] << 8));
int scrolly = (state->control_1[0x12] + (state->control_1[0x13] << 8));
/* Draw playfield */
state->flipscreen = state->control_2[0] & 0x80;
tilemap_set_flip_all(screen->machine, state->flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
//state->flipscreen = state->control_2[0] & 0x80;
//tilemap_set_flip_all(screen->machine, state->flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
tilemap_set_scrollx(state->pf1_tilemap,0, scrollx );
tilemap_set_scrolly(state->pf1_tilemap,0, scrolly );
tilemap_set_scrollx(state->pf1_alt_tilemap, 0, scrollx );
tilemap_set_scrolly(state->pf1_alt_tilemap, 0, scrolly );
if (state->control_1[6] == 1)
tilemap_draw(bitmap, cliprect, state->pf1_alt_tilemap, 0, 0);
else
tilemap_draw(bitmap, cliprect, state->pf1_tilemap, 0, 0);
screen->machine->device<deco_bac06_device>("tilegen1")->deco_bac06_pf_draw(screen->machine,bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00);
/* Sprites */
for (offs = 0; offs < 0x800; offs += 8)
@ -232,7 +100,8 @@ SCREEN_UPDATE( actfancr )
}
}
tilemap_draw(bitmap, cliprect, state->pf2_tilemap, 0, 0);
screen->machine->device<deco_bac06_device>("tilegen2")->deco_bac06_pf_draw(screen->machine,bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
return 0;
}
@ -240,29 +109,13 @@ SCREEN_UPDATE( triothep )
{
actfancr_state *state = screen->machine->driver_data<actfancr_state>();
UINT8 *buffered_spriteram = screen->machine->generic.buffered_spriteram.u8;
int offs, i, mult;
int scrollx = (state->control_1[0x10] + (state->control_1[0x11] << 8));
int scrolly = (state->control_1[0x12] + (state->control_1[0x13] << 8));
int offs, mult;
/* Draw playfield */
state->flipscreen = state->control_2[0] & 0x80;
tilemap_set_flip_all(screen->machine, state->flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
//state->flipscreen = state->control_2[0] & 0x80;
//tilemap_set_flip_all(screen->machine, state->flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
if (state->control_2[0] & 0x4)
{
tilemap_set_scroll_rows(state->pf1_tilemap, 32);
tilemap_set_scrolly(state->pf1_tilemap, 0, scrolly);
for (i = 0; i < 32; i++)
tilemap_set_scrollx(state->pf1_tilemap, i, scrollx + (state->pf1_rowscroll_data[i * 2] | state->pf1_rowscroll_data[i * 2 + 1] << 8) );
}
else
{
tilemap_set_scroll_rows(state->pf1_tilemap, 1);
tilemap_set_scrollx(state->pf1_tilemap, 0, scrollx);
tilemap_set_scrolly(state->pf1_tilemap, 0, scrolly);
}
tilemap_draw(bitmap, cliprect, state->pf1_tilemap, 0, 0);
screen->machine->device<deco_bac06_device>("tilegen1")->deco_bac06_pf_draw(screen->machine,bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00);
/* Sprites */
for (offs = 0; offs < 0x800; offs += 8)
@ -324,6 +177,7 @@ SCREEN_UPDATE( triothep )
}
}
tilemap_draw(bitmap, cliprect, state->pf2_tilemap, 0, 0);
screen->machine->device<deco_bac06_device>("tilegen2")->deco_bac06_pf_draw(screen->machine,bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
return 0;
}

View File

@ -414,46 +414,6 @@ SCREEN_UPDATE( cobracom )
/******************************************************************************/
/*
static TILE_GET_INFO( get_bac0_tile_info )
{
dec8_state *state = machine->driver_data<dec8_state>();
int tile, color, offs = tile_index << 1;
tile = (state->bg_data[offs] << 8) | state->bg_data[offs + 1];
color = tile >> 12;
if (color > 7 && state->game_uses_priority)
tileinfo->category = 1;
else
tileinfo->category = 0;
SET_TILE_INFO(
2,
tile & 0xfff,
color & state->gfx_mask,
0);
}
static TILE_GET_INFO( get_bac1_tile_info )
{
dec8_state *state = machine->driver_data<dec8_state>();
int tile, color, offs = tile_index << 1;
tile = (state->pf1_data[offs] << 8) | state->pf1_data[offs + 1];
color = tile >> 12;
if (color > 7 && state->game_uses_priority)
tileinfo->category = 1;
else
tileinfo->category = 0;
SET_TILE_INFO(
3,
tile & 0xfff,
color & 3,
0);
}
*/
static TILE_GET_INFO( get_cobracom_fix_tile_info )
{

View File

@ -59,7 +59,7 @@ Priority word (Midres):
deco_bac06_device_config::deco_bac06_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
: device_config(mconfig, static_alloc_device_config, "decbac06_device", tag, owner, clock)
{
m_gfxregion8x8 = m_gfxregion16x16 = 0;
m_gfxregion8x8 = m_gfxregion16x16 = m_wide = 0;
}
device_config *deco_bac06_device_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
@ -72,11 +72,12 @@ device_t *deco_bac06_device_config::alloc_device(running_machine &machine) const
return auto_alloc(&machine, deco_bac06_device(machine, *this));
}
void deco_bac06_device_config::set_gfx_region(device_config *device, int region8x8, int region16x16)
void deco_bac06_device_config::set_gfx_region_wide(device_config *device, int region8x8, int region16x16, int wide)
{
deco_bac06_device_config *dev = downcast<deco_bac06_device_config *>(device);
dev->m_gfxregion8x8 = region8x8;
dev->m_gfxregion16x16 = region16x16;
dev->m_wide = wide;
}
@ -84,25 +85,27 @@ deco_bac06_device::deco_bac06_device(running_machine &_machine, const deco_bac06
: device_t(_machine, config),
m_config(config),
m_gfxregion8x8(m_config.m_gfxregion8x8),
m_gfxregion16x16(m_config.m_gfxregion16x16)
m_gfxregion16x16(m_config.m_gfxregion16x16),
m_wide(m_config.m_wide)
{
}
static TILEMAP_MAPPER( tile_shape0_scan )
{
return (col & 0xf) + ((row & 0xf) << 4) + ((col & 0x30) << 4);
return (col & 0xf) + ((row & 0xf) << 4) + ((col & 0x70) << 4);
}
static TILEMAP_MAPPER( tile_shape1_scan )
{
return (col & 0xf) + ((row & 0xf) << 4) + ((row & 0x10) << 4) + ((col & 0x10) << 5);
return (col & 0xf) + ((row & 0x1f) << 4) + ((col & 0x30) << 5);
}
static TILEMAP_MAPPER( tile_shape2_scan )
{
return (col & 0xf) + ((row & 0x3f) << 4);
return (col & 0xf) + ((row & 0x3f) << 4) + ((col & 0x10) << 6);
}
static TILEMAP_MAPPER( tile_shape0_8x8_scan )
@ -120,6 +123,10 @@ static TILEMAP_MAPPER( tile_shape2_8x8_scan )
return (col & 0x1f) + ((row & 0x7f) << 5);
}
static TILE_GET_INFO_DEVICE( get_pf8x8_tile_info )
{
deco_bac06_device *dev = (deco_bac06_device*)device;
@ -149,10 +156,19 @@ void deco_bac06_device::create_tilemaps(int region8x8, int region16x16)
tile_region = region16x16;
if (m_wide)
{
pf16x16_tilemap[0] = tilemap_create_device(this, get_pf16x16_tile_info, tile_shape0_scan, 16, 16, 128, 16);
pf16x16_tilemap[1] = tilemap_create_device(this, get_pf16x16_tile_info, tile_shape1_scan, 16, 16, 64, 32);
pf16x16_tilemap[2] = tilemap_create_device(this, get_pf16x16_tile_info, tile_shape2_scan, 16, 16, 32, 64);
}
else
{
pf16x16_tilemap[0] = tilemap_create_device(this, get_pf16x16_tile_info,tile_shape0_scan, 16,16, 64, 16);
pf16x16_tilemap[1] = tilemap_create_device(this, get_pf16x16_tile_info,tile_shape1_scan, 16,16, 32, 32);
pf16x16_tilemap[2] = tilemap_create_device(this, get_pf16x16_tile_info,tile_shape2_scan, 16,16, 16, 64);
}
}
void deco_bac06_device::device_start()
{
@ -390,12 +406,22 @@ READ8_DEVICE_HANDLER( deco_bac06_pf_control1_8bit_r )
/* used by dec8.c */
WRITE8_DEVICE_HANDLER( deco_bac06_pf_control1_8bit_w )
{
if (offset<4) // these registers are 16-bit?
{
if (offset&1)
deco_bac06_pf_control_1_w(device,offset/2,data,0x00ff);
else
deco_bac06_pf_control_1_w(device,offset/2,data<<8,0xff00);
}
else // these registers are 8-bit and mirror? (triothep vs actfancr)
{
if (offset&1)
deco_bac06_pf_control_1_w(device,offset/2,data,0x00ff);
else
deco_bac06_pf_control_1_w(device,offset/2,data,0x00ff);
}
}
READ8_DEVICE_HANDLER( deco_bac06_pf_rowscroll_8bit_r )
{
@ -414,6 +440,23 @@ WRITE8_DEVICE_HANDLER( deco_bac06_pf_rowscroll_8bit_w )
deco_bac06_pf_rowscroll_w(device,offset/2,data<<8,0xff00);
}
READ8_DEVICE_HANDLER( deco_bac06_pf_rowscroll_8bit_swap_r )
{
if (offset&1)
return deco_bac06_pf_rowscroll_r(device,offset/2,0xff00)>>8;
else
return deco_bac06_pf_rowscroll_r(device,offset/2,0x00ff);
}
WRITE8_DEVICE_HANDLER( deco_bac06_pf_rowscroll_8bit_swap_w )
{
if (offset&1)
deco_bac06_pf_rowscroll_w(device,offset/2,data<<8,0xff00);
else
deco_bac06_pf_rowscroll_w(device,offset/2,data,0x00ff);
}
/* used by hippodrm */
WRITE8_DEVICE_HANDLER( deco_bac06_pf_control0_8bit_packed_w )
@ -427,28 +470,17 @@ WRITE8_DEVICE_HANDLER( deco_bac06_pf_control0_8bit_packed_w )
/* used by hippodrm */
WRITE8_DEVICE_HANDLER( deco_bac06_pf_control1_8bit_swap_w )
{
if (offset&1)
deco_bac06_pf_control_1_w(device,offset/2,data<<8,0xff00);
else
deco_bac06_pf_control_1_w(device,offset/2,data,0x00ff);
deco_bac06_pf_control1_8bit_w(device, offset^1, data);
}
/* used by hippodrm */
READ8_DEVICE_HANDLER( deco_bac06_pf_data_8bit_swap_r )
{
if (offset&1)
return deco_bac06_pf_data_r(device,offset/2,0xff00)>>8;
else
return deco_bac06_pf_data_r(device,offset/2,0x00ff);
return deco_bac06_pf_data_8bit_r(device, offset^1);
}
/* used by hippodrm */
WRITE8_DEVICE_HANDLER( deco_bac06_pf_data_8bit_swap_w )
{
if (offset&1)
deco_bac06_pf_data_w(device,offset/2,data<<8,0xff00);
else
deco_bac06_pf_data_w(device,offset/2,data,0x00ff);
deco_bac06_pf_data_8bit_w(device, offset^1, data);
}

View File

@ -8,11 +8,12 @@ class deco_bac06_device_config : public device_config
public:
static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
virtual device_t *alloc_device(running_machine &machine) const;
static void set_gfx_region(device_config *device, int region8x8, int region16x16);
static void set_gfx_region_wide(device_config *device, int region8x8, int region16x16, int wide);
protected:
UINT8 m_gfxregion8x8;
UINT8 m_gfxregion16x16;
int m_wide;
};
class deco_bac06_device : public device_t
@ -46,6 +47,7 @@ protected:
UINT8 m_gfxregion8x8;
UINT8 m_gfxregion16x16;
int m_wide;
void custom_tilemap_draw(running_machine *machine,
bitmap_t *bitmap,
@ -95,6 +97,8 @@ WRITE8_DEVICE_HANDLER( deco_bac06_pf_control0_8bit_packed_w );
WRITE8_DEVICE_HANDLER( deco_bac06_pf_control1_8bit_swap_w );
READ8_DEVICE_HANDLER( deco_bac06_pf_data_8bit_swap_r );
WRITE8_DEVICE_HANDLER( deco_bac06_pf_data_8bit_swap_w );
READ8_DEVICE_HANDLER( deco_bac06_pf_rowscroll_8bit_swap_r );
WRITE8_DEVICE_HANDLER( deco_bac06_pf_rowscroll_8bit_swap_w );
const device_type deco_bac06_ = deco_bac06_device_config::static_alloc_device_config;

View File

@ -8,141 +8,12 @@
#include "emu.h"
#include "includes/madmotor.h"
/* 512 by 512 playfield, 8 by 8 tiles */
static TILEMAP_MAPPER( pf1_scan )
{
/* logical (col,row) -> memory offset */
return (col & 0x1f) + ((row & 0x1f) << 5) + ((row & 0x20) << 5) + ((col & 0x20) << 6);
}
static TILE_GET_INFO( get_pf1_tile_info )
{
madmotor_state *state = machine->driver_data<madmotor_state>();
int tile = state->pf1_data[tile_index];
int color = tile >> 12;
tile = tile & 0xfff;
SET_TILE_INFO(
0,
tile,
color,
0);
}
/* 512 by 512 playfield, 16 by 16 tiles */
static TILEMAP_MAPPER( pf2_scan )
{
/* logical (col,row) -> memory offset */
return (col & 0x0f) + ((row & 0x0f) << 4) + ((row & 0x10) << 4) + ((col & 0x10) << 5);
}
static TILE_GET_INFO( get_pf2_tile_info )
{
madmotor_state *state = machine->driver_data<madmotor_state>();
int tile = state->pf2_data[tile_index];
int color = tile >> 12;
tile = tile & 0xfff;
SET_TILE_INFO(
1,
tile,
color,
0);
}
/* 512 by 1024 playfield, 16 by 16 tiles */
static TILEMAP_MAPPER( pf3_scan )
{
/* logical (col,row) -> memory offset */
return (col & 0x0f) + ((row & 0x0f) << 4) + ((row & 0x30) << 4) + ((col & 0x10) << 6);
}
static TILE_GET_INFO( get_pf3_tile_info )
{
madmotor_state *state = machine->driver_data<madmotor_state>();
int tile = state->pf3_data[tile_index];
int color = tile >> 12;
tile = tile & 0xfff;
SET_TILE_INFO(
2,
tile,
color,
0);
}
/* 2048 by 256 playfield, 16 by 16 tiles */
static TILEMAP_MAPPER( pf3a_scan )
{
/* logical (col,row) -> memory offset */
return (col & 0x0f) + ((row & 0x0f) << 4) + ((col & 0x70) << 4);
}
static TILE_GET_INFO( get_pf3a_tile_info )
{
madmotor_state *state = machine->driver_data<madmotor_state>();
int tile = state->pf3_data[tile_index];
int color = tile >> 12;
tile = tile & 0xfff;
SET_TILE_INFO(
2,
tile,
color,
0);
}
#include "video/decbac06.h"
/******************************************************************************/
VIDEO_START( madmotor )
{
madmotor_state *state = machine->driver_data<madmotor_state>();
state->pf1_tilemap = tilemap_create(machine, get_pf1_tile_info, pf1_scan, 8, 8, 64, 64);
state->pf2_tilemap = tilemap_create(machine, get_pf2_tile_info, pf2_scan, 16, 16, 32, 32);
state->pf3_tilemap = tilemap_create(machine, get_pf3_tile_info, pf3_scan, 16, 16, 32, 64);
state->pf3a_tilemap= tilemap_create(machine, get_pf3a_tile_info, pf3a_scan, 16, 16, 128, 16);
tilemap_set_transparent_pen(state->pf1_tilemap, 0);
tilemap_set_transparent_pen(state->pf2_tilemap, 0);
tilemap_set_scroll_rows(state->pf1_tilemap, 512);
}
/******************************************************************************/
WRITE16_HANDLER( madmotor_pf1_data_w )
{
madmotor_state *state = space->machine->driver_data<madmotor_state>();
COMBINE_DATA(&state->pf1_data[offset]);
tilemap_mark_tile_dirty(state->pf1_tilemap, offset);
}
WRITE16_HANDLER( madmotor_pf2_data_w )
{
madmotor_state *state = space->machine->driver_data<madmotor_state>();
COMBINE_DATA(&state->pf2_data[offset]);
tilemap_mark_tile_dirty(state->pf2_tilemap, offset);
}
WRITE16_HANDLER( madmotor_pf3_data_w )
{
madmotor_state *state = space->machine->driver_data<madmotor_state>();
COMBINE_DATA(&state->pf3_data[offset]);
/* Mark the dirty position on the 512 x 1024 version */
tilemap_mark_tile_dirty(state->pf3_tilemap, offset);
/* Mark the dirty position on the 2048 x 256 version */
tilemap_mark_tile_dirty(state->pf3a_tilemap, offset);
}
/******************************************************************************/
@ -224,37 +95,13 @@ static void draw_sprites( running_machine *machine, bitmap_t *bitmap, const rect
SCREEN_UPDATE( madmotor )
{
madmotor_state *state = screen->machine->driver_data<madmotor_state>();
int offs;
flip_screen_set(screen->machine, screen->machine->device<deco_bac06_device>("tilegen1")->get_flip_state());
/* Update flipscreen */
if (state->pf1_control[0] & 0x80)
state->flipscreen = 1;
else
state->flipscreen = 0;
// tilemap_set_flip_all(screen->machine, screen->machine->device<deco_bac06_device>("tilegen1")->get_flip_state() ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
tilemap_set_flip_all(screen->machine, state->flipscreen ? (TILEMAP_FLIPY | TILEMAP_FLIPX) : 0);
/* Setup scroll registers */
for (offs = 0; offs < 512; offs++)
tilemap_set_scrollx(state->pf1_tilemap, offs, state->pf1_control[0x08] + state->pf1_rowscroll[0x200 + offs]);
tilemap_set_scrolly(state->pf1_tilemap, 0, state->pf1_control[0x09]);
tilemap_set_scrollx(state->pf2_tilemap, 0, state->pf2_control[0x08]);
tilemap_set_scrolly(state->pf2_tilemap, 0, state->pf2_control[0x09]);
tilemap_set_scrollx(state->pf3_tilemap, 0, state->pf3_control[0x08]);
tilemap_set_scrolly(state->pf3_tilemap, 0, state->pf3_control[0x09]);
tilemap_set_scrollx(state->pf3a_tilemap, 0, state->pf3_control[0x08]);
tilemap_set_scrolly(state->pf3a_tilemap, 0, state->pf3_control[0x09]);
/* Draw playfields & sprites */
if (state->pf3_control[0x03] == 2)
tilemap_draw(bitmap, cliprect, state->pf3_tilemap, 0, 0);
else
tilemap_draw(bitmap, cliprect, state->pf3a_tilemap, 0, 0);
tilemap_draw(bitmap, cliprect, state->pf2_tilemap, 0, 0);
screen->machine->device<deco_bac06_device>("tilegen3")->deco_bac06_pf_draw(screen->machine,bitmap,cliprect,TILEMAP_DRAW_OPAQUE, 0x00, 0x00, 0x00, 0x00);
screen->machine->device<deco_bac06_device>("tilegen2")->deco_bac06_pf_draw(screen->machine,bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
draw_sprites(screen->machine, bitmap, cliprect, 0x00, 0x00);
tilemap_draw(bitmap, cliprect, state->pf1_tilemap, 0, 0);
screen->machine->device<deco_bac06_device>("tilegen1")->deco_bac06_pf_draw(screen->machine,bitmap,cliprect,0, 0x00, 0x00, 0x00, 0x00);
return 0;
}