diff --git a/blk/050 b/blk/050 index e0be481..9845275 100644 --- a/blk/050 +++ b/blk/050 @@ -4,6 +4,8 @@ Memory ! n a -- Store n in address a ? a -- Print value of addr a +! n a -- Increase value of addr a by n +BIT@ b a -- f Get bit b from addr a. +BIT! f b a -- Set bit b to f in addr a. C@ a -- c Set c to byte at address a C@+ a -- a+1 c Fetch c from a and inc a. C@- a -- a-1 c Fetch c from a and dec a. @@ -11,6 +13,4 @@ C! c a -- Store byte c in address a C!+ c a -- a+1 Store byte c in a and inc a. C!- c a -- a-1 Store byte c in a and dec a. CURRENT -- a Set a to wordref of last added entry. -CURRENT* -- a A pointer to active CURRENT*. Useful - when we have multiple active dicts. (cont.) diff --git a/blk/051 b/blk/051 index 54e8d4d..dea8c4e 100644 --- a/blk/051 +++ b/blk/051 @@ -1,3 +1,5 @@ +CURRENT* -- a A pointer to active CURRENT*. Useful + when we have multiple active dicts. FILL a n b -- Fill n bytes at addr a with val b. HERE -- a Push HERE's address H@ -- a HERE @ diff --git a/blk/404 b/blk/404 index de0f8e1..dbb9719 100644 --- a/blk/404 +++ b/blk/404 @@ -4,9 +4,11 @@ DUP NOT IF DROP 0x0c RAM+ @ THEN ( 0c == C<* ) EXECUTE ; - : , HERE @ ! HERE @ 2+ HERE ! ; - : C, HERE @ C! HERE @ 1+ HERE ! ; - - +: BIT@ ( bit addr -- f ) C@ SWAP RSHIFT 0x01 AND ; +: BIT! ( f bit addr -- ) + SWAP 0x01 SWAP LSHIFT ROT ( addr mask f ) + IF OVER C@ OR + ELSE 0xff XOR OVER C@ AND THEN ( addr flg ) + SWAP C! ; diff --git a/emul/forth.bin b/emul/forth.bin index ec04e62..f9614a4 100644 Binary files a/emul/forth.bin and b/emul/forth.bin differ