diff --git a/blk/050 b/blk/050 index 1c3616a..e0be481 100644 --- a/blk/050 +++ b/blk/050 @@ -6,12 +6,11 @@ Memory +! 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@- a -- a-1 c Fetch c from a and dec a. 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. -FILL a n b -- Fill n bytes at addr a with val b. -HERE -- a Push HERE's address -H@ -- a HERE @ (cont.) diff --git a/blk/051 b/blk/051 index 8c93cad..54e8d4d 100644 --- a/blk/051 +++ b/blk/051 @@ -1,2 +1,7 @@ +FILL a n b -- Fill n bytes at addr a with val b. +HERE -- a Push HERE's address +H@ -- a HERE @ MOVE a1 a2 u -- Copy u bytes from a1 to a2, starting with a1, going up. +MOVE- a1 a2 u -- Copy u bytes from a1 to a2, starting + with a1+u, going down. diff --git a/blk/394 b/blk/394 index 27f9726..6fb571f 100644 --- a/blk/394 +++ b/blk/394 @@ -1,12 +1,6 @@ : ABORT (resSP) QUIT ; - -: = CMP NOT ; -: < CMP -1 = ; -: > CMP 1 = ; -: 0< 32767 > ; -: >= < NOT ; -: <= > NOT ; -: 0>= 0< NOT ; +: = CMP NOT ; : < CMP -1 = ; : > CMP 1 = ; +: 0< 32767 > ; : >= < NOT ; : <= > NOT ; : 0>= 0< NOT ; ( n l h -- f ) : >< 2 PICK > ( n l f ) ROT ROT > AND ; : =><= 2 PICK >= ( n l f ) ROT ROT >= AND ; @@ -14,3 +8,7 @@ : C@+ DUP C@ SWAP 1+ SWAP ; ( c a -- a+1 ) : C!+ SWAP OVER C! 1+ ; +( a -- a-1 c ) +: C@- DUP C@ SWAP 1- SWAP ; +( c a -- a-1 ) +: C!- SWAP OVER C! 1- ; diff --git a/blk/434 b/blk/434 index 83393ec..0523223 100644 --- a/blk/434 +++ b/blk/434 @@ -1,9 +1,13 @@ : MOVE ( a1 a2 u -- ) - ( u ) 0 DO - SWAP DUP I + C@ ( a2 a1 x ) - ROT SWAP OVER I + ( a1 a2 x a2 ) - C! ( a1 a2 ) - LOOP - 2DROP -; + ( u ) 0 DO ( a1 a2 ) + SWAP C@+ ( a2 a1+1 x ) + ROT C!+ ( a1+1 a2+1 ) + LOOP 2DROP ; +: MOVE- ( a1 a2 u -- ) + SWAP OVER + 1- ( a1 u a2+u-1 ) + ROT 2 PICK + 1- ( u a2+u-1 a1+u-1 ) + ROT ( u ) 0 DO ( a2 a1 ) + C@- ( a2 a1-1 x ) + ROT C!- ( a1-1 a2-1 ) SWAP ( a2 a1 ) + LOOP 2DROP ; : PREV 3 - DUP @ - ; diff --git a/emul/forth.bin b/emul/forth.bin index 61a7629..781c5a6 100644 Binary files a/emul/forth.bin and b/emul/forth.bin differ