CHAIN does an effective PR#0 and IN#0 when it is used, disabling an 80 column card or a High-Res character generator in the process. The first program can save four memory locations that, when the second program restores them, leave the input and output vectors unchanged.
63000 rem prepare to chain
63010 J = peek (999) + peek (1000) * 256 - 110
63020 for K = 0 TO 3
63030 A(K) = peek (J+K)
63040 next K
63050 rem chain now
10 rem Program 2 #2
20 for K = 0 TO 3
30 poke J+K,A(K)
40 next K
50 rem rest of the program
CHAIN overlays your existing Applesoft program with the new program. Watch out for your programs that use DEF FN and Onerr Goto statements. These statements must be re-executed in the new program if they are to work properly, because both statements contain pointers into the program text, which is different for each program.
EXTENDED TIL INFO - *The following information is for Apple Internal & Support Providers Only*