mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-24 01:58:06 +11:00
16 lines
486 B
Plaintext
16 lines
486 B
Plaintext
( Read word from C<, copy to WORDBUF, null-terminate, and
|
|
return WORDBUF. )
|
|
: _wb 0x0e RAM+ ;
|
|
: _eot 4 _wb ! _wb ;
|
|
: WORD
|
|
_wb 1+ TOWORD ( a c )
|
|
DUP EOT? IF 2DROP _eot EXIT THEN
|
|
BEGIN
|
|
( We take advantage of the fact that char MSB is
|
|
always zero to pre-write our null-termination )
|
|
OVER ! 1+ C< ( a c )
|
|
OVER 0x2d ( 2e-1 for NULL ) RAM+ = OVER WS? OR
|
|
UNTIL ( a c )
|
|
SWAP _wb - 1- ( ws len ) _wb C!
|
|
EOT? IF _eot ELSE _wb 1+ THEN ;
|