mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-24 02:58:06 +11:00
2e9e7047bf
This should allow me to simplify LOAD's exit mechanism on block end.
14 lines
440 B
Plaintext
14 lines
440 B
Plaintext
( Read word from C<, copy to WORDBUF, null-terminate, and
|
|
return WORDBUF. )
|
|
: WORD
|
|
0x0e RAM+ TOWORD ( a c )
|
|
DUP EOT? IF OVER ! 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 DROP 0x0e RAM+ ( ws a )
|
|
SWAP EOT? IF 4 OVER ! THEN ;
|