Here's a sadistic test for your HuC6280/VDC emulation:
http://sarsie.fobby.net/junk/irq3.zipIt should display a picture of Bob Dole for a fraction of a second, and then the Lord of Nightmares wielding a shovel.
If it only shows Bob Dole, the test fails. :b
Two rather prominent HuCard games that I know rely on correctly emulating what this test tests: Jackie Chan's Action Kung Fu(may work correctly even if you emulate it incorrectly), and Final Soldier(will be in "vibrating mode" unless you emulate it correctly
).
The reason this issue comes up is because the games erroneously(I presume, though I didn't read the programmers' minds) do:
cli
lda $0000
when they should've done:
lda $0000
cli
"CLI/SEI changes to the I flag are delayed by 1 instruction" is only a convenient generalization to inner 6502-family behavior, which works on most cases, but not all.
You need to sample the external IRQ inputs masked against the I flag before the action of the last effective cycle of the current instruction is completed(be it setting/clearing the I flag, or doing a read).
This "CLI/acknowledge" double-IRQ issue does not appear to affect timer IRQs, interestingly enough. Though I acknowledged the timer IRQ with a write...it's always possible that the IRQ sampling semantics are different on a write than a read, though I doubt it, it's probably just a timer nuance. (But I'll try to remember to test it sometime)