!!! RAM Move Routine

{{{
01 ; MOVE$ RAM MOVER SUBROUTINE
02 ; BY D.W. HOWERTON
03 ; CALL FROM BASIC WITH THE FORM:
04 ; X=USR(ADR(MOVE$),FROM,TO,#BYTES)
05 ; WHERE: FROM=MEM. LOCATION TO MOVE
06 ;          TO=TARGET LOCATION
07 ;      #BYTES=NO. OF BYTES TO MOVE
08 ;
10       *=  $0600   ;RELOCATABLE
20 FROM  =   $D2     ;ZERO PGE STORAGE
30 TO    =   $D4     ;FOR LOC USED IN
40 NUM   =   $D6     ;SUBROUTINE
50       PLA         ;UNUSED-DISCARD
60       PLA         ;HI BYTE OF FROM
70       STA FROM+1  ;STORE IT
80       PLA         ;LOW BYTE OF FROM
90       STA FROM    ;STORE IT
0100     PLA         ;HIGH BYTE OF TO
0110     STA TO+1    ;STORE IT
0120     PLA         ;LOW BYTE OF TO
0130     STA TO      ;STORE IT
0140     PLA         ;HI BYTE #BYTES
0150     STA NUM     ;STORE IT
0160     PLA         ;LO BYTE #BYTES
0170     TAX         ;X IS COUNTER
0190     BNE START   ;GO AHEAD
0200     DEC NUM     ;PREVENT MOVING
0205     ;           EXTRA PAGE OF MEM
0210 START LDY #0    ;USE FOR INDEXING
0220 MOVE LDA (FROM),Y ;BYTE TO MOVE
0230     STA (TO),Y  ;MOVE IT
0240     INY         ;INCREMENT INDEX
0250     BNE NEXT    ;IF<>0 A PAGE
0255     ;           HASN'T BEEN MOVED
0260     INC FROM+1  ;INCREMENT THE
0270     INC TO+1    ;HIGH BYTES
0280 NEXT DEX        ;-LO BYTE COUNTER
0290     BNE MOVE    ;MOVE ANOTHR BYTE
0300     DEC NUM     ;-HI BYTE COUNTER
0310     BPL MOVE    ;IF POS DO MORE
0320     RTS         ;RETURN TO BASIC
}}}