Browse code

(calc.tal) Added decimal printing

Devine Lu Linvega authored on 17/11/2021 20:54:47
Showing 1 changed files
... ...
@@ -501,6 +501,26 @@ RTN
501 501
 
502 502
 RTN
503 503
 
504
+@draw-decimal ( -- )
505
+
506
+	.bitpad-frame/y2 LDZ2 #0008 ++ .Screen/y DEO2
507
+	.center/x LDZ2 #0014 -- .Screen/x DEO2
508
+	#01 .Screen/auto DEO
509
+
510
+	.input/value LDZ2
511
+	( 10,000 ) #2710 DIV2k DUP2 NIP ,&digit JSR [ MUL2 SUB2 ]
512
+	( 1,000 ) #03e8 DIV2k DUP2 NIP ,&digit JSR [ MUL2 SUB2 ]
513
+	( 100 ) #0064 DIV2k DUP2 NIP ,&digit JSR [ MUL2 SUB2 NIP ]
514
+	( 10 ) #0a DIVk DUP ,&digit JSR [ MUL SUB ]
515
+	( 1 ) ,&digit JSR
516
+	#00 .Screen/auto DEO
517
+
518
+RTN
519
+	&digit ( num -- )
520
+		8* TOS ;font-hex ++ .Screen/addr DEO2
521
+		#03 .Screen/sprite DEO
522
+	RTN
523
+
504 524
 @draw-input ( key -- )
505 525
 
506 526
 	STH
... ...
@@ -531,6 +551,8 @@ RTN
531 551
 
532 552
 	POPr
533 553
 
554
+	;draw-decimal JSR2
555
+
534 556
 RTN
535 557
 
536 558
 @draw-keypad ( key -- )