Add EOT ASCII const

This commit is contained in:
Virgil Dupras 2021-01-02 13:55:20 -05:00
parent 3d47c28a28
commit 1cbef2f210
3 changed files with 8 additions and 8 deletions

14
blk.fs
View File

@ -1717,7 +1717,8 @@ with "390 LOAD"
( ----- 356 )
SYSVARS 0x53 + :** EMIT
: STYPE C@+ ( a len ) 0 DO C@+ EMIT LOOP DROP ;
: BS 0x8 ; : LF 0xa ; : CR 0xd ; : SPC 0x20 ; : SPC> SPC EMIT ;
: EOT 0x4 ; : BS 0x8 ; : LF 0xa ; : CR 0xd ; : SPC 0x20 ;
: SPC> SPC EMIT ;
: NL> 0x50 RAM+ C@ ?DUP IF EMIT ELSE 13 EMIT 10 EMIT THEN ;
: ERR STYPE ABORT ;
: (uflw) LIT" stack underflow" ERR ;
@ -1806,14 +1807,13 @@ SYSVARS 0x0c + :** C<*
C< DUP 34 ( ASCII " ) = IF DROP EXIT THEN C,
AGAIN ;
( ----- 364 )
: WS? 33 < ;
: EOT? 4 = ; ( 4 == ASCII EOT, CTRL+D )
: EOT, 4 C, ;
: WS? SPC <= ;
: EOT? EOT = ;
: EOT, EOT C, ;
: TOWORD
: TOWORD ( -- c, c being the first letter of the word )
0 ( dummy ) BEGIN
DROP C< DUP WS? NOT OVER EOT? OR
UNTIL ;
DROP C< DUP WS? NOT OVER EOT? OR UNTIL ;
( ----- 365 )
( Read word from C<, copy to WORDBUF, null-terminate, and
return WORDBUF. )

Binary file not shown.

View File

@ -265,7 +265,7 @@ WORD -- a Read one word from buffered input and push its
idered a word).
These ASCII consts are defined:
BS CR LF SPC
EOT BS CR LF SPC
KEY? and EMIT are ialiases to (key?) and (emit) (see TTY proto-
col in protocol.txt). KEY is a loop over KEY?.