newppu: improve timing. fix vice project doom

This commit is contained in:
zeromus 2008-08-19 04:06:24 +00:00
parent f6b541ce2f
commit 83f30885a2
1 changed files with 39 additions and 37 deletions

View File

@ -1808,14 +1808,16 @@ int FCEUX_PPU_Loop(int skip) {
} }
{ {
//vblank
PPU_status |= 0x80;
if(VBlankON) TriggerNMI();
//TRICKY: //TRICKY:
//even though the timing doc says that every scanline is 1364 except for the first dummy scanline, //even though the timing doc says that every scanline is 1364 except for the first dummy scanline,
//i need these to be 1360 in order to get marble madness and pirates! to work. //i need these to be 1360 in order to get marble madness and pirates! to work.
runppu(20*1360); runppu(1*1360);
PPU_status |= 0x80;
runppu(48);
if(VBlankON) TriggerNMI();
runppu(19*1360-48);
//no longer in vblank //no longer in vblank
PPU_status &= ~0x80; PPU_status &= ~0x80;
@ -1902,7 +1904,6 @@ int FCEUX_PPU_Loop(int skip) {
pixelcolor = PALRAM[pixel]; pixelcolor = PALRAM[pixel];
//look for a sprite to be drawn //look for a sprite to be drawn
if(renderspritenow) {
bool havepixel = false; bool havepixel = false;
for(int s=0;s<oamcount;s++) { for(int s=0;s<oamcount;s++) {
uint8* oam = oams[renderslot][s]; uint8* oam = oams[renderslot][s];
@ -1917,6 +1918,8 @@ int FCEUX_PPU_Loop(int skip) {
oam[4] >>= 1; oam[4] >>= 1;
oam[5] >>= 1; oam[5] >>= 1;
if(!renderspritenow) continue;
//bail out if we already have a pixel from a higher priority sprite //bail out if we already have a pixel from a higher priority sprite
if(havepixel) continue; if(havepixel) continue;
@ -1943,7 +1946,6 @@ int FCEUX_PPU_Loop(int skip) {
pixelcolor = PALRAM[0x10+spixel]; pixelcolor = PALRAM[0x10+spixel];
} }
} }
}
//fceu rendering system requires that this be set //fceu rendering system requires that this be set
//(so that it knows there is a valid pixel there?) //(so that it knows there is a valid pixel there?)
@ -2083,7 +2085,7 @@ int FCEUX_PPU_Loop(int skip) {
//idle for one line //idle for one line
//why 1360? see the note up top at vblank //why 1360? see the note up top at vblank
runppu(1360); runppu(1364);
framectr++; framectr++;