SuperCPU Tutorial Listings - Part 7
Listing 7.1
; 65816 Native Mode IRQ-Programming
; written in 1997 by Malte Mundt
; for GO64!
£ba $c000
£la rasterpointer=$02
sei
clc ; native mode
xce
lda #$35 ; disable rom
sta $01
lda #$01 ; enable
sta $d01a ; raster-irq
lda #$1b
sta $d011
lda #$61 ; at position $61
sta $d012
lda #$7f ; disable cia-irq
sta $dc0d ;
lda $dc0d ; clear poss. old cia irq
lda #$00
sta $d020
sta $d021
lda $d019 ; vic-
sta $d019 ; irq clr
lda #irq ; native
sta $ffef ; vector
cli
loop:
sep #$30 ; 8 bit
inc $d800 ; color-ram +1
rep #$30 ; 16 bit
inc $0400 ; $0400/01 +1
jmp loop
irq:
pha ; save accu
phx ; save x
php ; save status
sep #$10 ; index 8 bit
rep #$20 ; akku 16 bit
£al
£rs
ldx rasterpointer
lda coltab,x ; get 16 bit
sta $d020 ; to $d020/21
sep #$20 ; accu 8 bit
£as
inc $d012 ; new irq
inx ; inc x by 2
inx
cpx #12
bne skip
lda #$61 ; next
sta $d012 ; frame
ldx #0
skip:
stx rasterpointer
lda $d019
sta $d019
plp ; reset status
pla ; reset accu
plx ; reset x
rti
coltab:
£by $06,$02
£by $0e,$0a
£by $01,$07
£by $0e,$0a
£by $06,$02
£by $00,$00
Assembler Code © by Malte Mundt
Partial translation and cosmetical changes by Count Zero/SCS*TRC
[ Listings Part 6 ][
Tutorial Part 7 ][ Index ][ Listings
Part 8 ]