Previous 199869 Revisions Next

r21814 Wednesday 13th March, 2013 at 00:49:18 UTC by Angelo Salese
Improved VDP1 timings, fixes several Saturn games such as Fatal Fury 3, Night Striker S, Command & Conquer
[src/emu/machine]saturn.c
[src/emu/video]stvvdp1.c stvvdp2.c
[src/mame/includes]stv.h

trunk/src/mame/includes/stv.h
r21813r21814
162162   TIMER_CALLBACK_MEMBER(dma_lv0_ended);
163163   TIMER_CALLBACK_MEMBER(dma_lv1_ended);
164164   TIMER_CALLBACK_MEMBER(dma_lv2_ended);
165   TIMER_CALLBACK_MEMBER(vdp1_draw_end);
165166   void scu_single_transfer(address_space &space, UINT32 src, UINT32 dst,UINT8 *src_shift);
166167   void scu_dma_direct(address_space &space, UINT8 dma_ch);
167168   void scu_dma_indirect(address_space &space,UINT8 dma_ch);
trunk/src/emu/video/stvvdp2.c
r21813r21814
44564456      /* Langrisser III bit 3 normal, bit 1 during battle field */
44574457      /* Metal Slug bit 0 during gameplay */
44584458      /* Bug! Sega Away Logo onward 0x470 */
4459      if(STV_VDP2_SFSEL & ~0x47b)
4459      /* Command & Conquer 0x0004 0xc000 */
4460      if(STV_VDP2_SFSEL & ~0x47f)
44604461         popmessage("Special Function Code Select enable %04x %04x, contact MAMEdev",STV_VDP2_SFSEL,STV_VDP2_SFCODE);
44614462
44624463      /* Albert Odyssey Gaiden 0x0001 */
trunk/src/emu/video/stvvdp1.c
r21813r21814
16631663}
16641664
16651665
1666
1667
16661668void saturn_state::stv_vdp1_draw_normal_sprite(const rectangle &cliprect, int sprite_type)
16671669{
16681670   //UINT16 *destline;
r21813r21814
17451747   }
17461748}
17471749
1750TIMER_CALLBACK_MEMBER(saturn_state::vdp1_draw_end )
1751{
1752   /* set CEF to 1*/
1753   CEF_1;
1754
1755   if(!(m_scu.ism & IRQ_VDP1_END))
1756   {
1757      m_maincpu->set_input_line_and_vector(0x2, HOLD_LINE, 0x4d);
1758      scu_do_transfer(6);
1759   }
1760   else
1761      m_scu.ist |= (IRQ_VDP1_END);
1762}
1763
1764
17481765void saturn_state::stv_vdp1_process_list( void )
17491766{
17501767   int position;
r21813r21814
17761793   //      position = 0;
17771794   //  }
17781795
1796      spritecount++;
1797
17791798      stv2_current_sprite.CMDCTRL = (m_vdp1_vram[position * (0x20/4)+0] & 0xffff0000) >> 16;
17801799
17811800      if (stv2_current_sprite.CMDCTRL == 0x8000)
r21813r21814
19691988         }
19701989      }
19711990
1972      spritecount++;
1973
19741991   }
19751992
19761993
19771994   end:
1978   /* set CEF to 1*/
1979   CEF_1;
19801995   m_vdp1.copr = (position * 0x20) >> 3;
19811996
1997   /* TODO: what's the exact formula? Guess it should be a mix between number of pixels written and actual command data fetched. */
1998   machine().scheduler().timer_set(m_maincpu->cycles_to_attotime(spritecount*16), timer_expired_delegate(FUNC(saturn_state::vdp1_draw_end),this));
1999
19822000   if (VDP1_LOG) logerror ("End of list processing!\n");
19832001}
19842002
trunk/src/emu/machine/saturn.c
r21813r21814
479479   if(!(DWUP(dma_ch))) m_scu.dst[dma_ch] = tmp_dst;
480480
481481   {
482      /*TODO: change DMA into DRQ model. Timing is a guess.  */
482      /*TODO: Timing is a guess.  */
483483      switch(dma_ch)
484484      {
485485         case 0: machine().scheduler().timer_set(m_maincpu->cycles_to_attotime(total_size/4), timer_expired_delegate(FUNC(saturn_state::dma_lv0_ended),this)); break;
r21813r21814
825825
826826   //popmessage("%08x %d T0 %d T1 %d %08x",m_scu.ism ^ 0xffffffff,max_y,m_scu_regs[36],m_scu_regs[37],m_scu_regs[38]);
827827
828   if(scanline == (0)*y_step)
829   {
830      video_update_vdp1();
831
832      if(STV_VDP1_VBE)
833         m_vdp1.framebuffer_clear_on_next_frame = 1;
834
835      if(!(m_scu.ism & IRQ_VDP1_END))
836      {
837         m_maincpu->set_input_line_and_vector(0x2, HOLD_LINE, 0x4d);
838         scu_do_transfer(6);
839      }
840      else
841         m_scu.ist |= (IRQ_VDP1_END);
842   }
843
844828   if(scanline == 0*y_step)
845829   {
846830      if(!(m_scu.ism & IRQ_VBLANK_OUT))
r21813r21814
861845      }
862846      else
863847         m_scu.ist |= (IRQ_VBLANK_IN);
848
849      /* TODO: when Automatic Draw actually happens? Night Striker S is very fussy on this, and it looks like that VDP1 starts at more or less vblank-in time ... */
850      video_update_vdp1();
864851   }
865852   else if((scanline % y_step) == 0 && scanline < vblank_line*y_step)
866853   {
r21813r21814
873860         m_scu.ist |= (IRQ_HBLANK_IN);
874861   }
875862
863   if(scanline == (vblank_line+1)*y_step)
864   {
865      /* docs mentions that VBE happens one line after vblank-in. */
866      if(STV_VDP1_VBE)
867         m_vdp1.framebuffer_clear_on_next_frame = 1;
868   }
869
870
876871   if(scanline == (m_scu_regs[36] & 0x3ff)*y_step)
877872   {
878873      if(!(m_scu.ism & IRQ_TIMER_0))

Previous 199869 Revisions Next


© 1997-2024 The MAME Team