Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > 65816 WAI NMI Edge Case
2021-04-29 10:44
oziphantom

Registered: Oct 2014
Posts: 478
65816 WAI NMI Edge Case

The 65816 has a special mode of WAI, when you Set I it will not fire the IRQB handler and drop to the next instruction.
It does mention that ABORTB will behavior differently, in that it will exit the WAI but not start the processor.

However there is no mention of what happens in the instance of a NMI.

so
SEI
WAI
; NMI fires

does it

a.)handle NMI as per normal and return to the WAI

b.)handle NMI as per normal and exit from the WAI

c.)skip the NMI handler and exit from the WAI

Does anybody know? I can't find any test cases or documented evidence of what it does do. Some things don't mention it, some things say it will trap "any" interrupt.
2021-04-29 12:01
Krill

Registered: Apr 2002
Posts: 2839
From W65C816S manual:
"NMIB, IRQB or RESB will terminate the WAI condition and transfer control to the interrupt handler routine."

This reads like option b.) to me.
2021-04-29 12:19
oziphantom

Registered: Oct 2014
Posts: 478
keep reading. That is the

CLI
WAI

method.

SEI
WAI

acts differently.
2021-04-29 12:21
Krill

Registered: Apr 2002
Posts: 2839
Well, relevant rest is basically, "When the Status Register I flag is set (IRQB disabled) the IRQB interrupt will cause the next instruction (following the WAI instruction) to be executed without going to the IRQB interrupt handler."

So there is no special mention of other interrupt sources, implying that the I flag is irrelevant for the NMI case.
2021-04-29 12:49
oziphantom

Registered: Oct 2014
Posts: 478
only it does affect the ABORTB signal which is not affected by I under any conditions normally and has a higher priority than the NMI.

But ignoring the ABORTB, we are still left with does the NMI do a or c.
Having a react to IRQB in 1 clock getting tripped up by an NMI sounds bad, while I might want to do the NMI I would also probably not want the code that was designed to happen straight after an IRQ to happen without the IRQ. However there is no mention or cation against this scenario either.

This site http://6502.org/tutorials/65c816interrupts.html claims "any" for example when talking about the SEI WAI case.
2021-04-29 13:33
Krill

Registered: Apr 2002
Posts: 2839
http://forum.6502.org/viewtopic.php?f=1&t=5428#p65552

These guys seem to have practical experience with the issue, and it reads like option c.) to me.

In any case, this stuff should be fairly easy to test on real hardware.
2021-04-29 14:11
oziphantom

Registered: Oct 2014
Posts: 478
BigDumbDinosaur says it's c.
drogon says 'fairly confident' it's not c, and seems mostly likely they infer b
2021-04-29 14:35
Krill

Registered: Apr 2002
Posts: 2839
And neither bothered to test it on real hardware? :)
2021-04-29 15:39
oziphantom

Registered: Oct 2014
Posts: 478
they might have, but if they did, they didn't document their findings.
2021-04-29 16:11
chatGPZ

Registered: Dec 2001
Posts: 11111
And why dont you? I mean... isnt it the obvious thing to do? :)
2021-04-29 16:43
oziphantom

Registered: Oct 2014
Posts: 478
I don't have a SuperCPU, I don't have an Apple IIgs, nor a Foniex 256 and I don't have a SDPro for a SNES.

Otherwise I would have.
 
... 7 posts hidden. Click here to view all posts....
 
Previous - 1 | 2 - Next
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
Menace/Spaceballs
Apollyon/ALD
MCM/ONSLAUGHT
Guests online: 87
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 Wonderland XIV  (9.6)
9 Bromance  (9.6)
10 Memento Mori  (9.6)
Top onefile Demos
1 It's More Fun to Com..  (9.7)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 Rainbow Connection  (9.5)
6 TRSAC, Gabber & Pebe..  (9.5)
7 Onscreen 5k  (9.5)
8 Wafer Demo  (9.5)
9 Dawnfall V1.1  (9.5)
10 Quadrants  (9.5)
Top Groups
1 Oxyron  (9.3)
2 Nostalgia  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Logo Graphicians
1 Sander  (10)
2 Facet  (9.7)
3 Mermaid  (9.4)
4 Pal  (9.4)
5 Shine  (9.3)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.042 sec.