1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-05 08:40:54 +11:00

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 WORD -- a Read one word from buffered input and push its
addr. addr.
There are also ascii const emitters: There are also ascii const emitters:
BS BS CR LF SPC CRLF
CR NL is an indirect word (see B80) that aliases to CRLF by
LF default and that should generally be used when we want to emit
SPC a newline.

View File

@ -4,7 +4,7 @@ RAMSTART INITIAL_SP +55 (key) override
+04 HERE +59 blk's variables +04 HERE +59 blk's variables
+06 C<? +5b z80a's variables +06 C<? +5b z80a's variables
+08 C<* override +5d adev's variables +08 C<* override +5d adev's variables
+0a RESERVED +5f FUTURE USES +0a NLPTR +5f FUTURE USES
+0c C<* +70 DRIVERS +0c C<* +70 DRIVERS
+0e WORDBUF +80 RAMEND +0e WORDBUF +80 RAMEND
+2e BOOT C< PTR +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 when maintaining alternative dicts (during cross compilation
for example), it can point elsewhere. for example), it can point elsewhere.
NLPTR points to an alternative routine for NL (by default,
CRLF).
FUTURE USES section is unused for now. FUTURE USES section is unused for now.
DRIVERS section is reserved for recipe-specific 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. * 0x70-0x78: ACIA buffer pointers in RC2014 recipes.

View File

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

View File

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

View File

@ -1,3 +1,3 @@
( b1 b2 -- ) ( 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 0x08 RAM+ ! ( 08 == C<* override )
0 0x53 RAM+ ! ( 53 == (emit) override ) 0 0x53 RAM+ ! ( 53 == (emit) override )
0 0x55 RAM+ ! ( 55 == (key) override ) 0 0x55 RAM+ ! ( 55 == (key) override )
0 0x0a RAM+ ! ( NLPTR )
( 0c == C<* ) ( 0c == C<* )
LIT< (boot<) (find) DROP 0x0c RAM+ ! LIT< (boot<) (find) DROP 0x0c RAM+ !
( boot< always has a char waiting. 06 == C<?* ) ( boot< always has a char waiting. 06 == C<?* )

View File

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

View File

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

View File

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

View File

@ -1,2 +1,2 @@
( b1 b2 -- ) ( 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!* ! ['] EFS! BLK!* !
RDLN$ RDLN$
LIT< _sys [entry] LIT< _sys [entry]
." Collapse OS" CRLF ." Collapse OS" NL
INTERPRET INTERPRET
; ;