diff --git a/src/mame/drivers/arabian.c b/src/mame/drivers/arabian.c index 01d684c3773..57b85aa7329 100644 --- a/src/mame/drivers/arabian.c +++ b/src/mame/drivers/arabian.c @@ -8,8 +8,7 @@ * Arabian [2 sets] Known bugs: - * The large blue bird is missing (see MT 03916). - * The game doesn't work properly when the MCU is emulated. Bad ROM? + * none at this time **************************************************************************** @@ -41,30 +40,6 @@ IRQ generated by VBLANK ======================================================================== - ======================================================================== - CPU #1 (Kangaroo) - ======================================================================== - 0000-7FFF R xxxxxxxx Program ROM - 8000-BFFF R/W xxxxxxxx Bitmap RAM - C000 R ----xxxx Coin inputs - C200 R ----xxxx Option switches - D000-DFFF R/W xxxxxxxx Custom microprocessor RAM - E000 W ----xxxx BSEL Bank select - E001 W xxxxxxxx DMA ROM start address low - E002 W xxxxxxxx DMA ROM start address high - E003 W xxxxxxxx DMA RAM start address low - E004 W xxxxxxxx DMA RAM start address high - E005 W xxxxxxxx Picture size/DMA start low - E006 W xxxxxxxx Picture size/DMA start high - ======================================================================== - C800 W xxxxxxxx Sound chip address - CA00 R/W xxxxxxxx Sound chip data - ======================================================================== - Interrupts: - NMI not connected - IRQ generated by VBLANK - ======================================================================== - ***************************************************************************/ #include "emu.h" @@ -75,7 +50,6 @@ /* constants */ #define MAIN_OSC XTAL_12MHz -#define SIMULATE_MCU 1 /************************************* @@ -101,8 +75,6 @@ static WRITE8_DEVICE_HANDLER( ay8910_porta_w ) static WRITE8_DEVICE_HANDLER( ay8910_portb_w ) { - arabian_state *state = device->machine->driver_data(); - /* bit 5 = /IREQ to custom CPU bit 4 = /SRES to custom CPU @@ -110,13 +82,8 @@ static WRITE8_DEVICE_HANDLER( ay8910_portb_w ) bit 0 = coin 1 counter */ - /* track the custom CPU reset */ - state->custom_cpu_reset = ~data & 0x10; - -#if !SIMULATE_MCU cputag_set_input_line(device->machine, "mcu", MB88_IRQ_LINE, data & 0x20 ? CLEAR_LINE : ASSERT_LINE); cputag_set_input_line(device->machine, "mcu", INPUT_LINE_RESET, data & 0x10 ? CLEAR_LINE : ASSERT_LINE); -#endif /* clock the coin counters */ coin_counter_w(device->machine, 1, ~data & 0x02); @@ -127,101 +94,10 @@ static WRITE8_DEVICE_HANDLER( ay8910_portb_w ) /************************************* * - * Custom CPU RAM snooping + * Custom CPU (MB8841 MCU) * *************************************/ -#if SIMULATE_MCU -static READ8_HANDLER( custom_cpu_r ) -{ - arabian_state *state = space->machine->driver_data(); - /* since we don't have a simulator for the Fujitsu 8841 4-bit microprocessor */ - /* we have to simulate its behavior; it looks like Arabian reads out of the */ - /* alternate CPU's RAM space while the CPU is running. If the CPU is not */ - /* running (i.e., the /SRES line is low), it needs to look like RAM to pass */ - /* the self-tests */ - static const char *const comnames[] = { "COM0", "COM1", "COM2", "COM3", "COM4", "COM5" }; - - /* if the CPU reset line is being held down, just return RAM */ - if (state->custom_cpu_reset) - return state->custom_cpu_ram[0x7f0 + offset]; - - /* otherwise, assume the custom CPU is live */ - switch (offset) - { - /* 4-bit input ports from the custom */ - case 0: - case 1: - case 2: - case 3: - case 4: - case 5: - return input_port_read(space->machine, comnames[offset]); - - /* busy flag; this is polled to check the custom CPU's readiness */ - /* we just toggle it on and off until the main CPU gets the result */ - /* it wants. There appears to be a number of different ways to make */ - /* the custom turn this on. */ - case 6: - return state->custom_cpu_busy ^= 1; - - /* handshake read; the main CPU writes to the previous memory location */ - /* and waits for the custom to copy that value here */ - case 8: - return state->custom_cpu_ram[0x7f0 + offset - 1]; - - /* error cases */ - default: - logerror("Input Port %04X read. PC = %04X\n", offset + 0xd7f0, cpu_get_pc(space->cpu)); - } - return 0; -} - -static WRITE8_HANDLER( custom_cpu_w ) -{ - arabian_state *state = space->machine->driver_data(); - - state->custom_cpu_ram[0x7f0 + offset] = data; -} - - -static void update_flip_state( running_machine *machine ) -{ - arabian_state *state = machine->driver_data(); - - /* the custom CPU also controls the video flip control line; unfortunately, */ - /* it appears that the custom is smart enough to flip the screen itself, based */ - /* on the information stored at $d400 and $d401. The value at $d400 specifies */ - /* the active player number, and the value at $d401 is a copy of the input */ - /* port from $c200. Also, the value at $d34b controls the global flip screen */ - /* state. */ - - /* initial state is based on the flip screen flag */ - state->flip_screen = state->custom_cpu_ram[0x34b]; - - /* flip if not player 1 and cocktail mode */ - if (state->custom_cpu_ram[0x400] != 0 && !(state->custom_cpu_ram[0x401] & 0x02)) - state->flip_screen = !state->flip_screen; -} - - -static WRITE8_HANDLER( custom_flip_w ) -{ - arabian_state *state = space->machine->driver_data(); - - state->custom_cpu_ram[0x34b + offset] = data; - update_flip_state(space->machine); -} - - -static WRITE8_HANDLER( custom_cocktail_w ) -{ - arabian_state *state = space->machine->driver_data(); - - state->custom_cpu_ram[0x400 + offset] = data; - update_flip_state(space->machine); -} -#else static READ8_HANDLER( mcu_port_r_r ) { arabian_state *state = space->machine->driver_data(); @@ -297,7 +173,7 @@ static WRITE8_HANDLER( mcu_port_p_w ) arabian_state *state = space->machine->driver_data(); state->mcu_port_p = data & 0x0f; } -#endif + /************************************* @@ -311,12 +187,7 @@ static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x8000, 0xbfff) AM_WRITE(arabian_videoram_w) AM_RANGE(0xc000, 0xc000) AM_MIRROR(0x01ff) AM_READ_PORT("IN0") AM_RANGE(0xc200, 0xc200) AM_MIRROR(0x01ff) AM_READ_PORT("DSW1") -#if SIMULATE_MCU - AM_RANGE(0xd000, 0xd7ef) AM_RAM AM_BASE_MEMBER(arabian_state, custom_cpu_ram) - AM_RANGE(0xd7f0, 0xd7ff) AM_READWRITE(custom_cpu_r, custom_cpu_w) -#else AM_RANGE(0xd000, 0xd7ff) AM_MIRROR(0x0800) AM_RAM AM_BASE_MEMBER(arabian_state, custom_cpu_ram) -#endif AM_RANGE(0xe000, 0xe007) AM_MIRROR(0x0ff8) AM_WRITE(arabian_blitter_w) AM_BASE_MEMBER(arabian_state, blitter) ADDRESS_MAP_END @@ -340,14 +211,14 @@ ADDRESS_MAP_END * MCU port handlers * *************************************/ -#if !SIMULATE_MCU + static ADDRESS_MAP_START( mcu_io_map, ADDRESS_SPACE_IO, 8 ) AM_RANGE(MB88_PORTK, MB88_PORTK ) AM_READ(mcu_portk_r) AM_RANGE(MB88_PORTO, MB88_PORTO ) AM_WRITE(mcu_port_o_w) AM_RANGE(MB88_PORTP, MB88_PORTP ) AM_WRITE(mcu_port_p_w) AM_RANGE(MB88_PORTR0, MB88_PORTR3) AM_READWRITE(mcu_port_r_r, mcu_port_r_w) ADDRESS_MAP_END -#endif + /************************************* @@ -479,18 +350,16 @@ static MACHINE_START( arabian ) { arabian_state *state = machine->driver_data(); - state_save_register_global(machine, state->custom_cpu_reset); - state_save_register_global(machine, state->custom_cpu_busy); + state_save_register_global(machine, state->mcu_port_o); + state_save_register_global(machine, state->mcu_port_p); + state_save_register_global_array(machine, state->mcu_port_r); } static MACHINE_RESET( arabian ) { arabian_state *state = machine->driver_data(); - state->custom_cpu_reset = 0; - state->custom_cpu_busy = 0; state->video_control = 0; - state->flip_screen = 0; } static MACHINE_CONFIG_START( arabian, arabian_state ) @@ -501,10 +370,8 @@ static MACHINE_CONFIG_START( arabian, arabian_state ) MDRV_CPU_IO_MAP(main_io_map) MDRV_CPU_VBLANK_INT("screen", irq0_line_hold) -#if !SIMULATE_MCU - MDRV_CPU_ADD("mcu", MB8841, MAIN_OSC/3/2) - MDRV_CPU_IO_MAP(mcu_io_map) -#endif + MDRV_CPU_ADD("mcu", MB8841, MAIN_OSC/3/2) + MDRV_CPU_IO_MAP(mcu_io_map) MDRV_MACHINE_START(arabian) MDRV_MACHINE_RESET(arabian) @@ -552,7 +419,7 @@ ROM_START( arabian ) ROM_LOAD( "tvg-94.ic87", 0x6000, 0x2000, CRC(82160b9a) SHA1(03511f6ebcf22ba709a80a565e71acf5bdecbabb) ) ROM_REGION( 0x800, "mcu", 0 ) - ROM_LOAD( "sun-8212.ic3", 0x000, 0x800, BAD_DUMP CRC(8869611e) SHA1(c6443f3bcb0cdb4d7b1b19afcbfe339c300f36aa) ) + ROM_LOAD( "sun-8212.ic3", 0x000, 0x800, CRC(8869611e) SHA1(c6443f3bcb0cdb4d7b1b19afcbfe339c300f36aa) ) ROM_END @@ -570,7 +437,7 @@ ROM_START( arabiana ) ROM_LOAD( "tvg-94.ic87", 0x6000, 0x2000, CRC(82160b9a) SHA1(03511f6ebcf22ba709a80a565e71acf5bdecbabb) ) ROM_REGION( 0x800, "mcu", 0 ) - ROM_LOAD( "sun-8212.ic3", 0x000, 0x800, BAD_DUMP CRC(8869611e) SHA1(c6443f3bcb0cdb4d7b1b19afcbfe339c300f36aa) ) + ROM_LOAD( "sun-8212.ic3", 0x000, 0x800, CRC(8869611e) SHA1(c6443f3bcb0cdb4d7b1b19afcbfe339c300f36aa) ) ROM_END @@ -583,12 +450,7 @@ ROM_END static DRIVER_INIT( arabian ) { -#if SIMULATE_MCU - memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xd34b, 0xd34b, 0, 0, custom_flip_w); - memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xd400, 0xd401, 0, 0, custom_cocktail_w); -#else cputag_set_input_line(machine, "mcu", INPUT_LINE_RESET, ASSERT_LINE); -#endif } diff --git a/src/mame/includes/arabian.h b/src/mame/includes/arabian.h index fd5518d9aab..fb26633ffec 100644 --- a/src/mame/includes/arabian.h +++ b/src/mame/includes/arabian.h @@ -23,10 +23,7 @@ public: UINT8 video_control; UINT8 flip_screen; - /* misc */ - UINT8 custom_cpu_reset; - UINT8 custom_cpu_busy; - + /* MCU */ UINT8 mcu_port_o; UINT8 mcu_port_p; UINT8 mcu_port_r[4];