From 05d8b4479c98aef9d6707a101345f2c60c2b62dd Mon Sep 17 00:00:00 2001 From: neauoire Date: Thu, 24 Mar 2022 13:15:50 -0700 Subject: [PATCH] (clock.tal) Optimizations --- projects/software/clock.tal | 72 ++++++++++++++++++------------------- 1 file changed, 35 insertions(+), 37 deletions(-) diff --git a/projects/software/clock.tal b/projects/software/clock.tal index da45000..a6a4607 100644 --- a/projects/software/clock.tal +++ b/projects/software/clock.tal @@ -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 ( -> ) @@ -96,26 +95,27 @@ BRK STH .center/x LDZ2 .center/y LDZ2 - OVR2 OVR2 - .needles/zx LDZ2 .needles/zy LDZ2 #02 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 - ( middle ) - #0001 SUB2 .Screen/y DEO2 - #0001 SUB2 .Screen/x DEO2 - ;middle-icn .Screen/addr DEO2 - #0a .Screen/sprite DEO + OVR2 OVR2 + .needles/mx LDZ2 .needles/my LDZ2 #01 STHkr MUL + ;draw-line JSR2 + OVR2 OVR2 + .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 + ;middle-icn .Screen/addr DEO2 + #0a .Screen/sprite DEO 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