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)
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
);
}

View file

@ -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

View file

@ -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] = {};