commit 6821bea9c0a0f6f356d2b406de55c4968445b9c3
parent ba76eae6a8a361737dc881c565524189b1906246
Author: neauoire <aliceffekt@gmail.com>
Date: Mon, 20 Sep 2021 15:51:54 -0700
The calc pushes values on opcode
Diffstat:
1 file changed, 21 insertions(+), 4 deletions(-)
diff --git a/projects/software/calc.tal b/projects/software/calc.tal
@@ -260,7 +260,12 @@ RTN
@do-add ( -- )
- .stack/length LDZ #01 > RTN?
+ .input/value LDZ2 #0000 == ,&no-push JCN
+ ;do-push JSR2
+ &no-push
+
+ ( stack empty ) .stack/length LDZ #01 > RTN?
+
#00 ;draw-modpad JSR2
;pop JSR2 ;pop JSR2 SWP2 ADD2 ;push JSR2
@@ -268,7 +273,11 @@ RTN
@do-sub ( -- )
- .stack/length LDZ #01 > RTN?
+ .input/value LDZ2 #0000 == ,&no-push JCN
+ ;do-push JSR2
+ &no-push
+
+ ( stack empty ) .stack/length LDZ #01 > RTN?
#01 ;draw-modpad JSR2
;pop JSR2 ;pop JSR2 SWP2 SUB2 ;push JSR2
@@ -276,7 +285,11 @@ RTN
@do-mul ( -- )
- .stack/length LDZ #01 > RTN?
+ .input/value LDZ2 #0000 == ,&no-push JCN
+ ;do-push JSR2
+ &no-push
+
+ ( stack empty ) .stack/length LDZ #01 > RTN?
#02 ;draw-modpad JSR2
;pop JSR2 ;pop JSR2 SWP2 MUL2 ;push JSR2
@@ -284,7 +297,11 @@ RTN
@do-div ( -- )
- .stack/length LDZ #01 > RTN?
+ .input/value LDZ2 #0000 == ,&no-push JCN
+ ;do-push JSR2
+ &no-push
+
+ ( stack empty ) .stack/length LDZ #01 > RTN?
#03 ;draw-modpad JSR2
;pop JSR2 ;pop JSR2 SWP2 DIV2 ;push JSR2