Timex M851 Watch User Manual


 
M851 WristApp Design Guide Rev 1.2
Timex Corporation 105
;--------------------------------------------------------------
jr cntSetRedisplayAndReqBlink ; **EXTERNAL JUMP
cntSetStateToggleDirection:
; Toggle count-up/countdown bit.
ld A, [IY + CNTFLAGSOFFSET]
xor A, #bCNTCountDown
ld [IY + CNTFLAGSOFFSET], A
;--------------------------------------------------------------
; Clear line 2 only so that the display would not look like
; garbage when changing from "DOWN" to "UP".
; Destroys AReg, IXReg.
;--------------------------------------------------------------
LCD_CLR_MAIN_DM_LINE2
;--------------------------------------------------------------
; Refresh the display and request blinking on the editable field.
; Destroys BAReg, HLReg, IXReg.
; Input: IYReg - ASD address.
;--------------------------------------------------------------
jr cntSetRedisplayAndReqBlink ; **EXTERNAL JUMP
5.10.7 Background Handler
The following code handles the events passed by the M851 OS to the counter wristapp background handler.
Only the INIT event is seen processed here. The TASKEXIT, PEEK, and APP_SHUTDOWN_FOR_COMM
are handled only as return instructions.
IF @DEF('SUBROUTINE')
UNDEF SUBROUTINE
ENDIF
DEFINE SUBROUTINE "'cntBackgroundHandler'"
GLOBAL cntBackgroundHandler
cntBackgroundHandler:
; Load the event to be process to AReg.
ld A, [COREBackgroundEvent]
; Check if INIT event.
cp A, #COREEVENT_INIT
jr NZ, cntBackgroundProcessExit
cntBackgroundInitEvent:
;**************************************************************
; INITIALIZATION THROUGH COMM MODE
;**************************************************************
;--------------------------------------------------------------
; Counter initial data.
; Data - 0
; Count up
;--------------------------------------------------------------
ld A, #0
ld IY, [CORECurrentASDAddress]
ld [IY + CNTFLAGSOFFSET], A
ld [IY + CNTDATALOOFFSET], A
ld [IY + CNTDATAHIOFFSET], A
cntBackgroundProcessExit:
ret