NESDev and Strangulation Records messageboards
Forum Index | FAQ | New User | Login | Search

Previous ThreadView All ThreadsNext ThreadShow in Flat Mode*


SubjectPolled VBL wierdness?  
Posted byblargg
Posted on12/6/03 11:21 PM
From IP199.170.89.100  



I prefer polling the VBL rather than using an NMI handler for simple experiments on the NES but have observed $2002.7 not being set sometimes. The following code demonstrates this by toggling the DMC's DAC for every VBL ,which makes missed VBLs audibly obvious:

      lda   #0          ; init PPU
sta $2000
sta $2001

lda #63
loop: bit $2002
bpl loop
eor #63 ; toggle DAC
sta $4011
jmp loop

If I use LDA instead of BIT (with appropriate saving and restoring of A), the results are the same. If I insert NOPs into the loop, the VBL is periodically missed. My current solution is to use a minimal NMI handler that just sets a "NMI occurred" flag and returns, but this is inelegant. Is there some subtlety to properly polling $2002.7?




-
Entire Thread
Subject  Posted byPosted On
.Polled VBL wierdness?  blargg12/6/03 11:21 PM
.*Re: Polled VBL wierdness?  Memblers12/7/03 1:36 PM
..*Re: Polled VBL wierdness?  blargg12/8/03 05:50 AM
...*Re: Polled VBL wierdness?  tepples12/8/03 06:46 AM
....*Re: Polled VBL wierdness?  Anonymous12/29/03 03:05 AM
Jump to

Memblers' homepage             Contact Me

Forums powered by WWWThreads Demo