midline: optimize

This commit is contained in:
Vince Weaver 2023-05-18 14:14:05 -04:00
parent e5b108298b
commit 80af2dd610

View File

@ -16,6 +16,8 @@
; 257 bytes -- inline sine generation ; 257 bytes -- inline sine generation
; 259 bytes -- fix sine generation initialization, shave some message print ; 259 bytes -- fix sine generation initialization, shave some message print
; 247 bytes -- start replacing sather delays with something more compact ; 247 bytes -- start replacing sather delays with something more compact
; 229 bytes -- finish replacing sather delays
; 228 bytes -- optimize and center the middle area
sine = $c00 ; location of sine table sine = $c00 ; location of sine table
@ -89,62 +91,57 @@ lp17029:
cycle_start: cycle_start:
;==============================
; top
; 2 ; 2
top_smc: top_smc:
ldx #66 ; 2 ldx #66 ; 2
lda $00 ; nop3 ; 5 bne top7 ; bra ; 3/2
bne top10 ; bra ; 3/2
top_loop: top_loop:
nop ; 2 pha ; 3
nop ; 2 pla ; 4
nop ; 2 top7:
nop ; 2 ; 7
nop ; 2 lda #0 ; 2
top10: ldy #3 ; 2
; 11
; want to delay 49
; 10 jsr size_delay ; 47
ldy #4 ; 2 ; 58
; 12
jsr wait_y_x_10 ; 40
; 52
nop ; 2
nop ; 2
; 56
nop ; 2
nop ; 2 nop ; 2
; 60 ; 60
dex ; 2 dex ; 2
bne top_loop ; 3/2 bne top_loop ; 3/2
;===================================
; middle ; middle
; -1 ; -1
nop ; 2
nop ; 2
ldx #56 ; 2 ldx #56 ; 2
bne middle_8 ; bra ; 3 bne middle_4 ; bra ; 3
middle_loop: middle_loop:
nop ; 2 nop ; 2
nop ; 2 nop ; 2
middle_4:
nop ; 2 nop ; 2
nop ; 2 ; nop ; 2
lda $0
; 8 ; 8
middle_8:
jsr delay_16_setgr ; 16 jsr delay_16_setgr ; 16
; 24 ; 24
jsr delay_16_settext ; 16 jsr delay_16_settext ; 16
; 40 ; 40
jsr delay_16_setgr ; 16 jsr delay_16_setgr ; 16
; 56 ; 56
nop ; 2 lda $0
nop ; 2 ; nop ; 2
; nop ; 2
; 60 ; 60
dex ; 2 dex ; 2
bne middle_loop ; 3/2 bne middle_loop ; 3/2
@ -153,32 +150,25 @@ middle_8:
; -1 ; -1
nop ; 2
nop ; 2
bottom_smc: bottom_smc:
ldx #118 ; 2 ldx #118 ; 2
bne bottom_8 ; bra ; 3/2 bne bottom_4 ; bra ; 3
bottom_loop: bottom_loop:
nop ; 2 nop ; 2
nop ; 2 nop ; 2
nop ; 2 ; 4
nop ; 2 bottom_4:
; 4
lda #0 ; 2
ldy #3 ; 2
; 8 ; 8
bottom_8: ; want to delay 50
ldy #4 ; 2
; 10
jsr wait_y_x_10 ; 40
; 50
nop
nop
nop
; 56
nop
jsr size_delay ; 47
; 55
lda $0 ; nop3 ; 3
; 58 ; 58
inx ; 2 inx ; 2
cpx #192 ; 2 cpx #192 ; 2
@ -191,6 +181,9 @@ bottom_8:
;====================================== ;======================================
; -1 from before ; -1 from before
vblank_start: vblank_start:
; move window
; -1 ; -1
inc FRAME ; 5 inc FRAME ; 5
; 4 ; 4
@ -203,6 +196,8 @@ vblank_start:
adc #56 ; 2 adc #56 ; 2
sta bottom_smc+1 ; 4 sta bottom_smc+1 ; 4
; finish delay
; 25 ; 25
lda #1 ; 2 lda #1 ; 2
ldy #244 ; 2 ldy #244 ; 2
@ -216,47 +211,12 @@ vblank_start:
delay_16_setgr: delay_16_setgr:
bit SET_GR bit SET_GR
delay_12:
rts rts
delay_16_settext: delay_16_settext:
bit SET_TEXT bit SET_TEXT
rts rts
;===================================
; wait y-reg times 10
;===================================
loop10:
bne skip
wait_y_x_10:
dey ; wait y-reg times 10 ; 2
skip:
dey ; 2
nop ; 2
bne loop10 ; 2/3
rts ; 6
.if 0
;===================================
; wait x-reg times 1000
;===================================
loop1k:
pha ; 3
pla ; 4
nop ; 2
nop ; 2
wait_X_x_1k:
ldy #98 ; wait x-reg times 1000 ; 2
jsr wait_y_x_10 ; 980
nop ; 2
dex ; 2
bne loop1k ; 2/3
rts1:
rts ; 6
.endif
;===================================== ;=====================================
; short delay by Bruce Clark ; short delay by Bruce Clark
; any delay between 8 to 589832 with res of 9 ; any delay between 8 to 589832 with res of 9
@ -269,6 +229,7 @@ delay_loop:
dey dey
sbc #0 sbc #0
bcs delay_loop bcs delay_loop
delay_12:
rts rts
a2_string: a2_string: