1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-27 19:48:06 +11:00
collapseos/blk/406
Virgil Dupras 33d37d4ce9 WORD: don't overwrite RAM on words over 31 chars
This allows me to reclaim some RAM I hadn't even noticed I
needlessly monopolise.
2020-05-13 20:39:53 -04:00

17 lines
509 B
Plaintext

( Read word from C<, copy to WORDBUF, null-terminate, and
return WORDBUF. )
: WORD
0x0e RAM+ ( 0e == WORDBUF )
TOWORD ( a c )
BEGIN
( We take advantage of the fact that char MSB is
always zero to pre-write our null-termination )
OVER ! 1+ ( a+1 )
C< ( a c )
OVER 0x2d ( 2e-1 for NULL ) RAM+ = OVER WS? OR
UNTIL
( a this point, PS is: a WS )
( null-termination is already written )
2DROP
0x0e RAM+ ;