optimize a bit

This commit is contained in:
Michaël Banaan Ananas 2012-05-25 22:29:49 +00:00
parent 20807a3491
commit 4c5067b469
3 changed files with 27 additions and 22 deletions

View File

@ -391,7 +391,7 @@ WRITE8_MEMBER(turbo_state::buckrog_ppi0c_w)
/* bit 6 = /IOREQ on the 2nd CPU */
/* bit 7 = /INT on the 2nd CPU */
m_buckrog_fchg = data & 0x07;
cputag_set_input_line(machine(), "sub", 0, (data & 0x80) ? CLEAR_LINE : ASSERT_LINE);
device_set_input_line(m_subcpu, 0, (data & 0x80) ? CLEAR_LINE : ASSERT_LINE);
}
@ -613,8 +613,8 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( subroc3d_map, AS_PROGRAM, 8, turbo_state )
AM_RANGE(0x0000, 0x9fff) AM_ROM
AM_RANGE(0xa000, 0xa3ff) AM_RAM AM_SHARE("spritepos") // CONT RAM
AM_RANGE(0xa400, 0xa7ff) AM_RAM AM_SHARE("spriteram") // CONT RAM
AM_RANGE(0xa000, 0xa3ff) AM_RAM AM_SHARE("spritepos") // CONT RAM
AM_RANGE(0xa400, 0xa7ff) AM_RAM AM_SHARE("spriteram") // CONT RAM
AM_RANGE(0xa800, 0xa800) AM_MIRROR(0x07fc) AM_READ_PORT("IN0") // INPUT 253
AM_RANGE(0xa801, 0xa801) AM_MIRROR(0x07fc) AM_READ_PORT("IN1") // INPUT 253
AM_RANGE(0xa802, 0xa802) AM_MIRROR(0x07fc) AM_READ_PORT("DSW2") // INPUT 253
@ -639,14 +639,14 @@ ADDRESS_MAP_END
static ADDRESS_MAP_START( buckrog_map, AS_PROGRAM, 8, turbo_state )
AM_RANGE(0x0000, 0x7fff) AM_ROM
AM_RANGE(0x8000, 0xbfff) AM_ROM
AM_RANGE(0xc000, 0xc7ff) AM_RAM_WRITE(turbo_videoram_w) AM_SHARE("videoram") // FIX PAGE
AM_RANGE(0xc000, 0xc7ff) AM_RAM_WRITE(turbo_videoram_w) AM_SHARE("videoram") // FIX PAGE
AM_RANGE(0xc800, 0xc803) AM_MIRROR(0x07fc) AM_DEVWRITE_LEGACY("ppi8255_0", ppi8255_r) AM_WRITE(buckrog_ppi8255_0_w) // 8255
AM_RANGE(0xd000, 0xd003) AM_MIRROR(0x07fc) AM_DEVREADWRITE_LEGACY("ppi8255_1", ppi8255_r, ppi8255_w) // 8255
AM_RANGE(0xd800, 0xd800) AM_MIRROR(0x07fe) AM_DEVREADWRITE("i8279", i8279_device, data_r, data_w )
AM_RANGE(0xd801, 0xd801) AM_MIRROR(0x07fe) AM_DEVREADWRITE("i8279", i8279_device, status_r, cmd_w)
AM_RANGE(0xe000, 0xe3ff) AM_RAM AM_SHARE("spritepos") // CONT RAM
AM_RANGE(0xe400, 0xe7ff) AM_RAM AM_SHARE("spriteram") // CONT RAM
AM_RANGE(0xe800, 0xe800) AM_MIRROR(0x07fc) AM_READ_PORT("IN0") // INPUT
AM_RANGE(0xe000, 0xe3ff) AM_RAM AM_SHARE("spritepos") // CONT RAM
AM_RANGE(0xe400, 0xe7ff) AM_RAM AM_SHARE("spriteram") // CONT RAM
AM_RANGE(0xe800, 0xe800) AM_MIRROR(0x07fc) AM_READ_PORT("IN0") // INPUT
AM_RANGE(0xe801, 0xe801) AM_MIRROR(0x07fc) AM_READ_PORT("IN1")
AM_RANGE(0xe802, 0xe802) AM_MIRROR(0x07fc) AM_READ(buckrog_port_2_r)
AM_RANGE(0xe803, 0xe803) AM_MIRROR(0x07fc) AM_READ(buckrog_port_3_r)
@ -990,7 +990,7 @@ static MACHINE_CONFIG_START( buckrog, turbo_state )
MCFG_CPU_PROGRAM_MAP(buckrog_map)
MCFG_CPU_VBLANK_INT("screen", irq0_line_hold)
MCFG_CPU_ADD("sub", Z80, MASTER_CLOCK/4)
MCFG_CPU_ADD("subcpu", Z80, MASTER_CLOCK/4)
MCFG_CPU_PROGRAM_MAP(buckrog_cpu2_map)
MCFG_CPU_IO_MAP(buckrog_cpu2_portmap)
@ -1240,7 +1240,7 @@ ROM_START( buckrog )
ROM_LOAD( "cpu-ic3", 0x0000, 0x4000, CRC(f0055e97) SHA1(f6ee2afd6fef710949087d1cb04cbc242d1fa9f5) ) /* encrypted */
ROM_LOAD( "cpu-ic4", 0x4000, 0x4000, CRC(7d084c39) SHA1(ef2c0a2a59e14d9e196fd3837139fc5acf0f63be) ) /* encrypted */
ROM_REGION( 0x2000, "sub", 0 )
ROM_REGION( 0x2000, "subcpu", 0 )
ROM_LOAD( "epr-5200.cpu-ic66", 0x0000, 0x1000, CRC(0d58b154) SHA1(9f3951eb7ea1fa9ff914738462e4b4f755d60802) )
ROM_REGION( 0x40000, "gfx1", 0 ) /* sprite data */
@ -1278,7 +1278,7 @@ ROM_START( buckrogn )
ROM_LOAD( "cpu-ic3.bin", 0x0000, 0x4000, CRC(7f1910af) SHA1(22d37750282676d8fd1f602e928c174f823245c9) )
ROM_LOAD( "cpu-ic4.bin", 0x4000, 0x4000, CRC(5ecd393b) SHA1(d069f12326644f2c685e516d91d33b97ec162c56) )
ROM_REGION( 0x2000, "sub", 0 )
ROM_REGION( 0x2000, "subcpu", 0 )
ROM_LOAD( "epr-5200.cpu-ic66", 0x0000, 0x1000, CRC(0d58b154) SHA1(9f3951eb7ea1fa9ff914738462e4b4f755d60802) )
ROM_REGION( 0x40000, "gfx1", 0 ) /* sprite data */
@ -1315,7 +1315,7 @@ ROM_START( buckrogn2 )
ROM_LOAD( "epr-5204", 0x0000, 0x4000, CRC(c2d43741) SHA1(ad435278de101b32e931a2a1a6cdba9be7b7da73) )
ROM_LOAD( "epr-5205", 0x4000, 0x4000, CRC(648f3546) SHA1(2eefdab44aea5fe6fa8e302032c725615b9fdb8a) )
ROM_REGION( 0x2000, "sub", 0 )
ROM_REGION( 0x2000, "subcpu", 0 )
ROM_LOAD( "epr-5200.cpu-ic66", 0x0000, 0x1000, CRC(0d58b154) SHA1(9f3951eb7ea1fa9ff914738462e4b4f755d60802) )
ROM_REGION( 0x40000, "gfx1", 0 ) /* sprite data */
@ -1486,7 +1486,7 @@ ROM_START( zoom909 )
ROM_LOAD( "epr-5217b.cpu-ic3", 0x0000, 0x4000, CRC(1b56e7dd) SHA1(ccf638c318ebce754ac9628271d2064e05ced35c) ) /* encrypted */
ROM_LOAD( "epr-5218b.cpu-ic4", 0x4000, 0x4000, CRC(77dfd911) SHA1(cc1d4aac863b2d6b52eff7de2b8233be21aac3c9) ) /* encrypted */
ROM_REGION( 0x2000, "sub", 0 )
ROM_REGION( 0x2000, "subcpu", 0 )
ROM_LOAD( "epr-5200.cpu-ic66", 0x0000, 0x1000, CRC(0d58b154) SHA1(9f3951eb7ea1fa9ff914738462e4b4f755d60802) )
ROM_REGION( 0x40000, "gfx1", 0 ) /* sprite data */

View File

@ -17,15 +17,23 @@ class turbo_state : public driver_device
public:
turbo_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
m_maincpu(*this,"maincpu"),
m_subcpu(*this,"subcpu"),
m_gfx1(*this, "gfx1"),
m_videoram(*this, "videoram"),
m_spriteram(*this, "spriteram"),
m_sprite_position(*this, "spritepos")
{ }
/* memory pointers */
/* device/memory pointers */
required_device<cpu_device> m_maincpu;
optional_device<cpu_device> m_subcpu;
required_memory_region m_gfx1;
required_shared_ptr<UINT8> m_videoram;
required_shared_ptr<UINT8> m_spriteram;
required_shared_ptr<UINT8> m_sprite_position;
UINT8 * m_buckrog_bitmap_ram;
/* machine states */

View File

@ -347,9 +347,8 @@ static void turbo_prepare_sprites(running_machine &machine, turbo_state *state,
}
static UINT32 turbo_get_sprite_bits(running_machine &machine, UINT8 road, sprite_info *sprinfo)
static UINT32 turbo_get_sprite_bits(const UINT8 *sprite_gfxdata, UINT8 road, sprite_info *sprinfo)
{
const UINT8 *sprite_gfxdata = machine.root_device().memregion("gfx1")->base();
UINT8 sprlive = sprinfo->lst;
UINT32 sprdata = 0;
int level;
@ -531,7 +530,7 @@ SCREEN_UPDATE_IND16( turbo )
/* CDG0-7 = D8 -D15 */
/* CDR0-7 = D16-D23 */
/* PLB0-7 = D24-D31 */
sprbits = turbo_get_sprite_bits(screen.machine(), road, &sprinfo);
sprbits = turbo_get_sprite_bits(state->m_gfx1->base(), road, &sprinfo);
/* perform collision detection here via lookup in IC20/PR1116 (p. 144) */
state->m_turbo_collision |= pr1116[((sprbits >> 24) & 7) | (slipar_acciar >> 1)];
@ -700,7 +699,7 @@ static void subroc3d_prepare_sprites(running_machine &machine, turbo_state *stat
}
static UINT32 subroc3d_get_sprite_bits(running_machine &machine, sprite_info *sprinfo, UINT8 *plb)
static UINT32 subroc3d_get_sprite_bits(const UINT8 *sprite_gfxdata, sprite_info *sprinfo, UINT8 *plb)
{
/* see logic on each sprite:
END = (CDA == 1 && (CDA ^ CDB) == 0 && (CDC ^ CDD) == 0)
@ -708,7 +707,6 @@ static UINT32 subroc3d_get_sprite_bits(running_machine &machine, sprite_info *sp
end is in bit 1, plb in bit 0
*/
static const UINT8 plb_end[16] = { 0,1,1,2, 1,1,1,1, 1,1,1,1, 0,1,1,2 };
const UINT8 *sprite_gfxdata = machine.root_device().memregion("gfx1")->base();
UINT32 sprdata = 0;
int level;
@ -817,7 +815,7 @@ SCREEN_UPDATE_IND16( subroc3d )
/* CDB0-7 = D8 -D15 */
/* CDC0-7 = D16-D23 */
/* CDD0-7 = D24-D31 */
sprbits = subroc3d_get_sprite_bits(screen.machine(), &sprinfo, &plb);
sprbits = subroc3d_get_sprite_bits(state->m_gfx1->base(), &sprinfo, &plb);
/* MUX0-3 is selected by PLY0-3 and the sprite enable bits, and is the output */
/* of IC21/PR1450 (p. 141), unless MPLB = 0, in which case the values are grounded (p. 141) */
@ -920,7 +918,7 @@ static void buckrog_prepare_sprites(running_machine &machine, turbo_state *state
}
static UINT32 buckrog_get_sprite_bits(running_machine &machine, sprite_info *sprinfo, UINT8 *plb)
static UINT32 buckrog_get_sprite_bits(const UINT8 *sprite_gfxdata, sprite_info *sprinfo, UINT8 *plb)
{
/* see logic on each sprite:
END = (CDA == 1 && (CDA ^ CDB) == 0 && (CDC ^ CDD) == 0)
@ -928,7 +926,6 @@ static UINT32 buckrog_get_sprite_bits(running_machine &machine, sprite_info *spr
end is in bit 1, plb in bit 0
*/
static const UINT8 plb_end[16] = { 0,1,1,1, 1,1,1,1, 1,1,1,1, 1,1,1,2 };
const UINT8 *sprite_gfxdata = machine.root_device().memregion("gfx1")->base();
UINT32 sprdata = 0;
int level;
@ -1034,7 +1031,7 @@ SCREEN_UPDATE_IND16( buckrog )
/* CDB0-7 = D8 -D15 */
/* CDC0-7 = D16-D23 */
/* CDD0-7 = D24-D31 */
sprbits = buckrog_get_sprite_bits(screen.machine(), &sprinfo, &plb);
sprbits = buckrog_get_sprite_bits(state->m_gfx1->base(), &sprinfo, &plb);
/* the PLB bits go into an LS148 8-to-1 decoder and become MUX0-3 (PROM board SH 2/10) */
if (plb == 0)