From 0e3cf7fa025ad00fd46b8e1746b1a261503fd231 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Sun, 26 Apr 2020 08:47:29 -0400 Subject: [PATCH] Add word ," --- blk/061 | 4 ++-- blk/062 | 4 ++-- blk/443 | 11 ++++++----- forth/print.fs | 11 ++++++----- 4 files changed, 16 insertions(+), 14 deletions(-) diff --git a/blk/061 b/blk/061 index 01b0c4e..3ef2a5e 100644 --- a/blk/061 +++ b/blk/061 @@ -1,3 +1,4 @@ +," xxx" -- Write xxx to HERE ." xxx" -- *I* Compiles string literal xxx followed by a call to (print). C -- a Address of variable containing current pos in KEY -- c Get char c from direct input PC! c a -- Spit c to port a PC@ a -- c Fetch c from port a -WORD -- a Read one word from buffered input and push its - addr. + (cont.) diff --git a/blk/062 b/blk/062 index 8a6d5cc..9a210da 100644 --- a/blk/062 +++ b/blk/062 @@ -1,4 +1,5 @@ -(cont.) +WORD -- a Read one word from buffered input and push its + addr. There are also ascii const emitters: BS CR @@ -13,4 +14,3 @@ SPC - diff --git a/blk/443 b/blk/443 index 072164c..6abc49d 100644 --- a/blk/443 +++ b/blk/443 @@ -1,11 +1,12 @@ -: ." - 34 , ( 34 == litWord ) +: ," BEGIN C< ( 34 is ASCII for " ) - DUP 34 = IF DROP 0 THEN - DUP C, - NOT UNTIL + DUP 34 = IF DROP EXIT THEN C, + AGAIN ; + +: ." + 34 , ( 34 == litWord ) ," 0 C, COMPILE (print) ; IMMEDIATE diff --git a/forth/print.fs b/forth/print.fs index c6f74a0..0989625 100644 --- a/forth/print.fs +++ b/forth/print.fs @@ -12,14 +12,15 @@ AGAIN ; -: ." - 34 , ( 34 == litWord ) +: ," BEGIN C< ( 34 is ASCII for " ) - DUP 34 = IF DROP 0 THEN - DUP C, - NOT UNTIL + DUP 34 = IF DROP EXIT THEN C, + AGAIN ; + +: ." + 34 , ( 34 == litWord ) ," 0 C, COMPILE (print) ; IMMEDIATE