.text
.global _asmFunction
_asmFunction:
mov.w #0x0, w4
mov.w w4, 0x2CA
clr.w w1 ;clear WREG1
clr.w w3 ;clear WREG3
clr.w TMR1 ;clear TMR1
mov.w #0x8000, w1 ;move 0x8000 to w for t1con
start: BTSS PORTB, #9
GOTO start
mov.w w1, T1CON ;timer 2 OFF
falledge: BTSC 0x2CA, #9 ;test RA7 if not set skip next(low)
GOTO falledge
stop: BTSS 0x2CA, #9 ;test RA7 if set skip(complete cycle)
GOTO stop
mov.w w3, T1CON ;timer 2 OFF
mov.w TMR1, w5 ;save
mov.w w5, 0x800 ;timer value
return
.end