BigEd wrote:
For a truly cold start, the risk is indeed negligible. But I'll say it again: if you've just suffered a momentary lapse of power, some of your RAM state may survive while some of it has decayed. Unless you're in a situation (like a planned sleep) where you were able to checksum all valid memory, you could falsely detect a warm start.
It sounds to me like this possibility is considered by the author to neither be a cold- nor warm-boot condition. A momentary lapse in power indicates bigger problems, and in fact, this can
never be totally designed for.
In scenario 1, you lose power just long enough to trip the warm/cold discriminator bit in your hardware. However, the RAM and CPU state are unhindered. This, when you think about it, is the same problem as debouncing a switch. So, you need to implement debounce logic in your discriminator.
In scenario 2, you lose power long enough to blow a few bits of RAM. I've never seen a condition where this didn't also blow the state of the CPU as well (particularly true on a 65816!!). But, suppose the CPU state remains intact enough to continue running. The CPU never sees a need to reset.
In scenario 3, you lose power long enough to guarantee a CPU reset. However, RAM may not have lost all its contents, particularly the warm/cold-boot data.
As you can see, no matter what you do, you're probabilistically screwed.
The only reliable solution to dealing with all three of these scenarios is to guarantee a reset sequence sufficiently long enough to allow a DMA operation to hard-write a value to someplace in RAM. E.g., while _RES is asserted and PHI2 is high, force the RAM address bus to $000000, the RAM data bus to $00 (it's convenient), and _WE asserted. Then, and only then, will you undeniably be able to detect a hardware reset-induced bootup.
However, I really cannot think of many situations where you'd need to go through these kinds of gyrations. You need to have some mighty specialized requirements to justify the expense of adding such equipment, however, simple it may be.