  1                     radix dec
  2     0008    global__variables__bank0 equ 8
  3     0030    global__variables__bank1 equ 48
  4     0050    global__variables__bank2 equ 80
  5     0070    global__variables__bank3 equ 112
  6     0012    global__bit__variables__bank0 equ 18
  7     0030    global__bit__variables__bank1 equ 48
  8     0050    global__bit__variables__bank2 equ 80
  9     0070    global__bit__variables__bank3 equ 112
 10     0000    indf___register equ 0
 11     0002    pcl___register equ 2
 12     0003    c___byte equ 3
 13     0000    c___bit equ 0
 14     0003    z___byte equ 3
 15     0002    z___bit equ 2
 16                     ; On 12-bit PIC's, RP0 is actually bit 5 in FSR (=4)
 17     0004    rp0___byte equ 4
 18     0005    rp0___bit equ 5
 19                     ; On 12-bit PIC's, RP1 is actually bit 6 in FSR (=4)
 20     0004    rp1___byte equ 4
 21     0006    rp1___bit equ 6
 22                     ; On 12-bit PIC's, PA0 is actually bit 5 in STATUS (=3)
 23     0003    pa0___byte equ 3
 24     0005    pa0___bit equ 5
 25     0004    fsr___register equ 4
 26                     org 0
 27             start:
 28                     ; Use oscillator calibration value already in register W
 29 000  025        movwf 5
 30                     ; Initialize TRIS registers
 31 001  cc8        movlw 200
 32 002  006        tris 6
 33 003  c00        movlw 0
 34 004  007        tris 7
 35 005  a06        goto main
 36                     ; comment #############################################################################
 37                     ; comment {}
 38                     ; comment {Copyright < c > 2002 by Wayne C . Gramlich and Bill Benson}
 39                     ; comment {All rights reserved .}
 40                     ; comment {}
 41                     ; comment {Permission to use , copy , modify , distribute , and sell this software}
 42                     ; comment {for any purpose is hereby granted without fee provided that the above}
 43                     ; comment {copyright notice and this permission are retained . The author makes}
 44                     ; comment {no representations about the suitability of this software for any purpose .}
 45                     ; comment {It is provided { as is } without express or implied warranty .}
 46                     ; comment {}
 47                     ; comment {This is the code that implements the LED10 RoboBrick . Basically}
 48                     ; comment {it just waits for commands that come in at 2400 baud and responds}
 49                     ; comment {to them . See}
 50                     ; comment {}
 51                     ; comment {http : / / web . gramlich . net / projects / robobricks / led10 / index . html}
 52                     ; comment {}
 53                     ; comment {for more details .}
 54                     ; comment {}
 55                     ; comment #############################################################################
 56                     ;   processor pic16c505 cp = off wdte = on mclre = off fosc = intrc_no_clock  
 57                     ; 4052=0xfd4 4095=0xfff
 58                     __config 4052
 59     0fff    configuration___address equ 4095
 60                     ; comment {Define processor constants :}
 61                     ;   constant clock_rate 4000000  
 62     3d0900    clock_rate equ 4000000
 63                     ;   constant clocks_per_instruction 4  
 64     0004    clocks_per_instruction equ 4
 65                     ;   constant instruction_rate clock_rate / clocks_per_instruction  
 66     f4240    instruction_rate equ 1000000
 67                     ; comment {Define serial communication control constants :}
 68                     ;   constant baud_rate 2400  
 69     0960    baud_rate equ 2400
 70                     ;   constant instructions_per_bit instruction_rate / baud_rate  
 71     01a0    instructions_per_bit equ 416
 72                     ;   constant delays_per_bit 3  
 73     0003    delays_per_bit equ 3
 74                     ;   constant instructions_per_delay instructions_per_bit / delays_per_bit  
 75     008a    instructions_per_delay equ 138
 76                     ;   constant extra_instructions_per_bit 9  
 77     0009    extra_instructions_per_bit equ 9
 78                     ;   constant extra_instructions_per_delay extra_instructions_per_bit / delays_per_bit  
 79     0003    extra_instructions_per_delay equ 3
 80                     ;   constant delay_instructions instructions_per_delay - extra_instructions_per_delay  
 81     0087    delay_instructions equ 135
 82                     ; comment {Register definitions :}
 83                     ; comment {Status register :}
 84     0003    status equ 3
 85                     ;   bind c status @ 0  
 86     0003    c equ status+0
 87     0003    c__byte equ status+0
 88     0000    c__bit equ 0
 89                     ;   bind z status @ 2  
 90     0003    z equ status+0
 91     0003    z__byte equ status+0
 92     0002    z__bit equ 2
 93                     ; comment {OSCCAL register :}
 94     0005    osccal equ 5
 95                     ;   constant osccal_lsb 4  
 96     0004    osccal_lsb equ 4
 97                     ; comment {Define pin assignments and directions :}
 98                     ;   constant led0_bit 5  
 99     0005    led0_bit equ 5
100                     ;   constant led1_bit 0  
101     0000    led1_bit equ 0
102                     ;   constant led2_bit 1  
103     0001    led2_bit equ 1
104                     ;   constant led3_bit 2  
105     0002    led3_bit equ 2
106                     ;   constant led4_bit 0  
107     0000    led4_bit equ 0
108                     ;   constant led5_bit 1  
109     0001    led5_bit equ 1
110                     ;   constant led6_bit 3  
111     0003    led6_bit equ 3
112                     ;   constant led7_bit 4  
113     0004    led7_bit equ 4
114                     ;   constant led8_bit 4  
115     0004    led8_bit equ 4
116                     ;   constant mode_bit 5  
117     0005    mode_bit equ 5
118                     ;   constant serial_out_bit 2  
119     0002    serial_out_bit equ 2
120                     ;   constant serial_in_bit 3  
121     0003    serial_in_bit equ 3
122                     ;   constant led0_mask {{ 1 << led0_bit }}  
123     0020    led0_mask equ 32
124                     ;   constant led1_mask {{ 1 << led1_bit }}  
125     0001    led1_mask equ 1
126                     ;   constant led2_mask {{ 1 << led2_bit }}  
127     0002    led2_mask equ 2
128                     ;   constant led3_mask {{ 1 << led3_bit }}  
129     0004    led3_mask equ 4
130                     ;   constant led4_mask {{ 1 << led4_bit }}  
131     0001    led4_mask equ 1
132                     ;   constant led5_mask {{ 1 << led5_bit }}  
133     0002    led5_mask equ 2
134                     ;   constant led6_mask {{ 1 << led6_bit }}  
135     0008    led6_mask equ 8
136                     ;   constant led7_mask {{ 1 << led7_bit }}  
137     0010    led7_mask equ 16
138                     ;   constant led8_mask {{ 1 << led8_bit }}  
139     0010    led8_mask equ 16
140     0006    portb equ 6
141     0007    portc equ 7
142     0006    led0__byte equ 6
143     0005    led0__bit equ 5
144     0006    led1__byte equ 6
145     0000    led1__bit equ 0
146     0006    led2__byte equ 6
147     0001    led2__bit equ 1
148     0007    led3__byte equ 7
149     0002    led3__bit equ 2
150     0007    led4__byte equ 7
151     0000    led4__bit equ 0
152     0007    led5__byte equ 7
153     0001    led5__bit equ 1
154     0007    led6__byte equ 7
155     0003    led6__bit equ 3
156     0006    led7__byte equ 6
157     0004    led7__bit equ 4
158     0007    led8__byte equ 7
159     0004    led8__bit equ 4
160     0007    mode__byte equ 7
161     0005    mode__bit equ 5
162     0006    serial_out__byte equ 6
163     0002    serial_out__bit equ 2
164     0006    serial_in__byte equ 6
165     0003    serial_in__bit equ 3
166     0008    b_on equ global__variables__bank0+0
167     0009    c_on equ global__variables__bank0+1
168     000a    b_off equ global__variables__bank0+2
169     000b    c_off equ global__variables__bank0+3
170             
171                     ; procedure main start
172             main:
173     000c    main__variables__base equ global__variables__bank0+4
174     000c    main__bytes__base equ main__variables__base+0
175     0012    main__bits__base equ main__variables__base+6
176     0006    main__total__bytes equ 6
177     0011    main__117byte1 equ main__bytes__base+5
178     0011    main__108byte1 equ main__bytes__base+5
179     0011    main__111byte1 equ main__bytes__base+5
180                     ;   arguments_none  
181     000c    main__command equ main__bytes__base+0
182     000d    main__glitch equ main__bytes__base+1
183     000e    main__index equ main__bytes__base+2
184     000f    main__count1 equ main__bytes__base+3
185     0010    main__count2 equ main__bytes__base+4
186                     ; loop_forever ... start
187             main__103loop__forever:
188                     ; Strobe the LED ' s for 600 uS at 40 kHz :
189                     ; `count_down count1 20 ...' start
190 006  c14        movlw 20
191 007  02f        movwf main__count1
192             main__105_loop:
193                     ;   portb := 0xff  
194 008  cff        movlw 255
195 009  026        movwf portb
196                     ;   portc := 0xff  
197 00a  cff        movlw 255
198 00b  027        movwf portc
199                     ; nop {{ 13 - 4 }}
200                     ; Delay 9 cycles
201 00c  c02        movlw 2
202 00d  031        movwf main__108byte1
203             main__108delay0:
204 00e  2f1        decfsz main__108byte1,f
205 00f  a0e        goto main__108delay0
206 010  000        nop
207 011  000        nop
208                     ;   portb := 0  
209 012  066        clrf portb
210                     ;   portc := 0  
211 013  067        clrf portc
212                     ; nop {{ 12 - 2 - 3 }}
213                     ; Delay 7 cycles
214 014  c02        movlw 2
215 015  031        movwf main__111byte1
216             main__111delay0:
217 016  2f1        decfsz main__111byte1,f
218 017  a16        goto main__111delay0
219 018  2ef        decfsz main__count1,f
220 019  a08        goto main__105_loop
221             main__105_done:
222                     ; `count_down count1 20 ...' end
223                     ; Leave everything off for 100 mS :
224                     ; `count_down count2 200 ...' start
225 01a  cc8        movlw 200
226 01b  030        movwf main__count2
227             main__115_loop:
228                     ; `count_down count1 20 ...' start
229 01c  c14        movlw 20
230 01d  02f        movwf main__count1
231             main__116_loop:
232                     ; nop {{ 25 - 3 }}
233                     ; Delay 22 cycles
234 01e  c07        movlw 7
235 01f  031        movwf main__117byte1
236             main__117delay0:
237 020  2f1        decfsz main__117byte1,f
238 021  a20        goto main__117delay0
239 022  2ef        decfsz main__count1,f
240 023  a1e        goto main__116_loop
241             main__116_done:
242                     ; `count_down count1 20 ...' end
243 024  2f0        decfsz main__count2,f
244 025  a1c        goto main__115_loop
245             main__115_done:
246                     ; `count_down count2 200 ...' end
247 026  a06        goto main__103loop__forever
248                     ; loop_forever ... end
249                     ; procedure main end
250             
251                     ; Register bank 0 used 10 bytes of 24 available bytes
252                     ; Register bank 1 used 0 bytes of 16 available bytes
253                     ; Register bank 2 used 0 bytes of 16 available bytes
254                     ; Register bank 3 used 0 bytes of 16 available bytes
255             
256                     end

