mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-24 02:38:05 +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.
10 lines
357 B
Plaintext
10 lines
357 B
Plaintext
: EMIT
|
|
( 0x53==(emit) override )
|
|
0x53 RAM+ @ ?DUP IF EXECUTE ELSE (emit) THEN ;
|
|
: (print) C@+ ( a len ) 0 DO C@+ EMIT LOOP DROP ;
|
|
: BS 8 EMIT ; : LF 10 EMIT ; : CR 13 EMIT ;
|
|
: CRLF CR LF ; : SPC 32 EMIT ;
|
|
: NL 0x0a RAM+ @ ( NLPTR ) ?DUP IF EXECUTE ELSE CRLF THEN ;
|
|
: (uflw) LIT" stack underflow" ERR ;
|
|
: (wnf) (print) SPC LIT" word not found" ERR ;
|