Last active
October 20, 2019 08:35
-
-
Save r-moeritz/3e14863e6b9711e1033af07da0564fa6 to your computer and use it in GitHub Desktop.
Raster interrupt sample from Compute's Machine Language Routines for the Commodore 64/128
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 sys 49152 | |
10 print chr$(147):poke 49408+33,0:poke 49455+33,0 | |
15 for a=832 to 896:poke a,255:next | |
20 for a=2040 to 2047:poke a,13:next | |
30 poke 49408+21,255:poke 49455+21,255 | |
40 for a=49408 to 49422 step 2:poke a,b*25+50:poke a+47,b*25+50:b=b+1:next | |
50 for a=49409 to 49423 step 2:poke a,100:poke a+47,200:next |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*=$c000 | |
; | |
vic = $d000 | |
newvic = $c100 | |
ciaicr = $dc0d | |
scroly = $d011 | |
irqmsk = $d01a | |
vicirq = $d019 | |
raster = $d012 | |
irqvec = $0314 | |
irqnor = $ea31 | |
irqend = $febc | |
; | |
ras64 lda #$7f | |
sta ciaicr | |
lda #<main | |
sta irqvec | |
lda #>main | |
sta irqvec+1 | |
lda scroly | |
and #$7f | |
sta scroly | |
lda #1 | |
sta irqmsk | |
ldy #46 | |
; | |
copy lda vic,y | |
sta newvic,y | |
sta newvic+47,y | |
dey | |
bpl copy | |
lda newvic+$11 | |
and #$7f | |
sta newvic+$11 | |
sta newvic+47+$11 | |
rts | |
; | |
main lda #1 | |
sta vicirq | |
ldx #147 | |
ldy #46 | |
lda raster | |
cmp #147 | |
bcc top | |
ldx #1 | |
ldy #93 | |
; | |
top txa | |
pha | |
ldx #3 | |
; | |
delay dex | |
bne delay | |
nop | |
ldx #46 | |
; | |
copybk lda newvic,y | |
sta vic,x | |
dey | |
dex | |
bpl copybk | |
pla | |
sta raster | |
lda ciaicr | |
lsr | |
bcc noirq | |
jmp irqnor | |
; | |
noirq jmp irqend |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment