83:ROMCalls:4062

From WikiTI
Revision as of 07:27, 26 April 2005 by Dan Englender (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Synopsis

Official Name: Initialize

Call Address: 4062

This routine resets all RAM and jumps to Mon.

Inputs

None

Outputs

This routine does not return.

Details

  • 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.