-PROGRAMS= led-flash send-serial reply-serial
+PROGRAMS= led-flash send-serial reply-serial nmra-stream
include ../pic.make
;****************************************************************************
serial_receive
- movff FROMSERIAL,FSR0L ; set low byte of IND0 pointer
+ movff FROMSERIAL,FSR0L ; set low byte of INDF0 pointer
movlw 5
- movwf FSR0H,0 ; set high byte of IND0 pointer
- movff RCREG,IND0 ; copy to received register
+ movwf FSR0H,0 ; set high byte of INDF0 pointer
+ movff RCREG,INDF0 ; copy to received register
incf FROMSERIAL,1,0 ; advance FROMSERIAL pointer by 1 byte
; *** check for overrun and do something sensible
btfss RCREG,7,0 ; check if bit 7 is set
bcf INTCON,2,0 ; clear interrupt-set bit
movlw 0x01 ; (testing)
; movlw 0x6E ; (not-testing)
- movwf W,TMR0L ; set timer0 to 0x6E (so interrupt takes 58us)
+ movwf TMR0L,0 ; set timer0 to 0x6E (so interrupt takes 58us)
; check next action - if 0, change to 1 and return
; check whether current to-track buffer = current from-serial buffer
; if yes, transmit 1s (set transmitbit=1, nextaction=1 and return)
- movff FROMSERIAL,W,0
+ movff FROMSERIAL,W
xorwf TOTRACK,0,0
andlw 0x30
bnz read_from_buffer
movff TOTRACK,FSR1L ; set low byte of IND1 pointer
movlw 5
movwf FSR1H,0 ; set high byte of IND1 pointer
- movff INDF1,W,0
+ movff INDF1,W
andwf TOTRACKBIT,0,0 ; mask out bit to be transmitted
;*** to `mask out' means to clear, eg
;*** if you were to `mask out bit 0 of 0xff' you'd get 0xfe
movff TOTRACK,FSR1L
movlw 5
movwf FSR1H,0
- movff INDF1,W,0
+ movff INDF1,W
andlw 0x80
;*** bit test bit 7 of INDF1 ? That's simpler than load into W and AND. -iwj
movff TOTRACK,FSR1L ; set low byte of IND1 pointer
movlw 5
movwf FSR1H,0 ; set high byte of IND1 pointer
- movff INDF1,W,0
+ movff INDF1,W
andwf TOTRACKBIT,0,0 ; mask out bit to be transmitted
;*** This is the same code as the 2nd stanza in read_from_buffer,
;*** above. Surely it should be made common (eg a subroutine) ? -iwj
;****************************************************************************
serial_receive
- movff FROMSERIAL,FSR0L ; set low byte of IND0 pointer
+ movff FROMSERIAL,FSR0L ; set low byte of INDF0 pointer
movlw 5
- movwf FSR0H,0 ; set high byte of IND0 pointer
- movff RCREG,IND0 ; copy to received register
+ movwf FSR0H,0 ; set high byte of INDF0 pointer
+ movff RCREG,INDF0 ; copy to received register
incf FROMSERIAL,1,0 ; advance FROMSERIAL pointer by 1 byte
; *** check for overrun and do something sensible
btfss RCREG,7,0 ; check if bit 7 is set
bcf INTCON,2,0 ; clear interrupt-set bit
movlw 0x01 ; (testing)
; movlw 0x6E ; (not-testing)
- movwf W,TMR0L ; set timer0 to 0x6E (so interrupt takes 58us)
+ movwf TMR0L,0 ; set timer0 to 0x6E (so interrupt takes 58us)
; check next action - if 0, change to 1 and return
; check whether current to-track buffer = current from-serial buffer
; if yes, transmit 1s (set transmitbit=1, nextaction=1 and return)
- movff FROMSERIAL,W,0
+ movff FROMSERIAL,W
xorwf TOTRACK,0,0
andlw 0x30
bnz read_from_buffer
movff TOTRACK,FSR1L ; set low byte of IND1 pointer
movlw 5
movwf FSR1H,0 ; set high byte of IND1 pointer
- movff INDF1,W,0
+ movff INDF1,W
andwf TOTRACKBIT,0,0 ; mask out bit to be transmitted
;*** to `mask out' means to clear, eg
;*** if you were to `mask out bit 0 of 0xff' you'd get 0xfe
movff TOTRACK,FSR1L
movlw 5
movwf FSR1H,0
- movff INDF1,W,0
+ movff INDF1,W
andlw 0x80
;*** bit test bit 7 of INDF1 ? That's simpler than load into W and AND. -iwj
movff TOTRACK,FSR1L ; set low byte of IND1 pointer
movlw 5
movwf FSR1H,0 ; set high byte of IND1 pointer
- movff INDF1,W,0
+ movff INDF1,W
andwf TOTRACKBIT,0,0 ; mask out bit to be transmitted
;*** This is the same code as the 2nd stanza in read_from_buffer,
;*** above. Surely it should be made common (eg a subroutine) ? -iwj