diff --git a/arch/z80/trs80/xcomp.fs b/arch/z80/trs80/xcomp.fs index 9839c2e..ee37f89 100644 --- a/arch/z80/trs80/xcomp.fs +++ b/arch/z80/trs80/xcomp.fs @@ -15,6 +15,6 @@ RS_ADDR 0x80 - CONSTANT SYSVARS ( Update LATEST ) PC ORG @ 8 + ! ( TRS-80 wants CR-only newlines ) -," ' CR ' NL **! BLK$ FD$ " EOT, +," 13 0x50 RAM+ C! BLK$ FD$ " EOT, ORG @ |M 2 PC! 2 PC! H@ |M 2 PC! 2 PC! diff --git a/blk.fs b/blk.fs index 398e7c1..78ddd74 100644 --- a/blk.fs +++ b/blk.fs @@ -450,7 +450,7 @@ VARIABLE L1 VARIABLE L2 VARIABLE L3 VARIABLE L4 ( We divide by 2 because each PC represents a word. ) : PC H@ ORG @ - 1 RSHIFT ; ( ----- 052 ) -: _oor ." arg out of range: " .X SPC ." PC: " PC .X NL ABORT ; +: _oor ." arg out of range: " .X SPC ." PC: " PC .X NL> ABORT ; : _r8c DUP 7 > IF _oor THEN ; : _r32c DUP 31 > IF _oor THEN ; : _r16+c _r32c DUP 16 < IF _oor THEN ; @@ -610,7 +610,7 @@ See doc/ed.txt 1 7 LOADR+ ( ----- 106 ) CREATE ACC 0 , -: _LIST ." Block " DUP . NL LIST ; +: _LIST ." Block " DUP . NL> LIST ; : L BLK> @ _LIST ; : B BLK> @ 1- BLK@ L ; : N BLK> @ 1+ BLK@ L ; @@ -1717,9 +1717,8 @@ with "390 LOAD" ( ----- 356 ) SYSVARS 0x53 + :** EMIT : STYPE C@+ ( a len ) 0 DO C@+ EMIT LOOP DROP ; -: BS 8 EMIT ; : CR 13 EMIT ; -: CRLF CR 10 EMIT ; : SPC 32 EMIT ; -SYSVARS 0x0a + :** NL +: BS 8 EMIT ; : SPC 32 EMIT ; +: NL> 0x50 RAM+ C@ ?DUP IF EMIT ELSE 13 EMIT 10 EMIT THEN ; : ERR STYPE ABORT ; : (uflw) LIT" stack underflow" ERR ; XCURRENT @ _xapply ORG @ 0x06 ( stable ABI uflw ) + ! @@ -1968,7 +1967,7 @@ SYSVARS 0x0c + :** C<* DROP ( a ) 8 0 DO C@+ DUP 0x20 0x7e =><= NOT IF DROP '.' THEN EMIT - LOOP NL ; + LOOP NL> ; : DUMP ( n a -- ) SWAP 8 /MOD SWAP IF 1+ THEN 0 DO _ LOOP ; @@ -2038,14 +2037,14 @@ SYSVARS 0x55 + :** KEY? 64 I * BLK( + DUP 64 + SWAP DO I C@ DUP 0x1f > IF EMIT ELSE DROP LEAVE THEN LOOP - NL + NL> LOOP ; ( ----- 383 ) : INTERPRET BEGIN WORD DUP @ 0x0401 = ( EOT ) IF DROP EXIT THEN FIND NOT IF (parse) ELSE EXECUTE THEN - C THEN AGAIN ; ( Read from BOOT C< PTR and inc it. ) : (boot<) @@ -2085,13 +2084,13 @@ SYSVARS 0x55 + :** KEY? 0x02 RAM+ CURRENT* ! CURRENT @ 0x2e RAM+ ! ( 2e == BOOT C< PTR ) 0 0x08 RAM+ ! ( 08 == C<* override ) + 0 0x50 RAM+ C! ( NL> ) ['] (emit) ['] EMIT **! ['] (key?) ['] KEY? **! - ['] CRLF ['] NL **! ['] (boot<) ['] C<* **! ( boot< always has a char waiting. 06 == C (main) ; XCURRENT @ _xapply ORG @ 0x04 ( stable ABI BOOT ) + ! 1 4 LOADR+ ( ----- 391 ) diff --git a/cvm/stage.bin b/cvm/stage.bin index b317698..0d09fdc 100644 Binary files a/cvm/stage.bin and b/cvm/stage.bin differ diff --git a/doc/dict.txt b/doc/dict.txt index 4b7a79c..fba8d23 100644 --- a/doc/dict.txt +++ b/doc/dict.txt @@ -253,21 +253,20 @@ KEY? -- c? f Polls the keyboard for a key. If a key is pressed, f is true and c is the char. Other- wise, f is false and c is *not* on the stack. KEY -- c Get char c from direct input +NL> -- Emit newline PC! c a -- Spit c to port a PC@ a -- c Fetch c from port a +SPC -- Emit space character WORD -- a Read one word from buffered input and push its addr. Always null terminated. If ASCII EOT is encountered, a will point to it (it is cons- idered a word). -There are also ascii const emitters: -BS CR LF SPC CRLF - KEY? and EMIT are ialiases to (key?) and (emit) (see TTY proto- col in protocol.txt). KEY is a loop over KEY?. -NL is an ialias that points to CRLF by default and that should -generally be used when we want to emit a newline. +NL> spits CRLF by default, but can be configured to spit an +alternate newline char. See impl.txt. # Disk diff --git a/doc/impl.txt b/doc/impl.txt index f242843..1f086fb 100644 --- a/doc/impl.txt +++ b/doc/impl.txt @@ -162,8 +162,8 @@ SYSVARS FUTURE USES +3c BLK(* +02 CURRENT +3e ~C!* +04 HERE +41 ~C!ERR +06 C character ++0a FUTURE USES +51 CURRENTPTR +0c C<* +53 EMIT ialias +0e WORDBUF +55 KEY? ialias +2e BOOT C< PTR +57 FUTURE USES @@ -201,6 +201,9 @@ Register usage is arch-dependent, see boot code for details. this byte to a nonzero value. Otherwise, stays at zero. Has to be reset to zero manually after an error. +NL> is a single byte. If zero (default), NL> spits CR/LF. Other- +wise, it spits the value of RAM+50. + DRIVERS section is reserved for recipe-specific drivers. FUTURE USES section is unused for now.