From c3ee29a5045cc283d84590c826788be3a800b951 Mon Sep 17 00:00:00 2001 From: Angelo Salese Date: Sat, 2 Jul 2011 18:12:42 +0000 Subject: [PATCH] deprecat.h --- src/mame/drivers/vulgus.c | 10 ++--- src/mame/drivers/xmen.c | 78 +++++++++++++-------------------------- src/mame/includes/xmen.h | 2 +- src/mame/video/xmen.c | 4 +- 4 files changed, 31 insertions(+), 63 deletions(-) diff --git a/src/mame/drivers/vulgus.c b/src/mame/drivers/vulgus.c index 252820d7b75..7af1142d515 100644 --- a/src/mame/drivers/vulgus.c +++ b/src/mame/drivers/vulgus.c @@ -46,15 +46,11 @@ c001 YM2203 #2 write #include "includes/vulgus.h" -static INTERRUPT_GEN( vulgus_interrupt ) +static INTERRUPT_GEN( vulgus_vblank_irq ) { - if (cpu_getiloops(device) != 0) - device_set_input_line_and_vector(device, 0, HOLD_LINE, 0xcf); /* RST 08h */ - else - device_set_input_line_and_vector(device, 0, HOLD_LINE, 0xd7); /* RST 10h - vblank */ + device_set_input_line_and_vector(device, 0, HOLD_LINE, 0xd7); /* RST 10h - vblank */ } - static ADDRESS_MAP_START( main_map, AS_PROGRAM, 8 ) AM_RANGE(0x0000, 0x9fff) AM_ROM AM_RANGE(0xc000, 0xc000) AM_READ_PORT("SYSTEM") @@ -222,7 +218,7 @@ static MACHINE_CONFIG_START( vulgus, vulgus_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", Z80, 4000000) /* 4 MHz (?) */ MCFG_CPU_PROGRAM_MAP(main_map) - MCFG_CPU_VBLANK_INT_HACK(vulgus_interrupt,2) + MCFG_CPU_VBLANK_INT("screen",vulgus_vblank_irq) MCFG_CPU_ADD("audiocpu", Z80, 3000000) /* 3 MHz ??? */ MCFG_CPU_PROGRAM_MAP(sound_map) diff --git a/src/mame/drivers/xmen.c b/src/mame/drivers/xmen.c index bd136761bf6..d34431b9352 100644 --- a/src/mame/drivers/xmen.c +++ b/src/mame/drivers/xmen.c @@ -15,7 +15,6 @@ likewise be a 2 screen game ***************************************************************************/ #include "emu.h" #include "cpu/m68000/m68000.h" -#include "deprecat.h" #include "video/konicdev.h" #include "machine/eeprom.h" #include "cpu/z80/z80.h" @@ -55,6 +54,7 @@ static WRITE16_HANDLER( eeprom_w ) /* bit 2 is data */ /* bit 3 is clock (active high) */ /* bit 4 is cs (active low) */ + /* bit 5 is enabled in IRQ3, disabled in IRQ5 (sprite DMA start?) */ input_port_write(space->machine(), "EEPROMOUT", data, 0xff); } if (ACCESSING_BITS_8_15) @@ -88,10 +88,12 @@ static WRITE16_HANDLER( sound_irq_w ) static WRITE16_HANDLER( xmen_18fa00_w ) { + xmen_state *state = space->machine().driver_data(); + if(ACCESSING_BITS_0_7) { /* bit 2 is interrupt enable */ - interrupt_enable_w(space, 0, data & 0x04); + state->m_vblank_irq_mask = data & 0x04; } } @@ -258,8 +260,8 @@ INPUT_PORTS_END static CUSTOM_INPUT( xmen_frame_r ) { - xmen_state *state = field.machine().driver_data(); - return state->m_current_frame; + //xmen_state *state = field.machine().driver_data(); + return field.machine().primary_screen->frame_number() & 1; } static INPUT_PORTS_START( xmen6p ) @@ -295,15 +297,6 @@ static INPUT_PORTS_START( xmen6p ) INPUT_PORTS_END - -static INTERRUPT_GEN( xmen_interrupt ) -{ - if (cpu_getiloops(device) == 0) - irq5_line_hold(device); - else - irq3_line_hold(device); -} - static MACHINE_START( xmen ) { xmen_state *state = machine.driver_data(); @@ -325,6 +318,7 @@ static MACHINE_START( xmen ) state->save_item(NAME(state->m_sprite_colorbase)); state->save_item(NAME(state->m_layer_colorbase)); state->save_item(NAME(state->m_layerpri)); + state->save_item(NAME(state->m_vblank_irq_mask)); machine.save().register_postload(save_prepost_delegate(FUNC(sound_reset_bank), &machine)); } @@ -341,6 +335,7 @@ static MACHINE_RESET( xmen ) state->m_sprite_colorbase = 0; state->m_sound_curbank = 0; + state->m_vblank_irq_mask = 0; } static const k052109_interface xmen_k052109_intf = @@ -361,12 +356,26 @@ static const k053247_interface xmen_k053246_intf = xmen_sprite_callback }; +static TIMER_DEVICE_CALLBACK( xmen_scanline ) +{ + xmen_state *state = timer.machine().driver_data(); + int scanline = param; + + if(scanline == 240 && state->m_vblank_irq_mask) // vblank-out irq + cputag_set_input_line(timer.machine(), "maincpu", 3, HOLD_LINE); + + if(scanline == 0) // sprite DMA irq? + cputag_set_input_line(timer.machine(), "maincpu", 5, HOLD_LINE); + +} + + static MACHINE_CONFIG_START( xmen, xmen_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", M68000, XTAL_16MHz) /* verified on pcb */ MCFG_CPU_PROGRAM_MAP(main_map) - MCFG_CPU_VBLANK_INT_HACK(xmen_interrupt,2) + MCFG_TIMER_ADD_SCANLINE("scantimer", xmen_scanline, "screen", 0, 1) MCFG_CPU_ADD("audiocpu", Z80, XTAL_16MHz/2) /* verified on pcb */ MCFG_CPU_PROGRAM_MAP(sound_map) @@ -404,41 +413,6 @@ static MACHINE_CONFIG_START( xmen, xmen_state ) MCFG_SOUND_ROUTE(1, "rspeaker", 0.80) MACHINE_CONFIG_END - -static MACHINE_START( xmen6p ) -{ - xmen_state *state = machine.driver_data(); - - MACHINE_START_CALL(xmen); - - state->save_item(NAME(state->m_current_frame)); -} - -static MACHINE_RESET( xmen6p ) -{ - xmen_state *state = machine.driver_data(); - state->m_current_frame = 0x00; -} - -static INTERRUPT_GEN( xmen6p_interrupt ) -{ - if (cpu_getiloops(device) == 0) - { - irq5_line_hold(device); - - - } - else - { -// if (xmen_irqenabled & 0x04) -// { - irq3_line_hold(device); -// state->m_current_frame = 0x00; - -// } - } -} - static const k053247_interface xmen6p_k053246_intf = { "lscreen", /* is this correct? */ @@ -454,13 +428,13 @@ static MACHINE_CONFIG_START( xmen6p, xmen_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", M68000, 16000000) /* ? */ MCFG_CPU_PROGRAM_MAP(6p_main_map) - MCFG_CPU_VBLANK_INT_HACK(xmen6p_interrupt,2) + MCFG_TIMER_ADD_SCANLINE("scantimer", xmen_scanline, "lscreen", 0, 1) MCFG_CPU_ADD("audiocpu", Z80,8000000) /* verified with M1, guessed but accurate */ MCFG_CPU_PROGRAM_MAP(sound_map) - MCFG_MACHINE_START(xmen6p) - MCFG_MACHINE_RESET(xmen6p) + MCFG_MACHINE_START(xmen) + MCFG_MACHINE_RESET(xmen) MCFG_EEPROM_ADD("eeprom", eeprom_intf) diff --git a/src/mame/includes/xmen.h b/src/mame/includes/xmen.h index 88a5d7b60f1..0d4beecd5b5 100644 --- a/src/mame/includes/xmen.h +++ b/src/mame/includes/xmen.h @@ -21,10 +21,10 @@ public: UINT16 * m_xmen6p_tilemapleft; UINT16 * m_xmen6p_tilemapright; UINT16 * m_k053247_ram; - UINT16 m_current_frame; /* misc */ UINT8 m_sound_curbank; + UINT8 m_vblank_irq_mask; /* devices */ device_t *m_maincpu; diff --git a/src/mame/video/xmen.c b/src/mame/video/xmen.c index 3570ea52b55..ff6e05be1e9 100644 --- a/src/mame/video/xmen.c +++ b/src/mame/video/xmen.c @@ -143,8 +143,6 @@ SCREEN_EOF( xmen6p ) rectangle cliprect; int offset; - state->m_current_frame ^= 0x01; - // const rectangle *visarea = machine.primary_screen->visible_area(); // cliprect.min_x = visarea->min_x; // cliprect.max_x = visarea->max_x; @@ -157,7 +155,7 @@ SCREEN_EOF( xmen6p ) cliprect.max_y = 30 * 8 - 1; - if (state->m_current_frame & 0x01) + if (machine.primary_screen->frame_number() & 0x01) { /* copy the desired spritelist to the chip */