1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-23 19:58:06 +11:00

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.
This commit is contained in:
Virgil Dupras 2020-05-13 20:39:53 -04:00
parent bd1e76ec5b
commit 33d37d4ce9
4 changed files with 4 additions and 6 deletions

View File

@ -7,6 +7,7 @@ RAMSTART FUTURE USES +55 (key) override
+0c C<* +70 DRIVERS +0c C<* +70 DRIVERS
+0e WORDBUF +80 RAMEND +0e WORDBUF +80 RAMEND
+2e BOOT C< PTR +2e BOOT C< PTR
+30 FUTURE USES
+4e INTJUMP +4e INTJUMP
+51 CURRENTPTR +51 CURRENTPTR
+53 (emit) override +53 (emit) override

View File

@ -1,7 +1,4 @@
( The NOT is to normalize the negative/positive numbers to 1 : WS? 33 < ;
or 0. Hadn't we wanted to normalize, we'd have written:
32 CMP 1 - )
: WS? 33 CMP 1+ NOT ;
: TOWORD : TOWORD
BEGIN BEGIN

View File

@ -1,5 +1,5 @@
( Read word from C<, copy to WORDBUF, null-terminate, and ( Read word from C<, copy to WORDBUF, null-terminate, and
return, make HL point to WORDBUF. ) return WORDBUF. )
: WORD : WORD
0x0e RAM+ ( 0e == WORDBUF ) 0x0e RAM+ ( 0e == WORDBUF )
TOWORD ( a c ) TOWORD ( a c )
@ -8,7 +8,7 @@
always zero to pre-write our null-termination ) always zero to pre-write our null-termination )
OVER ! 1+ ( a+1 ) OVER ! 1+ ( a+1 )
C< ( a c ) C< ( a c )
DUP WS? OVER 0x2d ( 2e-1 for NULL ) RAM+ = OVER WS? OR
UNTIL UNTIL
( a this point, PS is: a WS ) ( a this point, PS is: a WS )
( null-termination is already written ) ( null-termination is already written )

Binary file not shown.