From 6821bea9c0a0f6f356d2b406de55c4968445b9c3 Mon Sep 17 00:00:00 2001 From: neauoire Date: Mon, 20 Sep 2021 15:51:54 -0700 Subject: [PATCH] The calc pushes values on opcode --- projects/software/calc.tal | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/projects/software/calc.tal b/projects/software/calc.tal index 09202e8..fd3493e 100644 --- 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