1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-23 19:28:06 +11:00

Add word "C@+"

This commit is contained in:
Virgil Dupras 2020-04-16 18:58:11 -04:00
parent eefa8e6de5
commit 5cb4a7de9a
5 changed files with 12 additions and 12 deletions

View File

@ -5,6 +5,7 @@ Memory
? a -- Print value of addr a
+! n a -- Increase value of addr a by n
C@ a -- c Set c to byte at address a
C@+ a -- a+1 c Fetch c from a and inc a.
C! c a -- Store byte c in address a
CURRENT -- a Set a to wordref of last added entry.
CURRENT* -- a A pointer to active CURRENT*. Useful

View File

@ -179,3 +179,6 @@
R> DROP I 2- @ ( I I a )
= UNTIL
;
( a -- a+1 c )
: C@+ DUP C@ SWAP 1+ SWAP ;

View File

@ -54,11 +54,10 @@
LOOP
DROP
8 0 DO
DUP C@
C@+
DUP <>{ 0x20 &< 0x7e |> <>}
IF DROP '.' THEN
EMIT
1+
LOOP
CRLF
;

View File

@ -5,22 +5,21 @@
: (print)
BEGIN
DUP C@ ( a c )
C@+ ( a+1 c )
( exit if null )
DUP NOT IF 2DROP EXIT THEN
EMIT ( a )
1 + ( a+1 )
AGAIN
;
: ."
34 , ( 34 == litWord )
BEGIN
C< DUP ( c c )
C<
( 34 is ASCII for " )
DUP 34 = IF DROP DROP 0 0 THEN
C,
0 = UNTIL
DUP 34 = IF DROP 0 THEN
DUP C,
NOT UNTIL
COMPILE (print)
; IMMEDIATE

View File

@ -1,7 +1,5 @@
: SLEN ( a -- n )
DUP ( astart aend )
BEGIN
DUP C@ 0 = IF -^ EXIT THEN
1+
AGAIN
BEGIN C@+ NOT UNTIL
1- -^
;