From 058b85686f5452841ec444ca134681367cc703e5 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Sun, 5 Apr 2020 21:01:19 -0400 Subject: [PATCH] core: add word "MOVE" --- dictionary.txt | 2 ++ forth/core.fs | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/dictionary.txt b/dictionary.txt index a282957..dcd91db 100644 --- a/dictionary.txt +++ b/dictionary.txt @@ -98,6 +98,8 @@ C! c a -- Store byte c in address a CURRENT -- a Set a to wordref of last added entry. 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. *** Arithmetic / Bits *** diff --git a/forth/core.fs b/forth/core.fs index ba726e6..5896d24 100644 --- a/forth/core.fs +++ b/forth/core.fs @@ -118,3 +118,12 @@ ( Set up initial SYSVNXT value, which is 2 bytes after its own address ) 46 RAM+ DUP 2 + SWAP ! + +( a1 a2 u -- ) +: MOVE + ( u ) 0 DO + SWAP DUP I + @ ( a2 a1 x ) + ROT SWAP OVER I + ( a1 a2 x a2 ) + ! ( a1 a2 ) + LOOP +;