From 43b6a6978fd2450f7f1ca252fe3a18c387df0b67 Mon Sep 17 00:00:00 2001 From: Camden Dixie O'Brien Date: Sat, 28 Feb 2026 18:53:42 +0000 Subject: [PATCH] Define IMMEDIATE --- wipforth.wat | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/wipforth.wat b/wipforth.wat index 8397e3a..b0266d2 100644 --- a/wipforth.wat +++ b/wipforth.wat @@ -1838,6 +1838,29 @@ ;; => 0x34 bytes + ;; : IMMEDIATE + ;; LATEST @ + ;; 4+ DUP C@ 128 XOR SWAP C! + ;; ; IMMEDIATE + + (data (i32.const 0x0ccc) + "\98\0c\00\00" + "\89IMMEDIATE\00\00" + "\00\00\00\00" + "\98\05\00\00" ;; LATEST + "\cc\03\00\00" ;; @ + "\a8\02\00\00" ;; 4+ + "\08\02\00\00" ;; DUP + "\fc\03\00\00" ;; C@ + "\18\04\00\00" ;; LIT + "\80\00\00\00" ;; 128 + "\a4\03\00\00" ;; XOR + "\28\02\00\00" ;; SWAP + "\f0\03\00\00" ;; C! + "\0c\04\00\00") ;; EXIT + + ;; => 0x40 bytes + ;; The trampoline is a workaround for WebAssembly's lack of indirect ;; jumps and code addresses. Instead of jumping into the next ;; codeword, NEXT sets the $fn global to the function index of the