mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-17 08:58:06 +11:00
bd38d80f9c
and renamed it "Core words". Also, reworded the presentation.
14 lines
361 B
Plaintext
14 lines
361 B
Plaintext
: MOVE ( a1 a2 u -- )
|
|
( 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 @ - ;
|