From b40f9602263f9031cb27bdcf92d84650187013b9 Mon Sep 17 00:00:00 2001 From: Angelo Salese Date: Thu, 29 Aug 2013 20:29:45 +0000 Subject: [PATCH] Fixed vblank irq trigger when interlace mode is used --- src/mame/includes/dc.h | 5 +++-- src/mame/machine/dc.c | 6 +++++- src/mame/video/powervr2.c | 29 ++++++++++++++++++++++++----- src/mame/video/powervr2.h | 3 ++- src/mess/drivers/tk80.c | 4 ++-- src/mess/machine/dccons.c | 2 +- 6 files changed, 37 insertions(+), 12 deletions(-) diff --git a/src/mame/includes/dc.h b/src/mame/includes/dc.h index 8415d9fd313..fea1a257d8b 100644 --- a/src/mame/includes/dc.h +++ b/src/mame/includes/dc.h @@ -273,8 +273,9 @@ class dc_state : public driver_device #define IST_EXT_MODEM 0x00000004 #define IST_EXT_AICA 0x00000002 #define IST_EXT_GDROM 0x00000001 - -#define IST_ERR_ISP_LIMIT_IRQ 0x00000004 +/* -------------- error interrupts ------------- */ +#define IST_ERR_ISP_LIMIT 0x00000004 +#define IST_ERR_PVRIF_ILL_ADDR 0x00000040 void dc_maple_irq(running_machine &machine); diff --git a/src/mame/machine/dc.c b/src/mame/machine/dc.c index c56ac9ba92f..ef4f4b1e772 100644 --- a/src/mame/machine/dc.c +++ b/src/mame/machine/dc.c @@ -165,7 +165,11 @@ WRITE8_MEMBER(dc_state::pvr_irq) break; case powervr2_device::ERR_ISP_LIMIT_IRQ: - dc_sysctrl_regs[SB_ISTERR] |= IST_ERR_ISP_LIMIT_IRQ; + dc_sysctrl_regs[SB_ISTERR] |= IST_ERR_ISP_LIMIT; + break; + + case powervr2_device::ERR_PVRIF_ILL_ADDR_IRQ: + dc_sysctrl_regs[SB_ISTERR] |= IST_ERR_PVRIF_ILL_ADDR; break; } dc_update_interrupt_status(); diff --git a/src/mame/video/powervr2.c b/src/mame/video/powervr2.c index 0ffa32d9881..00c6c752a82 100644 --- a/src/mame/video/powervr2.c +++ b/src/mame/video/powervr2.c @@ -2003,7 +2003,7 @@ WRITE8_MEMBER( powervr2_device::ta_fifo_yuv_w ) { ta_yuv_y = 0; /* TODO: timing */ - yuv_timer_end->adjust(state->m_maincpu->cycles_to_attotime(ta_yuv_x_size*ta_yuv_y_size*0x180)); + yuv_timer_end->adjust(state->m_maincpu->cycles_to_attotime((ta_yuv_x_size/16)*(ta_yuv_y_size/16)*0x180)); } } } @@ -3356,9 +3356,21 @@ void powervr2_device::pvr_dma_execute(address_space &space) size = 0; /* used so far by usagui and sprtjam*/ - //printf("PVR-DMA start\n"); - //printf("%08x %08x %08x\n",m_pvr_dma.pvr_addr,m_pvr_dma.sys_addr,m_pvr_dma.size); - //printf("src %s dst %08x\n",m_pvr_dma.dir ? "->" : "<-",m_pvr_dma.sel); + printf("PVR-DMA start\n"); + printf("%08x %08x %08x\n",m_pvr_dma.pvr_addr,m_pvr_dma.sys_addr,m_pvr_dma.size); + printf("src %s dst %08x\n",m_pvr_dma.dir ? "->" : "<-",m_pvr_dma.sel); + + /* Throw illegal address set */ + #if 0 + if((m_pvr_dma.sys_addr & 0x1c000000) != 0x0c000000) + { + /* TODO: timing */ + irq_cb(ERR_PVRIF_ILL_ADDR_IRQ); + m_pvr_dma.start = sb_pdst = 0; + printf("Illegal PVR DMA set\n"); + return; + } + #endif /* 0 rounding size = 16 Mbytes */ if(m_pvr_dma.size == 0) { m_pvr_dma.size = 0x100000; } @@ -3568,9 +3580,16 @@ void powervr2_device::pvr_scanline_timer(int vpos) { int vbin_line = spg_vblank_int & 0x3ff; int vbout_line = (spg_vblank_int >> 16) & 0x3ff; + UINT8 interlace_on = ((spg_control & 0x10) >> 4); dc_state *state = machine().driver_data(); - if(vbin_line-1 == vpos) + if(interlace_on) + { + vbin_line <<= 1; + vbout_line <<= 1; + } + + if(vbin_line-(1+interlace_on) == vpos) state->m_maple->maple_hw_trigger(); if(vbin_line == vpos) diff --git a/src/mame/video/powervr2.h b/src/mame/video/powervr2.h index cfcd889ee5b..d70e2031b13 100644 --- a/src/mame/video/powervr2.h +++ b/src/mame/video/powervr2.h @@ -24,7 +24,8 @@ public: EOR_TSP_IRQ, EOR_ISP_IRQ, DMA_PVR_IRQ, - ERR_ISP_LIMIT_IRQ + ERR_ISP_LIMIT_IRQ, + ERR_PVRIF_ILL_ADDR_IRQ }; DECLARE_ADDRESS_MAP(ta_map, 32); diff --git a/src/mess/drivers/tk80.c b/src/mess/drivers/tk80.c index 26298bf004c..75401c82b22 100644 --- a/src/mess/drivers/tk80.c +++ b/src/mess/drivers/tk80.c @@ -48,7 +48,7 @@ ICS8080 #include "cpu/i8085/i8085.h" #include "machine/i8255.h" #include "machine/keyboard.h" -#include "tk80.lh" +//#include "tk80.lh" class tk80_state : public driver_device @@ -283,7 +283,7 @@ static MACHINE_CONFIG_START( tk80, tk80_state ) MCFG_CPU_IO_MAP(tk80_io) /* video hardware */ - MCFG_DEFAULT_LAYOUT(layout_tk80) +// MCFG_DEFAULT_LAYOUT(layout_tk80) /* Devices */ MCFG_I8255_ADD( "ppi8255_0", ppi_intf_0 ) diff --git a/src/mess/machine/dccons.c b/src/mess/machine/dccons.c index 033be0901cf..8f06d918f9c 100644 --- a/src/mess/machine/dccons.c +++ b/src/mess/machine/dccons.c @@ -743,7 +743,7 @@ WRITE32_MEMBER(dc_cons_state::dc_mess_g1_ctrl_w ) atapi_regs[ATAPI_REG_SAMTAG] = GDROM_PAUSE_STATE | 0x80; } break; -// The following is required to unlock the GD-ROM. The original Japanese BIOS doen't need it +// The following is required to unlock the GD-ROM. The original Japanese BIOS doesn't need it case GD_UNLOCK: if (data==0 || data==0x001fffff || data==0x42fe) {