From 6821949f5126b615898d161cdd2fbb33c4ca1343 Mon Sep 17 00:00:00 2001 From: Couriersud Date: Thu, 13 May 2010 10:52:11 +0000 Subject: [PATCH] Fixed MT 03482. [M.A.S.H., Couriersud] Changed hunchbkg to use all galaxian hardware memory i/o and interrupt and vblank logic. [Couriersud] --- src/mame/drivers/galaxold.c | 42 +++++++++++++----------------------- src/mame/includes/galaxold.h | 1 + src/mame/machine/galaxold.c | 22 ++++++++++++++++++- 3 files changed, 37 insertions(+), 28 deletions(-) diff --git a/src/mame/drivers/galaxold.c b/src/mame/drivers/galaxold.c index f21d3969ff7..208ee6e5291 100644 --- a/src/mame/drivers/galaxold.c +++ b/src/mame/drivers/galaxold.c @@ -796,23 +796,26 @@ static ADDRESS_MAP_START( harem_cpu2_io, ADDRESS_SPACE_IO, 8 ) AM_RANGE(0x80, 0x80) AM_READ(soundlatch_r) ADDRESS_MAP_END - static ADDRESS_MAP_START( hunchbkg, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x0fff) AM_ROM AM_RANGE(0x1480, 0x14bf) AM_MIRROR(0x6000) AM_RAM_WRITE(galaxold_attributesram_w) AM_BASE(&galaxold_attributesram) AM_RANGE(0x14c0, 0x14ff) AM_MIRROR(0x6000) AM_WRITEONLY AM_BASE(&galaxold_spriteram) AM_SIZE(&galaxold_spriteram_size) AM_RANGE(0x1500, 0x1500) AM_MIRROR(0x6000) AM_READ_PORT("IN0") + AM_RANGE(0x1500, 0x1501) AM_MIRROR(0x6000) AM_WRITE(galaxold_leds_w) /* not connected ... */ + AM_RANGE(0x1502, 0x1502) AM_MIRROR(0x6000) AM_WRITE(galaxold_coin_lockout_w) /* not connected ... */ AM_RANGE(0x1503, 0x1503) AM_MIRROR(0x6000) AM_WRITE(galaxold_coin_counter_w) + AM_RANGE(0x1504, 0x1507) AM_MIRROR(0x6000) AM_DEVWRITE(GAL_AUDIO, galaxian_lfo_freq_w) AM_RANGE(0x1580, 0x1580) AM_MIRROR(0x6000) AM_READ_PORT("IN1") - AM_RANGE(0x1580, 0x1582) AM_MIRROR(0x6000) AM_DEVWRITE(GAL_AUDIO, galaxian_background_enable_w) - AM_RANGE(0x1583, 0x1583) AM_MIRROR(0x6000) AM_WRITENOP - AM_RANGE(0x1584, 0x1587) AM_MIRROR(0x6000) AM_DEVWRITE(GAL_AUDIO, galaxian_lfo_freq_w) + AM_RANGE(0x1580, 0x1587) AM_MIRROR(0x6000) AM_DEVWRITE(GAL_AUDIO, galaxian_sound_w) + AM_RANGE(0x1583, 0x1583) AM_MIRROR(0x6000) AM_DEVWRITE(GAL_AUDIO, galaxian_noise_enable_w) + AM_RANGE(0x1585, 0x1585) AM_MIRROR(0x6000) AM_DEVWRITE(GAL_AUDIO, galaxian_shoot_enable_w) + AM_RANGE(0x1586, 0x1587) AM_MIRROR(0x6000) AM_DEVWRITE(GAL_AUDIO, galaxian_vol_w) AM_RANGE(0x1600, 0x1600) AM_MIRROR(0x6000) AM_READ_PORT("DSW0") - AM_RANGE(0x1600, 0x1601) AM_MIRROR(0x6000) AM_WRITENOP - AM_RANGE(0x1604, 0x1604) AM_MIRROR(0x6000) AM_WRITENOP + AM_RANGE(0x1601, 0x1601) AM_MIRROR(0x6000) AM_WRITE(galaxold_nmi_enable_w) + AM_RANGE(0x1604, 0x1604) AM_MIRROR(0x6000) AM_WRITE(galaxold_stars_enable_w) AM_RANGE(0x1606, 0x1606) AM_MIRROR(0x6000) AM_WRITE(galaxold_flip_screen_x_w) AM_RANGE(0x1607, 0x1607) AM_MIRROR(0x6000) AM_WRITE(galaxold_flip_screen_y_w) - AM_RANGE(0x1680, 0x1680) AM_MIRROR(0x6000) AM_READNOP AM_DEVWRITE(GAL_AUDIO, galaxian_pitch_w) + AM_RANGE(0x1680, 0x1680) AM_MIRROR(0x6000) AM_READ(watchdog_reset_r) AM_DEVWRITE(GAL_AUDIO, galaxian_pitch_w) AM_RANGE(0x1800, 0x1bff) AM_MIRROR(0x6000) AM_WRITE(galaxold_videoram_w) AM_BASE(&galaxold_videoram) AM_RANGE(0x1c00, 0x1fff) AM_MIRROR(0x6000) AM_RAM AM_RANGE(0x2000, 0x2fff) AM_ROM @@ -820,9 +823,10 @@ static ADDRESS_MAP_START( hunchbkg, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x6000, 0x6fff) AM_ROM ADDRESS_MAP_END +/* the nmi line seems to be inverted on the cpu plugin board */ static ADDRESS_MAP_START( hunchbkg_io, ADDRESS_SPACE_IO, 8 ) AM_RANGE(S2650_DATA_PORT, S2650_DATA_PORT) AM_READNOP // not used - AM_RANGE(S2650_SENSE_PORT, S2650_SENSE_PORT) AM_READ_PORT("SENSE") + AM_RANGE(S2650_SENSE_PORT, S2650_SENSE_PORT) AM_DEVREAD("7474_9m_1", ttl7474_output_comp_r) ADDRESS_MAP_END @@ -1791,9 +1795,6 @@ static INPUT_PORTS_START( hunchbkg ) PORT_DIPNAME( 0x80, 0x00, DEF_STR( Unknown ) ) PORT_DIPSETTING( 0x00, DEF_STR( Off ) ) PORT_DIPSETTING( 0x80, DEF_STR( On ) ) - - PORT_START("SENSE") - PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK ) INPUT_PORTS_END @@ -2342,25 +2343,12 @@ MACHINE_DRIVER_END static MACHINE_DRIVER_START( hunchbkg ) /* basic machine hardware */ - MDRV_CPU_ADD("maincpu", S2650, PIXEL_CLOCK/2) + MDRV_IMPORT_FROM(galaxold_base) + MDRV_CPU_REPLACE("maincpu", S2650, PIXEL_CLOCK / 4) MDRV_CPU_PROGRAM_MAP(hunchbkg) MDRV_CPU_IO_MAP(hunchbkg_io) - MDRV_CPU_VBLANK_INT("screen", hunchbks_vh_interrupt) - MDRV_GFXDECODE(galaxian) - MDRV_PALETTE_LENGTH(32+2+64) /* 32 for the characters, 2 for the bullets, 64 for the stars */ - - MDRV_SCREEN_ADD("screen", RASTER) - MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) - MDRV_SCREEN_RAW_PARAMS(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART) - - MDRV_PALETTE_INIT(galaxold) - - MDRV_VIDEO_UPDATE(galaxold) - MDRV_VIDEO_START(galaxold_plain) - - /* sound hardware */ - MDRV_SPEAKER_STANDARD_MONO("mono") + MDRV_MACHINE_RESET(hunchbkg) MDRV_IMPORT_FROM(galaxian_audio) MACHINE_DRIVER_END diff --git a/src/mame/includes/galaxold.h b/src/mame/includes/galaxold.h index a58f79774a3..122aab2e623 100644 --- a/src/mame/includes/galaxold.h +++ b/src/mame/includes/galaxold.h @@ -110,6 +110,7 @@ WRITE8_HANDLER( galaxold_nmi_enable_w ); MACHINE_RESET( galaxold ); MACHINE_RESET( devilfsg ); +MACHINE_RESET( hunchbkg ); WRITE8_HANDLER( galaxold_coin_lockout_w ); WRITE8_HANDLER( galaxold_coin_counter_w ); diff --git a/src/mame/machine/galaxold.c b/src/mame/machine/galaxold.c index 65dcc1c029d..30d408357cc 100644 --- a/src/mame/machine/galaxold.c +++ b/src/mame/machine/galaxold.c @@ -16,6 +16,21 @@ static running_device *int_timer; static UINT8 _4in1_bank; +static IRQ_CALLBACK(hunchbkg_irq_callback) +{ + /* for some reason a call to cputag_set_input_line + * is significantly delayed .... + * + * cputag_set_input_line(device->machine, "maincpu", 0, CLEAR_LINE); + * + * Therefore we reset the line without any detour .... + */ + //cpu_set_input_line(device->machine->firstcpu, 0, CLEAR_LINE); + cpu_set_info(device->machine->firstcpu, CPUINFO_INT_INPUT_STATE + irq_line, CLEAR_LINE); + return 0x03; +} + + void galaxold_7474_9m_2_callback(running_device *device) { /* Q bar clocks the other flip-flop, @@ -47,7 +62,7 @@ TIMER_DEVICE_CALLBACK( galaxold_interrupt_timer ) ttl7474_d_w(target, (param & 0xe0) != 0xe0); /* 16V clocks the flip-flop */ - ttl7474_clock_w(target, param & 0x10); + ttl7474_clock_w(target, (param & 0x10) == 0x10); param = (param + 0x10) & 0xff; @@ -86,6 +101,11 @@ MACHINE_RESET( devilfsg ) machine_reset_common(machine, 0); } +MACHINE_RESET( hunchbkg ) +{ + machine_reset_common(machine, 0); + cpu_set_irq_callback(devtag_get_device(machine, "maincpu"), hunchbkg_irq_callback); +} WRITE8_HANDLER( galaxold_coin_lockout_w ) {