Add word ,"

This commit is contained in:
Virgil Dupras 2020-04-26 08:47:29 -04:00
parent 4b7247a971
commit 0e3cf7fa02
4 changed files with 16 additions and 14 deletions

View File

@ -1,3 +1,4 @@
," xxx" -- Write xxx to HERE
." xxx" -- *I* Compiles string literal xxx followed by a ." xxx" -- *I* Compiles string literal xxx followed by a
call to (print). call to (print).
C<? -- f Returns whether there's a char waiting in buf. C<? -- f Returns whether there's a char waiting in buf.
@ -11,6 +12,5 @@ IN> -- a Address of variable containing current pos in
KEY -- c Get char c from direct input KEY -- c Get char c from direct input
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
WORD -- a Read one word from buffered input and push its
addr.
(cont.) (cont.)

View File

@ -1,4 +1,5 @@
(cont.) WORD -- a Read one word from buffered input and push its
addr.
There are also ascii const emitters: There are also ascii const emitters:
BS BS
CR CR
@ -13,4 +14,3 @@ SPC

11
blk/443
View File

@ -1,11 +1,12 @@
: ." : ,"
34 , ( 34 == litWord )
BEGIN BEGIN
C< C<
( 34 is ASCII for " ) ( 34 is ASCII for " )
DUP 34 = IF DROP 0 THEN DUP 34 = IF DROP EXIT THEN C,
DUP C, AGAIN ;
NOT UNTIL
: ."
34 , ( 34 == litWord ) ," 0 C,
COMPILE (print) COMPILE (print)
; IMMEDIATE ; IMMEDIATE

View File

@ -12,14 +12,15 @@
AGAIN AGAIN
; ;
: ." : ,"
34 , ( 34 == litWord )
BEGIN BEGIN
C< C<
( 34 is ASCII for " ) ( 34 is ASCII for " )
DUP 34 = IF DROP 0 THEN DUP 34 = IF DROP EXIT THEN C,
DUP C, AGAIN ;
NOT UNTIL
: ."
34 , ( 34 == litWord ) ," 0 C,
COMPILE (print) COMPILE (print)
; IMMEDIATE ; IMMEDIATE