Official Name: Initialize
Call Address: 4062
This routine resets all RAM and jumps to Mon.
This routine does not return.
- out (00),C0
- ld sp,FFFF
- load zero into 8000-FFFF,0000
- initialize RAM with default values
- setup default error handler (MonErrHand)
- save SP at onSP
- display "Mem cleared"
- call HomeUp
- call CursorOn
- clear kbdScanCode by calling GetCSC
- call GetKey (read: wait for a key)
- Before this call, bit onClrScrn,(iy+onFlags) has been set so when the user turns off the calculator, the on-key interrupt handler will clear the screen when the calculator is turned on again. This is necessary because when you press the on-key to turn the calculator on, the on-key interrupt handler does not return, but resets SP using onSP and jumps directly to Mon.
- call ClrScrn to remove the "Mem cleared" message on the first keypress.
- res onClrScrn,(iy+onFlags)
- jump to MonForceKey to handle the keypress returned by the GetKey call and hand over control to Mon.