What happens when the power fails?
Probably one of the most clever ideas in the Molecular. A feature that has been there since the Mk III at least. Possibly one that has never been equalled?
When power failed in the office, the Molecular 18 typically also lost its power. So, along with the terminals, printers and the lights, all was quiet!
When power was restored, all the terminals and printers and lights would come back on, of course. The Molecular would simply power up and resume exactly where it left off when the interruption occured. Those users that were part-way through a long cash-posting or those raising a sales order, would simply carry on as they were, with no data loss at all. Possibly a short delay while the disks came up to speed, but still no loss of data.
Imagine the effect of a power outage on a multi-user system based on Unix or VMS!
So, how did it work?
The big clue is that all the early Molecular computers used core memory and the later machines used static RAM chips with battery backup. Non-volatile memory is the secret. The clever part is having the hardware and software mutually supporting this feature.
Hardware Elements
The Molecular has additonal circuitry designed by Systemation to detect if the power supply rails are dropping. This cicuit monitors the supply rails and will generate an interrupt should they begin to fall.Although power is failing, the Molecular still has time to run several hundred more instructions.The processor also provides instructions to skip an instruction depending on the state of the power fail detection circuitry.When power is resumed, the Molecular will start running from a particular memory address, where the OS has placed a jump back to the OS interrupt handler.
Software Elements
The power fail circuitry generates an interrupt by jumping to location 2 in page zero where the OS has placed a jump immediately to the interrupt handler. There is only one interrupt for the Molecular, so the handler needs to test a variety of flags to determine what has happened. The first flag to check is always the power fail. If power has failed, registers A and B and the program counter are saved in core. The Molecular can then halt.When power returns, the Molecular jumps again to location 2 where there is a jump back to the operating system. All the OS needs to do is restore the registers, jump back to the saved program counter, and continue running.