mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-23 12:48:05 +11:00
Make NL, renamed to NL> a bit simpler
It doesn't require emitting words anymore. The rename to NL> is linked to the upcoming commit.
This commit is contained in:
parent
1fb062e121
commit
cbf9ecfb1e
@ -15,6 +15,6 @@ RS_ADDR 0x80 - CONSTANT SYSVARS
|
|||||||
( Update LATEST )
|
( Update LATEST )
|
||||||
PC ORG @ 8 + !
|
PC ORG @ 8 + !
|
||||||
( TRS-80 wants CR-only newlines )
|
( TRS-80 wants CR-only newlines )
|
||||||
," ' CR ' NL **! BLK$ FD$ " EOT,
|
," 13 0x50 RAM+ C! BLK$ FD$ " EOT,
|
||||||
ORG @ |M 2 PC! 2 PC!
|
ORG @ |M 2 PC! 2 PC!
|
||||||
H@ |M 2 PC! 2 PC!
|
H@ |M 2 PC! 2 PC!
|
||||||
|
19
blk.fs
19
blk.fs
@ -450,7 +450,7 @@ VARIABLE L1 VARIABLE L2 VARIABLE L3 VARIABLE L4
|
|||||||
( We divide by 2 because each PC represents a word. )
|
( We divide by 2 because each PC represents a word. )
|
||||||
: PC H@ ORG @ - 1 RSHIFT ;
|
: PC H@ ORG @ - 1 RSHIFT ;
|
||||||
( ----- 052 )
|
( ----- 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 ;
|
: _r8c DUP 7 > IF _oor THEN ;
|
||||||
: _r32c DUP 31 > IF _oor THEN ;
|
: _r32c DUP 31 > IF _oor THEN ;
|
||||||
: _r16+c _r32c DUP 16 < IF _oor THEN ;
|
: _r16+c _r32c DUP 16 < IF _oor THEN ;
|
||||||
@ -610,7 +610,7 @@ See doc/ed.txt
|
|||||||
1 7 LOADR+
|
1 7 LOADR+
|
||||||
( ----- 106 )
|
( ----- 106 )
|
||||||
CREATE ACC 0 ,
|
CREATE ACC 0 ,
|
||||||
: _LIST ." Block " DUP . NL LIST ;
|
: _LIST ." Block " DUP . NL> LIST ;
|
||||||
: L BLK> @ _LIST ;
|
: L BLK> @ _LIST ;
|
||||||
: B BLK> @ 1- BLK@ L ;
|
: B BLK> @ 1- BLK@ L ;
|
||||||
: N BLK> @ 1+ BLK@ L ;
|
: N BLK> @ 1+ BLK@ L ;
|
||||||
@ -1717,9 +1717,8 @@ with "390 LOAD"
|
|||||||
( ----- 356 )
|
( ----- 356 )
|
||||||
SYSVARS 0x53 + :** EMIT
|
SYSVARS 0x53 + :** EMIT
|
||||||
: STYPE C@+ ( a len ) 0 DO C@+ EMIT LOOP DROP ;
|
: STYPE C@+ ( a len ) 0 DO C@+ EMIT LOOP DROP ;
|
||||||
: BS 8 EMIT ; : CR 13 EMIT ;
|
: BS 8 EMIT ; : SPC 32 EMIT ;
|
||||||
: CRLF CR 10 EMIT ; : SPC 32 EMIT ;
|
: NL> 0x50 RAM+ C@ ?DUP IF EMIT ELSE 13 EMIT 10 EMIT THEN ;
|
||||||
SYSVARS 0x0a + :** NL
|
|
||||||
: ERR STYPE ABORT ;
|
: ERR STYPE ABORT ;
|
||||||
: (uflw) LIT" stack underflow" ERR ;
|
: (uflw) LIT" stack underflow" ERR ;
|
||||||
XCURRENT @ _xapply ORG @ 0x06 ( stable ABI uflw ) + !
|
XCURRENT @ _xapply ORG @ 0x06 ( stable ABI uflw ) + !
|
||||||
@ -1968,7 +1967,7 @@ SYSVARS 0x0c + :** C<*
|
|||||||
DROP ( a )
|
DROP ( a )
|
||||||
8 0 DO
|
8 0 DO
|
||||||
C@+ DUP 0x20 0x7e =><= NOT IF DROP '.' THEN EMIT
|
C@+ DUP 0x20 0x7e =><= NOT IF DROP '.' THEN EMIT
|
||||||
LOOP NL ;
|
LOOP NL> ;
|
||||||
: DUMP ( n a -- )
|
: DUMP ( n a -- )
|
||||||
SWAP 8 /MOD SWAP IF 1+ THEN
|
SWAP 8 /MOD SWAP IF 1+ THEN
|
||||||
0 DO _ LOOP ;
|
0 DO _ LOOP ;
|
||||||
@ -2038,14 +2037,14 @@ SYSVARS 0x55 + :** KEY?
|
|||||||
64 I * BLK( + DUP 64 + SWAP DO
|
64 I * BLK( + DUP 64 + SWAP DO
|
||||||
I C@ DUP 0x1f > IF EMIT ELSE DROP LEAVE THEN
|
I C@ DUP 0x1f > IF EMIT ELSE DROP LEAVE THEN
|
||||||
LOOP
|
LOOP
|
||||||
NL
|
NL>
|
||||||
LOOP ;
|
LOOP ;
|
||||||
( ----- 383 )
|
( ----- 383 )
|
||||||
: INTERPRET
|
: INTERPRET
|
||||||
BEGIN
|
BEGIN
|
||||||
WORD DUP @ 0x0401 = ( EOT ) IF DROP EXIT THEN
|
WORD DUP @ 0x0401 = ( EOT ) IF DROP EXIT THEN
|
||||||
FIND NOT IF (parse) ELSE EXECUTE THEN
|
FIND NOT IF (parse) ELSE EXECUTE THEN
|
||||||
C<? NOT IF SPC LIT" ok" STYPE NL THEN
|
C<? NOT IF SPC LIT" ok" STYPE NL> THEN
|
||||||
AGAIN ;
|
AGAIN ;
|
||||||
( Read from BOOT C< PTR and inc it. )
|
( Read from BOOT C< PTR and inc it. )
|
||||||
: (boot<)
|
: (boot<)
|
||||||
@ -2085,13 +2084,13 @@ SYSVARS 0x55 + :** KEY?
|
|||||||
0x02 RAM+ CURRENT* !
|
0x02 RAM+ CURRENT* !
|
||||||
CURRENT @ 0x2e RAM+ ! ( 2e == BOOT C< PTR )
|
CURRENT @ 0x2e RAM+ ! ( 2e == BOOT C< PTR )
|
||||||
0 0x08 RAM+ ! ( 08 == C<* override )
|
0 0x08 RAM+ ! ( 08 == C<* override )
|
||||||
|
0 0x50 RAM+ C! ( NL> )
|
||||||
['] (emit) ['] EMIT **! ['] (key?) ['] KEY? **!
|
['] (emit) ['] EMIT **! ['] (key?) ['] KEY? **!
|
||||||
['] CRLF ['] NL **!
|
|
||||||
['] (boot<) ['] C<* **!
|
['] (boot<) ['] C<* **!
|
||||||
( boot< always has a char waiting. 06 == C<?* )
|
( boot< always has a char waiting. 06 == C<?* )
|
||||||
1 0x06 RAM+ ! INTERPRET
|
1 0x06 RAM+ ! INTERPRET
|
||||||
RDLN$ LIT" _sys" [entry]
|
RDLN$ LIT" _sys" [entry]
|
||||||
LIT" Collapse OS" STYPE NL (main) ;
|
LIT" Collapse OS" STYPE NL> (main) ;
|
||||||
XCURRENT @ _xapply ORG @ 0x04 ( stable ABI BOOT ) + !
|
XCURRENT @ _xapply ORG @ 0x04 ( stable ABI BOOT ) + !
|
||||||
1 4 LOADR+
|
1 4 LOADR+
|
||||||
( ----- 391 )
|
( ----- 391 )
|
||||||
|
BIN
cvm/stage.bin
BIN
cvm/stage.bin
Binary file not shown.
@ -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-
|
pressed, f is true and c is the char. Other-
|
||||||
wise, f is false and c is *not* on the stack.
|
wise, f is false and c is *not* on the stack.
|
||||||
KEY -- c Get char c from direct input
|
KEY -- c Get char c from direct input
|
||||||
|
NL> -- Emit newline
|
||||||
PC! c a -- Spit c to port a
|
PC! c a -- Spit c to port a
|
||||||
PC@ a -- c Fetch c from 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
|
WORD -- a Read one word from buffered input and push its
|
||||||
addr. Always null terminated. If ASCII EOT is
|
addr. Always null terminated. If ASCII EOT is
|
||||||
encountered, a will point to it (it is cons-
|
encountered, a will point to it (it is cons-
|
||||||
idered a word).
|
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-
|
KEY? and EMIT are ialiases to (key?) and (emit) (see TTY proto-
|
||||||
col in protocol.txt). KEY is a loop over KEY?.
|
col in protocol.txt). KEY is a loop over KEY?.
|
||||||
|
|
||||||
NL is an ialias that points to CRLF by default and that should
|
NL> spits CRLF by default, but can be configured to spit an
|
||||||
generally be used when we want to emit a newline.
|
alternate newline char. See impl.txt.
|
||||||
|
|
||||||
# Disk
|
# Disk
|
||||||
|
|
||||||
|
@ -162,8 +162,8 @@ SYSVARS FUTURE USES +3c BLK(*
|
|||||||
+02 CURRENT +3e ~C!*
|
+02 CURRENT +3e ~C!*
|
||||||
+04 HERE +41 ~C!ERR
|
+04 HERE +41 ~C!ERR
|
||||||
+06 C<? +42 FUTURE USES
|
+06 C<? +42 FUTURE USES
|
||||||
+08 C<* override +43 FUTURE USES
|
+08 C<* override +50 NL> character
|
||||||
+0a NL ialias +51 CURRENTPTR
|
+0a FUTURE USES +51 CURRENTPTR
|
||||||
+0c C<* +53 EMIT ialias
|
+0c C<* +53 EMIT ialias
|
||||||
+0e WORDBUF +55 KEY? ialias
|
+0e WORDBUF +55 KEY? ialias
|
||||||
+2e BOOT C< PTR +57 FUTURE USES
|
+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
|
this byte to a nonzero value. Otherwise, stays at zero. Has to
|
||||||
be reset to zero manually after an error.
|
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.
|
DRIVERS section is reserved for recipe-specific drivers.
|
||||||
|
|
||||||
FUTURE USES section is unused for now.
|
FUTURE USES section is unused for now.
|
||||||
|
Loading…
Reference in New Issue
Block a user