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