Difference between revisions of "83:ROMCalls:4062"
From WikiTI
m (Formatting) |
|||
(2 intermediate revisions by one other user not shown) | |||
Line 8: | Line 8: | ||
=== Inputs === | === Inputs === | ||
− | None | + | ''None'' |
=== Outputs === | === Outputs === | ||
Line 14: | Line 14: | ||
== Details == | == Details == | ||
− | * out (00),C0 | + | * out ([[83:Ports:00|00]]),C0 |
* ld sp,FFFF | * ld sp,FFFF | ||
* load zero into 8000-FFFF,0000 | * load zero into 8000-FFFF,0000 | ||
* initialize RAM with default values | * initialize RAM with default values | ||
* setup default error handler ([[83:ROMCalls:4056|MonErrHand]]) | * setup default error handler ([[83:ROMCalls:4056|MonErrHand]]) | ||
− | * save SP | + | * save SP at [[83:RAM:817D|onSP]] |
* display "Mem cleared" | * display "Mem cleared" | ||
* call [[83:ROMCalls:4775|HomeUp]] | * call [[83:ROMCalls:4775|HomeUp]] | ||
Line 25: | Line 25: | ||
* clear [[83:RAM:8000|kbdScanCode]] by calling [[83:ROMCalls:4014|GetCSC]] | * clear [[83:RAM:8000|kbdScanCode]] by calling [[83:ROMCalls:4014|GetCSC]] | ||
* call [[83:ROMCalls:4CFE|GetKey]] (read: wait for a key) | * call [[83:ROMCalls:4CFE|GetKey]] (read: wait for a key) | ||
+ | ** Before this call, bit onClrScrn,(iy+[[83:Flags:09|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 [[83:RAM:817D|onSP]] and jumps directly to [[83:ROMCalls:401B|Mon]]. | ||
* call [[83:ROMCalls:4761|ClrScrn]] to remove the "Mem cleared" message on the first keypress. | * call [[83:ROMCalls:4761|ClrScrn]] to remove the "Mem cleared" message on the first keypress. | ||
+ | * res onClrScrn,(iy+[[83:Flags:09|onFlags]]) | ||
* jump to [[83:ROMCalls:401E|MonForceKey]] to handle the keypress returned by the [[83:ROMCalls:4CFE|GetKey]] call and hand over control to [[83:ROMCalls:401B|Mon]]. | * jump to [[83:ROMCalls:401E|MonForceKey]] to handle the keypress returned by the [[83:ROMCalls:4CFE|GetKey]] call and hand over control to [[83:ROMCalls:401B|Mon]]. |
Latest revision as of 07:27, 26 April 2005
Contents
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.