Rasters: Your First Colour Split - Slarti64/C64-Code-Hacking GitHub Wiki
Rasters: Your First Colour Split
This routine is largely the same as our bare bones routine, except an extra interrupt routine has been added. $FFFE and $FFFF are set to the location of the next label, and $d012 is set to $32(the first line of the screen) + (12*8) (12 lines). Then after that routine has been executed $FFFE and $FFFF are reset to the location of the start label, easy as that! Now as a challenge, consider the other VIC registers you could split, such as $d016 to have a scrolling area of the screen. We’ll cover basic scrollies in the next post.
*=$080d
LDX #$00
- LDA #$20
STA $0400,x
STA $0500,x
STA $0600,x
STA $0700,x
LDA #$01
STA $D900,x
STA $DA00,x
STA $DB00,x
STA $DBE0,x
INX
BNE -
SEI
JSR $1000
LDA #$7F
STA $DC0D ;CIA1: CIA Interrupt Control Register
STA $DD0D ;CIA2: CIA Interrupt Control Register
LDA #$1B
STA $D011 ;VIC Control Register 1
LDA #$01
STA $D01A ;VIC Interrupt Mask Register (IMR)
LDA #$06
STA $D020 ;Border Color
LDA #$00
STA $D021 ;Background Color 0
LDA #$00
STA $D012 ;Raster Position
LDX #<start
LDY #>start
STX $FFFE ;IRQ
STY $FFFF ;IRQ
LDX #<nmi
LDY #>nmi
STX $FFFA ;NMI
STY $FFFB ;NMI
LDA #$35
LDX #$FF
STA $01
TXS
INC $D019 ;VIC Interrupt Request Register (IRR)
LDA $DC0D ;CIA1: CIA Interrupt Control Register
LDA $DD0D ;CIA2: CIA Interrupt Control Register
CLI
- JMP -
start STA nexta+1
STX nextx+1
STY nexty+1
LDA #$06
STA $D020
STA $D021
JSR $1003
LDA #$1B
STA $D011 ;VIC Control Register 1
LDX #<next
LDY #>next
LDA #$32+(12*8)
STX $FFFE ;IRQ
STY $FFFF ;IRQ
STA $D012 ;Raster Position
INC $D019 ;VIC Interrupt Request Register (IRR)
nexta LDA #$00
nextx LDX #$00
nexty LDY #$00
nmi RTI
next STA nexta1+1
STX nextx1+1
STY nexty1+1
LDX #$00
- INX
CPX #$3D
BNE -
LDA #$00
STA $D021
STA $D020
LDX #<start
LDY #>start
LDA #$00
STX $FFFE
STY $FFFF
STA $D012
INC $D019
nexta1 LDA #$00
nextx1 LDX #$00
nexty1 LDY #$00
RTI
*=$1000
.binary "music.prg",2