From d7715eee0d8c4e8233153857e8c120c12b99f568 Mon Sep 17 00:00:00 2001 From: davidhay Date: Sat, 19 Jul 2008 12:03:31 +0000 Subject: [PATCH] merged CPU0 and 1 memory maps in flower, improved interrupt generation, fix for 01472 --- src/mame/drivers/flower.c | 49 ++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 27 deletions(-) diff --git a/src/mame/drivers/flower.c b/src/mame/drivers/flower.c index 6d92d250cc2..10346b9a05e 100644 --- a/src/mame/drivers/flower.c +++ b/src/mame/drivers/flower.c @@ -85,40 +85,30 @@ static WRITE8_HANDLER( sound_command_w ) cpunum_set_input_line(machine, 2, INPUT_LINE_NMI, PULSE_LINE); } -static ADDRESS_MAP_START( flower_cpu1, ADDRESS_SPACE_PROGRAM, 8 ) +static ADDRESS_MAP_START( flower_cpu1_2, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0xa000, 0xa000) AM_WRITENOP //watchdog? AM_RANGE(0xa001, 0xa001) AM_WRITE(flower_flipscreen_w) AM_RANGE(0xa002, 0xa002) AM_WRITE(flower_irq_ack) //irq ack / enable, maybe? - AM_RANGE(0xa004, 0xa004) AM_WRITENOP //nmi enable (routine is empty) - AM_RANGE(0xa102, 0xa102) AM_READ(input_port_0_r) - AM_RANGE(0xa103, 0xa103) AM_READ(input_port_1_r) - AM_RANGE(0xc000, 0xddff) AM_RAM AM_SHARE(1) - AM_RANGE(0xde00, 0xdfff) AM_RAM AM_SHARE(2) AM_BASE(&spriteram) - AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(flower_textram_w) AM_SHARE(3) AM_BASE(&flower_textram) - AM_RANGE(0xe000, 0xefff) AM_RAM //only cleared? - AM_RANGE(0xf000, 0xf1ff) AM_RAM_WRITE(flower_bg0ram_w) AM_SHARE(4) AM_BASE(&flower_bg0ram) - AM_RANGE(0xf200, 0xf200) AM_RAM AM_SHARE(5) AM_BASE(&flower_bg0_scroll) - AM_RANGE(0xf800, 0xf9ff) AM_RAM_WRITE(flower_bg1ram_w) AM_SHARE(6) AM_BASE(&flower_bg1ram) - AM_RANGE(0xfa00, 0xfa00) AM_RAM AM_SHARE(7) AM_BASE(&flower_bg1_scroll) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( flower_cpu2, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0x7fff) AM_ROM AM_RANGE(0xa003, 0xa003) AM_WRITENOP //irq enable AM_RANGE(0xa005, 0xa005) AM_WRITENOP //nmi enable (routine is empty) + AM_RANGE(0xa004, 0xa004) AM_WRITENOP //nmi enable (routine is empty) AM_RANGE(0xa100, 0xa100) AM_READ(input_port_2_r) AM_RANGE(0xa101, 0xa101) AM_READ(input_port_3_r) + AM_RANGE(0xa102, 0xa102) AM_READ(input_port_0_r) + AM_RANGE(0xa103, 0xa103) AM_READ(input_port_1_r) AM_RANGE(0xa400, 0xa400) AM_WRITE(sound_command_w) - AM_RANGE(0xc000, 0xddff) AM_RAM AM_SHARE(1) - AM_RANGE(0xde00, 0xdfff) AM_RAM AM_SHARE(2) - AM_RANGE(0xe000, 0xe7ff) AM_RAM_WRITE(flower_textram_w) AM_SHARE(3) - AM_RANGE(0xf000, 0xf1ff) AM_RAM_WRITE(flower_bg0ram_w) AM_SHARE(4) - AM_RANGE(0xf200, 0xf200) AM_RAM AM_SHARE(5) - AM_RANGE(0xf800, 0xf9ff) AM_RAM_WRITE(flower_bg1ram_w) AM_SHARE(6) - AM_RANGE(0xfa00, 0xfa00) AM_RAM AM_SHARE(7) + AM_RANGE(0xc000, 0xddff) AM_SHARE(1) AM_RAM + AM_RANGE(0xde00, 0xdfff) AM_SHARE(2) AM_RAM AM_BASE(&spriteram) + AM_RANGE(0xe000, 0xe7ff) AM_SHARE(3) AM_RAM_WRITE(flower_textram_w) AM_BASE(&flower_textram) + AM_RANGE(0xe000, 0xefff) AM_SHARE(4) AM_RAM //only cleared? + AM_RANGE(0xf000, 0xf1ff) AM_SHARE(5) AM_RAM_WRITE(flower_bg0ram_w) AM_BASE(&flower_bg0ram) + AM_RANGE(0xf200, 0xf200) AM_SHARE(6) AM_RAM AM_BASE(&flower_bg0_scroll) + AM_RANGE(0xf800, 0xf9ff) AM_SHARE(7) AM_RAM_WRITE(flower_bg1ram_w) AM_BASE(&flower_bg1ram) + AM_RANGE(0xfa00, 0xfa00) AM_SHARE(8) AM_RAM AM_BASE(&flower_bg1_scroll) ADDRESS_MAP_END + static ADDRESS_MAP_START( flower_sound_cpu, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x3fff) AM_ROM AM_RANGE(0x4000, 0x4000) AM_WRITE(sn_irq_enable_w) AM_BASE(&sn_irq_enable) @@ -230,16 +220,21 @@ static const struct CustomSound_interface custom_interface = flower_sh_start }; +static INTERRUPT_GEN( flower_cpu0_interrupt ) +{ + cpunum_set_input_line(machine, 0, 0, ASSERT_LINE); +} + static MACHINE_DRIVER_START( flower ) /* basic machine hardware */ MDRV_CPU_ADD("main", Z80,8000000) - MDRV_CPU_PROGRAM_MAP(flower_cpu1,0) - MDRV_CPU_VBLANK_INT_HACK(irq0_line_hold,10) -// MDRV_CPU_VBLANK_INT("main", nmi_line_pulse) //nmis stuff up the writes to shared ram + MDRV_CPU_PROGRAM_MAP(flower_cpu1_2,0) +// MDRV_CPU_VBLANK_INT_HACK(flower_cpu0_interrupt,10) + MDRV_CPU_VBLANK_INT("main", flower_cpu0_interrupt) //nmis stuff up the writes to shared ram MDRV_CPU_ADD("sub", Z80,8000000) - MDRV_CPU_PROGRAM_MAP(flower_cpu2,0) + MDRV_CPU_PROGRAM_MAP(flower_cpu1_2,0) MDRV_CPU_VBLANK_INT("main", irq0_line_hold) // MDRV_CPU_VBLANK_INT("main", nmi_line_pulse)