| |
turtle Account closed
Registered: Mar 2005 Posts: 44 |
irq rutine
i wonder what is the best irq rutine to use for a demo ?
eks .
*=$1000
jrs $ff81
sei
lda #<int1
sta$0314
lda #>int2
sta$0315
lda #$7f
sta $dc0d
lda #$01
sta $d01a
lda #$1b
sta $d011
lda #$33
Sta $d012
cli
rts
int1 *= $1200
|
|
| |
Conrad
Registered: Nov 2006 Posts: 849 |
Have a look at this:
http://codebase64.org/doku.php?id=base:introduction_to_raster_i..
That version is pretty much standard for good productions, but the one you've shown on here will work fine as well. Just make sure you put JMP $EA31 (or JMP $EA7E or JMP $EA81) at the end of the IRQ block...
int1 *=$1200
inc $d020
dec $d020
jmp $ea31 ; Returns from IRQ interrupt (using the kernal)
|
| |
enthusi
Registered: May 2004 Posts: 677 |
quite likely you wanna bank out Kernal ROM and then IRQ is triggered via $fffe/f. |
| |
j0x
Registered: Mar 2004 Posts: 215 |
Quoting Conrad
int1 *=$1200
inc $d020
dec $d020
jmp $ea31 ; Returns from IRQ interrupt (using the kernal)
Since you're doing a raster interrupt, you need to acknowledge the raster IRQ, by adding e.g. "dec $d019" to the interrupt code.
|
| |
Radiant
Registered: Sep 2004 Posts: 639 |
You could of course do pla tay pla tax pla rti manually instead of jmp $ea81. For most demos you probably have Kernal switched off in any case, so manually saving and restoring the IRQ handler affected registers is the way to go. I use zeropage variables:
sta $02
stx $03
sty $04
[...]
lda $02
ldx $03
ldy $04
rti
Self modifying code is equally fast and frees up three ZP locations if you need them:
sta arestore + 1
stx xrestore + 1
sty yrestore + 1
[...]
arestore:
lda #0
xrestore:
ldx #0
yrestore:
ldy #0
rti
|