--- a/source/page00/interrupt.asm Thu May 08 04:00:18 2014 -0400
+++ b/source/page00/interrupt.asm Thu May 08 16:43:29 2014 -0400
@@ -7,7 +7,7 @@
out (3), a
pop af
out (3), a
- jp page0_83D
+ jp HandlePowerOnRequest
.module InterruptFromSecondHardwareTimer
interruptFromSecondHardwareTimer:
@@ -798,7 +798,7 @@
ld b, a
ld sp, (onSP)
res 6, (iy+0Ch)
- call page0_BB1
+ call SetFastSpeed
ld a, 40h ; '@'
call newContext0
ld a, b
@@ -901,7 +901,7 @@
jr z, page0_69E
call cxPPutAway
call page0_7DE
- call z, page0_BB1
+ call z, SetFastSpeed
page0_69E:
ld a, (mcxCurApp)
pop bc
@@ -912,7 +912,7 @@
call j_POPCX
call sub_73D
call page0_7DE
- call z, page0_BB1
+ call z, SetFastSpeed
page0_6B4:
ld hl, 858Dh
ld de, 859Bh
@@ -1097,47 +1097,49 @@
ret
handleONKeyPress:
+ ;Switch to slow speed
in a, (2)
- and 80h ; ''
- jr z, page0_7F2
+ and 80h
+ jr z, {+}
in a, (20h)
ld e, a
xor a
out (20h), a
-page0_7F2:
- ld b, 0
-page0_7F4:
++: ld b, 0
+debounceRestart:
ld hl, 1016h
-page0_7F7:
+debounceLoop:
in a, (4)
and 8
cp b
ld b, a
- jr nz, page0_7F4
+ jr nz, debounceRestart
dec hl
ld a, l
or h
- jr nz, page0_7F7
+ jr nz, debounceLoop
cp b
- jr z, page0_834
+ jr z, ONKeyBeingPressed
+ ;ON key is being released
in a, (7)
ld b, a
in a, (2)
- and 80h ; ''
- jr z, page0_818
+ and 80h
+ jr z, {+}
+ ;Restore previous speed
ld a, e
out (20h), a
ld a, b
- cp 81h ; 'g
- jr page0_81D
-page0_818:
- ld a, b
- and 4Fh ; 'O'
- cp 41h ; 'A'
-page0_81D:
- jp nz, page0_A9B
+ cp 81h
+ jr isRAMUnhooked
++: ld a, b
+ and 4Fh
+ cp 41h
+isRAMUnhooked:
+ jp nz, RAMUnhookedWaitForPowerOn
bit onRunning, (iy+onFlags)
ret nz
+ ;ON key being released and we're just off, so just return from the interrupt handler
pop hl
sub a
push af
@@ -1147,39 +1149,41 @@
out (3), a
ld a, 11h
jp noSecondHardwareTimer
-
-page0_834:
+ONKeyBeingPressed:
+ ;Restore previous speed
in a, (2)
- and 80h ; ''
- jr z, page0_83D
+ and 80h
+ jr z, HandlePowerOnRequest
ld a, e
out (20h), a
-page0_83D:
- ld a, 76h ; 'v'
+
+.module HandlePowerOnRequest
+HandlePowerOnRequest:
+ ld a, 76h
out (4), a
in a, (2)
- and 80h ; ''
- jr z, page0_84D
- in a, (7)
- cp 81h ; 'g
- jr page0_853
-page0_84D:
+ and 80h
+ jr z, {+}
in a, (7)
- and 4Fh ; 'O'
- cp 41h ; 'A'
-page0_853:
- jp nz, page0_952
+ cp 81h
+ jr _isRAMUnhooked
++: in a, (7)
+ and 4Fh
+ cp 41h
+_isRAMUnhooked:
+ jp nz, HookRAMAndPowerOn
bit shift2nd, (iy+shiftFlags)
- jp z, page0_8E4
+ jp z, HandleONPressed
+ ;2nd is being pressed, so we might be turning off
bit enableKeyEcho, (iy+hookflags1)
- jr nz, page0_869
+ jr nz, {+}
bit appRetKeyOff, (iy+APIFlg)
jr z, PowerOff
++: set kOffPressed, (iy+APIFlg)
+ ret
+.endmodule
-page0_869:
- set 3, (iy+28h)
- ret
-
+.module PowerOff
PowerOff:
ld a, 8
push af
@@ -1189,19 +1193,19 @@
out (3), a
call TurnOffLCD
bit resetOnPowerOn, (iy+selfTestFlag)
- jr z, page0_887
+ jr z, {+}
+ ;If above flag is set and APD is disabled, skip RAM checksum generation (forcing a reset)
bit apdAble, (iy+apdFlags)
- jr z, page0_8C6
-page0_887:
- call page0_BB1
- call page0_B76
+ jr z, _skipRAMChecksum
++: call SetFastSpeed
+ call PreviousContext_CloseAnyOpenMenu
call j_hideCursor
set monAbandon, (iy+monFlags)
- ld hl, 9D8Dh
- set 0, (hl)
+ ld hl, lcdFlag
+ set powerLcdForGC, (hl)
call forcecmd
- ld hl, 9D8Dh
- res 0, (hl)
+ ld hl, lcdFlag
+ res powerLcdForGC, (hl)
res monAbandon, (iy+monFlags)
bit alt_Off, (iy+hookflags1)
call nz, Page0Call_3E7F
@@ -1210,13 +1214,13 @@
ld a, 8
out (3), a
call TurnOffLCD
- ld hl, 89F9h
- bit 2, (hl)
- res 2, (hl)
+ ld hl, flags+onFlags
+ bit clrScrnOnPowerOff, (hl)
+ res clrScrnOnPowerOff, (hl)
call nz, j_ClrScrn
call calculateRAMChecksum
ld (RAMChecksum), hl
-page0_8C6:
+_skipRAMChecksum:
res bPLinkOn, (iy+hookflags1)
res enableKeyEcho, (iy+hookflags1)
ld a, 36h ; '6'
@@ -1230,8 +1234,9 @@
ei
-: halt
jr {-}
+.endmodule
-page0_8E4:
+HandleONPressed:
res checkNoBatteriesNextTime, (iy+batteryFlags2)
call ApdSetup
bit onRunning, (iy+onFlags)
@@ -1284,7 +1289,7 @@
set onInterrupt, (iy+onFlags)
ret
-page0_952:
+HookRAMAndPowerOn:
ld a, 76h ; 'v'
out (4), a
ld a, 0C0h ; ''
@@ -1334,7 +1339,7 @@
dec de
ld (RAMChecksum), de
call Page0Call_3EB5
- call page0_B76
+ call PreviousContext_CloseAnyOpenMenu
ld a, 0Bh
out (3), a
res apdWarmStart, (iy+apdFlags)
@@ -1418,7 +1423,7 @@
jp newContext0
bootCalc:
- call page0_B8D
+ call SetSlowSpeed
ld a, 77h ; 'w'
out (4), a
ld b, 0
@@ -1442,7 +1447,7 @@
ld a, 0C0h ; ''
out (0), a
-page0_A9B:
+RAMUnhookedWaitForPowerOn:
ld a, 37h ; '7'
out (4), a
sub a
@@ -1510,7 +1515,7 @@
call refreshSystemRAM
in a, (2)
bit 0, a
- jp z, page0_8C6
+ jp z, PowerOff._skipRAMChecksum
sub_AEF:
call Page0Call_3ED9
@@ -1559,7 +1564,7 @@
ld sp, (onSP)
ld iy, 89F0h
call Page0Call_3EE5
- call page0_B76
+ call PreviousContext_CloseAnyOpenMenu
call forcecmd
res apdWarmStart, (iy+apdFlags)
bit 6, (iy+0Ch)
@@ -1575,43 +1580,38 @@
ei
jp Mon
-page0_B76:
- call page0_B86
- jr z, page0_B82
+PreviousContext_CloseAnyOpenMenu:
+ call IsInMenu
+ jr z, PreviousContext
xor a
ld (MenuCurrent), a
call j_rstrpartial
-
-page0_B82:
+PreviousContext:
call j_PrevContext
ret
-page0_B86:
+IsInMenu:
ld b, a
ld a, (MenuCurrent)
or a
ld a, b
ret
-page0_B8D:
+SetSlowSpeed:
call NZIf83Plus
ret nz
- jr page0_B9C
-
-page0_B93:
+ jr {+}
forceSlowSpeed:
call NZIf83Plus
ret nz
in a, (20h)
ld (oldSESpeed), a
-page0_B9C:
- push af
++: push af
xor a
out (20h), a
pop af
ret
-page0_BA2:
restorePreviousSpeed:
call NZIf83Plus
ret nz
@@ -1622,32 +1622,28 @@
SetExSpeed:
or a
-page0_BAF:
- jr z, page0_B8D
-
-
-page0_BB1:
+SetSpeed_NZForFast:
+ jr z, SetSlowSpeed
+SetFastSpeed:
push af
call NZIf83Plus
- jr nz, page0_BBB
+ jr nz, {+}
ld a, 1
out (20h), a
-page0_BBB:
- pop af
++: pop af
ret
page0_BBD:
pop af
push hl
- ld hl, 9CAEh
+ ld hl, SEspeed
dec (hl)
pop hl
call NZIf83Plus
- jr nz, page0_BCD
+ jr nz, {+}
and 1
out (20h), a
-page0_BCD:
- pop af
++: pop af
pop af
pop af
ret
--- a/source/page03/initial.asm Thu May 08 04:00:18 2014 -0400
+++ b/source/page03/initial.asm Thu May 08 16:43:29 2014 -0400
@@ -301,7 +301,7 @@
call p03sub_41A1
ld ix, p03loc_42B3
ld b, 31h ; '1'
- call page0_B8D
+ call SetSlowSpeed
p03loc_4214:
ld hl, 503h
--- a/source/page06/initial.asm Thu May 08 04:00:18 2014 -0400
+++ b/source/page06/initial.asm Thu May 08 16:43:29 2014 -0400
@@ -1835,7 +1835,7 @@
set appRetKeyOff, (iy+APIFlg)
getkey:
- res 3, (iy+28h)
+ res kOffPressed, (iy+APIFlg)
ld a, (iy+33h)
ld (bpSave), a
@@ -1878,9 +1878,9 @@
p06loc_49D8:
call GetCSC
- bit 3, (iy+28h)
+ bit kOffPressed, (iy+APIFlg)
jr z, p06loc_49E7
- res 3, (iy+28h)
+ res kOffPressed, (iy+APIFlg)
ld a, 0FFh
p06loc_49E7:
--- a/source/page07/initial.asm Thu May 08 04:00:18 2014 -0400
+++ b/source/page07/initial.asm Thu May 08 16:43:29 2014 -0400
@@ -4527,7 +4527,7 @@
cp 40h ; '@'
jr nz, p07loc_52C1
dec hl
- call page0_B86
+ call IsInMenu
jr nz, p07loc_52BF
bit inGroup, (iy+groupFlags)
jr nz, p07loc_52BF
@@ -5496,7 +5496,7 @@
in a, (20h)
push af
bit 5, (iy+24h)
- call page0_BAF
+ call SetSpeed_NZForFast
p07loc_57F6:
ld hl, p07loc_5848
--- a/source/page78/initial.asm Thu May 08 04:00:18 2014 -0400
+++ b/source/page78/initial.asm Thu May 08 16:43:29 2014 -0400
@@ -9748,7 +9748,7 @@
call page0_17DB
ld a, (SEspeed)
or a
- call nz, page0_BAF
+ call nz, SetSpeed_NZForFast
xor a
ld (SEspeed), a
ld (winLeftEdge), a
@@ -9803,8 +9803,8 @@
call popErrorHandleR
p78loc_776B:
- ld hl, 9D8Dh
- res 0, (hl)
+ ld hl, lcdFlag
+ res powerLcdForGC, (hl)
call j_setupEditCmd
bit 2, (iy+15h)
ret z
@@ -9815,8 +9815,8 @@
call j_cursorToOffset
ret
p78loc_7789:
- ld hl, 9D8Dh
- bit 0, (hl)
+ ld hl, lcdFlag
+ bit powerLcdForGC, (hl)
jp z, JErrorNo
ld hl, p78loc_7A99
ld (mcxErrorEP), hl
--- a/source/page79/initial.asm Thu May 08 04:00:18 2014 -0400
+++ b/source/page79/initial.asm Thu May 08 16:43:29 2014 -0400
@@ -286,7 +286,7 @@
; ---------------------------------------------------------------------------
Page79_3EBB:
- call page0_BB1
+ call SetFastSpeed
call NZIf83Plus
jr z, p79loc_41B7
ld b, 0
@@ -448,7 +448,7 @@
Page79_3ED9:
- call page0_B76
+ call PreviousContext_CloseAnyOpenMenu
call j_ClrScrn
res onInterrupt, (iy+onFlags)
set onRunning, (iy+onFlags)
@@ -861,7 +861,7 @@
; ---------------------------------------------------------------------------
Page79_3A5F:
- call page0_BB1
+ call SetFastSpeed
res extraIndic, (iy+newIndicFlags)
res 6, (iy+24h)
res 7, (iy+24h)
--- a/source/page7B/initial.asm Thu May 08 04:00:18 2014 -0400
+++ b/source/page7B/initial.asm Thu May 08 16:43:29 2014 -0400
@@ -7226,7 +7226,7 @@
in a, (20h)
push af
bit 5, (iy+24h)
- call page0_BAF
+ call SetSpeed_NZForFast
pop af
push af
ld a, (unk_9C22)
--- a/source/page7C/initial.asm Thu May 08 04:00:18 2014 -0400
+++ b/source/page7C/initial.asm Thu May 08 16:43:29 2014 -0400
@@ -4032,7 +4032,7 @@
; ReceiveVar:p7Cloc_593Fp
call Page0Call_3D05
call Page0Call_2D4B
- call page0_B93
+ call forceSlowSpeed
ld b, 64h ; 'd'
p7Cloc_5958:
@@ -4044,7 +4044,7 @@
djnz p7Cloc_5958
p7Cloc_5962:
- call page0_BA2
+ call restorePreviousSpeed
ret
; End of function p7Csub_594D
@@ -5732,7 +5732,7 @@
call p7Csub_6B25
ld a, 3
out (0), a
- call page0_B93
+ call forceSlowSpeed
ld hl, 0FFFFh
p7Cloc_6336:
@@ -5749,7 +5749,7 @@
ld a, h
or l
jr nz, p7Cloc_6336
- call page0_BA2
+ call restorePreviousSpeed
ld a, 0
out (0), a
call Page7C_2DCF
@@ -8541,8 +8541,8 @@
di
call p7Csub_7E37
call p7Csub_725D
- ld hl, 9D8Dh
- bit 0, (hl)
+ ld hl, lcdFlag
+ bit powerLcdForGC, (hl)
call nz, page0_AB7
ei
ret
@@ -11386,8 +11386,8 @@
p7Csub_7E19:
- ld hl, 9D8Dh
- bit 0, (hl)
+ ld hl, lcdFlag
+ bit powerLcdForGC, (hl)
call nz, j_LCD_DRIVERON
call p7Csub_7E52
ld hl, aGarbage
@@ -11399,10 +11399,9 @@
ld a, 73h ; 's'
jr p7Cloc_7E47
-
p7Csub_7E37:
- ld hl, 9D8Dh
- bit 0, (hl)
+ ld hl, lcdFlag
+ bit powerLcdForGC, (hl)
call nz, j_LCD_DRIVERON
call p7Csub_7E52
ld hl, aDefragmenting___
--- a/source/page7D/initial.asm Thu May 08 04:00:18 2014 -0400
+++ b/source/page7D/initial.asm Thu May 08 16:43:29 2014 -0400
@@ -2044,7 +2044,7 @@
call nz, j_call_character_hook
call p7Dsub_7045
call j_newline
- call page0_B93
+ call forceSlowSpeed
ld b, 5
p7Dloc_496C:
@@ -2061,7 +2061,7 @@
djnz p7Dloc_496F
ld b, c
djnz p7Dloc_496C
- call page0_BA2
+ call restorePreviousSpeed
call Page0Call_2E65
ld hl, 0
ld (curRow), hl
@@ -9973,12 +9973,12 @@
jr z, p7Dloc_7024
p7Dloc_701F:
- call page0_BB1
+ call SetFastSpeed
jr p7Dloc_7027
; ---------------------------------------------------------------------------
p7Dloc_7024:
- call page0_B8D
+ call SetSlowSpeed
p7Dloc_7027:
pop de
--- a/source/prosus.inc Thu May 08 04:00:18 2014 -0400
+++ b/source/prosus.inc Thu May 08 16:43:29 2014 -0400
@@ -211,7 +211,6 @@
unk_8A2C .equ 8A2Ch
unk_8A36 .equ 8A36h
unk_8A37 .equ 8A37h
-noBatterySP .equ 8A38h
unk_8D0A .equ 8D0Ah
unk_8D0B .equ 8D0Bh
unk_8D1E .equ 8D1Eh
@@ -330,7 +329,6 @@
unk_9C20 .equ 9C20h
unk_9C22 .equ 9C22h
unk_9C24 .equ 9C24h
-linkAssistHaltTickDelay .equ 9C86h
unk_9C87 .equ 9C87h
unk_9CAC .equ 9CACh
unk_9CAF .equ 9CAFh
--- a/source/ti83plus.inc Thu May 08 04:00:18 2014 -0400
+++ b/source/ti83plus.inc Thu May 08 16:43:29 2014 -0400
@@ -2058,6 +2058,7 @@
flags equ 89F0h
appFlagsAddr equ 89FDh
;something equ 8A36h ;stats-related? This gets stored to (varCurrent) for some reason
+noBatterySP equ 8A38h
statVars equ 8A3Ah
anovaf_vars equ 8C17h
infVars equ 8C4Dh
@@ -2366,9 +2367,10 @@
usb_dataExpectCount equ 9C80h
offPageCallPage equ 9C83h ;temporarily stores off-page page and address
offPageCallAddress equ 9C84h
-;something equ 9C86h ;used with SE link activity, values of 00h, 0FAh, 0FFh probably mean something
+linkAssistHaltTickDelay equ 9C86h
;something equ 9C87h ;zero this to force the APPS menu to recache itself (this is always either 0, 1, or last app page, for some reason)
;something equ 9C88h ;don't know, but it's 14 bytes and has to do with selecting stuff (if 9C87h is non-zero, this is zeroed out)
+bpSave equ 9D8Ah
;something equ 9C9Eh ;funky, this actually gets written to the certificate on non-83+ (11 bytes)
SEspeed equ 9CAEh
;something, table index equ 9CAFh
@@ -2379,7 +2381,8 @@
keyForStr equ 9D76h
keyToStrRam equ 9D77h
sedMonSp equ 9D88h ;small edit monitor SP
-bpSave equ 9D8Ah
+lcdFlag equ 9D8Dh
+powerLcdForGC equ 0
userMem equ 9D95h
symTable equ 0FE66h
@@ -2453,14 +2456,15 @@
;----------------------------------------------------------------------
web_err_mask equ 60h
;----------------------------------------------------------------------
-onFlags equ 9h ;on key flags
-parseInput equ 1 ;1=parse input when done
-onRunning equ 3 ;1=calculator is running
-onInterrupt equ 4 ;1=on key interrupt request
+onFlags equ 9h ;on key flags
+parseInput equ 1 ;1=parse input when done
+clrScrnOnPowerOff equ 2 ;1=clear screen on power off
+onRunning equ 3 ;1=calculator is running
+onInterrupt equ 4 ;1=on key interrupt request
-statFlags equ 9h ;statistics flags
-;unknown equ 5 ;unknown
-statsValid equ 6 ;1=stats are valid
+statFlags equ 9h ;statistics flags
+;unknown equ 5 ;unknown
+statsValid equ 6 ;1=stats are valid
;----------------------------------------------------------------------
fmtFlags equ 0Ah ;numeric format flags
fmtExponent equ 0 ;1=show exponent, 0=no exponent
@@ -2638,14 +2642,14 @@
;There is a flag 27h.
;----------------------------------------------------------------------
APIFlg equ 28h
-appAllowContext equ 0 ;App wants context changes to happen
+appAllowContext equ 0 ;App wants context changes to happen
;1 set to ignore a key after returning from rawkeyhook
;2 set to send this key back?
-;3
+kOffPressed equ 3 ;key echo is enabled and kOff pressed
appRunning equ 4 ;app is currently running
;5
;6
-appRetKeyOff equ 7 ;1 = GetKey returns kOff when [2nd]+[ON] pressed
+appRetKeyOff equ 7 ;1 = GetKey returns kOff when [2nd]+[ON] pressed
;----------------------------------------------------------------------
apiFlg2 equ 29h
;----------------------------------------------------------------------