Pinning down insidious bug in interpreter.
[forth.jl.git] / src / lib.4th
index 68bb77b..c145b61 100644 (file)
@@ -32,8 +32,9 @@
 
 : LITERAL IMMEDIATE ['] LIT , , ;
 
-: CHAR BL WORD 1+ @ ;
+: ' BL WORD FIND >CFA ;
 
+: CHAR BL WORD 1+ @ ;
 : [CHAR] IMMEDIATE
     CHAR
     ['] LIT , ,
 ;
 
 : +LOOP IMMEDIATE
+
+        trace
+
         ['] DUP , \ Store copy of increment
 
         ['] R> , ['] SWAP , ['] R> , ['] SWAP , ['] R> , ['] SWAP , ['] + , ['] 2DUP , ['] - ,
         ['] SWAP , ['] >R , ['] SWAP , ['] >R , ['] SWAP , ['] >R ,
 
+        trace
+
         \ Condition differently depending on sign of increment
         ['] SWAP , ['] 0>= , [COMPILE] IF
             ['] 0<= ,
             ['] 0> ,
         [COMPILE] THEN
 
+        trace
+
         \ Branch back to begining of loop kernel
         ['] 0BRANCH , HERE @ - ,
 
         \ Clean up
         ['] RDROP , ['] RDROP , ['] RDROP ,
 
+        trace
+
         \ Record address of loop end for any LEAVEs to use
         HERE @ SWAP !