mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-06 01:40:56 +11:00
2d17b4e8ec
I'm not sure why I chose null-terminated initially. Probably because the z80asm version had null-terminated strings. Length-prefixes strings are the traditional form of strings in Forth and it's a bit easier to work with them with traditional forth words when they're under this form.
13 lines
241 B
Plaintext
13 lines
241 B
Plaintext
: '? WORD FIND ;
|
|
: '
|
|
'? (?br) [ 4 , ] EXIT
|
|
LIT< (wnf) FIND DROP EXECUTE
|
|
;
|
|
: ROLL
|
|
?DUP NOT IF EXIT THEN
|
|
1+ DUP PICK ( n val )
|
|
SWAP 2 * (roll) ( val )
|
|
NIP ;
|
|
: 2OVER 3 PICK 3 PICK ;
|
|
: 2SWAP 3 ROLL 3 ROLL ;
|