M851 WristApp Design Guide Rev 1.2
Timex Corporation 110
cntSubDataBy1
IF @DEF('SUBROUTINE')
UNDEF SUBROUTINE
ENDIF
DEFINE SUBROUTINE "'cntSubDataBy1'"
GLOBAL cntSubDataBy1
cntSubDataBy1: ; **SUBROUTINE cntSubDataBy1
push SC
; Use decimal addition.
UTL_DECIMAL_MATH_MODE
; Value to be subtracted to the counter data.
ld A, #01h
; Compute the new counter data.
; Popping of SCReg is done inside the routine.
jr cntSubDataBy1EntryPoint
cntSubDataByAcceleration
IF @DEF('SUBROUTINE')
UNDEF SUBROUTINE
ENDIF
DEFINE SUBROUTINE "'cntSubDataByAcceleration'"
GLOBAL cntSubDataByAcceleration
cntSubDataByAcceleration:
push SC
; Use decimal addition.
UTL_DECIMAL_MATH_MODE
;--------------------------------------------------------------
; Determine the acceleration factor for COREEventArgument and
; write factor into AReg.
;--------------------------------------------------------------
;--------------------------------------------------------------
; Get starting address into the acceleration table then subtract
; it by 1 to get the exact acceleration data. Take note that
; the least number of pulses that the system will send is 1.
;--------------------------------------------------------------
ld IX, #utlAccelerationTable1Min - 1
; Get the number of pulses.
ld L, [COREEventArgument]
; Get the acceleration factor.
ld A, [IX + L]
cntSubDataBy1EntryPoint:
;--------------------------------------------------------------
; Note for using this as the entry point.
; AReg - Value to be added to the current counter.
; IYReg- Counter ASD address.
; SCReg should be pushed.
; bDecimalFlag should be set.
;--------------------------------------------------------------
push IY
; Set HLReg and IYReg to point to the data low address.
add IY, #CNTDATALOOFFSET