Tom F
05-24-2006, 11:10 PM
I'm surprised that the BS2 doesn't have a progammatic way to find how much EPROM is not being used by the program.
If I'm collecting data, I want to know how much space I've got!
It seems sort of risky to depend on me f to periodically check the memory map to see if my program has grown and then change my source code so that it doesn't acccidentally overwrite my program space.
I was thinking that there must be a programmatic way to do this. Can I assume that EPROM is zeroed when a program is downloaded to it? If so, then when a program starts, it could start at the top of the EPROM memory and search until it finds EPROM that has non-zero contents. Wouldn't that be the end of the memory the program uses? And, having done so, it could put the result at the top memory location of the EPROM so it didn't search during subsequent runs.
(Depending on where DATA statements are stored, perhaps I could even put a "unique" bit pattern at the end of the last Data statement in the program and search for that. Might make the code more robust.)
Or is there a better way?!
If I'm collecting data, I want to know how much space I've got!
It seems sort of risky to depend on me f to periodically check the memory map to see if my program has grown and then change my source code so that it doesn't acccidentally overwrite my program space.
I was thinking that there must be a programmatic way to do this. Can I assume that EPROM is zeroed when a program is downloaded to it? If so, then when a program starts, it could start at the top of the EPROM memory and search until it finds EPROM that has non-zero contents. Wouldn't that be the end of the memory the program uses? And, having done so, it could put the result at the top memory location of the EPROM so it didn't search during subsequent runs.
(Depending on where DATA statements are stored, perhaps I could even put a "unique" bit pattern at the end of the last Data statement in the program and search for that. Might make the code more robust.)
Or is there a better way?!