movff fromserial,FSR0L ; set low byte of INDF0 pointer
movlw bufferpage
movwf FSR0H,0 ; set high byte of INDF0 pointer
-; debug '1' ; write 'h' to serial port
+; debug '1'
movff RCREG,INDF0 ; copy to received register
-; debug '2' ; write 'h' to serial port
+; debug '2'
; 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
-; debug '3' ; write 'h' to serial port
+; 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' ; write 'h' to serial port
+; debug '4'
bcf PIR1,RCIF,0 ; unset interrupt
goto intrl_handled_nostack
; clear low 4 bits of fromserial and increment top 4 bits
; aaaabbbb -> bbbbaaaa -> bbbb(aaaa+1) -> 0000(aaaa+1) -> (aaaa+1)0000
- debug '5' ; write 'h' to serial port
+ debug '5'
swapf fromserial,1,0
incf fromserial,1,0
movlw 0xF
swapf fromserial,1,0
; clear bit 6 (will set back to buffer 0 if has overflowed to 4)
- debug '6' ; write 'h' to serial port
+ debug '6'
bcf fromserial,6,0
return