| |
TWW
Registered: Jul 2009 Posts: 545 |
$dc0d madness
how come a lot of people set up their raster IRQ's like:
lda #$01
sta $d01a
lda #$7f (?)
sta $dc0d
and not just simply:
ldx #$00 // I believe 0 = mask and 1 = don't mask but it isn't specified in the prog.ref.manual...
stx $dc0d // Mask out all CIA#1 IRQ's
inx
stx $d01a // Mask out all VICII IRQ's minus raster compare
Where does this "#$7f" come from?
or have i missed some kind of importaint point here? |
|
... 11 posts hidden. Click here to view all posts.... |
| |
Graham Account closed
Registered: Dec 2002 Posts: 990 |
Because the register works quite different than you think.
Bit 7 of the register tells if the selected IRQ masking bits get cleared or set. You select an IRQ masking bit by having it's bit set. So if you write $03, the timer A and B IRQ masks will be cleared, but if you write $83 the masks will be set. This way you can modify single IRQ masks without touching the others.
|
| |
TWW
Registered: Jul 2009 Posts: 545 |
Alrigth then so a setting of a bitmask:
lda #$83
sta $dc0d
would ENABLE Timer A+B IRQ's from CIA#1
and consequently:
lda #$03
sta $dc0d
would DISABLE Timer A+B IRQ's from CIA#1.
Without touching the state of the other available IRQ's.
does it work in the same way for the VICII IRQ mask register aswell (only inverted use of bit #7)?
lda #$01
sta $d01a // Enable raster comp. IRQ
vs.
lda #$81
sta $d01a // Disable raster comp. IRQ? |
| |
Mr. SID
Registered: Jan 2003 Posts: 424 |
No, the VIC has just one bit per IRQ source, if you don't want to affect the other ones, you have to mask out the bits yourself. |
| |
Ninja
Registered: Jan 2002 Posts: 411 |
In almost any case you want to do a LDA $DC0D after clearing all the other CIA interrupts. Bonus point if you find out why by yourself (stuff like AAY64 might help you)... |
| |
chatGPZ
Registered: Dec 2001 Posts: 11386 |
another bonus point for finding the flaw in
lda $dc0d
sta $dc0d
:)
|
| |
Oswald
Registered: Apr 2002 Posts: 5094 |
madness?!
t h i s i s SPARTAAAAAAAAAAAAAA!!!!!!!!!!!!!!!!!!11111 |
| |
TWW
Registered: Jul 2009 Posts: 545 |
Quote: In almost any case you want to do a LDA $DC0D after clearing all the other CIA interrupts. Bonus point if you find out why by yourself (stuff like AAY64 might help you)...
No fucking clue there was something like AAY64 around (now I know though) but before consulting documentation of such biblical proporsions I am going out on a limb to achieve my bonus point and guess that a LDA $dc0d would ack any outstanding CIA interrupts to avoid accendental triggering of latent CIA IRQ's.
Fucking hell that's one huge sentence eh?
@ Groepaz:
Uncertain what happens when you read bit #7 of $dc0d (@ work and no time to consult AAY64 or test it) but depending of the state of bit #7 you would then disable/enable any occured IRQ. But I'm sure it doesen't work this way anyway... If I got it half right does I gets its another bonus points?
@ Oswald:
freak! |
| |
Ninja
Registered: Jan 2002 Posts: 411 |
Quoting TWWFucking hell that's one huge sentence eh?
Still you got the point :D
This can be a reason why some demo-parts crash on start "randomly". Forbid interrupts, clear some memory (during that time, a CIA-IRQ may appear and is waiting for interrupts to be allowed again), set up your VIC-IRQ which just clears $d019, allow interrupts - voila, CIA will trigger IRQs endlessly. |
| |
TWW
Registered: Jul 2009 Posts: 545 |
What I find interesting is that SEI itself only inhibit activation of IRQs but don't stop them from setting bits high in $d019/$dc0d even during a sei-cli. An importaint fact to say the least.
On top of this special care regarding NMI which is totally unaffected by the sei-cli statement must be taken.
@ groepas:
After thinking about it I will say the following about your lda/sta $dc0d.
lda $dc0d // loads status of CIA#1 IRQs / Ack's any IRQs
if A & #%10000000 = 80 (some IRQ occured) then whichever IRQ occured will be masked after sta $dc0d.
if A & #%10000000 = 00 (no IRQ occured) then you would write #00 into $dc0d which means unmask no IRQs. which doesen't make any sense?!
So to summarise: If any CIA#1 IRQ(s) occurs, disable it/them. If no IRQ occurs pretend to be 'leet and shout loudly "I kill LAMERS for free!". (aka. nothing happens^^)
I want my bonus point. This gives me totally 2 points (I assume I got ninja's bonuspoint) and then I donate 1/2 a point to Oswald for his SPPPAAAARTTTAAAA comment. A considerable contribution to this discussion afterall :) |
| |
Stone
Registered: Oct 2006 Posts: 172 |
No points for you! Come back, one year! |
Previous - 1 | 2 | 3 - Next |