Add routine to do horizontal displacement of BG1

This commit is contained in:
Lucas Scharenbroich 2021-07-19 22:52:42 -05:00
parent c5eb84ea37
commit 9cdba9a537
2 changed files with 318 additions and 221 deletions

View File

@ -209,7 +209,7 @@ _ApplyBG1YPos
; Unrolled copy routine to move BG1YTable entries into BG1_ADDR position. ; Unrolled copy routine to move BG1YTable entries into BG1_ADDR position.
; ;
; A = intect into the BG1YTable array (x2) ; A = index into the BG1YTable array (x2)
; Y = starting line * $1000 ; Y = starting line * $1000
; X = number of lines (x2) ; X = number of lines (x2)
CopyBG1YTableToBG1Addr CopyBG1YTableToBG1Addr
@ -284,6 +284,102 @@ CopyBG1YTableToBG1Addr
sta: BG1_ADDR+$0000,y sta: BG1_ADDR+$0000,y
:none rts :none rts
; Unrolled copy routine to move BG1YTable entries into BG1_ADDR position with an additional
; shift
;
; A = index into the BG1YTable array (x2)
; Y = starting line * $1000
; X = number of lines (x2)
CopyBG1YTableToBG1Addr2
jmp (:tbl,x)
:tbl da :none
da :do01,:do02,:do03,:do04
da :do05,:do06,:do07,:do08
da :do09,:do10,:do11,:do12
da :do13,:do14,:do15,:do16
:do15 tax
bra :x15
:do14 tax
bra :x14
:do13 tax
bra :x13
:do12 tax
bra :x12
:do11 tax
bra :x11
:do10 tax
bra :x10
:do09 tax
bra :x09
:do08 tax
bra :x08
:do16 tax
ldal BG1YTable+30,x
adcl BG1YOffsetTable+30,x
sta BG1_ADDR+$F000,y
:x15 ldal BG1YTable+28,x
adcl BG1YOffsetTable+28,x
sta BG1_ADDR+$E000,y
:x14 ldal BG1YTable+26,x
adcl BG1YOffsetTable+26,x
sta BG1_ADDR+$D000,y
:x13 ldal BG1YTable+24,x
adcl BG1YOffsetTable+24,x
sta BG1_ADDR+$C000,y
:x12 ldal BG1YTable+22,x
adcl BG1YOffsetTable+22,x
sta BG1_ADDR+$B000,y
:x11 ldal BG1YTable+20,x
adcl BG1YOffsetTable+20,x
sta BG1_ADDR+$A000,y
:x10 ldal BG1YTable+18,x
adcl BG1YOffsetTable+18,x
sta BG1_ADDR+$9000,y
:x09 ldal BG1YTable+16,x
adcl BG1YOffsetTable+16,x
sta BG1_ADDR+$8000,y
:x08 ldal BG1YTable+14,x
adcl BG1YOffsetTable+14,x
sta BG1_ADDR+$7000,y
:x07 ldal BG1YTable+12,x
adcl BG1YOffsetTable+12,x
sta BG1_ADDR+$6000,y
:x06 ldal BG1YTable+10,x
adcl BG1YOffsetTable+10,x
sta BG1_ADDR+$5000,y
:x05 ldal BG1YTable+08,x
adcl BG1YOffsetTable+08,x
sta: BG1_ADDR+$4000,y
:x04 ldal BG1YTable+06,x
adcl BG1YOffsetTable+06,x
sta BG1_ADDR+$3000,y
:x03 ldal BG1YTable+04,x
adcl BG1YOffsetTable+04,x
sta BG1_ADDR+$2000,y
:x02 ldal BG1YTable+02,x
adcl BG1YOffsetTable+02,x
sta BG1_ADDR+$1000,y
:x01 ldal BG1YTable+00,x
adcl BG1YOffsetTable+00,x
sta: BG1_ADDR+$0000,y
:none rts
:do07 tax
bra :x07
:do06 tax
bra :x06
:do05 tax
bra :x05
:do04 tax
bra :x04
:do03 tax
bra :x03
:do02 tax
bra :x02
:do01 tax
bra :x01

View File

@ -238,5 +238,6 @@ BG1YTable lup 208
]step = ]step+256 ]step = ]step+256
--^ --^
BG1YOffsetTable ds 208*2*2