Implement cold start
This commit is contained in:
13
wipforth.wat
13
wipforth.wat
@@ -1651,6 +1651,10 @@
|
|||||||
|
|
||||||
;; => 0x28 bytes
|
;; => 0x28 bytes
|
||||||
|
|
||||||
|
;; Cold start
|
||||||
|
|
||||||
|
(data (i32.const 0x0ba0) "\78\0b\00\00") ;; QUIT
|
||||||
|
|
||||||
;; The trampoline is a workaround for WebAssembly's lack of indirect
|
;; The trampoline is a workaround for WebAssembly's lack of indirect
|
||||||
;; jumps and code addresses. Instead of jumping into the next
|
;; jumps and code addresses. Instead of jumping into the next
|
||||||
;; codeword, NEXT sets the $fn global to the function index of the
|
;; codeword, NEXT sets the $fn global to the function index of the
|
||||||
@@ -1668,8 +1672,7 @@
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
(func (export "reset")
|
(func (export "reset")
|
||||||
i32.const 0xf000 global.set $sp ;; Set the stack pointer
|
i32.const 0xf000 global.set $sp ;; Set the stack pointer
|
||||||
;; i32.const 0x???? global.set $ip ;; Set the IP to point at QUIT
|
i32.const 0x0ba0 global.set $ip ;; Set the IP to the cold start
|
||||||
;; call $next
|
call $next
|
||||||
;; call $trampoline
|
call $trampoline))
|
||||||
))
|
|
||||||
|
|||||||
Reference in New Issue
Block a user