blargg_ppu_tests_2005.09.15b

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
blargg_ppu_tests_2005.09.15b
by on (#61371)
I am confused about the sprite_ram.nes tests.

Specifically, I didn't have anything implemented in my emulator to mask bytes of the OAM read with E3, yet I passed that portion of the test. The original code points to "third sprite bytes" which, if I interpret correctly is the sprite's X coordinate.

Original code:
Code:
      lda   #5;) Third sprite bytes should be masked with $e3 on read
      sta   result
      lda   #3
      sta   $2003
      lda   #$ff
      sta   $2004
      lda   #3
      sta   $2003
      lda   $2004
      cmp   #$e3
      jsr   error_if_eq


The above will never fail on a halfway decent emulator or a real NES. Reason: it is the attributes (byte 2) that is masked not the sprite X.

What I *think* was meant:
Code:
      lda   #5;) Second sprite bytes should be masked with $e3 on read
      sta   result
      lda   #2
      sta   $2003
      lda   #$ff
      sta   $2004
      lda   #2
      sta   $2003
      lda   $2004
      cmp   #$ff
      jsr   error_if_eq


Is this right?

by on (#61400)
That code is definitely wrong in some way. It is true that the third byte should be masked, but that code tests the fourth byte. The code appears to verify that the fourth (X coordinate) is NOT masked with $E3. So yeah, as you wrote, or better, cmp #$e3 : jsr error_if_ne.