ifndef SLOW_VERSION
debug macro debugvalue
+ ; uncomment this to get copious stuff in the debug buffer
+ ; NB that strictly this does not work because debugbyte messes with
+ ; FSR0[LH] and if we interrupt debugbyte we will trash FSR0
+ ; Dl debugvalue
endm
endif
; serial_receive:
-; debug 'h' ; write 'h' to serial port
+ debug 'h' ; write 'h' to serial port
+ Df fromserial
+ Df totrack
+
bt_fa_if1 RCSTA,FERR ; if FERR set (= framing error), then panic
goto panic_ferr
bt_fa_if1 RCSTA,OERR ; if OERR set (= overrun error), then panic
mov_ff fromserial,FSR0L ; set low byte of INDF0 pointer
mov_lw bufferpage
mov_wfa FSR0H ; set high byte of INDF0 pointer
-; debug '1'
+ debug '1'
mov_fw RCREG ; get received byte
mov_wf INDF0 ; copy to received register
; 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'
+ debug '3'
; If not, move to next byte
inc_fa fromserial ; advance fromserial pointer by 1 byte
-; debug '4'
+ debug '4'
mov_lw 0x0f
and_wfw fromserial
; timer0 interrupt
debug ',' ; write ',' to serial port
+ Df fromserial
+ Df totrack
+ Df nmractrl
+
bc_fa INTCON,TMR0IF ; clear interrupt-set bit
ifdef SLOW_VERSION
; aaaabbbb -> bbbbaaaa -> bbbb(aaaa+1) -> 0000(aaaa+1) -> (aaaa+1)0000
bt_f_if1 totrack, 6 ; were we doing watchdog broadcasts ?
bra advance_read_buffer_ifwatchdog
+
mov_fw totrack
add_lw 0x10
and_lw 0x30
mov_wf totrack
- debug '9' ; write 'v' to serial port
+ debug '9' ; write '9' to serial port
inc_f acknmra
bs_f PIE1, TXIE ; ensure we tell host to send us more