shave some cycles

This commit is contained in:
4am 2021-12-04 22:10:23 -05:00
parent 7cc576c8a0
commit 37d50064c6
35 changed files with 57 additions and 53 deletions

View File

@ -126,12 +126,23 @@ BoxesY = $BEB0 ; [$50 bytes][accessed via BoxesY-1][should
;WRITEAUXMEM active ;WRITEAUXMEM active
jmp MainLoop jmp MainLoop
siderows !byte 1,5,9,13,17,21
branches !byte across2-back
!byte across3-back
!byte across4-back
!byte across5-back
!byte across6-back
!byte across7-back
start start
!pseudopc 0 { !pseudopc 0 {
copy1 ldx <topx+1 copy1 ldx <topx+1
+SET_ROW_X +SET_ROW_X
ldy <lefty+1 ldy <lefty+1
jsr across1 +COPY_BYTE_AND_INY
+COPY_BYTE_AND_INY
+COPY_BYTE_AND_INY
+COPY_BYTE
ReBox ldx #$00 ; [SMC] X = BoxLoop index 1..80 ReBox ldx #$00 ; [SMC] X = BoxLoop index 1..80
NextBox dex NextBox dex
bne BoxLoop bne BoxLoop
@ -142,6 +153,7 @@ NextBox dex
bpl MainLoop bpl MainLoop
exit sta WRITEMAINMEM exit sta WRITEMAINMEM
setV rts setV rts
MainLoop ldx #80 MainLoop ldx #80
BoxLoop ldy BoxStages-1, x ; for each box, get its current stage BoxLoop ldy BoxStages-1, x ; for each box, get its current stage
inc BoxStages-1, x ; increment every box's stage every time through the loop inc BoxStages-1, x ; increment every box's stage every time through the loop
@ -160,20 +172,19 @@ stage ldx #$00 ; [SMC] X = stage index 1..7, reinitialized
sta <lefty+1 sta <lefty+1
dex dex
beq copy1 beq copy1
lda <siderows-1, x lda siderows-1, x
sta <rowcount sta <rowcount
lda <across_lo-1, x lda branches-1, x
sta <j+1 sta <branch+1
topx ldx #$FD ; [SMC] topx ldx #$FD ; [SMC]
clv clv
copy2row clc copy2row clc
!byte $A9 !byte $A9
copy1row sec copy1row sec
+SET_ROW_X
ldy <lefty+1 ldy <lefty+1
j jsr across7 ; [SMC low byte] +SET_ROW_X
inx branch bne across7 ; [SMC branch target][always branches]
bcc copy1row back bcc copy1row
bvs ReBox bvs ReBox
sty <righty+1 sty <righty+1
copyside +SET_ROW_X copyside +SET_ROW_X
@ -199,26 +210,19 @@ across3 +COPY_BYTE_AND_INY
+COPY_BYTE_AND_INY +COPY_BYTE_AND_INY
across2 +COPY_BYTE_AND_INY across2 +COPY_BYTE_AND_INY
+COPY_BYTE_AND_INY +COPY_BYTE_AND_INY
across1 +COPY_BYTE_AND_INY +COPY_BYTE_AND_INY
+COPY_BYTE_AND_INY +COPY_BYTE_AND_INY
+COPY_BYTE_AND_INY +COPY_BYTE_AND_INY
lda (src+1), y lda (src+1), y
src sta $FDFD, y ; [SMC] src sta $FDFD, y ; [SMC]
rts inx
bne back ; always branches
toprow !byte 12,10,8,6,4,2,0 toprow !byte 12,10,8,6,4,2,0
leftbyte !byte 6,5,4,3,2,1,0 leftbyte !byte 6,5,4,3,2,1,0
siderows !byte 1,5,9,13,17,21
across_lo
!byte <across2
!byte <across3
!byte <across4
!byte <across5
!byte <across6
!byte <across7
rowcount rowcount
} }
!if (*-start>=$FF) { !if (*-start>$FF) {
!error "Code is too big to fit on zero page! ", *-start !error "Code is too big to fit on zero page! ", *-start
} }

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 10806970 !be24 10807078
!le16 4244 !le16 4244

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 10759850 !be24 10759958
!le16 5223 !le16 5223

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 10703061 !be24 10703169
!le16 3593 !le16 3593

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 10715438 !be24 10715546
!le16 3953 !le16 3953

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 10730844 !be24 10730952
!le16 4628 !le16 4628

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 10748126 !be24 10748234
!le16 5575 !le16 5575

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 10811214 !be24 10811322
!le16 410 !le16 410

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 10811932 !be24 10812040
!le16 448 !le16 448

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 10812380 !be24 10812488
!le16 303 !le16 303

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 10767219 !be24 10767327
!le16 1242 !le16 1242

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 10805640 !be24 10805748
!le16 1249 !le16 1249

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 10791630 !be24 10791738
!le16 464 !le16 464

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 10765073 !be24 10765181
!le16 2146 !le16 2146

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 10768692 !be24 10768800
!le16 6149 !le16 6149

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 10811624 !be24 10811732
!le16 107 !le16 107

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 10806889 !be24 10806997
!le16 81 !le16 81

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 10811731 !be24 10811839
!le16 201 !le16 201

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 10792094 !be24 10792202
!le16 4407 !le16 4407

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 10796501 !be24 10796609
!le16 1533 !le16 1533

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 10798034 !be24 10798142
!le16 1040 !le16 1040

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 10799074 !be24 10799182
!le16 3237 !le16 3237

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 10802311 !be24 10802419
!le16 2764 !le16 2764

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 10805075 !be24 10805183
!le16 460 !le16 460

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 10805535 !be24 10805643
!le16 105 !le16 105

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 10812683 !be24 10812791
!le16 2370 !le16 2370

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 10779735 !be24 10779843
!le16 6149 !le16 6149

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 10753701 !be24 10753809
!le16 6149 !le16 6149

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 10695029 !be24 10695137
!le16 8032 !le16 8032

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 10706654 !be24 10706762
!le16 8784 !le16 8784

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 10719391 !be24 10719499
!le16 11453 !le16 11453

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 10735472 !be24 10735580
!le16 12654 !le16 12654

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 10768461 !be24 10768569
!le16 231 !le16 231

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 10774841 !be24 10774949
!le16 4894 !le16 4894

View File

@ -4,5 +4,5 @@
; This file is automatically generated ; This file is automatically generated
; ;
!byte 0 !byte 0
!be24 10785884 !be24 10785992
!le16 5746 !le16 5746