channels working
[watForth.git] / forth.wat
index 75c3009..d524060 100644 (file)
--- a/forth.wat
+++ b/forth.wat
   (data (i32.const 16740) "\01\00\00\00") ;; RET
   (data (i32.const 16744) "\20\00\00\00") ;; 2DROP <-- donum_err
   (data (i32.const 16748) "\02\00\00\00") ;; LIT 
-  (data (i32.const 16752) "\04\30\00\00") ;; INBUFSIZE LOCATION
+  (data (i32.const 16752) "\00\00\00\00") ;; 0
   (data (i32.const 16756) "\02\00\00\00") ;; LIT
-  (data (i32.const 16760) "\00\00\00\00") ;; 0
+  (data (i32.const 16760) "\04\30\00\00") ;; INBUFSIZE LOCATION
   (data (i32.const 16764) "\0b\00\00\00") ;; !
   (data (i32.const 16768) "\19\00\00\00") ;; BYE
   (data (i32.const 16772) "\00\00\00\00") ;; 
       block $echostring block $strstart block $strput block $strend block $fetchinc
       block $setinc block $finddoes block $definedoes block $stacktrace block $webfetch
       block $outchan block $read block $openchannel block $rpush_op block $fetch8_u
+      block $negrot
         get_local $eax
         br_table $op0 $ret (;2;)$lit $rinit (;4;)$logword $key (;6;)$dup $plus
         (;8;)$jmp $emit (;10;)$fetch $set (;12;)$execute $noop (;14;)$jz $jnz
         (;34;)$subtract $inchan (;36;)$sethere $eqbool (;38;)$echostring $strstart
         (;40;)$strput $strend (;42;)$fetchinc $setinc (;44;)$finddoes $definedoes
         (;46;)$stacktrace $webfetch (;48;)$outchan $read (;50;)$awaiting $openchannel
-        (;52;)$rpush_op $fetch8_u $default
+        (;52;)$rpush_op $fetch8_u (;54;)$negrot $default
+      end ;; negrot
+        call $pop
+        call $pop
+        set_local $eax
+        call $pop
+        get_local $eax
+        call $push
+        set_local $eax
+        call $push
+        get_local $eax
+        call $push
+        br $next
       end ;; fetch8_u
         call $pop
         i32.load8_u
         call $push
         br $next
       end ;; setinc
-        call $pop
-        call $rpush
         call $pop
         tee_local $eax
-        call $rpop
+        call $pop
         i32.store
         get_local $eax
         i32.const 4
         br $next
       end ;; set
         call $pop
-        set_local $eax
         call $pop
-        get_local $eax
         i32.store
         br $next
       end ;; fetch