shave some cycles

This commit is contained in:
4am 2021-12-02 15:33:48 -05:00
parent 2c319823fa
commit f750844ec6
3 changed files with 9 additions and 20 deletions

View File

@ -79,7 +79,6 @@ dst = $02 ; [word] used by drawing routines
rowcount = $04 ; [byte] used by drawing routines
tmpy = $05 ; [byte] used by drawing routines
box = $0E ; [byte] counter in main loop
any = $0F ; [byte][must be at $0F] counter in main loop
BoxStages = $10 ; [$30 bytes] current stage for each box
auxsrc_hgrhi = $BC00 ; [$C0 bytes] HGR base addresses (hi) starting at $9000
hgrhi = $BD00 ; [$C0 bytes] HGR base addresses (hi) starting at $2000
@ -228,15 +227,14 @@ BoxLoop ldy BoxStages-1, x ; for each box, get its current stage
lda BoxesX-1, x
ldy BoxesY-1, x ; Y = starting byte offset for this box
tax ; X = starting HGR row for this box
inc any ; was initialized by the BoxStages copy loop
clc
j jsr $FD00 ; [SMC] call drawing routine for this stage
j jsr $0000 ; [SMC] call drawing routine for this stage
ldx box
NextBox dex
bne BoxLoop
lda any
lda j+2
beq + ; if we didn't draw anything in any box, we're done
stx any ; X=0 here
stx j+2 ; X=0 here
bit $C000 ; check for key
bpl MainLoop
+ sta $C000 ; 80STORE off
@ -754,6 +752,4 @@ OUTER_STAGE
!if >* != >STAGE0 {
!error "Templates are not all on same page"
}
; Note: the final k_rts is later copied to zero page $0F and used in MainLoop,
; so don't put any more code before BoxInitialStages.
BoxInitialStages

View File

@ -77,7 +77,6 @@ src = $00 ; [word][must be at $00] used by drawing ro
dst = $02 ; [word] used by drawing routines
rowcount = $04 ; [byte] used by drawing routines
box = $0E ; [byte] counter in main loop
any = $0F ; [byte][must be at $0F] counter in main loop
BoxStages = $10 ; [$30 bytes] current stage for each box
hgrhi = $40 ; [$C0 bytes] HGR base addresses
hgrlo = $300 ; [$C0 bytes] HGR base addresses
@ -220,15 +219,14 @@ BoxLoop ldy BoxStages-1, x ; for each box, get its current stage
lda BoxesX-1, x
ldy BoxesY-1, x ; Y = starting byte offset for this box
tax ; X = starting HGR row for this box
inc any ; was initialized by the BoxStages copy loop
clc
j jsr $FD00 ; [SMC] call drawing routine for this stage
j jsr $0000 ; [SMC] call drawing routine for this stage
ldx box
NextBox dex
bne BoxLoop
lda any
lda j+2
beq + ; if we didn't draw anything in any box, we're done
stx any ; X=0 here
stx j+2 ; X=0 here
bit $C000
bpl MainLoop
+
@ -561,8 +559,5 @@ BuildStage1And0
jsr BuildDrawingRoutineFrom
lda #<STAGE0
jmp BuildDrawingRoutineFrom
; note: the high byte of the final JMP is later copied
; to zero page $0F and used in MainLoop, so don't put any
; more code before BoxInitialStages
BoxInitialStages

View File

@ -133,17 +133,15 @@ BoxLoop ldy <BoxStages-1, x ; for each box, get its current stage
sta <j+2
lda BoxesX-1, x ; A = starting SHR row for this box
ldy BoxesY-1, x ; Y = starting byte offset for this box
inc <any
clc
stx <ReBox+1
j jsr $FD00 ; [SMC] call drawing routine for this stage
j jsr $0000 ; [SMC] call drawing routine for this stage
ReBox ldx #$00 ; [SMC]
NextBox dex
bne <BoxLoop
any=*+1
lda #$00 ; [SMC]
lda <j+2
beq <exit ; if we didn't draw anything in any box, we're done
stx <any ; X=0 here
stx <j+2 ; X=0 here
bit $C000
bpl MainLoop
exit sta WRITEMAINMEM