1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-12-25 04:58:05 +11:00

forth: Forth-ify "TOWORD"

This commit is contained in:
Virgil Dupras 2020-03-28 13:02:04 -04:00
parent 8b7947bc6a
commit c1693c6256
3 changed files with 9 additions and 18 deletions

Binary file not shown.

View File

@ -875,26 +875,11 @@ NOT:
push hl
jp next
; ( -- c )
; C< DUP 32 CMP 1 - SKIP? EXIT DROP TOWORD
.db "TOWORD"
.dw $-NOT
.db 6
TOWORD:
.dw compiledWord
.dw CIN
.dw DUP
.dw ISWS
.dw CSKIP
.dw EXIT
.dw DROP
.dw TOWORD
.dw EXIT
.fill 73
.fill 100
.db "(parsed)"
.dw $-TOWORD
.dw $-NOT
.db 8
PARSED:
.dw nativeWord

View File

@ -78,12 +78,18 @@
HERE @ 1 + HERE !
;
: TOWORD
BEGIN
C< DUP WS? NOT IF EXIT THEN DROP
AGAIN
;
( Read word from C<, copy to WORDBUF, null-terminate, and
return, make HL point to WORDBUF. )
: WORD
( JTBL+30 == WORDBUF )
[ JTBL 30 + @ LITN ] ( a )
TOWORD ( a c )
_c TOWORD ( a c )
BEGIN
( We take advantage of the fact that char MSB is
always zero to pre-write our null-termination )