movlw bufferpage
movwf FSR0H,0 ; set high byte of INDF0 pointer
; debug '1'
- movff RCREG,INDF0 ; copy to received register
-; debug '2'
+ mov_fw RCREG ; get received byte
+ mov_wf INDF0 ; copy to received register
-; check whether bit 7 is set. If so, move to next buffer.
- btfsc INDF0,7,0 ; check if bit 7 is set
- call advance_write_buffer ; if so, move to next buffer
+; check whether bit 7 is clear.
+; If so, move to next buffer (or process other kind of message)
+ bra_nn end_message ; (STATUS N still from mov_fw RCREG)
; debug '3'
; If not, move to next byte
- btfss INDF0,7,0 ; check if bit 7 is set
incf fromserial,1,0 ; advance fromserial pointer by 1 byte
; debug '4'
; *** I *think* the interrupt bit is cleared by reading out of RCREG
; but this may be something to try in debugging if stuff doesn't work
+end_message
+; so what's the first byte then ?
+ mov_lw 0xf0
+ and_wff FSR0L
+ and_wff fromserial
+ com_fw INDF0
+ bra_nz not_nmra_message
-
+; so, first byte is FF (since complement of it is zero)
+; so, move to next buffer
advance_write_buffer
; clear low 4 bits of fromserial and increment top 4 bits
return
+not_nmra_message
+ call serialrx_generalmsg
+ intrl_handled_nostack
;****************************************************************************