mirror of
https://github.com/open-simh/simh.git
synced 2026-01-14 15:46:31 +00:00
PROBLEM: Attempting to LOAD after a RESTORE of an MPE session aborts the simulator with an "integer division by zero" exception. OBSERVATION: Stopping the simulator during an idle MPE session, saving the state to a file, exiting, restarting, restoring, and attempting to perform a cold load aborts with a "divide by 0" error. CAUSE: The "clk_update_counter" routine in hp3000_clk.c is called as part of the instruction postlude to update the clock's counter register. A calculation divides the elapsed time since the last tick by the clock unit's "wait" value. The developer's manual stated that this field is saved and restored automatically, but this is not true. When the simulator is restarted, the "wait" field is initially zero. If "clk_update_counter" is called before the clock's event service routine resets the value, the calculation will divide by zero, which causes the abort. RESOLUTION: Modify "clk_reg" (hp3000_clk.c) to preset the unit wait field with the MPE clock resolution value.