Converted toaplan1/2 drivers to use driver_data [Atari Ace]

-------------------------------------------------------------------------------

from Atari Ace <atari_ace@frontier.com>
date Sun, Aug 22, 2010 at 10:24 PM
subject [patch] Convert toaplan1/2 to driver_data^3

mamedev,

toaplan2 remains a moving target.  This patch is a rebsubmission of
yesterday's patch adjusted to account for recent toaplan2 changes.

~aa
This commit is contained in:
Phil Bennett 2010-08-23 10:13:59 +00:00
parent b5490690b6
commit 566a84b1db
9 changed files with 1064 additions and 801 deletions

View File

@ -353,7 +353,7 @@ static ADDRESS_MAP_START( rallybik_main_map, ADDRESS_SPACE_PROGRAM, 16 )
AM_RANGE(0x000000, 0x00ffff) AM_ROM AM_RANGE(0x000000, 0x00ffff) AM_ROM
AM_RANGE(0x040000, 0x07ffff) AM_ROM AM_RANGE(0x040000, 0x07ffff) AM_ROM
AM_RANGE(0x080000, 0x083fff) AM_RAM AM_RANGE(0x080000, 0x083fff) AM_RAM
AM_RANGE(0x0c0000, 0x0c0fff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram) AM_RANGE(0x0c0000, 0x0c0fff) AM_RAM AM_BASE_SIZE_MEMBER(toaplan1_state, spriteram, spriteram_size)
AM_RANGE(0x100000, 0x100001) AM_WRITE(rallybik_bcu_flipscreen_w) AM_RANGE(0x100000, 0x100001) AM_WRITE(rallybik_bcu_flipscreen_w)
AM_RANGE(0x100002, 0x100003) AM_READWRITE(toaplan1_tileram_offs_r, toaplan1_tileram_offs_w) AM_RANGE(0x100002, 0x100003) AM_READWRITE(toaplan1_tileram_offs_r, toaplan1_tileram_offs_w)
AM_RANGE(0x100004, 0x100007) AM_READWRITE(rallybik_tileram16_r, toaplan1_tileram16_w) AM_RANGE(0x100004, 0x100007) AM_READWRITE(rallybik_tileram16_r, toaplan1_tileram16_w)
@ -362,8 +362,8 @@ static ADDRESS_MAP_START( rallybik_main_map, ADDRESS_SPACE_PROGRAM, 16 )
// AM_RANGE(0x140000, 0x140001) AM_WRITE(?? video frame related ??) // AM_RANGE(0x140000, 0x140001) AM_WRITE(?? video frame related ??)
AM_RANGE(0x140002, 0x140003) AM_WRITE(toaplan1_intenable_w) AM_RANGE(0x140002, 0x140003) AM_WRITE(toaplan1_intenable_w)
AM_RANGE(0x140008, 0x14000f) AM_WRITE(toaplan1_bcu_control_w) AM_RANGE(0x140008, 0x14000f) AM_WRITE(toaplan1_bcu_control_w)
AM_RANGE(0x144000, 0x1447ff) AM_READWRITE(toaplan1_colorram1_r, toaplan1_colorram1_w) AM_BASE(&toaplan1_colorram1) AM_SIZE(&toaplan1_colorram1_size) AM_RANGE(0x144000, 0x1447ff) AM_READWRITE(toaplan1_colorram1_r, toaplan1_colorram1_w) AM_BASE_SIZE_MEMBER(toaplan1_state, colorram1, colorram1_size)
AM_RANGE(0x146000, 0x1467ff) AM_READWRITE(toaplan1_colorram2_r, toaplan1_colorram2_w) AM_BASE(&toaplan1_colorram2) AM_SIZE(&toaplan1_colorram2_size) AM_RANGE(0x146000, 0x1467ff) AM_READWRITE(toaplan1_colorram2_r, toaplan1_colorram2_w) AM_BASE_SIZE_MEMBER(toaplan1_state, colorram2, colorram2_size)
AM_RANGE(0x180000, 0x180fff) AM_READWRITE(toaplan1_shared_r, toaplan1_shared_w) AM_RANGE(0x180000, 0x180fff) AM_READWRITE(toaplan1_shared_r, toaplan1_shared_w)
AM_RANGE(0x1c0000, 0x1c0003) AM_WRITE(toaplan1_tile_offsets_w) AM_RANGE(0x1c0000, 0x1c0003) AM_WRITE(toaplan1_tile_offsets_w)
AM_RANGE(0x1c8000, 0x1c8001) AM_WRITE(toaplan1_reset_sound) AM_RANGE(0x1c8000, 0x1c8001) AM_WRITE(toaplan1_reset_sound)
@ -384,8 +384,8 @@ static ADDRESS_MAP_START( truxton_main_map, ADDRESS_SPACE_PROGRAM, 16 )
// AM_RANGE(0x140000, 0x140001) AM_WRITE(?? video frame related ??) // AM_RANGE(0x140000, 0x140001) AM_WRITE(?? video frame related ??)
AM_RANGE(0x140002, 0x140003) AM_WRITE(toaplan1_intenable_w) AM_RANGE(0x140002, 0x140003) AM_WRITE(toaplan1_intenable_w)
AM_RANGE(0x140008, 0x14000f) AM_WRITE(toaplan1_bcu_control_w) AM_RANGE(0x140008, 0x14000f) AM_WRITE(toaplan1_bcu_control_w)
AM_RANGE(0x144000, 0x1447ff) AM_READWRITE(toaplan1_colorram1_r, toaplan1_colorram1_w) AM_BASE(&toaplan1_colorram1) AM_SIZE(&toaplan1_colorram1_size) AM_RANGE(0x144000, 0x1447ff) AM_READWRITE(toaplan1_colorram1_r, toaplan1_colorram1_w) AM_BASE_SIZE_MEMBER(toaplan1_state, colorram1, colorram1_size)
AM_RANGE(0x146000, 0x1467ff) AM_READWRITE(toaplan1_colorram2_r, toaplan1_colorram2_w) AM_BASE(&toaplan1_colorram2) AM_SIZE(&toaplan1_colorram2_size) AM_RANGE(0x146000, 0x1467ff) AM_READWRITE(toaplan1_colorram2_r, toaplan1_colorram2_w) AM_BASE_SIZE_MEMBER(toaplan1_state, colorram2, colorram2_size)
AM_RANGE(0x180000, 0x180fff) AM_READWRITE(toaplan1_shared_r, toaplan1_shared_w) AM_RANGE(0x180000, 0x180fff) AM_READWRITE(toaplan1_shared_r, toaplan1_shared_w)
AM_RANGE(0x1c0000, 0x1c0003) AM_WRITE(toaplan1_tile_offsets_w) AM_RANGE(0x1c0000, 0x1c0003) AM_WRITE(toaplan1_tile_offsets_w)
AM_RANGE(0x1c0006, 0x1c0007) AM_WRITE(toaplan1_fcu_flipscreen_w) AM_RANGE(0x1c0006, 0x1c0007) AM_WRITE(toaplan1_fcu_flipscreen_w)
@ -399,8 +399,8 @@ static ADDRESS_MAP_START( hellfire_main_map, ADDRESS_SPACE_PROGRAM, 16 )
// AM_RANGE(0x080000, 0x080001) AM_WRITE(?? video frame related ??) // AM_RANGE(0x080000, 0x080001) AM_WRITE(?? video frame related ??)
AM_RANGE(0x080002, 0x080003) AM_WRITE(toaplan1_intenable_w) AM_RANGE(0x080002, 0x080003) AM_WRITE(toaplan1_intenable_w)
AM_RANGE(0x080008, 0x08000f) AM_WRITE(toaplan1_bcu_control_w) AM_RANGE(0x080008, 0x08000f) AM_WRITE(toaplan1_bcu_control_w)
AM_RANGE(0x084000, 0x0847ff) AM_READWRITE(toaplan1_colorram1_r, toaplan1_colorram1_w) AM_BASE(&toaplan1_colorram1) AM_SIZE(&toaplan1_colorram1_size) AM_RANGE(0x084000, 0x0847ff) AM_READWRITE(toaplan1_colorram1_r, toaplan1_colorram1_w) AM_BASE_SIZE_MEMBER(toaplan1_state, colorram1, colorram1_size)
AM_RANGE(0x086000, 0x0867ff) AM_READWRITE(toaplan1_colorram2_r, toaplan1_colorram2_w) AM_BASE(&toaplan1_colorram2) AM_SIZE(&toaplan1_colorram2_size) AM_RANGE(0x086000, 0x0867ff) AM_READWRITE(toaplan1_colorram2_r, toaplan1_colorram2_w) AM_BASE_SIZE_MEMBER(toaplan1_state, colorram2, colorram2_size)
AM_RANGE(0x0c0000, 0x0c0fff) AM_READWRITE(toaplan1_shared_r, toaplan1_shared_w) AM_RANGE(0x0c0000, 0x0c0fff) AM_READWRITE(toaplan1_shared_r, toaplan1_shared_w)
AM_RANGE(0x100000, 0x100001) AM_WRITE(toaplan1_bcu_flipscreen_w) AM_RANGE(0x100000, 0x100001) AM_WRITE(toaplan1_bcu_flipscreen_w)
AM_RANGE(0x100002, 0x100003) AM_READWRITE(toaplan1_tileram_offs_r, toaplan1_tileram_offs_w) AM_RANGE(0x100002, 0x100003) AM_READWRITE(toaplan1_tileram_offs_r, toaplan1_tileram_offs_w)
@ -425,8 +425,8 @@ static ADDRESS_MAP_START( zerowing_main_map, ADDRESS_SPACE_PROGRAM, 16 )
// AM_RANGE(0x400000, 0x400001) AM_WRITE(?? video frame related ??) // AM_RANGE(0x400000, 0x400001) AM_WRITE(?? video frame related ??)
AM_RANGE(0x400002, 0x400003) AM_WRITE(toaplan1_intenable_w) AM_RANGE(0x400002, 0x400003) AM_WRITE(toaplan1_intenable_w)
AM_RANGE(0x400008, 0x40000f) AM_WRITE(toaplan1_bcu_control_w) AM_RANGE(0x400008, 0x40000f) AM_WRITE(toaplan1_bcu_control_w)
AM_RANGE(0x404000, 0x4047ff) AM_READWRITE(toaplan1_colorram1_r, toaplan1_colorram1_w) AM_BASE(&toaplan1_colorram1) AM_SIZE(&toaplan1_colorram1_size) AM_RANGE(0x404000, 0x4047ff) AM_READWRITE(toaplan1_colorram1_r, toaplan1_colorram1_w) AM_BASE_SIZE_MEMBER(toaplan1_state, colorram1, colorram1_size)
AM_RANGE(0x406000, 0x4067ff) AM_READWRITE(toaplan1_colorram2_r, toaplan1_colorram2_w) AM_BASE(&toaplan1_colorram2) AM_SIZE(&toaplan1_colorram2_size) AM_RANGE(0x406000, 0x4067ff) AM_READWRITE(toaplan1_colorram2_r, toaplan1_colorram2_w) AM_BASE_SIZE_MEMBER(toaplan1_state, colorram2, colorram2_size)
AM_RANGE(0x440000, 0x440fff) AM_READWRITE(toaplan1_shared_r, toaplan1_shared_w) AM_RANGE(0x440000, 0x440fff) AM_READWRITE(toaplan1_shared_r, toaplan1_shared_w)
AM_RANGE(0x480000, 0x480001) AM_WRITE(toaplan1_bcu_flipscreen_w) AM_RANGE(0x480000, 0x480001) AM_WRITE(toaplan1_bcu_flipscreen_w)
AM_RANGE(0x480002, 0x480003) AM_READWRITE(toaplan1_tileram_offs_r, toaplan1_tileram_offs_w) AM_RANGE(0x480002, 0x480003) AM_READWRITE(toaplan1_tileram_offs_r, toaplan1_tileram_offs_w)
@ -444,8 +444,8 @@ static ADDRESS_MAP_START( demonwld_main_map, ADDRESS_SPACE_PROGRAM, 16 )
// AM_RANGE(0x400000, 0x400001) AM_WRITE(?? video frame related ??) // AM_RANGE(0x400000, 0x400001) AM_WRITE(?? video frame related ??)
AM_RANGE(0x400002, 0x400003) AM_WRITE(toaplan1_intenable_w) AM_RANGE(0x400002, 0x400003) AM_WRITE(toaplan1_intenable_w)
AM_RANGE(0x400008, 0x40000f) AM_WRITE(toaplan1_bcu_control_w) AM_RANGE(0x400008, 0x40000f) AM_WRITE(toaplan1_bcu_control_w)
AM_RANGE(0x404000, 0x4047ff) AM_READWRITE(toaplan1_colorram1_r, toaplan1_colorram1_w) AM_BASE(&toaplan1_colorram1) AM_SIZE(&toaplan1_colorram1_size) AM_RANGE(0x404000, 0x4047ff) AM_READWRITE(toaplan1_colorram1_r, toaplan1_colorram1_w) AM_BASE_SIZE_MEMBER(toaplan1_state, colorram1, colorram1_size)
AM_RANGE(0x406000, 0x4067ff) AM_READWRITE(toaplan1_colorram2_r, toaplan1_colorram2_w) AM_BASE(&toaplan1_colorram2) AM_SIZE(&toaplan1_colorram2_size) AM_RANGE(0x406000, 0x4067ff) AM_READWRITE(toaplan1_colorram2_r, toaplan1_colorram2_w) AM_BASE_SIZE_MEMBER(toaplan1_state, colorram2, colorram2_size)
AM_RANGE(0x600000, 0x600fff) AM_READWRITE(toaplan1_shared_r, toaplan1_shared_w) AM_RANGE(0x600000, 0x600fff) AM_READWRITE(toaplan1_shared_r, toaplan1_shared_w)
AM_RANGE(0x800000, 0x800001) AM_WRITE(toaplan1_bcu_flipscreen_w) AM_RANGE(0x800000, 0x800001) AM_WRITE(toaplan1_bcu_flipscreen_w)
AM_RANGE(0x800002, 0x800003) AM_READWRITE(toaplan1_tileram_offs_r, toaplan1_tileram_offs_w) AM_RANGE(0x800002, 0x800003) AM_READWRITE(toaplan1_tileram_offs_r, toaplan1_tileram_offs_w)
@ -472,8 +472,8 @@ static ADDRESS_MAP_START( samesame_main_map, ADDRESS_SPACE_PROGRAM, 16 )
// AM_RANGE(0x100000, 0x100001) AM_WRITE(?? video frame related ??) // AM_RANGE(0x100000, 0x100001) AM_WRITE(?? video frame related ??)
AM_RANGE(0x100002, 0x100003) AM_WRITE(toaplan1_intenable_w) AM_RANGE(0x100002, 0x100003) AM_WRITE(toaplan1_intenable_w)
AM_RANGE(0x100008, 0x10000f) AM_WRITE(toaplan1_bcu_control_w) AM_RANGE(0x100008, 0x10000f) AM_WRITE(toaplan1_bcu_control_w)
AM_RANGE(0x104000, 0x1047ff) AM_READWRITE(toaplan1_colorram1_r, toaplan1_colorram1_w) AM_BASE(&toaplan1_colorram1) AM_SIZE(&toaplan1_colorram1_size) AM_RANGE(0x104000, 0x1047ff) AM_READWRITE(toaplan1_colorram1_r, toaplan1_colorram1_w) AM_BASE_SIZE_MEMBER(toaplan1_state, colorram1, colorram1_size)
AM_RANGE(0x106000, 0x1067ff) AM_READWRITE(toaplan1_colorram2_r, toaplan1_colorram2_w) AM_BASE(&toaplan1_colorram2) AM_SIZE(&toaplan1_colorram2_size) AM_RANGE(0x106000, 0x1067ff) AM_READWRITE(toaplan1_colorram2_r, toaplan1_colorram2_w) AM_BASE_SIZE_MEMBER(toaplan1_state, colorram2, colorram2_size)
AM_RANGE(0x140000, 0x140001) AM_READ_PORT("P1") AM_RANGE(0x140000, 0x140001) AM_READ_PORT("P1")
AM_RANGE(0x140002, 0x140003) AM_READ_PORT("P2") AM_RANGE(0x140002, 0x140003) AM_READ_PORT("P2")
AM_RANGE(0x140004, 0x140005) AM_READ_PORT("DSWA") AM_RANGE(0x140004, 0x140005) AM_READ_PORT("DSWA")
@ -509,8 +509,8 @@ static ADDRESS_MAP_START( outzone_main_map, ADDRESS_SPACE_PROGRAM, 16 )
// AM_RANGE(0x300000, 0x300001) AM_WRITE(?? video frame related ??) // AM_RANGE(0x300000, 0x300001) AM_WRITE(?? video frame related ??)
AM_RANGE(0x300002, 0x300003) AM_WRITE(toaplan1_intenable_w) AM_RANGE(0x300002, 0x300003) AM_WRITE(toaplan1_intenable_w)
AM_RANGE(0x300008, 0x30000f) AM_WRITE(toaplan1_bcu_control_w) AM_RANGE(0x300008, 0x30000f) AM_WRITE(toaplan1_bcu_control_w)
AM_RANGE(0x304000, 0x3047ff) AM_READWRITE(toaplan1_colorram1_r, toaplan1_colorram1_w) AM_BASE(&toaplan1_colorram1) AM_SIZE(&toaplan1_colorram1_size) AM_RANGE(0x304000, 0x3047ff) AM_READWRITE(toaplan1_colorram1_r, toaplan1_colorram1_w) AM_BASE_SIZE_MEMBER(toaplan1_state, colorram1, colorram1_size)
AM_RANGE(0x306000, 0x3067ff) AM_READWRITE(toaplan1_colorram2_r, toaplan1_colorram2_w) AM_BASE(&toaplan1_colorram2) AM_SIZE(&toaplan1_colorram2_size) AM_RANGE(0x306000, 0x3067ff) AM_READWRITE(toaplan1_colorram2_r, toaplan1_colorram2_w) AM_BASE_SIZE_MEMBER(toaplan1_state, colorram2, colorram2_size)
AM_RANGE(0x340000, 0x340003) AM_WRITE(toaplan1_tile_offsets_w) AM_RANGE(0x340000, 0x340003) AM_WRITE(toaplan1_tile_offsets_w)
AM_RANGE(0x340006, 0x340007) AM_WRITE(toaplan1_fcu_flipscreen_w) AM_RANGE(0x340006, 0x340007) AM_WRITE(toaplan1_fcu_flipscreen_w)
ADDRESS_MAP_END ADDRESS_MAP_END
@ -527,8 +527,8 @@ static ADDRESS_MAP_START( vimana_main_map, ADDRESS_SPACE_PROGRAM, 16 )
// AM_RANGE(0x400000, 0x400001) AM_WRITE(?? video frame related ??) // AM_RANGE(0x400000, 0x400001) AM_WRITE(?? video frame related ??)
AM_RANGE(0x400002, 0x400003) AM_WRITE(toaplan1_intenable_w) AM_RANGE(0x400002, 0x400003) AM_WRITE(toaplan1_intenable_w)
AM_RANGE(0x400008, 0x40000f) AM_WRITE(toaplan1_bcu_control_w) AM_RANGE(0x400008, 0x40000f) AM_WRITE(toaplan1_bcu_control_w)
AM_RANGE(0x404000, 0x4047ff) AM_READWRITE(toaplan1_colorram1_r, toaplan1_colorram1_w) AM_BASE(&toaplan1_colorram1) AM_SIZE(&toaplan1_colorram1_size) AM_RANGE(0x404000, 0x4047ff) AM_READWRITE(toaplan1_colorram1_r, toaplan1_colorram1_w) AM_BASE_SIZE_MEMBER(toaplan1_state, colorram1, colorram1_size)
AM_RANGE(0x406000, 0x4067ff) AM_READWRITE(toaplan1_colorram2_r, toaplan1_colorram2_w) AM_BASE(&toaplan1_colorram2) AM_SIZE(&toaplan1_colorram2_size) AM_RANGE(0x406000, 0x4067ff) AM_READWRITE(toaplan1_colorram2_r, toaplan1_colorram2_w) AM_BASE_SIZE_MEMBER(toaplan1_state, colorram2, colorram2_size)
AM_RANGE(0x440000, 0x440005) AM_READWRITE(vimana_mcu_r, vimana_mcu_w) /* shared memory from 0x440000 to 0x44ffff ? */ AM_RANGE(0x440000, 0x440005) AM_READWRITE(vimana_mcu_r, vimana_mcu_w) /* shared memory from 0x440000 to 0x44ffff ? */
AM_RANGE(0x440006, 0x440007) AM_READ_PORT("DSWA") AM_RANGE(0x440006, 0x440007) AM_READ_PORT("DSWA")
AM_RANGE(0x440008, 0x440009) AM_READ(vimana_system_port_r) /* "SYSTEM" + coinage simulation */ AM_RANGE(0x440008, 0x440009) AM_READ(vimana_system_port_r) /* "SYSTEM" + coinage simulation */
@ -548,7 +548,7 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( toaplan1_sound_map, ADDRESS_SPACE_PROGRAM, 8 ) static ADDRESS_MAP_START( toaplan1_sound_map, ADDRESS_SPACE_PROGRAM, 8 )
AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0xffff) AM_RAM AM_BASE(&toaplan1_sharedram) AM_RANGE(0x8000, 0xffff) AM_RAM AM_BASE_MEMBER(toaplan1_state, sharedram)
ADDRESS_MAP_END ADDRESS_MAP_END
static ADDRESS_MAP_START( rallybik_sound_io_map, ADDRESS_SPACE_IO, 8 ) static ADDRESS_MAP_START( rallybik_sound_io_map, ADDRESS_SPACE_IO, 8 )
@ -1512,6 +1512,8 @@ static const ym3812_interface ym3812_config =
static MACHINE_DRIVER_START( rallybik ) static MACHINE_DRIVER_START( rallybik )
MDRV_DRIVER_DATA( toaplan1_state )
/* basic machine hardware */ /* basic machine hardware */
MDRV_CPU_ADD("maincpu", M68000, XTAL_10MHz) MDRV_CPU_ADD("maincpu", M68000, XTAL_10MHz)
MDRV_CPU_PROGRAM_MAP(rallybik_main_map) MDRV_CPU_PROGRAM_MAP(rallybik_main_map)
@ -1526,7 +1528,7 @@ static MACHINE_DRIVER_START( rallybik )
MDRV_MACHINE_RESET(toaplan1) MDRV_MACHINE_RESET(toaplan1)
/* video hardware */ /* video hardware */
MDRV_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK | VIDEO_BUFFERS_SPRITERAM) MDRV_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK)
MDRV_SCREEN_ADD("screen", RASTER) MDRV_SCREEN_ADD("screen", RASTER)
MDRV_SCREEN_REFRESH_RATE(55.14) /* verified on pcb */ MDRV_SCREEN_REFRESH_RATE(55.14) /* verified on pcb */
@ -1552,6 +1554,8 @@ MACHINE_DRIVER_END
static MACHINE_DRIVER_START( truxton ) static MACHINE_DRIVER_START( truxton )
MDRV_DRIVER_DATA( toaplan1_state )
/* basic machine hardware */ /* basic machine hardware */
MDRV_CPU_ADD("maincpu", M68000, XTAL_10MHz) MDRV_CPU_ADD("maincpu", M68000, XTAL_10MHz)
MDRV_CPU_PROGRAM_MAP(truxton_main_map) MDRV_CPU_PROGRAM_MAP(truxton_main_map)
@ -1592,6 +1596,8 @@ MACHINE_DRIVER_END
static MACHINE_DRIVER_START( hellfire ) static MACHINE_DRIVER_START( hellfire )
MDRV_DRIVER_DATA( toaplan1_state )
/* basic machine hardware */ /* basic machine hardware */
MDRV_CPU_ADD("maincpu", M68000, XTAL_10MHz) MDRV_CPU_ADD("maincpu", M68000, XTAL_10MHz)
MDRV_CPU_PROGRAM_MAP(hellfire_main_map) MDRV_CPU_PROGRAM_MAP(hellfire_main_map)
@ -1632,6 +1638,8 @@ MACHINE_DRIVER_END
static MACHINE_DRIVER_START( zerowing ) static MACHINE_DRIVER_START( zerowing )
MDRV_DRIVER_DATA( toaplan1_state )
/* basic machine hardware */ /* basic machine hardware */
MDRV_CPU_ADD("maincpu", M68000, XTAL_10MHz) MDRV_CPU_ADD("maincpu", M68000, XTAL_10MHz)
MDRV_CPU_PROGRAM_MAP(zerowing_main_map) MDRV_CPU_PROGRAM_MAP(zerowing_main_map)
@ -1672,6 +1680,8 @@ MACHINE_DRIVER_END
static MACHINE_DRIVER_START( demonwld ) static MACHINE_DRIVER_START( demonwld )
MDRV_DRIVER_DATA( toaplan1_state )
/* basic machine hardware */ /* basic machine hardware */
MDRV_CPU_ADD("maincpu", M68000, XTAL_10MHz) MDRV_CPU_ADD("maincpu", M68000, XTAL_10MHz)
MDRV_CPU_PROGRAM_MAP(demonwld_main_map) MDRV_CPU_PROGRAM_MAP(demonwld_main_map)
@ -1716,6 +1726,8 @@ MACHINE_DRIVER_END
static MACHINE_DRIVER_START( samesame ) static MACHINE_DRIVER_START( samesame )
MDRV_DRIVER_DATA( toaplan1_state )
/* basic machine hardware */ /* basic machine hardware */
MDRV_CPU_ADD("maincpu", M68000, XTAL_10MHz) MDRV_CPU_ADD("maincpu", M68000, XTAL_10MHz)
MDRV_CPU_PROGRAM_MAP(samesame_main_map) MDRV_CPU_PROGRAM_MAP(samesame_main_map)
@ -1754,6 +1766,8 @@ MACHINE_DRIVER_END
static MACHINE_DRIVER_START( outzone ) static MACHINE_DRIVER_START( outzone )
MDRV_DRIVER_DATA( toaplan1_state )
/* basic machine hardware */ /* basic machine hardware */
MDRV_CPU_ADD("maincpu", M68000, XTAL_10MHz) MDRV_CPU_ADD("maincpu", M68000, XTAL_10MHz)
MDRV_CPU_PROGRAM_MAP(outzone_main_map) MDRV_CPU_PROGRAM_MAP(outzone_main_map)
@ -1794,6 +1808,8 @@ MACHINE_DRIVER_END
static MACHINE_DRIVER_START( vimana ) static MACHINE_DRIVER_START( vimana )
MDRV_DRIVER_DATA( toaplan1_state )
/* basic machine hardware */ /* basic machine hardware */
MDRV_CPU_ADD("maincpu", M68000, XTAL_10MHz) /* verified on pcb */ MDRV_CPU_ADD("maincpu", M68000, XTAL_10MHz) /* verified on pcb */
MDRV_CPU_PROGRAM_MAP(vimana_main_map) MDRV_CPU_PROGRAM_MAP(vimana_main_map)

File diff suppressed because it is too large Load Diff

View File

@ -4,6 +4,85 @@
****************************************************************************/ ****************************************************************************/
class toaplan1_state : public driver_data_t
{
public:
static driver_data_t *alloc(running_machine &machine) { return auto_alloc_clear(&machine, toaplan1_state(machine)); }
toaplan1_state(running_machine &machine)
: driver_data_t(machine) { }
int unk_reset_port;
UINT16 *colorram1;
UINT16 *colorram2;
size_t colorram1_size;
size_t colorram2_size;
UINT8 *sharedram;
int coin_count; /* coin count increments on startup ? , so dont count it */
int intenable;
/* Demon world */
int dsp_on;
int dsp_BIO;
int dsp_execute;
UINT32 dsp_addr_w;
UINT32 main_ram_seg;
UINT8 vimana_coins[2];
UINT8 vimana_credits;
UINT8 vimana_latch;
UINT16 *pf4_tilevram16; /* || Drawn in this order */
UINT16 *pf3_tilevram16; /* || */
UINT16 *pf2_tilevram16; /* \||/ */
UINT16 *pf1_tilevram16; /* \/ */
size_t spriteram_size;
UINT16 *spriteram;
UINT16 *buffered_spriteram;
UINT16 *spritesizeram16;
UINT16 *buffered_spritesizeram16;
INT32 bcu_flipscreen; /* Tile controller flip flag */
INT32 fcu_flipscreen; /* Sprite controller flip flag */
INT32 pf_voffs;
INT32 spriteram_offs;
INT32 pf1_scrollx;
INT32 pf1_scrolly;
INT32 pf2_scrollx;
INT32 pf2_scrolly;
INT32 pf3_scrollx;
INT32 pf3_scrolly;
INT32 pf4_scrollx;
INT32 pf4_scrolly;
INT32 scrollx_offs1;
INT32 scrollx_offs2;
INT32 scrollx_offs3;
INT32 scrollx_offs4;
INT32 scrolly_offs;
#ifdef MAME_DEBUG
int display_pf1;
int display_pf2;
int display_pf3;
int display_pf4;
int displog;
#endif
INT32 tiles_offsetx;
INT32 tiles_offsety;
int reset; /* Hack! See toaplan1_bcu_control below */
tilemap_t *pf1_tilemap, *pf2_tilemap, *pf3_tilemap, *pf4_tilemap;
};
/*----------- defined in machine/toaplan1.c -----------*/ /*----------- defined in machine/toaplan1.c -----------*/
INTERRUPT_GEN( toaplan1_interrupt ); INTERRUPT_GEN( toaplan1_interrupt );
@ -31,15 +110,9 @@ MACHINE_RESET( demonwld );
MACHINE_RESET( vimana ); MACHINE_RESET( vimana );
MACHINE_RESET( zerowing ); /* hack for ZeroWing/OutZone. See video */ MACHINE_RESET( zerowing ); /* hack for ZeroWing/OutZone. See video */
extern void toaplan1_driver_savestate(running_machine *machine); void toaplan1_driver_savestate(running_machine *machine);
extern void demonwld_driver_savestate(running_machine *machine); void demonwld_driver_savestate(running_machine *machine);
extern void vimana_driver_savestate(running_machine *machine); void vimana_driver_savestate(running_machine *machine);
extern int toaplan1_unk_reset_port;
extern UINT8 *toaplan1_sharedram;
/*----------- defined in video/toaplan1.c -----------*/ /*----------- defined in video/toaplan1.c -----------*/
@ -78,9 +151,3 @@ VIDEO_START( toaplan1 );
VIDEO_UPDATE( rallybik ); VIDEO_UPDATE( rallybik );
VIDEO_UPDATE( toaplan1 ); VIDEO_UPDATE( toaplan1 );
VIDEO_UPDATE( demonwld ); VIDEO_UPDATE( demonwld );
extern UINT16 *toaplan1_colorram1;
extern UINT16 *toaplan1_colorram2;
extern size_t toaplan1_colorram1_size;
extern size_t toaplan1_colorram2_size;

View File

@ -30,6 +30,48 @@ public:
gp9001vdp_device* vdp0; gp9001vdp_device* vdp0;
gp9001vdp_device* vdp1; gp9001vdp_device* vdp1;
UINT8 *z80_shared_ram;
UINT16 *shared_ram16; /* Really 8bit RAM connected to Z180 */
#ifndef USE_ENCRYPTED_V25S
UINT16 *V25_shared_ram; /* Really 8bit RAM connected to Z180 */
#endif
UINT8* batsugun_share;
#ifdef USE_ENCRYPTED_V25S
UINT8* batsugun_share2;
#endif
int sub_cpu_type;
running_device *sub_cpu;
UINT16 mcu_data;
UINT16 video_status;
INT8 old_p1_paddle_h; /* For Ghox */
INT8 old_p2_paddle_h;
INT8 current_bank; /* Z80 bank used in Battle Garegga and Batrider */
int sndirq_line; /* IRQ4 for batrider, IRQ2 for bbakraid */
UINT16 z80_busreq;
int unlimited_ver;
UINT16 *txvideoram16;
UINT16 *txvideoram16_offs;
UINT16 *txscrollram16;
UINT16 *tx_gfxram16;
size_t tx_vram_size;
size_t tx_offs_vram_size;
size_t tx_scroll_vram_size;
size_t paletteram16_size;
bitmap_t* custom_priority_bitmap;
bitmap_t* secondary_render_bitmap;
tilemap_t *tx_tilemap; /* Tilemap for extra-text-layer */
UINT8 tx_flip;
int display_tx;
int displog;
}; };
@ -40,22 +82,9 @@ void kbash_okisnd_w(running_device *device, int data);
void fixeight_okisnd_w(running_device *device, int data); void fixeight_okisnd_w(running_device *device, int data);
void batsugun_okisnd_w(running_device *device, int data); void batsugun_okisnd_w(running_device *device, int data);
/*----------- defined in drivers/toaplan2.c -----------*/
extern int toaplan2_sub_cpu;
/*----------- defined in video/toaplan2.c -----------*/ /*----------- defined in video/toaplan2.c -----------*/
extern UINT16 *toaplan2_txvideoram16;
extern UINT16 *toaplan2_txvideoram16_offs;
extern UINT16 *toaplan2_txscrollram16;
extern UINT16 *toaplan2_tx_gfxram16;
extern size_t toaplan2_tx_vram_size;
extern size_t toaplan2_tx_offs_vram_size;
extern size_t toaplan2_tx_scroll_vram_size;
extern size_t batrider_paletteram16_size;
VIDEO_EOF( toaplan2 ); VIDEO_EOF( toaplan2 );
VIDEO_START( toaplan2 ); VIDEO_START( toaplan2 );
VIDEO_START( truxton2 ); VIDEO_START( truxton2 );

View File

@ -38,28 +38,12 @@ static const UINT8 toaplan1_credits_for_coin[TOAPLAN1_REGION_OTHER+1][2][4] =
{ { 1, 1, 1, 1 }, { 1, 1, 1, 1 } }, /* TOAPLAN1_REGION_OTHER */ { { 1, 1, 1, 1 }, { 1, 1, 1, 1 } }, /* TOAPLAN1_REGION_OTHER */
}; };
static int toaplan1_coin_count; /* coin count increments on startup ? , so dont count it */
static int toaplan1_intenable;
static int demonwld_dsp_on;
static int demonwld_dsp_BIO;
static int dsp_execute; /* Demon world */
static UINT32 dsp_addr_w, main_ram_seg; /* Demon world */
static UINT8 vimana_coins[2];
static UINT8 vimana_credits;
static UINT8 vimana_latch;
int toaplan1_unk_reset_port;
UINT8 *toaplan1_sharedram;
INTERRUPT_GEN( toaplan1_interrupt ) INTERRUPT_GEN( toaplan1_interrupt )
{ {
if (toaplan1_intenable) toaplan1_state *state = device->machine->driver_data<toaplan1_state>();
if (state->intenable)
cpu_set_input_line(device, 4, HOLD_LINE); cpu_set_input_line(device, 4, HOLD_LINE);
} }
@ -67,13 +51,16 @@ WRITE16_HANDLER( toaplan1_intenable_w )
{ {
if (ACCESSING_BITS_0_7) if (ACCESSING_BITS_0_7)
{ {
toaplan1_intenable = data & 0xff; toaplan1_state *state = space->machine->driver_data<toaplan1_state>();
state->intenable = data & 0xff;
} }
} }
WRITE16_HANDLER( demonwld_dsp_addrsel_w ) WRITE16_HANDLER( demonwld_dsp_addrsel_w )
{ {
toaplan1_state *state = space->machine->driver_data<toaplan1_state>();
/* This sets the main CPU RAM address the DSP should */ /* This sets the main CPU RAM address the DSP should */
/* read/write, via the DSP IO port 0 */ /* read/write, via the DSP IO port 0 */
/* Top three bits of data need to be shifted left 9 places */ /* Top three bits of data need to be shifted left 9 places */
@ -82,41 +69,44 @@ WRITE16_HANDLER( demonwld_dsp_addrsel_w )
/* Lower thirteen bits of this data is shifted left one position */ /* Lower thirteen bits of this data is shifted left one position */
/* to move it to an even address word boundary */ /* to move it to an even address word boundary */
main_ram_seg = ((data & 0xe000) << 9); state->main_ram_seg = ((data & 0xe000) << 9);
dsp_addr_w = ((data & 0x1fff) << 1); state->dsp_addr_w = ((data & 0x1fff) << 1);
logerror("DSP PC:%04x IO write %04x (%08x) at port 0\n",cpu_get_previouspc(space->cpu),data,main_ram_seg + dsp_addr_w); logerror("DSP PC:%04x IO write %04x (%08x) at port 0\n", cpu_get_previouspc(space->cpu), data, state->main_ram_seg + state->dsp_addr_w);
} }
READ16_HANDLER( demonwld_dsp_r ) READ16_HANDLER( demonwld_dsp_r )
{ {
/* DSP can read data from main CPU RAM via DSP IO port 1 */ /* DSP can read data from main CPU RAM via DSP IO port 1 */
toaplan1_state *state = space->machine->driver_data<toaplan1_state>();
address_space *mainspace; address_space *mainspace;
UINT16 input_data = 0; UINT16 input_data = 0;
switch (main_ram_seg) {
switch (state->main_ram_seg) {
case 0xc00000: mainspace = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM); case 0xc00000: mainspace = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
input_data = mainspace->read_word(main_ram_seg + dsp_addr_w); input_data = mainspace->read_word(state->main_ram_seg + state->dsp_addr_w);
break; break;
default: logerror("DSP PC:%04x Warning !!! IO reading from %08x (port 1)\n",cpu_get_previouspc(space->cpu),main_ram_seg + dsp_addr_w); default: logerror("DSP PC:%04x Warning !!! IO reading from %08x (port 1)\n", cpu_get_previouspc(space->cpu), state->main_ram_seg + state->dsp_addr_w);
} }
logerror("DSP PC:%04x IO read %04x at %08x (port 1)\n",cpu_get_previouspc(space->cpu),input_data,main_ram_seg + dsp_addr_w); logerror("DSP PC:%04x IO read %04x at %08x (port 1)\n", cpu_get_previouspc(space->cpu), input_data, state->main_ram_seg + state->dsp_addr_w);
return input_data; return input_data;
} }
WRITE16_HANDLER( demonwld_dsp_w ) WRITE16_HANDLER( demonwld_dsp_w )
{ {
toaplan1_state *state = space->machine->driver_data<toaplan1_state>();
address_space *mainspace; address_space *mainspace;
/* Data written to main CPU RAM via DSP IO port 1 */ /* Data written to main CPU RAM via DSP IO port 1 */
dsp_execute = 0; state->dsp_execute = 0;
switch (main_ram_seg) { switch (state->main_ram_seg) {
case 0xc00000: if ((dsp_addr_w < 3) && (data == 0)) dsp_execute = 1; case 0xc00000: if ((state->dsp_addr_w < 3) && (data == 0)) state->dsp_execute = 1;
mainspace = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM); mainspace = cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM);
mainspace->write_word(main_ram_seg + dsp_addr_w, data); mainspace->write_word(state->main_ram_seg + state->dsp_addr_w, data);
break; break;
default: logerror("DSP PC:%04x Warning !!! IO writing to %08x (port 1)\n",cpu_get_previouspc(space->cpu),main_ram_seg + dsp_addr_w); default: logerror("DSP PC:%04x Warning !!! IO writing to %08x (port 1)\n", cpu_get_previouspc(space->cpu), state->main_ram_seg + state->dsp_addr_w);
} }
logerror("DSP PC:%04x IO write %04x at %08x (port 1)\n",cpu_get_previouspc(space->cpu),data,main_ram_seg + dsp_addr_w); logerror("DSP PC:%04x IO write %04x at %08x (port 1)\n", cpu_get_previouspc(space->cpu), data, state->main_ram_seg + state->dsp_addr_w);
} }
WRITE16_HANDLER( demonwld_dsp_bio_w ) WRITE16_HANDLER( demonwld_dsp_bio_w )
@ -126,29 +116,36 @@ WRITE16_HANDLER( demonwld_dsp_bio_w )
/* Actually only DSP data bit 15 controls this */ /* Actually only DSP data bit 15 controls this */
/* data 0x0000 means set DSP BIO line active and disable */ /* data 0x0000 means set DSP BIO line active and disable */
/* communication to main processor*/ /* communication to main processor*/
logerror("DSP PC:%04x IO write %04x at port 3\n",cpu_get_previouspc(space->cpu),data);
toaplan1_state *state = space->machine->driver_data<toaplan1_state>();
logerror("DSP PC:%04x IO write %04x at port 3\n", cpu_get_previouspc(space->cpu), data);
if (data & 0x8000) { if (data & 0x8000) {
demonwld_dsp_BIO = CLEAR_LINE; state->dsp_BIO = CLEAR_LINE;
} }
if (data == 0) { if (data == 0) {
if (dsp_execute) { if (state->dsp_execute) {
logerror("Turning 68000 on\n"); logerror("Turning 68000 on\n");
cputag_set_input_line(space->machine, "maincpu", INPUT_LINE_HALT, CLEAR_LINE); cputag_set_input_line(space->machine, "maincpu", INPUT_LINE_HALT, CLEAR_LINE);
dsp_execute = 0; state->dsp_execute = 0;
} }
demonwld_dsp_BIO = ASSERT_LINE; state->dsp_BIO = ASSERT_LINE;
} }
} }
READ16_HANDLER ( demonwld_BIO_r ) READ16_HANDLER ( demonwld_BIO_r )
{ {
return demonwld_dsp_BIO; toaplan1_state *state = space->machine->driver_data<toaplan1_state>();
return state->dsp_BIO;
} }
static void demonwld_dsp(running_machine *machine, int enable) static void demonwld_dsp(running_machine *machine, int enable)
{ {
demonwld_dsp_on = enable; toaplan1_state *state = machine->driver_data<toaplan1_state>();
state->dsp_on = enable;
if (enable) if (enable)
{ {
logerror("Turning DSP on and 68000 off\n"); logerror("Turning DSP on and 68000 off\n");
@ -166,7 +163,8 @@ static void demonwld_dsp(running_machine *machine, int enable)
static STATE_POSTLOAD( demonwld_restore_dsp ) static STATE_POSTLOAD( demonwld_restore_dsp )
{ {
demonwld_dsp(machine, demonwld_dsp_on); toaplan1_state *state = machine->driver_data<toaplan1_state>();
demonwld_dsp(machine, state->dsp_on);
} }
WRITE16_HANDLER( demonwld_dsp_ctrl_w ) WRITE16_HANDLER( demonwld_dsp_ctrl_w )
@ -207,32 +205,34 @@ READ16_HANDLER ( vimana_system_port_r )
TOAPLAN1_REGION_JAPAN, TOAPLAN1_REGION_OTHER, TOAPLAN1_REGION_OTHER, TOAPLAN1_REGION_OTHER, TOAPLAN1_REGION_JAPAN, TOAPLAN1_REGION_OTHER, TOAPLAN1_REGION_OTHER, TOAPLAN1_REGION_OTHER,
TOAPLAN1_REGION_OTHER, TOAPLAN1_REGION_OTHER, TOAPLAN1_REGION_OTHER, TOAPLAN1_REGION_JAPAN TOAPLAN1_REGION_OTHER, TOAPLAN1_REGION_OTHER, TOAPLAN1_REGION_OTHER, TOAPLAN1_REGION_JAPAN
}; };
toaplan1_state *state = space->machine->driver_data<toaplan1_state>();
int data, p, r, d, slot, reg, dsw; int data, p, r, d, slot, reg, dsw;
slot = -1; slot = -1;
d = input_port_read(space->machine, "DSWA"); d = input_port_read(space->machine, "DSWA");
r = input_port_read(space->machine, "TJUMP"); r = input_port_read(space->machine, "TJUMP");
p = input_port_read(space->machine, "SYSTEM"); p = input_port_read(space->machine, "SYSTEM");
vimana_latch ^= p; state->vimana_latch ^= p;
data = (vimana_latch & p); data = (state->vimana_latch & p);
/* simulate the mcu keeping track of credits based on region and coinage settings */ /* simulate the mcu keeping track of credits based on region and coinage settings */
/* latch so it doesn't add more than one coin per keypress */ /* latch so it doesn't add more than one coin per keypress */
if (d & 0x04) /* "test mode" ON */ if (d & 0x04) /* "test mode" ON */
{ {
vimana_coins[0] = vimana_coins[1] = 0; state->vimana_coins[0] = state->vimana_coins[1] = 0;
vimana_credits = 0; state->vimana_credits = 0;
} }
else /* "test mode" OFF */ else /* "test mode" OFF */
{ {
if (data & 0x02) /* TILT */ if (data & 0x02) /* TILT */
{ {
vimana_coins[0] = vimana_coins[1] = 0; state->vimana_coins[0] = state->vimana_coins[1] = 0;
vimana_credits = 0; state->vimana_credits = 0;
} }
if (data & 0x01) /* SERVICE1 */ if (data & 0x01) /* SERVICE1 */
{ {
vimana_credits++ ; state->vimana_credits++ ;
} }
if (data & 0x08) /* COIN1 */ if (data & 0x08) /* COIN1 */
{ {
@ -247,23 +247,23 @@ READ16_HANDLER ( vimana_system_port_r )
{ {
reg = vimana_region[r]; reg = vimana_region[r];
dsw = (d & 0xf0) >> (4 + 2 * slot); dsw = (d & 0xf0) >> (4 + 2 * slot);
vimana_coins[slot]++; state->vimana_coins[slot]++;
if (vimana_coins[slot] >= toaplan1_coins_for_credit[reg][slot][dsw]) if (state->vimana_coins[slot] >= toaplan1_coins_for_credit[reg][slot][dsw])
{ {
vimana_credits += toaplan1_credits_for_coin[reg][slot][dsw]; state->vimana_credits += toaplan1_credits_for_coin[reg][slot][dsw];
vimana_coins[slot] -= toaplan1_coins_for_credit[reg][slot][dsw]; state->vimana_coins[slot] -= toaplan1_coins_for_credit[reg][slot][dsw];
} }
coin_counter_w(space->machine, slot, 1); coin_counter_w(space->machine, slot, 1);
coin_counter_w(space->machine, slot, 0); coin_counter_w(space->machine, slot, 0);
} }
if (vimana_credits >= 9) if (state->vimana_credits >= 9)
vimana_credits = 9; state->vimana_credits = 9;
} }
coin_lockout_global_w(space->machine, (vimana_credits >= 9)); coin_lockout_global_w(space->machine, (state->vimana_credits >= 9));
vimana_latch = p; state->vimana_latch = p;
return p & 0xffff; return p & 0xffff;
} }
@ -275,7 +275,12 @@ READ16_HANDLER( vimana_mcu_r )
{ {
case 0: data = 0xff; break; case 0: data = 0xff; break;
case 1: data = 0x00; break; case 1: data = 0x00; break;
case 2: data = vimana_credits; break; case 2:
{
toaplan1_state *state = space->machine->driver_data<toaplan1_state>();
data = state->vimana_credits;
break;
}
} }
return data & 0xff; return data & 0xff;
} }
@ -286,10 +291,12 @@ WRITE16_HANDLER( vimana_mcu_w )
{ {
case 0: break; case 0: break;
case 1: break; case 1: break;
case 2: if (ACCESSING_BITS_0_7) case 2:
if (ACCESSING_BITS_0_7)
{ {
vimana_credits = data & 0xff; toaplan1_state *state = space->machine->driver_data<toaplan1_state>();
coin_lockout_global_w(space->machine, (vimana_credits >= 9)); state->vimana_credits = data & 0xff;
coin_lockout_global_w(space->machine, (state->vimana_credits >= 9));
} }
break; break;
} }
@ -297,14 +304,16 @@ WRITE16_HANDLER( vimana_mcu_w )
READ16_HANDLER( toaplan1_shared_r ) READ16_HANDLER( toaplan1_shared_r )
{ {
return toaplan1_sharedram[offset] & 0xff; toaplan1_state *state = space->machine->driver_data<toaplan1_state>();
return state->sharedram[offset] & 0xff;
} }
WRITE16_HANDLER( toaplan1_shared_w ) WRITE16_HANDLER( toaplan1_shared_w )
{ {
if (ACCESSING_BITS_0_7) if (ACCESSING_BITS_0_7)
{ {
toaplan1_sharedram[offset] = data & 0xff; toaplan1_state *state = space->machine->driver_data<toaplan1_state>();
state->sharedram[offset] = data & 0xff;
} }
} }
@ -326,15 +335,17 @@ WRITE16_HANDLER( toaplan1_reset_sound )
WRITE8_HANDLER( rallybik_coin_w ) WRITE8_HANDLER( rallybik_coin_w )
{ {
toaplan1_state *state = space->machine->driver_data<toaplan1_state>();
switch (data) { switch (data) {
case 0x08: if (toaplan1_coin_count) { coin_counter_w(space->machine, 0,1); coin_counter_w(space->machine, 0,0); } break; case 0x08: if (state->coin_count) { coin_counter_w(space->machine, 0, 1); coin_counter_w(space->machine, 0, 0); } break;
case 0x09: if (toaplan1_coin_count) { coin_counter_w(space->machine, 2,1); coin_counter_w(space->machine, 2,0); } break; case 0x09: if (state->coin_count) { coin_counter_w(space->machine, 2, 1); coin_counter_w(space->machine, 2, 0); } break;
case 0x0a: if (toaplan1_coin_count) { coin_counter_w(space->machine, 1,1); coin_counter_w(space->machine, 1,0); } break; case 0x0a: if (state->coin_count) { coin_counter_w(space->machine, 1, 1); coin_counter_w(space->machine, 1, 0); } break;
case 0x0b: if (toaplan1_coin_count) { coin_counter_w(space->machine, 3,1); coin_counter_w(space->machine, 3,0); } break; case 0x0b: if (state->coin_count) { coin_counter_w(space->machine, 3, 1); coin_counter_w(space->machine, 3, 0); } break;
case 0x0c: coin_lockout_w(space->machine, 0,1); coin_lockout_w(space->machine, 2,1); break; case 0x0c: coin_lockout_w(space->machine, 0, 1); coin_lockout_w(space->machine, 2, 1); break;
case 0x0d: coin_lockout_w(space->machine, 0,0); coin_lockout_w(space->machine, 2,0); break; case 0x0d: coin_lockout_w(space->machine, 0, 0); coin_lockout_w(space->machine, 2, 0); break;
case 0x0e: coin_lockout_w(space->machine, 1,1); coin_lockout_w(space->machine, 3,1); break; case 0x0e: coin_lockout_w(space->machine, 1, 1); coin_lockout_w(space->machine, 3, 1); break;
case 0x0f: coin_lockout_w(space->machine, 1,0); coin_lockout_w(space->machine, 3,0); toaplan1_coin_count=1; break; case 0x0f: coin_lockout_w(space->machine, 1, 0); coin_lockout_w(space->machine, 3, 0); state->coin_count=1; break;
default: logerror("PC:%04x Writing unknown data (%04x) to coin count/lockout port\n",cpu_get_previouspc(space->cpu),data); break; default: logerror("PC:%04x Writing unknown data (%04x) to coin count/lockout port\n",cpu_get_previouspc(space->cpu),data); break;
} }
} }
@ -384,55 +395,69 @@ WRITE16_HANDLER( samesame_coin_w )
MACHINE_RESET( toaplan1 ) MACHINE_RESET( toaplan1 )
{ {
toaplan1_intenable = 0; toaplan1_state *state = machine->driver_data<toaplan1_state>();
toaplan1_coin_count = 0;
toaplan1_unk_reset_port = 0; state->intenable = 0;
state->coin_count = 0;
state->unk_reset_port = 0;
coin_lockout_global_w(machine, 0); coin_lockout_global_w(machine, 0);
} }
void toaplan1_driver_savestate(running_machine *machine) void toaplan1_driver_savestate(running_machine *machine)
{ {
state_save_register_global(machine, toaplan1_intenable); toaplan1_state *state = machine->driver_data<toaplan1_state>();
state_save_register_global(machine, toaplan1_coin_count);
state_save_register_global(machine, toaplan1_unk_reset_port); state_save_register_global(machine, state->intenable);
state_save_register_global(machine, state->coin_count);
state_save_register_global(machine, state->unk_reset_port);
} }
MACHINE_RESET( zerowing ) /* Hack for ZeroWing and OutZone. See the video driver */ MACHINE_RESET( zerowing ) /* Hack for ZeroWing and OutZone. See the video driver */
{ {
toaplan1_state *state = machine->driver_data<toaplan1_state>();
MACHINE_RESET_CALL(toaplan1); MACHINE_RESET_CALL(toaplan1);
toaplan1_unk_reset_port = 1; state->unk_reset_port = 1;
} }
MACHINE_RESET( demonwld ) MACHINE_RESET( demonwld )
{ {
toaplan1_state *state = machine->driver_data<toaplan1_state>();
MACHINE_RESET_CALL(toaplan1); MACHINE_RESET_CALL(toaplan1);
dsp_addr_w = 0; state->dsp_addr_w = 0;
main_ram_seg = 0; state->main_ram_seg = 0;
dsp_execute = 0; state->dsp_execute = 0;
} }
void demonwld_driver_savestate(running_machine *machine) void demonwld_driver_savestate(running_machine *machine)
{ {
state_save_register_global(machine, demonwld_dsp_on); toaplan1_state *state = machine->driver_data<toaplan1_state>();
state_save_register_global(machine, dsp_addr_w);
state_save_register_global(machine, main_ram_seg); state_save_register_global(machine, state->dsp_on);
state_save_register_global(machine, demonwld_dsp_BIO); state_save_register_global(machine, state->dsp_addr_w);
state_save_register_global(machine, dsp_execute); state_save_register_global(machine, state->main_ram_seg);
state_save_register_global(machine, state->dsp_BIO);
state_save_register_global(machine, state->dsp_execute);
state_save_register_postload(machine, demonwld_restore_dsp, NULL); state_save_register_postload(machine, demonwld_restore_dsp, NULL);
} }
MACHINE_RESET( vimana ) MACHINE_RESET( vimana )
{ {
toaplan1_state *state = machine->driver_data<toaplan1_state>();
MACHINE_RESET_CALL(toaplan1); MACHINE_RESET_CALL(toaplan1);
vimana_coins[0] = vimana_coins[1] = 0; state->vimana_coins[0] = state->vimana_coins[1] = 0;
vimana_credits = 0; state->vimana_credits = 0;
vimana_latch = 0; state->vimana_latch = 0;
} }
void vimana_driver_savestate(running_machine *machine) void vimana_driver_savestate(running_machine *machine)
{ {
state_save_register_global(machine, vimana_coins[0]); toaplan1_state *state = machine->driver_data<toaplan1_state>();
state_save_register_global(machine, vimana_coins[1]);
state_save_register_global(machine, vimana_credits); state_save_register_global(machine, state->vimana_coins[0]);
state_save_register_global(machine, vimana_latch); state_save_register_global(machine, state->vimana_coins[1]);
state_save_register_global(machine, state->vimana_credits);
state_save_register_global(machine, state->vimana_latch);
} }

View File

@ -128,11 +128,6 @@ Pipi & Bibis | Fix Eight | V-Five | Snow Bros. 2 |
#include "emu.h" #include "emu.h"
#include "gp9001.h" #include "gp9001.h"
bitmap_t* gp9001_custom_priority_bitmap;
bitmap_t* gp9001_secondary_render_bitmap;
int gp9001_displog = 0;
static WRITE16_DEVICE_HANDLER( gp9001_bg_tilemap_w ) static WRITE16_DEVICE_HANDLER( gp9001_bg_tilemap_w )
{ {
gp9001vdp_device *vdp = (gp9001vdp_device*)device; gp9001vdp_device *vdp = (gp9001vdp_device*)device;
@ -995,10 +990,10 @@ void gp9001_log_vram(gp9001vdp_device* vdp, running_machine *machine)
if ( input_code_pressed_once(machine, KEYCODE_E) ) if ( input_code_pressed_once(machine, KEYCODE_E) )
{ {
gp9001_displog += 1; *vdp->displog += 1;
gp9001_displog &= 1; *vdp->displog &= 1;
} }
if (gp9001_displog) if (*vdp->displog)
{ {
logerror("Scrolls BG-X BG-Y FG-X FG-Y TOP-X TOP-Y Sprite-X Sprite-Y\n"); logerror("Scrolls BG-X BG-Y FG-X FG-Y TOP-X TOP-Y Sprite-X Sprite-Y\n");
@ -1176,7 +1171,7 @@ void gp9001vdp_device::draw_sprites( running_machine *machine, bitmap_t *bitmap,
{ {
UINT8 pix = srcdata[count]; UINT8 pix = srcdata[count];
UINT16* dstptr = BITMAP_ADDR16(bitmap,drawyy,drawxx); UINT16* dstptr = BITMAP_ADDR16(bitmap,drawyy,drawxx);
UINT8* dstpri = BITMAP_ADDR8(gp9001_custom_priority_bitmap, drawyy, drawxx); UINT8* dstpri = BITMAP_ADDR8(this->custom_priority_bitmap, drawyy, drawxx);
if (priority >= dstpri[0]) if (priority >= dstpri[0])
{ {
@ -1228,7 +1223,7 @@ void gp9001vdp_device::gp9001_draw_custom_tilemap(running_machine* machine, bitm
srcptr = BITMAP_ADDR16(tmb, realy, 0); srcptr = BITMAP_ADDR16(tmb, realy, 0);
dstptr = BITMAP_ADDR16(bitmap, y, 0); dstptr = BITMAP_ADDR16(bitmap, y, 0);
dstpriptr = BITMAP_ADDR8(gp9001_custom_priority_bitmap, y, 0); dstpriptr = BITMAP_ADDR8(this->custom_priority_bitmap, y, 0);
for (x=0;x<width;x++) for (x=0;x<width;x++)
{ {
@ -1257,7 +1252,7 @@ void gp9001vdp_device::gp9001_draw_custom_tilemap(running_machine* machine, bitm
static const UINT8 gp9001_primap1[16] = { 0x00, 0x04, 0x08, 0x0c, 0x10, 0x14, 0x18, 0x1c, 0x20, 0x24, 0x28, 0x2c, 0x30, 0x34, 0x38, 0x3c }; static const UINT8 gp9001_primap1[16] = { 0x00, 0x04, 0x08, 0x0c, 0x10, 0x14, 0x18, 0x1c, 0x20, 0x24, 0x28, 0x2c, 0x30, 0x34, 0x38, 0x3c };
//UINT8 gp9001_sprprimap1[16] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f }; //static const UINT8 gp9001_sprprimap1[16] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f };
static const UINT8 gp9001_sprprimap1[16] = { 0x00, 0x04, 0x08, 0x0c, 0x10, 0x14, 0x18, 0x1c, 0x20, 0x24, 0x28, 0x2c, 0x30, 0x34, 0x38, 0x3c }; static const UINT8 gp9001_sprprimap1[16] = { 0x00, 0x04, 0x08, 0x0c, 0x10, 0x14, 0x18, 0x1c, 0x20, 0x24, 0x28, 0x2c, 0x30, 0x34, 0x38, 0x3c };
static const UINT8 batsugun_prienable0[16]={ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 }; static const UINT8 batsugun_prienable0[16]={ 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 };

View File

@ -1,8 +1,5 @@
/* GP9001 Video Controller */ /* GP9001 Video Controller */
extern bitmap_t* gp9001_custom_priority_bitmap;
extern bitmap_t* gp9001_secondary_render_bitmap;
class gp9001vdp_device_config : public device_config, class gp9001vdp_device_config : public device_config,
public device_config_memory_interface public device_config_memory_interface
{ {
@ -77,6 +74,9 @@ public:
int extra_xoffset[4]; int extra_xoffset[4];
int extra_yoffset[4]; int extra_yoffset[4];
bitmap_t *custom_priority_bitmap;
int *displog;
protected: protected:
virtual void device_start(); virtual void device_start();
virtual void device_reset(); virtual void device_reset();
@ -97,7 +97,6 @@ const device_type gp9001vdp_ = gp9001vdp_device_config::static_alloc_device_conf
ADDRESS_MAP_EXTERN( gp9001vdp0_map, 16 ); ADDRESS_MAP_EXTERN( gp9001vdp0_map, 16 );
ADDRESS_MAP_EXTERN( gp9001vdp1_map, 16 ); ADDRESS_MAP_EXTERN( gp9001vdp1_map, 16 );
extern int gp9001_displog;
/* vdp map 0, gfx region 0 */ /* vdp map 0, gfx region 0 */

File diff suppressed because it is too large Load Diff

View File

@ -30,23 +30,6 @@
UINT16 *toaplan2_txvideoram16; /* Video ram for extra text layer */
UINT16 *toaplan2_txvideoram16_offs; /* Text layer tile flip and positon ? */
UINT16 *toaplan2_txscrollram16; /* Text layer scroll ? */
UINT16 *toaplan2_tx_gfxram16; /* Text Layer RAM based tiles */
size_t toaplan2_tx_vram_size; /* 0x2000 Text layer RAM size */
size_t toaplan2_tx_offs_vram_size; /* 0x200 Text layer tile flip and positon ? */
size_t toaplan2_tx_scroll_vram_size; /* 0x200 Text layer scroll ? */
size_t batrider_paletteram16_size;
static int display_tx;
static UINT8 tx_flip = 0;
static tilemap_t *tx_tilemap; /* Tilemap for extra-text-layer */
/*************************************************************************** /***************************************************************************
Callbacks for the TileMap code Callbacks for the TileMap code
@ -55,9 +38,10 @@ static tilemap_t *tx_tilemap; /* Tilemap for extra-text-layer */
static TILE_GET_INFO( get_text_tile_info ) static TILE_GET_INFO( get_text_tile_info )
{ {
toaplan2_state *state = machine->driver_data<toaplan2_state>();
int color, tile_number, attrib; int color, tile_number, attrib;
attrib = toaplan2_txvideoram16[tile_index]; attrib = state->txvideoram16[tile_index];
tile_number = attrib & 0x3ff; tile_number = attrib & 0x3ff;
color = ((attrib >> 10) | 0x40) & 0x7f; color = ((attrib >> 10) | 0x40) & 0x7f;
SET_TILE_INFO( SET_TILE_INFO(
@ -76,50 +60,66 @@ static TILE_GET_INFO( get_text_tile_info )
static void truxton2_create_tx_tilemap(running_machine *machine) static void truxton2_create_tx_tilemap(running_machine *machine)
{ {
tx_tilemap = tilemap_create(machine, get_text_tile_info,tilemap_scan_rows,8,8,64,32); toaplan2_state *state = machine->driver_data<toaplan2_state>();
tilemap_set_scroll_rows(tx_tilemap,8*32); /* line scrolling */
tilemap_set_scroll_cols(tx_tilemap,1); state->tx_tilemap = tilemap_create(machine, get_text_tile_info, tilemap_scan_rows, 8, 8, 64, 32);
tilemap_set_transparent_pen(tx_tilemap,0); tilemap_set_scroll_rows(state->tx_tilemap, 8*32); /* line scrolling */
tilemap_set_scroll_cols(state->tx_tilemap, 1);
tilemap_set_transparent_pen(state->tx_tilemap, 0);
} }
static void register_state_save(running_machine *machine) static void register_state_save(running_machine *machine)
{ {
state_save_register_global(machine, tx_flip); toaplan2_state *state = machine->driver_data<toaplan2_state>();
state_save_register_global(machine, state->tx_flip);
} }
VIDEO_START( toaplan2 ) VIDEO_START( toaplan2 )
{ {
toaplan2_state *state = machine->driver_data<toaplan2_state>();
int width = machine->primary_screen->width(); int width = machine->primary_screen->width();
int height = machine->primary_screen->height(); int height = machine->primary_screen->height();
/* cache the VDP device */ /* cache the VDP device */
toaplan2_state *state = machine->driver_data<toaplan2_state>();
state->vdp0 = machine->device<gp9001vdp_device>("gp9001vdp0"); state->vdp0 = machine->device<gp9001vdp_device>("gp9001vdp0");
state->vdp1 = machine->device<gp9001vdp_device>("gp9001vdp1"); state->vdp1 = machine->device<gp9001vdp_device>("gp9001vdp1");
/* our current VDP implementation needs this bitmap to work with */ /* our current VDP implementation needs this bitmap to work with */
gp9001_custom_priority_bitmap = auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED8); state->custom_priority_bitmap = auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED8);
state->displog = 0; // debug flag
if (state->vdp1) if (state->vdp0 != NULL)
gp9001_secondary_render_bitmap = auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED16); {
state->secondary_render_bitmap = NULL;
state->vdp0->custom_priority_bitmap = state->custom_priority_bitmap;
state->vdp0->displog = &state->displog;
}
gp9001_displog = 0; // debug flag if (state->vdp1 != NULL)
{
state->secondary_render_bitmap = auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED16);
state->vdp1->custom_priority_bitmap = state->custom_priority_bitmap;
state->vdp1->displog = &state->displog;
}
display_tx = 1; state->display_tx = 1;
register_state_save(machine); register_state_save(machine);
} }
VIDEO_START( truxton2 ) VIDEO_START( truxton2 )
{ {
toaplan2_state *state = machine->driver_data<toaplan2_state>();
VIDEO_START_CALL( toaplan2 ); VIDEO_START_CALL( toaplan2 );
/* Create the Text tilemap for this game */ /* Create the Text tilemap for this game */
truxton2_create_tx_tilemap(machine); truxton2_create_tx_tilemap(machine);
if (machine->gfx[2]->srcdata == NULL) if (machine->gfx[2]->srcdata == NULL)
gfx_element_set_source(machine->gfx[2], (UINT8 *)toaplan2_tx_gfxram16); gfx_element_set_source(machine->gfx[2], (UINT8 *)state->tx_gfxram16);
tilemap_set_scrolldx(tx_tilemap, 0x1d4 +1, 0x2a); tilemap_set_scrolldx(state->tx_tilemap, 0x1d4 +1, 0x2a);
} }
VIDEO_START( fixeighb ) VIDEO_START( fixeighb )
@ -139,16 +139,18 @@ VIDEO_START( fixeighb )
state->vdp0->extra_yoffset[2]=-15; state->vdp0->extra_yoffset[2]=-15;
state->vdp0->extra_yoffset[3]=8; state->vdp0->extra_yoffset[3]=8;
tilemap_set_scrolldx(tx_tilemap, 0, 0); tilemap_set_scrolldx(state->tx_tilemap, 0, 0);
} }
VIDEO_START( bgaregga ) VIDEO_START( bgaregga )
{ {
toaplan2_state *state = machine->driver_data<toaplan2_state>();
VIDEO_START_CALL( toaplan2 ); VIDEO_START_CALL( toaplan2 );
/* Create the Text tilemap for this game */ /* Create the Text tilemap for this game */
truxton2_create_tx_tilemap(machine); truxton2_create_tx_tilemap(machine);
tilemap_set_scrolldx(tx_tilemap, 0x1d4, 0x2a); tilemap_set_scrolldx(state->tx_tilemap, 0x1d4, 0x2a);
} }
VIDEO_START( batrider ) VIDEO_START( batrider )
@ -159,11 +161,11 @@ VIDEO_START( batrider )
state->vdp0->spriteram16_n = state->vdp0->spriteram16_new; state->vdp0->spriteram16_n = state->vdp0->spriteram16_new;
/* Create the Text tilemap for this game */ /* Create the Text tilemap for this game */
toaplan2_tx_gfxram16 = auto_alloc_array_clear(machine, UINT16, RAIZING_TX_GFXRAM_SIZE/2); state->tx_gfxram16 = auto_alloc_array_clear(machine, UINT16, RAIZING_TX_GFXRAM_SIZE/2);
state_save_register_global_pointer(machine, toaplan2_tx_gfxram16, RAIZING_TX_GFXRAM_SIZE/2); state_save_register_global_pointer(machine, state->tx_gfxram16, RAIZING_TX_GFXRAM_SIZE/2);
gfx_element_set_source(machine->gfx[2], (UINT8 *)toaplan2_tx_gfxram16); gfx_element_set_source(machine->gfx[2], (UINT8 *)state->tx_gfxram16);
truxton2_create_tx_tilemap(machine); truxton2_create_tx_tilemap(machine);
tilemap_set_scrolldx(tx_tilemap, 0x1d4, 0x2a); tilemap_set_scrolldx(state->tx_tilemap, 0x1d4, 0x2a);
/* Has special banking */ /* Has special banking */
state->vdp0->gp9001_gfxrom_is_banked = 1; state->vdp0->gp9001_gfxrom_is_banked = 1;
@ -171,20 +173,27 @@ VIDEO_START( batrider )
READ16_HANDLER( toaplan2_txvideoram16_r ) READ16_HANDLER( toaplan2_txvideoram16_r )
{ {
return toaplan2_txvideoram16[offset]; toaplan2_state *state = space->machine->driver_data<toaplan2_state>();
return state->txvideoram16[offset];
} }
WRITE16_HANDLER( toaplan2_txvideoram16_w ) WRITE16_HANDLER( toaplan2_txvideoram16_w )
{ {
COMBINE_DATA(&toaplan2_txvideoram16[offset]); toaplan2_state *state = space->machine->driver_data<toaplan2_state>();
if (offset < (toaplan2_tx_vram_size/4))
tilemap_mark_tile_dirty(tx_tilemap,offset); COMBINE_DATA(&state->txvideoram16[offset]);
if (offset < (state->tx_vram_size/4))
tilemap_mark_tile_dirty(state->tx_tilemap, offset);
} }
READ16_HANDLER( toaplan2_txvideoram16_offs_r ) READ16_HANDLER( toaplan2_txvideoram16_offs_r )
{ {
return toaplan2_txvideoram16_offs[offset]; toaplan2_state *state = space->machine->driver_data<toaplan2_state>();
return state->txvideoram16_offs[offset];
} }
WRITE16_HANDLER( toaplan2_txvideoram16_offs_w ) WRITE16_HANDLER( toaplan2_txvideoram16_offs_w )
{ {
/* Besides containing flip, function of this RAM is still unknown */ /* Besides containing flip, function of this RAM is still unknown */
@ -192,7 +201,8 @@ WRITE16_HANDLER( toaplan2_txvideoram16_offs_w )
/* Maybe specifies which line to draw text info (line number data is */ /* Maybe specifies which line to draw text info (line number data is */
/* opposite when flip bits are on) */ /* opposite when flip bits are on) */
UINT16 oldword = toaplan2_txvideoram16_offs[offset]; toaplan2_state *state = space->machine->driver_data<toaplan2_state>();
UINT16 oldword = state->txvideoram16_offs[offset];
if (oldword != data) if (oldword != data)
{ {
@ -200,73 +210,84 @@ WRITE16_HANDLER( toaplan2_txvideoram16_offs_w )
{ {
if (data & 0x8000) /* Flip off */ if (data & 0x8000) /* Flip off */
{ {
tx_flip = 0; state->tx_flip = 0;
tilemap_set_flip(tx_tilemap, tx_flip); tilemap_set_flip(state->tx_tilemap, state->tx_flip);
tilemap_set_scrolly(tx_tilemap, 0, 0); tilemap_set_scrolly(state->tx_tilemap, 0, 0);
} }
else /* Flip on */ else /* Flip on */
{ {
tx_flip = (TILEMAP_FLIPY | TILEMAP_FLIPX); state->tx_flip = (TILEMAP_FLIPY | TILEMAP_FLIPX);
tilemap_set_flip(tx_tilemap, tx_flip); tilemap_set_flip(state->tx_tilemap, state->tx_flip);
tilemap_set_scrolly(tx_tilemap, 0, -16); tilemap_set_scrolly(state->tx_tilemap, 0, -16);
} }
} }
COMBINE_DATA(&toaplan2_txvideoram16_offs[offset]); COMBINE_DATA(&state->txvideoram16_offs[offset]);
} }
// logerror("Writing %04x to text offs RAM offset %04x\n",data,offset); // logerror("Writing %04x to text offs RAM offset %04x\n",data,offset);
} }
READ16_HANDLER( toaplan2_txscrollram16_r ) READ16_HANDLER( toaplan2_txscrollram16_r )
{ {
return toaplan2_txscrollram16[offset]; toaplan2_state *state = space->machine->driver_data<toaplan2_state>();
return state->txscrollram16[offset];
} }
WRITE16_HANDLER( toaplan2_txscrollram16_w ) WRITE16_HANDLER( toaplan2_txscrollram16_w )
{ {
/*** Line-Scroll RAM for Text Layer ***/ /*** Line-Scroll RAM for Text Layer ***/
toaplan2_state *state = space->machine->driver_data<toaplan2_state>();
int data_tx = data; int data_tx = data;
tilemap_set_scrollx(tx_tilemap, offset, data_tx); tilemap_set_scrollx(state->tx_tilemap, offset, data_tx);
// logerror("Writing %04x to text scroll RAM offset %04x\n",data,offset); // logerror("Writing %04x to text scroll RAM offset %04x\n",data,offset);
COMBINE_DATA(&toaplan2_txscrollram16[offset]); COMBINE_DATA(&state->txscrollram16[offset]);
} }
READ16_HANDLER( toaplan2_tx_gfxram16_r ) READ16_HANDLER( toaplan2_tx_gfxram16_r )
{ {
return toaplan2_tx_gfxram16[offset]; toaplan2_state *state = space->machine->driver_data<toaplan2_state>();
return state->tx_gfxram16[offset];
} }
WRITE16_HANDLER( toaplan2_tx_gfxram16_w ) WRITE16_HANDLER( toaplan2_tx_gfxram16_w )
{ {
/*** Dynamic GFX decoding for Truxton 2 / FixEight ***/ /*** Dynamic GFX decoding for Truxton 2 / FixEight ***/
UINT16 oldword = toaplan2_tx_gfxram16[offset]; toaplan2_state *state = space->machine->driver_data<toaplan2_state>();
UINT16 oldword = state->tx_gfxram16[offset];
if (oldword != data) if (oldword != data)
{ {
int code = offset/32; int code = offset/32;
COMBINE_DATA(&toaplan2_tx_gfxram16[offset]); COMBINE_DATA(&state->tx_gfxram16[offset]);
gfx_element_mark_dirty(space->machine->gfx[2], code); gfx_element_mark_dirty(space->machine->gfx[2], code);
} }
} }
READ16_HANDLER( raizing_tx_gfxram16_r ) READ16_HANDLER( raizing_tx_gfxram16_r )
{ {
toaplan2_state *state = space->machine->driver_data<toaplan2_state>();
offset += 0x3400/2; offset += 0x3400/2;
return toaplan2_tx_gfxram16[offset]; return state->tx_gfxram16[offset];
} }
WRITE16_HANDLER( raizing_tx_gfxram16_w ) WRITE16_HANDLER( raizing_tx_gfxram16_w )
{ {
/*** Dynamic Text GFX decoding for Batrider ***/ /*** Dynamic Text GFX decoding for Batrider ***/
toaplan2_state *state = space->machine->driver_data<toaplan2_state>();
UINT16 oldword; UINT16 oldword;
offset += 0x3400/2; offset += 0x3400/2;
oldword = toaplan2_tx_gfxram16[offset]; oldword = state->tx_gfxram16[offset];
if (oldword != data) if (oldword != data)
{ {
COMBINE_DATA(&toaplan2_tx_gfxram16[offset]); COMBINE_DATA(&state->tx_gfxram16[offset]);
} }
} }
@ -275,16 +296,17 @@ WRITE16_HANDLER( batrider_textdata_decode )
/*** Dynamic Text GFX decoding for Batrider ***/ /*** Dynamic Text GFX decoding for Batrider ***/
/*** Only done once during start-up ***/ /*** Only done once during start-up ***/
toaplan2_state *state = space->machine->driver_data<toaplan2_state>();
int code; int code;
UINT16 *dest = (UINT16 *)toaplan2_tx_gfxram16; UINT16 *dest = (UINT16 *)state->tx_gfxram16;
memcpy(dest, toaplan2_txvideoram16, toaplan2_tx_vram_size); memcpy(dest, state->txvideoram16, state->tx_vram_size);
dest += (toaplan2_tx_vram_size/2); dest += (state->tx_vram_size/2);
memcpy(dest, space->machine->generic.paletteram.u16, batrider_paletteram16_size); memcpy(dest, space->machine->generic.paletteram.u16, state->paletteram16_size);
dest += (batrider_paletteram16_size/2); dest += (state->paletteram16_size/2);
memcpy(dest, toaplan2_txvideoram16_offs, toaplan2_tx_offs_vram_size); memcpy(dest, state->txvideoram16_offs, state->tx_offs_vram_size);
dest += (toaplan2_tx_offs_vram_size/2); dest += (state->tx_offs_vram_size/2);
memcpy(dest, toaplan2_txscrollram16, toaplan2_tx_scroll_vram_size); memcpy(dest, state->txscrollram16, state->tx_scroll_vram_size);
/* Decode text characters; force them to update immediately */ /* Decode text characters; force them to update immediately */
for (code = 0; code < 1024; code++) for (code = 0; code < 1024; code++)
@ -316,7 +338,7 @@ VIDEO_UPDATE( toaplan2_dual )
gp9001_log_vram(state->vdp1, screen->machine); gp9001_log_vram(state->vdp1, screen->machine);
bitmap_fill(bitmap,cliprect,0); bitmap_fill(bitmap,cliprect,0);
bitmap_fill(gp9001_custom_priority_bitmap, cliprect, 0); bitmap_fill(state->custom_priority_bitmap, cliprect, 0);
state->vdp1->gp9001_render_vdp(screen->machine, bitmap, cliprect); state->vdp1->gp9001_render_vdp(screen->machine, bitmap, cliprect);
} }
if (state->vdp0) if (state->vdp0)
@ -324,7 +346,7 @@ VIDEO_UPDATE( toaplan2_dual )
gp9001_log_vram(state->vdp0, screen->machine); gp9001_log_vram(state->vdp0, screen->machine);
// bitmap_fill(bitmap,cliprect,0); // bitmap_fill(bitmap,cliprect,0);
bitmap_fill(gp9001_custom_priority_bitmap, cliprect, 0); bitmap_fill(state->custom_priority_bitmap, cliprect, 0);
state->vdp0->gp9001_render_vdp(screen->machine, bitmap, cliprect); state->vdp0->gp9001_render_vdp(screen->machine, bitmap, cliprect);
} }
@ -346,16 +368,16 @@ VIDEO_UPDATE( toaplan2_mixed )
gp9001_log_vram(state->vdp0, screen->machine); gp9001_log_vram(state->vdp0, screen->machine);
bitmap_fill(bitmap,cliprect,0); bitmap_fill(bitmap,cliprect,0);
bitmap_fill(gp9001_custom_priority_bitmap, cliprect, 0); bitmap_fill(state->custom_priority_bitmap, cliprect, 0);
state->vdp0->gp9001_render_vdp(screen->machine, bitmap, cliprect); state->vdp0->gp9001_render_vdp(screen->machine, bitmap, cliprect);
} }
if (state->vdp1) if (state->vdp1)
{ {
gp9001_log_vram(state->vdp1, screen->machine); gp9001_log_vram(state->vdp1, screen->machine);
bitmap_fill(gp9001_secondary_render_bitmap,cliprect,0); bitmap_fill(state->secondary_render_bitmap,cliprect,0);
bitmap_fill(gp9001_custom_priority_bitmap, cliprect, 0); bitmap_fill(state->custom_priority_bitmap, cliprect, 0);
state->vdp1->gp9001_render_vdp(screen->machine, gp9001_secondary_render_bitmap, cliprect); state->vdp1->gp9001_render_vdp(screen->machine, state->secondary_render_bitmap, cliprect);
} }
@ -381,7 +403,7 @@ VIDEO_UPDATE( toaplan2_mixed )
for (y=0;y<height;y++) for (y=0;y<height;y++)
{ {
src_vdp0 = BITMAP_ADDR16(bitmap, y, 0); src_vdp0 = BITMAP_ADDR16(bitmap, y, 0);
src_vdp1 = BITMAP_ADDR16(gp9001_secondary_render_bitmap, y, 0); src_vdp1 = BITMAP_ADDR16(state->secondary_render_bitmap, y, 0);
for (x=0;x<width;x++) for (x=0;x<width;x++)
{ {
@ -442,7 +464,6 @@ VIDEO_UPDATE( toaplan2 )
{ {
toaplan2_state *state = screen->machine->driver_data<toaplan2_state>(); toaplan2_state *state = screen->machine->driver_data<toaplan2_state>();
if (state->vdp0) if (state->vdp0)
{ {
running_device *screen1 = screen->machine->device("screen"); running_device *screen1 = screen->machine->device("screen");
@ -452,7 +473,7 @@ VIDEO_UPDATE( toaplan2 )
if (screen == screen1) if (screen == screen1)
{ {
bitmap_fill(bitmap,cliprect,0); bitmap_fill(bitmap,cliprect,0);
bitmap_fill(gp9001_custom_priority_bitmap, cliprect, 0); bitmap_fill(state->custom_priority_bitmap, cliprect, 0);
state->vdp0->gp9001_render_vdp(screen->machine, bitmap, cliprect); state->vdp0->gp9001_render_vdp(screen->machine, bitmap, cliprect);
} }
} }
@ -468,7 +489,7 @@ VIDEO_UPDATE( toaplan2 )
if (screen == screen2) if (screen == screen2)
{ {
bitmap_fill(bitmap,cliprect,0); bitmap_fill(bitmap,cliprect,0);
bitmap_fill(gp9001_custom_priority_bitmap, cliprect, 0); bitmap_fill(state->custom_priority_bitmap, cliprect, 0);
state->vdp1->gp9001_render_vdp(screen->machine, bitmap, cliprect); state->vdp1->gp9001_render_vdp(screen->machine, bitmap, cliprect);
} }
} }
@ -479,14 +500,18 @@ VIDEO_UPDATE( toaplan2 )
VIDEO_UPDATE( truxton2 ) VIDEO_UPDATE( truxton2 )
{ {
toaplan2_state *state = screen->machine->driver_data<toaplan2_state>();
VIDEO_UPDATE_CALL(toaplan2); VIDEO_UPDATE_CALL(toaplan2);
tilemap_draw(bitmap,cliprect,tx_tilemap,0,0); tilemap_draw(bitmap, cliprect, state->tx_tilemap, 0, 0);
return 0; return 0;
} }
VIDEO_UPDATE( batrider ) VIDEO_UPDATE( batrider )
{ {
toaplan2_state *state = screen->machine->driver_data<toaplan2_state>();
VIDEO_UPDATE_CALL( toaplan2 ); VIDEO_UPDATE_CALL( toaplan2 );
int line; int line;
@ -502,8 +527,8 @@ VIDEO_UPDATE( batrider )
for (line = 0; line < 256;line++) for (line = 0; line < 256;line++)
{ {
clip.min_y = clip.max_y = line; clip.min_y = clip.max_y = line;
tilemap_set_scrolly(tx_tilemap,0,toaplan2_txvideoram16_offs[line&0xff]-line); tilemap_set_scrolly(state->tx_tilemap, 0, state->txvideoram16_offs[line&0xff] - line);
tilemap_draw(bitmap,&clip,tx_tilemap,0,0); tilemap_draw(bitmap, &clip, state->tx_tilemap, 0, 0);
} }
return 0; return 0;
} }