aboutsummaryrefslogtreecommitdiff
path: root/amforth-6.5/avr8/lib/imove.frt
diff options
context:
space:
mode:
Diffstat (limited to 'amforth-6.5/avr8/lib/imove.frt')
-rw-r--r--amforth-6.5/avr8/lib/imove.frt12
1 files changed, 12 insertions, 0 deletions
diff --git a/amforth-6.5/avr8/lib/imove.frt b/amforth-6.5/avr8/lib/imove.frt
new file mode 100644
index 0000000..bf33697
--- /dev/null
+++ b/amforth-6.5/avr8/lib/imove.frt
@@ -0,0 +1,12 @@
+\ copy a string from flash to RAM
+\
+\ i->d on the msp430, and the same stack as cmove
+\
+: imove ( i-addr len ram -- )
+ rot rot dup 1 and >r \ ( ram i-addr len ) ( r: odd )
+ 2/ over + dup >r \ ( ram i-addr i-addr' ) ( r: odd i-addr' )
+ swap \ ( ram i-addr' i-addr )
+ ?do i @i over ! cell+ loop \ ( ram' )
+ r> r> \ ( ram' i-addr' odd )
+ if @i swap c! else 2drop then
+;