It is currently Sun Nov 18, 2018 1:26 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 18 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: Fri Sep 07, 2018 11:30 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 3686
Location: Mountain View, CA
rainwarrior wrote:
If you read status from $2002 on the same cycle that the NMI hits, the NMI flag is cleared before the interrupt happens and it's "cancelled", and the read also returns a 0 for vblank status.

It's the reason why you can't really use a bit $2002 polling loop to time a frame, it will only reliably wait "at least" one frame, but if you're unlucky it'll be more.

Oh, that. Yes, the age-old thing that I used to do in my own (old) code because I assumed the NES did it like the SNES. :/ Anyway, I didn't know that's what "the NMI cancelling reading" referred to. Makes sense now. Thank you! :-)


Top
 Profile  
 
PostPosted: Sat Sep 08, 2018 1:57 am 
Offline

Joined: Tue Aug 14, 2018 5:32 am
Posts: 8
Code:
; A taken non-page-crossing branch ignores IRQ during
; its last clock, so that next instruction executes
; before the IRQ. Other instructions would execute the
; NMI before the next instruction.


koitsu wrote:
Wow, this is the first I've heard of IRQ and NMI differing in behaviour, particularly tied to specific opcodes (re: how the underlying opcodes are implemented in silicon). Yikes.


I just assumed that mixing of IRQ and NMI in Blargg's source comment was a typo. I treat them the same in the branch opcodes anyway.


Top
 Profile  
 
PostPosted: Sun Sep 09, 2018 7:07 am 
Offline
Formerly Fx3
User avatar

Joined: Fri Nov 12, 2004 4:59 pm
Posts: 3155
Location: Brazil
JonteP wrote:
I just assumed that mixing of IRQ and NMI in Blargg's source comment was a typo. I treat them the same in the branch opcodes anyway.

No, it wasn't. Did you read the entire test source code? Here's the FULL description...
Code:
; A taken non-page-crossing branch ignores IRQ during
; its last clock, so that next instruction executes
; before the IRQ. Other instructions would execute the
; NMI before the next instruction.
;
; The same occurs for NMI, though that's not tested here.

I suggest you to read the full source of 3-nmi_and_irq - "NMI behavior when it interrupts IRQ vectoring".


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 18 posts ]  Go to page Previous  1, 2

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group