diff --git a/wipforth.wat b/wipforth.wat index c657a89..b38c21f 100644 --- a/wipforth.wat +++ b/wipforth.wat @@ -1651,6 +1651,10 @@ ;; => 0x28 bytes + ;; Cold start + + (data (i32.const 0x0ba0) "\78\0b\00\00") ;; QUIT + ;; 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 @@ -1668,8 +1672,7 @@ end) (func (export "reset") - i32.const 0xf000 global.set $sp ;; Set the stack pointer - ;; i32.const 0x???? global.set $ip ;; Set the IP to point at QUIT - ;; call $next - ;; call $trampoline - )) + i32.const 0xf000 global.set $sp ;; Set the stack pointer + i32.const 0x0ba0 global.set $ip ;; Set the IP to the cold start + call $next + call $trampoline))