diff --git a/Core/InternalRegisters.cpp b/Core/InternalRegisters.cpp index bb7a0ea..fd953eb 100644 --- a/Core/InternalRegisters.cpp +++ b/Core/InternalRegisters.cpp @@ -79,7 +79,7 @@ uint8_t InternalRegisters::Read(uint16_t addr) //TODO TIMING (set/clear timing) return ( (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 ); } diff --git a/Core/Ppu.cpp b/Core/Ppu.cpp index 7471949..aec54d8 100644 --- a/Core/Ppu.cpp +++ b/Core/Ppu.cpp @@ -70,8 +70,6 @@ void Ppu::Exec() _cycle = -1; _scanline++; - _rangeOver = false; - _timeOver = false; if(_scanline == (_overscanMode ? 240 : 225)) { //Reset OAM address at the start of vblank? if(!_forcedVblank) { @@ -94,6 +92,8 @@ void Ppu::Exec() } else if(_scanline == 261) { _regs->SetNmiFlag(false); _scanline = 0; + _rangeOver = false; + _timeOver = false; if(_mosaicEnabled) { _mosaicStartScanline = 0; @@ -209,12 +209,12 @@ void Ppu::EvaluateNextLineSprites() } totalWidth += width; - if(totalWidth >= 34 * 8) { + if(totalWidth > 34 * 8) { _timeOver = true; } _spriteCount++; - if(_spriteCount == 32) { + if(_spriteCount > 32) { _rangeOver = true; } @@ -1145,7 +1145,6 @@ uint8_t Ppu::Read(uint16_t addr) return value; } - case 0x213E: //STAT77 - PPU Status Flag and Version //TODO open bus on bit 4 diff --git a/Core/Ppu.h b/Core/Ppu.h index 55f5f13..7225128 100644 --- a/Core/Ppu.h +++ b/Core/Ppu.h @@ -78,7 +78,7 @@ private: uint16_t *_outputBuffers[2]; uint16_t *_currentBuffer; - SpriteInfo _sprites[32] = {}; + SpriteInfo _sprites[33] = {}; uint8_t _spriteCount = 0; uint8_t _spritePriority[256] = {}; uint8_t _spritePalette[256] = {};