From 5564d3cbb88e150fbc41f63ae0c366659f095506 Mon Sep 17 00:00:00 2001 From: Aaron Giles Date: Tue, 14 Aug 2012 20:06:42 +0000 Subject: [PATCH] Modernized Sega Y-board driver. --- src/mame/drivers/segaxbd.c | 16 +- src/mame/drivers/segaybd.c | 1453 ++++++++++++++++++----------------- src/mame/includes/segaybd.h | 79 +- src/mame/video/segaxbd.c | 2 +- src/mame/video/segaybd.c | 52 +- 5 files changed, 833 insertions(+), 769 deletions(-) diff --git a/src/mame/drivers/segaxbd.c b/src/mame/drivers/segaxbd.c index 8a7ac7d08db..9ef33e5d9d1 100644 --- a/src/mame/drivers/segaxbd.c +++ b/src/mame/drivers/segaxbd.c @@ -1068,11 +1068,9 @@ ADDRESS_MAP_END -/************************************* - * - * Generic port definitions - * - *************************************/ +//************************************************************************** +// GENERIC PORT DEFINITIONS +//************************************************************************** static INPUT_PORTS_START( xboard_generic ) PORT_START("IO0PORTA") @@ -1112,11 +1110,9 @@ INPUT_PORTS_END -/************************************* - * - * Game-specific port definitions - * - *************************************/ +//************************************************************************** +// GAME-SPECIFIC PORT DEFINITIONS +//************************************************************************** static INPUT_PORTS_START( aburner ) PORT_INCLUDE( xboard_generic ) diff --git a/src/mame/drivers/segaybd.c b/src/mame/drivers/segaybd.c index 503b0ef8af9..877c57b21ff 100644 --- a/src/mame/drivers/segaybd.c +++ b/src/mame/drivers/segaybd.c @@ -68,241 +68,77 @@ #include "pdrift.lh" -#define MASTER_CLOCK 50000000 -#define SOUND_CLOCK 32215900 +//************************************************************************** +// CONSTANTS +//************************************************************************** -/* use this to fiddle with the IRQ2 timing */ +const UINT32 MASTER_CLOCK = 50000000; +const UINT32 SOUND_CLOCK = 32215900; + +// use this to fiddle with the IRQ2 timing #define TWEAK_IRQ2_SCANLINE (0) -/************************************* - * - * Statics - * - *************************************/ +//************************************************************************** +// YM2151 CHIP CALLBACKS +//************************************************************************** -/* callbacks to handle output */ -typedef void (*yboard_output_callback)(UINT16 data); -static yboard_output_callback ybd_output_cb1, ybd_output_cb2; -static UINT16 pdrift_bank; +//------------------------------------------------- +// sound_cpu_irq - signal an IRQ to the sound CPU +//------------------------------------------------- - -/************************************* - * - * Configuration - * - *************************************/ - -static void yboard_generic_init( running_machine &machine ) +void segaybd_state::sound_cpu_irq(int state) { - segaybd_state *state = machine.driver_data(); - - /* reset globals */ - state->m_vblank_irq_state = 0; - state->m_timer_irq_state = 0; - - ybd_output_cb1 = NULL; - ybd_output_cb2 = NULL; + m_soundcpu->set_input_line(0, state); } -/************************************* - * - * Initialization & interrupts - * - *************************************/ +//************************************************************************** +// MAIN CPU READ/WRITE HANDLERS +//************************************************************************** -static void update_main_irqs(running_machine &machine) -{ - segaybd_state *state = machine.driver_data(); - - device_set_input_line(state->m_maincpu, 2, state->m_timer_irq_state ? ASSERT_LINE : CLEAR_LINE); - device_set_input_line(state->m_subx, 2, state->m_timer_irq_state ? ASSERT_LINE : CLEAR_LINE); - device_set_input_line(state->m_suby, 2, state->m_timer_irq_state ? ASSERT_LINE : CLEAR_LINE); - device_set_input_line(state->m_maincpu, 4, state->m_vblank_irq_state ? ASSERT_LINE : CLEAR_LINE); - device_set_input_line(state->m_subx, 4, state->m_vblank_irq_state ? ASSERT_LINE : CLEAR_LINE); - device_set_input_line(state->m_suby, 4, state->m_vblank_irq_state ? ASSERT_LINE : CLEAR_LINE); - device_set_input_line(state->m_maincpu, 6, state->m_timer_irq_state && state->m_vblank_irq_state ? ASSERT_LINE : CLEAR_LINE); - device_set_input_line(state->m_subx, 6, state->m_timer_irq_state && state->m_vblank_irq_state ? ASSERT_LINE : CLEAR_LINE); - device_set_input_line(state->m_suby, 6, state->m_timer_irq_state && state->m_vblank_irq_state ? ASSERT_LINE : CLEAR_LINE); - - if (state->m_timer_irq_state || state->m_vblank_irq_state) - machine.scheduler().boost_interleave(attotime::zero, attotime::from_usec(50)); -} - - -/* - IRQ2 timing: the timing of this interrupt is VERY sensitive! If it is at the - wrong time, many games will screw up their rendering. Also, since there is - no ack on the interrupt, it only fires for a single scanline, so if it fires - too early, it's possible it could be missed. - - As far as I can tell, the interrupt is not programmable. It comes from the - pair of rotation/video sync chips. There is no obvious location in the - rotation RAM where it is specified, so I am assuming it is a hard-coded - interrupt. - - Through trial and error, here is what I have found. Scanline 170 seems to - be the earliest we can fire it and have it work reliably. Firing it later - seems to introduce some glitches. Firing it too early means it will get - missed and even worse things happen. - - Enable the TWEAK_IRQ2_SCANLINE define at the top of this file to fiddle with - the timing. - - pdrift: - 100-110 = glitchy logo - 120 = glitchy logo + flickering 16B during logo - 150-170 = ok, very little logo glitching - 180-200 = ok, slightly glitchy logo - 210-220 = ok, but no palette fade - - gforce2: - 140 = no palette fade up - 150-200 = ok - - strkfgtr: - 150-200 = ok -*/ - -static TIMER_CALLBACK( scanline_callback ) -{ - segaybd_state *state = machine.driver_data(); - int scanline = param; - - /* on scanline 'irq2_scanline' generate an IRQ2 */ - if (scanline == state->m_irq2_scanline) - { - state->m_timer_irq_state = 1; - scanline = state->m_irq2_scanline + 1; - } - - /* on scanline 'irq2_scanline' + 1, clear the IRQ2 */ - else if (scanline == state->m_irq2_scanline + 1) - { - state->m_timer_irq_state = 0; - scanline = 223; - } - - /* on scanline 223 generate VBLANK for all CPUs */ - else if (scanline == 223) - { - state->m_vblank_irq_state = 1; - scanline = 224; - } - - /* on scanline 224 we turn it off */ - else if (scanline == 224) - { - state->m_vblank_irq_state = 0; - scanline = state->m_irq2_scanline; - } - - /* update IRQs on the main CPU */ - update_main_irqs(machine); - - /* come back at the next appropriate scanline */ - state->m_scanline_timer->adjust(machine.primary_screen->time_until_pos(scanline), scanline); - -#if TWEAK_IRQ2_SCANLINE - if (scanline == 223) - { - int old = state->m_irq2_scanline; - - /* Q = -10 scanlines, W = -1 scanline, E = +1 scanline, R = +10 scanlines */ - if (machine.input().code_pressed(KEYCODE_Q)) { while (machine.input().code_pressed(KEYCODE_Q)) ; state->m_irq2_scanline -= 10; } - if (machine.input().code_pressed(KEYCODE_W)) { while (machine.input().code_pressed(KEYCODE_W)) ; state->m_irq2_scanline -= 1; } - if (machine.input().code_pressed(KEYCODE_E)) { while (machine.input().code_pressed(KEYCODE_E)) ; state->m_irq2_scanline += 1; } - if (machine.input().code_pressed(KEYCODE_R)) { while (machine.input().code_pressed(KEYCODE_R)) ; state->m_irq2_scanline += 10; } - if (old != state->m_irq2_scanline) - popmessage("scanline = %d", state->m_irq2_scanline); - } -#endif -} - - -static MACHINE_START( yboard ) -{ - segaybd_state *state = machine.driver_data(); - - state->save_item(NAME(state->m_vblank_irq_state)); - state->save_item(NAME(state->m_timer_irq_state)); - state->save_item(NAME(state->m_irq2_scanline)); - state->save_item(NAME(state->m_misc_io_data)); - state->save_item(NAME(state->m_analog_data)); - - state->m_scanline_timer = machine.scheduler().timer_alloc(FUNC(scanline_callback)); -} - - -static MACHINE_RESET( yboard ) -{ - segaybd_state *state = machine.driver_data(); - - state->m_irq2_scanline = 170; - - state->m_scanline_timer->adjust(machine.primary_screen->time_until_pos(223), 223); -} - - - -/************************************* - * - * Sound comm and interrupts - * - *************************************/ - -static void sound_cpu_irq(device_t *device, int state) -{ - segaybd_state *driver = device->machine().driver_data(); - - device_set_input_line(driver->m_soundcpu, 0, state); -} - - -static TIMER_CALLBACK( delayed_sound_data_w ) -{ - segaybd_state *state = machine.driver_data(); - address_space *space = state->m_maincpu->memory().space(AS_PROGRAM); - - state->soundlatch_byte_w(*space, 0, param); - device_set_input_line(state->m_soundcpu, INPUT_LINE_NMI, ASSERT_LINE); -} - - -static WRITE16_HANDLER( sound_data_w ) +//------------------------------------------------- +// analog_r - handle analog input reads +//------------------------------------------------- + +READ16_MEMBER( segaybd_state::analog_r ) { + int result = 0xff; if (ACCESSING_BITS_0_7) - space->machine().scheduler().synchronize(FUNC(delayed_sound_data_w), data & 0xff); + { + result = m_analog_data[offset & 3] & 0x80; + m_analog_data[offset & 3] <<= 1; + } + return result; } -static READ8_HANDLER( sound_data_r ) +//------------------------------------------------- +// analog_w - handle analog input control writes +//------------------------------------------------- + +WRITE16_MEMBER( segaybd_state::analog_w ) { - segaybd_state *state = space->machine().driver_data(); - device_set_input_line(state->m_soundcpu, INPUT_LINE_NMI, CLEAR_LINE); - return state->soundlatch_byte_r(*space, offset); + static const char *const ports[] = { "ADC0", "ADC1", "ADC2", "ADC3", "ADC4", "ADC5", "ADC6" }; + int selected = ((offset & 3) == 3) ? (3 + (m_misc_io_data[0x08/2] & 3)) : (offset & 3); + m_analog_data[offset & 3] = ioport(ports[selected])->read_safe(0xff); } +//------------------------------------------------- +// io_chip_r - handle reads from the I/O chip +//------------------------------------------------- -/************************************* - * - * I/O space - * - *************************************/ - -static READ16_HANDLER( io_chip_r ) +READ16_MEMBER( segaybd_state::io_chip_r ) { - segaybd_state *state = space->machine().driver_data(); static const char *const portnames[] = { "P1", "GENERAL", "PORTC", "PORTD", "PORTE", "DSW", "COINAGE", "PORTH" }; offset &= 0x1f/2; switch (offset) { - /* I/O ports */ + // I/O ports case 0x00/2: case 0x02/2: case 0x04/2: @@ -311,14 +147,14 @@ static READ16_HANDLER( io_chip_r ) case 0x0a/2: case 0x0c/2: case 0x0e/2: - /* if the port is configured as an output, return the last thing written */ - if (state->m_misc_io_data[0x1e/2] & (1 << offset)) - return state->m_misc_io_data[offset]; + // if the port is configured as an output, return the last thing written + if (m_misc_io_data[0x1e/2] & (1 << offset)) + return m_misc_io_data[offset]; - /* otherwise, return an input port */ - return space->machine().root_device().ioport(portnames[offset])->read(); + // otherwise, return an input port + return ioport(portnames[offset])->read(); - /* 'SEGA' protection */ + // 'SEGA' protection case 0x10/2: return 'S'; case 0x12/2: @@ -328,33 +164,36 @@ static READ16_HANDLER( io_chip_r ) case 0x16/2: return 'A'; - /* CNT register & mirror */ + // CNT register & mirror case 0x18/2: case 0x1c/2: - return state->m_misc_io_data[0x1c/2]; + return m_misc_io_data[0x1c/2]; - /* port direction register & mirror */ + // port direction register & mirror case 0x1a/2: case 0x1e/2: - return state->m_misc_io_data[0x1e/2]; + return m_misc_io_data[0x1e/2]; } return 0xffff; } -static WRITE16_HANDLER( io_chip_w ) +//------------------------------------------------- +// io_chip_w - handle writes to the I/O chip +//------------------------------------------------- + +WRITE16_MEMBER( segaybd_state::io_chip_w ) { - segaybd_state *state = space->machine().driver_data(); UINT8 old; - /* generic implementation */ + // generic implementation offset &= 0x1f/2; - old = state->m_misc_io_data[offset]; - state->m_misc_io_data[offset] = data; + old = m_misc_io_data[offset]; + m_misc_io_data[offset] = data; switch (offset) { - /* I/O ports */ + // I/O ports case 0x00/2: break; case 0x02/2: @@ -362,110 +201,522 @@ static WRITE16_HANDLER( io_chip_w ) case 0x04/2: break; case 0x06/2: - if (ybd_output_cb1) - ybd_output_cb1(data); + if (!m_output_cb1.isnull()) + m_output_cb1(data); break; case 0x0a/2: case 0x0c/2: break; - /* miscellaneous output */ + // miscellaneous output case 0x08/2: - - - /* - D7 = /KILL - D6 = CONT - D5 = /WDCL - D4 = /SRES - D3 = XRES - D2 = YRES - D1-D0 = ADC0-1 - */ - segaic16_set_display_enable(space->machine(), data & 0x80); + // + // D7 = /KILL + // D6 = CONT + // D5 = /WDCL + // D4 = /SRES + // D3 = XRES + // D2 = YRES + // D1-D0 = ADC0-1 + // + segaic16_set_display_enable(machine(), data & 0x80); if (((old ^ data) & 0x20) && !(data & 0x20)) - state->watchdog_reset_w(*space, 0, 0); - device_set_input_line(state->m_soundcpu, INPUT_LINE_RESET, (data & 0x10) ? CLEAR_LINE : ASSERT_LINE); - device_set_input_line(state->m_subx, INPUT_LINE_RESET, (data & 0x08) ? ASSERT_LINE : CLEAR_LINE); - device_set_input_line(state->m_suby, INPUT_LINE_RESET, (data & 0x04) ? ASSERT_LINE : CLEAR_LINE); + machine().watchdog_reset(); + m_soundcpu->set_input_line(INPUT_LINE_RESET, (data & 0x10) ? CLEAR_LINE : ASSERT_LINE); + m_subx->set_input_line(INPUT_LINE_RESET, (data & 0x08) ? ASSERT_LINE : CLEAR_LINE); + m_suby->set_input_line(INPUT_LINE_RESET, (data & 0x04) ? ASSERT_LINE : CLEAR_LINE); break; - /* mute */ + // mute case 0x0e/2: - if (ybd_output_cb2) - ybd_output_cb2(data); + if (!m_output_cb2.isnull()) + m_output_cb2(data); - /* D7 = /MUTE */ - /* D6-D0 = FLT31-25 */ - space->machine().sound().system_enable(data & 0x80); + // D7 = /MUTE + // D6-D0 = FLT31-25 + machine().sound().system_enable(data & 0x80); break; - /* CNT register */ + // CNT register case 0x1c/2: break; } } -/************************************* - * - * Analog ports - * - *************************************/ +//------------------------------------------------- +// sound_data_w - handle writes to sound control +// port +//------------------------------------------------- -static READ16_HANDLER( analog_r ) +WRITE16_MEMBER( segaybd_state::sound_data_w ) { - segaybd_state *state = space->machine().driver_data(); - int result = 0xff; if (ACCESSING_BITS_0_7) - { - result = state->m_analog_data[offset & 3] & 0x80; - state->m_analog_data[offset & 3] <<= 1; - } - return result; + synchronize(TID_SOUND_WRITE, data & 0xff); } -static WRITE16_HANDLER( analog_w ) + +//************************************************************************** +// SOUND Z80 CPU READ/WRITE CALLBACKS +//************************************************************************** + +//------------------------------------------------- +// sound_data_r - read latched sound data +//------------------------------------------------- + +READ8_MEMBER( segaybd_state::sound_data_r ) { - segaybd_state *state = space->machine().driver_data(); - static const char *const ports[] = { "ADC0", "ADC1", "ADC2", "ADC3", "ADC4", "ADC5", "ADC6" }; - int selected = ((offset & 3) == 3) ? (3 + (state->m_misc_io_data[0x08/2] & 3)) : (offset & 3); - int value = state->ioport(ports[selected])->read_safe(0xff); - - state->m_analog_data[offset & 3] = value; + m_soundcpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); + return soundlatch_read(); } -/************************************* - * - * Main CPU memory handlers - * - *************************************/ +//************************************************************************** +// DRIVER OVERRIDES +//************************************************************************** + +//------------------------------------------------- +// machine_reset - reset the state of the machine +//------------------------------------------------- + +void segaybd_state::machine_reset() +{ + m_irq2_scanline = 170; + m_scanline_timer->adjust(machine().primary_screen->time_until_pos(223), 223); +} + + +//------------------------------------------------- +// device_timer - handle device timers +//------------------------------------------------- + +void segaybd_state::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) +{ + switch (id) + { + case TID_IRQ2_GEN: + // + // IRQ2 timing: the timing of this interrupt is VERY sensitive! If it is at the + // wrong time, many games will screw up their rendering. Also, since there is + // no ack on the interrupt, it only fires for a single scanline, so if it fires + // too early, it's possible it could be missed. + // + // As far as I can tell, the interrupt is not programmable. It comes from the + // pair of rotation/video sync chips. There is no obvious location in the + // rotation RAM where it is specified, so I am assuming it is a hard-coded + // interrupt. + // + // Through trial and error, here is what I have found. Scanline 170 seems to + // be the earliest we can fire it and have it work reliably. Firing it later + // seems to introduce some glitches. Firing it too early means it will get + // missed and even worse things happen. + // + // Enable the TWEAK_IRQ2_SCANLINE define at the top of this file to fiddle with + // the timing. + // + // pdrift: + // 100-110 = glitchy logo + // 120 = glitchy logo + flickering 16B during logo + // 150-170 = ok, very little logo glitching + // 180-200 = ok, slightly glitchy logo + // 210-220 = ok, but no palette fade + // + // gforce2: + // 140 = no palette fade up + // 150-200 = ok + // + // strkfgtr: + // 150-200 = ok + // + { + // on scanline 'irq2_scanline' generate an IRQ2 + int scanline = param; + if (scanline == m_irq2_scanline) + { + m_timer_irq_state = 1; + scanline = m_irq2_scanline + 1; + } + + // on scanline 'irq2_scanline' + 1, clear the IRQ2 + else if (scanline == m_irq2_scanline + 1) + { + m_timer_irq_state = 0; + scanline = 223; + } + + // on scanline 223 generate VBLANK for all CPUs + else if (scanline == 223) + { + m_vblank_irq_state = 1; + scanline = 224; + } + + // on scanline 224 we turn it off + else if (scanline == 224) + { + m_vblank_irq_state = 0; + scanline = m_irq2_scanline; + } + + // update IRQs on the main CPU + update_irqs(); + + // come back at the next appropriate scanline + m_scanline_timer->adjust(machine().primary_screen->time_until_pos(scanline), scanline); + + #if TWEAK_IRQ2_SCANLINE + if (scanline == 223) + { + int old = m_irq2_scanline; + + // Q = -10 scanlines, W = -1 scanline, E = +1 scanline, R = +10 scanlines + if (machine().input().code_pressed(KEYCODE_Q)) { while (machine().input().code_pressed(KEYCODE_Q)) ; m_irq2_scanline -= 10; } + if (machine().input().code_pressed(KEYCODE_W)) { while (machine().input().code_pressed(KEYCODE_W)) ; m_irq2_scanline -= 1; } + if (machine().input().code_pressed(KEYCODE_E)) { while (machine().input().code_pressed(KEYCODE_E)) ; m_irq2_scanline += 1; } + if (machine().input().code_pressed(KEYCODE_R)) { while (machine().input().code_pressed(KEYCODE_R)) ; m_irq2_scanline += 10; } + if (old != m_irq2_scanline) + popmessage("scanline = %d", m_irq2_scanline); + } + #endif + } + + case TID_SOUND_WRITE: + soundlatch_write(param); + m_soundcpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); + break; + + } +} + + + +//************************************************************************** +// GAME-SPECIFIC OUTPUT CALLBACKS +//************************************************************************** + +// TODO: kokoroj2 and jpark (SW2) +// +// Additional notes: +// - about jpark: the compression switch is broken/inoperative +// and because of that all piston data, which is in this +// section is frozen. bits x01, x04 and x10 when which == 0 +// (IO chip 0), seem to have something to do with the sensor +// switches we need to fix + +//------------------------------------------------- +// gforce2_output_cb2 - output #2 handler for +// Galaxy Force +//------------------------------------------------- + +void segaybd_state::gforce2_output_cb2(UINT16 data) +{ + output_set_value("start_lamp", BIT(data, 2)); +} + + +//------------------------------------------------- +// gloc_output_cb1 - output #1 handler for +// G-Loc +//------------------------------------------------- + +void segaybd_state::gloc_output_cb1(UINT16 data) +{ + if (data < 32) + { + output_set_value("right_motor_position", data); + + // normalization here prevents strange data from being transferred + // we do this because for some odd reason + // gloc starts with one piston all up and one all down.... at least data-wise it does + if (data > 1 && data < 29) + output_set_value("right_motor_position_nor", data); + } + + if (data < 40 && data > 31) + output_set_value("right_motor_speed", data - 32); + + if (data < 96 && data > 63) + { + output_set_value("left_motor_position", data); + // normalized version... you know... for the kids + if ((data - 64) > 1 && (data - 64) < 29) + output_set_value("left_motor_position_nor", data - 64); + } + + if (data < 104 && data > 95) + output_set_value("left_motor_speed", data - 96); +} + + +//------------------------------------------------- +// gloc_output_cb2 - output #2 handler for +// G-Loc +//------------------------------------------------- + +void segaybd_state::gloc_output_cb2(UINT16 data) +{ + output_set_value("start_lamp", BIT(data, 2)); + output_set_value("danger_lamp", BIT(data, 5)); + output_set_value("crash_lamp", BIT(data, 6)); +} + + +//------------------------------------------------- +// r360_output_cb2 - output #2 handler for +// G-Loc R360 +//------------------------------------------------- + +void segaybd_state::r360_output_cb2(UINT16 data) +{ + // r360 cabinet + output_set_value("start_lamp", BIT(data, 2)); + // even though the same output is used, I've split them to avoid confusion. + output_set_value("emergency_stop_lamp", BIT(data, 2)); +} + + +//------------------------------------------------- +// pdrift_output_cb1 - output #1 handler for +// Power Drift +//------------------------------------------------- + +void segaybd_state::pdrift_output_cb1(UINT16 data) +{ + // Note: this is an approximation to get a relatively accurate bank value. It is obviously not 100% + + // for some stupid reason the data is set to all on in the debug menu so we need to check for that + if (data != 255) + { + // this is a cheap hack to get some usable positional data in the service menu + // these values probably manually turn the motor left and right + if ((data == 162 || data == 161 || data == 160)) + { + if (data == 162) + // moving left + { + // in this rare instance, the bottom bits are used for positional data + output_set_value("bank_data_raw", data); + output_set_value("vibration_motor", 0); + switch (m_pdrift_bank) + // we want to go left one step at a time + { + case 1: + // all left + output_set_value("bank_motor_position", 1); + m_pdrift_bank = 1; + break; + case 2: + output_set_value("bank_motor_position", 1); + m_pdrift_bank = 1; + break; + case 3: + output_set_value("bank_motor_position", 2); + m_pdrift_bank = 2; + break; + case 4: + // centered + output_set_value("bank_motor_position", 3); + m_pdrift_bank = 3; + break; + case 5: + output_set_value("bank_motor_position", 4); + m_pdrift_bank = 4; + break; + case 6: + output_set_value("bank_motor_position", 5); + m_pdrift_bank = 5; + break; + case 7: + // all right + output_set_value("bank_motor_position", 6); + m_pdrift_bank = 6; + break; + default: + output_set_value("bank_motor_position", 4); + m_pdrift_bank = 4; + break; + } + } + + if (data == 161) + // moving right + { + // in this rare instance, the bottom bits are used for positional data + output_set_value("bank_data_raw", data); + output_set_value("vibration_motor", 0); + switch (m_pdrift_bank) + // we want to go right one step at a time + { + case 1: + // all left + output_set_value("bank_motor_position", 2); + m_pdrift_bank = 2; + break; + case 2: + output_set_value("bank_motor_position", 3); + m_pdrift_bank = 3; + break; + case 3: + output_set_value("bank_motor_position", 4); + m_pdrift_bank = 4; + break; + case 4: + // centered + output_set_value("bank_motor_position", 5); + m_pdrift_bank = 5; + break; + case 5: + output_set_value("bank_motor_position", 6); + m_pdrift_bank = 6; + break; + case 6: + output_set_value("bank_motor_position", 7); + m_pdrift_bank = 7; + break; + case 7: + // all right + output_set_value("bank_motor_position", 7); + m_pdrift_bank = 7; + break; + default: + output_set_value("bank_motor_position", 4); + m_pdrift_bank = 4; + break; + + } + } + } + else + { + // the vibration value uses the first few bits to give a number between 0 and 7 + output_set_value("vibration_motor", data & 7); + // normalize the data and subtract the vibration value from it*/ + + m_pdrift_bank = data - (data & 7); + output_set_value("bank_data_raw", m_pdrift_bank); + + // position values from left to right + // 56 48 40 120 72 80 88 + + // the normalized values we'll use + // 1 2 3 4 5 6 7 + + switch (m_pdrift_bank) + { + case 56: + // all left + output_set_value("bank_motor_position", 1); + break; + case 48: + output_set_value("bank_motor_position", 2); + break; + case 40: + output_set_value("bank_motor_position", 3); + break; + case 120: + // centered + output_set_value("bank_motor_position", 4); + break; + case 72: + output_set_value("bank_motor_position", 5); + break; + case 80: + output_set_value("bank_motor_position", 6); + break; + case 88: + // all right + output_set_value("bank_motor_position", 7); + break; + // these are the only valid values but 24 pops up sometimes when we crash + } + } + } +} + + +//------------------------------------------------- +// pdrift_output_cb2 - output #2 handler for +// Power Drift +//------------------------------------------------- + +void segaybd_state::pdrift_output_cb2(UINT16 data) +{ + output_set_value("start_lamp", BIT(data, 2)); + output_set_value("upright_wheel_motor", BIT(data, 1)); +} + + +//------------------------------------------------- +// rchase_output_cb2 - output #2 handler for +// Rail Chase +//------------------------------------------------- + +void segaybd_state::rchase_output_cb2(UINT16 data) +{ + output_set_value("left_start_lamp", BIT(data, 2)); + output_set_value("right_start_lamp", BIT(data, 1)); + + output_set_value("P1_Gun_Recoil", BIT(data, 6)); + output_set_value("P2_Gun_Recoil", BIT(data, 5)); +} + + + +//************************************************************************** +// INTERNAL HELPERS +//************************************************************************** + +//------------------------------------------------- +// update_irqs - flush IRQ state to the various +// CPU devices +//------------------------------------------------- + +void segaybd_state::update_irqs() +{ + m_maincpu->set_input_line(2, m_timer_irq_state ? ASSERT_LINE : CLEAR_LINE); + m_subx->set_input_line(2, m_timer_irq_state ? ASSERT_LINE : CLEAR_LINE); + m_suby->set_input_line(2, m_timer_irq_state ? ASSERT_LINE : CLEAR_LINE); + + m_maincpu->set_input_line(4, m_vblank_irq_state ? ASSERT_LINE : CLEAR_LINE); + m_subx->set_input_line(4, m_vblank_irq_state ? ASSERT_LINE : CLEAR_LINE); + m_suby->set_input_line(4, m_vblank_irq_state ? ASSERT_LINE : CLEAR_LINE); + + m_maincpu->set_input_line(6, m_timer_irq_state && m_vblank_irq_state ? ASSERT_LINE : CLEAR_LINE); + m_subx->set_input_line(6, m_timer_irq_state && m_vblank_irq_state ? ASSERT_LINE : CLEAR_LINE); + m_suby->set_input_line(6, m_timer_irq_state && m_vblank_irq_state ? ASSERT_LINE : CLEAR_LINE); + + if (m_timer_irq_state || m_vblank_irq_state) + machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(50)); +} + + + +//************************************************************************** +// MAIN CPU ADDRESS MAPS +//************************************************************************** static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, segaybd_state ) ADDRESS_MAP_UNMAP_HIGH ADDRESS_MAP_GLOBAL_MASK(0x1fffff) AM_RANGE(0x000000, 0x07ffff) AM_ROM AM_RANGE(0x080000, 0x080007) AM_MIRROR(0x001ff8) AM_DEVREADWRITE("multiplier_main", sega_315_5248_multiplier_device, read, write) - AM_RANGE(0x082000, 0x083fff) AM_WRITE_LEGACY(sound_data_w) + AM_RANGE(0x082000, 0x083fff) AM_WRITE(sound_data_w) AM_RANGE(0x084000, 0x08401f) AM_MIRROR(0x001fe0) AM_DEVREADWRITE("divider_main", sega_315_5249_divider_device, read, write) // AM_RANGE(0x086000, 0x087fff) /DEA0 - AM_RANGE(0x0c0000, 0x0cffff) AM_RAM AM_SHARE("share1") - AM_RANGE(0x100000, 0x10001f) AM_READWRITE_LEGACY(io_chip_r, io_chip_w) - AM_RANGE(0x100040, 0x100047) AM_READWRITE_LEGACY(analog_r, analog_w) + AM_RANGE(0x0c0000, 0x0cffff) AM_RAM AM_SHARE("shareram") + AM_RANGE(0x100000, 0x10001f) AM_READWRITE(io_chip_r, io_chip_w) + AM_RANGE(0x100040, 0x100047) AM_READWRITE(analog_r, analog_w) AM_RANGE(0x1f0000, 0x1fffff) AM_RAM ADDRESS_MAP_END -/************************************* - * - * Sub CPU memory handlers - * - *************************************/ +//************************************************************************** +// SUB CPU ADDRESS MAPS +//************************************************************************** static ADDRESS_MAP_START( subx_map, AS_PROGRAM, 16, segaybd_state ) ADDRESS_MAP_UNMAP_HIGH @@ -473,34 +724,31 @@ static ADDRESS_MAP_START( subx_map, AS_PROGRAM, 16, segaybd_state ) AM_RANGE(0x000000, 0x03ffff) AM_ROM AM_RANGE(0x080000, 0x080007) AM_MIRROR(0x001ff8) AM_DEVREADWRITE("multiplier_subx", sega_315_5248_multiplier_device, read, write) AM_RANGE(0x084000, 0x08401f) AM_MIRROR(0x001fe0) AM_DEVREADWRITE("divider_subx", sega_315_5249_divider_device, read, write) - AM_RANGE(0x0c0000, 0x0cffff) AM_RAM AM_SHARE("share1") - AM_RANGE(0x180000, 0x18ffff) AM_RAM AM_BASE_LEGACY(&segaic16_spriteram_1) + AM_RANGE(0x0c0000, 0x0cffff) AM_RAM AM_SHARE("shareram") + AM_RANGE(0x180000, 0x18ffff) AM_RAM AM_SHARE("spriteram2") AM_RANGE(0x1f8000, 0x1fbfff) AM_RAM AM_RANGE(0x1fc000, 0x1fffff) AM_RAM AM_SHARE("backupram") ADDRESS_MAP_END - static ADDRESS_MAP_START( suby_map, AS_PROGRAM, 16, segaybd_state ) ADDRESS_MAP_UNMAP_HIGH ADDRESS_MAP_GLOBAL_MASK(0x1fffff) AM_RANGE(0x000000, 0x03ffff) AM_ROM AM_RANGE(0x080000, 0x080007) AM_MIRROR(0x001ff8) AM_DEVREADWRITE("multiplier_suby", sega_315_5248_multiplier_device, read, write) AM_RANGE(0x084000, 0x08401f) AM_MIRROR(0x001fe0) AM_DEVREADWRITE("divider_suby", sega_315_5249_divider_device, read, write) - AM_RANGE(0x0c0000, 0x0cffff) AM_RAM AM_SHARE("share1") - AM_RANGE(0x180000, 0x1807ff) AM_MIRROR(0x007800) AM_RAM AM_BASE_LEGACY(&segaic16_rotateram_0) - AM_RANGE(0x188000, 0x188fff) AM_MIRROR(0x007000) AM_RAM AM_BASE_LEGACY(&segaic16_spriteram_0) - AM_RANGE(0x190000, 0x193fff) AM_MIRROR(0x004000) AM_RAM_WRITE_LEGACY(segaic16_paletteram_w) AM_BASE_LEGACY(&segaic16_paletteram) + AM_RANGE(0x0c0000, 0x0cffff) AM_RAM AM_SHARE("shareram") + AM_RANGE(0x180000, 0x1807ff) AM_MIRROR(0x007800) AM_RAM AM_SHARE("rotateram") + AM_RANGE(0x188000, 0x188fff) AM_MIRROR(0x007000) AM_RAM AM_SHARE("spriteram") + AM_RANGE(0x190000, 0x193fff) AM_MIRROR(0x004000) AM_RAM_WRITE_LEGACY(segaic16_paletteram_w) AM_SHARE("paletteram") AM_RANGE(0x198000, 0x19ffff) AM_READ_LEGACY(segaic16_rotate_control_0_r) AM_RANGE(0x1f0000, 0x1fffff) AM_RAM ADDRESS_MAP_END -/************************************* - * - * Sound CPU memory handlers - * - *************************************/ +//************************************************************************** +// Z80 SOUND CPU ADDRESS MAPS +//************************************************************************** static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8, segaybd_state ) ADDRESS_MAP_UNMAP_HIGH @@ -513,28 +761,26 @@ static ADDRESS_MAP_START( sound_portmap, AS_IO, 8, segaybd_state ) ADDRESS_MAP_UNMAP_HIGH ADDRESS_MAP_GLOBAL_MASK(0xff) AM_RANGE(0x00, 0x01) AM_MIRROR(0x3e) AM_DEVREADWRITE_LEGACY("ymsnd", ym2151_r, ym2151_w) - AM_RANGE(0x40, 0x40) AM_MIRROR(0x3f) AM_READ_LEGACY(sound_data_r) + AM_RANGE(0x40, 0x40) AM_MIRROR(0x3f) AM_READ(sound_data_r) ADDRESS_MAP_END -/************************************* - * - * Generic port definitions - * - *************************************/ +//************************************************************************** +// GENERIC PORT DEFINITIONS +//************************************************************************** static INPUT_PORTS_START( yboard_generic ) PORT_START("P1") PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNKNOWN ) PORT_START("GENERAL") - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* afterburner (gloc) */ + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) // afterburner (gloc) PORT_SERVICE_NO_TOGGLE( 0x02, IP_ACTIVE_LOW ) PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 ) - PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* cannon trigger */ - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* missile button or gearshift */ + PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN ) // cannon trigger + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN ) // missile button or gearshift PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 ) @@ -566,11 +812,9 @@ INPUT_PORTS_END -/************************************* - * - * Game-specific port definitions - * - *************************************/ +//************************************************************************** +// GAME-SPECIFIC PORT DEFINITIONS +//************************************************************************** static INPUT_PORTS_START( gforce2 ) PORT_INCLUDE( yboard_generic ) @@ -602,13 +846,13 @@ static INPUT_PORTS_START( gforce2 ) PORT_DIPSETTING( 0x40, DEF_STR( Upright ) ) PORT_DIPSETTING( 0x00, "City" ) - PORT_START("ADC0") /* stick X */ + PORT_START("ADC0") // stick X PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x01,0xff) PORT_SENSITIVITY(100) PORT_KEYDELTA(4) - PORT_START("ADC1") /* stick Y */ + PORT_START("ADC1") // stick Y PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x01,0xff) PORT_SENSITIVITY(100) PORT_KEYDELTA(4) PORT_REVERSE - PORT_START("ADC2") /* throttle */ + PORT_START("ADC2") // throttle PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Z ) PORT_MINMAX(0x01,0xff) PORT_SENSITIVITY(100) PORT_KEYDELTA(79) INPUT_PORTS_END @@ -644,13 +888,13 @@ static INPUT_PORTS_START( gloc ) PORT_DIPSETTING( 0x80, "3 to Start, 2 to Continue" ) PORT_DIPSETTING( 0x00, "4 to Start, 3 to Continue" ) - PORT_START("ADC3") /* stick Y */ + PORT_START("ADC3") // stick Y PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Y ) PORT_MINMAX(0x40,0xc0) PORT_SENSITIVITY(100) PORT_KEYDELTA(4) PORT_REVERSE - PORT_START("ADC4") /* throttle */ + PORT_START("ADC4") // throttle PORT_BIT( 0xff, 0x80, IPT_AD_STICK_Z ) PORT_SENSITIVITY(100) PORT_KEYDELTA(79) - PORT_START("ADC5") /* stick X */ + PORT_START("ADC5") // stick X PORT_BIT( 0xff, 0x80, IPT_AD_STICK_X ) PORT_MINMAX(0x20,0xe0) PORT_SENSITIVITY(100) PORT_KEYDELTA(4) INPUT_PORTS_END @@ -729,16 +973,16 @@ static INPUT_PORTS_START( glocr360 ) PORT_DIPSETTING( 0x80, DEF_STR( 1C_8C ) ) PORT_DIPSETTING( 0x00, "Free Play (if Coin A too) or 1/1" ) - PORT_START("ADC0") /* moving pitch */ + PORT_START("ADC0") // moving pitch PORT_BIT( 0xff, 0x7f, IPT_AD_STICK_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(4) PORT_PLAYER(2) - PORT_START("ADC2") /* moving roll */ + PORT_START("ADC2") // moving roll PORT_BIT( 0xff, 0x7f, IPT_AD_STICK_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(4) PORT_PLAYER(3) - PORT_START("ADC3") /* stick Y */ + PORT_START("ADC3") // stick Y PORT_BIT( 0xff, 0x7f, IPT_AD_STICK_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(4) PORT_REVERSE - PORT_START("ADC5") /* stick X */ + PORT_START("ADC5") // stick X PORT_BIT( 0xff, 0x7f, IPT_AD_STICK_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(4) INPUT_PORTS_END @@ -772,13 +1016,13 @@ static INPUT_PORTS_START( pdrift ) PORT_DIPSETTING( 0x40, DEF_STR( Hard ) ) PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) - PORT_START("ADC3") /* brake */ + PORT_START("ADC3") // brake PORT_BIT( 0xff, 0x00, IPT_PEDAL2 ) PORT_SENSITIVITY(100) PORT_KEYDELTA(40) - PORT_START("ADC4") /* gas pedal */ + PORT_START("ADC4") // gas pedal PORT_BIT( 0xff, 0x00, IPT_PEDAL ) PORT_SENSITIVITY(100) PORT_KEYDELTA(20) - PORT_START("ADC5") /* steering */ + PORT_START("ADC5") // steering PORT_BIT( 0xff, 0x80, IPT_PADDLE ) PORT_MINMAX(0x20,0xe0) PORT_SENSITIVITY(100) PORT_KEYDELTA(4) INPUT_PORTS_END @@ -938,18 +1182,15 @@ INPUT_PORTS_END -/************************************* - * - * Sound definitions - * - *************************************/ +//************************************************************************** +// SOUND DEFINITIONS +//************************************************************************** static const ym2151_interface ym2151_config = { - DEVCB_LINE(sound_cpu_irq) + DEVCB_DRIVER_LINE_MEMBER(segaybd_state, sound_cpu_irq) }; - static const sega_pcm_interface segapcm_interface = { BANK_12M | BANK_MASKF8 @@ -957,15 +1198,13 @@ static const sega_pcm_interface segapcm_interface = -/************************************* - * - * Generic machine drivers - * - *************************************/ +//************************************************************************** +// GENERIC MACHINE DRIVERS +//************************************************************************** static MACHINE_CONFIG_START( yboard, segaybd_state ) - /* basic machine hardware */ + // basic machine hardware MCFG_CPU_ADD("maincpu", M68000, MASTER_CLOCK/4) MCFG_CPU_PROGRAM_MAP(main_map) @@ -979,8 +1218,6 @@ static MACHINE_CONFIG_START( yboard, segaybd_state ) MCFG_CPU_PROGRAM_MAP(sound_map) MCFG_CPU_IO_MAP(sound_portmap) - MCFG_MACHINE_START(yboard) - MCFG_MACHINE_RESET(yboard) MCFG_NVRAM_ADD_0FILL("backupram") MCFG_QUANTUM_TIME(attotime::from_hz(6000)) @@ -991,21 +1228,19 @@ static MACHINE_CONFIG_START( yboard, segaybd_state ) MCFG_SEGA_315_5249_DIVIDER_ADD("divider_subx") MCFG_SEGA_315_5249_DIVIDER_ADD("divider_suby") - /* video hardware */ + // video hardware MCFG_SCREEN_ADD("screen", RASTER) MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_SIZE(342,262) /* to be verified */ + MCFG_SCREEN_SIZE(342,262) // to be verified MCFG_SCREEN_VISIBLE_AREA(0*8, 40*8-1, 0*8, 28*8-1) - MCFG_SCREEN_UPDATE_STATIC(yboard) + MCFG_SCREEN_UPDATE_DRIVER(segaybd_state,screen_update) MCFG_SEGA16SP_ADD_YBOARD_16B("segaspr1") MCFG_SEGA16SP_ADD_YBOARD("segaspr2") MCFG_PALETTE_LENGTH(8192*3) - MCFG_VIDEO_START(yboard) - - /* sound hardware */ + // sound hardware MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker") MCFG_SOUND_ADD("ymsnd", YM2151, SOUND_CLOCK/8) @@ -1021,29 +1256,28 @@ MACHINE_CONFIG_END -/************************************* - * - * ROM definition(s) - * - *************************************/ +//************************************************************************** +// ROM DEFINITIONS +//************************************************************************** -/************************************************************************************************************************** - ************************************************************************************************************************** - ************************************************************************************************************************** - Galaxy Force, Sega Y-board - Sega Game ID: 831-6614 (two PCB board stack) - NOTE: An original PCB is very hard to locate intact. Most of these boards were upgraded to Galaxy Force 2 through a - chip swap upgrade. +//************************************************************************************************************************* +//************************************************************************************************************************* +//************************************************************************************************************************* +// Galaxy Force, Sega Y-board +// Sega Game ID: 831-6614 (two PCB board stack +// +// NOTE: An original PCB is very hard to locate intact. Most of these boards were upgraded to Galaxy Force 2 through a +// chip swap upgrade. +// -*/ -/************************************************************************************************************************** - ************************************************************************************************************************** - ************************************************************************************************************************** - Galaxy Force 2, Sega Y-board - CPU: 68000 (317-????) -*/ +//************************************************************************************************************************* +//************************************************************************************************************************* +//************************************************************************************************************************* +// Galaxy Force 2, Sega Y-board +// CPU: 68000 (317-????) +// ROM_START( gforce2 ) ROM_REGION( 0x080000, "maincpu", 0 ) // M ROM_LOAD16_BYTE( "epr-11688.25", 0x000000, 0x20000, CRC(c845f2df) SHA1(17586a5f83170e99f28cd35b28e85e503e7bbe75) ) @@ -1100,10 +1334,10 @@ ROM_START( gforce2 ) ROMX_LOAD( "epr-11534.79", 0x300006, 0x20000, CRC(b7f0ad7c) SHA1(987b198692db365f3a81e88e5eec526775c318c6), ROM_SKIP(7) ) ROMX_LOAD( "epr-11535.107", 0x300007, 0x20000, CRC(95da7a46) SHA1(ffe6cd80eecc7c53a1155396ede0720d975d2c3b), ROM_SKIP(7) ) - ROM_REGION( 0x10000, "soundcpu", 0 ) /* Z80 sound CPU */ + ROM_REGION( 0x10000, "soundcpu", 0 ) // Z80 sound CPU ROM_LOAD( "epr-11693.102", 0x000000, 0x10000, CRC(0497785c) SHA1(f077e71efdc96d6eb3f1a1f989650466554fb13a) ) // 11516A - ROM_REGION( 0x200000, "pcm", ROMREGION_ERASEFF ) /* SegaPCM samples */ + ROM_REGION( 0x200000, "pcm", ROMREGION_ERASEFF ) // SegaPCM samples ROM_LOAD( "mpr-11465.107", 0x000000, 0x80000, CRC(e1436dab) SHA1(363f4c111de38cb1d82b245e4fcc65308f506e6a) ) ROM_LOAD( "epr-11516.106", 0x080000, 0x20000, CRC(19d0e17f) SHA1(7171131226cf1fe260a2db310fad2ec264adca26) ) ROM_RELOAD( 0x0a0000, 0x20000 ) @@ -1115,10 +1349,10 @@ ROM_START( gforce2 ) ROM_RELOAD( 0x160000, 0x20000 ) ROM_END -/************************************************************************************************************************** - Galaxy Force 2, Sega Y-board - CPU: 68000 (317-????) -*/ +//************************************************************************************************************************* +// Galaxy Force 2, Sega Y-board +// CPU: 68000 (317-????) +// ROM_START( gforce2ja ) ROM_REGION( 0x080000, "maincpu", 0 ) // M ROM_LOAD16_BYTE( "epr-11688.25", 0x000000, 0x20000, CRC(c845f2df) SHA1(17586a5f83170e99f28cd35b28e85e503e7bbe75) ) @@ -1175,10 +1409,10 @@ ROM_START( gforce2ja ) ROMX_LOAD( "epr-11534.79", 0x300006, 0x20000, CRC(b7f0ad7c) SHA1(987b198692db365f3a81e88e5eec526775c318c6), ROM_SKIP(7) ) ROMX_LOAD( "epr-11535.107", 0x300007, 0x20000, CRC(95da7a46) SHA1(ffe6cd80eecc7c53a1155396ede0720d975d2c3b), ROM_SKIP(7) ) - ROM_REGION( 0x10000, "soundcpu", 0 ) /* Z80 sound CPU */ + ROM_REGION( 0x10000, "soundcpu", 0 ) // Z80 sound CPU ROM_LOAD( "epr-11693.102", 0x000000, 0x10000, CRC(0497785c) SHA1(f077e71efdc96d6eb3f1a1f989650466554fb13a) ) // 11516A - ROM_REGION( 0x200000, "pcm", ROMREGION_ERASEFF ) /* SegaPCM samples */ + ROM_REGION( 0x200000, "pcm", ROMREGION_ERASEFF ) // SegaPCM samples ROM_LOAD( "mpr-11465.107", 0x000000, 0x80000, CRC(e1436dab) SHA1(363f4c111de38cb1d82b245e4fcc65308f506e6a) ) ROM_LOAD( "epr-11516.106", 0x080000, 0x20000, CRC(19d0e17f) SHA1(7171131226cf1fe260a2db310fad2ec264adca26) ) ROM_RELOAD( 0x0a0000, 0x20000 ) @@ -1190,10 +1424,10 @@ ROM_START( gforce2ja ) ROM_RELOAD( 0x160000, 0x20000 ) ROM_END -/************************************************************************************************************************** - Galaxy Force 2, Sega Y-board - CPU: 68000 (317-????) -*/ +//************************************************************************************************************************* +// Galaxy Force 2, Sega Y-board +// CPU: 68000 (317-????) +// ROM_START( gforce2j ) ROM_REGION( 0x080000, "maincpu", 0 ) // M ROM_LOAD16_BYTE( "epr-11511.25", 0x000000, 0x20000, CRC(d80a86d6) SHA1(e1beecb2af2d9960514639f30dbf923c9d5d5a89) ) @@ -1250,10 +1484,10 @@ ROM_START( gforce2j ) ROMX_LOAD( "epr-11534.79", 0x300006, 0x20000, CRC(b7f0ad7c) SHA1(987b198692db365f3a81e88e5eec526775c318c6), ROM_SKIP(7) ) ROMX_LOAD( "epr-11535.107", 0x300007, 0x20000, CRC(95da7a46) SHA1(ffe6cd80eecc7c53a1155396ede0720d975d2c3b), ROM_SKIP(7) ) - ROM_REGION( 0x10000, "soundcpu", 0 ) /* Z80 sound CPU */ + ROM_REGION( 0x10000, "soundcpu", 0 ) // Z80 sound CPU ROM_LOAD( "epr-11693.102", 0x000000, 0x10000, CRC(0497785c) SHA1(f077e71efdc96d6eb3f1a1f989650466554fb13a) ) // 11516A - ROM_REGION( 0x200000, "pcm", ROMREGION_ERASEFF ) /* SegaPCM samples */ + ROM_REGION( 0x200000, "pcm", ROMREGION_ERASEFF ) // SegaPCM samples ROM_LOAD( "mpr-11465.107", 0x000000, 0x80000, CRC(e1436dab) SHA1(363f4c111de38cb1d82b245e4fcc65308f506e6a) ) ROM_LOAD( "epr-11516.106", 0x080000, 0x20000, CRC(19d0e17f) SHA1(7171131226cf1fe260a2db310fad2ec264adca26) ) ROM_RELOAD( 0x0a0000, 0x20000 ) @@ -1266,12 +1500,12 @@ ROM_START( gforce2j ) ROM_END -/************************************************************************************************************************** - ************************************************************************************************************************** - ************************************************************************************************************************** - G-Loc, Sega Y-board - CPU: 68000 (317-????) -*/ +//************************************************************************************************************************* +//************************************************************************************************************************* +//************************************************************************************************************************* +// G-Loc, Sega Y-board +// CPU: 68000 (317-????) +// ROM_START( gloc ) ROM_REGION( 0x080000, "maincpu", 0 ) // M ROM_LOAD16_BYTE( "epr-13170.25", 0x000000, 0x20000, CRC(45189229) SHA1(01d18f6e4887633475baf610f455fad4ed7981e4) ) @@ -1330,16 +1564,17 @@ ROM_START( gloc ) ROMX_LOAD( "epr-13057.79", 0xc00006, 0x80000, CRC(73baefee) SHA1(6e86edc8229dd6112034a7df79f7341a4120dc6b), ROM_SKIP(7) ) ROMX_LOAD( "epr-13065.107", 0xc00007, 0x80000, CRC(8937a655) SHA1(d38726a8a6fe68a002ac8d17f70ab83c2f814aa2), ROM_SKIP(7) ) - ROM_REGION( 0x10000, "soundcpu", 0 ) /* Z80 sound CPU */ + ROM_REGION( 0x10000, "soundcpu", 0 ) // Z80 sound CPU ROM_LOAD( "epr-13033.102", 0x000000, 0x10000, CRC(6df5e827) SHA1(ec260886a27ba00690490500fcf4ebf07fb35205) ) - ROM_REGION( 0x200000, "pcm", ROMREGION_ERASEFF ) /* SegaPCM samples */ + ROM_REGION( 0x200000, "pcm", ROMREGION_ERASEFF ) // SegaPCM samples ROM_LOAD( "epr-13036.107", 0x000000, 0x80000, CRC(7890c26c) SHA1(97e0678bb571de5cf732804f8909e5cbd24980f1) ) ROM_LOAD( "epr-13035.106", 0x080000, 0x80000, CRC(009fa13e) SHA1(c7b224b471696b12332fc7c403c127b19c297df7) ) ROM_LOAD( "epr-13034.105", 0x100000, 0x80000, CRC(cd22d95d) SHA1(857aa320df0b3fb44fc8a5526ba5ee82cc74fe63) ) ROM_END - +//************************************************************************************************************************* +// ROM_START( glocr360 ) ROM_REGION( 0x080000, "maincpu", 0 ) // M ROM_LOAD16_BYTE( "epr-13623.25", 0x000000, 0x20000, CRC(58ad10e7) SHA1(3760ede1d1c089f6c8b2ec88b2f25bce67add467) ) @@ -1398,23 +1633,24 @@ ROM_START( glocr360 ) ROMX_LOAD( "epr-13057.79", 0xc00006, 0x80000, CRC(73baefee) SHA1(6e86edc8229dd6112034a7df79f7341a4120dc6b), ROM_SKIP(7) ) ROMX_LOAD( "epr-13065.107", 0xc00007, 0x80000, CRC(8937a655) SHA1(d38726a8a6fe68a002ac8d17f70ab83c2f814aa2), ROM_SKIP(7) ) - ROM_REGION( 0x10000, "soundcpu", 0 ) /* Z80 sound CPU */ + ROM_REGION( 0x10000, "soundcpu", 0 ) // Z80 sound CPU ROM_LOAD( "epr-13624.102", 0x000000, 0x10000, CRC(eff33f2d) SHA1(87ea22042e5ee1df28544e4959e16f54cfe17f23) ) - ROM_REGION( 0x200000, "pcm", ROMREGION_ERASEFF ) /* SegaPCM samples */ + ROM_REGION( 0x200000, "pcm", ROMREGION_ERASEFF ) // SegaPCM samples ROM_LOAD( "epr-13036.107", 0x000000, 0x80000, CRC(7890c26c) SHA1(97e0678bb571de5cf732804f8909e5cbd24980f1) ) ROM_LOAD( "epr-13035.106", 0x080000, 0x80000, CRC(009fa13e) SHA1(c7b224b471696b12332fc7c403c127b19c297df7) ) ROM_LOAD( "epr-13625.105", 0x100000, 0x80000, CRC(fae71fd2) SHA1(c8468486b1ac74d3a6254d538f05034b1533e40b) ) ROM_END -/************************************************************************************************************************** - ************************************************************************************************************************** - ************************************************************************************************************************** - Power Drift, Sega Y-board - CPU: 68000 (317-????) - CPU BD POWER DRIFT 837-6695-08 (or 837-6695-09) - VIDEO BD POWER DRIFT 837-6696-01 (or 837-6696-02) -*/ + +//************************************************************************************************************************* +//************************************************************************************************************************* +//************************************************************************************************************************* +// Power Drift, Sega Y-board +// CPU: 68000 (317-????) +// CPU BD POWER DRIFT 837-6695-08 (or 837-6695-09) +// VIDEO BD POWER DRIFT 837-6696-01 (or 837-6696-02) +// ROM_START( pdrift ) ROM_REGION( 0x080000, "maincpu", 0 ) // M ROM_LOAD16_BYTE( "epr-12017.25", 0x000000, 0x20000, CRC(31190322) SHA1(18df4bd6078b1c76c7061c05a476a7cbf7d0b37b) ) @@ -1473,10 +1709,10 @@ ROM_START( pdrift ) ROMX_LOAD( "epr-11787.79", 0x300006, 0x20000, CRC(e631dc12) SHA1(3fd6db2eb297890b35dec566b6a90fc2d96bd085), ROM_SKIP(7) ) ROMX_LOAD( "epr-11788.107", 0x300007, 0x20000, CRC(8464c66e) SHA1(af93cbcc50acbd929d0298fb9a75da0369e13ff7), ROM_SKIP(7) ) - ROM_REGION( 0x10000, "soundcpu", 0 ) /* Z80 sound CPU */ + ROM_REGION( 0x10000, "soundcpu", 0 ) // Z80 sound CPU ROM_LOAD( "epr-11899.102", 0x000000, 0x10000, CRC(ed9fa889) SHA1(25d1a069254b34c31d8ee82d301ada895e8dc391) ) - ROM_REGION( 0x200000, "pcm", ROMREGION_ERASEFF ) /* SegaPCM samples */ + ROM_REGION( 0x200000, "pcm", ROMREGION_ERASEFF ) // SegaPCM samples ROM_LOAD( "mpr-11754.107", 0x000000, 0x80000, CRC(ebeb8484) SHA1(269f33cb1a9be126bada858e25291385d48686a2) ) ROM_LOAD( "epr-11756.105", 0x080000, 0x20000, CRC(12e43f8a) SHA1(0f9a11ba6b7c1a352daa1146a01ce147945e91e4) ) ROM_RELOAD( 0x0a0000, 0x20000 ) @@ -1488,13 +1724,15 @@ ROM_START( pdrift ) ROM_RELOAD( 0x160000, 0x20000 ) ROM_REGION( 0x100000, "user1", 0 ) - /* These are mpr-11754.107 split into 4 roms. They would be located on a Sega 839-0221 daughter card. */ + // These are mpr-11754.107 split into 4 roms. They would be located on a Sega 839-0221 daughter card. ROM_LOAD( "epr-11895.ic1", 0x000000, 0x20000, CRC(ee99a6fd) SHA1(4444826e751d9186e6d46b081e47cd99ee3cf853) ) ROM_LOAD( "epr-11896.ic2", 0x000000, 0x20000, CRC(4bebc015) SHA1(307022ea1c1ee87c9ef3782526888c48c3c69fd2) ) ROM_LOAD( "epr-11897.ic3", 0x000000, 0x20000, CRC(4463cb95) SHA1(e86fd4611cf83fe72d59950a60fc8c3a7381a1c7) ) ROM_LOAD( "epr-11898.ic4", 0x000000, 0x20000, CRC(5d19d767) SHA1(d335cd3ef57c75e388df04b04fc3e2881a3902cf) ) ROM_END +//************************************************************************************************************************* +// ROM_START( pdrifta ) ROM_REGION( 0x080000, "maincpu", 0 ) // M ROM_LOAD16_BYTE( "epr-12017.25", 0x000000, 0x20000, CRC(31190322) SHA1(18df4bd6078b1c76c7061c05a476a7cbf7d0b37b) ) @@ -1553,10 +1791,10 @@ ROM_START( pdrifta ) ROMX_LOAD( "epr-11787.79", 0x300006, 0x20000, CRC(e631dc12) SHA1(3fd6db2eb297890b35dec566b6a90fc2d96bd085), ROM_SKIP(7) ) ROMX_LOAD( "epr-11788.107", 0x300007, 0x20000, CRC(8464c66e) SHA1(af93cbcc50acbd929d0298fb9a75da0369e13ff7), ROM_SKIP(7) ) - ROM_REGION( 0x10000, "soundcpu", 0 ) /* Z80 sound CPU */ + ROM_REGION( 0x10000, "soundcpu", 0 ) // Z80 sound CPU ROM_LOAD( "epr-11899.102", 0x000000, 0x10000, CRC(ed9fa889) SHA1(25d1a069254b34c31d8ee82d301ada895e8dc391) ) - ROM_REGION( 0x200000, "pcm", ROMREGION_ERASEFF ) /* SegaPCM samples */ + ROM_REGION( 0x200000, "pcm", ROMREGION_ERASEFF ) // SegaPCM samples ROM_LOAD( "mpr-11754.107", 0x000000, 0x80000, CRC(ebeb8484) SHA1(269f33cb1a9be126bada858e25291385d48686a2) ) ROM_LOAD( "epr-11756.105", 0x080000, 0x20000, CRC(12e43f8a) SHA1(0f9a11ba6b7c1a352daa1146a01ce147945e91e4) ) ROM_RELOAD( 0x0a0000, 0x20000 ) @@ -1568,14 +1806,17 @@ ROM_START( pdrifta ) ROM_RELOAD( 0x160000, 0x20000 ) ROM_REGION( 0x100000, "user1", 0 ) - /* These are mpr-11754.107 split into 4 roms. They would be located on a Sega 839-0221 daughter card. */ + // These are mpr-11754.107 split into 4 roms. They would be located on a Sega 839-0221 daughter card. ROM_LOAD( "epr-11895.ic1", 0x000000, 0x20000, CRC(ee99a6fd) SHA1(4444826e751d9186e6d46b081e47cd99ee3cf853) ) ROM_LOAD( "epr-11896.ic2", 0x000000, 0x20000, CRC(4bebc015) SHA1(307022ea1c1ee87c9ef3782526888c48c3c69fd2) ) ROM_LOAD( "epr-11897.ic3", 0x000000, 0x20000, CRC(4463cb95) SHA1(e86fd4611cf83fe72d59950a60fc8c3a7381a1c7) ) ROM_LOAD( "epr-11898.ic4", 0x000000, 0x20000, CRC(5d19d767) SHA1(d335cd3ef57c75e388df04b04fc3e2881a3902cf) ) ROM_END -ROM_START( pdrifte ) /* Earlier set based on eprom numbers & Sega Eprom/Mask Rom Locations sheet 421-7708 */ +//************************************************************************************************************************* +// Earlier set based on eprom numbers & Sega Eprom/Mask Rom Locations sheet 421-7708 +// +ROM_START( pdrifte ) ROM_REGION( 0x080000, "maincpu", 0 ) // M ROM_LOAD16_BYTE( "epr-11901.25", 0x000000, 0x20000, CRC(16744be8) SHA1(51d06f1b590621d37b2eb8f6cc88f17b248402ad) ) ROM_LOAD16_BYTE( "epr-11900.24", 0x000001, 0x20000, CRC(0a170d06) SHA1(525dec21708fb33c6c7e6d86cb82fd16f6bddfa0) ) @@ -1633,10 +1874,10 @@ ROM_START( pdrifte ) /* Earlier set based on eprom numbers & Sega Eprom/Mask Rom ROMX_LOAD( "epr-11787.79", 0x300006, 0x20000, CRC(e631dc12) SHA1(3fd6db2eb297890b35dec566b6a90fc2d96bd085), ROM_SKIP(7) ) ROMX_LOAD( "epr-11788.107", 0x300007, 0x20000, CRC(8464c66e) SHA1(af93cbcc50acbd929d0298fb9a75da0369e13ff7), ROM_SKIP(7) ) - ROM_REGION( 0x10000, "soundcpu", 0 ) /* Z80 sound CPU */ + ROM_REGION( 0x10000, "soundcpu", 0 ) // Z80 sound CPU ROM_LOAD( "epr-11899.102", 0x000000, 0x10000, CRC(ed9fa889) SHA1(25d1a069254b34c31d8ee82d301ada895e8dc391) ) - ROM_REGION( 0x200000, "pcm", ROMREGION_ERASEFF ) /* SegaPCM samples */ + ROM_REGION( 0x200000, "pcm", ROMREGION_ERASEFF ) // SegaPCM samples ROM_LOAD( "mpr-11754.107", 0x000000, 0x80000, CRC(ebeb8484) SHA1(269f33cb1a9be126bada858e25291385d48686a2) ) ROM_LOAD( "epr-11756.105", 0x080000, 0x20000, CRC(12e43f8a) SHA1(0f9a11ba6b7c1a352daa1146a01ce147945e91e4) ) ROM_RELOAD( 0x0a0000, 0x20000 ) @@ -1648,19 +1889,19 @@ ROM_START( pdrifte ) /* Earlier set based on eprom numbers & Sega Eprom/Mask Rom ROM_RELOAD( 0x160000, 0x20000 ) ROM_REGION( 0x100000, "user1", 0 ) - /* These are mpr-11754.107 split into 4 roms. They would be located on a Sega 839-0221 daughter card. */ + // These are mpr-11754.107 split into 4 roms. They would be located on a Sega 839-0221 daughter card. ROM_LOAD( "epr-11895.ic1", 0x000000, 0x20000, CRC(ee99a6fd) SHA1(4444826e751d9186e6d46b081e47cd99ee3cf853) ) ROM_LOAD( "epr-11896.ic2", 0x000000, 0x20000, CRC(4bebc015) SHA1(307022ea1c1ee87c9ef3782526888c48c3c69fd2) ) ROM_LOAD( "epr-11897.ic3", 0x000000, 0x20000, CRC(4463cb95) SHA1(e86fd4611cf83fe72d59950a60fc8c3a7381a1c7) ) ROM_LOAD( "epr-11898.ic4", 0x000000, 0x20000, CRC(5d19d767) SHA1(d335cd3ef57c75e388df04b04fc3e2881a3902cf) ) ROM_END -/************************************************************************************************************************** - Power Drift, Sega Y-board - CPU: 68000 (317-????) - CPU BD POWER DRIFT 837-6695-08 (or 837-6695-09) - VIDEO BD POWER DRIFT 837-6696-01 (or 837-6696-02) -*/ +//************************************************************************************************************************* +// Power Drift, Sega Y-board +// CPU: 68000 (317-????) +// CPU BD POWER DRIFT 837-6695-08 (or 837-6695-09) +// VIDEO BD POWER DRIFT 837-6696-01 (or 837-6696-02) +// ROM_START( pdriftj ) ROM_REGION( 0x080000, "maincpu", 0 ) // M ROM_LOAD16_BYTE( "epr-11746a.25", 0x000000, 0x20000, CRC(b0f1caf4) SHA1(1d7e70e740ef513728a72ff6e7b1c4b78e3cb0d5) ) @@ -1719,10 +1960,10 @@ ROM_START( pdriftj ) ROMX_LOAD( "epr-11787.79", 0x300006, 0x20000, CRC(e631dc12) SHA1(3fd6db2eb297890b35dec566b6a90fc2d96bd085), ROM_SKIP(7) ) ROMX_LOAD( "epr-11788.107", 0x300007, 0x20000, CRC(8464c66e) SHA1(af93cbcc50acbd929d0298fb9a75da0369e13ff7), ROM_SKIP(7) ) - ROM_REGION( 0x10000, "soundcpu", 0 ) /* Z80 sound CPU */ + ROM_REGION( 0x10000, "soundcpu", 0 ) // Z80 sound CPU ROM_LOAD( "epr-11899.102", 0x000000, 0x10000, CRC(ed9fa889) SHA1(25d1a069254b34c31d8ee82d301ada895e8dc391) ) - ROM_REGION( 0x200000, "pcm", ROMREGION_ERASEFF ) /* SegaPCM samples */ + ROM_REGION( 0x200000, "pcm", ROMREGION_ERASEFF ) // SegaPCM samples ROM_LOAD( "mpr-11754.107", 0x000000, 0x80000, CRC(ebeb8484) SHA1(269f33cb1a9be126bada858e25291385d48686a2) ) ROM_LOAD( "epr-11756.105", 0x080000, 0x20000, CRC(12e43f8a) SHA1(0f9a11ba6b7c1a352daa1146a01ce147945e91e4) ) ROM_RELOAD( 0x0a0000, 0x20000 ) @@ -1734,7 +1975,7 @@ ROM_START( pdriftj ) ROM_RELOAD( 0x160000, 0x20000 ) ROM_REGION( 0x100000, "user1", 0 ) - /* These are mpr-11754.107 split into 4 roms. They would be located on a Sega 839-0221 daughter card. */ + // These are mpr-11754.107 split into 4 roms. They would be located on a Sega 839-0221 daughter card. ROM_LOAD( "epr-11895.ic1", 0x000000, 0x20000, CRC(ee99a6fd) SHA1(4444826e751d9186e6d46b081e47cd99ee3cf853) ) ROM_LOAD( "epr-11896.ic2", 0x000000, 0x20000, CRC(4bebc015) SHA1(307022ea1c1ee87c9ef3782526888c48c3c69fd2) ) ROM_LOAD( "epr-11897.ic3", 0x000000, 0x20000, CRC(4463cb95) SHA1(e86fd4611cf83fe72d59950a60fc8c3a7381a1c7) ) @@ -1742,15 +1983,15 @@ ROM_START( pdriftj ) ROM_END -/************************************************************************************************************************** - ************************************************************************************************************************** - ************************************************************************************************************************** - Rail Chase World, Sega Y-board - CPU: 68000 (317-????) - CPU BD 837-8073-05 - VIDEO BD 837-8074-01 - GAME BD 834-8072-05 -*/ +//************************************************************************************************************************* +//************************************************************************************************************************* +//************************************************************************************************************************* +// Rail Chase World, Sega Y-board +// CPU: 68000 (317-????) +// CPU BD 837-8073-05 +// VIDEO BD 837-8074-01 +// GAME BD 834-8072-05 +// ROM_START( rchase ) ROM_REGION( 0x080000, "maincpu", 0 ) // M ROM_LOAD16_BYTE( "epr-13986.25", 0x000000, 0x20000, CRC(388b2365) SHA1(0f006f9120b96b8d8be968878ce1d6dd853cd977) ) @@ -1798,22 +2039,19 @@ ROM_START( rchase ) ROMX_LOAD( "mpr-14003.80", 0x800006, 0x80000, CRC(87725d74) SHA1(d284512ad15362a886072aaa1a3af98f7a0bddf9), ROM_SKIP(7) ) ROMX_LOAD( "mpr-14004.108", 0x800007, 0x80000, CRC(73477291) SHA1(1fe9d7666d89ee55a0178dceb7cfea7ce94b9e18), ROM_SKIP(7) ) - ROM_REGION( 0x10000, "soundcpu", 0 ) /* Z80 sound CPU */ + ROM_REGION( 0x10000, "soundcpu", 0 ) // Z80 sound CPU ROM_LOAD( "epr-13993.102", 0x000000, 0x10000, CRC(7cc3b543) SHA1(c5e6a2dca891d0b6528e6d66ccd18b24ed4a9464) ) - ROM_REGION( 0x200000, "pcm", ROMREGION_ERASEFF ) /* SegaPCM samples */ + ROM_REGION( 0x200000, "pcm", ROMREGION_ERASEFF ) // SegaPCM samples ROM_LOAD( "mpr-13996.107", 0x000000, 0x80000, CRC(345f5a41) SHA1(d414c3485ba31863c2b36282756709e06a41d262) ) ROM_LOAD( "mpr-13995.106", 0x080000, 0x80000, CRC(f604c270) SHA1(02023786fec2f2702c2f19f51aff5b7e4928ae91) ) ROM_LOAD( "mpr-13994.105", 0x100000, 0x80000, CRC(76095538) SHA1(aab830e3675116c475fe69e0e991118c045b131b) ) ROM_END -/************************************************************************************************************************** - ************************************************************************************************************************** - ************************************************************************************************************************** - Rail Chase Japan, Sega Y-board - CPU: 68000 (317-????) -*/ - +//************************************************************************************************************************* +// Rail Chase Japan, Sega Y-board +// CPU: 68000 (317-????) +// ROM_START( rchasej ) ROM_REGION( 0x080000, "maincpu", 0 ) // M ROM_LOAD16_BYTE( "epr-13986.25", 0x000000, 0x20000, CRC(388b2365) SHA1(0f006f9120b96b8d8be968878ce1d6dd853cd977) ) @@ -1826,8 +2064,8 @@ ROM_START( rchasej ) ROM_LOAD16_BYTE( "epr-13991a.80", 0x000001, 0x20000, CRC(299e3c7c) SHA1(e4903816ec364e9352abd1180e8a609fed75e1a7) ) ROM_REGION( 0x040000, "suby", 0 ) // Y - ROM_LOAD16_BYTE( "epr-13990.54.verify", 0x000000, 0x20000, CRC(18eb23c5) SHA1(53e5681c7450a3879ed80c1680168d6295caa887) ) /* Need to verify EPR #, same as epr-14092.54 above */ - ROM_LOAD16_BYTE( "epr-13989.53.verify", 0x000001, 0x20000, CRC(8f4f824e) SHA1(d470f23ce2dca4e75b7b714175d47338c41bb721) ) /* Need to verify EPR # */ + ROM_LOAD16_BYTE( "epr-13990.54.verify", 0x000000, 0x20000, CRC(18eb23c5) SHA1(53e5681c7450a3879ed80c1680168d6295caa887) ) // Need to verify EPR #, same as epr-14092.54 above + ROM_LOAD16_BYTE( "epr-13989.53.verify", 0x000001, 0x20000, CRC(8f4f824e) SHA1(d470f23ce2dca4e75b7b714175d47338c41bb721) ) // Need to verify EPR # ROM_REGION16_BE( 0x080000, "gfx2", 0 ) ROM_LOAD16_BYTE( "mpr-13999.16", 0x000000, 0x40000, CRC(9a1dd53c) SHA1(cb01f2c64554914ea693879dfcb498181a1e7a9a) ) @@ -1861,23 +2099,22 @@ ROM_START( rchasej ) ROMX_LOAD( "mpr-14003.80", 0x800006, 0x80000, CRC(87725d74) SHA1(d284512ad15362a886072aaa1a3af98f7a0bddf9), ROM_SKIP(7) ) ROMX_LOAD( "mpr-14004.108", 0x800007, 0x80000, CRC(73477291) SHA1(1fe9d7666d89ee55a0178dceb7cfea7ce94b9e18), ROM_SKIP(7) ) - ROM_REGION( 0x10000, "soundcpu", 0 ) /* Z80 sound CPU */ + ROM_REGION( 0x10000, "soundcpu", 0 ) // Z80 sound CPU ROM_LOAD( "epr-13993.102", 0x000000, 0x10000, CRC(7cc3b543) SHA1(c5e6a2dca891d0b6528e6d66ccd18b24ed4a9464) ) - ROM_REGION( 0x200000, "pcm", ROMREGION_ERASEFF ) /* SegaPCM samples */ + ROM_REGION( 0x200000, "pcm", ROMREGION_ERASEFF ) // SegaPCM samples ROM_LOAD( "mpr-13996.107", 0x000000, 0x80000, CRC(345f5a41) SHA1(d414c3485ba31863c2b36282756709e06a41d262) ) ROM_LOAD( "mpr-13995.106", 0x080000, 0x80000, CRC(f604c270) SHA1(02023786fec2f2702c2f19f51aff5b7e4928ae91) ) ROM_LOAD( "mpr-13994.105", 0x100000, 0x80000, CRC(76095538) SHA1(aab830e3675116c475fe69e0e991118c045b131b) ) ROM_END - -/************************************************************************************************************************** - ************************************************************************************************************************** - ************************************************************************************************************************** - Strike Fighter, Sega Y-board - CPU: 68000 (317-????) -*/ +//************************************************************************************************************************* +//************************************************************************************************************************* +//************************************************************************************************************************* +// Strike Fighter, Sega Y-board +// CPU: 68000 (317-????) +// ROM_START( strkfgtr ) ROM_REGION( 0x080000, "maincpu", 0 ) // M ROM_LOAD16_BYTE( "epr-13824.25", 0x000000, 0x20000, CRC(2cf2610c) SHA1(451511842ef61a0404094ecab4f9dc548790d06f) ) @@ -1936,10 +2173,10 @@ ROM_START( strkfgtr ) ROMX_LOAD( "epr-13057.79", 0xc00006, 0x80000, CRC(73baefee) SHA1(6e86edc8229dd6112034a7df79f7341a4120dc6b), ROM_SKIP(7) ) ROMX_LOAD( "epr-13065.107", 0xc00007, 0x80000, CRC(8937a655) SHA1(d38726a8a6fe68a002ac8d17f70ab83c2f814aa2), ROM_SKIP(7) ) - ROM_REGION( 0x10000, "soundcpu", 0 ) /* Z80 sound CPU */ + ROM_REGION( 0x10000, "soundcpu", 0 ) // Z80 sound CPU ROM_LOAD( "epr-13831.102", 0x000000, 0x10000, CRC(dabbcea1) SHA1(79dab7d4a0f80a6acc05672a422ace9c487e26ae) ) - ROM_REGION( 0x200000, "pcm", ROMREGION_ERASEFF ) /* SegaPCM samples */ + ROM_REGION( 0x200000, "pcm", ROMREGION_ERASEFF ) // SegaPCM samples ROM_LOAD( "mpr-13036.107", 0x000000, 0x80000, CRC(7890c26c) SHA1(97e0678bb571de5cf732804f8909e5cbd24980f1) ) ROM_LOAD( "mpr-13035.106", 0x080000, 0x80000, CRC(009fa13e) SHA1(c7b224b471696b12332fc7c403c127b19c297df7) ) ROM_LOAD( "mpr-13034.105", 0x100000, 0x80000, CRC(cd22d95d) SHA1(857aa320df0b3fb44fc8a5526ba5ee82cc74fe63) ) @@ -1947,299 +2184,93 @@ ROM_END -/************************************* - * - * Output callbacks - * - * TODO: kokoroj2 and jpark (SW2) - * - * Additional notes: - * - about jpark: the compression switch is broken/inoperative - * and because of that all piston data, which is in this - * section is frozen. bits x01, x04 and x10 when which == 0 - * (IO chip 0), seem to have something to do with the sensor - * switches we need to fix - *************************************/ +//************************************************************************** +// CONFIGURATION +//************************************************************************** -static void pdrift_output_cb1( UINT16 data ) +//------------------------------------------------- +// init_generic - common initialization +//------------------------------------------------- + +DRIVER_INIT_MEMBER(segaybd_state,generic) { - /* Note: this is an approximation to get a relatively accurate bank value. It is obviously not 100% */ + // allocate a scanline timer + m_scanline_timer = timer_alloc(TID_IRQ2_GEN); - /* for some stupid reason the data is set to all on in the debug menu so we need to check for that */ - if (data != 255) - { - /* this is a cheap hack to get some usable positional data in the service menu */ - /* these values probably manually turn the motor left and right */ - if (((data == 162) || (data == 161) || (data == 160))) - { - if ((data == 162)) - /* moving left */ - { - /* in this rare instance, the bottom bits are used for positional data */ - output_set_value("bank_data_raw", data); - output_set_value("vibration_motor", 0); - switch (pdrift_bank) - /* we want to go left one step at a time */ - { - case 1: - /* all left */ - output_set_value("bank_motor_position", 1); - pdrift_bank = 1; - break; - case 2: - output_set_value("bank_motor_position", 1); - pdrift_bank = 1; - break; - case 3: - output_set_value("bank_motor_position", 2); - pdrift_bank = 2; - break; - case 4: - /* centered */ - output_set_value("bank_motor_position", 3); - pdrift_bank = 3; - break; - case 5: - output_set_value("bank_motor_position", 4); - pdrift_bank = 4; - break; - case 6: - output_set_value("bank_motor_position", 5); - pdrift_bank = 5; - break; - case 7: - /* all right */ - output_set_value("bank_motor_position", 6); - pdrift_bank = 6; - break; - default: - output_set_value("bank_motor_position", 4); - pdrift_bank = 4; - break; + // point globals to allocated memory regions + segaic16_spriteram_0 = reinterpret_cast(memshare("spriteram")->ptr()); + segaic16_spriteram_1 = reinterpret_cast(memshare("spriteram2")->ptr()); + segaic16_paletteram = reinterpret_cast(memshare("paletteram")->ptr()); + segaic16_rotateram_0 = reinterpret_cast(memshare("rotateram")->ptr()); - } - } - - if ((data == 161)) - /* moving right */ - { - /* in this rare instance, the bottom bits are used for positional data */ - output_set_value("bank_data_raw", data); - output_set_value("vibration_motor", 0); - switch (pdrift_bank) - /* we want to go right one step at a time */ - { - case 1: - /* all left */ - output_set_value("bank_motor_position", 2); - pdrift_bank = 2; - break; - case 2: - output_set_value("bank_motor_position", 3); - pdrift_bank = 3; - break; - case 3: - output_set_value("bank_motor_position", 4); - pdrift_bank = 4; - break; - case 4: - /* centered */ - output_set_value("bank_motor_position", 5); - pdrift_bank = 5; - break; - case 5: - output_set_value("bank_motor_position", 6); - pdrift_bank = 6; - break; - case 6: - output_set_value("bank_motor_position", 7); - pdrift_bank = 7; - break; - case 7: - /* all right */ - output_set_value("bank_motor_position", 7); - pdrift_bank = 7; - break; - default: - output_set_value("bank_motor_position", 4); - pdrift_bank = 4; - break; - - } - - } - } - else - { - /* the vibration value uses the first few bits to give a number between 0 and 7 */ - output_set_value("vibration_motor", data & 7); - /* normalize the data and subtract the vibration value from it*/ - - pdrift_bank = (data - (data & 7)); - output_set_value("bank_data_raw", pdrift_bank); - - /* position values from left to right */ - /* 56 48 40 120 72 80 88 */ - - /* the normalized values we'll use */ - /* 1 2 3 4 5 6 7 */ - - switch (pdrift_bank) - { - case 56: - /* all left */ - output_set_value("bank_motor_position", 1); - break; - case 48: - output_set_value("bank_motor_position", 2); - break; - case 40: - output_set_value("bank_motor_position", 3); - break; - case 120: - /* centered */ - output_set_value("bank_motor_position", 4); - break; - case 72: - output_set_value("bank_motor_position", 5); - break; - case 80: - output_set_value("bank_motor_position", 6); - break; - case 88: - /* all right */ - output_set_value("bank_motor_position", 7); - break; - /* these are the only valid values but 24 pops up sometimes when we crash */ - - } - } - } + // save state + save_item(NAME(m_pdrift_bank)); + save_item(NAME(m_analog_data)); + save_item(NAME(m_irq2_scanline)); + save_item(NAME(m_timer_irq_state)); + save_item(NAME(m_vblank_irq_state)); + save_item(NAME(m_misc_io_data)); + save_item(NAME(m_tmp_bitmap)); } -static void gloc_output_cb1( UINT16 data ) -{ - if ((data < 32)) - { - output_set_value("right_motor_position", data); - /* normalization here prevents strange data from being transferred */ - /* we do this because for some odd reason */ - /* gloc starts with one piston all up and one all down.... at least data-wise it does */ - if ((data > 1) && (data < 29)) - output_set_value("right_motor_position_nor", data); - } - - if ((data < 40) && (data > 31)) - output_set_value("right_motor_speed", data - 32); - - if ((data < 96) && (data > 63)) - { - output_set_value("left_motor_position", data); - /* normalized version... you know... for the kids */ - if (((data - 64) > 1) && ((data - 64) < 29)) - output_set_value("left_motor_position_nor", data - 64); - } - - if ((data < 104) && (data > 95)) - output_set_value("left_motor_speed", data - 96); -} - -static void pdrift_output_cb2( UINT16 data ) -{ - output_set_value("start_lamp", BIT(data, 2)); - output_set_value("upright_wheel_motor", BIT(data, 1)); -} - -static void gforce2_output_cb2( UINT16 data ) -{ - output_set_value("start_lamp", BIT(data, 2)); -} - -static void gloc_output_cb2( UINT16 data ) -{ - output_set_value("start_lamp", BIT(data, 2)); - output_set_value("danger_lamp", BIT(data, 5)); - output_set_value("crash_lamp", BIT(data, 6)); -} - -static void r360_output_cb2( UINT16 data ) -{ - /* r360 cabinet */ - output_set_value("start_lamp", BIT(data, 2)); - /* even though the same ouput is used, I've split them to avoid confusion. */ - output_set_value("emergency_stop_lamp", BIT(data, 2)); -} - -static void rchase_output_cb2( UINT16 data ) -{ - output_set_value("left_start_lamp", BIT(data, 2)); - output_set_value("right_start_lamp", BIT(data, 1)); - - output_set_value("P1_Gun_Recoil", BIT(data, 6)); - output_set_value("P2_Gun_Recoil", BIT(data, 5)); -} - -/************************************* - * - * Game-Specific driver initialization - * - *************************************/ +//------------------------------------------------- +// init_* - game-specific initialization +//------------------------------------------------- DRIVER_INIT_MEMBER(segaybd_state,gforce2) { - yboard_generic_init(machine()); - ybd_output_cb2 = gforce2_output_cb2; -} - -DRIVER_INIT_MEMBER(segaybd_state,pdrift) -{ - /* because some of the output data isn't fully understood we need to "center" the motor */ - yboard_generic_init(machine()); - - ybd_output_cb1 = pdrift_output_cb1; - ybd_output_cb2 = pdrift_output_cb2; + DRIVER_INIT_CALL(generic); + m_output_cb2 = output_delegate(FUNC(segaybd_state::gforce2_output_cb2), this); } DRIVER_INIT_MEMBER(segaybd_state,gloc) { - /* because some of the output data isn't fully understood we need to "center" the rams */ + // because some of the output data isn't fully understood we need to "center" the rams + DRIVER_INIT_CALL(generic); + m_output_cb1 = output_delegate(FUNC(segaybd_state::gloc_output_cb1), this); + m_output_cb2 = output_delegate(FUNC(segaybd_state::gloc_output_cb2), this); + output_set_value("left_motor_position_nor", 16); output_set_value("right_motor_position_nor", 16); - yboard_generic_init(machine()); - - ybd_output_cb1 = gloc_output_cb1; - ybd_output_cb2 = gloc_output_cb2; } DRIVER_INIT_MEMBER(segaybd_state,r360) { - yboard_generic_init(machine()); - ybd_output_cb2 = r360_output_cb2; + DRIVER_INIT_CALL(generic); + m_output_cb2 = output_delegate(FUNC(segaybd_state::r360_output_cb2), this); +} + +DRIVER_INIT_MEMBER(segaybd_state,pdrift) +{ + // because some of the output data isn't fully understood we need to "center" the motor + DRIVER_INIT_CALL(generic); + m_output_cb1 = output_delegate(FUNC(segaybd_state::pdrift_output_cb1), this); + m_output_cb2 = output_delegate(FUNC(segaybd_state::pdrift_output_cb2), this); } DRIVER_INIT_MEMBER(segaybd_state,rchase) { - yboard_generic_init(machine()); - ybd_output_cb2 = rchase_output_cb2; + DRIVER_INIT_CALL(generic); + m_output_cb2 = output_delegate(FUNC(segaybd_state::rchase_output_cb2), this); } -/************************************* - * - * Game driver(s) - * - *************************************/ -// YEAR, NAME, PARENT, MACHINE,INPUT, INIT, MONITOR,COMPANY,FULLNAME,FLAGS, LAYOUT -GAME( 1988, gforce2, 0, yboard, gforce2, segaybd_state, gforce2, ROT0, "Sega", "Galaxy Force 2", GAME_SUPPORTS_SAVE ) -GAME( 1988, gforce2j, gforce2, yboard, gforce2, segaybd_state, gforce2, ROT0, "Sega", "Galaxy Force 2 (Japan)", GAME_SUPPORTS_SAVE ) -GAME( 1988, gforce2ja, gforce2, yboard, gforce2, segaybd_state, gforce2, ROT0, "Sega", "Galaxy Force 2 (Japan, Rev A)", GAME_SUPPORTS_SAVE ) -GAME( 1990, gloc, 0, yboard, gloc, segaybd_state, gloc, ROT0, "Sega", "G-LOC Air Battle (US)", GAME_SUPPORTS_SAVE ) + +//************************************************************************** +// GAME DRIVERS +//************************************************************************** + +// YEAR, NAME, PARENT, MACHINE,INPUT, INIT, MONITOR,COMPANY,FULLNAME,FLAGS, LAYOUT +GAME( 1988, gforce2, 0, yboard, gforce2, segaybd_state, gforce2, ROT0, "Sega", "Galaxy Force 2", GAME_SUPPORTS_SAVE ) +GAME( 1988, gforce2j, gforce2, yboard, gforce2, segaybd_state, gforce2, ROT0, "Sega", "Galaxy Force 2 (Japan)", GAME_SUPPORTS_SAVE ) +GAME( 1988, gforce2ja, gforce2, yboard, gforce2, segaybd_state, gforce2, ROT0, "Sega", "Galaxy Force 2 (Japan, Rev A)", GAME_SUPPORTS_SAVE ) +GAME( 1990, gloc, 0, yboard, gloc, segaybd_state, gloc, ROT0, "Sega", "G-LOC Air Battle (US)", GAME_SUPPORTS_SAVE ) GAME( 1990, glocr360, gloc, yboard, glocr360, segaybd_state, r360, ROT0, "Sega", "G-LOC R360", GAME_SUPPORTS_SAVE ) -GAMEL(1988, pdrift, 0, yboard, pdrift, segaybd_state, pdrift, ROT0, "Sega", "Power Drift (World, Rev A)", GAME_SUPPORTS_SAVE, layout_pdrift ) -GAMEL(1988, pdrifta, pdrift, yboard, pdrift, segaybd_state, pdrift, ROT0, "Sega", "Power Drift (World)", GAME_SUPPORTS_SAVE, layout_pdrift ) -GAMEL(1988, pdrifte, pdrift, yboard, pdrifte, segaybd_state, pdrift, ROT0, "Sega", "Power Drift (World, Earlier)", GAME_SUPPORTS_SAVE, layout_pdrift ) -GAMEL(1988, pdriftj, pdrift, yboard, pdriftj, segaybd_state, pdrift, ROT0, "Sega", "Power Drift (Japan)", GAME_SUPPORTS_SAVE, layout_pdrift ) -GAME( 1991, rchase, 0, yboard, rchase, segaybd_state, rchase, ROT0, "Sega", "Rail Chase (World)", GAME_SUPPORTS_SAVE ) -GAME( 1991, rchasej, rchase, yboard, rchase, segaybd_state, rchase, ROT0, "Sega", "Rail Chase (Japan)", GAME_SUPPORTS_SAVE ) +GAMEL(1988, pdrift, 0, yboard, pdrift, segaybd_state, pdrift, ROT0, "Sega", "Power Drift (World, Rev A)", GAME_SUPPORTS_SAVE, layout_pdrift ) +GAMEL(1988, pdrifta, pdrift, yboard, pdrift, segaybd_state, pdrift, ROT0, "Sega", "Power Drift (World)", GAME_SUPPORTS_SAVE, layout_pdrift ) +GAMEL(1988, pdrifte, pdrift, yboard, pdrifte, segaybd_state, pdrift, ROT0, "Sega", "Power Drift (World, Earlier)", GAME_SUPPORTS_SAVE, layout_pdrift ) +GAMEL(1988, pdriftj, pdrift, yboard, pdriftj, segaybd_state, pdrift, ROT0, "Sega", "Power Drift (Japan)", GAME_SUPPORTS_SAVE, layout_pdrift ) +GAME( 1991, rchase, 0, yboard, rchase, segaybd_state, rchase, ROT0, "Sega", "Rail Chase (World)", GAME_SUPPORTS_SAVE ) +GAME( 1991, rchasej, rchase, yboard, rchase, segaybd_state, rchase, ROT0, "Sega", "Rail Chase (Japan)", GAME_SUPPORTS_SAVE ) GAME( 1991, strkfgtr, 0, yboard, strkfgtr, segaybd_state, gloc, ROT0, "Sega", "Strike Fighter (Japan)", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/includes/segaybd.h b/src/mame/includes/segaybd.h index 7a6f2d448b7..08e87334e2e 100644 --- a/src/mame/includes/segaybd.h +++ b/src/mame/includes/segaybd.h @@ -52,36 +52,87 @@ public: m_maincpu(*this, "maincpu"), m_subx(*this, "subx"), m_suby(*this, "suby"), - m_soundcpu(*this, "soundcpu") + m_soundcpu(*this, "soundcpu"), + m_pdrift_bank(0), + m_scanline_timer(NULL), + m_irq2_scanline(0), + m_timer_irq_state(0), + m_vblank_irq_state(0), + m_tmp_bitmap(512, 512) { memset(m_analog_data, 0, sizeof(m_analog_data)); memset(m_misc_io_data, 0, sizeof(m_misc_io_data)); } -//protected: + // YM2151 chip callbacks + WRITE_LINE_MEMBER( sound_cpu_irq ); + + // main CPU read/write handlers + READ16_MEMBER( analog_r ); + WRITE16_MEMBER( analog_w ); + READ16_MEMBER( io_chip_r ); + WRITE16_MEMBER( io_chip_w ); + WRITE16_MEMBER( sound_data_w ); + + // sound Z80 CPU read/write handlers + READ8_MEMBER( sound_data_r ); + + // game-specific output handlers + void gforce2_output_cb2(UINT16 data); + void gloc_output_cb1(UINT16 data); + void gloc_output_cb2(UINT16 data); + void r360_output_cb2(UINT16 data); + void pdrift_output_cb1(UINT16 data); + void pdrift_output_cb2(UINT16 data); + void rchase_output_cb2(UINT16 data); + + // game-specific driver init + DECLARE_DRIVER_INIT(generic); + DECLARE_DRIVER_INIT(pdrift); + DECLARE_DRIVER_INIT(r360); + DECLARE_DRIVER_INIT(gforce2); + DECLARE_DRIVER_INIT(rchase); + DECLARE_DRIVER_INIT(gloc); + + // video updates + UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + +protected: + // internal types + typedef delegate output_delegate; + + // timer IDs + enum + { + TID_IRQ2_GEN, + TID_SOUND_WRITE + }; + + // device overrides + virtual void machine_reset(); + virtual void video_start(); + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr); + + // internal helpers + void update_irqs(); + // devices required_device m_maincpu; required_device m_subx; required_device m_suby; required_device m_soundcpu; + // configuration + output_delegate m_output_cb1; + output_delegate m_output_cb2; + // internal state + UINT16 m_pdrift_bank; emu_timer * m_scanline_timer; UINT8 m_analog_data[4]; int m_irq2_scanline; UINT8 m_timer_irq_state; UINT8 m_vblank_irq_state; UINT8 m_misc_io_data[0x10]; - bitmap_ind16 * m_tmp_bitmap; - DECLARE_DRIVER_INIT(pdrift); - DECLARE_DRIVER_INIT(r360); - DECLARE_DRIVER_INIT(gforce2); - DECLARE_DRIVER_INIT(rchase); - DECLARE_DRIVER_INIT(gloc); + bitmap_ind16 m_tmp_bitmap; }; - - -/*----------- defined in video/segaybd.c -----------*/ - -VIDEO_START( yboard ); -SCREEN_UPDATE_IND16( yboard ); diff --git a/src/mame/video/segaxbd.c b/src/mame/video/segaxbd.c index a28ea0ef1ab..36a83a8b726 100644 --- a/src/mame/video/segaxbd.c +++ b/src/mame/video/segaxbd.c @@ -58,7 +58,7 @@ void segaxbd_state::video_start() //************************************************************************** -// VIDEO STARTUP +// VIDEO UPDATE //************************************************************************** UINT32 segaxbd_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) diff --git a/src/mame/video/segaybd.c b/src/mame/video/segaybd.c index 3a65b2b2bfb..f48b9014741 100644 --- a/src/mame/video/segaybd.c +++ b/src/mame/video/segaybd.c @@ -39,56 +39,42 @@ #include "includes/segaybd.h" -/************************************* - * - * Video startup - * - *************************************/ +//************************************************************************** +// VIDEO STARTUP +//************************************************************************** -VIDEO_START( yboard ) +void segaybd_state::video_start() { - segaybd_state *state = machine.driver_data(); - - /* compute palette info */ + // compute palette info segaic16_palette_init(0x2000); - /* allocate a bitmap for the yboard layer */ - state->m_tmp_bitmap = auto_bitmap_ind16_alloc(machine, 512, 512); - - /* initialize the rotation layer */ - segaic16_rotate_init(machine, 0, SEGAIC16_ROTATE_YBOARD, 0x000); - - state->save_item(NAME(*state->m_tmp_bitmap)); + // initialize the rotation layer + segaic16_rotate_init(machine(), 0, SEGAIC16_ROTATE_YBOARD, 0x000); } -/************************************* - * - * Video update - * - *************************************/ +//************************************************************************** +// VIDEO UPDATE +//************************************************************************** -SCREEN_UPDATE_IND16( yboard ) +UINT32 segaybd_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - segaybd_state *state = screen.machine().driver_data(); - rectangle yboard_clip; - - /* if no drawing is happening, fill with black and get out */ + // if no drawing is happening, fill with black and get out if (!segaic16_display_enable) { - bitmap.fill(get_black_pen(screen.machine()), cliprect); + bitmap.fill(get_black_pen(machine()), cliprect); return 0; } - /* draw the yboard sprites */ - yboard_clip.set(0, 511, 0, 511); - segaic16_sprites_draw(screen, *state->m_tmp_bitmap, yboard_clip, 1); + // draw the yboard sprites + rectangle yboard_clip(0, 511, 0, 511); + segaic16_sprites_draw(screen, m_tmp_bitmap, yboard_clip, 1); - /* apply rotation */ - segaic16_rotate_draw(screen.machine(), 0, bitmap, cliprect, state->m_tmp_bitmap); + // apply rotation + segaic16_rotate_draw(machine(), 0, bitmap, cliprect, &m_tmp_bitmap); - /* draw the 16B sprites */ + // draw the 16B sprites segaic16_sprites_draw(screen, bitmap, cliprect, 0); return 0; }