\ 4tH library - cell SMOVE - Copyright 2011 J.L. Bezemer
\ You can redistribute this file and/or modify it under
\ the terms of the GNU General Public License

[UNDEFINED] smove [IF]
: smove                                ( src dst n --)
  >r over - tuck 0>                    ( moving down - src < dst)
  if r@ 1- cells + r> negate bounds ?do i @ over cells i + ! -1 +loop
  else over 0<                         ( moving up - src > dst)
  if r> bounds ?do i @ over cells i + ! loop
  else r> drop drop                    ( do nothing - src = dst)
  then then drop
;
[THEN]
