diff --git a/src/mame/audio/firetrk.c b/src/mame/audio/firetrk.c index bae5ec52c96..290f57477fe 100644 --- a/src/mame/audio/firetrk.c +++ b/src/mame/audio/firetrk.c @@ -11,17 +11,20 @@ WRITE8_HANDLER( firetrk_skid_reset_w ) { - if (GAME_IS_FIRETRUCK || GAME_IS_SUPERBUG) - { - firetrk_skid[0] = 0; - firetrk_skid[1] = 0; - } + firetrk_skid[0] = 0; + firetrk_skid[1] = 0; - // also SUPERBUG_SKID_EN and MONTECAR_SKID_EN + // also SUPERBUG_SKID_EN discrete_sound_w(FIRETRUCK_SKID_EN, 1); } +WRITE8_HANDLER( montecar_skid_reset_w ) +{ + discrete_sound_w(MONTECAR_SKID_EN, 1); +} + + WRITE8_HANDLER( firetrk_crash_snd_w ) { // also SUPERBUG_CRASH_DATA and MONTECAR_CRASH_DATA @@ -38,14 +41,17 @@ WRITE8_HANDLER( firetrk_skid_snd_w ) WRITE8_HANDLER( firetrk_motor_snd_w ) { - if (GAME_IS_FIRETRUCK || GAME_IS_MONTECARLO) - { - // also MONTECAR_DRONE_MOTOR_DATA - discrete_sound_w(FIRETRUCK_SIREN_DATA, data >> 4); - } + // also MONTECAR_DRONE_MOTOR_DATA + discrete_sound_w(FIRETRUCK_SIREN_DATA, data >> 4); - // also SUPERBUG_SPEED_DATA and MONTECAR_MOTOR_DATA - discrete_sound_w(FIRETRUCK_MOTOR_DATA, data & 0x0f); + // also MONTECAR_MOTOR_DATA + discrete_sound_w(FIRETRUCK_MOTOR_DATA, data & 0x0f); +} + + +WRITE8_HANDLER( superbug_motor_snd_w ) +{ + discrete_sound_w(SUPERBUG_SPEED_DATA, data & 0x0f); } @@ -55,24 +61,10 @@ WRITE8_HANDLER( firetrk_xtndply_w ) } -WRITE8_HANDLER( firetrk_asr_w ) +WRITE8_HANDLER( superbug_asr_w ) { - if (GAME_IS_SUPERBUG) - { +popmessage("ASR"); discrete_sound_w(SUPERBUG_ASR_EN, 1); /* ASR */ - } -} - - -WRITE8_HANDLER( firetrk_out2_w ) -{ - firetrk_set_flash(data & 0x80); - - if (GAME_IS_MONTECARLO) - { - discrete_sound_w(MONTECAR_BEEPER_EN, data & 0x10); /* Beep */ - discrete_sound_w(MONTECAR_DRONE_LOUD_DATA, data & 0x0f); /* Drone Motor Volume */ - } } diff --git a/src/mame/drivers/firetrk.c b/src/mame/drivers/firetrk.c index 1313dfc9044..5b16800670c 100644 --- a/src/mame/drivers/firetrk.c +++ b/src/mame/drivers/firetrk.c @@ -10,37 +10,22 @@ Atari Fire Truck + Super Bug + Monte Carlo driver #include "sound/discrete.h" #define FIRETRK_CPU_CLOCK_1MHZ (12096000 / 12) -#define FIRETRK_CPU_CLOCK_750KZ (12096000 /16) +#define FIRETRK_CPU_CLOCK_750KZ (12096000 / 16) int firetrk_game; -UINT32 firetrk_color1_mask; -UINT32 firetrk_color2_mask; - -static int last_service; -static int steer_dir[2]; -static int steer_flag[2]; -static int attract; -static int gear; +static UINT8 in_service_mode; +static UINT32 dial[2]; +static UINT8 steer_dir[2]; +static UINT8 steer_flag[2]; +static UINT8 gear; -static DRIVER_INIT( firetrk ) +static void set_service_mode(running_machine *machine, int enable) { - firetrk_game = 1; -} -static DRIVER_INIT( superbug ) -{ - firetrk_game = 2; -} -static DRIVER_INIT( montecar ) -{ - firetrk_game = 3; -} + in_service_mode = enable; - -static void set_firetrk_service(running_machine *machine, int enable) -{ /* watchdog is disabled during service mode */ watchdog_enable(machine, !enable); @@ -49,41 +34,33 @@ static void set_firetrk_service(running_machine *machine, int enable) } +static INPUT_CHANGED( service_mode_switch_changed ) +{ + set_service_mode(machine, newval); +} + + +static INPUT_CHANGED( firetrk_horn_changed ) +{ + discrete_sound_w(FIRETRUCK_HORN_EN, newval); +} + + +static INPUT_CHANGED( gear_changed ) +{ + if (newval) + gear = (FPTR)param; +} + + static INTERRUPT_GEN( firetrk_interrupt ) { - int firetrk_service; - - if (GAME_IS_FIRETRUCK) - { - firetrk_service = readinputport(4) & 0x80; - if (firetrk_service != last_service) - { - set_firetrk_service(machine, firetrk_service); - - last_service = firetrk_service; - } - if (firetrk_service) - return; - } - else - if (GAME_IS_MONTECARLO) - { - firetrk_service = readinputport(6) & 0x04; - if (firetrk_service != last_service) - { - set_firetrk_service(machine, firetrk_service); - - last_service = firetrk_service; - } - if (firetrk_service) - return; - } - else - discrete_sound_w(SUPERBUG_ASR_EN, 0); /* Super Bug - ASR */ + /* Super Bug - ASR - when is this used and what is an ASR? */ +// discrete_sound_w(SUPERBUG_ASR_EN, 0); /* NMI interrupts are disabled during service mode in firetrk and montecar */ - /* they never make it here if in service mode */ - cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE); + if (!in_service_mode) + cpunum_set_input_line(machine, 0, INPUT_LINE_NMI, PULSE_LINE); } @@ -94,413 +71,270 @@ static TIMER_CALLBACK( periodic_callback ) cpunum_set_input_line(machine, 0, 0, PULSE_LINE); /* IRQs are generated by inverse 16V signal */ - scanline += 32; if (scanline > 262) - { scanline = 0; - } timer_set(video_screen_get_time_until_pos(0, scanline, 0), NULL, scanline, periodic_callback); } -static TIMER_CALLBACK( frame_callback ) +static WRITE8_HANDLER( firetrk_output_w ) { - static UINT8 dial[2]; + /* BIT0 => START1 LAMP */ + set_led_status(0, !(data & 0x01)); - int i; + /* BIT1 => START2 LAMP */ + set_led_status(1, !(data & 0x02)); - /* handle steering wheels */ + /* BIT2 => FLASH */ + firetrk_flash = data & 0x04; - for (i = 0; i < 2; i++) - { - signed char delta = readinputport(i) - dial[i]; + /* BIT3 => TRACK LAMP */ + set_led_status(3, !(data & 0x08)); - if (delta < 0) - { - steer_flag[i] = 1; - steer_dir[i] = 0; - } - if (delta > 0) - { - steer_flag[i] = 1; - steer_dir[i] = 1; - } + /* BIT4 => ATTRACT */ + discrete_sound_w(FIRETRUCK_ATTRACT_EN, data & 0x10); + coin_lockout_w(0, !(data & 0x10)); + coin_lockout_w(1, !(data & 0x10)); - dial[i] += delta; - } + /* BIT5 => START3 LAMP */ + set_led_status(2, !(data & 0x20)); - if (GAME_IS_FIRETRUCK) - { - /* map horn button onto discrete sound emulation */ - discrete_sound_w(FIRETRUCK_HORN_EN, readinputport(7)); - } + /* BIT6 => UNUSED */ - /* update gear shift */ - if (GAME_IS_SUPERBUG || GAME_IS_MONTECARLO) - { - switch (readinputport(7) & 15) - { - case 1: gear = 1; break; - case 2: gear = 2; break; - case 4: gear = 3; break; - case 8: gear = 4; break; - } - } + /* BIT7 => BELL OUT */ + discrete_sound_w(FIRETRUCK_BELL_EN, data & 0x80); } -static void write_output(UINT8 flags) +static WRITE8_HANDLER( superbug_output_w ) { - if (GAME_IS_FIRETRUCK) - { - /* BIT0 => START1 LAMP */ - /* BIT1 => START2 LAMP */ - /* BIT2 => FLASH */ - /* BIT3 => TRACK LAMP */ - /* BIT4 => ATTRACT */ - /* BIT5 => START3 LAMP */ - /* BIT6 => UNUSED */ - /* BIT7 => BELL OUT */ + /* BIT0 => START LAMP */ + set_led_status(0, offset & 0x01); - set_led_status(0, !(flags & 0x01)); - set_led_status(1, !(flags & 0x02)); - set_led_status(2, !(flags & 0x20)); - set_led_status(3, !(flags & 0x08)); + /* BIT1 => ATTRACT */ + discrete_sound_w(SUPERBUG_ATTRACT_EN, offset & 0x02); + coin_lockout_w(0, !(offset & 0x02)); + coin_lockout_w(1, !(offset & 0x02)); - attract = flags & 0x10; + /* BIT2 => FLASH */ + firetrk_flash = offset & 0x04; - discrete_sound_w(FIRETRUCK_BELL_EN, flags & 0x80); /* Bell Sound */ - discrete_sound_w(FIRETRUCK_ATTRACT_EN, flags & 0x10); /* Attract */ + /* BIT3 => TRACK LAMP */ + set_led_status(1, offset & 0x08); +} - coin_lockout_w(0, !attract); - coin_lockout_w(1, !attract); - firetrk_set_flash(flags & 0x04); - } +static WRITE8_HANDLER( montecar_output_1_w ) +{ + /* BIT0 => START LAMP */ + set_led_status(0, !(data & 0x01)); - if (GAME_IS_SUPERBUG) - { - /* BIT0 => START LAMP */ - /* BIT1 => ATTRACT */ - /* BIT2 => FLASH */ - /* BIT3 => TRACK LAMP */ + /* BIT1 => TRACK LAMP */ + set_led_status(1, !(data & 0x02)); - attract = flags & 0x02; + /* BIT2 => ATTRACT */ + discrete_sound_w(MONTECAR_ATTRACT_INV, data & 0x04); - set_led_status(0, flags & 0x01); - set_led_status(1, flags & 0x08); + /* BIT3 => UNUSED */ + /* BIT4 => UNUSED */ - discrete_sound_w(SUPERBUG_ATTRACT_EN, flags & 0x02); /* Attract */ + /* BIT5 => COIN3 COUNTER */ + coin_counter_w(0, data & 0x80); - coin_lockout_w(0, !attract); - coin_lockout_w(1, !attract); + /* BIT6 => COIN2 COUNTER */ + coin_counter_w(1, data & 0x40); - firetrk_set_flash(flags & 0x04); - } + /* BIT7 => COIN1 COUNTER */ + coin_counter_w(2, data & 0x20); +} - if (GAME_IS_MONTECARLO) - { - /* BIT0 => START LAMP */ - /* BIT1 => TRACK LAMP */ - /* BIT2 => ATTRACT */ - /* BIT3 => UNUSED */ - /* BIT4 => UNUSED */ - /* BIT5 => COIN3 COUNTER */ - /* BIT6 => COIN2 COUNTER */ - /* BIT7 => COIN1 COUNTER */ - set_led_status(0, !(flags & 0x01)); - set_led_status(1, !(flags & 0x02)); +static WRITE8_HANDLER( montecar_output_2_w ) +{ + firetrk_flash = data & 0x80; - discrete_sound_w(MONTECAR_ATTRACT_INV, flags & 0x04); /* Attract */ - - coin_counter_w(0, flags & 0x80); - coin_counter_w(1, flags & 0x40); - coin_counter_w(2, flags & 0x20); - } + discrete_sound_w(MONTECAR_BEEPER_EN, data & 0x10); + discrete_sound_w(MONTECAR_DRONE_LOUD_DATA, data & 0x0f); } static MACHINE_RESET( firetrk ) { - timer_pulse(video_screen_get_frame_period(0), NULL, 0, frame_callback); - - if (GAME_IS_MONTECARLO) - { - write_output(0); - last_service = readinputport(6) & 0x04; - set_firetrk_service(machine, last_service); - } - else - if (GAME_IS_FIRETRUCK) - { - last_service = readinputport(4) & 0x80; - set_firetrk_service(machine, last_service); - } + set_service_mode(machine, 0); timer_call_after_resynch(NULL, 0, periodic_callback); } -static PALETTE_INIT( firetrk ) -{ - static const UINT8 colortable_source[] = - { - 0, 0, 1, 0, - 2, 0, 3, 0, - 3, 3, 2, 3, - 1, 3, 0, 3, - 0, 0, 1, 0, - 2, 0, 0, 3, - 3, 0, 0, 3 - }; - static const rgb_t palette_source[] = - { - MAKE_RGB(0x00, 0x00, 0x00), - MAKE_RGB(0x5b, 0x5b, 0x5b), - MAKE_RGB(0xa4, 0xa4, 0xa4), - MAKE_RGB(0xff, 0xff, 0xff) - }; - int i; - - firetrk_color1_mask = firetrk_color2_mask = 0; - for (i = 0; i < ARRAY_LENGTH(colortable_source); i++) - { - UINT8 color = colortable_source[i]; - if (color == 1) - firetrk_color1_mask |= 1 << i; - else if (color == 2) - firetrk_color2_mask |= 1 << i; - palette_set_color(machine, i, palette_source[color]); - } -} - - -static void prom_to_palette(running_machine *machine, int number, UINT8 val) -{ - palette_set_color_rgb(machine, number, pal1bit(val >> 2), pal1bit(val >> 1), pal1bit(val >> 0)); -} - - -static PALETTE_INIT( montecar ) -{ - static const UINT8 colortable_source[] = - { - 0x00, 0x00, 0x00, 0x01, - 0x00, 0x02, 0x00, 0x03, - 0x03, 0x03, 0x03, 0x02, - 0x03, 0x01, 0x03, 0x00, - 0x00, 0x00, 0x02, 0x00, - 0x02, 0x01, 0x02, 0x02, - 0x00, 0x10, 0x20, 0x30, - 0x00, 0x04, 0x08, 0x0C, - 0x00, 0x44, 0x48, 0x4C, - 0x00, 0x84, 0x88, 0x8C, - 0x00, 0xC4, 0xC8, 0xCC - }; - - /* - * The color PROM is addressed as follows: - * - * A0 => PLAYFIELD 1 - * A1 => PLAYFIELD 2 - * A2 => DRONE 1 - * A3 => DRONE 2 - * A4 => CAR 1 - * A5 => CAR 2 - * A6 => DRONE COLOR 1 - * A7 => DRONE COLOR 2 - * A8 => PLAYFIELD WINDOW - * - * This driver hard-codes some behavior which actually depends - * on the PROM, like priorities, clipping and transparency. - * - */ - - const UINT8* p = memory_region(REGION_PROMS); - int i; - - firetrk_color1_mask = firetrk_color2_mask = 0; - for (i = 0; i < ARRAY_LENGTH(colortable_source); i++) - { - UINT8 color = colortable_source[i]; - if (color == 1) - firetrk_color1_mask |= 1 << i; - else if (color == 2) - firetrk_color2_mask |= 1 << i; - prom_to_palette(machine, i, p[0x100 + colortable_source[i]]); - } - - palette_set_color(machine, ARRAY_LENGTH(colortable_source) + 0, MAKE_RGB(0x00, 0x00, 0x00)); - palette_set_color(machine, ARRAY_LENGTH(colortable_source) + 1, MAKE_RGB(0xff, 0xff, 0xff)); -} - - static READ8_HANDLER( firetrk_dip_r ) { - UINT8 val0 = readinputport(2); - UINT8 val1 = readinputport(3); + UINT8 val0 = readinputportbytag("DIP_0"); + UINT8 val1 = readinputportbytag("DIP_1"); - if (GAME_IS_FIRETRUCK || GAME_IS_SUPERBUG) - { - if (val1 & (1 << (2 * offset + 0))) val0 |= 1; - if (val1 & (1 << (2 * offset + 1))) val0 |= 2; - } - if (GAME_IS_MONTECARLO) - { - if (val1 & (1 << (3 - offset))) val0 |= 1; - if (val1 & (1 << (7 - offset))) val0 |= 2; - } + if (val1 & (1 << (2 * offset + 0))) val0 |= 1; + if (val1 & (1 << (2 * offset + 1))) val0 |= 2; return val0; } +static READ8_HANDLER( montecar_dip_r ) +{ + UINT8 val0 = readinputportbytag("DIP_0"); + UINT8 val1 = readinputportbytag("DIP_1"); + + if (val1 & (1 << (3 - offset))) val0 |= 1; + if (val1 & (1 << (7 - offset))) val0 |= 2; + + return val0; +} + + +static CUSTOM_INPUT( steer_dir_r ) +{ + return steer_dir[(FPTR)param]; +} + + +static CUSTOM_INPUT( steer_flag_r ) +{ + return steer_flag[(FPTR)param]; +} + + +static CUSTOM_INPUT( skid_r ) +{ + UINT32 ret; + int which = (FPTR)param; + + if (which != 2) + ret = firetrk_skid[which]; + else + ret = firetrk_skid[0] | firetrk_skid[1]; + + return ret; +} + + +static CUSTOM_INPUT( crash_r ) +{ + UINT32 ret; + int which = (FPTR)param; + + if (which != 2) + ret = firetrk_crash[which]; + else + ret = firetrk_crash[0] | firetrk_crash[1]; + + return ret; +} + + +static CUSTOM_INPUT( gear_r ) +{ + return (gear == (FPTR)param) ? 1 : 0; +} + + static READ8_HANDLER( firetrk_input_r ) { - UINT8 val = 0; + int i; - UINT8 bit0 = readinputport(4); - UINT8 bit6 = readinputport(5); - UINT8 bit7 = readinputport(6); - - if (GAME_IS_FIRETRUCK) + /* update steering wheels */ + for (i = 0; i < 2; i++) { - if (!steer_dir[0]) - bit0 |= 0x04; - if (!steer_flag[0]) - bit7 |= 0x04; - if (firetrk_skid[0] || firetrk_skid[1]) - bit0 |= 0x40; - if (firetrk_crash[0] || firetrk_crash[1]) - bit7 |= 0x40; - if (!steer_dir[1]) - bit0 |= 0x08; - if (!steer_flag[1]) - bit7 |= 0x08; + UINT32 new_dial = readinputportbytag_safe((i ? "STEER_2" : "STEER_1"), 0); + INT32 delta = new_dial - dial[i]; + + if (delta != 0) + { + steer_flag[i] = 0; + steer_dir[i] = (delta < 0) ? 1 : 0; + + dial[i] = dial[i] + delta; + } } - if (GAME_IS_SUPERBUG) - { - if (!steer_dir[0]) - bit0 |= 0x04; - if (!steer_flag[0]) - bit7 |= 0x04; - if (firetrk_skid[0]) - bit0 |= 0x40; - if (firetrk_crash[0]) - bit7 |= 0x40; - if (gear == 1) - bit7 |= 0x02; - if (gear == 2) - bit0 |= 0x01; - if (gear == 3) - bit7 |= 0x01; - } - - if (GAME_IS_MONTECARLO) - { - if (!steer_dir[0]) - bit6 |= 0x40; - if (!steer_flag[0]) - bit7 |= 0x40; - if (gear == 1) - bit6 |= 0x01; - if (gear == 2) - bit6 |= 0x02; - if (gear == 3) - bit6 |= 0x04; - if (firetrk_skid[0]) - bit7 |= 0x80; - if (firetrk_skid[1]) - bit6 |= 0x80; - if (firetrk_crash[0]) - val |= 0x02; - if (firetrk_crash[1]) - val |= 0x01; - } - - if (bit0 & (1 << offset)) val |= 0x01; - if (bit6 & (1 << offset)) val |= 0x40; - if (bit7 & (1 << offset)) val |= 0x80; - - return val; + return ((readinputportbytag_safe("BIT_0", 0) & (1 << offset)) ? 0x01 : 0) | + ((readinputportbytag_safe("BIT_6", 0) & (1 << offset)) ? 0x40 : 0) | + ((readinputportbytag_safe("BIT_7", 0) & (1 << offset)) ? 0x80 : 0); } -static WRITE8_HANDLER( firetrk_arrow_off_w ) +static READ8_HANDLER( montecar_input_r ) { - firetrk_set_blink(1); + UINT8 ret = firetrk_input_r(offset); + + if (firetrk_crash[0]) + ret |= 0x02; + + /* can this be right, bit 0 again ???? */ + if (firetrk_crash[1]) + ret |= 0x01; + + return ret; } -static WRITE8_HANDLER( firetrk_car_reset_w ) +static WRITE8_HANDLER( blink_on_w ) +{ + *firetrk_blink = TRUE; +} + + +static WRITE8_HANDLER( montecar_car_reset_w ) { firetrk_crash[0] = 0; firetrk_skid[0] = 0; } -static WRITE8_HANDLER( firetrk_drone_reset_w ) +static WRITE8_HANDLER( montecar_drone_reset_w ) { firetrk_crash[1] = 0; firetrk_skid[1] = 0; } -static WRITE8_HANDLER( firetrk_steer_reset_w ) +static WRITE8_HANDLER( steer_reset_w ) { - steer_flag[0] = 0; - steer_flag[1] = 0; + steer_flag[0] = 1; + steer_flag[1] = 1; } -static WRITE8_HANDLER( firetrk_crash_reset_w ) +static WRITE8_HANDLER( crash_reset_w ) { firetrk_crash[0] = 0; firetrk_crash[1] = 0; } -static WRITE8_HANDLER( firetrk_out_w ) -{ - if (GAME_IS_FIRETRUCK || GAME_IS_MONTECARLO) - { - write_output(data); - } - if (GAME_IS_SUPERBUG) - { - write_output(offset); - } -} - - - static ADDRESS_MAP_START( firetrk_map, ADDRESS_SPACE_PROGRAM, 8 ) ADDRESS_MAP_FLAGS( AMEF_ABITS(14) ) - AM_RANGE(0x0000, 0x00ff) AM_MIRROR(0x700) AM_RAM AM_BASE(&firetrk_alpha_num_ram) - AM_RANGE(0x0800, 0x08ff) AM_MIRROR(0x700) AM_READWRITE(MRA8_RAM, firetrk_playfield_w) AM_BASE(&firetrk_playfield_ram) - AM_RANGE(0x1000, 0x1000) AM_MIRROR(0x1f) AM_WRITE(firetrk_vert_w) - AM_RANGE(0x1020, 0x1020) AM_MIRROR(0x1f) AM_WRITE(firetrk_horz_w) - AM_RANGE(0x1040, 0x1040) AM_MIRROR(0x1f) AM_WRITE(firetrk_crash_reset_w) - AM_RANGE(0x1060, 0x1060) AM_MIRROR(0x1f) AM_WRITE(firetrk_skid_reset_w) - AM_RANGE(0x1080, 0x1080) AM_MIRROR(0x1f) AM_WRITE(firetrk_car_rot_w) - AM_RANGE(0x10a0, 0x10a0) AM_MIRROR(0x1f) AM_WRITE(firetrk_steer_reset_w) - AM_RANGE(0x10c0, 0x10c0) AM_MIRROR(0x1f) AM_WRITE(watchdog_reset_w) - AM_RANGE(0x10e0, 0x10e0) AM_MIRROR(0x1f) AM_WRITE(firetrk_arrow_off_w) - AM_RANGE(0x1400, 0x1400) AM_MIRROR(0x1f) AM_WRITE(firetrk_motor_snd_w) - AM_RANGE(0x1420, 0x1420) AM_MIRROR(0x1f) AM_WRITE(firetrk_crash_snd_w) - AM_RANGE(0x1440, 0x1440) AM_MIRROR(0x1f) AM_WRITE(firetrk_skid_snd_w) - AM_RANGE(0x1460, 0x1460) AM_MIRROR(0x1f) AM_WRITE(firetrk_drone_hpos_w) - AM_RANGE(0x1480, 0x1480) AM_MIRROR(0x1f) AM_WRITE(firetrk_drone_vpos_w) - AM_RANGE(0x14a0, 0x14a0) AM_MIRROR(0x1f) AM_WRITE(firetrk_drone_rot_w) - AM_RANGE(0x14c0, 0x14c0) AM_MIRROR(0x1f) AM_WRITE(firetrk_out_w) - AM_RANGE(0x14e0, 0x14e0) AM_MIRROR(0x1f) AM_WRITE(firetrk_xtndply_w) - AM_RANGE(0x1800, 0x1807) AM_MIRROR(0x3f8) AM_READWRITE(firetrk_input_r, MWA8_NOP) - AM_RANGE(0x1c00, 0x1c03) AM_MIRROR(0x3fc) AM_READ(firetrk_dip_r) + AM_RANGE(0x0000, 0x00ff) AM_MIRROR(0x0700) AM_RAM AM_BASE(&firetrk_alpha_num_ram) + AM_RANGE(0x0800, 0x08ff) AM_MIRROR(0x0700) AM_RAM AM_BASE(&firetrk_playfield_ram) + AM_RANGE(0x1000, 0x1000) AM_MIRROR(0x001f) AM_WRITE(MWA8_RAM) AM_BASE(&firetrk_scroll_y) + AM_RANGE(0x1020, 0x1020) AM_MIRROR(0x001f) AM_WRITE(MWA8_RAM) AM_BASE(&firetrk_scroll_x) + AM_RANGE(0x1040, 0x1040) AM_MIRROR(0x001f) AM_WRITE(crash_reset_w) + AM_RANGE(0x1060, 0x1060) AM_MIRROR(0x001f) AM_WRITE(firetrk_skid_reset_w) + AM_RANGE(0x1080, 0x1080) AM_MIRROR(0x001f) AM_WRITE(MWA8_RAM) AM_BASE(&firetrk_car_rot) + AM_RANGE(0x10a0, 0x10a0) AM_MIRROR(0x001f) AM_WRITE(steer_reset_w) + AM_RANGE(0x10c0, 0x10c0) AM_MIRROR(0x001f) AM_WRITE(watchdog_reset_w) + AM_RANGE(0x10e0, 0x10e0) AM_MIRROR(0x001f) AM_WRITE(blink_on_w) AM_BASE(&firetrk_blink) + AM_RANGE(0x1400, 0x1400) AM_MIRROR(0x001f) AM_WRITE(firetrk_motor_snd_w) + AM_RANGE(0x1420, 0x1420) AM_MIRROR(0x001f) AM_WRITE(firetrk_crash_snd_w) + AM_RANGE(0x1440, 0x1440) AM_MIRROR(0x001f) AM_WRITE(firetrk_skid_snd_w) + AM_RANGE(0x1460, 0x1460) AM_MIRROR(0x001f) AM_WRITE(MWA8_RAM) AM_BASE(&firetrk_drone_x) + AM_RANGE(0x1480, 0x1480) AM_MIRROR(0x001f) AM_WRITE(MWA8_RAM) AM_BASE(&firetrk_drone_y) + AM_RANGE(0x14a0, 0x14a0) AM_MIRROR(0x001f) AM_WRITE(MWA8_RAM) AM_BASE(&firetrk_drone_rot) + AM_RANGE(0x14c0, 0x14c0) AM_MIRROR(0x001f) AM_WRITE(firetrk_output_w) + AM_RANGE(0x14e0, 0x14e0) AM_MIRROR(0x001f) AM_WRITE(firetrk_xtndply_w) + AM_RANGE(0x1800, 0x1807) AM_MIRROR(0x03f8) AM_READWRITE(firetrk_input_r, MWA8_NOP) + AM_RANGE(0x1c00, 0x1c03) AM_MIRROR(0x03fc) AM_READ(firetrk_dip_r) AM_RANGE(0x2000, 0x3fff) AM_ROM ADDRESS_MAP_END @@ -508,63 +342,63 @@ ADDRESS_MAP_END static ADDRESS_MAP_START( superbug_map, ADDRESS_SPACE_PROGRAM, 8 ) ADDRESS_MAP_FLAGS( AMEF_ABITS(13) ) AM_RANGE(0x0000, 0x00ff) AM_RAM - AM_RANGE(0x0100, 0x0100) AM_MIRROR(0x1f) AM_WRITE(firetrk_vert_w) - AM_RANGE(0x0120, 0x0120) AM_MIRROR(0x1f) AM_WRITE(firetrk_horz_w) - AM_RANGE(0x0140, 0x0140) AM_MIRROR(0x1f) AM_WRITE(firetrk_crash_reset_w) - AM_RANGE(0x0160, 0x0160) AM_MIRROR(0x1f) AM_WRITE(firetrk_skid_reset_w) - AM_RANGE(0x0180, 0x0180) AM_MIRROR(0x1f) AM_WRITE(firetrk_car_rot_w) - AM_RANGE(0x01a0, 0x01a0) AM_MIRROR(0x1f) AM_WRITE(firetrk_steer_reset_w) - AM_RANGE(0x01c0, 0x01c0) AM_MIRROR(0x1f) AM_WRITE(watchdog_reset_w) - AM_RANGE(0x01e0, 0x01e0) AM_MIRROR(0x1f) AM_WRITE(firetrk_arrow_off_w) - AM_RANGE(0x0200, 0x0207) AM_MIRROR(0x18) AM_READ(firetrk_input_r) - AM_RANGE(0x0220, 0x0220) AM_MIRROR(0x1f) AM_WRITE(firetrk_asr_w) - AM_RANGE(0x0240, 0x0243) AM_MIRROR(0x1c) AM_READ(firetrk_dip_r) - AM_RANGE(0x0260, 0x026f) AM_MIRROR(0x10) AM_WRITE(firetrk_out_w) - AM_RANGE(0x0280, 0x0280) AM_MIRROR(0x1f) AM_WRITE(firetrk_motor_snd_w) - AM_RANGE(0x02a0, 0x02a0) AM_MIRROR(0x1f) AM_WRITE(firetrk_crash_snd_w) - AM_RANGE(0x02c0, 0x02c0) AM_MIRROR(0x1f) AM_WRITE(firetrk_skid_snd_w) + AM_RANGE(0x0100, 0x0100) AM_MIRROR(0x001f) AM_WRITE(MWA8_RAM) AM_BASE(&firetrk_scroll_y) + AM_RANGE(0x0120, 0x0120) AM_MIRROR(0x001f) AM_WRITE(MWA8_RAM) AM_BASE(&firetrk_scroll_x) + AM_RANGE(0x0140, 0x0140) AM_MIRROR(0x001f) AM_WRITE(crash_reset_w) + AM_RANGE(0x0160, 0x0160) AM_MIRROR(0x001f) AM_WRITE(firetrk_skid_reset_w) + AM_RANGE(0x0180, 0x0180) AM_MIRROR(0x001f) AM_WRITE(MWA8_RAM) AM_BASE(&firetrk_car_rot) + AM_RANGE(0x01a0, 0x01a0) AM_MIRROR(0x001f) AM_WRITE(steer_reset_w) + AM_RANGE(0x01c0, 0x01c0) AM_MIRROR(0x001f) AM_WRITE(watchdog_reset_w) + AM_RANGE(0x01e0, 0x01e0) AM_MIRROR(0x001f) AM_WRITE(blink_on_w) AM_BASE(&firetrk_blink) + AM_RANGE(0x0200, 0x0207) AM_MIRROR(0x0018) AM_READ(firetrk_input_r) + AM_RANGE(0x0220, 0x0220) AM_MIRROR(0x001f) AM_WRITE(superbug_asr_w) + AM_RANGE(0x0240, 0x0243) AM_MIRROR(0x001c) AM_READ(firetrk_dip_r) + AM_RANGE(0x0260, 0x026f) AM_MIRROR(0x0010) AM_WRITE(superbug_output_w) + AM_RANGE(0x0280, 0x0280) AM_MIRROR(0x001f) AM_WRITE(superbug_motor_snd_w) + AM_RANGE(0x02a0, 0x02a0) AM_MIRROR(0x001f) AM_WRITE(firetrk_crash_snd_w) + AM_RANGE(0x02c0, 0x02c0) AM_MIRROR(0x001f) AM_WRITE(firetrk_skid_snd_w) AM_RANGE(0x0400, 0x041f) AM_RAM AM_BASE(&firetrk_alpha_num_ram) - AM_RANGE(0x0500, 0x05ff) AM_READWRITE(MRA8_RAM, firetrk_playfield_w) AM_BASE(&firetrk_playfield_ram) + AM_RANGE(0x0500, 0x05ff) AM_RAM AM_BASE(&firetrk_playfield_ram) AM_RANGE(0x0800, 0x1fff) AM_ROM ADDRESS_MAP_END static ADDRESS_MAP_START( montecar_map, ADDRESS_SPACE_PROGRAM, 8 ) ADDRESS_MAP_FLAGS( AMEF_ABITS(14) ) - AM_RANGE(0x0000, 0x00ff) AM_MIRROR(0x700) AM_RAM AM_BASE(&firetrk_alpha_num_ram) - AM_RANGE(0x0800, 0x08ff) AM_MIRROR(0x700) AM_READWRITE(MRA8_RAM, firetrk_playfield_w) AM_BASE(&firetrk_playfield_ram) - AM_RANGE(0x1000, 0x1000) AM_MIRROR(0x1f) AM_WRITE(firetrk_vert_w) - AM_RANGE(0x1020, 0x1020) AM_MIRROR(0x1f) AM_WRITE(firetrk_horz_w) - AM_RANGE(0x1040, 0x1040) AM_MIRROR(0x1f) AM_WRITE(firetrk_drone_reset_w) - AM_RANGE(0x1060, 0x1060) AM_MIRROR(0x1f) AM_WRITE(firetrk_car_reset_w) - AM_RANGE(0x1080, 0x1080) AM_MIRROR(0x1f) AM_WRITE(firetrk_car_rot_w) - AM_RANGE(0x10a0, 0x10a0) AM_MIRROR(0x1f) AM_WRITE(firetrk_steer_reset_w) - AM_RANGE(0x10c0, 0x10c0) AM_MIRROR(0x1f) AM_WRITE(watchdog_reset_w) - AM_RANGE(0x10e0, 0x10e0) AM_MIRROR(0x1f) AM_WRITE(firetrk_skid_reset_w) - AM_RANGE(0x1400, 0x1400) AM_MIRROR(0x1f) AM_WRITE(firetrk_motor_snd_w) - AM_RANGE(0x1420, 0x1420) AM_MIRROR(0x1f) AM_WRITE(firetrk_crash_snd_w) - AM_RANGE(0x1440, 0x1440) AM_MIRROR(0x1f) AM_WRITE(firetrk_skid_snd_w) - AM_RANGE(0x1460, 0x1460) AM_MIRROR(0x1f) AM_WRITE(firetrk_drone_hpos_w) - AM_RANGE(0x1480, 0x1480) AM_MIRROR(0x1f) AM_WRITE(firetrk_drone_vpos_w) - AM_RANGE(0x14a0, 0x14a0) AM_MIRROR(0x1f) AM_WRITE(firetrk_drone_rot_w) - AM_RANGE(0x14c0, 0x14c0) AM_MIRROR(0x1f) AM_WRITE(firetrk_out_w) - AM_RANGE(0x14e0, 0x14e0) AM_MIRROR(0x1f) AM_WRITE(firetrk_out2_w) - AM_RANGE(0x1800, 0x1807) AM_MIRROR(0x3f8) AM_READWRITE(firetrk_input_r, MWA8_NOP) - AM_RANGE(0x1c00, 0x1c03) AM_MIRROR(0x3fc) AM_READ(firetrk_dip_r) + AM_RANGE(0x0000, 0x00ff) AM_MIRROR(0x0700) AM_RAM AM_BASE(&firetrk_alpha_num_ram) + AM_RANGE(0x0800, 0x08ff) AM_MIRROR(0x0700) AM_RAM AM_BASE(&firetrk_playfield_ram) + AM_RANGE(0x1000, 0x1000) AM_MIRROR(0x001f) AM_WRITE(MWA8_RAM) AM_BASE(&firetrk_scroll_y) + AM_RANGE(0x1020, 0x1020) AM_MIRROR(0x001f) AM_WRITE(MWA8_RAM) AM_BASE(&firetrk_scroll_x) + AM_RANGE(0x1040, 0x1040) AM_MIRROR(0x001f) AM_WRITE(montecar_drone_reset_w) + AM_RANGE(0x1060, 0x1060) AM_MIRROR(0x001f) AM_WRITE(montecar_car_reset_w) + AM_RANGE(0x1080, 0x1080) AM_MIRROR(0x001f) AM_WRITE(MWA8_RAM) AM_BASE(&firetrk_car_rot) + AM_RANGE(0x10a0, 0x10a0) AM_MIRROR(0x001f) AM_WRITE(steer_reset_w) + AM_RANGE(0x10c0, 0x10c0) AM_MIRROR(0x001f) AM_WRITE(watchdog_reset_w) + AM_RANGE(0x10e0, 0x10e0) AM_MIRROR(0x001f) AM_WRITE(montecar_skid_reset_w) + AM_RANGE(0x1400, 0x1400) AM_MIRROR(0x001f) AM_WRITE(firetrk_motor_snd_w) + AM_RANGE(0x1420, 0x1420) AM_MIRROR(0x001f) AM_WRITE(firetrk_crash_snd_w) + AM_RANGE(0x1440, 0x1440) AM_MIRROR(0x001f) AM_WRITE(firetrk_skid_snd_w) + AM_RANGE(0x1460, 0x1460) AM_MIRROR(0x001f) AM_WRITE(MWA8_RAM) AM_BASE(&firetrk_drone_x) + AM_RANGE(0x1480, 0x1480) AM_MIRROR(0x001f) AM_WRITE(MWA8_RAM) AM_BASE(&firetrk_drone_y) + AM_RANGE(0x14a0, 0x14a0) AM_MIRROR(0x001f) AM_WRITE(MWA8_RAM) AM_BASE(&firetrk_drone_rot) + AM_RANGE(0x14c0, 0x14c0) AM_MIRROR(0x001f) AM_WRITE(montecar_output_1_w) + AM_RANGE(0x14e0, 0x14e0) AM_MIRROR(0x001f) AM_WRITE(montecar_output_2_w) + AM_RANGE(0x1800, 0x1807) AM_MIRROR(0x03f8) AM_READWRITE(montecar_input_r, MWA8_NOP) + AM_RANGE(0x1c00, 0x1c03) AM_MIRROR(0x03fc) AM_READ(montecar_dip_r) AM_RANGE(0x2000, 0x3fff) AM_ROM ADDRESS_MAP_END static INPUT_PORTS_START( firetrk ) - PORT_START + PORT_START_TAG("STEER_1") PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_PLAYER(1) - PORT_START + PORT_START_TAG("STEER_2") PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_PLAYER(2) - PORT_START - PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_UNUSED) /* other DIPs connect here */ - PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_UNUSED) /* other DIPs connect here */ + PORT_START_TAG("DIP_0") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) /* other DIPs connect here */ + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) /* other DIPs connect here */ PORT_DIPNAME( 0x0c, 0x08, DEF_STR( Coinage )) PORT_DIPSETTING( 0x0c, DEF_STR( 2C_1C )) PORT_DIPSETTING( 0x08, DEF_STR( 1C_1C )) @@ -577,7 +411,7 @@ static INPUT_PORTS_START( firetrk ) PORT_DIPSETTING( 0x20, DEF_STR( Off )) PORT_DIPSETTING( 0x00, DEF_STR( On )) - PORT_START + PORT_START_TAG("DIP_1") PORT_DIPNAME( 0x03, 0x00, DEF_STR( Language ) ) PORT_DIPSETTING( 0x00, DEF_STR( English ) ) PORT_DIPSETTING( 0x01, DEF_STR( French ) ) @@ -594,40 +428,42 @@ static INPUT_PORTS_START( firetrk ) PORT_DIPSETTING( 0x30, "Conservative" ) PORT_DIPSETTING( 0x00, "Never" ) - PORT_START /* bit 0 */ - PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Gas") PORT_PLAYER(1) - PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_UNUSED) /* STEER DIR 1 */ - PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_UNUSED) /* STEER DIR 2 */ - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Bell") PORT_PLAYER(2) - PORT_BIT (0x20, IP_ACTIVE_HIGH, IPT_TILT) - PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_UNUSED) /* SKID */ - PORT_SERVICE(0x80, IP_ACTIVE_HIGH) + PORT_START_TAG("BIT_0") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Gas") PORT_PLAYER(1) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(steer_dir_r, (void *)0) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(steer_dir_r, (void *)1) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Bell") PORT_PLAYER(2) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_TILT ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(skid_r, (void *)2) + PORT_DIPNAME( 0x80, 0x00, DEF_STR( Service_Mode ) ) PORT_CODE(KEYCODE_F2) PORT_TOGGLE PORT_CHANGED(service_mode_switch_changed, 0) + PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) + PORT_DIPSETTING( 0x80, DEF_STR( On ) ) - PORT_START /* bit 6 */ - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_START1 ) PORT_NAME("Front Player Start") - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_START2 ) PORT_NAME("Back Player Start") - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_START3 ) PORT_NAME("Both Players Start") - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Track Select") PORT_CODE(KEYCODE_SPACE) PORT_PLAYER(1) - PORT_BIT (0x10, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT (0x20, IP_ACTIVE_LOW, IPT_VBLANK) + PORT_START_TAG("BIT_6") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 ) PORT_NAME("Front Player Start") + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 ) PORT_NAME("Back Player Start") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START3 ) PORT_NAME("Both Players Start") + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Track Select") PORT_CODE(KEYCODE_SPACE) PORT_PLAYER(1) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_VBLANK ) PORT_DIPNAME( 0x40, 0x40, DEF_STR( Cabinet )) PORT_DIPSETTING( 0x00, "Smokey Joe (1 Player)" ) PORT_DIPSETTING( 0x40, "Fire Truck (2 Players)" ) - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_SERVICE ) PORT_NAME("Diag Hold") PORT_CODE(KEYCODE_F6) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SERVICE ) PORT_NAME("Diag Hold") PORT_CODE(KEYCODE_F6) - PORT_START /* bit 7 */ - PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_UNUSED) /* STEER FLAG 1 */ - PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_UNUSED) /* STEER FLAG 2 */ - PORT_BIT (0x10, IP_ACTIVE_HIGH, IPT_COIN1) - PORT_BIT (0x20, IP_ACTIVE_HIGH, IPT_COIN2) - PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_UNUSED) /* CRASH */ - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_SERVICE ) PORT_NAME("Diag Step") PORT_CODE(KEYCODE_F1) + PORT_START_TAG("BIT_7") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(steer_flag_r, (void *)0) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(steer_flag_r, (void *)1) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_COIN1 ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_COIN2 ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(crash_r, (void *)2) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SERVICE ) PORT_NAME("Diag Step") PORT_CODE(KEYCODE_F1) - PORT_START - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Horn") PORT_PLAYER(1) + PORT_START_TAG("HORN") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Horn") PORT_PLAYER(1) PORT_CHANGED(firetrk_horn_changed, 0) PORT_START_TAG("R27") PORT_ADJUSTER( 20, "R27 - Motor Frequency" ) @@ -635,17 +471,14 @@ INPUT_PORTS_END static INPUT_PORTS_START( superbug ) - PORT_START + PORT_START_TAG("STEER_1") PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) - PORT_START - PORT_BIT (0xff, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_START_TAG("DIP_0") + PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) /* other DIPs connect here */ + PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) /* other DIPs connect here */ - PORT_START - PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_UNUSED) /* other DIPs connect here */ - PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_UNUSED) /* other DIPs connect here */ - - PORT_START + PORT_START_TAG("DIP_1") PORT_DIPNAME( 0x03, 0x02, DEF_STR( Coinage )) PORT_DIPSETTING( 0x03, DEF_STR( 2C_1C )) PORT_DIPSETTING( 0x02, DEF_STR( 1C_1C )) @@ -667,34 +500,31 @@ static INPUT_PORTS_START( superbug ) PORT_DIPSETTING( 0x80, DEF_STR( Spanish ) ) PORT_DIPSETTING( 0xc0, DEF_STR( German ) ) - PORT_START /* bit 0 */ - PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_UNUSED) /* GEAR 2 */ - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Gas") - PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_UNUSED) /* STEER DIR */ - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_NAME("Hiscore Reset") PORT_CODE(KEYCODE_H) - PORT_BIT (0x10, IP_ACTIVE_HIGH, IPT_UNUSED) - PORT_SERVICE( 0x20, IP_ACTIVE_HIGH) - PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_UNUSED) /* SKID */ - PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_TILT) + PORT_START_TAG("BIT_0") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(gear_r, (void *)1) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Gas") + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(steer_dir_r, (void *)0) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON7 ) PORT_NAME("Hiscore Reset") PORT_CODE(KEYCODE_H) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNUSED ) + PORT_SERVICE( 0x20, IP_ACTIVE_HIGH ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(skid_r, (void *)0) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_TILT ) - PORT_START /* bit 6 */ - PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_START_TAG("BIT_7") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(gear_r, (void *)2) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(gear_r, (void *)0) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(steer_flag_r, (void *)0) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_COIN1 ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_COIN2 ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_START1 ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(crash_r, (void *)0) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("Track Select") PORT_CODE(KEYCODE_SPACE) - PORT_START /* bit 7 */ - PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_UNUSED) /* GEAR 3 */ - PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_UNUSED) /* GEAR 1 */ - PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_UNUSED) /* STEER FLAG */ - PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_COIN1) - PORT_BIT (0x10, IP_ACTIVE_HIGH, IPT_COIN2) - PORT_BIT (0x20, IP_ACTIVE_HIGH, IPT_START1) - PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_UNUSED) /* CRASH */ - PORT_BIT(0x80, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("Track Select") PORT_CODE(KEYCODE_SPACE) - - PORT_START - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Gear 1") PORT_CODE(KEYCODE_Z) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Gear 2") PORT_CODE(KEYCODE_X) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Gear 3") PORT_CODE(KEYCODE_C) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("Gear 4") PORT_CODE(KEYCODE_V) + PORT_START_TAG("GEAR") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Gear 1") PORT_CODE(KEYCODE_Z) PORT_CHANGED(gear_changed, (void *)0) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Gear 2") PORT_CODE(KEYCODE_X) PORT_CHANGED(gear_changed, (void *)1) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Gear 3") PORT_CODE(KEYCODE_C) PORT_CHANGED(gear_changed, (void *)2) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("Gear 4") PORT_CODE(KEYCODE_V) PORT_CHANGED(gear_changed, (void *)3) PORT_START_TAG("R62") PORT_ADJUSTER( 20, "R62 - Motor Frequency" ) @@ -702,15 +532,12 @@ INPUT_PORTS_END static INPUT_PORTS_START( montecar ) - PORT_START + PORT_START_TAG("STEER_1") PORT_BIT( 0xff, 0x00, IPT_DIAL ) PORT_SENSITIVITY(25) PORT_KEYDELTA(10) PORT_PLAYER(1) - PORT_START - PORT_BIT (0xff, IP_ACTIVE_HIGH, IPT_UNUSED) - - PORT_START - PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_UNUSED) /* other DIPs connect here */ - PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_UNUSED) /* other DIPs connect here */ + PORT_START_TAG("DIP_0") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_UNUSED ) /* other DIPs connect here */ + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_UNUSED ) /* other DIPs connect here */ PORT_DIPNAME( 0x0c, 0x0c, "Coin 3 Multiplier" ) PORT_DIPSETTING( 0x0c, "1" ) PORT_DIPSETTING( 0x08, "4" ) @@ -723,7 +550,7 @@ static INPUT_PORTS_START( montecar ) PORT_DIPSETTING( 0x20, DEF_STR( Off )) PORT_DIPSETTING( 0x00, DEF_STR( On )) - PORT_START + PORT_START_TAG("DIP_1") PORT_DIPNAME( 0x03, 0x02, DEF_STR( Coinage )) PORT_DIPSETTING( 0x00, DEF_STR( 2C_1C )) PORT_DIPSETTING( 0x02, DEF_STR( 1C_1C )) @@ -745,34 +572,31 @@ static INPUT_PORTS_START( montecar ) PORT_DIPSETTING( 0x40, DEF_STR( French ) ) PORT_DIPSETTING( 0x00, DEF_STR( German ) ) - PORT_START /* bit 0 */ - PORT_BIT(0xff, IP_ACTIVE_HIGH, IPT_UNUSED) + PORT_START_TAG("BIT_6") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(gear_r, (void *)0) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(gear_r, (void *)1) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(gear_r, (void *)2) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("Track Select") PORT_CODE(KEYCODE_SPACE) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Gas") + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_VBLANK ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(steer_dir_r, (void *)0) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(skid_r, (void *)1) - PORT_START /* bit 6 */ - PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_UNUSED) /* GEAR 1 */ - PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_UNUSED) /* GEAR 2 */ - PORT_BIT (0x04, IP_ACTIVE_HIGH, IPT_UNUSED) /* GEAR 3 */ - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_BUTTON6 ) PORT_NAME("Track Select") PORT_CODE(KEYCODE_SPACE) - PORT_BIT(0x10, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Gas") - PORT_BIT (0x20, IP_ACTIVE_HIGH, IPT_VBLANK) - PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_UNUSED) /* STEER DIR */ - PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_UNUSED) /* SKID 1 */ + PORT_START_TAG("BIT_7") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 ) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_TILT ) + PORT_SERVICE( 0x04, IP_ACTIVE_HIGH ) PORT_CHANGED(service_mode_switch_changed, 0) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_COIN1 ) + PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_COIN2 ) + PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_SPECIAL ) + PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(steer_flag_r, (void *)0) + PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(skid_r, (void *)0) - PORT_START /* bit 7 */ - PORT_BIT (0x01, IP_ACTIVE_HIGH, IPT_START1) - PORT_BIT (0x02, IP_ACTIVE_HIGH, IPT_TILT) - PORT_SERVICE(0x04, IP_ACTIVE_HIGH) - PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_COIN1) - PORT_BIT (0x10, IP_ACTIVE_HIGH, IPT_COIN2) - PORT_BIT (0x20, IP_ACTIVE_HIGH, IPT_COIN3) - PORT_BIT (0x40, IP_ACTIVE_HIGH, IPT_UNUSED) /* STEER FLAG */ - PORT_BIT (0x80, IP_ACTIVE_HIGH, IPT_UNUSED) /* SKID 0 */ - - PORT_START - PORT_BIT(0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Gear 1") PORT_CODE(KEYCODE_Z) - PORT_BIT(0x02, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Gear 2") PORT_CODE(KEYCODE_X) - PORT_BIT(0x04, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Gear 3") PORT_CODE(KEYCODE_C) - PORT_BIT(0x08, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("Gear 4") PORT_CODE(KEYCODE_V) + PORT_START_TAG("GEAR") + PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Gear 1") PORT_CODE(KEYCODE_Z) PORT_CHANGED(gear_changed, (void *)0) + PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Gear 2") PORT_CODE(KEYCODE_X) PORT_CHANGED(gear_changed, (void *)1) + PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON4 ) PORT_NAME("Gear 3") PORT_CODE(KEYCODE_C) PORT_CHANGED(gear_changed, (void *)2) + PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_BUTTON5 ) PORT_NAME("Gear 4") PORT_CODE(KEYCODE_V) PORT_CHANGED(gear_changed, (void *)3) PORT_START_TAG("R89") PORT_ADJUSTER( 20, "R89 - Motor Frequency" ) @@ -789,12 +613,12 @@ static const gfx_layout firetrk_text_layout = 1, /* planes */ { 0 }, /* plane offsets */ { - 0x1C, 0x1D, 0x1E, 0x1F, 0x04, 0x05, 0x06, 0x07, - 0x0C, 0x0D, 0x0E, 0x0F, 0x14, 0x15, 0x16, 0x17 + 0x1c, 0x1d, 0x1e, 0x1f, 0x04, 0x05, 0x06, 0x07, + 0x0c, 0x0d, 0x0e, 0x0f, 0x14, 0x15, 0x16, 0x17 }, { - 0x000, 0x020, 0x040, 0x060, 0x080, 0x0A0, 0x0C0, 0x0E0, - 0x100, 0x120, 0x140, 0x160, 0x180, 0x1A0, 0x1C0, 0x1E0 + 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0, + 0x100, 0x120, 0x140, 0x160, 0x180, 0x1a0, 0x1c0, 0x1e0 }, 0x200 }; @@ -807,12 +631,12 @@ static const gfx_layout superbug_text_layout = 1, /* planes */ { 0 }, /* plane offsets */ { - 0x0C, 0x0D, 0x0E, 0x0F, 0x14, 0x15, 0x16, 0x17, - 0x1C, 0x1D, 0x1E, 0x1F, 0x04, 0x05, 0x06, 0x07 + 0x0c, 0x0d, 0x0e, 0x0f, 0x14, 0x15, 0x16, 0x17, + 0x1c, 0x1d, 0x1e, 0x1f, 0x04, 0x05, 0x06, 0x07 }, { - 0x000, 0x020, 0x040, 0x060, 0x080, 0x0A0, 0x0C0, 0x0E0, - 0x100, 0x120, 0x140, 0x160, 0x180, 0x1A0, 0x1C0, 0x1E0 + 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0, + 0x100, 0x120, 0x140, 0x160, 0x180, 0x1a0, 0x1c0, 0x1e0 }, 0x200 }; @@ -825,7 +649,7 @@ static const gfx_layout montecar_text_layout = 1, /* planes */ { 0 }, /* plane offsets */ { - 0xC, 0xD, 0xE, 0xF, 0x4, 0x5, 0x6, 0x7 + 0xc, 0xd, 0xe, 0xf, 0x4, 0x5, 0x6, 0x7 }, { 0x00, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70 @@ -842,11 +666,11 @@ static const gfx_layout firetrk_tile_layout = { 0 }, /* plane offsets */ { 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, - 0x8, 0x9, 0xA, 0xB, 0xC, 0xD, 0xE, 0xF + 0x8, 0x9, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf }, { 0x00, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, - 0x80, 0x90, 0xA0, 0xB0, 0xC0, 0xD0, 0xE0, 0xF0 + 0x80, 0x90, 0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0 }, 0x100 }; @@ -859,12 +683,12 @@ static const gfx_layout superbug_tile_layout = 1, /* planes */ { 0 }, /* plane offsets */ { - 0x07, 0x06, 0x05, 0x04, 0x0F, 0x0E, 0x0D, 0x0C, - 0x17, 0x16, 0x15, 0x14, 0x1F, 0x1E, 0x1D, 0x1C + 0x07, 0x06, 0x05, 0x04, 0x0f, 0x0e, 0x0d, 0x0c, + 0x17, 0x16, 0x15, 0x14, 0x1f, 0x1e, 0x1d, 0x1c }, { - 0x000, 0x020, 0x040, 0x060, 0x080, 0x0A0, 0x0C0, 0x0E0, - 0x100, 0x120, 0x140, 0x160, 0x180, 0x1A0, 0x1C0, 0x1E0 + 0x000, 0x020, 0x040, 0x060, 0x080, 0x0a0, 0x0c0, 0x0e0, + 0x100, 0x120, 0x140, 0x160, 0x180, 0x1a0, 0x1c0, 0x1e0 }, 0x200 }; @@ -877,16 +701,16 @@ static const gfx_layout firetrk_car_layout1 = 1, /* planes */ { 0 }, /* plane offsets */ { - 0x000, 0x040, 0x080, 0x0C0, 0x100, 0x140, 0x180, 0x1C0, - 0x200, 0x240, 0x280, 0x2C0, 0x300, 0x340, 0x380, 0x3C0, - 0x400, 0x440, 0x480, 0x4C0, 0x500, 0x540, 0x580, 0x5C0, - 0x600, 0x640, 0x680, 0x6C0, 0x700, 0x740, 0x780, 0x7C0 + 0x000, 0x040, 0x080, 0x0c0, 0x100, 0x140, 0x180, 0x1c0, + 0x200, 0x240, 0x280, 0x2c0, 0x300, 0x340, 0x380, 0x3c0, + 0x400, 0x440, 0x480, 0x4c0, 0x500, 0x540, 0x580, 0x5c0, + 0x600, 0x640, 0x680, 0x6c0, 0x700, 0x740, 0x780, 0x7c0 }, { - 0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, - 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F, - 0x24, 0x25, 0x26, 0x27, 0x2C, 0x2D, 0x2E, 0x2F, - 0x34, 0x35, 0x36, 0x37, 0x3C, 0x3D, 0x3E, 0x3B + 0x04, 0x05, 0x06, 0x07, 0x0c, 0x0d, 0x0e, 0x0f, + 0x14, 0x15, 0x16, 0x17, 0x1c, 0x1d, 0x1e, 0x1f, + 0x24, 0x25, 0x26, 0x27, 0x2c, 0x2d, 0x2e, 0x2f, + 0x34, 0x35, 0x36, 0x37, 0x3c, 0x3d, 0x3e, 0x3b }, 0x800 }; @@ -900,15 +724,15 @@ static const gfx_layout superbug_car_layout1 = { 0 }, /* plane offsets */ { 0x0000, 0x0100, 0x0200, 0x0300, 0x0400, 0x0500, 0x0600, 0x0700, - 0x0800, 0x0900, 0x0A00, 0x0B00, 0x0C00, 0x0D00, 0x0E00, 0x0F00, + 0x0800, 0x0900, 0x0a00, 0x0b00, 0x0c00, 0x0d00, 0x0e00, 0x0f00, 0x1000, 0x1100, 0x1200, 0x1300, 0x1400, 0x1500, 0x1600, 0x1700, - 0x1800, 0x1900, 0x1A00, 0x1B00, 0x1C00, 0x1D00, 0x1E00, 0x1F00 + 0x1800, 0x1900, 0x1a00, 0x1b00, 0x1c00, 0x1d00, 0x1e00, 0x1f00 }, { - 0x04, 0x0C, 0x14, 0x1C, 0x24, 0x2C, 0x34, 0x3C, - 0x44, 0x4C, 0x54, 0x5C, 0x64, 0x6C, 0x74, 0x7C, - 0x84, 0x8C, 0x94, 0x9C, 0xA4, 0xAC, 0xB4, 0xBC, - 0xC4, 0xCC, 0xD4, 0xDC, 0xE4, 0xEC, 0xF4, 0xFC + 0x04, 0x0c, 0x14, 0x1c, 0x24, 0x2c, 0x34, 0x3c, + 0x44, 0x4c, 0x54, 0x5c, 0x64, 0x6c, 0x74, 0x7c, + 0x84, 0x8c, 0x94, 0x9c, 0xa4, 0xac, 0xb4, 0xbc, + 0xc4, 0xcc, 0xd4, 0xdc, 0xe4, 0xec, 0xf4, 0xfc }, 0x001 }; @@ -922,16 +746,16 @@ static const gfx_layout montecar_car_layout = /* plane offsets */ { 1, 0 }, { - 0x00, 0x02, 0x04, 0x06, 0x08, 0x0A, 0x0C, 0x0E, - 0x10, 0x12, 0x14, 0x16, 0x18, 0x1A, 0x1C, 0x1E, - 0x20, 0x22, 0x24, 0x26, 0x28, 0x2A, 0x2C, 0x2E, - 0x30, 0x32, 0x34, 0x36, 0x38, 0x3A, 0x3C, 0x3E + 0x00, 0x02, 0x04, 0x06, 0x08, 0x0a, 0x0c, 0x0e, + 0x10, 0x12, 0x14, 0x16, 0x18, 0x1a, 0x1c, 0x1e, + 0x20, 0x22, 0x24, 0x26, 0x28, 0x2a, 0x2c, 0x2e, + 0x30, 0x32, 0x34, 0x36, 0x38, 0x3a, 0x3c, 0x3e }, { - 0x000, 0x040, 0x080, 0x0C0, 0x100, 0x140, 0x180, 0x1C0, - 0x200, 0x240, 0x280, 0x2C0, 0x300, 0x340, 0x380, 0x3C0, - 0x400, 0x440, 0x480, 0x4C0, 0x500, 0x540, 0x580, 0x5C0, - 0x600, 0x640, 0x680, 0x6C0, 0x700, 0x740, 0x780, 0x7C0 + 0x000, 0x040, 0x080, 0x0c0, 0x100, 0x140, 0x180, 0x1c0, + 0x200, 0x240, 0x280, 0x2c0, 0x300, 0x340, 0x380, 0x3c0, + 0x400, 0x440, 0x480, 0x4c0, 0x500, 0x540, 0x580, 0x5c0, + 0x600, 0x640, 0x680, 0x6c0, 0x700, 0x740, 0x780, 0x7c0 }, 0x800 }; @@ -944,16 +768,16 @@ static const gfx_layout firetrk_car_layout2 = 1, /* planes */ { 0 }, /* plane offsets */ { - 0x04, 0x05, 0x06, 0x07, 0x0C, 0x0D, 0x0E, 0x0F, - 0x14, 0x15, 0x16, 0x17, 0x1C, 0x1D, 0x1E, 0x1F, - 0x24, 0x25, 0x26, 0x27, 0x2C, 0x2D, 0x2E, 0x2F, - 0x34, 0x35, 0x36, 0x37, 0x3C, 0x3D, 0x3E, 0x3B + 0x04, 0x05, 0x06, 0x07, 0x0c, 0x0d, 0x0e, 0x0f, + 0x14, 0x15, 0x16, 0x17, 0x1c, 0x1d, 0x1e, 0x1f, + 0x24, 0x25, 0x26, 0x27, 0x2c, 0x2d, 0x2e, 0x2f, + 0x34, 0x35, 0x36, 0x37, 0x3c, 0x3d, 0x3e, 0x3b }, { - 0x000, 0x040, 0x080, 0x0C0, 0x100, 0x140, 0x180, 0x1C0, - 0x200, 0x240, 0x280, 0x2C0, 0x300, 0x340, 0x380, 0x3C0, - 0x400, 0x440, 0x480, 0x4C0, 0x500, 0x540, 0x580, 0x5C0, - 0x600, 0x640, 0x680, 0x6C0, 0x700, 0x740, 0x780, 0x7C0 + 0x000, 0x040, 0x080, 0x0c0, 0x100, 0x140, 0x180, 0x1c0, + 0x200, 0x240, 0x280, 0x2c0, 0x300, 0x340, 0x380, 0x3c0, + 0x400, 0x440, 0x480, 0x4c0, 0x500, 0x540, 0x580, 0x5c0, + 0x600, 0x640, 0x680, 0x6c0, 0x700, 0x740, 0x780, 0x7c0 }, 0x800 }; @@ -966,16 +790,16 @@ static const gfx_layout superbug_car_layout2 = 1, /* planes */ { 0 }, /* plane offsets */ { - 0x04, 0x0C, 0x14, 0x1C, 0x24, 0x2C, 0x34, 0x3C, - 0x44, 0x4C, 0x54, 0x5C, 0x64, 0x6C, 0x74, 0x7C, - 0x84, 0x8C, 0x94, 0x9C, 0xA4, 0xAC, 0xB4, 0xBC, - 0xC4, 0xCC, 0xD4, 0xDC, 0xE4, 0xEC, 0xF4, 0xFC + 0x04, 0x0c, 0x14, 0x1c, 0x24, 0x2c, 0x34, 0x3c, + 0x44, 0x4c, 0x54, 0x5c, 0x64, 0x6c, 0x74, 0x7c, + 0x84, 0x8c, 0x94, 0x9c, 0xa4, 0xac, 0xb4, 0xbc, + 0xc4, 0xcc, 0xd4, 0xdc, 0xe4, 0xec, 0xf4, 0xfc }, { 0x0000, 0x0100, 0x0200, 0x0300, 0x0400, 0x0500, 0x0600, 0x0700, - 0x0800, 0x0900, 0x0A00, 0x0B00, 0x0C00, 0x0D00, 0x0E00, 0x0F00, + 0x0800, 0x0900, 0x0a00, 0x0b00, 0x0c00, 0x0d00, 0x0e00, 0x0f00, 0x1000, 0x1100, 0x1200, 0x1300, 0x1400, 0x1500, 0x1600, 0x1700, - 0x1800, 0x1900, 0x1A00, 0x1B00, 0x1C00, 0x1D00, 0x1E00, 0x1F00 + 0x1800, 0x1900, 0x1a00, 0x1b00, 0x1c00, 0x1d00, 0x1e00, 0x1f00 }, 0x001 }; @@ -983,25 +807,25 @@ static const gfx_layout superbug_car_layout2 = static const UINT32 firetrk_trailer_layout_xoffset[64] = { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, + 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F, + 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, - 0x28, 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, + 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, - 0x38, 0x39, 0x3A, 0x3B, 0x3C, 0x3D, 0x3E, 0x3F + 0x38, 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f }; static const UINT32 firetrk_trailer_layout_yoffset[64] = { - 0x000, 0x040, 0x080, 0x0C0, 0x100, 0x140, 0x180, 0x1C0, - 0x200, 0x240, 0x280, 0x2C0, 0x300, 0x340, 0x380, 0x3C0, - 0x400, 0x440, 0x480, 0x4C0, 0x500, 0x540, 0x580, 0x5C0, - 0x600, 0x640, 0x680, 0x6C0, 0x700, 0x740, 0x780, 0x7C0, - 0x800, 0x840, 0x880, 0x8C0, 0x900, 0x940, 0x980, 0x9C0, - 0xA00, 0xA40, 0xA80, 0xAC0, 0xB00, 0xB40, 0xB80, 0xBC0, - 0xC00, 0xC40, 0xC80, 0xCC0, 0xD00, 0xD40, 0xD80, 0xDC0, - 0xE00, 0xE40, 0xE80, 0xEC0, 0xF00, 0xF40, 0xF80, 0xFC0 + 0x000, 0x040, 0x080, 0x0c0, 0x100, 0x140, 0x180, 0x1c0, + 0x200, 0x240, 0x280, 0x2c0, 0x300, 0x340, 0x380, 0x3c0, + 0x400, 0x440, 0x480, 0x4c0, 0x500, 0x540, 0x580, 0x5c0, + 0x600, 0x640, 0x680, 0x6c0, 0x700, 0x740, 0x780, 0x7c0, + 0x800, 0x840, 0x880, 0x8c0, 0x900, 0x940, 0x980, 0x9c0, + 0xa00, 0xa40, 0xa80, 0xac0, 0xb00, 0xb40, 0xb80, 0xbc0, + 0xc00, 0xc40, 0xc80, 0xcc0, 0xd00, 0xd40, 0xd80, 0xdc0, + 0xe00, 0xe40, 0xe80, 0xec0, 0xf00, 0xf40, 0xf80, 0xfc0 }; static const gfx_layout firetrk_trailer_layout = @@ -1057,20 +881,19 @@ static MACHINE_DRIVER_START( firetrk ) MDRV_MACHINE_RESET(firetrk) /* video hardware */ + MDRV_VIDEO_ATTRIBUTES(VIDEO_ALWAYS_UPDATE) + MDRV_SCREEN_ADD("main", RASTER) MDRV_SCREEN_REFRESH_RATE(60) MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) MDRV_SCREEN_SIZE(320, 262) MDRV_SCREEN_VISIBLE_AREA(0, 319, 0, 239) - MDRV_GFXDECODE(firetrk) - + MDRV_VIDEO_START(firetrk) + MDRV_VIDEO_UPDATE(firetrk) MDRV_PALETTE_INIT(firetrk) MDRV_PALETTE_LENGTH(28) - - MDRV_VIDEO_START(firetrk) - MDRV_VIDEO_EOF(firetrk) - MDRV_VIDEO_UPDATE(firetrk) + MDRV_GFXDECODE(firetrk) /* sound hardware */ MDRV_SPEAKER_STANDARD_MONO("mono") @@ -1089,9 +912,9 @@ static MACHINE_DRIVER_START( superbug ) MDRV_CPU_PROGRAM_MAP(superbug_map, 0) /* video hardware */ + MDRV_VIDEO_START(superbug) + MDRV_VIDEO_UPDATE(superbug) MDRV_GFXDECODE(superbug) - - MDRV_PALETTE_INIT(firetrk) MDRV_PALETTE_LENGTH(28) /* sound hardware */ @@ -1109,6 +932,8 @@ static MACHINE_DRIVER_START( montecar ) MDRV_CPU_PROGRAM_MAP(montecar_map, 0) /* video hardware */ + MDRV_VIDEO_START(montecar) + MDRV_VIDEO_UPDATE(montecar) MDRV_GFXDECODE(montecar) MDRV_PALETTE_INIT(montecar) @@ -1197,6 +1022,6 @@ ROM_START( montecar ) ROM_END -GAME( 1977, superbug, 0, superbug, superbug, superbug, ROT270, "Atari", "Super Bug", 0 ) -GAME( 1978, firetrk, 0, firetrk, firetrk, firetrk, ROT270, "Atari", "Fire Truck", 0 ) -GAME( 1979, montecar, 0, montecar, montecar, montecar, ROT270, "Atari", "Monte Carlo", 0 ) +GAME( 1977, superbug, 0, superbug, superbug, 0, ROT270, "Atari", "Super Bug", 0 ) +GAME( 1978, firetrk, 0, firetrk, firetrk, 0, ROT270, "Atari", "Fire Truck", 0 ) +GAME( 1979, montecar, 0, montecar, montecar, 0, ROT270, "Atari", "Monte Carlo", 0 ) diff --git a/src/mame/includes/firetrk.h b/src/mame/includes/firetrk.h index 6d6d99d6354..fe53b8027ca 100644 --- a/src/mame/includes/firetrk.h +++ b/src/mame/includes/firetrk.h @@ -29,28 +29,17 @@ Atari Fire Truck + Super Bug + Monte Carlo driver #define MONTECAR_BEEPER_EN FIRETRUCK_XTNDPLY_EN #define MONTECAR_ATTRACT_INV FIRETRUCK_ATTRACT_EN -#define GAME_IS_FIRETRUCK (firetrk_game == 1) -#define GAME_IS_SUPERBUG (firetrk_game == 2) -#define GAME_IS_MONTECARLO (firetrk_game == 3) - - -/*----------- defined in drivers/firetrk.c -----------*/ - -extern int firetrk_game; - -extern UINT32 firetrk_color1_mask; -extern UINT32 firetrk_color2_mask; - /*----------- defined in audio/firetrk.c -----------*/ WRITE8_HANDLER( firetrk_skid_reset_w ); +WRITE8_HANDLER( montecar_skid_reset_w ); WRITE8_HANDLER( firetrk_crash_snd_w ); WRITE8_HANDLER( firetrk_skid_snd_w ); WRITE8_HANDLER( firetrk_motor_snd_w ); +WRITE8_HANDLER( superbug_motor_snd_w ); WRITE8_HANDLER( firetrk_xtndply_w ); -WRITE8_HANDLER( firetrk_asr_w ); -WRITE8_HANDLER( firetrk_out2_w ); +WRITE8_HANDLER( superbug_asr_w ); DISCRETE_SOUND_EXTERN( firetrk ); DISCRETE_SOUND_EXTERN( superbug ); @@ -59,23 +48,25 @@ DISCRETE_SOUND_EXTERN( montecar ); /*----------- defined in video/firetrk.c -----------*/ -extern VIDEO_UPDATE( firetrk ); -extern VIDEO_START( firetrk ); -extern VIDEO_EOF( firetrk ); +PALETTE_INIT( firetrk ); +PALETTE_INIT( montecar ); +VIDEO_START( firetrk ); +VIDEO_START( superbug ); +VIDEO_START( montecar ); +VIDEO_UPDATE( firetrk ); +VIDEO_UPDATE( superbug ); +VIDEO_UPDATE( montecar ); -extern WRITE8_HANDLER( firetrk_vert_w ); -extern WRITE8_HANDLER( firetrk_horz_w ); -extern WRITE8_HANDLER( firetrk_drone_hpos_w ); -extern WRITE8_HANDLER( firetrk_drone_vpos_w ); -extern WRITE8_HANDLER( firetrk_drone_rot_w ); -extern WRITE8_HANDLER( firetrk_playfield_w ); -extern WRITE8_HANDLER( firetrk_car_rot_w ); +extern UINT8 *firetrk_alpha_num_ram; +extern UINT8 *firetrk_playfield_ram; +extern UINT8 *firetrk_scroll_x; +extern UINT8 *firetrk_scroll_y; +extern UINT8 *firetrk_car_rot; +extern UINT8 *firetrk_drone_rot; +extern UINT8 *firetrk_drone_x; +extern UINT8 *firetrk_drone_y; +extern UINT8 *firetrk_blink; +extern UINT8 firetrk_flash; -extern void firetrk_set_flash(int flag); -extern void firetrk_set_blink(int flag); - -extern UINT8* firetrk_alpha_num_ram; -extern UINT8* firetrk_playfield_ram; - -extern int firetrk_crash[2]; -extern int firetrk_skid[2]; +extern UINT8 firetrk_crash[2]; +extern UINT8 firetrk_skid[2]; diff --git a/src/mame/video/firetrk.c b/src/mame/video/firetrk.c index 37d42640439..feb85710017 100644 --- a/src/mame/video/firetrk.c +++ b/src/mame/video/firetrk.c @@ -7,463 +7,450 @@ Atari Fire Truck + Super Bug + Monte Carlo video emulation #include "driver.h" #include "firetrk.h" -UINT8* firetrk_alpha_num_ram; -UINT8* firetrk_playfield_ram; -int firetrk_skid[2]; -int firetrk_crash[2]; +UINT8 *firetrk_alpha_num_ram; +UINT8 *firetrk_playfield_ram; +UINT8 *firetrk_scroll_x; +UINT8 *firetrk_scroll_y; +UINT8 *firetrk_car_rot; +UINT8 *firetrk_drone_rot; +UINT8 *firetrk_drone_x; +UINT8 *firetrk_drone_y; +UINT8 *firetrk_blink; +UINT8 firetrk_flash; + +UINT8 firetrk_skid[2]; +UINT8 firetrk_crash[2]; static bitmap_t *helper1; static bitmap_t *helper2; -static int blink; -static int flash; -static int drone_hpos; -static int drone_vpos; +static UINT32 color1_mask; +static UINT32 color2_mask; -static const rectangle playfield_window = { 0x02A, 0x115, 0x000, 0x0FF }; -struct sprite_data +static const rectangle playfield_window = { 0x02a, 0x115, 0x000, 0x0ff }; + +static tilemap *tilemap1; /* for screen display */ +static tilemap *tilemap2; /* for collision detection */ + + + +PALETTE_INIT( firetrk ) { - int layout; - int number; - int x; - int y; - int flipx; - int flipy; - int color; -}; + int i; -static struct sprite_data car[2]; - -static tilemap* tilemap1; /* for screen display */ -static tilemap* tilemap2; /* for collision detection */ - - - -INLINE int arrow_code(int c) -{ - if (GAME_IS_FIRETRUCK) + static const UINT8 colortable_source[] = { - return (c & 0x3F) >= 0x4 && (c & 0x3F) <= 0xB; - } - if (GAME_IS_SUPERBUG) + 0, 0, 1, 0, + 2, 0, 3, 0, + 3, 3, 2, 3, + 1, 3, 0, 3, + 0, 0, 1, 0, + 2, 0, 0, 3, + 3, 0, 0, 3 + }; + static const rgb_t palette_source[] = { - return (c & 0x3F) >= 0x8 && (c & 0x3F) <= 0xF; - } + RGB_BLACK, + MAKE_RGB(0x5b, 0x5b, 0x5b), + MAKE_RGB(0xa4, 0xa4, 0xa4), + RGB_WHITE + }; - return 0; + color1_mask = color2_mask = 0; + + for (i = 0; i < ARRAY_LENGTH(colortable_source); i++) + { + UINT8 color = colortable_source[i]; + + if (color == 1) + color1_mask |= 1 << i; + else if (color == 2) + color2_mask |= 1 << i; + + palette_set_color(machine, i, palette_source[color]); + } } -void firetrk_set_flash(int flag) +static void prom_to_palette(running_machine *machine, int number, UINT8 val) { - tilemap_mark_all_tiles_dirty(tilemap1); - - if (GAME_IS_FIRETRUCK || GAME_IS_SUPERBUG) - { - if (flag) - { - car[0].color = 1; - car[1].color = 1; - } - else - { - car[0].color = 0; - car[1].color = 0; - } - } - - flash = flag; + palette_set_color(machine, number, MAKE_RGB(pal1bit(val >> 2), pal1bit(val >> 1), pal1bit(val >> 0))); } -void firetrk_set_blink(int flag) +PALETTE_INIT( montecar ) { - int offset; + int i; - for (offset = 0; offset < 0x100; offset++) + static const UINT8 colortable_source[] = { - if (arrow_code(firetrk_playfield_ram[offset])) - { - tilemap_mark_tile_dirty(tilemap1, offset); - } + 0x00, 0x00, 0x00, 0x01, + 0x00, 0x02, 0x00, 0x03, + 0x03, 0x03, 0x03, 0x02, + 0x03, 0x01, 0x03, 0x00, + 0x00, 0x00, 0x02, 0x00, + 0x02, 0x01, 0x02, 0x02, + 0x00, 0x10, 0x20, 0x30, + 0x00, 0x04, 0x08, 0x0c, + 0x00, 0x44, 0x48, 0x4c, + 0x00, 0x84, 0x88, 0x8c, + 0x00, 0xc4, 0xc8, 0xcc + }; + + /* + * The color PROM is addressed as follows: + * + * A0 => PLAYFIELD 1 + * A1 => PLAYFIELD 2 + * A2 => DRONE 1 + * A3 => DRONE 2 + * A4 => CAR 1 + * A5 => CAR 2 + * A6 => DRONE COLOR 1 + * A7 => DRONE COLOR 2 + * A8 => PLAYFIELD WINDOW + * + * This driver hard-codes some behavior which actually depends + * on the PROM, like priorities, clipping and transparency. + * + */ + + color1_mask = color2_mask = 0; + + for (i = 0; i < ARRAY_LENGTH(colortable_source); i++) + { + UINT8 color = colortable_source[i]; + + if (color == 1) + color1_mask |= 1 << i; + else if (color == 2) + color2_mask |= 1 << i; + + prom_to_palette(machine, i, color_prom[0x100 + colortable_source[i]]); } - blink = flag; + palette_set_color(machine, ARRAY_LENGTH(colortable_source) + 0, RGB_BLACK); + palette_set_color(machine, ARRAY_LENGTH(colortable_source) + 1, RGB_WHITE); } -static TILE_GET_INFO( get_tile_info1 ) +static TILE_GET_INFO( firetrk_get_tile_info1 ) { - UINT8 code = firetrk_playfield_ram[tile_index]; + int code = firetrk_playfield_ram[tile_index] & 0x3f; + int color = (firetrk_playfield_ram[tile_index] >> 6) & 0x03; - int color = code >> 6; - - if (blink && arrow_code(code)) - { + if (*firetrk_blink && (code >= 0x04) && (code <= 0x0b)) color = 0; - } - if (flash) - { - color |= 4; - } - SET_TILE_INFO(1, code & 0x3f, color, 0); + if (firetrk_flash) + color = color | 0x04; + + SET_TILE_INFO(1, code, color, 0); } -static TILE_GET_INFO( get_tile_info2 ) +static TILE_GET_INFO( superbug_get_tile_info1 ) { - UINT8 code = firetrk_playfield_ram[tile_index]; + int code = firetrk_playfield_ram[tile_index] & 0x3f; + int color = (firetrk_playfield_ram[tile_index] >> 6) & 0x03; + if (*firetrk_blink && (code >= 0x08) && (code <= 0x0f)) + color = 0; + + if (firetrk_flash) + color = color | 0x04; + + SET_TILE_INFO(1, code, color, 0); +} + + +static TILE_GET_INFO( montecar_get_tile_info1 ) +{ + int code = firetrk_playfield_ram[tile_index] & 0x3f; + int color = (firetrk_playfield_ram[tile_index] >> 6) & 0x03; + + if (firetrk_flash) + color = color | 0x04; + + SET_TILE_INFO(1, code, color, 0); +} + + +static TILE_GET_INFO( firetrk_get_tile_info2 ) +{ + UINT8 code = firetrk_playfield_ram[tile_index] & 0x3f; int color = 0; /* palette 1 for crash and palette 2 for skid */ + if (((code & 0x30) != 0x00) || ((code & 0x0c) == 0x00)) + color = 1; /* palette 0, 1 */ - if (GAME_IS_FIRETRUCK) - { - if ((code & 0x30) != 0x00 || (code & 0x0c) == 0x00) - { - color = 1; /* palette 0, 1 */ - } - if ((code & 0x3c) == 0x0c) - { - color = 2; /* palette 0, 2 */ - } - } + if ((code & 0x3c) == 0x0c) + color = 2; /* palette 0, 2 */ - if (GAME_IS_SUPERBUG) - { - if ((code & 0x30) != 0x00) - { - color = 1; /* palette 0, 1 */ - } - if ((code & 0x38) == 0x00) - { - color = 2; /* palette 0, 2 */ - } - } + SET_TILE_INFO(2, code, color, 0); +} - if (GAME_IS_MONTECARLO) - { - if ((code & 0xc0) == 0x40 || (code & 0xc0) == 0x80) - { - color = 2; /* palette 2, 1 */ - } - if ((code & 0xc0) == 0xc0) - { - color = 1; /* palette 2, 0 */ - } - if ((code & 0xc0) == 0x00) - { - color = 3; /* palette 2, 2 */ - } - if ((code & 0x30) == 0x30) - { - color = 0; /* palette 0, 0 */ - } - } + +static TILE_GET_INFO( superbug_get_tile_info2 ) +{ + UINT8 code = firetrk_playfield_ram[tile_index] & 0x3f; + int color = 0; + + /* palette 1 for crash and palette 2 for skid */ + if ((code & 0x30) != 0x00) + color = 1; /* palette 0, 1 */ + + if ((code & 0x38) == 0x00) + color = 2; /* palette 0, 2 */ + + SET_TILE_INFO(2, code, color, 0); +} + + +static TILE_GET_INFO( montecar_get_tile_info2 ) +{ + UINT8 code = firetrk_playfield_ram[tile_index]; + int color = 0; + + /* palette 1 for crash and palette 2 for skid */ + if (((code & 0xc0) == 0x40) || ((code & 0xc0) == 0x80)) + color = 2; /* palette 2, 1 */ + + if ((code & 0xc0) == 0xc0) + color = 1; /* palette 2, 0 */ + + if ((code & 0xc0) == 0x00) + color = 3; /* palette 2, 2 */ + + if ((code & 0x30) == 0x30) + color = 0; /* palette 0, 0 */ SET_TILE_INFO(2, code & 0x3f, color, 0); } -WRITE8_HANDLER( firetrk_vert_w ) -{ - tilemap_set_scrolly(tilemap1, 0, data); - tilemap_set_scrolly(tilemap2, 0, data); -} - - -WRITE8_HANDLER( firetrk_horz_w ) -{ - tilemap_set_scrollx(tilemap1, 0, data - 37); - tilemap_set_scrollx(tilemap2, 0, data - 37); -} - - -WRITE8_HANDLER( firetrk_drone_hpos_w ) -{ - drone_hpos = data; -} - - -WRITE8_HANDLER( firetrk_drone_vpos_w ) -{ - drone_vpos = data; -} - - -WRITE8_HANDLER( firetrk_car_rot_w ) -{ - if (GAME_IS_FIRETRUCK) - { - car[0].number = data & 0x03; - - if (data & 0x10) /* swap xy */ - { - car[0].layout = 4; - } - else - { - car[0].layout = 3; - } - - car[0].flipx = data & 0x04; - car[0].flipy = data & 0x08; - } - - if (GAME_IS_SUPERBUG) - { - car[0].number = (data & 0x03) ^ 3; - - if (data & 0x10) /* swap xy */ - { - car[0].layout = 4; - } - else - { - car[0].layout = 3; - } - - car[0].flipx = data & 0x04; - car[0].flipy = data & 0x08; - } - - if (GAME_IS_MONTECARLO) - { - car[0].number = data & 0x07; - - if (data & 0x80) - { - car[1].color |= 2; - } - else - { - car[1].color &= ~2; - } - - car[0].flipx = data & 0x10; - car[0].flipy = data & 0x08; - } -} - - -WRITE8_HANDLER( firetrk_drone_rot_w ) -{ - car[1].number = data & 0x07; - - if (GAME_IS_FIRETRUCK) - { - car[1].flipx = data & 0x08; - car[1].flipy = data & 0x10; - } - - if (GAME_IS_MONTECARLO) - { - car[1].flipx = data & 0x10; - car[1].flipy = data & 0x08; - - if (data & 0x80) - { - car[1].color |= 1; - } - else - { - car[1].color &= ~1; - } - } -} - - -WRITE8_HANDLER( firetrk_playfield_w ) -{ - firetrk_playfield_ram[offset] = data; - tilemap_mark_tile_dirty(tilemap1, offset); - tilemap_mark_tile_dirty(tilemap2, offset); -} - - VIDEO_START( firetrk ) { helper1 = auto_bitmap_alloc(machine->screen[0].width, machine->screen[0].height, machine->screen[0].format); helper2 = auto_bitmap_alloc(machine->screen[0].width, machine->screen[0].height, machine->screen[0].format); - tilemap1 = tilemap_create(get_tile_info1, tilemap_scan_rows, 16, 16, 16, 16); - tilemap2 = tilemap_create(get_tile_info2, tilemap_scan_rows, 16, 16, 16, 16); - - memset(&car[0], 0, sizeof (struct sprite_data)); - memset(&car[1], 0, sizeof (struct sprite_data)); - - if (GAME_IS_FIRETRUCK) - { - car[0].layout = 3; - car[1].layout = 5; - } - if (GAME_IS_SUPERBUG) - { - car[0].layout = 3; - car[1].layout = 0; - } - if (GAME_IS_MONTECARLO) - { - car[0].layout = 3; - car[1].layout = 4; - } + tilemap1 = tilemap_create(firetrk_get_tile_info1, tilemap_scan_rows, 16, 16, 16, 16); + tilemap2 = tilemap_create(firetrk_get_tile_info2, tilemap_scan_rows, 16, 16, 16, 16); } -static void calc_car_positions(void) +VIDEO_START( superbug ) { - car[0].x = 144; - car[0].y = 104; + helper1 = auto_bitmap_alloc(machine->screen[0].width, machine->screen[0].height, machine->screen[0].format); + helper2 = auto_bitmap_alloc(machine->screen[0].width, machine->screen[0].height, machine->screen[0].format); - if (GAME_IS_FIRETRUCK) - { - car[1].x = car[1].flipx ? drone_hpos - 63 : 192 - drone_hpos; - car[1].y = car[1].flipy ? drone_vpos - 63 : 192 - drone_vpos; - - car[1].x += 36; - } - - if (GAME_IS_MONTECARLO) - { - car[1].x = car[1].flipx ? drone_hpos - 31 : 224 - drone_hpos; - car[1].y = car[1].flipy ? drone_vpos - 31 : 224 - drone_vpos; - - car[1].x += 34; - } + tilemap1 = tilemap_create(superbug_get_tile_info1, tilemap_scan_rows, 16, 16, 16, 16); + tilemap2 = tilemap_create(superbug_get_tile_info2, tilemap_scan_rows, 16, 16, 16, 16); } -static void draw_text(running_machine *machine, bitmap_t* bitmap, const rectangle* cliprect) +VIDEO_START( montecar ) { - const UINT8* p = firetrk_alpha_num_ram; + helper1 = auto_bitmap_alloc(machine->screen[0].width, machine->screen[0].height, machine->screen[0].format); + helper2 = auto_bitmap_alloc(machine->screen[0].width, machine->screen[0].height, machine->screen[0].format); + tilemap1 = tilemap_create(montecar_get_tile_info1, tilemap_scan_rows, 16, 16, 16, 16); + tilemap2 = tilemap_create(montecar_get_tile_info2, tilemap_scan_rows, 16, 16, 16, 16); +} + + +static void firetrk_draw_car(gfx_element **gfx, bitmap_t *bitmap, const rectangle *cliprect, int which, int flash) +{ + int gfx_bank, code, color, flip_x, flip_y, x, y; + + if (which) + { + gfx_bank = 5; + code = *firetrk_drone_rot & 0x07; + color = flash ? 1 : 0; + flip_x = *firetrk_drone_rot & 0x08; + flip_y = *firetrk_drone_rot & 0x10; + x = (flip_x ? *firetrk_drone_x - 63 : 192 - *firetrk_drone_x) + 36; + y = flip_y ? *firetrk_drone_y - 63 : 192 - *firetrk_drone_y; + } + else + { + gfx_bank = (*firetrk_car_rot & 0x10) ? 4 : 3; + code = *firetrk_car_rot & 0x03; + color = flash ? 1 : 0; + flip_x = *firetrk_car_rot & 0x04; + flip_y = *firetrk_car_rot & 0x08; + x = 144; + y = 104; + } + + drawgfx(bitmap, gfx[gfx_bank], code, color, flip_x, flip_y, x, y, cliprect, TRANSPARENCY_PEN, 0); +} + + +static void superbug_draw_car(gfx_element **gfx, bitmap_t *bitmap, const rectangle *cliprect, int flash) +{ + int gfx_bank = (*firetrk_car_rot & 0x10) ? 4 : 3; + int code = ~*firetrk_car_rot & 0x03; + int color = flash ? 1 : 0; + int flip_x = *firetrk_car_rot & 0x04; + int flip_y = *firetrk_car_rot & 0x08; + + drawgfx(bitmap, gfx[gfx_bank], code, color, flip_x, flip_y, 144, 104, cliprect, TRANSPARENCY_PEN, 0); +} + + +static void montecar_draw_car(gfx_element **gfx, bitmap_t *bitmap, const rectangle *cliprect, int which, int is_collision_detection) +{ + int gfx_bank, code, color, flip_x, flip_y, x, y; + + if (which) + { + gfx_bank = 4; + code = *firetrk_drone_rot & 0x07; + color = is_collision_detection ? 0 : (((*firetrk_car_rot & 0x80) >> 6) | ((*firetrk_drone_rot & 0x80) >> 7)); + flip_x = *firetrk_drone_rot & 0x10; + flip_y = *firetrk_drone_rot & 0x08; + x = (flip_x ? *firetrk_drone_x - 31 : 224 - *firetrk_drone_x) + 34; + y = flip_y ? *firetrk_drone_y - 31 : 224 - *firetrk_drone_y; + } + else + { + gfx_bank = 3; + code = *firetrk_car_rot & 0x07; + color = 0; + flip_x = *firetrk_car_rot & 0x10; + flip_y = *firetrk_car_rot & 0x08; + x = 144; + y = 104; + } + + drawgfx(bitmap, gfx[gfx_bank], code, color, flip_x, flip_y, x, y, cliprect, TRANSPARENCY_PEN, 0); +} + + +static void draw_text(gfx_element **gfx, bitmap_t *bitmap, const rectangle *cliprect, UINT8 *alpha_ram, + int x, int count, int height) +{ int i; - for (i = 0; i < 2; i++) - { - int x = 0; - int y = 0; + for (i = 0; i < count; i++) + drawgfx(bitmap, gfx[0], alpha_ram[i], 0, 0, 0, x, i * height, cliprect, TRANSPARENCY_NONE, 0); +} - if (GAME_IS_SUPERBUG || GAME_IS_FIRETRUCK) - { - x = (i == 0) ? 296 : 8; - } - if (GAME_IS_MONTECARLO) - { - x = (i == 0) ? 24 : 16; - } - for (y = 0; y < 256; y += machine->gfx[0]->width) +static void check_collision(int which) +{ + int y, x; + + for (y = playfield_window.min_y; y <= playfield_window.max_y; y++) + for (x = playfield_window.min_x; x <= playfield_window.max_x; x++) { - drawgfx(bitmap, machine->gfx[0], *p++, 0, 0, 0, - x, y, cliprect, TRANSPARENCY_NONE, 0); + pen_t a = *BITMAP_ADDR16(helper1, y, x); + pen_t b = *BITMAP_ADDR16(helper2, y, x); + + if (b != 0xff && (color1_mask >> a) & 1) + firetrk_crash[which] = 1; + + if (b != 0xff && (color2_mask >> a) & 1) + firetrk_skid[which] = 1; } - } } VIDEO_UPDATE( firetrk ) { - int i; + tilemap_mark_all_tiles_dirty(ALL_TILEMAPS); + tilemap_set_scrollx(tilemap1, 0, *firetrk_scroll_x - 37); + tilemap_set_scrollx(tilemap2, 0, *firetrk_scroll_x - 37); + tilemap_set_scrolly(tilemap1, 0, *firetrk_scroll_y); + tilemap_set_scrolly(tilemap2, 0, *firetrk_scroll_y); + fillbitmap(bitmap, 0, cliprect); tilemap_draw(bitmap, &playfield_window, tilemap1, 0, 0); + firetrk_draw_car(machine->gfx, bitmap, &playfield_window, 0, firetrk_flash); + firetrk_draw_car(machine->gfx, bitmap, &playfield_window, 1, firetrk_flash); + draw_text(machine->gfx, bitmap, cliprect, firetrk_alpha_num_ram + 0x00, 296, 0x10, 0x10); + draw_text(machine->gfx, bitmap, cliprect, firetrk_alpha_num_ram + 0x10, 8, 0x10, 0x10); - calc_car_positions(); - - for (i = 1; i >= 0; i--) + if (cliprect->max_y == machine->screen[screen].visarea.max_y) { - if (GAME_IS_SUPERBUG && i == 1) - { - continue; - } + tilemap_draw(helper1, &playfield_window, tilemap2, 0, 0); - drawgfx(bitmap, - machine->gfx[car[i].layout], - car[i].number, - car[i].color, - car[i].flipx, - car[i].flipy, - car[i].x, - car[i].y, - &playfield_window, - TRANSPARENCY_PEN, 0); + fillbitmap(helper2, 0xff, &playfield_window); + firetrk_draw_car(machine->gfx, helper2, &playfield_window, 0, FALSE); + check_collision(0); + + fillbitmap(helper2, 0xff, &playfield_window); + firetrk_draw_car(machine->gfx, helper2, &playfield_window, 1, FALSE); + check_collision(1); + + *firetrk_blink = FALSE; } - draw_text(machine, bitmap, cliprect); return 0; } -VIDEO_EOF( firetrk ) +VIDEO_UPDATE( superbug ) { - int i; + tilemap_mark_all_tiles_dirty(ALL_TILEMAPS); + tilemap_set_scrollx(tilemap1, 0, *firetrk_scroll_x - 37); + tilemap_set_scrollx(tilemap2, 0, *firetrk_scroll_x - 37); + tilemap_set_scrolly(tilemap1, 0, *firetrk_scroll_y); + tilemap_set_scrolly(tilemap2, 0, *firetrk_scroll_y); - tilemap_draw(helper1, &playfield_window, tilemap2, 0, 0); + fillbitmap(bitmap, 0, cliprect); + tilemap_draw(bitmap, &playfield_window, tilemap1, 0, 0); + superbug_draw_car(machine->gfx, bitmap, &playfield_window, firetrk_flash); + draw_text(machine->gfx, bitmap, cliprect, firetrk_alpha_num_ram + 0x00, 296, 0x10, 0x10); + draw_text(machine->gfx, bitmap, cliprect, firetrk_alpha_num_ram + 0x10, 8, 0x10, 0x10); - calc_car_positions(); - - for (i = 1; i >= 0; i--) + if (cliprect->max_y == machine->screen[screen].visarea.max_y) { - int width = machine->gfx[car[i].layout]->width; - int height = machine->gfx[car[i].layout]->height; + tilemap_draw(helper1, &playfield_window, tilemap2, 0, 0); - int x; - int y; + fillbitmap(helper2, 0xff, &playfield_window); + superbug_draw_car(machine->gfx, helper2, &playfield_window, FALSE); + check_collision(0); - if (GAME_IS_SUPERBUG && i == 1) - { - continue; - } - - fillbitmap(helper2, 0xff, NULL); - drawgfx(helper2, - machine->gfx[car[i].layout], - car[i].number, - 0, - car[i].flipx, - car[i].flipy, - car[i].x, - car[i].y, - &playfield_window, - TRANSPARENCY_PEN, 0); - - for (y = car[i].y; y < car[i].y + height; y++) - { - for (x = car[i].x; x < car[i].x + width; x++) - { - pen_t a; - pen_t b; - - if (x < playfield_window.min_x) - continue; - if (x > playfield_window.max_x) - continue; - if (y < playfield_window.min_y) - continue; - if (y > playfield_window.max_y) - continue; - - a = *BITMAP_ADDR16(helper1, y, x); - b = *BITMAP_ADDR16(helper2, y, x); - - if (b != 0xff && (firetrk_color1_mask >> a) & 1) - { - firetrk_crash[i] = 1; - } - if (b != 0xff && (firetrk_color2_mask >> a) & 1) - { - firetrk_skid[i] = 1; - } - } - } + *firetrk_blink = FALSE; } - if (blink) - { - firetrk_set_blink(0); - } + return 0; +} + + +VIDEO_UPDATE( montecar ) +{ + tilemap_mark_all_tiles_dirty(ALL_TILEMAPS); + tilemap_set_scrollx(tilemap1, 0, *firetrk_scroll_x - 37); + tilemap_set_scrollx(tilemap2, 0, *firetrk_scroll_x - 37); + tilemap_set_scrolly(tilemap1, 0, *firetrk_scroll_y); + tilemap_set_scrolly(tilemap2, 0, *firetrk_scroll_y); + + fillbitmap(bitmap, 0x2c, cliprect); + tilemap_draw(bitmap, &playfield_window, tilemap1, 0, 0); + montecar_draw_car(machine->gfx, bitmap, &playfield_window, 0, FALSE); + montecar_draw_car(machine->gfx, bitmap, &playfield_window, 1, FALSE); + draw_text(machine->gfx, bitmap, cliprect, firetrk_alpha_num_ram + 0x00, 24, 0x20, 0x08); + draw_text(machine->gfx, bitmap, cliprect, firetrk_alpha_num_ram + 0x20, 16, 0x20, 0x08); + + if (cliprect->max_y == machine->screen[screen].visarea.max_y) + { + tilemap_draw(helper1, &playfield_window, tilemap2, 0, 0); + + fillbitmap(helper2, 0xff, &playfield_window); + montecar_draw_car(machine->gfx, helper2, &playfield_window, 0, TRUE); + check_collision(0); + + fillbitmap(helper2, 0xff, &playfield_window); + montecar_draw_car(machine->gfx, helper2, &playfield_window, 1, TRUE); + check_collision(1); + } + + return 0; }