2020-05-26 10:34:52 +10:00
|
|
|
: MOVE ( a1 a2 u -- )
|
2020-06-21 20:49:45 +10:00
|
|
|
?DUP IF ( u ) 0 DO ( a1 a2 )
|
2020-05-26 10:34:52 +10:00
|
|
|
SWAP C@+ ( a2 a1+1 x )
|
|
|
|
ROT C!+ ( a1+1 a2+1 )
|
2020-06-21 20:49:45 +10:00
|
|
|
LOOP THEN 2DROP ;
|
2020-05-26 10:34:52 +10:00
|
|
|
: MOVE- ( a1 a2 u -- )
|
2020-06-21 20:49:45 +10:00
|
|
|
?DUP IF TUCK + 1- ( a1 u a2+u-1 )
|
2020-05-26 10:34:52 +10:00
|
|
|
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 )
|
2020-06-21 20:49:45 +10:00
|
|
|
LOOP THEN 2DROP ;
|
2020-05-26 10:34:52 +10:00
|
|
|
: MOVE, ( a u -- ) H@ OVER ALLOT SWAP MOVE ;
|
|
|
|
: PREV 3 - DUP @ - ;
|