Thread View: net.lang.forth
1 messages
1 total messages
Started by utzoodecvaxucbvaxucbcadtektronix...
Thu, 31 Mar 1983 09:36
<CMOVE
Author: utzoodecvaxucbvaxucbcadtektronix...
Date: Thu, 31 Mar 1983 09:36
Date: Thu, 31 Mar 1983 09:36
33 lines
1515 bytes
1515 bytes
: <CMOVE ( Copy n bytes starting at addr1 to addr2. The move ) ( proceeds from high memory to low memory. ) ( addr1 addr1 n --- ) DUP ROT + ( Calculate addr2 + n ) SWAP ROT ( and put it on bottom of stack ) 1 - ( DO-LOOP end = addr1 - 1 ) DUP ROT + ( DO-LOOP start = addr1 + N - 1 ) DO 1 - ( Decrement last string 2 address ) I C@ ( Fetch next byte from string 1 ) OVER C! ( and copy it to string 2 ) -1 ( Decrement index ) +LOOP DROP ; ( Discard the string 2 address ) : CMOVE$ ( Copy n bytes starting at addr1 to addr2. If addr2 ) ( is forward of addr1, the move proceeds from high ) ( memory to low memory; otherwise the move proceeds ) ( from low memory to high memory. ) OVER 4 PICK ( Copy addr2 addr1 on top of stack ) > ( Copying to a higher address? ) IF <CMOVE ( if so, use <CMOVE ) ELSE CMOVE ( if not, use CMOVE ) THEN ; ( if you don't have PICK ... ) : PICK 2 * SP@ + @ ; ( without comments ) ( these were taken ( except PICK ) from a book by LEO J. SCANLON ) ( a HOWARD SAMS book ISBN 0-672-22007-5 $16.95 suggested price.)
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads