From 3e4f663ffdce63767b42631694786d88e5b35f4c Mon Sep 17 00:00:00 2001 From: Angelo Salese Date: Mon, 5 Dec 2011 21:04:52 +0000 Subject: [PATCH] deprecat.h --- src/mame/drivers/brkthru.c | 12 +++--- src/mame/drivers/csplayh5.c | 32 +++++++++------ src/mame/drivers/firetrap.c | 79 +++++++++++++----------------------- src/mame/drivers/gaelco2.c | 3 +- src/mame/drivers/kas89.c | 35 ++++++++++------ src/mame/includes/firetrap.h | 3 +- src/mame/includes/gaelco2.h | 8 +++- src/mame/machine/gaelco2.c | 18 ++++---- 8 files changed, 92 insertions(+), 98 deletions(-) diff --git a/src/mame/drivers/brkthru.c b/src/mame/drivers/brkthru.c index 82521d02b08..5430abf1116 100644 --- a/src/mame/drivers/brkthru.c +++ b/src/mame/drivers/brkthru.c @@ -230,9 +230,9 @@ static INPUT_PORTS_START( brkthru ) // PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) // PORT_DIPSETTING( 0x00, DEF_STR( On ) ) /* SW2:7,8 ALWAYS OFF according to the manual */ - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0) PORT_IMPULSE(1) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_CHANGED(coin_inserted, 0) PORT_IMPULSE(1) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_CHANGED(coin_inserted, 0) PORT_IMPULSE(1) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_CHANGED(coin_inserted, 0) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_CHANGED(coin_inserted, 0) INPUT_PORTS_END static INPUT_PORTS_START( brkthruj ) @@ -272,9 +272,9 @@ static INPUT_PORTS_START( darwin ) // PORT_DIPSETTING( 0x20, DEF_STR( Off ) ) // PORT_DIPSETTING( 0x00, DEF_STR( On ) ) /* SW2:5,7,8 ALWAYS OFF according to the manual */ - PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0) PORT_IMPULSE(1) - PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_CHANGED(coin_inserted, 0) PORT_IMPULSE(1) - PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_CHANGED(coin_inserted, 0) PORT_IMPULSE(1) + PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 0) + PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_CHANGED(coin_inserted, 0) + PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_CHANGED(coin_inserted, 0) INPUT_PORTS_END diff --git a/src/mame/drivers/csplayh5.c b/src/mame/drivers/csplayh5.c index b7fc9769962..14a0b063019 100644 --- a/src/mame/drivers/csplayh5.c +++ b/src/mame/drivers/csplayh5.c @@ -29,12 +29,16 @@ class csplayh5_state : public driver_device { public: csplayh5_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) { } + : driver_device(mconfig, type, tag), + m_maincpu(*this,"maincpu") + { } bitmap_t *m_vdp0_bitmap; UINT16 m_mux_data; UINT8 m_pio_dir[5]; UINT8 m_pio_latch[5]; + + required_device m_maincpu; }; @@ -597,16 +601,20 @@ static MACHINE_RESET( csplayh5 ) } } -static INTERRUPT_GEN( scanline_irq ) +static TIMER_DEVICE_CALLBACK( csplayh5_irq ) { - v9938_set_sprite_limit(0, 0); - v9938_set_resolution(0, RENDER_HIGH); - v9938_interrupt(device->machine(), 0); -} + csplayh5_state *state = timer.machine().driver_data(); + int scanline = param; -static INTERRUPT_GEN( csplayh5_irq ) -{ - device_set_input_line_and_vector(device, 1, HOLD_LINE,0x100/4); + if(scanline == 212*2) + device_set_input_line_and_vector(state->m_maincpu, 1, HOLD_LINE,0x100/4); + + if((scanline % 2) == 0) + { + v9938_set_sprite_limit(0, 0); + v9938_set_resolution(0, RENDER_HIGH); + v9938_interrupt(timer.machine(), 0); + } } static const z80_daisy_config daisy_chain_sound[] = @@ -621,8 +629,7 @@ static MACHINE_CONFIG_START( csplayh5, csplayh5_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu",M68000,16000000) /* TMP68301-16 */ MCFG_CPU_PROGRAM_MAP(csplayh5_map) - MCFG_CPU_VBLANK_INT("screen", csplayh5_irq ) - MCFG_CPU_PERIODIC_INT(scanline_irq,262*60) // unknown timing + MCFG_TIMER_ADD_SCANLINE("scantimer", csplayh5_irq, "screen", 0, 1) #if USE_H8 MCFG_CPU_ADD("subcpu", H83002, 16000000) /* unknown clock */ @@ -646,8 +653,7 @@ static MACHINE_CONFIG_START( csplayh5, csplayh5_state ) MCFG_SCREEN_ADD("screen",RASTER) MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) - + MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) MCFG_SCREEN_SIZE(MSX2_TOTAL_XRES_PIXELS, MSX2_TOTAL_YRES_PIXELS) MCFG_SCREEN_VISIBLE_AREA(MSX2_XBORDER_PIXELS - MSX2_VISIBLE_XBORDER_PIXELS, MSX2_TOTAL_XRES_PIXELS - MSX2_XBORDER_PIXELS + MSX2_VISIBLE_XBORDER_PIXELS - 1, MSX2_YBORDER_PIXELS - MSX2_VISIBLE_YBORDER_PIXELS, MSX2_TOTAL_YRES_PIXELS - MSX2_YBORDER_PIXELS + MSX2_VISIBLE_YBORDER_PIXELS - 1) diff --git a/src/mame/drivers/firetrap.c b/src/mame/drivers/firetrap.c index a2ca6186ae4..7d041708cc9 100644 --- a/src/mame/drivers/firetrap.c +++ b/src/mame/drivers/firetrap.c @@ -168,7 +168,6 @@ Stephh's notes (based on the games Z80 code and some tests) : #include "emu.h" #include "cpu/z80/z80.h" -#include "deprecat.h" #include "cpu/m6502/m6502.h" #include "sound/3526intf.h" #include "sound/msm5205.h" @@ -317,7 +316,7 @@ static WRITE8_HANDLER( firetrap_sound_2400_w ) { firetrap_state *state = space->machine().driver_data(); msm5205_reset_w(state->m_msm, ~data & 0x01); - state->m_irq_enable = data & 0x02; + state->m_sound_irq_enable = data & 0x02; } static WRITE8_HANDLER( firetrap_sound_bankselect_w ) @@ -333,7 +332,7 @@ static void firetrap_adpcm_int( device_t *device ) state->m_msm5205next <<= 4; state->m_adpcm_toggle ^= 1; - if (state->m_irq_enable && state->m_adpcm_toggle) + if (state->m_sound_irq_enable && state->m_adpcm_toggle) device_set_input_line(state->m_audiocpu, M6502_IRQ_LINE, HOLD_LINE); } @@ -413,6 +412,25 @@ static ADDRESS_MAP_START( sound_map, AS_PROGRAM, 8 ) AM_RANGE(0x8000, 0xffff) AM_ROM ADDRESS_MAP_END +static INPUT_CHANGED( coin_inserted ) +{ + firetrap_state *state = field.machine().driver_data(); + + /* coin insertion causes an IRQ */ + if(newval) + { + state->m_coin_command_pending = (UINT8)(FPTR)(param); + + /* Make sure coin IRQ's aren't generated when another command is pending, the main cpu + definitely doesn't expect them as it locks out the coin routine */ + if (state->m_coin_command_pending && !state->m_i8751_current_command) + { + state->m_i8751_return = state->m_coin_command_pending; + device_set_input_line_and_vector(state->m_maincpu, 0, HOLD_LINE, 0xff); + state->m_coin_command_pending = 0; + } + } +} /* verified from Z80 code */ static INPUT_PORTS_START( firetrap ) @@ -490,9 +508,9 @@ static INPUT_PORTS_START( firetrap ) PORT_SERVICE_DIPLOC( 0x80, IP_ACTIVE_LOW, "SW2:8" ) PORT_START("COIN") /* Connected to i8751 directly */ - PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) - PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) - PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) + PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_COIN1 ) PORT_CHANGED(coin_inserted, 1) + PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_COIN2 ) PORT_CHANGED(coin_inserted, 2) + PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_SERVICE1 ) PORT_CHANGED(coin_inserted, 3) INPUT_PORTS_END /* verified from Z80 code */ @@ -572,48 +590,11 @@ static const msm5205_interface msm5205_config = }; static INTERRUPT_GEN( firetrap_irq ) -{ - firetrap_state *state = device->machine().driver_data(); - UINT8 coin = 0; - UINT8 port = input_port_read(device->machine(), "COIN") & 0x07; /* TODO: remove me */ - - /* Check for coin IRQ */ - if (cpu_getiloops(device)) - { - if (port != 0x07 && !state->m_int_latch) - { - if (!(port & 0x01)) /* COIN1 */ - coin = 1; - if (!(port & 0x02)) /* COIN2 */ - coin = 2; - if (!(port & 0x04)) /* SERVICE1 */ - coin = 3; - state->m_coin_command_pending = coin; - state->m_int_latch = 1; - } - if (port == 0x07) - state->m_int_latch = 0; - - /* Make sure coin IRQ's aren't generated when another command is pending, the main cpu - definitely doesn't expect them as it locks out the coin routine */ - if (state->m_coin_command_pending && !state->m_i8751_current_command) - { - state->m_i8751_return = state->m_coin_command_pending; - device_set_input_line_and_vector(device, 0, HOLD_LINE, 0xff); - state->m_coin_command_pending = 0; - } - } - - if (state->m_nmi_enable && !cpu_getiloops(device)) - device_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE); -} - -static INTERRUPT_GEN( bootleg_irq ) { firetrap_state *state = device->machine().driver_data(); if (state->m_nmi_enable) - device_set_input_line (device, INPUT_LINE_NMI, PULSE_LINE); + device_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE); } @@ -631,13 +612,12 @@ static MACHINE_START( firetrap ) memory_configure_bank(machine, "bank2", 0, 2, &SOUND[0x10000], 0x4000); state->save_item(NAME(state->m_i8751_current_command)); - state->save_item(NAME(state->m_irq_enable)); + state->save_item(NAME(state->m_sound_irq_enable)); state->save_item(NAME(state->m_nmi_enable)); state->save_item(NAME(state->m_i8751_return)); state->save_item(NAME(state->m_i8751_init_ptr)); state->save_item(NAME(state->m_msm5205next)); state->save_item(NAME(state->m_adpcm_toggle)); - state->save_item(NAME(state->m_int_latch)); state->save_item(NAME(state->m_coin_command_pending)); state->save_item(NAME(state->m_scroll1_x)); state->save_item(NAME(state->m_scroll1_y)); @@ -659,13 +639,12 @@ static MACHINE_RESET( firetrap ) } state->m_i8751_current_command = 0; - state->m_irq_enable = 0; + state->m_sound_irq_enable = 0; state->m_nmi_enable = 0; state->m_i8751_return = 0; state->m_i8751_init_ptr = 0; state->m_msm5205next = 0xff; state->m_adpcm_toggle = 0; - state->m_int_latch = 0; state->m_coin_command_pending = 0; } @@ -674,7 +653,7 @@ static MACHINE_CONFIG_START( firetrap, firetrap_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", Z80, FIRETRAP_XTAL/2) // 6 MHz MCFG_CPU_PROGRAM_MAP(firetrap_map) - MCFG_CPU_VBLANK_INT_HACK(firetrap_irq,2) + MCFG_CPU_VBLANK_INT("screen",firetrap_irq) MCFG_CPU_ADD("audiocpu", M6502, FIRETRAP_XTAL/8) // 1.5 MHz MCFG_CPU_PROGRAM_MAP(sound_map) @@ -715,7 +694,7 @@ static MACHINE_CONFIG_START( firetrapbl, firetrap_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", Z80, FIRETRAP_XTAL/2) // 6 MHz MCFG_CPU_PROGRAM_MAP(firetrap_bootleg_map) - MCFG_CPU_VBLANK_INT("screen", bootleg_irq) + MCFG_CPU_VBLANK_INT("screen", firetrap_irq) MCFG_CPU_ADD("audiocpu", M6502, FIRETRAP_XTAL/8) // 1.5 MHz MCFG_CPU_PROGRAM_MAP(sound_map) diff --git a/src/mame/drivers/gaelco2.c b/src/mame/drivers/gaelco2.c index 1628f2712a4..f2ee5cadafb 100644 --- a/src/mame/drivers/gaelco2.c +++ b/src/mame/drivers/gaelco2.c @@ -20,7 +20,6 @@ ***************************************************************************/ #include "emu.h" -#include "deprecat.h" #include "cpu/m68000/m68000.h" #include "machine/eeprom.h" #include "sound/gaelco.h" @@ -291,7 +290,7 @@ static MACHINE_CONFIG_START( bang, gaelco2_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", M68000, 30000000/2) /* 15 MHz */ MCFG_CPU_PROGRAM_MAP(bang_map) - MCFG_CPU_VBLANK_INT_HACK(bang_interrupt, 6) + MCFG_TIMER_ADD_SCANLINE("scantimer", bang_irq, "screen", 0, 1) MCFG_EEPROM_ADD("eeprom", gaelco2_eeprom_interface) diff --git a/src/mame/drivers/kas89.c b/src/mame/drivers/kas89.c index 8ae7fafa9fd..583e114a033 100644 --- a/src/mame/drivers/kas89.c +++ b/src/mame/drivers/kas89.c @@ -196,7 +196,6 @@ #include "sound/ay8910.h" #include "video/v9938.h" #include "machine/nvram.h" -#include "deprecat.h" #include "kas89.lh" @@ -204,7 +203,8 @@ class kas89_state : public driver_device { public: kas89_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) { } + : driver_device(mconfig, type, tag) + { } UINT8 m_mux_data; UINT8 m_main_nmi_enable; @@ -230,9 +230,12 @@ static void kas89_vdp_interrupt(running_machine &machine, int i) cputag_set_input_line (machine, "maincpu", 0, (i ? ASSERT_LINE : CLEAR_LINE)); } -static INTERRUPT_GEN( kas89_interrupt ) +static TIMER_DEVICE_CALLBACK( kas89_interrupt ) { - v9938_interrupt(device->machine(), 0); + int scanline = param; + + if((scanline % 2) == 0) + v9938_interrupt(timer.machine(), 0); } @@ -306,16 +309,22 @@ static READ8_HANDLER( mux_r ) return state->m_mux_data; } -static INTERRUPT_GEN ( kas89_nmi_interrupt ) +static TIMER_DEVICE_CALLBACK ( kas89_nmi_cb ) { - kas89_state *state = device->machine().driver_data(); + kas89_state *state = timer.machine().driver_data(); if (state->m_main_nmi_enable) - { - device_set_input_line(device, INPUT_LINE_NMI, PULSE_LINE); - } + device_set_input_line(state->m_maincpu, INPUT_LINE_NMI, PULSE_LINE); } +static TIMER_DEVICE_CALLBACK ( kas89_sound_nmi_cb ) +{ + kas89_state *state = timer.machine().driver_data(); + + device_set_input_line(state->m_audiocpu, INPUT_LINE_NMI, PULSE_LINE); +} + + static WRITE8_HANDLER( control_w ) { /* - bits - @@ -773,13 +782,13 @@ static MACHINE_CONFIG_START( kas89, kas89_state ) MCFG_CPU_ADD("maincpu", Z80, MASTER_CLOCK/6) /* Confirmed */ MCFG_CPU_PROGRAM_MAP(kas89_map) MCFG_CPU_IO_MAP(kas89_io) - MCFG_CPU_VBLANK_INT_HACK(kas89_interrupt, 262) - MCFG_CPU_PERIODIC_INT(kas89_nmi_interrupt, 138) /* Connected to a 138Hz osc. *AND* bit6 of port $82 */ + MCFG_TIMER_ADD_SCANLINE("scantimer", kas89_interrupt, "screen", 0, 1) + MCFG_TIMER_ADD_PERIODIC("kas89_nmi", kas89_nmi_cb, attotime::from_hz(138)) /* Connected to a 138Hz osc. *AND* bit6 of port $82 */ MCFG_CPU_ADD("audiocpu", Z80, MASTER_CLOCK/6) /* Confirmed */ MCFG_CPU_PROGRAM_MAP(audio_map) MCFG_CPU_IO_MAP(audio_io) - MCFG_CPU_PERIODIC_INT(nmi_line_pulse, 138) /* Connected to a 138Hz osc.*/ + MCFG_TIMER_ADD_PERIODIC("kas89_snmi", kas89_sound_nmi_cb, attotime::from_hz(138)) /* Connected to a 138Hz osc.*/ MCFG_MACHINE_START(kas89) MCFG_MACHINE_RESET(kas89) @@ -791,7 +800,7 @@ static MACHINE_CONFIG_START( kas89, kas89_state ) MCFG_SCREEN_REFRESH_RATE(60) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) MCFG_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) - MCFG_SCREEN_SIZE(544, 480) + MCFG_SCREEN_SIZE(544, 524) MCFG_SCREEN_VISIBLE_AREA(0, 544 - 1, 0, 480 - 1) MCFG_SCREEN_UPDATE(generic_bitmapped) diff --git a/src/mame/includes/firetrap.h b/src/mame/includes/firetrap.h index 4d33516d886..c6a0e48a039 100644 --- a/src/mame/includes/firetrap.h +++ b/src/mame/includes/firetrap.h @@ -27,14 +27,13 @@ public: UINT8 m_scroll2_y[2]; /* misc */ - int m_irq_enable; + int m_sound_irq_enable; int m_nmi_enable; int m_i8751_return; int m_i8751_current_command; int m_i8751_init_ptr; int m_msm5205next; int m_adpcm_toggle; - int m_int_latch; int m_coin_command_pending; /* devices */ diff --git a/src/mame/includes/gaelco2.h b/src/mame/includes/gaelco2.h index 9ee3494d35e..dbbdbd25410 100644 --- a/src/mame/includes/gaelco2.h +++ b/src/mame/includes/gaelco2.h @@ -2,7 +2,9 @@ class gaelco2_state : public driver_device { public: gaelco2_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) { } + : driver_device(mconfig, type, tag), + m_maincpu(*this,"maincpu") + { } UINT16 *m_snowboar_protection; UINT16 *m_vregs; @@ -11,6 +13,8 @@ public: UINT16 *m_videoram; tilemap_t *m_pant[2]; int m_dual_monitor; + + required_device m_maincpu; }; @@ -25,7 +29,7 @@ WRITE16_HANDLER( gaelco2_coin2_w ); WRITE16_HANDLER( wrally2_coin_w ); WRITE16_HANDLER( touchgo_coin_w ); WRITE16_HANDLER( bang_clr_gun_int_w ); -INTERRUPT_GEN( bang_interrupt ); +TIMER_DEVICE_CALLBACK( bang_irq ); CUSTOM_INPUT( wrally2_analog_bit_r ); WRITE16_HANDLER( wrally2_adc_clk ); WRITE16_HANDLER( wrally2_adc_cs ); diff --git a/src/mame/machine/gaelco2.c b/src/mame/machine/gaelco2.c index 59b20c73c6d..a7df42c4f54 100644 --- a/src/mame/machine/gaelco2.c +++ b/src/mame/machine/gaelco2.c @@ -8,7 +8,6 @@ ***************************************************************************/ #include "emu.h" -#include "deprecat.h" #include "machine/eeprom.h" #include "includes/gaelco2.h" @@ -189,19 +188,18 @@ WRITE16_HANDLER( bang_clr_gun_int_w ) state->m_clr_gun_int = 1; } -INTERRUPT_GEN( bang_interrupt ) +TIMER_DEVICE_CALLBACK( bang_irq ) { - gaelco2_state *state = device->machine().driver_data(); - if (cpu_getiloops(device) == 0){ - device_set_input_line(device, 2, HOLD_LINE); + gaelco2_state *state = timer.machine().driver_data(); + int scanline = param; + if (scanline == 256){ + device_set_input_line(state->m_maincpu, 2, HOLD_LINE); state->m_clr_gun_int = 0; } - else if (cpu_getiloops(device) % 2){ - if (state->m_clr_gun_int){ - device_set_input_line(device, 4, HOLD_LINE); - } - } + + if ((scanline % 64) == 0 && state->m_clr_gun_int) + device_set_input_line(state->m_maincpu, 4, HOLD_LINE); } /***************************************************************************