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 > TIL: The instruction after SEI can be executed before a pending IRQ is handled
2017-11-07 15:56
Krill

Registered: Apr 2002
Posts: 2804
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....
 
2017-11-08 20:46
lft

Registered: Jul 2007
Posts: 369
The enemy (nmi?) cannot push RESTORE if you disable his hand.
2017-11-08 21:05
chatGPZ

Registered: Dec 2001
Posts: 11088
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 :)
2017-11-09 14:43
TWW

Registered: Jul 2009
Posts: 541
Ground the fucker ^^
2017-11-09 15:18
MagerValp

Registered: Dec 2001
Posts: 1055
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.
2017-11-09 15:27
Krill

Registered: Apr 2002
Posts: 2804
Quoting MagerValp
but 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? :)
2017-11-09 15:44
MagerValp

Registered: Dec 2001
Posts: 1055
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.
2017-11-09 15:48
iAN CooG

Registered: May 2002
Posts: 3128
" 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?
2017-11-09 15:51
MagerValp

Registered: Dec 2001
Posts: 1055
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.
2017-11-09 18:01
Stone

Registered: Oct 2006
Posts: 168
Quoting iAN CooG
" if run from basic "
and what about if it's not?
Then you either know about the calling context and set things up accordingly, OR you know nothing, in which case initial setup is the responsibility of the caller.
2017-11-10 07:56
ChristopherJam

Registered: Aug 2004
Posts: 1359
Quoting MagerValp
For reference, here's a bog standard raster IRQ setup that'll work every time if run from basic.


Â…and if you also zero $d01a at the start of the routine, it should then behave itself if your predecessor left a raster interrupt installed :)
Previous - 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 - 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
csabanw
Sentinel/Excess/TREX
Eryk/Chrome
Guests online: 298
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 No Bounds  (9.6)
6 Comaland 100%  (9.6)
7 Uncensored  (9.6)
8 The Ghost  (9.6)
9 Wonderland XIV  (9.6)
10 Bromance  (9.6)
Top onefile Demos
1 Party Elk 2  (9.7)
2 Cubic Dream  (9.6)
3 Copper Booze  (9.5)
4 Rainbow Connection  (9.5)
5 TRSAC, Gabber & Pebe..  (9.5)
6 Onscreen 5k  (9.5)
7 Dawnfall V1.1  (9.5)
8 Quadrants  (9.5)
9 Daah, Those Acid Pil..  (9.5)
10 Birth of a Flower  (9.5)
Top Groups
1 Booze Design  (9.3)
2 Nostalgia  (9.3)
3 Oxyron  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Coders
1 Axis  (9.8)
2 Graham  (9.8)
3 Lft  (9.8)
4 Crossbow  (9.8)
5 HCL  (9.8)

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