(clock.tal) Optimizations

This commit is contained in:
neauoire 2022-03-24 13:15:50 -07:00
parent f6e23cddb0
commit 05d8b4479c
1 changed files with 35 additions and 37 deletions

View File

@ -23,8 +23,7 @@
@buf
&d $3 &h $2 &s1 $1 &m $2 &s2 $1 &s $3
@line
&x0 $2 &y0 $2 &x $2 &y $2 &sx $2 &sy $2
&dx $2 &dy $2 &e1 $2 &e2 $2 &color $1
&x $2 &y $2 &dx $2 &dy $2 &e1 $2
|0100 ( -> )
@ -97,13 +96,15 @@ BRK
STH
.center/x LDZ2 .center/y LDZ2
OVR2 OVR2
.needles/zx LDZ2 .needles/zy LDZ2 #02 STHkr MUL ;draw-line JSR2
.needles/mx LDZ2 .needles/my LDZ2 #01 STHkr MUL
;draw-line JSR2
OVR2 OVR2
.needles/sx LDZ2 .needles/sy LDZ2 #02 STHkr MUL ;draw-line JSR2
OVR2 OVR2
.needles/mx LDZ2 .needles/my LDZ2 #01 STHkr MUL ;draw-line JSR2
OVR2 OVR2
.needles/hx LDZ2 .needles/hy LDZ2 #01 STHr MUL ;draw-line JSR2
.needles/hx LDZ2 .needles/hy LDZ2 #01 STHkr MUL
;draw-line JSR2
.needles/sx LDZ2 .needles/sy LDZ2
.needles/zx LDZ2 .needles/zy LDZ2 #02 STHr MUL
;draw-line JSR2
( middle )
#0001 SUB2 .Screen/y DEO2
#0001 SUB2 .Screen/x DEO2
@ -114,8 +115,7 @@ JMP2r
@draw-text ( addr* -- )
( auto addr ) #06 .Screen/auto DEO
.Screen/y DEI2 ,&anchor-y STR2
( auto addr ) #15 .Screen/auto DEO
&while
LDAk
DUP ;is-lc JSR2 ,&lc JCN
@ -126,13 +126,11 @@ JMP2r
POP ;font/blank
&end
.Screen/addr DEO2
#03 .Screen/sprite DEOk DEO
[ LIT2 &anchor-y $2 ] .Screen/y DEO2
.Screen/x DEI2k #0008 ADD2 ROT DEO2
#03 .Screen/sprite DEO
INC2 LDAk ,&while JCN
POP2
#00 .Screen/sprite DEO
( auto none ) #00 .Screen/auto DEO
.Screen/x DEI2k #0008 ADD2 ROT DEO2
JMP2r
&lc #61 SUB #00 SWP #40 SFT2 ;font/lc ADD2 ,&end JMP
@ -143,29 +141,29 @@ JMP2r
@draw-line ( x1* y1* x2* y2* color -- )
( load ) .line/color STZ .line/y0 STZ2 .line/x0 STZ2 .line/y STZ2 .line/x STZ2
.line/x0 LDZ2 .line/x LDZ2 SUB2 ;abs2 JSR2 .line/dx STZ2
.line/y0 LDZ2 .line/y LDZ2 SUB2 ;abs2 JSR2 #0000 SWP2 SUB2 .line/dy STZ2
#ffff #00 .line/x LDZ2 .line/x0 LDZ2 ;lts2 JSR2 #10 SFT2 ADD2 .line/sx STZ2
#ffff #00 .line/y LDZ2 .line/y0 LDZ2 ;lts2 JSR2 #10 SFT2 ADD2 .line/sy STZ2
( load ) STH ,&y STR2 ,&x STR2 .line/y STZ2 .line/x STZ2
,&x LDR2 .line/x LDZ2 SUB2 ;abs2 JSR2 .line/dx STZ2
#0000 ,&y LDR2 .line/y LDZ2 SUB2 ;abs2 JSR2 SUB2 .line/dy STZ2
#ffff #00 .line/x LDZ2 ,&x LDR2 ;lts2 JSR2 #10 SFT2 ADD2 ,&sx STR2
#ffff #00 .line/y LDZ2 ,&y LDR2 ;lts2 JSR2 #10 SFT2 ADD2 ,&sy STR2
.line/dx LDZ2 .line/dy LDZ2 ADD2 .line/e1 STZ2
&loop
.line/x LDZ2 .Screen/x DEO2
.line/y LDZ2 .Screen/y DEO2
.line/color LDZ .Screen/pixel DEO
[ .line/x LDZ2 .line/x0 LDZ2 EQU2 ]
[ .line/y LDZ2 .line/y0 LDZ2 EQU2 ] AND ,&end JCN
.line/e1 LDZ2 #10 SFT2 .line/e2 STZ2
.line/e2 LDZ2 .line/dy LDZ2 ;lts2 JSR2 ,&skipy JCN
.line/x LDZ2 DUP2 .Screen/x DEO2 [ LIT2 &x $2 ] EQU2
.line/y LDZ2 DUP2 .Screen/y DEO2 [ LIT2 &y $2 ] EQU2
STHkr .Screen/pixel DEO
AND ,&end JCN
.line/e1 LDZ2 #10 SFT2 DUP2
.line/dy LDZ2 ;lts2 JSR2 ,&skipy JCN
.line/e1 LDZ2 .line/dy LDZ2 ADD2 .line/e1 STZ2
.line/x LDZ2 .line/sx LDZ2 ADD2 .line/x STZ2
.line/x LDZ2 [ LIT2 &sx $2 ] ADD2 .line/x STZ2
&skipy
.line/e2 LDZ2 .line/dx LDZ2 ;gts2 JSR2 ,&skipx JCN
.line/dx LDZ2 ;gts2 JSR2 ,&skipx JCN
.line/e1 LDZ2 .line/dx LDZ2 ADD2 .line/e1 STZ2
.line/y LDZ2 .line/sy LDZ2 ADD2 .line/y STZ2
.line/y LDZ2 [ LIT2 &sy $2 ] ADD2 .line/y STZ2
&skipx
;&loop JMP2
,&loop JMP
&end
POPr
JMP2r