+; store counters
+mov counter_l_tmp,counter_l
+mov counter_h_tmp,counter_h
+
+; get new ones
+in counter_l,ICR1L
+in counter_h,ICR1H
+
+; delta calc on host software by now
+
+; return
+ret
+
+; ------------------------
+; toggle_icp_sense routine
+; ------------------------
+
+TOGGLE_ICP_SENSE:
+
+.ifdef DEBUG
+ldi tmp,0x54
+out UDR,tmp
+.endif
+
+; toggle according to state
+in tmp,TCCR1B
+cbr tmp,ICES1
+sbrs state,HIGH ; maybe toggle according to TCCR1B?
+sbr tmp,ICES1
+out TCCR1B,tmp
+
+; return
+ret
+
+; ------------------
+; fwd_to_cam routine
+; ------------------
+
+FWD_TO_CAM:
+
+.ifdef DEBUG
+ldi tmp,0x66
+out UDR,tmp
+.endif
+
+; activate led
+sbi PORTB,LED_FWD_TO_CARD
+cbi PORTB,LED_FWD_TO_CAM
+
+; disable external interrupt 1 while toggling edge
+in tmp,GIMSK
+cbr tmp,INT1
+out GIMSK,tmp
+
+; output state on port to cam
+in tmp1,PORTD
+sbr tmp1,PD3
+sbrs state,HIGH_F
+cbr tmp1,PD3