From: ian Date: Sun, 9 Jan 2005 21:43:37 +0000 (+0000) Subject: use BUFFERPAGE constant instead of literal 5 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ijackson/git?a=commitdiff_plain;h=8a6ea7a7da5de90d80fff4da4b3dd316f0411e24;p=trains.git use BUFFERPAGE constant instead of literal 5 --- diff --git a/cebpic/nmra-stream.asm b/cebpic/nmra-stream.asm index 5909e56..31697e8 100644 --- a/cebpic/nmra-stream.asm +++ b/cebpic/nmra-stream.asm @@ -15,6 +15,8 @@ FROMSERIAL equ 0x1 ; byte 1: from-serial buffer location (in BSR5) TOTRACK equ 0x2 ; byte 2: to-track buffer location (in BSR5) TOTRACKBIT equ 0x3 ; byte 3: bit location of pointer within byte +BUFFERPAGE equ 5 + ifdef SLOW_VERSION messg "hello this is the slow version" @@ -139,12 +141,12 @@ initialise ; initialise buffers (for BSR5, for nmra from-serial/to-track buffers) - movlw 5 - movwf BSR,0 ; set BSR to 5 + movlw BUFFERPAGE + movwf BSR,0 ; set BSR to point to buffer page clrf NMRACTRL,0 ; for bits relevant to control of nmra stream - clrf FROMSERIAL,0 ; for loc'n of write-from-usart ptr within BSR5 - clrf TOTRACK,0 ; for loc'n of send-to-track ptr within BSR5 + clrf FROMSERIAL,0 ; for loc'n of write-from-usart ptr in buffers + clrf TOTRACK,0 ; for loc'n of send-to-track ptr in buffers ; all in access bank @@ -227,7 +229,7 @@ interrupt_low serial_receive ; debug 'h' ; write 'h' to serial port movff FROMSERIAL,FSR0L ; set low byte of INDF0 pointer - movlw 5 + movlw BUFFERPAGE movwf FSR0H,0 ; set high byte of INDF0 pointer ; debug '1' ; write 'h' to serial port movff RCREG,INDF0 ; copy to received register @@ -348,7 +350,7 @@ read_from_buffer debug 'p' movff TOTRACK,FSR1L ; set low byte of IND1 pointer - movlw 5 + movlw BUFFERPAGE movwf FSR1H,0 ; set high byte of IND1 pointer movff INDF1,WREG andwf TOTRACKBIT,0,0 ; select bit to be transmitted @@ -397,7 +399,7 @@ advance_pointer ; currently on bit 7 of the byte, after having read rest of byte to ; track; check whether it is 1 or 0 movff TOTRACK,FSR1L - movlw 5 + movlw BUFFERPAGE movwf FSR1H,0 ; if set, move to next buffer diff --git a/detpic/nmra-stream.asm b/detpic/nmra-stream.asm index 5909e56..31697e8 100644 --- a/detpic/nmra-stream.asm +++ b/detpic/nmra-stream.asm @@ -15,6 +15,8 @@ FROMSERIAL equ 0x1 ; byte 1: from-serial buffer location (in BSR5) TOTRACK equ 0x2 ; byte 2: to-track buffer location (in BSR5) TOTRACKBIT equ 0x3 ; byte 3: bit location of pointer within byte +BUFFERPAGE equ 5 + ifdef SLOW_VERSION messg "hello this is the slow version" @@ -139,12 +141,12 @@ initialise ; initialise buffers (for BSR5, for nmra from-serial/to-track buffers) - movlw 5 - movwf BSR,0 ; set BSR to 5 + movlw BUFFERPAGE + movwf BSR,0 ; set BSR to point to buffer page clrf NMRACTRL,0 ; for bits relevant to control of nmra stream - clrf FROMSERIAL,0 ; for loc'n of write-from-usart ptr within BSR5 - clrf TOTRACK,0 ; for loc'n of send-to-track ptr within BSR5 + clrf FROMSERIAL,0 ; for loc'n of write-from-usart ptr in buffers + clrf TOTRACK,0 ; for loc'n of send-to-track ptr in buffers ; all in access bank @@ -227,7 +229,7 @@ interrupt_low serial_receive ; debug 'h' ; write 'h' to serial port movff FROMSERIAL,FSR0L ; set low byte of INDF0 pointer - movlw 5 + movlw BUFFERPAGE movwf FSR0H,0 ; set high byte of INDF0 pointer ; debug '1' ; write 'h' to serial port movff RCREG,INDF0 ; copy to received register @@ -348,7 +350,7 @@ read_from_buffer debug 'p' movff TOTRACK,FSR1L ; set low byte of IND1 pointer - movlw 5 + movlw BUFFERPAGE movwf FSR1H,0 ; set high byte of IND1 pointer movff INDF1,WREG andwf TOTRACKBIT,0,0 ; select bit to be transmitted @@ -397,7 +399,7 @@ advance_pointer ; currently on bit 7 of the byte, after having read rest of byte to ; track; check whether it is 1 or 0 movff TOTRACK,FSR1L - movlw 5 + movlw BUFFERPAGE movwf FSR1H,0 ; if set, move to next buffer