kervinck / gigatron-rom

System, apps and tooling for the Gigatron TTL microcomputer
BSD 2-Clause "Simplified" License
231 stars 80 forks source link

Comparison bug in tinybasic! #192

Closed lb3361 closed 3 years ago

lb3361 commented 3 years ago

I would have expected the last statement below to print nothing (not "yes")

image

lb3361 commented 3 years ago

Fix

diff --git a/Apps/TinyBASIC/TinyBASIC_v4.gcl b/Apps/TinyBASIC/TinyBASIC_v4.gcl
index 9b3e497d..80144cbd 100644
--- a/Apps/TinyBASIC/TinyBASIC_v4.gcl
+++ b/Apps/TinyBASIC/TinyBASIC_v4.gcl
@@ -452,7 +452,7 @@ GetLine=
     Expression!
     Keyword! `then #0           {Optional}
     %2 Value^                   {Do the comparison, beware of overflows}
-    [if<0 %2                    {Opposite signs}
+    [if<0 %2 1|                 {Opposite signs}
      else %2 Value-]            {Same signs}
     [if>0 4]                    {First is greater}
     [if<0 1]                    {Second is greater}
at67 commented 3 years ago

You can close this issue at your leisure, thanks for fixing it!