Emulator failing ppu_vbl_nmi test #2

This is an archive of a topic from NESdev BBS, taken in mid-October 2019 before a server upgrade.
View original topic
Emulator failing ppu_vbl_nmi test #2
by on (#223795)
Hello. My emulator currently passes blargg's CPU opcode test, but fails some of the "ppu_vbl_nmi.nes" tests.

Test #2 documentation (from the source):

Code:
; Verifies time VBL flag is set.
;
; Reads $2002 twice and prints VBL flags from
; them. Test is run one PPU clock later each time,
; around the time the flag is set.
;
; ^@T+ 1 2
; 00 - V
; 01 - V
; 02 - V
; 03 - V   ; after some resets this is - -
; 04 - -   ; flag setting is suppressed
; 05 V -
; 06 V -
; 07 V -
; 08 V -


My output:
Code:
$ ./output/testsuite
Unhandled PPU.write(0002, 00)
FAIL: src/emulator/test/PpuVblNmiCart_t.cc:86  0x00(0x00) != status(0x01)
  T+ 1 2
  00 - V
  01 - V
  02 - V
  03 - V
  04 - V
  05 V -
  06 V -
  07 V -
  08 V -
  4103C340
  02-vbl_set_time
  Failed
  While running test 2 of 10
Total tests: 354
Failed tests: 1


My own PPU VBL timing unit test [1] passes.

I assume that test #2 is testing that the emulator properly implements the race condition described in [2]. Can anyone confirm this hypothesis?

[1] https://pastebin.com/rD4PTeG6
[2] https://wiki.nesdev.com/w/index.php/NMI
Re: Emulator failing ppu_vbl_nmi test #2
by on (#223796)
If I'm not wrong, it's the same question here.
viewtopic.php?f=3&t=17663
Re: Emulator failing ppu_vbl_nmi test #2
by on (#223812)
I'm trying to fix the exact same bug right now in my emu.
Some info: check out "VBL FLag Timing" at this page http://wiki.nesdev.com/w/index.php/PPU_frame_timing