From 0645640f205669ebca0094a1f760cbd17ff1753b Mon Sep 17 00:00:00 2001 From: Camden Dixie O'Brien Date: Sat, 28 Feb 2026 17:41:26 +0000 Subject: [PATCH] Define ALIGN --- wipforth.wat | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/wipforth.wat b/wipforth.wat index 4d36be3..c8e3968 100644 --- a/wipforth.wat +++ b/wipforth.wat @@ -1794,6 +1794,32 @@ ;; => 0x20 bytes + ;; : ALIGN + ;; DUP 3 AND 0BRANCH [32] + ;; 0 OVER C! 1+ BRANCH [-48] + ;; ; + + (data (i32.const 0x0c50) + "\30\0c\00\00" + "\05ALIGN\00\00" + "\00\00\00\00" + "\08\02\00\00" ;; DUP + "\18\04\00\00" ;; LIT + "\03\00\00\00" ;; 3 + "\8c\03\00\00" ;; AND + "\b4\04\00\00" ;; 0BRANCH + "\20\00\00\00" ;; 32 + "\18\04\00\00" ;; LIT + "\00\00\00\00" ;; 0 + "\54\02\00\00" ;; OVER + "\f0\03\00\00" ;; C! + "\90\02\00\00" ;; 1+ + "\a4\04\00\00" ;; BRANCH + "\d0\ff\ff\ff" ;; -48 + "\0c\04\00\00") ;; EXIT + + ;; => 0x48 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