| |
Krill
Registered: Apr 2002 Posts: 2980 |
TIL: The instruction after SEI can be executed before a pending IRQ is handled
As described here: http://visual6502.org/wiki/index.php?title=6502_Timing_of_Inter..
I never knew this, after all those years, and thought i'd share this as a heads-up.
Thanks to Bubis for pointing it out to me! |
|
... 89 posts hidden. Click here to view all posts.... |
| |
Krill
Registered: Apr 2002 Posts: 2980 |
Quoting lftOn a side note, there is no need to disable CIA2 interrupts (NMI) at the beginning of a program that is launched from BASIC. You do, however, want to trigger one NMI that you never acknowledge, so the pesky restore key won't disrupt your meticulously hand-crafted timing. :) |
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
I dont care about restore, if the user wants to crash the demo let it be. its his own fault :) |
| |
lft
Registered: Jul 2007 Posts: 369 |
The enemy (nmi?) cannot push RESTORE if you disable his hand. |
| |
chatGPZ
Registered: Dec 2001 Posts: 11386 |
Quote:I dont care about restore
i've switched to just pointing the NMI vectors to some silly routine that punishes the bastard who pressed RESTORE accordingly :) |
| |
TWW
Registered: Jul 2009 Posts: 545 |
Ground the fucker ^^ |
| |
MagerValp
Registered: Dec 2001 Posts: 1078 |
For reference, here's a bog standard raster IRQ setup that'll work every time if run from basic:
lda #$7f
sta $dc0d
lda #$35
sta $01
lda #$1b
sta $d011
lda #$fa
sta $d012
lda #<irq
sta $fffe
lda #>irq
sta $ffff
lda #1
sta $d019
sta $d01a
NB: Clearing pending IRQs with $d019 is not strictly necessary if you run from a freshly reset machine (the kernal writes $0f to $d019 on reset), but if something else ran before and exited to the basic prompt there may be an unacknowledged raster IRQ pending. |
| |
Krill
Registered: Apr 2002 Posts: 2980 |
Quoting MagerValpbut if something else ran before and exited to the basic prompt there may be an unacknowledged raster IRQ pending. Hmm, if whatever ran before left unacknowledged interrupts behind, wouldn't they trigger time and again without ever being acknowledged, so the BASIC prompt would never be reached and IRQs be handled in an endless loop? :) |
| |
MagerValp
Registered: Dec 2001 Posts: 1078 |
No, they're still masked by a zero value in $d01a. Hmm, I wonder if the soft reset before the ready prompt clears it... Just checked, and afaict, nope. |
| |
iAN CooG
Registered: May 2002 Posts: 3193 |
" if run from basic "
and what about if it's not? Why even assuming it? It's not better to be safe and put ALSO sei/cli, and clearing $D019 too in any case? |
| |
MagerValp
Registered: Dec 2001 Posts: 1078 |
Clearing $d019 is necessary, and testing a bit more it seems like it's necessary even on a freshly reset machine. SEI/CLI is still useless though, and only creates the problem of having to clear $dc0d. |
Previous - 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 - Next |