Applesoft: Using the monitor MOVE Routine

The MOVE subroutine in the monitor will not work directly from an Applesoft CALL because Applesoft doesn't assure the presence of a zero in the 6502's Y register and the MOVE subroutine must have the zero there to work. Here is a program that shows a way around this problem:

10 DEF FN M(X) = X - INT (X/256) * 256
20 POKE 768,160 (LDY #0 )
30 POKE 769,0
40 POKE 770,76 (JMP MOVE)
50 POKE 771,44
60 POKE 772,254
100 REM DO THE MOVE
110 START = 20000 Start of memory to be moved
120 QUIT = 21000 End of memory to be moved
130 DEST = 30000 Start of destination
140 POKE 60,FN M(START)
150 POKE 61,START / 256
160 POKE 62,FN M(QUIT)
170 POKE 63,END / 256
180 POKE 66,FN M(DEST)
190 POKE 67,DEST / 256
200 CALL 768
Published Date: Feb 18, 2012