Created
November 14, 2012 05:36
-
-
Save keyboardspecialist/4070486 to your computer and use it in GitHub Desktop.
This file contains 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
DrawNewColumn: | |
lda scroll ;calc new address using scroll register | |
lsr a | |
lsr a | |
lsr a ;shift right 3 times | |
sta columnLo ;$00 to $1F, screen is 32 tiles wide | |
lda nametable ;calc new col addr using current nametable | |
eor #$01 ;invert lo bit | |
asl a ;shift up, A = $00 or $02 | |
asl a ;$00 or $04 | |
clc | |
adc #$20 ;add hi byte of nametable addr ($2000) | |
sta columnHi ;new addr = $20 or $24 | |
lda columnNum ;col number * 32 = col data offset | |
asl a | |
asl a | |
asl a | |
asl a | |
asl a | |
sta sourceLo | |
lda columnNum | |
lsr a | |
lsr a | |
lsr a | |
sta sourceHi | |
lda sourceLo ;col data start + offs = addr to load col data from | |
clc | |
adc #<columnData | |
sta sourceLo | |
lda sourceHi | |
adc #>columnData | |
sta sourceHi | |
DrawColumn: | |
lda #%00000100 ;increment +32 mode | |
sta $2000 | |
lda $2002 ;reset latch | |
lda columnHi | |
sta $2006 | |
lda columnLo | |
sta $2006 | |
ldx #$1E ;copy 30 bytes | |
ldy #$00 | |
DrawColumnLoop: | |
lda (sourceLo), y | |
sta $2007 | |
iny | |
dex | |
bne DrawColumnLoop | |
rts |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment