Matthias Trute <mtr...@web.de> writes:

>> Also, it seems to me that your implementation may cause ram buffer
>> overflow.
>
> The code copies flash cells. That may overrun the
> RAM if an odd number of bytes is transferred. Thats
> bad indeed.

Hello Matthias, 

I had it fixed for my own use, so here sharing:

: 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
;

http://pastebin.com/ZqL4aWN7

Regards, Enoch.


------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter
_______________________________________________
Amforth-devel mailing list for http://amforth.sf.net/
Amforth-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amforth-devel

Reply via email to