Timex M851 Watch User Manual


 
M851 WristApp Design Guide Rev 1.2
Timex Corporation 103
5.10.6 Set State Handler
The following is the code for the Counter set state handler.
IF @DEF('SUBROUTINE')
UNDEF SUBROUTINE
ENDIF
DEFINE SUBROUTINE "'cntSetStateManager'"
GLOBAL cntSetStateManager
cntSetStateManager:
; Set IYReg the address of the counter ASD.
ld IY, [CORECurrentASDAddress]
ld A, [CORECurrentEvent]
cp A, #CNT_STATEENTRY
jr Z, cntSetStateStateEntryEvent
cp A, #CNT_MODEDEPRESS
jr Z, cntSetStateModeDepressEvent
cp A, #CNT_STOPRESETDEPRESS
jr Z, cntSetStateStopResetDepressEvent
cp A, #CNT_CWPULSES
jr Z, cntSetStateCWPulseEvent
cp A, #CNT_CCWPULSES
jr Z, cntSetStateCCWPulseEvent
cp A, #CNT_CROWNHOME
jr NZ, cntSetStateExit
;**************************************************************
; CROWN HOME
;**************************************************************
ld B, #CNTDEFAULTSTATE
CORE_REQ_STATE_CHANGE
cntSetStateExit:
ret
cntSetStateStateEntryEvent:
;**************************************************************
; STATE ENTRY
;**************************************************************
; Enable pulse mode to change values.
CORE_ENABLE_PULSE_MODE
; Mask start/split key. This event is not needed.
CORE_MASK_KEYS (CNTSWITCHMASK_STARTSPLIT | CNTSWITCHMASK_EL)
; Clear the bit indicating that the first set item is the counter
; data.
ld HL, #CNTTempFlags
and [HL], #@LOW(~bCNTSetDirection)
;--------------------------------------------------------------
; Refresh the display and request blinking on the editable field.
; Destroys BAReg, HLReg, IXReg.
; Input: IYReg - ASD address.
;--------------------------------------------------------------
jr cntSetRedisplayAndReqBlink ; **EXTERNAL JUMP