From 8e313c81a4576b0356464fd9e8f86464935d73d9 Mon Sep 17 00:00:00 2001 From: Aaron Giles Date: Sat, 12 Feb 2011 18:22:01 +0000 Subject: [PATCH] Converted atarirle to a device. [Atari Ace] --- src/mame/drivers/atarig1.c | 82 ++++++++++++++--- src/mame/drivers/atarig42.c | 73 ++++++++++++--- src/mame/drivers/atarigt.c | 34 ++++++- src/mame/drivers/atarigx2.c | 87 +++++++++++++----- src/mame/includes/atarig1.h | 3 + src/mame/includes/atarig42.h | 5 +- src/mame/includes/atarigt.h | 3 + src/mame/includes/atarigx2.h | 5 +- src/mame/machine/atarigen.h | 1 - src/mame/video/atarig1.c | 54 ++--------- src/mame/video/atarig42.c | 38 ++------ src/mame/video/atarigt.c | 36 +++----- src/mame/video/atarigx2.c | 38 ++------ src/mame/video/atarirle.c | 172 ++++++++++++++++++++++------------- src/mame/video/atarirle.h | 35 +++---- 15 files changed, 400 insertions(+), 266 deletions(-) diff --git a/src/mame/drivers/atarig1.c b/src/mame/drivers/atarig1.c index 1ed1f24ff07..fc6d9ede6c9 100644 --- a/src/mame/drivers/atarig1.c +++ b/src/mame/drivers/atarig1.c @@ -70,7 +70,10 @@ static MACHINE_RESET( atarig1 ) static WRITE16_HANDLER( mo_control_w ) { if (ACCESSING_BITS_0_7) - atarirle_control_w(space->machine, 0, data & 7); + { + atarig1_state *state = space->machine->driver_data(); + atarirle_control_w(state->rle, data & 7); + } } @@ -78,7 +81,7 @@ static WRITE16_HANDLER( mo_command_w ) { atarig1_state *state = space->machine->driver_data(); COMBINE_DATA(state->mo_command); - atarirle_command_w(0, (data == 0 && state->is_pitfight) ? ATARIRLE_COMMAND_CHECKSUM : ATARIRLE_COMMAND_DRAW); + atarirle_command_w(state->rle, (data == 0 && state->is_pitfight) ? ATARIRLE_COMMAND_CHECKSUM : ATARIRLE_COMMAND_DRAW); } @@ -224,7 +227,7 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 16 ) AM_RANGE(0xfd8000, 0xfdffff) AM_READWRITE(atarigen_eeprom_r, atarigen_eeprom_w) AM_SHARE("eeprom") /* AM_RANGE(0xfe0000, 0xfe7fff) AM_READ(from_r)*/ AM_RANGE(0xfe8000, 0xfe89ff) AM_RAM_WRITE(atarigen_666_paletteram_w) AM_BASE_GENERIC(paletteram) - AM_RANGE(0xff0000, 0xff0fff) AM_WRITE(atarirle_0_spriteram_w) AM_BASE(&atarirle_0_spriteram) + AM_RANGE(0xff0000, 0xff0fff) AM_DEVREADWRITE("rle", atarirle_spriteram_r, atarirle_spriteram_w) AM_RANGE(0xff2000, 0xff2001) AM_WRITE(mo_command_w) AM_BASE_MEMBER(atarig1_state, mo_command) AM_RANGE(0xff4000, 0xff5fff) AM_WRITE(atarigen_playfield_w) AM_BASE_MEMBER(atarig1_state, playfield) AM_RANGE(0xff6000, 0xff6fff) AM_WRITE(atarigen_alpha_w) AM_BASE_MEMBER(atarig1_state, alpha) @@ -401,6 +404,48 @@ GFXDECODE_END +static const atarirle_desc modesc_hydra = +{ + "gfx3", /* region where the GFX data lives */ + 256, /* number of entries in sprite RAM */ + 0, /* left clip coordinate */ + 255, /* right clip coordinate */ + + 0x200, /* base palette entry */ + 0x100, /* maximum number of colors */ + + {{ 0x7fff,0,0,0,0,0,0,0 }}, /* mask for the code index */ + {{ 0,0x00f0,0,0,0,0,0,0 }}, /* mask for the color */ + {{ 0,0,0xffc0,0,0,0,0,0 }}, /* mask for the X position */ + {{ 0,0,0,0xffc0,0,0,0,0 }}, /* mask for the Y position */ + {{ 0,0,0,0,0xffff,0,0,0 }}, /* mask for the scale factor */ + {{ 0x8000,0,0,0,0,0,0,0 }}, /* mask for the horizontal flip */ + {{ 0,0,0,0,0,0x00ff,0,0 }}, /* mask for the order */ + {{ 0 }}, /* mask for the priority */ + {{ 0 }} /* mask for the VRAM target */ +}; + +static const atarirle_desc modesc_pitfight = +{ + "gfx3", /* region where the GFX data lives */ + 256, /* number of entries in sprite RAM */ + 40, /* left clip coordinate */ + 295, /* right clip coordinate */ + + 0x200, /* base palette entry */ + 0x100, /* maximum number of colors */ + + {{ 0x7fff,0,0,0,0,0,0,0 }}, /* mask for the code index */ + {{ 0,0x00f0,0,0,0,0,0,0 }}, /* mask for the color */ + {{ 0,0,0xffc0,0,0,0,0,0 }}, /* mask for the X position */ + {{ 0,0,0,0xffc0,0,0,0,0 }}, /* mask for the Y position */ + {{ 0,0,0,0,0xffff,0,0,0 }}, /* mask for the scale factor */ + {{ 0x8000,0,0,0,0,0,0,0 }}, /* mask for the horizontal flip */ + {{ 0,0,0,0,0,0,0x00ff,0 }}, /* mask for the order */ + {{ 0 }}, /* mask for the priority */ + {{ 0 }} /* mask for the VRAM target */ +}; + /************************************* * * Machine driver @@ -429,13 +474,20 @@ static MACHINE_CONFIG_START( atarig1, atarig1_state ) MCFG_SCREEN_RAW_PARAMS(ATARI_CLOCK_14MHz/2, 456, 0, 336, 262, 0, 240) MCFG_VIDEO_START(atarig1) - MCFG_VIDEO_EOF(atarirle) + MCFG_VIDEO_EOF(atarig1) MCFG_VIDEO_UPDATE(atarig1) /* sound hardware */ MCFG_FRAGMENT_ADD(jsa_ii_mono) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( hydra, atarig1 ) + MCFG_ATARIRLE_ADD( "rle", modesc_hydra ) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( pitfight, atarig1 ) + MCFG_ATARIRLE_ADD( "rle", modesc_pitfight ) +MACHINE_CONFIG_END /************************************* @@ -1201,15 +1253,15 @@ static DRIVER_INIT( pitfightb ) { init_g1_common(machine, 0x038000, -1, 1); } * *************************************/ -GAME( 1990, hydra, 0, atarig1, hydra, hydra, ROT0, "Atari Games", "Hydra", GAME_SUPPORTS_SAVE ) -GAME( 1990, hydrap, hydra, atarig1, hydra, hydrap, ROT0, "Atari Games", "Hydra (prototype 5/14/90)", GAME_SUPPORTS_SAVE ) -GAME( 1990, hydrap2, hydra, atarig1, hydra, hydrap, ROT0, "Atari Games", "Hydra (prototype 5/25/90)", GAME_SUPPORTS_SAVE ) +GAME( 1990, hydra, 0, hydra, hydra, hydra, ROT0, "Atari Games", "Hydra", GAME_SUPPORTS_SAVE ) +GAME( 1990, hydrap, hydra, hydra, hydra, hydrap, ROT0, "Atari Games", "Hydra (prototype 5/14/90)", GAME_SUPPORTS_SAVE ) +GAME( 1990, hydrap2, hydra, hydra, hydra, hydrap, ROT0, "Atari Games", "Hydra (prototype 5/25/90)", GAME_SUPPORTS_SAVE ) -GAME( 1990, pitfight, 0, atarig1, pitfight, pitfight9, ROT0, "Atari Games", "Pit Fighter (rev 9)", GAME_SUPPORTS_SAVE ) -GAME( 1990, pitfight7, pitfight, atarig1, pitfight, pitfight7, ROT0, "Atari Games", "Pit Fighter (rev 7)", GAME_SUPPORTS_SAVE ) -GAME( 1990, pitfight6, pitfight, atarig1, pitfight, pitfightj, ROT0, "Atari Games", "Pit Fighter (rev 6)", GAME_SUPPORTS_SAVE ) -GAME( 1990, pitfight5, pitfight, atarig1, pitfight, pitfight7, ROT0, "Atari Games", "Pit Fighter (rev 5)", GAME_SUPPORTS_SAVE ) -GAME( 1990, pitfight4, pitfight, atarig1, pitfight, pitfight, ROT0, "Atari Games", "Pit Fighter (rev 4)", GAME_SUPPORTS_SAVE ) -GAME( 1990, pitfight3, pitfight, atarig1, pitfight, pitfight, ROT0, "Atari Games", "Pit Fighter (rev 3)", GAME_SUPPORTS_SAVE ) -GAME( 1990, pitfightj, pitfight, atarig1, pitfightj,pitfightj, ROT0, "Atari Games", "Pit Fighter (Japan, 2 players)", GAME_SUPPORTS_SAVE ) -GAME( 1990, pitfightb, pitfight, atarig1, pitfight, pitfightb, ROT0, "bootleg", "Pit Fighter (bootleg)", GAME_SUPPORTS_SAVE ) +GAME( 1990, pitfight, 0, pitfight, pitfight, pitfight9, ROT0, "Atari Games", "Pit Fighter (rev 9)", GAME_SUPPORTS_SAVE ) +GAME( 1990, pitfight7, pitfight, pitfight, pitfight, pitfight7, ROT0, "Atari Games", "Pit Fighter (rev 7)", GAME_SUPPORTS_SAVE ) +GAME( 1990, pitfight6, pitfight, pitfight, pitfight, pitfightj, ROT0, "Atari Games", "Pit Fighter (rev 6)", GAME_SUPPORTS_SAVE ) +GAME( 1990, pitfight5, pitfight, pitfight, pitfight, pitfight7, ROT0, "Atari Games", "Pit Fighter (rev 5)", GAME_SUPPORTS_SAVE ) +GAME( 1990, pitfight4, pitfight, pitfight, pitfight, pitfight, ROT0, "Atari Games", "Pit Fighter (rev 4)", GAME_SUPPORTS_SAVE ) +GAME( 1990, pitfight3, pitfight, pitfight, pitfight, pitfight, ROT0, "Atari Games", "Pit Fighter (rev 3)", GAME_SUPPORTS_SAVE ) +GAME( 1990, pitfightj, pitfight, pitfight, pitfightj,pitfightj, ROT0, "Atari Games", "Pit Fighter (Japan, 2 players)", GAME_SUPPORTS_SAVE ) +GAME( 1990, pitfightb, pitfight, pitfight, pitfight, pitfightb, ROT0, "bootleg", "Pit Fighter (bootleg)", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/atarig42.c b/src/mame/drivers/atarig42.c index 206e4924e49..1442719f387 100644 --- a/src/mame/drivers/atarig42.c +++ b/src/mame/drivers/atarig42.c @@ -102,11 +102,13 @@ static WRITE16_HANDLER( io_latch_w ) /* upper byte */ if (ACCESSING_BITS_8_15) { + atarig42_state *state = space->machine->driver_data(); + /* bit 14 controls the ASIC65 reset line */ asic65_reset(space->machine, (~data >> 14) & 1); /* bits 13-11 are the MO control bits */ - atarirle_control_w(space->machine, 0, (data >> 11) & 7); + atarirle_control_w(state->rle, (data >> 11) & 7); } /* lower byte */ @@ -127,7 +129,7 @@ static WRITE16_HANDLER( mo_command_w ) { atarig42_state *state = space->machine->driver_data(); COMBINE_DATA(state->mo_command); - atarirle_command_w(0, (data == 0) ? ATARIRLE_COMMAND_CHECKSUM : ATARIRLE_COMMAND_DRAW); + atarirle_command_w(state->rle, (data == 0) ? ATARIRLE_COMMAND_CHECKSUM : ATARIRLE_COMMAND_DRAW); } @@ -365,7 +367,7 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 16 ) AM_RANGE(0xf80000, 0xf80003) AM_WRITE(asic65_data_w) AM_RANGE(0xfa0000, 0xfa0fff) AM_READWRITE(atarigen_eeprom_r, atarigen_eeprom_w) AM_SHARE("eeprom") AM_RANGE(0xfc0000, 0xfc0fff) AM_RAM_WRITE(atarigen_666_paletteram_w) AM_BASE_GENERIC(paletteram) - AM_RANGE(0xff0000, 0xff0fff) AM_WRITE(atarirle_0_spriteram_w) AM_BASE(&atarirle_0_spriteram) + AM_RANGE(0xff0000, 0xff0fff) AM_DEVREADWRITE("rle", atarirle_spriteram_r, atarirle_spriteram_w) AM_RANGE(0xff2000, 0xff5fff) AM_WRITE(atarigen_playfield_w) AM_BASE_MEMBER(atarig42_state, playfield) AM_RANGE(0xff6000, 0xff6fff) AM_WRITE(atarigen_alpha_w) AM_BASE_MEMBER(atarig42_state, alpha) AM_RANGE(0xff7000, 0xff7001) AM_WRITE(mo_command_w) AM_BASE_MEMBER(atarig42_state, mo_command) @@ -505,6 +507,50 @@ static GFXDECODE_START( atarig42 ) GFXDECODE_END +static const atarirle_desc modesc_0x200 = +{ + "gfx3", /* region where the GFX data lives */ + 256, /* number of entries in sprite RAM */ + 0, /* left clip coordinate */ + 0, /* right clip coordinate */ + + 0x200, /* base palette entry */ + 0x400, /* maximum number of colors */ + + {{ 0x7fff,0,0,0,0,0,0,0 }}, /* mask for the code index */ + {{ 0,0x01f0,0,0,0,0,0,0 }}, /* mask for the color */ + {{ 0,0,0xffc0,0,0,0,0,0 }}, /* mask for the X position */ + {{ 0,0,0,0xffc0,0,0,0,0 }}, /* mask for the Y position */ + {{ 0,0,0,0,0xffff,0,0,0 }}, /* mask for the scale factor */ + {{ 0x8000,0,0,0,0,0,0,0 }}, /* mask for the horizontal flip */ + {{ 0,0,0,0,0,0,0x00ff,0 }}, /* mask for the order */ + {{ 0,0x0e00,0,0,0,0,0,0 }}, /* mask for the priority */ + {{ 0 }} /* mask for the VRAM target */ +}; + + +static const atarirle_desc modesc_0x400 = +{ + "gfx3", /* region where the GFX data lives */ + 256, /* number of entries in sprite RAM */ + 0, /* left clip coordinate */ + 0, /* right clip coordinate */ + + 0x400, /* base palette entry */ + 0x400, /* maximum number of colors */ + + {{ 0x7fff,0,0,0,0,0,0,0 }}, /* mask for the code index */ + {{ 0,0x03f0,0,0,0,0,0,0 }}, /* mask for the color */ + {{ 0,0,0xffc0,0,0,0,0,0 }}, /* mask for the X position */ + {{ 0,0,0,0xffc0,0,0,0,0 }}, /* mask for the Y position */ + {{ 0,0,0,0,0xffff,0,0,0 }}, /* mask for the scale factor */ + {{ 0x8000,0,0,0,0,0,0,0 }}, /* mask for the horizontal flip */ + {{ 0,0,0,0,0,0,0x00ff,0 }}, /* mask for the order */ + {{ 0,0x0e00,0,0,0,0,0,0 }}, /* mask for the priority */ + {{ 0 }} /* mask for the VRAM target */ +}; + + /************************************* * @@ -538,13 +584,22 @@ static MACHINE_CONFIG_START( atarig42, atarig42_state ) MCFG_SCREEN_RAW_PARAMS(ATARI_CLOCK_14MHz/2, 456, 0, 336, 262, 0, 240) MCFG_VIDEO_START(atarig42) - MCFG_VIDEO_EOF(atarirle) + MCFG_VIDEO_EOF(atarig42) MCFG_VIDEO_UPDATE(atarig42) /* sound hardware */ MCFG_FRAGMENT_ADD(jsa_iii_mono) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( atarig42_0x200, atarig42 ) + MCFG_ATARIRLE_ADD( "rle", modesc_0x200 ) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( atarig42_0x400, atarig42 ) + MCFG_ATARIRLE_ADD( "rle", modesc_0x400 ) +MACHINE_CONFIG_END + + /************************************* @@ -744,8 +799,6 @@ static DRIVER_INIT( roadriot ) atarijsa_init(machine, "IN2", 0x0040); state->playfield_base = 0x400; - state->motion_object_base = 0x200; - state->motion_object_mask = 0x1ff; address_space *main = machine->device("maincpu")->space(AS_PROGRAM); state->sloop_base = memory_install_readwrite16_handler(main, 0x000000, 0x07ffff, 0, 0, roadriot_sloop_data_r, roadriot_sloop_data_w); @@ -781,8 +834,6 @@ static DRIVER_INIT( guardian ) atarijsa_init(machine, "IN2", 0x0040); state->playfield_base = 0x000; - state->motion_object_base = 0x400; - state->motion_object_mask = 0x3ff; /* it looks like they jsr to $80000 as some kind of protection */ /* put an RTS there so we don't die */ @@ -823,6 +874,6 @@ static DRIVER_INIT( guardian ) * *************************************/ -GAME( 1991, roadriot, 0, atarig42, roadriot, roadriot, ROT0, "Atari Games", "Road Riot 4WD (set 1, 13 Nov 1991)", GAME_UNEMULATED_PROTECTION ) -GAME( 1991, roadrioto,roadriot, atarig42, roadriot, roadriot, ROT0, "Atari Games", "Road Riot 4WD (set 2, 04 Jun 1991)", GAME_UNEMULATED_PROTECTION ) -GAME( 1992, guardian, 0, atarig42, guardian, guardian, ROT0, "Atari Games", "Guardians of the 'Hood", 0 ) +GAME( 1991, roadriot, 0, atarig42_0x200, roadriot, roadriot, ROT0, "Atari Games", "Road Riot 4WD (set 1, 13 Nov 1991)", GAME_UNEMULATED_PROTECTION ) +GAME( 1991, roadrioto,roadriot, atarig42_0x200, roadriot, roadriot, ROT0, "Atari Games", "Road Riot 4WD (set 2, 04 Jun 1991)", GAME_UNEMULATED_PROTECTION ) +GAME( 1992, guardian, 0, atarig42_0x400, guardian, guardian, ROT0, "Atari Games", "Guardians of the 'Hood", 0 ) diff --git a/src/mame/drivers/atarigt.c b/src/mame/drivers/atarigt.c index d5a35b32947..fab1fa310ea 100644 --- a/src/mame/drivers/atarigt.c +++ b/src/mame/drivers/atarigt.c @@ -196,8 +196,10 @@ static WRITE32_HANDLER( latch_w ) /* upper byte */ if (ACCESSING_BITS_24_31) { + atarigt_state *state = space->machine->driver_data(); + /* bits 13-11 are the MO control bits */ - atarirle_control_w(space->machine, 0, (data >> 27) & 7); + atarirle_control_w(state->rle, (data >> 27) & 7); } if (ACCESSING_BITS_16_23) @@ -214,7 +216,7 @@ static WRITE32_HANDLER( mo_command_w ) atarigt_state *state = space->machine->driver_data(); COMBINE_DATA(state->mo_command); if (ACCESSING_BITS_0_15) - atarirle_command_w(0, ((data & 0xffff) == 2) ? ATARIRLE_COMMAND_CHECKSUM : ATARIRLE_COMMAND_DRAW); + atarirle_command_w(state->rle, ((data & 0xffff) == 2) ? ATARIRLE_COMMAND_CHECKSUM : ATARIRLE_COMMAND_DRAW); } @@ -610,7 +612,7 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 32 ) AM_RANGE(0xd40000, 0xd4ffff) AM_WRITE(atarigen_eeprom_enable32_w) AM_RANGE(0xd72000, 0xd75fff) AM_WRITE(atarigen_playfield32_w) AM_BASE_MEMBER(atarigt_state, playfield32) AM_RANGE(0xd76000, 0xd76fff) AM_WRITE(atarigen_alpha32_w) AM_BASE_MEMBER(atarigt_state, alpha32) - AM_RANGE(0xd78000, 0xd78fff) AM_WRITE(atarirle_0_spriteram32_w) AM_BASE(&atarirle_0_spriteram32) + AM_RANGE(0xd78000, 0xd78fff) AM_DEVREADWRITE("rle", atarirle_spriteram32_r, atarirle_spriteram32_w) AM_RANGE(0xd7a200, 0xd7a203) AM_WRITE(mo_command_w) AM_BASE_MEMBER(atarigt_state, mo_command) AM_RANGE(0xd70000, 0xd7ffff) AM_RAM AM_RANGE(0xd80000, 0xdfffff) AM_READWRITE(colorram_protection_r, colorram_protection_w) AM_BASE_MEMBER(atarigt_state, colorram) @@ -780,6 +782,28 @@ static GFXDECODE_START( atarigt ) GFXDECODE_END +static const atarirle_desc modesc = +{ + "gfx3", /* region where the GFX data lives */ + 256, /* number of entries in sprite RAM */ + 0, /* left clip coordinate */ + 0, /* right clip coordinate */ + + 0x0000, /* base palette entry */ + 0x1000, /* maximum number of colors */ + + {{ 0x7fff,0,0,0,0,0,0,0 }}, /* mask for the code index */ + {{ 0,0x0ff0,0,0,0,0,0,0 }}, /* mask for the color */ + {{ 0,0,0xffc0,0,0,0,0,0 }}, /* mask for the X position */ + {{ 0,0,0,0xffc0,0,0,0,0 }}, /* mask for the Y position */ + {{ 0,0,0,0,0xffff,0,0,0 }}, /* mask for the scale factor */ + {{ 0x8000,0,0,0,0,0,0,0 }}, /* mask for the horizontal flip */ + {{ 0,0,0,0,0,0,0x00ff,0 }}, /* mask for the order */ + {{ 0,0x0e00,0,0,0,0,0,0 }}, /* mask for the priority */ + {{ 0,0x8000,0,0,0,0,0,0 }} /* mask for the VRAM target */ +}; + + /************************************* * @@ -811,9 +835,11 @@ static MACHINE_CONFIG_START( atarigt, atarigt_state ) MCFG_SCREEN_RAW_PARAMS(ATARI_CLOCK_14MHz/2, 456, 0, 336, 262, 0, 240) MCFG_VIDEO_START(atarigt) - MCFG_VIDEO_EOF(atarirle) + MCFG_VIDEO_EOF(atarigt) MCFG_VIDEO_UPDATE(atarigt) + MCFG_ATARIRLE_ADD("rle", modesc) + /* sound hardware */ MCFG_FRAGMENT_ADD(cage) MACHINE_CONFIG_END diff --git a/src/mame/drivers/atarigx2.c b/src/mame/drivers/atarigx2.c index faaf3c29daf..768ecd24347 100644 --- a/src/mame/drivers/atarigx2.c +++ b/src/mame/drivers/atarigx2.c @@ -117,8 +117,10 @@ static WRITE32_HANDLER( latch_w ) /* upper byte */ if (ACCESSING_BITS_24_31) { + atarigx2_state *state = space->machine->driver_data(); + /* bits 13-11 are the MO control bits */ - atarirle_control_w(space->machine,0, (data >> 27) & 7); + atarirle_control_w(state->rle, (data >> 27) & 7); } /* lower byte */ @@ -132,7 +134,7 @@ static WRITE32_HANDLER( mo_command_w ) atarigx2_state *state = space->machine->driver_data(); COMBINE_DATA(state->mo_command); if (ACCESSING_BITS_0_15) - atarirle_command_w(0, ((data & 0xffff) == 2) ? ATARIRLE_COMMAND_CHECKSUM : ATARIRLE_COMMAND_DRAW); + atarirle_command_w(state->rle, ((data & 0xffff) == 2) ? ATARIRLE_COMMAND_CHECKSUM : ATARIRLE_COMMAND_DRAW); } @@ -1157,7 +1159,7 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 32 ) AM_RANGE(0xd40000, 0xd40fff) AM_RAM_WRITE(atarigen_666_paletteram32_w) AM_BASE_GENERIC(paletteram) AM_RANGE(0xd72000, 0xd75fff) AM_WRITE(atarigen_playfield32_w) AM_BASE_MEMBER(atarigx2_state, playfield32) AM_RANGE(0xd76000, 0xd76fff) AM_WRITE(atarigen_alpha32_w) AM_BASE_MEMBER(atarigx2_state, alpha32) - AM_RANGE(0xd78000, 0xd78fff) AM_WRITE(atarirle_0_spriteram32_w) AM_BASE(&atarirle_0_spriteram32) + AM_RANGE(0xd78000, 0xd78fff) AM_DEVREADWRITE("rle", atarirle_spriteram32_r, atarirle_spriteram32_w) AM_RANGE(0xd7a200, 0xd7a203) AM_WRITE(mo_command_w) AM_BASE_MEMBER(atarigx2_state, mo_command) AM_RANGE(0xd70000, 0xd7ffff) AM_RAM AM_RANGE(0xd80000, 0xd9ffff) AM_WRITE(atarigen_eeprom_enable32_w) @@ -1380,6 +1382,48 @@ static GFXDECODE_START( atarigx2 ) GFXDECODE_ENTRY( "gfx1", 0, pftoplayout, 0x000, 64 ) GFXDECODE_END +static const atarirle_desc modesc_0x200 = +{ + "gfx3", /* region where the GFX data lives */ + 256, /* number of entries in sprite RAM */ + 0, /* left clip coordinate */ + 0, /* right clip coordinate */ + + 0x200, /* base palette entry */ + 0x400, /* maximum number of colors */ + + {{ 0x7fff,0,0,0,0,0,0,0 }}, /* mask for the code index */ + {{ 0,0x01f0,0,0,0,0,0,0 }}, /* mask for the color */ + {{ 0,0,0xffc0,0,0,0,0,0 }}, /* mask for the X position */ + {{ 0,0,0,0xffc0,0,0,0,0 }}, /* mask for the Y position */ + {{ 0,0,0,0,0xffff,0,0,0 }}, /* mask for the scale factor */ + {{ 0x8000,0,0,0,0,0,0,0 }}, /* mask for the horizontal flip */ + {{ 0,0,0,0,0,0,0x00ff,0 }}, /* mask for the order */ + {{ 0,0x0e00,0,0,0,0,0,0 }}, /* mask for the priority */ + {{ 0 }} /* mask for the VRAM target */ +}; + +static const atarirle_desc modesc_0x400 = +{ + "gfx3", /* region where the GFX data lives */ + 256, /* number of entries in sprite RAM */ + 0, /* left clip coordinate */ + 0, /* right clip coordinate */ + + 0x400, /* base palette entry */ + 0x400, /* maximum number of colors */ + + {{ 0x7fff,0,0,0,0,0,0,0 }}, /* mask for the code index */ + {{ 0,0x03f0,0,0,0,0,0,0 }}, /* mask for the color */ + {{ 0,0,0xffc0,0,0,0,0,0 }}, /* mask for the X position */ + {{ 0,0,0,0xffc0,0,0,0,0 }}, /* mask for the Y position */ + {{ 0,0,0,0,0xffff,0,0,0 }}, /* mask for the scale factor */ + {{ 0x8000,0,0,0,0,0,0,0 }}, /* mask for the horizontal flip */ + {{ 0,0,0,0,0,0,0x00ff,0 }}, /* mask for the order */ + {{ 0,0x0e00,0,0,0,0,0,0 }}, /* mask for the priority */ + {{ 0 }} /* mask for the VRAM target */ +}; + /************************************* @@ -1411,7 +1455,7 @@ static MACHINE_CONFIG_START( atarigx2, atarigx2_state ) MCFG_SCREEN_RAW_PARAMS(ATARI_CLOCK_14MHz/2, 456, 0, 336, 262, 0, 240) MCFG_VIDEO_START(atarigx2) - MCFG_VIDEO_EOF(atarirle) + MCFG_VIDEO_EOF(atarigx2) MCFG_VIDEO_UPDATE(atarigx2) /* sound hardware */ @@ -1419,6 +1463,13 @@ static MACHINE_CONFIG_START( atarigx2, atarigx2_state ) MACHINE_CONFIG_END +static MACHINE_CONFIG_DERIVED( atarigx2_0x200, atarigx2 ) + MCFG_ATARIRLE_ADD( "rle", modesc_0x200 ) +MACHINE_CONFIG_END + +static MACHINE_CONFIG_DERIVED( atarigx2_0x400, atarigx2 ) + MCFG_ATARIRLE_ADD( "rle", modesc_0x400 ) +MACHINE_CONFIG_END /************************************* * @@ -2148,8 +2199,6 @@ static DRIVER_INIT( spclords ) atarijsa_init(machine, "SERVICE", 0x0040); state->playfield_base = 0x000; - state->motion_object_base = 0x400; - state->motion_object_mask = 0x3ff; } @@ -2160,8 +2209,6 @@ static DRIVER_INIT( motofren ) atarijsa_init(machine, "SERVICE", 0x0040); state->playfield_base = 0x400; - state->motion_object_base = 0x200; - state->motion_object_mask = 0x1ff; /* L/W=!68.A23*!E.A22*!E.A21 = 000x xxxx = 000000-1fffff +68.A23*E.A22*E.A21*68.A20*68.A19*68.A18*68.A17 = 1111 111x = fe0000-ffffff @@ -2198,8 +2245,6 @@ static DRIVER_INIT( rrreveng ) atarijsa_init(machine, "SERVICE", 0x0040); state->playfield_base = 0x000; - state->motion_object_base = 0x400; - state->motion_object_mask = 0x3ff; memory_install_read32_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xca0fc0, 0xca0fc3, 0, 0, rrreveng_prot_r); } @@ -2212,16 +2257,16 @@ static DRIVER_INIT( rrreveng ) * *************************************/ -GAME( 1992, spclords, 0, atarigx2, spclords, spclords, ROT0, "Atari Games", "Space Lords (rev C)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) -GAME( 1992, spclordsb, spclords, atarigx2, spclords, spclords, ROT0, "Atari Games", "Space Lords (rev B)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) -GAME( 1992, spclordsg, spclords, atarigx2, spclords, spclords, ROT0, "Atari Games", "Space Lords (rev A, German)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) -GAME( 1992, spclordsa, spclords, atarigx2, spclords, spclords, ROT0, "Atari Games", "Space Lords (rev A)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) +GAME( 1992, spclords, 0, atarigx2_0x400, spclords, spclords, ROT0, "Atari Games", "Space Lords (rev C)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) +GAME( 1992, spclordsb, spclords, atarigx2_0x400, spclords, spclords, ROT0, "Atari Games", "Space Lords (rev B)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) +GAME( 1992, spclordsg, spclords, atarigx2_0x400, spclords, spclords, ROT0, "Atari Games", "Space Lords (rev A, German)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) +GAME( 1992, spclordsa, spclords, atarigx2_0x400, spclords, spclords, ROT0, "Atari Games", "Space Lords (rev A)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) -GAME( 1992, motofren, 0, atarigx2, motofren, motofren, ROT0, "Atari Games", "Moto Frenzy", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) -GAME( 1992, motofrenmd, motofren, atarigx2, motofren, motofren, ROT0, "Atari Games", "Moto Frenzy (Mini Deluxe)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) -GAME( 1992, motofrenft, motofren, atarigx2, motofren, motofren, ROT0, "Atari Games", "Moto Frenzy (Field Test Version)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) -GAME( 1992, motofrenmf, motofren, atarigx2, motofren, motofren, ROT0, "Atari Games", "Moto Frenzy (Mini Deluxe Field Test Version)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) +GAME( 1992, motofren, 0, atarigx2_0x200, motofren, motofren, ROT0, "Atari Games", "Moto Frenzy", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) +GAME( 1992, motofrenmd, motofren, atarigx2_0x200, motofren, motofren, ROT0, "Atari Games", "Moto Frenzy (Mini Deluxe)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) +GAME( 1992, motofrenft, motofren, atarigx2_0x200, motofren, motofren, ROT0, "Atari Games", "Moto Frenzy (Field Test Version)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) +GAME( 1992, motofrenmf, motofren, atarigx2_0x200, motofren, motofren, ROT0, "Atari Games", "Moto Frenzy (Mini Deluxe Field Test Version)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) -GAME( 1993, rrreveng, 0, atarigx2, rrreveng, rrreveng, ROT0, "Atari Games", "Road Riot's Revenge (prototype, Sep 06, 1994)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) -GAME( 1993, rrrevenga, rrreveng, atarigx2, rrreveng, rrreveng, ROT0, "Atari Games", "Road Riot's Revenge (prototype, Jan 27, 1994, set 1)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) -GAME( 1993, rrrevengb, rrreveng, atarigx2, rrreveng, rrreveng, ROT0, "Atari Games", "Road Riot's Revenge (prototype, Jan 27, 1994, set 2)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) +GAME( 1993, rrreveng, 0, atarigx2_0x400, rrreveng, rrreveng, ROT0, "Atari Games", "Road Riot's Revenge (prototype, Sep 06, 1994)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) +GAME( 1993, rrrevenga, rrreveng, atarigx2_0x400, rrreveng, rrreveng, ROT0, "Atari Games", "Road Riot's Revenge (prototype, Jan 27, 1994, set 1)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) +GAME( 1993, rrrevengb, rrreveng, atarigx2_0x400, rrreveng, rrreveng, ROT0, "Atari Games", "Road Riot's Revenge (prototype, Jan 27, 1994, set 2)", GAME_UNEMULATED_PROTECTION | GAME_NOT_WORKING ) diff --git a/src/mame/includes/atarig1.h b/src/mame/includes/atarig1.h index d5121c0d0e7..631e2752da4 100644 --- a/src/mame/includes/atarig1.h +++ b/src/mame/includes/atarig1.h @@ -27,6 +27,8 @@ public: UINT8 playfield_tile_bank; UINT16 playfield_xscroll; UINT16 playfield_yscroll; + + device_t * rle; }; @@ -35,6 +37,7 @@ public: WRITE16_HANDLER( atarig1_mo_control_w ); VIDEO_START( atarig1 ); +VIDEO_EOF( atarig1 ); VIDEO_UPDATE( atarig1 ); void atarig1_scanline_update(screen_device &screen, int scanline); diff --git a/src/mame/includes/atarig42.h b/src/mame/includes/atarig42.h index 409dd1aa2da..e0613aeacb2 100644 --- a/src/mame/includes/atarig42.h +++ b/src/mame/includes/atarig42.h @@ -13,8 +13,6 @@ public: : atarigen_state(machine, config) { } UINT16 playfield_base; - UINT16 motion_object_base; - UINT16 motion_object_mask; UINT16 current_control; UINT8 playfield_tile_bank; @@ -30,12 +28,15 @@ public: int sloop_offset; int sloop_state; UINT16 * sloop_base; + + device_t * rle; }; /*----------- defined in video/atarig42.c -----------*/ VIDEO_START( atarig42 ); +VIDEO_EOF( atarig42 ); VIDEO_UPDATE( atarig42 ); WRITE16_HANDLER( atarig42_mo_control_w ); diff --git a/src/mame/includes/atarigt.h b/src/mame/includes/atarigt.h index a7ff5bd167e..aa3351d0556 100644 --- a/src/mame/includes/atarigt.h +++ b/src/mame/includes/atarigt.h @@ -44,6 +44,8 @@ public: UINT8 protmode; UINT16 protresult; UINT8 protdata[0x800]; + + device_t * rle; }; @@ -53,6 +55,7 @@ void atarigt_colorram_w(atarigt_state *state, offs_t address, UINT16 data, UINT1 UINT16 atarigt_colorram_r(atarigt_state *state, offs_t address); VIDEO_START( atarigt ); +VIDEO_EOF( atarigt ); VIDEO_UPDATE( atarigt ); void atarigt_scanline_update(screen_device &screen, int scanline); diff --git a/src/mame/includes/atarigx2.h b/src/mame/includes/atarigx2.h index b796500f585..5e6080c5581 100644 --- a/src/mame/includes/atarigx2.h +++ b/src/mame/includes/atarigx2.h @@ -13,8 +13,6 @@ public: : atarigen_state(machine, config) { } UINT16 playfield_base; - UINT16 motion_object_base; - UINT16 motion_object_mask; UINT32 * mo_command; UINT32 * protection_base; @@ -27,12 +25,15 @@ public: UINT16 last_write; UINT16 last_write_offset; + + device_t * rle; }; /*----------- defined in video/atarigx2.c -----------*/ VIDEO_START( atarigx2 ); +VIDEO_EOF( atarigx2 ); VIDEO_UPDATE( atarigx2 ); WRITE16_HANDLER( atarigx2_mo_control_w ); diff --git a/src/mame/machine/atarigen.h b/src/mame/machine/atarigen.h index 186a9270ccb..c77fe4e84bd 100644 --- a/src/mame/machine/atarigen.h +++ b/src/mame/machine/atarigen.h @@ -42,7 +42,6 @@ #include "machine/nvram.h" #include "video/atarimo.h" -#include "video/atarirle.h" #include "machine/er2055.h" diff --git a/src/mame/video/atarig1.c b/src/mame/video/atarig1.c index a65cde8797a..ba4227ac425 100644 --- a/src/mame/video/atarig1.c +++ b/src/mame/video/atarig1.c @@ -5,7 +5,7 @@ ****************************************************************************/ #include "emu.h" -#include "machine/atarigen.h" +#include "video/atarirle.h" #include "includes/atarig1.h" @@ -46,47 +46,6 @@ static TILE_GET_INFO( get_playfield_tile_info ) VIDEO_START( atarig1 ) { - static const atarirle_desc modesc_hydra = - { - "gfx3", /* region where the GFX data lives */ - 256, /* number of entries in sprite RAM */ - 0, /* left clip coordinate */ - 255, /* right clip coordinate */ - - 0x200, /* base palette entry */ - 0x100, /* maximum number of colors */ - - {{ 0x7fff,0,0,0,0,0,0,0 }}, /* mask for the code index */ - {{ 0,0x00f0,0,0,0,0,0,0 }}, /* mask for the color */ - {{ 0,0,0xffc0,0,0,0,0,0 }}, /* mask for the X position */ - {{ 0,0,0,0xffc0,0,0,0,0 }}, /* mask for the Y position */ - {{ 0,0,0,0,0xffff,0,0,0 }}, /* mask for the scale factor */ - {{ 0x8000,0,0,0,0,0,0,0 }}, /* mask for the horizontal flip */ - {{ 0,0,0,0,0,0x00ff,0,0 }}, /* mask for the order */ - {{ 0 }}, /* mask for the priority */ - {{ 0 }} /* mask for the VRAM target */ - }; - - static const atarirle_desc modesc_pitfight = - { - "gfx3", /* region where the GFX data lives */ - 256, /* number of entries in sprite RAM */ - 40, /* left clip coordinate */ - 295, /* right clip coordinate */ - - 0x200, /* base palette entry */ - 0x100, /* maximum number of colors */ - - {{ 0x7fff,0,0,0,0,0,0,0 }}, /* mask for the code index */ - {{ 0,0x00f0,0,0,0,0,0,0 }}, /* mask for the color */ - {{ 0,0,0xffc0,0,0,0,0,0 }}, /* mask for the X position */ - {{ 0,0,0,0xffc0,0,0,0,0 }}, /* mask for the Y position */ - {{ 0,0,0,0,0xffff,0,0,0 }}, /* mask for the scale factor */ - {{ 0x8000,0,0,0,0,0,0,0 }}, /* mask for the horizontal flip */ - {{ 0,0,0,0,0,0,0x00ff,0 }}, /* mask for the order */ - {{ 0 }}, /* mask for the priority */ - {{ 0 }} /* mask for the VRAM target */ - }; atarig1_state *state = machine->driver_data(); /* blend the playfields and free the temporary one */ @@ -96,7 +55,7 @@ VIDEO_START( atarig1 ) state->playfield_tilemap = tilemap_create(machine, get_playfield_tile_info, tilemap_scan_rows, 8,8, 64,64); /* initialize the motion objects */ - atarirle_init(machine, 0, state->is_pitfight ? &modesc_pitfight : &modesc_hydra); + state->rle = machine->device("rle"); /* initialize the alphanumerics */ state->alpha_tilemap = tilemap_create(machine, get_alpha_tile_info, tilemap_scan_rows, 8,8, 64,32); @@ -200,9 +159,16 @@ VIDEO_UPDATE( atarig1 ) tilemap_draw(bitmap, cliprect, state->playfield_tilemap, 0, 0); /* copy the motion objects on top */ - copybitmap_trans(bitmap, atarirle_get_vram(0, 0), 0, 0, 0, 0, cliprect, 0); + copybitmap_trans(bitmap, atarirle_get_vram(state->rle, 0), 0, 0, 0, 0, cliprect, 0); /* add the alpha on top */ tilemap_draw(bitmap, cliprect, state->alpha_tilemap, 0, 0); return 0; } + +VIDEO_EOF( atarig1 ) +{ + atarig1_state *state = machine->driver_data(); + + atarirle_eof(state->rle); +} diff --git a/src/mame/video/atarig42.c b/src/mame/video/atarig42.c index 208d56e5ee0..f49764e3251 100644 --- a/src/mame/video/atarig42.c +++ b/src/mame/video/atarig42.c @@ -20,7 +20,7 @@ #include "emu.h" -#include "machine/atarigen.h" +#include "video/atarirle.h" #include "includes/atarig42.h" @@ -69,29 +69,7 @@ static TILEMAP_MAPPER( atarig42_playfield_scan ) VIDEO_START( atarig42 ) { - static const atarirle_desc modesc = - { - "gfx3", /* region where the GFX data lives */ - 256, /* number of entries in sprite RAM */ - 0, /* left clip coordinate */ - 0, /* right clip coordinate */ - - 0x000, /* base palette entry */ - 0x400, /* maximum number of colors */ - - {{ 0x7fff,0,0,0,0,0,0,0 }}, /* mask for the code index */ - {{ 0,0x03f0,0,0,0,0,0,0 }}, /* mask for the color */ - {{ 0,0,0xffc0,0,0,0,0,0 }}, /* mask for the X position */ - {{ 0,0,0,0xffc0,0,0,0,0 }}, /* mask for the Y position */ - {{ 0,0,0,0,0xffff,0,0,0 }}, /* mask for the scale factor */ - {{ 0x8000,0,0,0,0,0,0,0 }}, /* mask for the horizontal flip */ - {{ 0,0,0,0,0,0,0x00ff,0 }}, /* mask for the order */ - {{ 0,0x0e00,0,0,0,0,0,0 }}, /* mask for the priority */ - {{ 0 }} /* mask for the VRAM target */ - }; atarig42_state *state = machine->driver_data(); - atarirle_desc adjusted_modesc = modesc; - int i; /* blend the playfields and free the temporary one */ atarigen_blend_gfx(machine, 0, 2, 0x0f, 0x30); @@ -100,10 +78,7 @@ VIDEO_START( atarig42 ) state->playfield_tilemap = tilemap_create(machine, get_playfield_tile_info, atarig42_playfield_scan, 8,8, 128,64); /* initialize the motion objects */ - adjusted_modesc.palettebase = state->motion_object_base; - for (i = 0; i < 8; i++) - adjusted_modesc.colormask.data[i] &= state->motion_object_mask; - atarirle_init(machine, 0, &adjusted_modesc); + state->rle = machine->device("rle"); /* initialize the alphanumerics */ state->alpha_tilemap = tilemap_create(machine, get_alpha_tile_info, tilemap_scan_rows, 8,8, 64,32); @@ -223,7 +198,7 @@ VIDEO_UPDATE( atarig42 ) /* copy the motion objects on top */ { - bitmap_t *mo_bitmap = atarirle_get_vram(0, 0); + bitmap_t *mo_bitmap = atarirle_get_vram(state->rle, 0); int left = cliprect->min_x; int top = cliprect->min_y; int right = cliprect->max_x + 1; @@ -251,3 +226,10 @@ VIDEO_UPDATE( atarig42 ) tilemap_draw(bitmap, cliprect, state->alpha_tilemap, 0, 0); return 0; } + +VIDEO_EOF( atarig42 ) +{ + atarig42_state *state = machine->driver_data(); + + atarirle_eof(state->rle); +} diff --git a/src/mame/video/atarigt.c b/src/mame/video/atarigt.c index 75bee583d0e..5e8d5aa213a 100644 --- a/src/mame/video/atarigt.c +++ b/src/mame/video/atarigt.c @@ -20,7 +20,7 @@ #include "emu.h" -#include "machine/atarigen.h" +#include "video/atarirle.h" #include "includes/atarigt.h" @@ -78,28 +78,7 @@ static TILEMAP_MAPPER( atarigt_playfield_scan ) VIDEO_START( atarigt ) { - static const atarirle_desc modesc = - { - "gfx3", /* region where the GFX data lives */ - 256, /* number of entries in sprite RAM */ - 0, /* left clip coordinate */ - 0, /* right clip coordinate */ - - 0x0000, /* base palette entry */ - 0x1000, /* maximum number of colors */ - - {{ 0x7fff,0,0,0,0,0,0,0 }}, /* mask for the code index */ - {{ 0,0x0ff0,0,0,0,0,0,0 }}, /* mask for the color */ - {{ 0,0,0xffc0,0,0,0,0,0 }}, /* mask for the X position */ - {{ 0,0,0,0xffc0,0,0,0,0 }}, /* mask for the Y position */ - {{ 0,0,0,0,0xffff,0,0,0 }}, /* mask for the scale factor */ - {{ 0x8000,0,0,0,0,0,0,0 }}, /* mask for the horizontal flip */ - {{ 0,0,0,0,0,0,0x00ff,0 }}, /* mask for the order */ - {{ 0,0x0e00,0,0,0,0,0,0 }}, /* mask for the priority */ - {{ 0,0x8000,0,0,0,0,0,0 }} /* mask for the VRAM target */ - }; atarigt_state *state = machine->driver_data(); - atarirle_desc adjusted_modesc = modesc; pen_t *substitute_pens; int i, width, height; @@ -110,7 +89,7 @@ VIDEO_START( atarigt ) state->playfield_tilemap = tilemap_create(machine, get_playfield_tile_info, atarigt_playfield_scan, 8,8, 128,64); /* initialize the motion objects */ - atarirle_init(machine, 0, &adjusted_modesc); + state->rle = machine->device("rle"); /* initialize the alphanumerics */ state->alpha_tilemap = tilemap_create(machine, get_alpha_tile_info, tilemap_scan_rows, 8,8, 64,32); @@ -530,8 +509,8 @@ PrimRage GALs: VIDEO_UPDATE( atarigt ) { atarigt_state *state = screen->machine->driver_data(); - bitmap_t *mo_bitmap = atarirle_get_vram(0, 0); - bitmap_t *tm_bitmap = atarirle_get_vram(0, 1); + bitmap_t *mo_bitmap = atarirle_get_vram(state->rle, 0); + bitmap_t *tm_bitmap = atarirle_get_vram(state->rle, 1); UINT16 *cram, *tram; int color_latch; UINT32 *mram; @@ -652,3 +631,10 @@ VIDEO_UPDATE( atarigt ) } return 0; } + +VIDEO_EOF( atarigt ) +{ + atarigt_state *state = machine->driver_data(); + + atarirle_eof(state->rle); +} diff --git a/src/mame/video/atarigx2.c b/src/mame/video/atarigx2.c index f32616def65..37ec19ccebe 100644 --- a/src/mame/video/atarigx2.c +++ b/src/mame/video/atarigx2.c @@ -20,7 +20,7 @@ #include "emu.h" -#include "machine/atarigen.h" +#include "video/atarirle.h" #include "includes/atarigx2.h" @@ -69,29 +69,7 @@ static TILEMAP_MAPPER( atarigx2_playfield_scan ) VIDEO_START( atarigx2 ) { - static const atarirle_desc modesc = - { - "gfx3", /* region where the GFX data lives */ - 256, /* number of entries in sprite RAM */ - 0, /* left clip coordinate */ - 0, /* right clip coordinate */ - - 0x000, /* base palette entry */ - 0x400, /* maximum number of colors */ - - {{ 0x7fff,0,0,0,0,0,0,0 }}, /* mask for the code index */ - {{ 0,0x03f0,0,0,0,0,0,0 }}, /* mask for the color */ - {{ 0,0,0xffc0,0,0,0,0,0 }}, /* mask for the X position */ - {{ 0,0,0,0xffc0,0,0,0,0 }}, /* mask for the Y position */ - {{ 0,0,0,0,0xffff,0,0,0 }}, /* mask for the scale factor */ - {{ 0x8000,0,0,0,0,0,0,0 }}, /* mask for the horizontal flip */ - {{ 0,0,0,0,0,0,0x00ff,0 }}, /* mask for the order */ - {{ 0,0x0e00,0,0,0,0,0,0 }}, /* mask for the priority */ - {{ 0 }} /* mask for the VRAM target */ - }; atarigx2_state *state = machine->driver_data(); - atarirle_desc adjusted_modesc = modesc; - int i; /* blend the playfields and free the temporary one */ atarigen_blend_gfx(machine, 0, 2, 0x0f, 0x30); @@ -100,10 +78,7 @@ VIDEO_START( atarigx2 ) state->playfield_tilemap = tilemap_create(machine, get_playfield_tile_info, atarigx2_playfield_scan, 8,8, 128,64); /* initialize the motion objects */ - adjusted_modesc.palettebase = state->motion_object_base; - for (i = 0; i < 8; i++) - adjusted_modesc.colormask.data[i] &= state->motion_object_mask; - atarirle_init(machine, 0, &adjusted_modesc); + state->rle = machine->device("rle"); /* initialize the alphanumerics */ state->alpha_tilemap = tilemap_create(machine, get_alpha_tile_info, tilemap_scan_rows, 8,8, 64,32); @@ -221,7 +196,7 @@ VIDEO_UPDATE( atarigx2 ) /* copy the motion objects on top */ { - bitmap_t *mo_bitmap = atarirle_get_vram(0, 0); + bitmap_t *mo_bitmap = atarirle_get_vram(state->rle, 0); int left = cliprect->min_x; int top = cliprect->min_y; int right = cliprect->max_x + 1; @@ -244,3 +219,10 @@ VIDEO_UPDATE( atarigx2 ) tilemap_draw(bitmap, cliprect, state->alpha_tilemap, 0, 0); return 0; } + +VIDEO_EOF( atarigx2 ) +{ + atarigx2_state *state = machine->driver_data(); + + atarirle_eof(state->rle); +} diff --git a/src/mame/video/atarirle.c b/src/mame/video/atarirle.c index c909c338a57..ac7404bead9 100644 --- a/src/mame/video/atarirle.c +++ b/src/mame/video/atarirle.c @@ -96,6 +96,7 @@ struct atarirle_data UINT8 command; /* current command */ UINT8 is32bit; /* 32-bit or 16-bit? */ UINT16 checksums[256]; /* checksums for each 0x40000 bytes */ + UINT16 ram[0x1000/2]; }; @@ -108,15 +109,7 @@ struct atarirle_data #define EXTRACT_DATA(_input, _mask) (((_input)->data[(_mask).word] >> (_mask).shift) & (_mask).mask) - -/*************************************************************************** - GLOBAL VARIABLES -***************************************************************************/ - -UINT16 *atarirle_0_spriteram; -UINT32 *atarirle_0_spriteram32; - -static int atarirle_hilite_index = -1; +enum { atarirle_hilite_index = -1 }; @@ -124,8 +117,6 @@ static int atarirle_hilite_index = -1; STATIC VARIABLES ***************************************************************************/ -static atarirle_data atarirle[ATARIRLE_MAX]; - static UINT8 rle_bpp[8]; static UINT16 *rle_table[8]; @@ -155,6 +146,15 @@ static void draw_rle_zoom_hflip(bitmap_t *bitmap, const atarirle_info *gfx, INLINE FUNCTIONS ***************************************************************************/ +INLINE atarirle_data *get_safe_token(device_t *device) +{ + assert(device != NULL); + assert(device->type() == ATARIRLE); + + return (atarirle_data *)downcast(device)->token(); +} + + /*--------------------------------------------------------------- compute_log: Computes the number of bits necessary to hold a given value. The input must be an even power of @@ -268,15 +268,14 @@ INLINE int convert_mask(const atarirle_entry *input, atarirle_mask *result) the attribute lookup table. ---------------------------------------------------------------*/ -void atarirle_init(running_machine *machine, int map, const atarirle_desc *desc) +static DEVICE_START( atarirle ) { + atarirle_data *mo = get_safe_token(device); + running_machine *machine = device->machine; + const atarirle_desc *desc = (const atarirle_desc *)device->baseconfig().static_config(); const UINT16 *base = (const UINT16 *)machine->region(desc->region)->base(); - atarirle_data *mo = &atarirle[map]; int i, width, height; - /* verify the map index */ - assert_always(map >= 0 && map < ATARIRLE_MAX, "Invalid map index"); - /* build and allocate the generic tables */ build_rle_tables(machine); @@ -356,31 +355,51 @@ void atarirle_init(running_machine *machine, int map, const atarirle_desc *desc) mo->partial_scanline = -1; /* register for save states */ - state_save_register_item_pointer(machine, "atarirle", NULL, map, mo->spriteram[0].data, ARRAY_LENGTH(mo->spriteram[0].data) * mo->spriteramsize); - state_save_register_item_bitmap(machine, "atarirle", NULL, map, mo->vram[0][0]); - state_save_register_item_bitmap(machine, "atarirle", NULL, map, mo->vram[0][1]); + device->save_pointer(NAME(mo->spriteram[0].data), ARRAY_LENGTH(mo->spriteram[0].data) * mo->spriteramsize); + device->save_item(NAME(*mo->vram[0][0])); + device->save_item(NAME(*mo->vram[0][1])); if (mo->vrammask.mask != 0) { - state_save_register_item_bitmap(machine, "atarirle", NULL, map, mo->vram[1][0]); - state_save_register_item_bitmap(machine, "atarirle", NULL, map, mo->vram[1][1]); + device->save_item(NAME(*mo->vram[1][0])); + device->save_item(NAME(*mo->vram[1][1])); } - state_save_register_item(machine, "atarirle", NULL, map, mo->partial_scanline); - state_save_register_item(machine, "atarirle", NULL, map, mo->control_bits); - state_save_register_item(machine, "atarirle", NULL, map, mo->command); - state_save_register_item(machine, "atarirle", NULL, map, mo->is32bit); - state_save_register_item_array(machine, "atarirle", NULL, map, mo->checksums); + device->save_item(NAME(mo->partial_scanline)); + device->save_item(NAME(mo->control_bits)); + device->save_item(NAME(mo->command)); + device->save_item(NAME(mo->is32bit)); + device->save_item(NAME(mo->checksums)); } +DEVICE_GET_INFO( atarirle ) +{ + switch (state) + { + /* --- the following bits of info are returned as 64-bit signed integers --- */ + case DEVINFO_INT_TOKEN_BYTES: info->i = sizeof(atarirle_data); break; + + /* --- the following bits of info are returned as pointers to data or functions --- */ + case DEVINFO_FCT_START: info->start = DEVICE_START_NAME(atarirle); break; + + /* --- the following bits of info are returned as NULL-terminated strings --- */ + case DEVINFO_STR_NAME: strcpy(info->s, "Atari RLE"); break; + case DEVINFO_STR_FAMILY: strcpy(info->s, "Atari RLE Video IC"); break; + case DEVINFO_STR_VERSION: strcpy(info->s, "1.0"); break; + case DEVINFO_STR_SOURCE_FILE: strcpy(info->s, __FILE__); break; + case DEVINFO_STR_CREDITS: strcpy(info->s, "Copyright MAME Team"); break; + } +} + +DEFINE_LEGACY_DEVICE(ATARIRLE, atarirle); /*--------------------------------------------------------------- atarirle_control_w: Write handler for MO control bits. ---------------------------------------------------------------*/ -void atarirle_control_w(running_machine *machine, int map, UINT8 bits) +void atarirle_control_w(device_t *device, UINT8 bits) { - atarirle_data *mo = &atarirle[map]; - int scanline = machine->primary_screen->vpos(); + atarirle_data *mo = get_safe_token(device); + int scanline = device->machine->primary_screen->vpos(); int oldbits = mo->control_bits; //logerror("atarirle_control_w(%d)\n", bits); @@ -390,7 +409,7 @@ void atarirle_control_w(running_machine *machine, int map, UINT8 bits) return; /* force a partial update first */ - machine->primary_screen->update_partial(scanline); + device->machine->primary_screen->update_partial(scanline); /* if the erase flag was set, erase the front map */ if (oldbits & ATARIRLE_CONTROL_ERASE) @@ -418,7 +437,7 @@ void atarirle_control_w(running_machine *machine, int map, UINT8 bits) if (!(oldbits & ATARIRLE_CONTROL_MOGO) && (bits & ATARIRLE_CONTROL_MOGO)) { if (mo->command == ATARIRLE_COMMAND_DRAW) - sort_and_render(machine, mo); + sort_and_render(device->machine, mo); else if (mo->command == ATARIRLE_COMMAND_CHECKSUM) compute_checksum(mo); } @@ -433,28 +452,22 @@ void atarirle_control_w(running_machine *machine, int map, UINT8 bits) atarirle_command_w: Write handler for MO command bits. ---------------------------------------------------------------*/ -void atarirle_command_w(int map, UINT8 command) +void atarirle_command_w(device_t *device, UINT8 command) { - atarirle_data *mo = &atarirle[map]; + atarirle_data *mo = get_safe_token(device); mo->command = command; } /*--------------------------------------------------------------- - VIDEO_EOF(atarirle): Flush remaining changes. + atarirle_eof: Flush remaining changes. ---------------------------------------------------------------*/ -VIDEO_EOF( atarirle ) +void atarirle_eof(device_t *device) { - int i; - -//logerror("VIDEO_EOF(atarirle)\n"); - - /* loop over all RLE handlers */ - for (i = 0; i < ATARIRLE_MAX; i++) { - atarirle_data *mo = &atarirle[i]; + atarirle_data *mo = get_safe_token(device); /* if the erase flag is set, erase to the end of the screen */ if (mo->control_bits & ATARIRLE_CONTROL_ERASE) @@ -481,40 +494,70 @@ VIDEO_EOF( atarirle ) /*--------------------------------------------------------------- - atarirle_0_spriteram_w: Write handler for the spriteram. + atarirle_spriteram_r: Read handler for the spriteram. ---------------------------------------------------------------*/ -WRITE16_HANDLER( atarirle_0_spriteram_w ) +READ16_DEVICE_HANDLER( atarirle_spriteram_r ) { - int entry = (offset >> 3) & atarirle[0].spriterammask; - int idx = offset & 7; + atarirle_data *mo = get_safe_token(device); - /* combine raw data */ - COMBINE_DATA(&atarirle_0_spriteram[offset]); - - /* store a copy in our local spriteram */ - atarirle[0].spriteram[entry].data[idx] = atarirle_0_spriteram[offset]; - atarirle[0].is32bit = 0; + return mo->ram[offset]; } /*--------------------------------------------------------------- - atarirle_0_spriteram32_w: Write handler for the spriteram. + atarirle_spriteram_w: Write handler for the spriteram. ---------------------------------------------------------------*/ -WRITE32_HANDLER( atarirle_0_spriteram32_w ) +WRITE16_DEVICE_HANDLER( atarirle_spriteram_w ) { - int entry = (offset >> 2) & atarirle[0].spriterammask; + atarirle_data *mo = get_safe_token(device); + int entry = (offset >> 3) & mo->spriterammask; + int idx = offset & 7; + + /* combine raw data */ + COMBINE_DATA(&mo->ram[offset]); + + /* store a copy in our local spriteram */ + mo->spriteram[entry].data[idx] = mo->ram[offset]; + mo->is32bit = 0; +} + + + +/*--------------------------------------------------------------- + atarirle_spriteram32_r: Read handler for the spriteram. +---------------------------------------------------------------*/ + +READ32_DEVICE_HANDLER( atarirle_spriteram32_r ) +{ + atarirle_data *mo = get_safe_token(device); + UINT32 *ram = (UINT32 *)mo->ram; + + return ram[offset]; +} + + + +/*--------------------------------------------------------------- + atarirle_spriteram32_w: Write handler for the spriteram. +---------------------------------------------------------------*/ + +WRITE32_DEVICE_HANDLER( atarirle_spriteram32_w ) +{ + atarirle_data *mo = get_safe_token(device); + UINT32 *ram = (UINT32 *)mo->ram; + int entry = (offset >> 2) & mo->spriterammask; int idx = 2 * (offset & 3); /* combine raw data */ - COMBINE_DATA(&atarirle_0_spriteram32[offset]); + COMBINE_DATA(&ram[offset]); /* store a copy in our local spriteram */ - atarirle[0].spriteram[entry].data[idx+0] = atarirle_0_spriteram32[offset] >> 16; - atarirle[0].spriteram[entry].data[idx+1] = atarirle_0_spriteram32[offset]; - atarirle[0].is32bit = 1; + mo->spriteram[entry].data[idx+0] = ram[offset] >> 16; + mo->spriteram[entry].data[idx+1] = ram[offset]; + mo->is32bit = 1; } @@ -523,9 +566,9 @@ WRITE32_HANDLER( atarirle_0_spriteram32_w ) atarirle_get_vram: Return the VRAM bitmap. ---------------------------------------------------------------*/ -bitmap_t *atarirle_get_vram(int map, int idx) +bitmap_t *atarirle_get_vram(device_t *device, int idx) { - atarirle_data *mo = &atarirle[map]; + atarirle_data *mo = get_safe_token(device); //logerror("atarirle_get_vram (frame %d)\n", (mo->control_bits & ATARIRLE_CONTROL_FRAME) >> 2); return mo->vram[idx][(mo->control_bits & ATARIRLE_CONTROL_FRAME) >> 2]; } @@ -712,15 +755,16 @@ static void compute_checksum(atarirle_data *mo) if (!mo->is32bit) { for (i = 0; i < reqsums; i++) - atarirle_0_spriteram[i] = mo->checksums[i]; + mo->ram[i] = mo->checksums[i]; } else { + UINT32 *ram = (UINT32 *)mo->ram; for (i = 0; i < reqsums; i++) if (i & 1) - atarirle_0_spriteram32[i/2] = (atarirle_0_spriteram32[i/2] & 0xffff0000) | mo->checksums[i]; + ram[i/2] = (ram[i/2] & 0xffff0000) | mo->checksums[i]; else - atarirle_0_spriteram32[i/2] = (atarirle_0_spriteram32[i/2] & 0x0000ffff) | (mo->checksums[i] << 16); + ram[i/2] = (ram[i/2] & 0x0000ffff) | (mo->checksums[i] << 16); } } diff --git a/src/mame/video/atarirle.h b/src/mame/video/atarirle.h index 21375be5b84..855d00e9327 100644 --- a/src/mame/video/atarirle.h +++ b/src/mame/video/atarirle.h @@ -15,9 +15,6 @@ CONSTANTS ***************************************************************************/ -/* maximum number of motion object processors */ -#define ATARIRLE_MAX 1 - #define ATARIRLE_PRIORITY_SHIFT 12 #define ATARIRLE_BANK_SHIFT 15 #define ATARIRLE_PRIORITY_MASK ((~0 << ATARIRLE_PRIORITY_SHIFT) & 0xffff) @@ -73,28 +70,24 @@ struct atarirle_desc FUNCTION PROTOTYPES ***************************************************************************/ -/* setup/shutdown */ -void atarirle_init(running_machine *machine, int map, const atarirle_desc *desc); +DECLARE_LEGACY_DEVICE(ATARIRLE, atarirle); +#define MCFG_ATARIRLE_ADD(_tag, _interface) \ + MCFG_DEVICE_ADD(_tag, ATARIRLE, 0) \ + MCFG_DEVICE_CONFIG(_interface) + /* control handlers */ -void atarirle_control_w(running_machine *machine, int map, UINT8 bits); -void atarirle_command_w(int map, UINT8 command); -VIDEO_EOF( atarirle ); +void atarirle_control_w(device_t *device, UINT8 bits); +void atarirle_command_w(device_t *device, UINT8 command); -/* write handlers */ -WRITE16_HANDLER( atarirle_0_spriteram_w ); -WRITE32_HANDLER( atarirle_0_spriteram32_w ); +/* read/write handlers */ +READ16_DEVICE_HANDLER( atarirle_spriteram_r ); +READ32_DEVICE_HANDLER( atarirle_spriteram32_r ); +WRITE16_DEVICE_HANDLER( atarirle_spriteram_w ); +WRITE32_DEVICE_HANDLER( atarirle_spriteram32_w ); /* render helpers */ -bitmap_t *atarirle_get_vram(int map, int idx); - - - -/*************************************************************************** - GLOBAL VARIABLES -***************************************************************************/ - -extern UINT16 *atarirle_0_spriteram; -extern UINT32 *atarirle_0_spriteram32; +void atarirle_eof(device_t *device); +bitmap_t *atarirle_get_vram(device_t *device, int idx); #endif