Timex M851 Watch User Manual


 
M851 WristApp Design Guide Rev 1.2
Timex Corporation 101
; Load AReg with the counter status flag data and check the
; counting direction.
ld A, [IY + CNTFLAGSOFFSET]
bit A, #bCNTCountDown
jr Z, cntDefaultStartSplitDepressCountUp
;==============================================================
; COUNT DOWN OPERATION
;==============================================================
; Check whether it is in the minimum value.
cp HL, #CNTMINDATA
jr C, cntDefaultStartSplitDepressExit
jr Z, cntDefaultStartSplitDepressExit
;--------------------------------------------------------------
; Subtract 1 to the counter data.
;--------------------------------------------------------------
car cntSubDataBy1
jr cntDefaultSSDispDataAndReqAlert
cntDefaultStartSplitDepressCountUp:
;==============================================================
; COUNT UP
;==============================================================
; Check whether it is in the minimum value.
cp HL, #CNTMAXDATA
jr NC, cntDefaultStartSplitDepressExit
;--------------------------------------------------------------
; Add 1 to the counter data.
;--------------------------------------------------------------
car cntAddDataBy1
cntDefaultSSDispDataAndReqAlert:
;--------------------------------------------------------------
; Displays the counter data on the main dot matrix using
; large fonts.
;--------------------------------------------------------------
car cntDisplayCounterData
;--------------------------------------------------------------
; Generate alert to indicated that it has successfully
; decremented/incremented the counter.
;--------------------------------------------------------------
AUDSTART_SYSTEM_MELODY AUDSWBEEPMELODY, AUDNOMELODYDONEEVENT
cntDefaultStartSplitDepressExit:
ret
cntDefaultStateStopResetDepressEvent:
;**************************************************************
; STOP/RESET DEPRESS
;**************************************************************
; Get the current counter value and check whether it is in the
; minimum value.
add IY, #CNTDATALOOFFSET
ld BA, [IY]
cp BA, #CNTMINDATA
jr Z, cntDefaultStopResetDepressExit
; Not yet in its minimum.