https://github.com/DiasparCitizen/eNESimo

This game is never launching due to an infinite loop while the game is waiting for VB to be set to 1.

In the following trace you'll see pretty well what's going on.

As a summary:

- The CPU loops between F74E and F751 waiting for Vblank bit to be set

- Vblank is set to 1 when the PPU reaches the correct scanline

- A NMI is triggered, the CPU jumps to F294 to execute the NMI routine

- In the NMI routine, the thread reads PPU_status, thereby clearing Vblank

- When the thread is back in the loop, the Vblank bit is lost

*/* INFINITE LOOP */*

48753 F74E 173:LDA-abs(4+0) $220 A:00 X:00 Y:01 P:27 SP:F3 CYC:309 SL:240 FC:7 CPUCycle:174748 STA:0 MSK:6

48754 F751 16:BPL-rel(2+0) $FBC6 A:00 X:00 Y:01 P:27 SP:F3 CYC:321 SL:240 FC:7 CPUCycle:174752 STA:0 MSK:6

vertical blank to 0 (STATUS READ)

48755 F74E 173:LDA-abs(4+0) $220 A:00 X:00 Y:01 P:27 SP:F3 CYC:330 SL:240 FC:7 CPUCycle:174755 STA:0 MSK:6

48756 F751 16:BPL-rel(2+0) $FBC6 A:00 X:00 Y:01 P:27 SP:F3 CYC:1 SL:241 FC:7 CPUCycle:174759 STA:0 MSK:6

vertical blank to 1

/* START OF NMI ROUTINE */

48757 F294 72:PHA-imp(3+0) $8A48 A:00 X:00 Y:01 P:37 SP:F0 CYC:31 SL:241 FC:7 CPUCycle:174769 STA:80 MSK:6

48758 F295 138:TXA-imp(2+0) $4898 A:00 X:00 Y:01 P:37 SP:EF CYC:40 SL:241 FC:7 CPUCycle:174772 STA:80 MSK:6

48759 F296 72:PHA-imp(3+0) $9848 A:00 X:00 Y:01 P:37 SP:EF CYC:46 SL:241 FC:7 CPUCycle:174774 STA:80 MSK:6

48760 F297 152:TYA-imp(2+0) $48AD A:00 X:00 Y:01 P:37 SP:EE CYC:55 SL:241 FC:7 CPUCycle:174777 STA:80 MSK:6

48761 F298 72:PHA-imp(3+0) $AD2 A:01 X:00 Y:01 P:35 SP:EE CYC:61 SL:241 FC:7 CPUCycle:174779 STA:80 MSK:6

vertical blank to 0 (STATUS READ)

48762 F299 173:LDA-abs(4+0) $220 A:01 X:00 Y:01 P:35 SP:ED CYC:70 SL:241 FC:7 CPUCycle:174782 STA:80 MSK:6

48763 F29C 165:LDA-zpg(3+0) $4D0 A:80 X:00 Y:01 P:B5 SP:ED CYC:82 SL:241 FC:7 CPUCycle:174786 STA:0 MSK:6

48764 F29E 208:BNE-rel(2+0) $76E6 A:02 X:00 Y:01 P:35 SP:ED CYC:91 SL:241 FC:7 CPUCycle:174789 STA:0 MSK:6

48765 F316 32:JSR-abs(6+0) $F2F8 A:02 X:00 Y:01 P:35 SP:ED CYC:103 SL:241 FC:7 CPUCycle:174793 STA:0 MSK:6

vertical blank to 0 (STATUS READ)

48766 F8F2 174:LDX-abs(4+0) $220 A:02 X:00 Y:01 P:35 SP:EB CYC:121 SL:241 FC:7 CPUCycle:174799 STA:0 MSK:6

48767 F8F5 166:LDX-zpg(3+0) $558E A:02 X:00 Y:01 P:37 SP:EB CYC:133 SL:241 FC:7 CPUCycle:174803 STA:0 MSK:648753 F74E 173:LDA-abs(4+0) $220 A:00 X:00 Y:01 P:27 SP:F3 CYC:309 SL:240 FC:7 CPUCycle:174748 STA:0 MSK:6

48754 F751 16:BPL-rel(2+0) $FBC6 A:00 X:00 Y:01 P:27 SP:F3 CYC:321 SL:240 FC:7 CPUCycle:174752 STA:0 MSK:6

vertical blank to 0 (STATUS READ)

48755 F74E 173:LDA-abs(4+0) $220 A:00 X:00 Y:01 P:27 SP:F3 CYC:330 SL:240 FC:7 CPUCycle:174755 STA:0 MSK:6

48756 F751 16:BPL-rel(2+0) $FBC6 A:00 X:00 Y:01 P:27 SP:F3 CYC:1 SL:241 FC:7 CPUCycle:174759 STA:0 MSK:6

vertical blank to 1

/* START OF NMI ROUTINE */

48757 F294 72:PHA-imp(3+0) $8A48 A:00 X:00 Y:01 P:37 SP:F0 CYC:31 SL:241 FC:7 CPUCycle:174769 STA:80 MSK:6

48758 F295 138:TXA-imp(2+0) $4898 A:00 X:00 Y:01 P:37 SP:EF CYC:40 SL:241 FC:7 CPUCycle:174772 STA:80 MSK:6

48759 F296 72:PHA-imp(3+0) $9848 A:00 X:00 Y:01 P:37 SP:EF CYC:46 SL:241 FC:7 CPUCycle:174774 STA:80 MSK:6

48760 F297 152:TYA-imp(2+0) $48AD A:00 X:00 Y:01 P:37 SP:EE CYC:55 SL:241 FC:7 CPUCycle:174777 STA:80 MSK:6

48761 F298 72:PHA-imp(3+0) $AD2 A:01 X:00 Y:01 P:35 SP:EE CYC:61 SL:241 FC:7 CPUCycle:174779 STA:80 MSK:6

vertical blank to 0 (STATUS READ)

48762 F299 173:LDA-abs(4+0) $220 A:01 X:00 Y:01 P:35 SP:ED CYC:70 SL:241 FC:7 CPUCycle:174782 STA:80 MSK:6

48763 F29C 165:LDA-zpg(3+0) $4D0 A:80 X:00 Y:01 P:B5 SP:ED CYC:82 SL:241 FC:7 CPUCycle:174786 STA:0 MSK:6

48764 F29E 208:BNE-rel(2+0) $76E6 A:02 X:00 Y:01 P:35 SP:ED CYC:91 SL:241 FC:7 CPUCycle:174789 STA:0 MSK:6

48765 F316 32:JSR-abs(6+0) $F2F8 A:02 X:00 Y:01 P:35 SP:ED CYC:103 SL:241 FC:7 CPUCycle:174793 STA:0 MSK:6

vertical blank to 0 (STATUS READ)

48766 F8F2 174:LDX-abs(4+0) $220 A:02 X:00 Y:01 P:35 SP:EB CYC:121 SL:241 FC:7 CPUCycle:174799 STA:0 MSK:6

48767 F8F5 166:LDX-zpg(3+0) $558E A:02 X:00 Y:01 P:37 SP:EB CYC:133 SL:241 FC:7 CPUCycle:174803 STA:0 MSK:6

Now, this is a trace from MESEN.

You'll see that the CPU is not jumping to the NMI routine after Vblank is set:

*F74E $AD $02 $20 LDA PpuStatus_2002 A:00 X:00 Y:00 P:06 SP:FB CYC:330 SL:240 FC:2 CPU Cycle:27389*

F751 $10 $FB BPL $F74E A:00 X:00 Y:00 P:06 SP:FB CYC:1 SL:241 FC:2 CPU Cycle:27393

F74E $AD $02 $20 LDA PpuStatus_2002 A:00 X:00 Y:00 P:06 SP:FB CYC:10 SL:241 FC:2 CPU Cycle:27396

F751 $10 $FB BPL $F74E A:80 X:00 Y:00 P:84 SP:FB CYC:22 SL:241 FC:2 CPU Cycle:27400

/* THREAD SUCCESSFULLY ESCAPES LOOP */

F753 $C6 $04 DEC $04 A:80 X:00 Y:00 P:84 SP:FB CYC:28 SL:241 FC:2 CPU Cycle:27402

F755 $A9 $00 LDA #$00 A:80 X:00 Y:00 P:06 SP:FB CYC:43 SL:241 FC:2 CPU Cycle:27407

F757 $8D $03 $20 STA OamAddr_2003 A:00 X:00 Y:00 P:06 SP:FB CYC:49 SL:241 FC:2 CPU Cycle:27409

F75A $A9 $02 LDA #$02 A:00 X:00 Y:00 P:06 SP:FB CYC:61 SL:241 FC:2 CPU Cycle:27413F751 $10 $FB BPL $F74E A:00 X:00 Y:00 P:06 SP:FB CYC:1 SL:241 FC:2 CPU Cycle:27393

F74E $AD $02 $20 LDA PpuStatus_2002 A:00 X:00 Y:00 P:06 SP:FB CYC:10 SL:241 FC:2 CPU Cycle:27396

F751 $10 $FB BPL $F74E A:80 X:00 Y:00 P:84 SP:FB CYC:22 SL:241 FC:2 CPU Cycle:27400

/* THREAD SUCCESSFULLY ESCAPES LOOP */

F753 $C6 $04 DEC $04 A:80 X:00 Y:00 P:84 SP:FB CYC:28 SL:241 FC:2 CPU Cycle:27402

F755 $A9 $00 LDA #$00 A:80 X:00 Y:00 P:06 SP:FB CYC:43 SL:241 FC:2 CPU Cycle:27407

F757 $8D $03 $20 STA OamAddr_2003 A:00 X:00 Y:00 P:06 SP:FB CYC:49 SL:241 FC:2 CPU Cycle:27409

F75A $A9 $02 LDA #$02 A:00 X:00 Y:00 P:06 SP:FB CYC:61 SL:241 FC:2 CPU Cycle:27413

Clearly the logic of my PPU contains an error.

Any ideas?