mirror of
https://github.com/hsoft/collapseos.git
synced 2024-12-25 04:38:05 +11:00
forth: Forth-ify "WS?"
This commit is contained in:
parent
a17da42021
commit
9fcfebd84c
Binary file not shown.
@ -830,27 +830,10 @@ CIN:
|
||||
.dw EXIT
|
||||
|
||||
|
||||
; ( c -- f )
|
||||
; 33 CMP 1 + NOT
|
||||
; The NOT is to normalize the negative/positive numbers to 1 or 0.
|
||||
; Hadn't we wanted to normalize, we'd have written:
|
||||
; 32 CMP 1 -
|
||||
.db "WS?"
|
||||
.dw $-CIN
|
||||
.db 3
|
||||
ISWS:
|
||||
.dw compiledWord
|
||||
.dw NUMBER
|
||||
.dw 33
|
||||
.dw CMP
|
||||
.dw NUMBER
|
||||
.dw 1
|
||||
.dw PLUS
|
||||
.dw NOT
|
||||
.dw EXIT
|
||||
.fill 24
|
||||
|
||||
.db "NOT"
|
||||
.dw $-ISWS
|
||||
.dw $-CIN
|
||||
.db 3
|
||||
NOT:
|
||||
.dw nativeWord
|
||||
|
@ -78,9 +78,14 @@
|
||||
HERE @ 1 + HERE !
|
||||
;
|
||||
|
||||
( The NOT is to normalize the negative/positive numbers to 1
|
||||
or 0. Hadn't we wanted to normalize, we'd have written:
|
||||
32 CMP 1 - )
|
||||
: WS? 33 CMP 1 + NOT ;
|
||||
|
||||
: TOWORD
|
||||
BEGIN
|
||||
C< DUP WS? NOT IF EXIT THEN DROP
|
||||
C< DUP _c WS? NOT IF EXIT THEN DROP
|
||||
AGAIN
|
||||
;
|
||||
|
||||
@ -96,7 +101,7 @@
|
||||
OVER ! ( a )
|
||||
1 + ( a+1 )
|
||||
C< ( a c )
|
||||
DUP WS?
|
||||
DUP _c WS?
|
||||
UNTIL
|
||||
( a this point, PS is: a WS )
|
||||
( null-termination is already written )
|
||||
|
Loading…
Reference in New Issue
Block a user