diff --git a/wipforth.wat b/wipforth.wat index 66cf67e..5e8d7ce 100644 --- a/wipforth.wat +++ b/wipforth.wat @@ -635,10 +635,12 @@ (func $key (local $head i32) global.get $RXHEAD i32.atomic.load8_u - local.tee $head + local.set $head ;; Wait for RXBUF to be non-empty - loop $wait (param i32) + loop $wait + local.get $head + global.get $RXTAIL i32.atomic.load8_u i32.eq @@ -648,7 +650,6 @@ i64.const -1 memory.atomic.wait32 - local.get $head br $wait end end @@ -1641,10 +1642,10 @@ ;; ;; \ Handle number ;; DROP \ Discard nil entry - ;; DUP NUMBER? 0BRANCH [44] \ Convert to number + ;; DUP NUMBER? 0BRANCH [48] \ Convert to number ;; SWAP DROP \ Discard word length - ;; STATE @ 0BRANCH [16] \ Check state - ;; LIT-CFA , , \ If compiling, append LIT and the value + ;; STATE @ 0BRANCH [20] \ Check state + ;; LIT LIT , , \ If compiling, append LIT and the value ;; EXIT ;; ;; \ Word was not found @@ -1682,14 +1683,15 @@ "\08\02\00\00" ;; DUP "\5c\09\00\00" ;; NUMBER? "\b4\04\00\00" ;; 0BRANCH - "\2c\00\00\00" ;; 44 + "\30\00\00\00" ;; 48 "\28\02\00\00" ;; SWAP "\18\02\00\00" ;; DROP "\5c\05\00\00" ;; STATE "\cc\03\00\00" ;; @ "\b4\04\00\00" ;; 0BRANCH - "\10\00\00\00" ;; 16 - "\00\05\00\00" ;; LIT-CFA + "\14\00\00\00" ;; 20 + "\18\04\00\00" ;; LIT + "\18\04\00\00" ;; LIT "\5c\0a\00\00" ;; , "\5c\0a\00\00" ;; , "\0c\04\00\00" ;; EXIT @@ -1697,11 +1699,10 @@ "\bc\0b\00\00" ;; EXECUTE "\0c\04\00\00") ;; EXIT - ;; => 0xb8 bytes + ;; => 0xbc bytes - ;; The previous version of INTERPRET was 0xc4 bytes, so we have 12 - ;; unused bytes here. Could fit an extra codeword definition in - ;; here, if the name is less than 4 bytes long. + ;; The previous version of INTERPRET was 0xc4 bytes, so we have 8 + ;; unused bytes here lol ;; : QUIT R0 RSP! INTERPRET BRANCH [-8] ;