chiark / gitweb /
arrange to call serialrx_generalmsg at the right point
authorian <ian>
Mon, 19 Dec 2005 11:47:05 +0000 (11:47 +0000)
committerian <ian>
Mon, 19 Dec 2005 11:47:05 +0000 (11:47 +0000)
detpic/nmra-stream.asm

index 7105ddb91aca2bbbdb1fc45b3e9260977ccc6144..9c93b8e27cceb1cbd26983c78e2f456d47ad620b 100644 (file)
@@ -190,16 +190,15 @@ fixme need to check both interrupt handlers here and look for refies too
        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'
 
@@ -209,8 +208,16 @@ fixme need to check both interrupt handlers here and look for refies too
 ; *** 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
@@ -228,6 +235,9 @@ advance_write_buffer
        
        return
 
+not_nmra_message
+       call    serialrx_generalmsg
+       intrl_handled_nostack
 
 ;****************************************************************************