PPU: Fixed sprite range/time flags and hblank flag

This commit is contained in:
Sour 2019-03-02 00:11:42 -05:00
parent 672e4422f7
commit 28a151e00d
3 changed files with 6 additions and 7 deletions

View file

@ -79,7 +79,7 @@ uint8_t InternalRegisters::Read(uint16_t addr)
//TODO TIMING (set/clear timing) //TODO TIMING (set/clear timing)
return ( return (
(state.Scanline >= vblankStart ? 0x80 : 0) | (state.Scanline >= vblankStart ? 0x80 : 0) |
((state.Cycle >= 0x121 || state.Cycle <= 0x15) ? 0x40 : 0) | (state.Cycle >= 0x121 ? 0x40 : 0) | //TODO VERIFY (seems to contradict Anomie's docs?)
((_enableAutoJoypadRead && state.Scanline >= vblankStart && state.Scanline <= vblankStart + 2) ? 0x01 : 0) //Auto joypad read in progress ((_enableAutoJoypadRead && state.Scanline >= vblankStart && state.Scanline <= vblankStart + 2) ? 0x01 : 0) //Auto joypad read in progress
); );
} }

View file

@ -70,8 +70,6 @@ void Ppu::Exec()
_cycle = -1; _cycle = -1;
_scanline++; _scanline++;
_rangeOver = false;
_timeOver = false;
if(_scanline == (_overscanMode ? 240 : 225)) { if(_scanline == (_overscanMode ? 240 : 225)) {
//Reset OAM address at the start of vblank? //Reset OAM address at the start of vblank?
if(!_forcedVblank) { if(!_forcedVblank) {
@ -94,6 +92,8 @@ void Ppu::Exec()
} else if(_scanline == 261) { } else if(_scanline == 261) {
_regs->SetNmiFlag(false); _regs->SetNmiFlag(false);
_scanline = 0; _scanline = 0;
_rangeOver = false;
_timeOver = false;
if(_mosaicEnabled) { if(_mosaicEnabled) {
_mosaicStartScanline = 0; _mosaicStartScanline = 0;
@ -209,12 +209,12 @@ void Ppu::EvaluateNextLineSprites()
} }
totalWidth += width; totalWidth += width;
if(totalWidth >= 34 * 8) { if(totalWidth > 34 * 8) {
_timeOver = true; _timeOver = true;
} }
_spriteCount++; _spriteCount++;
if(_spriteCount == 32) { if(_spriteCount > 32) {
_rangeOver = true; _rangeOver = true;
} }
@ -1145,7 +1145,6 @@ uint8_t Ppu::Read(uint16_t addr)
return value; return value;
} }
case 0x213E: case 0x213E:
//STAT77 - PPU Status Flag and Version //STAT77 - PPU Status Flag and Version
//TODO open bus on bit 4 //TODO open bus on bit 4

View file

@ -78,7 +78,7 @@ private:
uint16_t *_outputBuffers[2]; uint16_t *_outputBuffers[2];
uint16_t *_currentBuffer; uint16_t *_currentBuffer;
SpriteInfo _sprites[32] = {}; SpriteInfo _sprites[33] = {};
uint8_t _spriteCount = 0; uint8_t _spriteCount = 0;
uint8_t _spritePriority[256] = {}; uint8_t _spritePriority[256] = {};
uint8_t _spritePalette[256] = {}; uint8_t _spritePalette[256] = {};