hi there! i'm having some issues with the rendering that i'd like to comment in order to get some help.
as all the documents says, reading 2002 will clear D7 and the 2006 register's latch, and the value returned is the value in 2002 before D7 were cleared. but look at this:
(i'm not implementing scrolling yet...)
as you can see, there's no king kong up there in the green area. that snapshot were taken while emulating 2002 like this:
the code is self explanatory and (i suppose...) it basically emulates the correct behavior of a register 2002 read.
while debbuging my emu, i deleted the line "PPU_2002 &= 0x7F;", so no D7 will be cleared after reding 2002, and this were the results:
also i'm clearing D7 after 6820 CPU cycles since VBlank starts and after an entire frame passes (89342 CPU cycles), and clearing it after scanline #240.
obviusly, there's some errors out there in my code, because i'm not doing what i should be doing (clear D7 after read 2002) but my emu still works. why does this bug happens?[/code]
as all the documents says, reading 2002 will clear D7 and the 2006 register's latch, and the value returned is the value in 2002 before D7 were cleared. but look at this:
(i'm not implementing scrolling yet...)
as you can see, there's no king kong up there in the green area. that snapshot were taken while emulating 2002 like this:
Code:
BYTE* ReadMem(WORD Address)
{
BYTE tmp2006;
switch(Address)
{
case 0x2002: // PPUSTATUS
tmp2002 = PPU_2002; // Get previous value of 2002
PPU_2002 &= 0x7F; // Clear D7
Latch2006 = 0; // Clear the latch
return tmp2002; // Return previous value of 2002
...
}
}
{
BYTE tmp2006;
switch(Address)
{
case 0x2002: // PPUSTATUS
tmp2002 = PPU_2002; // Get previous value of 2002
PPU_2002 &= 0x7F; // Clear D7
Latch2006 = 0; // Clear the latch
return tmp2002; // Return previous value of 2002
...
}
}
the code is self explanatory and (i suppose...) it basically emulates the correct behavior of a register 2002 read.
while debbuging my emu, i deleted the line "PPU_2002 &= 0x7F;", so no D7 will be cleared after reding 2002, and this were the results:
also i'm clearing D7 after 6820 CPU cycles since VBlank starts and after an entire frame passes (89342 CPU cycles), and clearing it after scanline #240.
obviusly, there's some errors out there in my code, because i'm not doing what i should be doing (clear D7 after read 2002) but my emu still works. why does this bug happens?[/code]