From 5e13dcedf33a466bc90f100d87da43f9e5d93154 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Wed, 28 Oct 2020 16:00:58 -0400 Subject: [PATCH] Make KEY and EMIT into switch words --- blk/381 | 4 +--- blk/387 | 5 +---- blk/396 | 4 ++-- cvm/forth.bin | Bin 5289 -> 5249 bytes recipes/trs80/README.md | 12 ++++++------ recipes/trs80/xcomp.fs | 4 ++-- 6 files changed, 12 insertions(+), 17 deletions(-) diff --git a/blk/381 b/blk/381 index 12767c1..12b65f1 100644 --- a/blk/381 +++ b/blk/381 @@ -1,6 +1,4 @@ -: EMIT - ( 0x53==(emit) override ) - 0x53 RAM+ @ ?DUP IF EXECUTE ELSE (emit) THEN ; +SYSVARS 0x53 + :** EMIT : (print) C@+ ( a len ) 0 DO C@+ EMIT LOOP DROP ; : BS 8 EMIT ; : LF 10 EMIT ; : CR 13 EMIT ; : CRLF CR LF ; : SPC 32 EMIT ; diff --git a/blk/387 b/blk/387 index d44789d..e88f70c 100644 --- a/blk/387 +++ b/blk/387 @@ -8,9 +8,6 @@ ; ( del is same as backspace ) : BS? DUP 0x7f = SWAP 0x8 = OR ; - -: KEY - 0x55 RAM+ @ ( (key) override ) - ?DUP IF EXECUTE ELSE (key) THEN ; +SYSVARS 0x55 + :** KEY ( cont.: read one char into input buffer and returns whether we should continue, that is, whether CR was not met. ) diff --git a/blk/396 b/blk/396 index aefaaa5..95d534f 100644 --- a/blk/396 +++ b/blk/396 @@ -3,8 +3,8 @@ 0x02 RAM+ CURRENT* ! CURRENT @ 0x2e RAM+ ! ( 2e == BOOT C< PTR ) 0 0x08 RAM+ ! ( 08 == C<* override ) - 0 0x53 RAM+ ! ( 53 == (emit) override ) - 0 0x55 RAM+ ! ( 55 == (key) override ) + ['] (emit) ['] EMIT **! + ['] (key) ['] KEY **! ['] CRLF ['] NL **! ( 0c == C<* ) ['] (boot<) 0x0c RAM+ ! diff --git a/cvm/forth.bin b/cvm/forth.bin index c8e06f861e33392b519d9501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zwT!pybNq&pf1pN=!!hZlZI${V)&>1Va1);!gvEq%y%p~4@@p`MANZDGlK8HXXKv_q qRO{Da7DLq4b544Hy|6@WX$ZG>w6rxTa0kz35ks}NRG{>DD}Mp6TDTPe diff --git a/recipes/trs80/README.md b/recipes/trs80/README.md index fbc9a30..c8e049c 100644 --- a/recipes/trs80/README.md +++ b/recipes/trs80/README.md @@ -233,14 +233,14 @@ blocks per disk. You'll need to send those blocks through RS-232. Begin by taking over the prompt: - ' *CL> 0x53 RAM+ ! - ' *CL< 0x55 RAM+ ! + ' *CL> ' EMIT **! + ' *CL< ' KEY **! See B80 for details about those RAM offsets. Your serial link now has the prompt. You will also have to make your newlines CRLF. The TRS-80 wants CR only, but serial communications (and `blkup`) expect CRLF: - ' CRLF 0x0a RAM+ ! + ' CRLF ' NL **! Now, you can use `/tools/blkup` to send a disk's contents. First, extract the first 100 blocks from blkfs: @@ -264,9 +264,9 @@ own Collapse OS floppy set. See Usage guide (B3) for details. Once you're done, you will want to go back to local control: - ' CR 0x0a RAM+ ! - 0 0x55 RAM+ ! - 0 0x53 RAM+ ! + ' CR ' NL **! + ' (emit) ' EMIT **! + ' (key) ' KEY **! ## Self-hosting diff --git a/recipes/trs80/xcomp.fs b/recipes/trs80/xcomp.fs index 40943f7..8a8c6cb 100644 --- a/recipes/trs80/xcomp.fs +++ b/recipes/trs80/xcomp.fs @@ -14,7 +14,7 @@ RS_ADDR 0x80 - CONSTANT SYSVARS (entry) _ ( Update LATEST ) PC ORG @ 8 + ! -( 0x0a == NLPTR. TRS-80 wants CR-only newlines ) -," ' CR 0x0a RAM+ ! BLK$ FD$ " EOT, +( TRS-80 wants CR-only newlines ) +," ' CR ' NL **! BLK$ FD$ " EOT, ORG @ 256 /MOD 2 PC! 2 PC! H@ 256 /MOD 2 PC! 2 PC!