diff --git a/src/mame/drivers/hng64.c b/src/mame/drivers/hng64.c index eb34b6b58d0..4bcbf69496f 100644 --- a/src/mame/drivers/hng64.c +++ b/src/mame/drivers/hng64.c @@ -448,7 +448,16 @@ or Fatal Fury for example). #include "machine/nvram.h" #include "includes/hng64.h" +/* TODO: NOT measured! */ +#define PIXEL_CLOCK ((MASTER_CLOCK*2)/4) // x 2 is due of the interlaced screen ... +#define HTOTAL (0x200+0x100) +#define HBEND (0) +#define HBSTART (0x200) + +#define VTOTAL (264*2) +#define VBEND (0) +#define VBSTART (224*2) #ifdef UNUSED_FUNCTION @@ -931,7 +940,7 @@ static WRITE32_HANDLER( tcram_w ) visarea.max_x = min_x + max_x - 1; visarea.min_y = min_y; visarea.max_y = min_y + max_y - 1; - space->machine().primary_screen->configure(0x200, 0x1c0, visarea, space->machine().primary_screen->frame_period().attoseconds ); + space->machine().primary_screen->configure(HTOTAL, VTOTAL, visarea, space->machine().primary_screen->frame_period().attoseconds ); } } @@ -1632,36 +1641,31 @@ static const mips3_config vr4300_config = 16384 /* data cache size */ }; -static TIMER_CALLBACK( irq_stop ) -{ - cputag_set_input_line(machine, "maincpu", 0, CLEAR_LINE); -} -static INTERRUPT_GEN( irq_start ) +static TIMER_DEVICE_CALLBACK( hng64_irq ) { - hng64_state *state = device->machine().driver_data(); + hng64_state *state = timer.machine().driver_data(); + int scanline = param; + int irq_fired,irq_type; - logerror("HNG64 interrupt level %x\n", cpu_getiloops(device)); + irq_fired = irq_type = 0; /* there are more, the sources are unknown at the moment */ - switch (cpu_getiloops(device)) + switch(scanline) { - case 0x00: state->m_interrupt_level_request = 0; - break; - case 0x01: state->m_interrupt_level_request = 1; - break; - case 0x02: state->m_interrupt_level_request = 2; - break; - case 0x03: - if (state->m_mcu_type == RACING_MCU) - state->m_interrupt_level_request = 11; //network irq - else - return; - break; + case 224*2: state->m_interrupt_level_request = 0; irq_fired = 1; irq_type = 1; break; + case 0*2: state->m_interrupt_level_request = 1; irq_fired = 1; irq_type = 1; break; + case 64*2: state->m_interrupt_level_request = 2; irq_fired = 1; irq_type = 1; break; + case 128*2: state->m_interrupt_level_request = 11; irq_fired = 1; irq_type = 1; break; + case (0+1)*2: + case (224+1)*2: + case (64+1)*2: + case (128+1)*2: + irq_fired = 1; irq_type = 0; break; } - device_set_input_line(device, 0, ASSERT_LINE); - device->machine().scheduler().timer_set(attotime::from_usec(50), FUNC(irq_stop)); + if(irq_fired) + device_set_input_line(state->m_maincpu, 0, (irq_type) ? ASSERT_LINE : CLEAR_LINE); } @@ -1721,7 +1725,7 @@ static MACHINE_CONFIG_START( hng64, hng64_state ) MCFG_CPU_ADD("maincpu", VR4300BE, MASTER_CLOCK) // actually R4300 MCFG_CPU_CONFIG(vr4300_config) MCFG_CPU_PROGRAM_MAP(hng_map) - MCFG_CPU_VBLANK_INT_HACK(irq_start,4) + MCFG_TIMER_ADD_SCANLINE("scantimer", hng64_irq, "screen", 0, 1) MCFG_CPU_ADD("audiocpu", V33, 8000000) // v53, 16? mhz! MCFG_CPU_PROGRAM_MAP(hng_sound_map) @@ -1737,16 +1741,14 @@ static MACHINE_CONFIG_START( hng64, hng64_state ) MCFG_MACHINE_RESET(hyperneo) MCFG_SCREEN_ADD("screen", RASTER) - MCFG_SCREEN_REFRESH_RATE(60) - MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) //not accurate + MCFG_SCREEN_RAW_PARAMS(PIXEL_CLOCK, HTOTAL, HBEND, HBSTART, VTOTAL, VBEND, VBSTART) MCFG_SCREEN_FORMAT(BITMAP_FORMAT_RGB32) - MCFG_SCREEN_SIZE(1024, 1024) - MCFG_SCREEN_VISIBLE_AREA(0, 0x200-1, 0, 0x1c0-1) MCFG_SCREEN_UPDATE(hng64) MCFG_PALETTE_LENGTH(0x1000) MCFG_VIDEO_START(hng64) + MCFG_SCREEN_EOF(hng64) MACHINE_CONFIG_END diff --git a/src/mame/includes/hng64.h b/src/mame/includes/hng64.h index f89b1c8bc8b..c723edf6c45 100644 --- a/src/mame/includes/hng64.h +++ b/src/mame/includes/hng64.h @@ -7,7 +7,9 @@ class hng64_state : public driver_device { public: hng64_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") + { } int m_mcu_type; UINT32 *m_mainram; @@ -94,6 +96,8 @@ public: float m_lightStrength; float m_lightVector[3]; + required_device m_maincpu; + }; @@ -104,3 +108,4 @@ void hng64_command3d(running_machine& machine, const UINT16* packet); VIDEO_START( hng64 ); SCREEN_UPDATE( hng64 ); +SCREEN_EOF( hng64 ); diff --git a/src/mame/video/hng64.c b/src/mame/video/hng64.c index b412eaa93b8..02fe212980e 100644 --- a/src/mame/video/hng64.c +++ b/src/mame/video/hng64.c @@ -1544,8 +1544,6 @@ SCREEN_UPDATE( hng64 ) hng64_drawtilemap(screen->machine(),bitmap,cliprect, 1); hng64_drawtilemap(screen->machine(),bitmap,cliprect, 0); - draw_sprites(screen->machine(), bitmap,cliprect); - // 3d really shouldn't be last, but you don't see some cool stuff right now if it's put before sprites. { int x, y; @@ -1566,9 +1564,10 @@ SCREEN_UPDATE( hng64 ) } } //printf("NEW FRAME!\n"); /* Debug - ajg */ - clear3d(screen->machine()); } + draw_sprites(screen->machine(), bitmap,cliprect); + if(0) transition_control(screen->machine(), bitmap, cliprect); @@ -1654,6 +1653,11 @@ SCREEN_UPDATE( hng64 ) return 0; } +SCREEN_EOF( hng64 ) +{ + clear3d(screen->machine()); +} + VIDEO_START( hng64 ) { hng64_state *state = machine.driver_data();