commit 7500317e4e2181c97c7e63becfa052e0bebe3ea5
parent 4ae6a9f870e7c5017ad397ec113071be96305183
Author: Devine Lu Linvega <aliceffekt@gmail.com>
Date: Wed, 17 Nov 2021 15:54:47 -0500
(calc.tal) Added decimal printing
Diffstat:
1 file changed, 22 insertions(+), 0 deletions(-)
diff --git a/projects/software/calc.tal b/projects/software/calc.tal
@@ -501,6 +501,26 @@ RTN
RTN
+@draw-decimal ( -- )
+
+ .bitpad-frame/y2 LDZ2 #0008 ++ .Screen/y DEO2
+ .center/x LDZ2 #0014 -- .Screen/x DEO2
+ #01 .Screen/auto DEO
+
+ .input/value LDZ2
+ ( 10,000 ) #2710 DIV2k DUP2 NIP ,&digit JSR [ MUL2 SUB2 ]
+ ( 1,000 ) #03e8 DIV2k DUP2 NIP ,&digit JSR [ MUL2 SUB2 ]
+ ( 100 ) #0064 DIV2k DUP2 NIP ,&digit JSR [ MUL2 SUB2 NIP ]
+ ( 10 ) #0a DIVk DUP ,&digit JSR [ MUL SUB ]
+ ( 1 ) ,&digit JSR
+ #00 .Screen/auto DEO
+
+RTN
+ &digit ( num -- )
+ 8* TOS ;font-hex ++ .Screen/addr DEO2
+ #03 .Screen/sprite DEO
+ RTN
+
@draw-input ( key -- )
STH
@@ -531,6 +551,8 @@ RTN
POPr
+ ;draw-decimal JSR2
+
RTN
@draw-keypad ( key -- )