shave some bytes

This commit is contained in:
4am 2021-12-04 21:23:11 -05:00
parent f57722baf7
commit da10566591
8 changed files with 42 additions and 24 deletions

View File

@ -17,7 +17,9 @@ shrhi = $38 ; $C8 bytes
bpl -
+BUILD_SHR_LOOKUP_TABLES shrlo, shrhi
;X=0
+COPY_SCB_AND_PALETTES
;WRITEAUXMEM active
jmp loop1

View File

@ -101,6 +101,10 @@ BoxesY = $BEB0 ; [$50 bytes][accessed via BoxesY-1][should
-- ldy #10
lda #$90
- sta BoxesY-1, x
pha
lda BoxInitialStages-1, x
sta BoxStages-1, x
pla
sec
sbc #$10
dex
@ -116,24 +120,18 @@ BoxesY = $BEB0 ; [$50 bytes][accessed via BoxesY-1][should
sta StageIndexes, x
inx
bne -
ldx #80 ; can't do full $100 here because we'd clobber the stack
- lda BoxInitialStages-1, x
sta BoxStages-1, x
dex
bne -
+BUILD_SHR_LOOKUP_TABLES shrlo, shrhi
;X=0
+COPY_SCB_AND_PALETTES
;WRITEAUXMEM active
jmp MainLoop
start
!pseudopc 0 {
copy1
ldx <topx+1
copy1 ldx <topx+1
+SET_ROW_X
ldy <lefty+1
jsr across1
copyexit
ReBox ldx #$00 ; [SMC] X = BoxLoop index 1..80
NextBox dex
bne BoxLoop
@ -160,10 +158,10 @@ stage ldx #$00 ; [SMC] X = stage index 1..7, reinitialized
tya
adc <leftbyte-1, x
sta <lefty+1
lda <siderows-1, x
sta <rowcount
dex
beq copy1
lda <siderows-1, x
sta <rowcount
lda <across_lo-1, x
sta <j+1
topx ldx #$FD ; [SMC]
@ -176,7 +174,7 @@ copy1row sec
j jsr across7 ; [SMC low byte]
inx
bcc copy1row
bvs copyexit
bvs ReBox
sty <righty+1
copyside +SET_ROW_X
lefty ldy #$FD ; [SMC]
@ -209,8 +207,8 @@ src sta $FDFD, y ; [SMC]
rts
toprow !byte 12,10,8,6,4,2,0
leftbyte !byte 6,5,4,3,2,1
siderows !byte 0,1,5,9,13,17,21
leftbyte !byte 6,5,4,3,2,1,0
siderows !byte 1,5,9,13,17,21
across_lo
!byte <across2
!byte <across3

View File

@ -2,6 +2,9 @@
;(c) 2021 by 4am
!macro BUILD_SHR_LOOKUP_TABLES .lo, .hi {
; in: none
; out: X=0
; Z=1
ldx #$C8
lda #$60
ldy #$9C
@ -23,6 +26,9 @@
}
!macro BUILD_SHR_REVERSE_LOOKUP_TABLES .lo, .hi {
; in: none
; out: X=0
; Z=1
ldx #$C8
lda #$00
ldy #$20
@ -44,14 +50,17 @@
}
!macro COPY_SCB_AND_PALETTES {
; in: X=0 /!\
; out: X=0
; Z=1
; WRITEAUXMEM active
sta $C005
ldy #0
- lda $9D00, y
sta $9D00, y
lda $9E00, y
sta $9E00, y
lda $9F00, y
sta $9F00, y
iny
- lda $9D00, x
sta $9D00, x
lda $9E00, x
sta $9E00, x
lda $9F00, x
sta $9F00, x
inx
bne -
}

View File

@ -17,7 +17,9 @@ shrhi = $201 ; $C8 bytes
bpl -
+BUILD_SHR_LOOKUP_TABLES shrlo, shrhi
;X=0
+COPY_SCB_AND_PALETTES
;WRITEAUXMEM active
jmp colloop

View File

@ -22,9 +22,10 @@ addrs=$80 ; [128 bytes]
dex
bne -
;X=0
ldy #0
+COPY_SCB_AND_PALETTES
;Y=0
;WRITEAUXMEM active
jmp loop

View File

@ -17,8 +17,10 @@ shrhi = $38 ; $C8 bytes
bpl -
+BUILD_SHR_LOOKUP_TABLES shrlo, shrhi
;X=0
+COPY_SCB_AND_PALETTES
;WRITEAUXMEM active
ldy #0
jmp loop
start

View File

@ -17,7 +17,9 @@ shrhi = $38 ; $C8 bytes
bpl -
+BUILD_SHR_LOOKUP_TABLES shrlo, shrhi
;X=0
+COPY_SCB_AND_PALETTES
;WRITEAUXMEM active
jmp loop1

View File

@ -18,9 +18,11 @@ reverseshrhi = $BE01 ; $C8 bytes
dex
bpl -
+BUILD_SHR_LOOKUP_TABLES shrlo, shrhi
+BUILD_SHR_REVERSE_LOOKUP_TABLES reverseshrlo, reverseshrhi
+BUILD_SHR_LOOKUP_TABLES shrlo, shrhi
;X=0
+COPY_SCB_AND_PALETTES
;WRITEAUXMEM active
ldx #$C8
jmp loop