chiark / gitweb /
fit in 80 columns
authorian <ian>
Tue, 4 Jan 2005 20:25:33 +0000 (20:25 +0000)
committerian <ian>
Tue, 4 Jan 2005 20:25:33 +0000 (20:25 +0000)
cebpic/nmra-stream.asm
detpic/nmra-stream.asm

index adb3264c9c12c5f16a96d95c223a151d90c2c34e..c6640a7008391279efc0aa1371a5131270d21b84 100644 (file)
@@ -1,5 +1,6 @@
 
-; pin 21 (per-pic-led, RD2/PSP2/C1IN) states: high H = green, low L = red, float Z = black
+; pin 21 (per-pic-led, RD2/PSP2/C1IN) states: 
+;  high H = green, low L = red, float Z = black
 
 
 
@@ -20,7 +21,7 @@ TOTRACKBIT    equ     0x3     ; byte 3: bit location of pointer within byte
        org     0
        goto    initialise
 
-;*****************************************************************************************
+;****************************************************************************
 
 ; high priority interrupt 
 
@@ -32,11 +33,11 @@ TOTRACKBIT  equ     0x3     ; byte 3: bit location of pointer within byte
        org     000018h
        goto    interrupt_low
 
-;*****************************************************************************************
+;****************************************************************************
 
        code
 
-;*****************************************************************************************
+;****************************************************************************
 
 macros
 
@@ -49,11 +50,13 @@ debug macro debugvalue
        endm
 
 debug_serial_transmit
-*** check and wait for flag so that it works if we debug twice in quick succession -iwj
-       movwf   TXREG,0         ; move contents of W (i.e. debugvalue) to TXREG for transmission
+*** check and wait for flag so that it
+***  works if we debug twice in quick succession -iwj
+       movwf   TXREG,0         ; move contents of W (i.e. debugvalue)
+                               ;       to TXREG for transmission
        return
 
-;*****************************************************************************************
+;****************************************************************************
 
 initialise
 
@@ -75,7 +78,7 @@ initialise
        bsf     SPBRG,7,0
        bsf     SPBRG,0,0
 
-;-----------------------------------------------------------------------------------------
+;----------------------------------------------------------------------------
 
 
 ; timer 0 set-up
@@ -92,7 +95,7 @@ initialise
         bcf     T0CON,0,0       ; }
 
        
-;-----------------------------------------------------------------------------------------
+;----------------------------------------------------------------------------
 
 ; initialise buffers (for BSR5, for nmra from-serial/to-track buffers)
 
@@ -100,12 +103,12 @@ initialise
        movwf   BSR,0           ; set BSR to 5
 
        clrf    NMRACTRL,0      ; for bits relevant to control of nmra stream
-       clrf    FROMSERIAL,0    ; for location of write-from-usart pointer within BSR5
-       clrf    TOTRACK,0       ; for location of send-to-track pointer within BSR5
+       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
                                ; all in access bank
 
 
-;-----------------------------------------------------------------------------------------
+;----------------------------------------------------------------------------
 
 
 ; initialise next action/transmit bit
@@ -125,7 +128,7 @@ initialise
        bsf     PORTC,1,0       ; booster pwm high
 
 
-;-----------------------------------------------------------------------------------------
+;----------------------------------------------------------------------------
 
 ; interrupt set-up
 
@@ -147,7 +150,7 @@ initialise
 ***  generate a spurious high-priority interrupt  -iwj
 
 
-;*****************************************************************************************
+;****************************************************************************
 
 main_loop_led
        call    led_green
@@ -155,29 +158,29 @@ main_loop_led
 *** do you really mean to set the led green in a tight loop ?? -iwj
 
 
-;*****************************************************************************************
+;****************************************************************************
 
 interrupt_high
        goto    panic
 
-;*****************************************************************************************
+;****************************************************************************
 
 interrupt_low
 
 ; check which interrupt. Branch to serial_receive or timer or return
 
-        btfss   PIR1,5,0        ; check whether serial receive interrupt bit set
+        btfss   PIR1,5,0        ; check whether serial recv interrupt bit set
        goto    serial_receive
        btfss   INTCON,2,0      ; check whether timer0 interrupt set
        goto    timer0_interrupt
        goto    panic
 
-; if 2 interrupts are set at once the 2nd will generate a new interrupt on leaving
-; the interrupt routine
+; if 2 interrupts are set at once the 2nd will generate a new
+; interrupt on leaving the interrupt routine
 ; *** we hope and trust -iwj
 
 
-;*****************************************************************************************
+;****************************************************************************
 
 serial_receive
        movff   FROMSERIAL,FSR0L        ; set low byte of IND0 pointer
@@ -218,13 +221,13 @@ fromserial_overflow
        return
 
 
-;*****************************************************************************************
+;****************************************************************************
 
 timer0_interrupt
        
        bcf     INTCON,2,0      ; clear interrupt-set bit
        movlw   0x6E
-       movwf   W,TMR0L         ; set timer0 to 0x6E (so that interrupt takes 58us)
+       movwf   W,TMR0L         ; set timer0 to 0x6E (so interrupt takes 58us)
 
 
 ; check next action - if 0, change to 1 and return
@@ -316,7 +319,8 @@ advance_bit
 
 advance_pointer
 
-; currently on bit 7 of the byte, after having read rest of byte to track; check whether it is 1 or 0
+; 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
@@ -379,7 +383,7 @@ advance_read_byte
 
 
 
-;*****************************************************************************************
+;****************************************************************************
 
 
 led_green
@@ -388,7 +392,8 @@ led_green
         return
 
 led_black
-        bsf     TRISD,2,0       ; make pin RD2 an input (i.e. set Z, black) (DS100)
+        bsf     TRISD,2,0       ; make pin RD2 an input (i.e. set Z, black)
+                               ;       (DS100)
         return
 
 led_red
@@ -405,6 +410,6 @@ panic_loop
        call    led_red
        goto    panic_loop
        
-;*****************************************************************************************
+;****************************************************************************
 
        end
index adb3264c9c12c5f16a96d95c223a151d90c2c34e..c6640a7008391279efc0aa1371a5131270d21b84 100644 (file)
@@ -1,5 +1,6 @@
 
-; pin 21 (per-pic-led, RD2/PSP2/C1IN) states: high H = green, low L = red, float Z = black
+; pin 21 (per-pic-led, RD2/PSP2/C1IN) states: 
+;  high H = green, low L = red, float Z = black
 
 
 
@@ -20,7 +21,7 @@ TOTRACKBIT    equ     0x3     ; byte 3: bit location of pointer within byte
        org     0
        goto    initialise
 
-;*****************************************************************************************
+;****************************************************************************
 
 ; high priority interrupt 
 
@@ -32,11 +33,11 @@ TOTRACKBIT  equ     0x3     ; byte 3: bit location of pointer within byte
        org     000018h
        goto    interrupt_low
 
-;*****************************************************************************************
+;****************************************************************************
 
        code
 
-;*****************************************************************************************
+;****************************************************************************
 
 macros
 
@@ -49,11 +50,13 @@ debug macro debugvalue
        endm
 
 debug_serial_transmit
-*** check and wait for flag so that it works if we debug twice in quick succession -iwj
-       movwf   TXREG,0         ; move contents of W (i.e. debugvalue) to TXREG for transmission
+*** check and wait for flag so that it
+***  works if we debug twice in quick succession -iwj
+       movwf   TXREG,0         ; move contents of W (i.e. debugvalue)
+                               ;       to TXREG for transmission
        return
 
-;*****************************************************************************************
+;****************************************************************************
 
 initialise
 
@@ -75,7 +78,7 @@ initialise
        bsf     SPBRG,7,0
        bsf     SPBRG,0,0
 
-;-----------------------------------------------------------------------------------------
+;----------------------------------------------------------------------------
 
 
 ; timer 0 set-up
@@ -92,7 +95,7 @@ initialise
         bcf     T0CON,0,0       ; }
 
        
-;-----------------------------------------------------------------------------------------
+;----------------------------------------------------------------------------
 
 ; initialise buffers (for BSR5, for nmra from-serial/to-track buffers)
 
@@ -100,12 +103,12 @@ initialise
        movwf   BSR,0           ; set BSR to 5
 
        clrf    NMRACTRL,0      ; for bits relevant to control of nmra stream
-       clrf    FROMSERIAL,0    ; for location of write-from-usart pointer within BSR5
-       clrf    TOTRACK,0       ; for location of send-to-track pointer within BSR5
+       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
                                ; all in access bank
 
 
-;-----------------------------------------------------------------------------------------
+;----------------------------------------------------------------------------
 
 
 ; initialise next action/transmit bit
@@ -125,7 +128,7 @@ initialise
        bsf     PORTC,1,0       ; booster pwm high
 
 
-;-----------------------------------------------------------------------------------------
+;----------------------------------------------------------------------------
 
 ; interrupt set-up
 
@@ -147,7 +150,7 @@ initialise
 ***  generate a spurious high-priority interrupt  -iwj
 
 
-;*****************************************************************************************
+;****************************************************************************
 
 main_loop_led
        call    led_green
@@ -155,29 +158,29 @@ main_loop_led
 *** do you really mean to set the led green in a tight loop ?? -iwj
 
 
-;*****************************************************************************************
+;****************************************************************************
 
 interrupt_high
        goto    panic
 
-;*****************************************************************************************
+;****************************************************************************
 
 interrupt_low
 
 ; check which interrupt. Branch to serial_receive or timer or return
 
-        btfss   PIR1,5,0        ; check whether serial receive interrupt bit set
+        btfss   PIR1,5,0        ; check whether serial recv interrupt bit set
        goto    serial_receive
        btfss   INTCON,2,0      ; check whether timer0 interrupt set
        goto    timer0_interrupt
        goto    panic
 
-; if 2 interrupts are set at once the 2nd will generate a new interrupt on leaving
-; the interrupt routine
+; if 2 interrupts are set at once the 2nd will generate a new
+; interrupt on leaving the interrupt routine
 ; *** we hope and trust -iwj
 
 
-;*****************************************************************************************
+;****************************************************************************
 
 serial_receive
        movff   FROMSERIAL,FSR0L        ; set low byte of IND0 pointer
@@ -218,13 +221,13 @@ fromserial_overflow
        return
 
 
-;*****************************************************************************************
+;****************************************************************************
 
 timer0_interrupt
        
        bcf     INTCON,2,0      ; clear interrupt-set bit
        movlw   0x6E
-       movwf   W,TMR0L         ; set timer0 to 0x6E (so that interrupt takes 58us)
+       movwf   W,TMR0L         ; set timer0 to 0x6E (so interrupt takes 58us)
 
 
 ; check next action - if 0, change to 1 and return
@@ -316,7 +319,8 @@ advance_bit
 
 advance_pointer
 
-; currently on bit 7 of the byte, after having read rest of byte to track; check whether it is 1 or 0
+; 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
@@ -379,7 +383,7 @@ advance_read_byte
 
 
 
-;*****************************************************************************************
+;****************************************************************************
 
 
 led_green
@@ -388,7 +392,8 @@ led_green
         return
 
 led_black
-        bsf     TRISD,2,0       ; make pin RD2 an input (i.e. set Z, black) (DS100)
+        bsf     TRISD,2,0       ; make pin RD2 an input (i.e. set Z, black)
+                               ;       (DS100)
         return
 
 led_red
@@ -405,6 +410,6 @@ panic_loop
        call    led_red
        goto    panic_loop
        
-;*****************************************************************************************
+;****************************************************************************
 
        end