Reading/Writing to ROM?
firestorm.v1
Posts: 94
If I have never written to a ROM location (say Location 0 for example) what will its value be if I try to read it?
Reason for this is I'm going to write a program that needs to read several locations that I have never written to in the life of my BS2. Rather than read in trash values I want to be able to go in and zero out those variables so that when the main part of the program reads the values and adjusts itself accordingly. I know that this code will only get executed once, but it is an important piece of code that will result in a reliable program/device.
I had thought of doing a start-up check of an I/O pin to see if it's high to initialize those ROM areas, otherwise do normal operation.
What do you all suggest?
Reason for this is I'm going to write a program that needs to read several locations that I have never written to in the life of my BS2. Rather than read in trash values I want to be able to go in and zero out those variables so that when the main part of the program reads the values and adjusts itself accordingly. I know that this code will only get executed once, but it is an important piece of code that will result in a reliable program/device.
I had thought of doing a start-up check of an I/O pin to see if it's high to initialize those ROM areas, otherwise do normal operation.
What do you all suggest?
Comments
1) Write a short program that just initializes the locations you want to some useful value.· You'll download and execute this once, then download your "real" program on top of it.
2) Include a DATA statement in your program (look in the PBasic manual) that initializes the locations with some constant whenever your program is downloaded.