Add word NL

This commit is contained in:
Virgil Dupras 2020-05-04 08:10:18 -04:00
parent a3c3a2f44a
commit 24e9fa0c30
13 changed files with 20 additions and 19 deletions

View File

@ -1,11 +1,10 @@
WORD -- a Read one word from buffered input and push its
addr.
There are also ascii const emitters:
BS
CR
LF
SPC
BS CR LF SPC CRLF
NL is an indirect word (see B80) that aliases to CRLF by
default and that should generally be used when we want to emit
a newline.

View File

@ -4,7 +4,7 @@ RAMSTART INITIAL_SP +55 (key) override
+04 HERE +59 blk's variables
+06 C<? +5b z80a's variables
+08 C<* override +5d adev's variables
+0a RESERVED +5f FUTURE USES
+0a NLPTR +5f FUTURE USES
+0c C<* +70 DRIVERS
+0e WORDBUF +80 RAMEND
+2e BOOT C< PTR

View File

@ -4,6 +4,9 @@ address. Most of the time, it points to RAM+2, but sometimes,
when maintaining alternative dicts (during cross compilation
for example), it can point elsewhere.
NLPTR points to an alternative routine for NL (by default,
CRLF).
FUTURE USES section is unused for now.
DRIVERS section is reserved for recipe-specific
@ -11,6 +14,3 @@ drivers. Here is a list of known usages:
* 0x70-0x78: ACIA buffer pointers in RC2014 recipes.

View File

@ -1,5 +1,5 @@
VARIABLE ACC
: _LIST ." Block " DUP . CRLF LIST ;
: _LIST ." Block " DUP . NL LIST ;
: _NUM
ACC @ SWAP _pdacc
IF _LIST 0 THEN

View File

@ -4,8 +4,8 @@
DUP ROT SWAP H@ 4 + ( u src u dst )
SWAP MOVE ( u )
4 + DUP CURRENT @ WORD( + ( u we )
DUP .X CRLF
SWAP CURRENT @ PREV + DUP .X CRLF ( we wr )
DUP .X NL
SWAP CURRENT @ PREV + DUP .X NL ( we wr )
BEGIN ( we wr )
DUP ROT ( wr wr we )
H@ @ H@ 2+ @ ( wr wr we ol o )
@ -13,4 +13,4 @@
DUP PREV SWAP ( wr oldwr )
WORD( SWAP ( we wr )
DUP 4 - H@ <= ( are we finished? )
UNTIL H@ 4 + .X CRLF ;
UNTIL H@ 4 + .X NL ;

View File

@ -1,3 +1,3 @@
( b1 b2 -- )
: XPACKR 1+ SWAP DO I DUP . CRLF XPACK LOOP ;
: XPACKR 1+ SWAP DO I DUP . NL XPACK LOOP ;

View File

@ -4,6 +4,7 @@
0 0x08 RAM+ ! ( 08 == C<* override )
0 0x53 RAM+ ! ( 53 == (emit) override )
0 0x55 RAM+ ! ( 55 == (key) override )
0 0x0a RAM+ ! ( NLPTR )
( 0c == C<* )
LIT< (boot<) (find) DROP 0x0c RAM+ !
( boot< always has a char waiting. 06 == C<?* )

View File

@ -3,7 +3,8 @@
: CR 13 EMIT ;
: CRLF CR LF ;
: SPC 32 EMIT ;
: NL 0x0a RAM+ @ ( NLPTR ) DUP IF EXECUTE ELSE DROP CRLF THEN ;
: (wnf) (print) SPC ABORT" word not found" ;
: (ok) SPC ." ok" CRLF ;
: (ok) SPC ." ok" NL ;

View File

@ -12,5 +12,5 @@
IF DROP '.' THEN
EMIT
LOOP
CRLF
NL
;

View File

@ -5,7 +5,7 @@
16 0 DO
I 1+ .2 SPC
64 I * BLK( + (print)
CRLF
NL
LOOP
;

View File

@ -1,2 +1,2 @@
( b1 b2 -- )
: LOADR 1+ SWAP DO I DUP . CRLF LOAD LOOP ;
: LOADR 1+ SWAP DO I DUP . NL LOAD LOOP ;

Binary file not shown.

View File

@ -19,7 +19,7 @@
['] EFS! BLK!* !
RDLN$
LIT< _sys [entry]
." Collapse OS" CRLF
." Collapse OS" NL
INTERPRET
;