!pr2
More Puzzle Solutions...............Bruce Love & Charles Putney

It takes a little longer for the mail to carry our messages overseas, so these solutions missed the November issue.

Bruce Love (from Hamilton, New Zealand) uses the power of the 65802 in a different manner than David Johnson did last month.  Remember that David used the MVP instruction to fill all RAM with the STP opcode.  Bruce uses a combination of a loop and the PHA instruction to fill all of RAM with $4C, which is a JMP opcode.

If you disassemble a series of $4C's, you will see JMP $4C4C.  Therefore Bruce positioned his code so that the last byte to be filled is at $4C4C.

The loop in lines 1160-1200 fills all RAM below $4C4C with the $4C value.  After finishing, it jumps back to $4C4C where a two-line loop pushes the A-register on the stack.  The trick here is that the stack pointer in the 65802 is 16-bits long.  Bruce starts it at $BFFF, and each PHA lowers it by one location.  The last location to be changed is $4C4C itself, and after that it loops endlessly executing JMP $4C4C at $4C4C.

Bruce points out that you can test the effectiveness of his program (if you have a 65802 in your Apple) by changing lines 1130 and 1160 to LDX ##$4FFF and LDX ##$4000 respectively.  Then it will fill the range from $4000 through $4FFF with $4C, and you can examine it to be sure it did.

Charles Putney (from Shankill, Dublin, Ireland) fills RAM with $48, using the normal 6502 instruction set.  Charlie used a combination similar to Bob S-C's solution last month.  The final loop resides inside the stack page, and the infinite series of PHA's fills the stack.  The difference is that Charlie has the user type an "L" key, which loads the keyboard register with $CC.  Then he clears the strobe, which changes it to $4C.  Since the locations $C000 through $C002 will all read back as $4C, the cpu will execute JMP $4C4C.
