Hi Mac,
You're absolutely right, I quoted the wrong device number. Thank you for spotting my error. It turns out that the PCB schematic had the wrong label on it, and that's what I referred to when I was posting above. Sorry if this caused confusion for people (it certainly did for me!)
As for the memory problem, I got a <i>flash</i> of inspiration (cough cough) from another post here by Kopone. ("Tell debugger to mass erase only 1/2 flash...") In the debugger, I went to
MultiCyclonePro -> Advanced Programming/Debug Options
...and saw that the range of memory from 0xC000 to 0xF9FF was "protected". I'm not sure why. Is this a default setting? Otherwise it must have been selected by the guys who developed the original version of the project I'm working on, and they forgot to write it down.
Anyway that explains the problem. This address range was not getting erased before the new data was written to it, so the data got corrupted. My code starts up OK now! :-)
Thanks for the help guys.
Brian