mirror of
https://github.com/holub/mame
synced 2025-04-22 08:22:15 +03:00
gaelco2.c: reduce tagmap lookups (nw)
This commit is contained in:
parent
1ad6aa9200
commit
35ea367141
@ -204,12 +204,12 @@ ROM_END
|
||||
BANG
|
||||
============================================================================*/
|
||||
|
||||
READ16_MEMBER(gaelco2_state::p1_gun_x){return (ioport("LIGHT0_X")->read() * 320 / 0x100) + 1;}
|
||||
READ16_MEMBER(gaelco2_state::p1_gun_y){return (ioport("LIGHT0_Y")->read() * 240 / 0x100) - 4;}
|
||||
READ16_MEMBER(gaelco2_state::p2_gun_x){return (ioport("LIGHT1_X")->read() * 320 / 0x100) + 1;}
|
||||
READ16_MEMBER(gaelco2_state::p2_gun_y){return (ioport("LIGHT1_Y")->read() * 240 / 0x100) - 4;}
|
||||
READ16_MEMBER(bang_state::p1_gun_x){return (m_light0_x->read() * 320 / 0x100) + 1;}
|
||||
READ16_MEMBER(bang_state::p1_gun_y){return (m_light0_y->read() * 240 / 0x100) - 4;}
|
||||
READ16_MEMBER(bang_state::p2_gun_x){return (m_light1_x->read() * 320 / 0x100) + 1;}
|
||||
READ16_MEMBER(bang_state::p2_gun_y){return (m_light1_y->read() * 240 / 0x100) - 4;}
|
||||
|
||||
static ADDRESS_MAP_START( bang_map, AS_PROGRAM, 16, gaelco2_state )
|
||||
static ADDRESS_MAP_START( bang_map, AS_PROGRAM, 16, bang_state )
|
||||
AM_RANGE(0x000000, 0x0fffff) AM_ROM /* ROM */
|
||||
AM_RANGE(0x202890, 0x2028ff) AM_DEVREADWRITE("gaelco", gaelco_cg1v_device, gaelcosnd_r, gaelcosnd_w) /* Sound Registers */
|
||||
AM_RANGE(0x200000, 0x20ffff) AM_RAM_WRITE(gaelco2_vram_w) AM_SHARE("spriteram") /* Video RAM */
|
||||
@ -263,11 +263,11 @@ static INPUT_PORTS_START( bang )
|
||||
PORT_BIT( 0xff, 0x80, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, -6.0 / 240, 0) PORT_SENSITIVITY(35) PORT_KEYDELTA(15) PORT_PLAYER(2)
|
||||
INPUT_PORTS_END
|
||||
|
||||
static MACHINE_CONFIG_START( bang, gaelco2_state )
|
||||
static MACHINE_CONFIG_START( bang, bang_state )
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", M68000, 30000000/2) /* 15 MHz */
|
||||
MCFG_CPU_PROGRAM_MAP(bang_map)
|
||||
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", gaelco2_state, bang_irq, "screen", 0, 1)
|
||||
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", bang_state, bang_irq, "screen", 0, 1)
|
||||
|
||||
MCFG_EEPROM_SERIAL_93C66_ADD("eeprom")
|
||||
|
||||
@ -1060,7 +1060,7 @@ ROM_END
|
||||
WORLD RALLY 2
|
||||
============================================================================*/
|
||||
|
||||
static ADDRESS_MAP_START( wrally2_map, AS_PROGRAM, 16, gaelco2_state )
|
||||
static ADDRESS_MAP_START( wrally2_map, AS_PROGRAM, 16, wrally2_state )
|
||||
AM_RANGE(0x000000, 0x0fffff) AM_ROM /* ROM */
|
||||
AM_RANGE(0x202890, 0x2028ff) AM_DEVREADWRITE("gaelco", gaelco_gae1_device, gaelcosnd_r, gaelcosnd_w) /* Sound Registers */
|
||||
AM_RANGE(0x200000, 0x20ffff) AM_RAM_WRITE(gaelco2_vram_w) AM_SHARE("spriteram") /* Video RAM */
|
||||
@ -1086,7 +1086,7 @@ static INPUT_PORTS_START( wrally2 )
|
||||
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
|
||||
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 Acc.")
|
||||
PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 Gear") PORT_TOGGLE
|
||||
PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, gaelco2_state,wrally2_analog_bit_r, (void *)0) /* ADC_1 serial input */
|
||||
PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, wrally2_state,wrally2_analog_bit_r, (void *)0) /* ADC_1 serial input */
|
||||
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START1 )
|
||||
PORT_SERVICE_DIPLOC( 0x0100, IP_ACTIVE_LOW, "SW2:1" )
|
||||
PORT_DIPNAME( 0x0200, 0x0000, "Coin mechanism" ) PORT_DIPLOCATION("SW2:2")
|
||||
@ -1144,7 +1144,7 @@ static INPUT_PORTS_START( wrally2 )
|
||||
PORT_BIT( 0x0008, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
|
||||
PORT_BIT( 0x0010, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 Acc.")
|
||||
PORT_BIT( 0x0020, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 Gear") PORT_TOGGLE
|
||||
PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, gaelco2_state,wrally2_analog_bit_r, (void *)1) /* ADC_2 serial input */
|
||||
PORT_BIT( 0x0040, IP_ACTIVE_HIGH, IPT_SPECIAL) PORT_CUSTOM_MEMBER(DEVICE_SELF, wrally2_state,wrally2_analog_bit_r, (void *)1) /* ADC_2 serial input */
|
||||
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_START2 )
|
||||
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_COIN1 )
|
||||
PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_COIN2 )
|
||||
@ -1167,7 +1167,7 @@ static INPUT_PORTS_START( wrally2 )
|
||||
PORT_BIT( 0xff, 0x8A, IPT_PADDLE_V ) PORT_MINMAX(0x00,0xff) PORT_SENSITIVITY(25) PORT_KEYDELTA(25) PORT_REVERSE PORT_NAME("P2 Wheel")
|
||||
INPUT_PORTS_END
|
||||
|
||||
static MACHINE_CONFIG_START( wrally2, gaelco2_state )
|
||||
static MACHINE_CONFIG_START( wrally2, wrally2_state )
|
||||
/* basic machine hardware */
|
||||
MCFG_CPU_ADD("maincpu", M68000, 26000000/2) /* 13 MHz */
|
||||
MCFG_CPU_PROGRAM_MAP(wrally2_map)
|
||||
@ -1415,7 +1415,7 @@ GAME( 1995, wrally2, 0, wrally2, wrally2, driver_device, 0, ROT
|
||||
GAME( 1996, maniacsq, 0, maniacsq, maniacsq, driver_device, 0, ROT0, "Gaelco", "Maniac Square (unprotected)", 0 )
|
||||
GAME( 1996, snowboar, 0, snowboar, snowboar, driver_device, 0, ROT0, "Gaelco", "Snow Board Championship (Version 2.1)", MACHINE_UNEMULATED_PROTECTION | MACHINE_NOT_WORKING )
|
||||
GAME( 1996, snowboara,snowboar, snowboar, snowboar, gaelco2_state, snowboar, ROT0, "Gaelco", "Snow Board Championship (Version 2.0)", MACHINE_UNEMULATED_PROTECTION | MACHINE_NOT_WORKING )
|
||||
GAME( 1998, bang, 0, bang, bang, gaelco2_state, bang, ROT0, "Gaelco", "Bang!", 0 )
|
||||
GAME( 1998, bangj, bang, bang, bang, gaelco2_state, bang, ROT0, "Gaelco", "Gun Gabacho (Japan)", 0 )
|
||||
GAME( 1998, bang, 0, bang, bang, bang_state, bang, ROT0, "Gaelco", "Bang!", 0 )
|
||||
GAME( 1998, bangj, bang, bang, bang, bang_state, bang, ROT0, "Gaelco", "Gun Gabacho (Japan)", 0 )
|
||||
GAME( 1999, grtesoro, 0, maniacsq, maniacsq, driver_device, 0, ROT0, "Nova Desitec", "Gran Tesoro? / Play 2000 (v5.01) (Italy)", MACHINE_UNEMULATED_PROTECTION | MACHINE_NOT_WORKING )
|
||||
GAME( 1999, grtesoro4, grtesoro,maniacsq, maniacsq, driver_device, 0, ROT0, "Nova Desitec", "Gran Tesoro? / Play 2000 (v4.0) (Italy)", MACHINE_UNEMULATED_PROTECTION | MACHINE_NOT_WORKING )
|
||||
|
@ -27,33 +27,21 @@ public:
|
||||
required_device<palette_device> m_palette;
|
||||
required_shared_ptr<UINT16> m_generic_paletteram_16;
|
||||
|
||||
int m_clr_gun_int;
|
||||
UINT8 m_analog_ports[2];
|
||||
UINT16 *m_videoram;
|
||||
tilemap_t *m_pant[2];
|
||||
int m_dual_monitor;
|
||||
|
||||
DECLARE_READ16_MEMBER(p1_gun_x);
|
||||
DECLARE_READ16_MEMBER(p1_gun_y);
|
||||
DECLARE_READ16_MEMBER(p2_gun_x);
|
||||
DECLARE_READ16_MEMBER(p2_gun_y);
|
||||
DECLARE_READ16_MEMBER(dallas_kludge_r);
|
||||
DECLARE_WRITE16_MEMBER(gaelco2_coin_w);
|
||||
DECLARE_WRITE16_MEMBER(gaelco2_coin2_w);
|
||||
DECLARE_WRITE16_MEMBER(wrally2_coin_w);
|
||||
DECLARE_WRITE16_MEMBER(touchgo_coin_w);
|
||||
DECLARE_WRITE16_MEMBER(bang_clr_gun_int_w);
|
||||
DECLARE_WRITE16_MEMBER(wrally2_adc_clk);
|
||||
DECLARE_WRITE16_MEMBER(wrally2_adc_cs);
|
||||
DECLARE_READ16_MEMBER(snowboar_protection_r);
|
||||
DECLARE_WRITE16_MEMBER(snowboar_protection_w);
|
||||
DECLARE_WRITE16_MEMBER(gaelco2_vram_w);
|
||||
DECLARE_WRITE16_MEMBER(gaelco2_palette_w);
|
||||
DECLARE_CUSTOM_INPUT_MEMBER(wrally2_analog_bit_r);
|
||||
DECLARE_DRIVER_INIT(touchgo);
|
||||
DECLARE_DRIVER_INIT(snowboar);
|
||||
DECLARE_DRIVER_INIT(alighunt);
|
||||
DECLARE_DRIVER_INIT(bang);
|
||||
TILE_GET_INFO_MEMBER(get_tile_info_gaelco2_screen0);
|
||||
TILE_GET_INFO_MEMBER(get_tile_info_gaelco2_screen1);
|
||||
TILE_GET_INFO_MEMBER(get_tile_info_gaelco2_screen0_dual);
|
||||
@ -63,7 +51,6 @@ public:
|
||||
UINT32 screen_update_gaelco2(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
UINT32 screen_update_gaelco2_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
UINT32 screen_update_gaelco2_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(bang_irq);
|
||||
DECLARE_WRITE16_MEMBER(gaelco2_eeprom_cs_w);
|
||||
DECLARE_WRITE16_MEMBER(gaelco2_eeprom_sk_w);
|
||||
DECLARE_WRITE16_MEMBER(gaelco2_eeprom_data_w);
|
||||
@ -71,3 +58,53 @@ public:
|
||||
UINT32 dual_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int index);
|
||||
void gaelco2_ROM16_split_gfx(const char *src_reg, const char *dst_reg, int start, int length, int dest1, int dest2);
|
||||
};
|
||||
|
||||
|
||||
class bang_state : public gaelco2_state
|
||||
{
|
||||
public:
|
||||
bang_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: gaelco2_state(mconfig, type, tag)
|
||||
, m_light0_x(*this, "LIGHT0_X")
|
||||
, m_light0_y(*this, "LIGHT0_Y")
|
||||
, m_light1_x(*this, "LIGHT1_X")
|
||||
, m_light1_y(*this, "LIGHT1_Y")
|
||||
{}
|
||||
|
||||
required_ioport m_light0_x;
|
||||
required_ioport m_light0_y;
|
||||
required_ioport m_light1_x;
|
||||
required_ioport m_light1_y;
|
||||
|
||||
int m_clr_gun_int;
|
||||
|
||||
DECLARE_READ16_MEMBER(p1_gun_x);
|
||||
DECLARE_READ16_MEMBER(p1_gun_y);
|
||||
DECLARE_READ16_MEMBER(p2_gun_x);
|
||||
DECLARE_READ16_MEMBER(p2_gun_y);
|
||||
DECLARE_WRITE16_MEMBER(bang_clr_gun_int_w);
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(bang_irq);
|
||||
DECLARE_DRIVER_INIT(bang);
|
||||
};
|
||||
|
||||
|
||||
class wrally2_state : public gaelco2_state
|
||||
{
|
||||
public:
|
||||
wrally2_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: gaelco2_state(mconfig, type, tag)
|
||||
, m_analog0(*this, "ANALOG0")
|
||||
, m_analog1(*this, "ANALOG1")
|
||||
{}
|
||||
|
||||
required_ioport m_analog0;
|
||||
required_ioport m_analog1;
|
||||
|
||||
UINT8 m_analog_ports[2];
|
||||
|
||||
DECLARE_WRITE16_MEMBER(wrally2_coin_w);
|
||||
DECLARE_WRITE16_MEMBER(wrally2_adc_clk);
|
||||
DECLARE_WRITE16_MEMBER(wrally2_adc_cs);
|
||||
DECLARE_CUSTOM_INPUT_MEMBER(wrally2_analog_bit_r);
|
||||
};
|
||||
|
||||
|
@ -155,7 +155,7 @@ WRITE16_MEMBER(gaelco2_state::gaelco2_coin2_w)
|
||||
coin_counter_w(machine(), offset & 0x01, data & 0x01);
|
||||
}
|
||||
|
||||
WRITE16_MEMBER(gaelco2_state::wrally2_coin_w)
|
||||
WRITE16_MEMBER(wrally2_state::wrally2_coin_w)
|
||||
{
|
||||
/* coin counters */
|
||||
coin_counter_w(machine(), (offset >> 3) & 0x01, data & 0x01);
|
||||
@ -178,17 +178,17 @@ WRITE16_MEMBER(gaelco2_state::touchgo_coin_w)
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
DRIVER_INIT_MEMBER(gaelco2_state,bang)
|
||||
DRIVER_INIT_MEMBER(bang_state,bang)
|
||||
{
|
||||
m_clr_gun_int = 0;
|
||||
}
|
||||
|
||||
WRITE16_MEMBER(gaelco2_state::bang_clr_gun_int_w)
|
||||
WRITE16_MEMBER(bang_state::bang_clr_gun_int_w)
|
||||
{
|
||||
m_clr_gun_int = 1;
|
||||
}
|
||||
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(gaelco2_state::bang_irq)
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(bang_state::bang_irq)
|
||||
{
|
||||
int scanline = param;
|
||||
|
||||
@ -218,14 +218,14 @@ TIMER_DEVICE_CALLBACK_MEMBER(gaelco2_state::bang_irq)
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
CUSTOM_INPUT_MEMBER(gaelco2_state::wrally2_analog_bit_r)
|
||||
CUSTOM_INPUT_MEMBER(wrally2_state::wrally2_analog_bit_r)
|
||||
{
|
||||
int which = (FPTR)param;
|
||||
return (m_analog_ports[which] >> 7) & 0x01;
|
||||
}
|
||||
|
||||
|
||||
WRITE16_MEMBER(gaelco2_state::wrally2_adc_clk)
|
||||
WRITE16_MEMBER(wrally2_state::wrally2_adc_clk)
|
||||
{
|
||||
/* a zero/one combo is written here to clock the next analog port bit */
|
||||
if (ACCESSING_BITS_0_7)
|
||||
@ -241,15 +241,15 @@ WRITE16_MEMBER(gaelco2_state::wrally2_adc_clk)
|
||||
}
|
||||
|
||||
|
||||
WRITE16_MEMBER(gaelco2_state::wrally2_adc_cs)
|
||||
WRITE16_MEMBER(wrally2_state::wrally2_adc_cs)
|
||||
{
|
||||
/* a zero is written here to read the analog ports, and a one is written when finished */
|
||||
if (ACCESSING_BITS_0_7)
|
||||
{
|
||||
if (!(data & 0xff))
|
||||
{
|
||||
m_analog_ports[0] = ioport("ANALOG0")->read_safe(0);
|
||||
m_analog_ports[1] = ioport("ANALOG1")->read_safe(0);
|
||||
m_analog_ports[0] = m_analog0->read();
|
||||
m_analog_ports[1] = m_analog1->read();
|
||||
}
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user