Fix NUMBER?

I wasn't able to keep the length the same so had to update the
addresses of , IMMEDIATE? INTERPRET QUIT and the cold start (and
therefore also the values of LATEST and HERE).
This commit is contained in:
2026-02-27 22:56:26 +00:00
parent 4f50321c26
commit 973eba9f0a

View File

@@ -1068,13 +1068,13 @@
"\64\05\00\00" "\64\05\00\00"
"\04HERE\00\00\00" "\04HERE\00\00\00"
"\02\00\00\00" "\02\00\00\00"
"\a8\0b\00\00") "\b0\0b\00\00")
(data (i32.const 0x058c) (data (i32.const 0x058c)
"\78\05\00\00" "\78\05\00\00"
"\06LATEST\00" "\06LATEST\00"
"\02\00\00\00" "\02\00\00\00"
"\7c\0b\00\00") "\84\0b\00\00")
(data (i32.const 0x05a0) (data (i32.const 0x05a0)
"\8c\05\00\00" "\8c\05\00\00"
@@ -1421,7 +1421,8 @@
;; : NUMBER? ( len -- value TRUE | FALSE ) ;; : NUMBER? ( len -- value TRUE | FALSE )
;; WORDBUF \ Initial address ;; WORDBUF \ Initial address
;; ;;
;; C@ 45 = 0BRANCH [56] \ Check for minus sign ;; DUP C@ 45 = 0BRANCH [60] \ Check for minus sign
;; 1+ \ Increment address
;; SWAP 1- \ Decrement length ;; SWAP 1- \ Decrement length
;; DUP 0BRANCH [24] \ Check if any characters remain ;; DUP 0BRANCH [24] \ Check if any characters remain
;; TRUE -ROT \ Set negate flag true ;; TRUE -ROT \ Set negate flag true
@@ -1460,12 +1461,14 @@
"\07NUMBER?" "\07NUMBER?"
"\00\00\00\00" "\00\00\00\00"
"\ac\05\00\00" ;; WORDBUF "\ac\05\00\00" ;; WORDBUF
"\08\02\00\00" ;; DUP
"\fc\03\00\00" ;; C@ "\fc\03\00\00" ;; C@
"\18\04\00\00" ;; LIT "\18\04\00\00" ;; LIT
"\2d\00\00\00" ;; 45 "\2d\00\00\00" ;; 45
"\fc\02\00\00" ;; = "\fc\02\00\00" ;; =
"\b4\04\00\00" ;; 0BRANCH "\b4\04\00\00" ;; 0BRANCH
"\38\00\00\00" ;; 56 "\3c\00\00\00" ;; 60
"\90\02\00\00" ;; 1+
"\28\02\00\00" ;; SWAP "\28\02\00\00" ;; SWAP
"\9c\02\00\00" ;; 1- "\9c\02\00\00" ;; 1-
"\08\02\00\00" ;; DUP "\08\02\00\00" ;; DUP
@@ -1519,11 +1522,11 @@
"\34\05\00\00" ;; TRUE "\34\05\00\00" ;; TRUE
"\0c\04\00\00") ;; EXIT "\0c\04\00\00") ;; EXIT
;; => 0xfc bytes ;; => 0x104 bytes
;; : , HERE @ ! 4 HERE +! ; ;; : , HERE @ ! 4 HERE +! ;
(data (i32.const 0x0a4c) (data (i32.const 0x0a54)
"\50\09\00\00" "\50\09\00\00"
"\01,\00\00" "\01,\00\00"
"\00\00\00\00" "\00\00\00\00"
@@ -1540,8 +1543,8 @@
;; : IMMEDIATE? 4+ @ 128 AND 0BRANCH [12] TRUE EXIT FALSE ; ;; : IMMEDIATE? 4+ @ 128 AND 0BRANCH [12] TRUE EXIT FALSE ;
(data (i32.const 0x0a78) (data (i32.const 0x0a80)
"\4c\0a\00\00" "\54\0a\00\00"
"\0aIMMEDIATE?\00" "\0aIMMEDIATE?\00"
"\00\00\00\00" "\00\00\00\00"
"\a8\02\00\00" ;; 4+ "\a8\02\00\00" ;; 4+
@@ -1586,8 +1589,8 @@
;; DROP 1 ERROR ! ;; DROP 1 ERROR !
;; ; ;; ;
(data (i32.const 0x0ab8) (data (i32.const 0x0ac0)
"\78\0a\00\00" "\80\0a\00\00"
"\09INTERPRET\00\00" "\09INTERPRET\00\00"
"\00\00\00\00" "\00\00\00\00"
"\74\06\00\00" ;; WORD "\74\06\00\00" ;; WORD
@@ -1599,7 +1602,7 @@
"\28\02\00\00" ;; SWAP "\28\02\00\00" ;; SWAP
"\18\02\00\00" ;; DROP "\18\02\00\00" ;; DROP
"\08\02\00\00" ;; DUP "\08\02\00\00" ;; DUP
"\88\0a\00\00" ;; IMMEDIATE? "\90\0a\00\00" ;; IMMEDIATE?
"\b4\03\00\00" ;; INVERT "\b4\03\00\00" ;; INVERT
"\b4\04\00\00" ;; 0BRANCH "\b4\04\00\00" ;; 0BRANCH
"\20\00\00\00" ;; 32 "\20\00\00\00" ;; 32
@@ -1608,7 +1611,7 @@
"\b4\04\00\00" ;; 0BRANCH "\b4\04\00\00" ;; 0BRANCH
"\10\00\00\00" ;; 16 "\10\00\00\00" ;; 16
"\28\08\00\00" ;; >CFA "\28\08\00\00" ;; >CFA
"\54\0a\00\00" ;; , "\5c\0a\00\00" ;; ,
"\0c\04\00\00" ;; EXIT "\0c\04\00\00" ;; EXIT
"\28\08\00\00" ;; >CFA "\28\08\00\00" ;; >CFA
"\24\04\00\00" ;; >R "\24\04\00\00" ;; >R
@@ -1625,8 +1628,8 @@
"\b4\04\00\00" ;; 0BRANCH "\b4\04\00\00" ;; 0BRANCH
"\10\00\00\00" ;; 16 "\10\00\00\00" ;; 16
"\00\05\00\00" ;; LIT-CFA "\00\05\00\00" ;; LIT-CFA
"\54\0a\00\00" ;; , "\5c\0a\00\00" ;; ,
"\54\0a\00\00" ;; , "\5c\0a\00\00" ;; ,
"\0c\04\00\00" ;; EXIT "\0c\04\00\00" ;; EXIT
"\18\02\00\00" ;; DROP "\18\02\00\00" ;; DROP
"\18\04\00\00" ;; LIT "\18\04\00\00" ;; LIT
@@ -1639,13 +1642,13 @@
;; : QUIT R0 RSP! INTERPRET BRANCH [-8] ; ;; : QUIT R0 RSP! INTERPRET BRANCH [-8] ;
(data (i32.const 0x0b7c) (data (i32.const 0x0b84)
"\b8\0a\00\00" "\c0\0a\00\00"
"\04QUIT\00\00\00" "\04QUIT\00\00\00"
"\00\00\00\00" "\00\00\00\00"
"\10\05\00\00" ;; R0 "\10\05\00\00" ;; R0
"\50\04\00\00" ;; RSP! "\50\04\00\00" ;; RSP!
"\c8\0a\00\00" ;; INTERPRET "\d0\0a\00\00" ;; INTERPRET
"\a4\04\00\00" ;; BRANCH "\a4\04\00\00" ;; BRANCH
"\f8\ff\ff\ff" ;; -8 "\f8\ff\ff\ff" ;; -8
"\0c\04\00\00") ;; EXIT "\0c\04\00\00") ;; EXIT
@@ -1654,7 +1657,7 @@
;; Cold start ;; Cold start
(data (i32.const 0x0ba4) "\88\0b\00\00") ;; QUIT (data (i32.const 0x0bac) "\90\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
@@ -1675,6 +1678,6 @@
(func (export "reset") (func (export "reset")
i32.const 0x10000 global.set $rsp ;; Set the return stack pointer i32.const 0x10000 global.set $rsp ;; Set the return stack pointer
i32.const 0xf000 global.set $sp ;; Set the stack pointer i32.const 0xf000 global.set $sp ;; Set the stack pointer
i32.const 0x0ba4 global.set $ip ;; Set the IP to the cold start i32.const 0x0bac global.set $ip ;; Set the IP to the cold start
call $next call $next
call $trampoline)) call $trampoline))