Experimental scanline code, to be improved on a later date

This commit is contained in:
Angelo Salese 2013-08-24 17:20:06 +00:00
parent 3797c5a78c
commit e655d95f7e
6 changed files with 35 additions and 11 deletions

View File

@ -2486,6 +2486,7 @@ static MACHINE_CONFIG_START( naomi_aw_base, naomi_state )
MCFG_CPU_CONFIG(sh4cpu_config)
MCFG_CPU_PROGRAM_MAP(naomi_map)
MCFG_CPU_IO_MAP(naomi_port)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", dc_state, dc_scanline, "screen", 0, 1)
MCFG_CPU_ADD("soundcpu", ARM7, ((XTAL_33_8688MHz*2)/3)/8) // AICA bus clock is 2/3rds * 33.8688. ARM7 gets 1 bus cycle out of each 8.
MCFG_CPU_PROGRAM_MAP(dc_audio_map)

View File

@ -85,6 +85,7 @@ class dc_state : public driver_device
optional_device<naomi_g1_device> m_naomig1;
void generic_dma(UINT32 main_adr, void *dma_ptr, UINT32 length, UINT32 size, bool to_mainram);
TIMER_DEVICE_CALLBACK_MEMBER(dc_scanline);
};
/*--------- Ch2-DMA Control Registers ----------*/

View File

@ -807,3 +807,8 @@ WRITE32_MEMBER(dc_state::dc_arm_aica_w)
{
aica_w(machine().device("aica"), space, offset*2, data, mem_mask&0xffff);
}
TIMER_DEVICE_CALLBACK_MEMBER(dc_state::dc_scanline)
{
m_powervr2->pvr_scanline_timer(param);
}

View File

@ -1129,11 +1129,11 @@ WRITE32_MEMBER( powervr2_device::spg_vblank_int_w )
COMBINE_DATA(&spg_vblank_int);
/* clear pending irqs and modify them with the updated ones */
vbin_timer->adjust(attotime::never);
vbout_timer->adjust(attotime::never);
// vbin_timer->adjust(attotime::never);
// vbout_timer->adjust(attotime::never);
vbin_timer->adjust(m_screen->time_until_pos(spg_vblank_int & 0x3ff));
vbout_timer->adjust(m_screen->time_until_pos((spg_vblank_int >> 16) & 0x3ff));
// vbin_timer->adjust(m_screen->time_until_pos(spg_vblank_int & 0x3ff));
// vbout_timer->adjust(m_screen->time_until_pos((spg_vblank_int >> 16) & 0x3ff));
}
READ32_MEMBER( powervr2_device::spg_hblank_r )
@ -2763,14 +2763,14 @@ TIMER_CALLBACK_MEMBER(powervr2_device::vbin)
irq_cb(VBL_IN_IRQ);
//popmessage("VII %d VOI %d VI %d VO %d VS %d",spg_vblank_int & 0x3ff,(spg_vblank_int >> 16) & 0x3ff,spg_vblank & 0x3ff,(spg_vblank >> 16) & 0x3ff,(spg_load >> 16) & 0x3ff);
vbin_timer->adjust(m_screen->time_until_pos(spg_vblank_int & 0x3ff));
// vbin_timer->adjust(m_screen->time_until_pos(spg_vblank_int & 0x3ff));
}
TIMER_CALLBACK_MEMBER(powervr2_device::vbout)
{
irq_cb(VBL_OUT_IRQ);
vbout_timer->adjust(m_screen->time_until_pos((spg_vblank_int >> 16) & 0x3ff));
// vbout_timer->adjust(m_screen->time_until_pos((spg_vblank_int >> 16) & 0x3ff));
}
TIMER_CALLBACK_MEMBER(powervr2_device::hbin)
@ -3006,8 +3006,8 @@ void powervr2_device::device_start()
computedilated();
vbout_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(powervr2_device::vbout),this));
vbin_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(powervr2_device::vbin),this));
// vbout_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(powervr2_device::vbout),this));
// vbin_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(powervr2_device::vbin),this));
hbin_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(powervr2_device::hbin),this));
endofrender_timer_isp = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(powervr2_device::endofrender_isp),this));
@ -3149,8 +3149,8 @@ void powervr2_device::device_reset()
renderselect= -1;
grabsel=0;
vbout_timer->adjust(m_screen->time_until_pos((spg_vblank_int >> 16) & 0x3ff));
vbin_timer->adjust(m_screen->time_until_pos(spg_vblank_int & 0x3ff));
// vbout_timer->adjust(m_screen->time_until_pos((spg_vblank_int >> 16) & 0x3ff));
// vbin_timer->adjust(m_screen->time_until_pos(spg_vblank_int & 0x3ff));
hbin_timer->adjust(m_screen->time_until_pos(0, ((spg_hblank_int >> 16) & 0x3ff)-1));
scanline = 0;
@ -3164,3 +3164,18 @@ void powervr2_device::device_reset()
dc_texture_ram = state->dc_texture_ram.target();
dc_framebuffer_ram = state->dc_framebuffer_ram.target();
}
/* called by TIMER_ADD_PERIODIC, in driver sections */
void powervr2_device::pvr_scanline_timer(int vpos)
{
int vbin_line = spg_vblank_int & 0x3ff;
int vbout_line = (spg_vblank_int >> 16) & 0x3ff;
if(vbin_line == vpos)
irq_cb(VBL_IN_IRQ);
if(vbout_line == vpos)
irq_cb(VBL_OUT_IRQ);
}

View File

@ -264,6 +264,7 @@ public:
TIMER_CALLBACK_MEMBER(pvr_dma_irq);
void pvr_dma_execute(address_space &space);
void pvr_scanline_timer(int vpos);
UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
protected:

View File

@ -26,7 +26,7 @@
- F355 Challenge: asserts after Sega logo;
- Idol Janshi wo Tsukucchaou: pixel aspect is way wrong (stretched and offsetted horizontally)
- Power Stone: hangs at Capcom logo;
- Sega GT: hangs at "produced by Sega" screen;
- Sega GT: hangs with a white screen after pressing start on attract mode (executes SCSI command 0x20 -> CD-Play);
- Tetris 4D: has color bugs, hangs at FMV anyway
Note:
@ -369,6 +369,7 @@ static MACHINE_CONFIG_START( dc, dc_cons_state )
MCFG_CPU_CONFIG(sh4cpu_config)
MCFG_CPU_PROGRAM_MAP(dc_map)
MCFG_CPU_IO_MAP(dc_port)
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", dc_state, dc_scanline, "screen", 0, 1)
MCFG_CPU_ADD("soundcpu", ARM7, ((XTAL_33_8688MHz*2)/3)/8) // AICA bus clock is 2/3rds * 33.8688. ARM7 gets 1 bus cycle out of each 8.
MCFG_CPU_PROGRAM_MAP(dc_audio_map)