mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-17 06:58:05 +11:00
Add word "C@+"
This commit is contained in:
parent
eefa8e6de5
commit
5cb4a7de9a
1
blk/050
1
blk/050
@ -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
|
||||
|
@ -179,3 +179,6 @@
|
||||
R> DROP I 2- @ ( I I a )
|
||||
= UNTIL
|
||||
;
|
||||
|
||||
( a -- a+1 c )
|
||||
: C@+ DUP C@ SWAP 1+ SWAP ;
|
||||
|
@ -54,11 +54,10 @@
|
||||
LOOP
|
||||
DROP
|
||||
8 0 DO
|
||||
DUP C@
|
||||
C@+
|
||||
DUP <>{ 0x20 &< 0x7e |> <>}
|
||||
IF DROP '.' THEN
|
||||
EMIT
|
||||
1+
|
||||
LOOP
|
||||
CRLF
|
||||
;
|
||||
|
@ -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
|
||||
|
||||
|
@ -1,7 +1,5 @@
|
||||
: SLEN ( a -- n )
|
||||
DUP ( astart aend )
|
||||
BEGIN
|
||||
DUP C@ 0 = IF -^ EXIT THEN
|
||||
1+
|
||||
AGAIN
|
||||
BEGIN C@+ NOT UNTIL
|
||||
1- -^
|
||||
;
|
||||
|
Loading…
Reference in New Issue
Block a user