I had a dangerous bug yesterday while coding my music synth. I would like to know what is a safe way to load a program without risking this:
I have set my code and data to start at org $4000, and reaching up to address $8000.
The problem I encountered seems to be related to the fact that the CoCo BASIC stack pointer starts at $8000 so it hangs in the range of $7FD0 or something like that when a program is loaded from LOADM”HELLO. What happens is that before your program can even start (and thus set the stack to somewhere safe like $F000 and put to Coco in all-RAM mode), a little bit of data will get corrupted near the initial stack pointer. Maybe its the disk loading routine itself? I don’t know.
But what happened to me was having corrupted data which in turned led to a complete crash with an invalid opcode. Even worse the bug is somewhat random since the stack or corruption is not exactly the same each time I booted it up. Very annoying bug, since even MESS Debugger can’t help because when it ‘crashes’ on an illegal opcode, it simply stops working and doesn’t tell you anything about it. Arggh.
This post was submitted by remz.