  1                     radix dec
  2     000c    global__variables__bank0 equ 12
  3     00ff    global__variables__bank1 equ 255
  4     0028    global__bit__variables__bank0 equ 40
  5     00ff    global__bit__variables__bank1 equ 255
  6     0000    indf___register equ 0
  7     0002    pcl___register equ 2
  8     0003    c___byte equ 3
  9     0000    c___bit equ 0
 10     0003    z___byte equ 3
 11     0002    z___bit equ 2
 12     0003    rp0___byte equ 3
 13     0005    rp0___bit equ 5
 14     0003    rp1___byte equ 3
 15     0006    rp1___bit equ 6
 16     0003    irp___byte equ 3
 17     0007    irp___bit equ 7
 18     0085    trisa___register equ 0x85
 19     0086    trisb___register equ 0x86
 20     0004    fsr___register equ 4
 21     000a    pclath___register equ 10
 22                     org 0
 23             start:
 24 000 0000            nop
 25 001 0000            nop
 26 002 0000            nop
 27 003 2805            goto skip___interrupt
 28             interrupt___vector:
 29 004 0009            retfie
 30             skip___interrupt:
 31                     ; Initialize TRIS registers
 32 005 30e9            movlw 233
 33                     ; Switch from register bank 0 to register bank 1 (which contains trisa___register)
 34 006 1683            bsf rp0___byte,rp0___bit
 35                     ; Register bank is now 1
 36 007 0085            movwf trisa___register
 37 008 018a            clrf pclath___register
 38                     ; Switch from register bank 1 to register bank 0
 39 009 1283            bcf rp0___byte,rp0___bit
 40                     ; Register bank is now 0
 41 00a 2819            goto main
 42                     ; comment #############################################################################
 43                     ; comment {}
 44                     ; comment {Copyright < c > 1999 - 2001 by Wayne C . Gramlich .}
 45                     ; comment {All rights reserved .}
 46                     ; comment {}
 47                     ; comment {Permission to use , copy , modify , distribute , and sell this software}
 48                     ; comment {for any purpose is hereby granted without fee provided that the above}
 49                     ; comment {copyright notice and this permission are retained . The author makes}
 50                     ; comment {no representations about the suitability of this software for any purpose .}
 51                     ; comment {It is provided { as is } without express or implied warranty .}
 52                     ; comment {}
 53                     ; comment {This is a test harness for developing Robobricks . Basically it allows}
 54                     ; comment {the user to type in an 8 - bit number in octal and send it to a RoboBrick .}
 55                     ; comment {Any resulting data is read back and printed in octal . All communication}
 56                     ; comment {occurs at 2400 baud . See}
 57                     ; comment {}
 58                     ; comment {http : / / web . gramlich . net / projects / robobricks / harness / index . html}
 59                     ; comment {}
 60                     ; comment {for more details .}
 61                     ; comment {}
 62                     ; comment #############################################################################
 63                     ;   processor pic16f84 cp = off dp = off pwrte = disabled wdte = disabled fosc = xt  
 64                     ; 16377=0x3ff9 8199=0x2007
 65                     __config 16377
 66     2007    configuration___address equ 8199
 67                     ;   constant clock_rate 4000000  
 68     3d0900    clock_rate equ 4000000
 69                     ;   constant instruction_rate clock_rate / 4  
 70     f4240    instruction_rate equ 1000000
 71                     ;   constant baud_rate 2400  
 72     0960    baud_rate equ 2400
 73                     ;   constant instructions_per_bit instruction_rate / baud_rate  
 74     01a0    instructions_per_bit equ 416
 75                     ;   constant delays_per_bit 3  
 76     0003    delays_per_bit equ 3
 77                     ;   constant instructions_per_delay instructions_per_bit / delays_per_bit  
 78     008a    instructions_per_delay equ 138
 79                     ;   constant delay_count instructions_per_delay / 6  
 80     0017    delay_count equ 23
 81                     ;   constant sp 32  
 82     0020    sp equ 32
 83                     ;   constant cr 13  
 84     000d    cr equ 13
 85                     ;   constant lf 10  
 86     000a    lf equ 10
 87                     ; comment {Some bit definitions :}
 88                     ;   constant rx_slave_bit 0  
 89     0000    rx_slave_bit equ 0
 90                     ;   constant tx_slave_bit 1  
 91     0001    tx_slave_bit equ 1
 92                     ;   constant tx_master_bit 2  
 93     0002    tx_master_bit equ 2
 94                     ;   constant rx_master_bit 3  
 95     0003    rx_master_bit equ 3
 96                     ;   constant rx_slave_mask 1 << rx_slave_bit  
 97     0001    rx_slave_mask equ 1
 98                     ;   constant tx_slave_mask 1 << tx_slave_bit  
 99     0002    tx_slave_mask equ 2
100                     ;   constant rx_master_mask 1 << rx_master_bit  
101     0008    rx_master_mask equ 8
102                     ;   constant tx_master_mask 1 << tx_master_bit  
103     0004    tx_master_mask equ 4
104     0005    porta equ 5
105     0005    tx_master_pin__byte equ 5
106     0002    tx_master_pin__bit equ 2
107     0005    rx_master_pin__byte equ 5
108     0003    rx_master_pin__bit equ 3
109     0005    tx_slave_pin__byte equ 5
110     0001    tx_slave_pin__bit equ 1
111     0005    rx_slave_pin__byte equ 5
112     0000    rx_slave_pin__bit equ 0
113     0005    heart__byte equ 5
114     0004    heart__bit equ 4
115     0006    portb equ 6
116                     ;   constant space 0xff  
117     00ff    space equ 255
118                     ;   constant buffer_size 5  
119     0005    buffer_size equ 5
120                     ; string_constants Start
121             string___fetch:
122 00b 0082            movwf pcl___register
123                     ;   hello = 0s'Harness-A' , cr , lf  
124     0000    hello___string equ 0
125             hello:
126 00c 0782            addwf pcl___register,f
127                     ; Length = 11
128 00d 340b            retlw 11
129                     ; `Harness-A'
130 00e 3448            retlw 72
131 00f 3461            retlw 97
132 010 3472            retlw 114
133 011 346e            retlw 110
134 012 3465            retlw 101
135 013 3473            retlw 115
136 014 3473            retlw 115
137 015 342d            retlw 45
138 016 3441            retlw 65
139                     ; cr
140 017 340d            retlw 13
141                     ; lf
142 018 340a            retlw 10
143                     ; string__constants End
144             
145                     ; procedure main start
146             main:
147     000c    main__variables__base equ global__variables__bank0+0
148     000c    main__bytes__base equ main__variables__base+0
149     0016    main__bits__base equ main__variables__base+10
150     000a    main__total__bytes equ 10
151     0015    main__100byte0 equ main__bytes__base+9
152     0015    main__128byte0 equ main__bytes__base+9
153                     ;   arguments_none  
154                     ; Read a byte .
155     000c    main__char equ main__bytes__base+0
156     000d    main__number equ main__bytes__base+1
157     000e    main__count equ main__bytes__base+2
158     000f    main__index equ main__bytes__base+3
159     0010    main__buffer equ main__bytes__base+4
160                     ; Let all the capacitors charge up :
161                     ; `count_down index 250 ...' start
162 019 30fa            movlw 250
163 01a 008f            movwf main__index
164             main__74_loop:
165                     ;   call delay {{ }}  
166 01b 2135            call delay
167 01c 0b8f            decfsz main__index,f
168 01d 281b            goto main__74_loop
169             main__74_done:
170                     ; `count_down index 250 ...' end
171                     ; Print out a welcome message :
172                     ;   index := 0  
173 01e 018f            clrf main__index
174                     ; `while  index < hello . size  ...' start
175             main__80while__continue:
176 01f 300b            movlw 11
177 020 020f            subwf main__index,w
178                     ; expression=` index < hello . size ' exp_delay=2 true_delay=9  false_delay=2 true_size=10 false_size=1
179 021 1803            btfsc c___byte,c___bit
180 022 282c            goto main__80while__break
181                     ;   char := hello ~~ {{ index }}  
182 023 0a0f            incf main__index,w
183 024 018a            clrf pclath___register
184 025 200c            call hello
185 026 008c            movwf main__char
186                     ;   call master_send {{ char , tx_master_mask }}  
187 027 0097            movwf master_send__character
188 028 3004            movlw 4
189 029 20ac            call master_send
190                     ;   index := index + 1  
191 02a 0a8f            incf main__index,f
192 02b 281f            goto main__80while__continue
193                     ; if exp=` index < hello . size ' false goto
194                     ; Other expression=` index < hello . size ' delay=-1
195             main__80while__break:
196                     ; `while  index < hello . size  ...' end
197                     ; Main loop
198                     ;   number := 0  
199 02c 018d            clrf main__number
200                     ; loop_forever ... start
201             main__88loop__forever:
202                     ; Get a character :
203                     ;   tx_slave_pin := 1  
204 02d 1485            bsf tx_slave_pin__byte,tx_slave_pin__bit
205                     ;   char := master_get {{ }}  
206 02e 20a6            call master_get
207 02f 0816            movf master_get__0return__byte,w
208 030 008c            movwf main__char
209                     ; Delay 2 / 3 ' s of bit make sure that get_byte is done .
210                     ;   call delay {{ }}  
211 031 2135            call delay
212                     ;   call delay {{ }}  
213 032 2135            call delay
214                     ; if { 0c'0' <= char && char < {{ 0c'9' + 1 }} } start
215 033 3030            movlw 48
216 034 020c            subwf main__char,w
217                     ; expression=`0c'0' <= char' exp_delay=2 true_delay=-1  false_delay=1 true_size=103 false_size=1
218 035 1c03            btfss c___byte,c___bit
219 036 2847            goto and97__0false
220 037 303a            movlw 58
221 038 020c            subwf main__char,w
222                     ; expression=`char < {{ 0c'9' + 1 }}' exp_delay=2 true_delay=9  false_delay=-1 true_size=11 false_size=87
223 039 1803            btfsc c___byte,c___bit
224 03a 2847            goto label97__1false
225             label97__1true:
226             and97__0true:
227                     ; if { 0c'0' <= char && char < {{ 0c'9' + 1 }} } body start
228                     ; Do a multiply by 8 then add in digit :
229                     ;   call master_send {{ char }}  
230 03b 080c            movf main__char,w
231 03c 0097            movwf master_send__character
232 03d 20ac            call master_send
233                     ;   number := {{ number << 3 }} + char - 0c'0'  
234 03e 0d0d            rlf main__number,w
235 03f 0095            movwf main__100byte0
236 040 0d95            rlf main__100byte0,f
237 041 0d15            rlf main__100byte0,w
238 042 39f8            andlw 248
239 043 070c            addwf main__char,w
240 044 3ed0            addlw 208
241 045 008d            movwf main__number
242                     ; if { 0c'0' <= char && char < {{ 0c'9' + 1 }} } body end
243 046 289e            goto label97__1end
244             label97__1false:
245             and97__0false:
246 047 3073            movlw 115
247 048 020c            subwf main__char,w
248                     ; expression=`{ char = 0c's' }' exp_delay=2 true_delay=-1  false_delay=-1 true_size=8 false_size=74
249 049 1d03            btfss z___byte,z___bit
250 04a 2854            goto label101__0false
251             label101__0true:
252                     ; else_if { char = 0c's' } body start
253                     ; Send byte to brick , no wait :
254                     ; Echo command and send CRLF :
255                     ;   call master_send {{ char }}  
256 04b 080c            movf main__char,w
257 04c 0097            movwf master_send__character
258 04d 20ac            call master_send
259                     ;   call master_crlf {{ }}  
260 04e 209f            call master_crlf
261                     ; Ship the byte down to the brick :
262                     ;   call slave_send {{ number }}  
263 04f 080d            movf main__number,w
264 050 009e            movwf slave_send__data
265 051 20f1            call slave_send
266                     ;   number := 0  
267 052 018d            clrf main__number
268                     ; else_if { char = 0c's' } body end
269 053 289e            goto label101__0end
270             label101__0false:
271 054 3077            movlw 119
272 055 020c            subwf main__char,w
273                     ; expression=`{ char = 0c'w' }' exp_delay=2 true_delay=-1  false_delay=-1 true_size=37 false_size=32
274 056 1d03            btfss z___byte,z___bit
275 057 287e            goto label112__0false
276             label112__0true:
277                     ; else_if { char = 0c'w' } body start
278                     ; Send byte to brick , wait for results :
279                     ; Echo command and send CRLF :
280                     ;   call master_send {{ char }}  
281 058 080c            movf main__char,w
282 059 0097            movwf master_send__character
283 05a 20ac            call master_send
284                     ;   call master_crlf {{ }}  
285 05b 209f            call master_crlf
286                     ; Ship the byte down to the brick ...
287                     ;   call slave_send {{ number }}  
288 05c 080d            movf main__number,w
289 05d 009e            movwf slave_send__data
290 05e 20f1            call slave_send
291                     ;   number := 0  
292 05f 018d            clrf main__number
293                     ; call delay < >
294                     ; ... and wait for a response :
295                     ;   index := 0  
296 060 018f            clrf main__index
297                     ; `while  index < buffer_size  ...' start
298             main__127while__continue:
299 061 3005            movlw 5
300 062 020f            subwf main__index,w
301                     ; expression=` index < buffer_size ' exp_delay=2 true_delay=9  false_delay=2 true_size=10 false_size=1
302 063 1803            btfsc c___byte,c___bit
303 064 286f            goto main__127while__break
304                     ;   buffer ~~ {{ index }} := slave_get {{ }}  
305 065 20cb            call slave_get
306 066 081a            movf slave_get__0return__byte,w
307 067 0095            movwf main__128byte0
308 068 3010            movlw LOW main__buffer
309 069 070f            addwf main__index,w
310 06a 0084            movwf fsr___register
311 06b 0815            movf main__128byte0,w
312 06c 0080            movwf indf___register
313                     ;   index := index + 1  
314 06d 0a8f            incf main__index,f
315 06e 2861            goto main__127while__continue
316                     ; if exp=` index < buffer_size ' false goto
317                     ; Other expression=` index < buffer_size ' delay=-1
318             main__127while__break:
319                     ; `while  index < buffer_size  ...' end
320                     ;   index := 0  
321 06f 018f            clrf main__index
322                     ; `while  index < buffer_size  ...' start
323             main__133while__continue:
324 070 3005            movlw 5
325 071 020f            subwf main__index,w
326                     ; expression=` index < buffer_size ' exp_delay=2 true_delay=7  false_delay=2 true_size=8 false_size=1
327 072 1803            btfsc c___byte,c___bit
328 073 287c            goto main__133while__break
329                     ;   call master_octal {{ buffer ~~ {{ index }} }}  
330 074 3010            movlw LOW main__buffer
331 075 070f            addwf main__index,w
332 076 0084            movwf fsr___register
333 077 0800            movf indf___register,w
334 078 0098            movwf master_octal__number
335 079 20b2            call master_octal
336                     ;   index := index + 1  
337 07a 0a8f            incf main__index,f
338 07b 2870            goto main__133while__continue
339                     ; if exp=` index < buffer_size ' false goto
340                     ; Other expression=` index < buffer_size ' delay=-1
341             main__133while__break:
342                     ; `while  index < buffer_size  ...' end
343                     ; Terminate the output list
344                     ;   call master_crlf {{ }}  
345 07c 209f            call master_crlf
346                     ; else_if { char = 0c'w' } body end
347 07d 289e            goto label112__0end
348             label112__0false:
349 07e 3069            movlw 105
350 07f 020c            subwf main__char,w
351                     ; expression=`{ char = 0c'i' }' exp_delay=2 true_delay=-1  false_delay=-1 true_size=8 false_size=19
352 080 1d03            btfss z___byte,z___bit
353 081 288b            goto label140__0false
354             label140__0true:
355                     ; else_if { char = 0c'i' } body start
356                     ; Interrogate the slave RoboBrick :
357                     ; Initialize the id index :
358                     ;   call slave_send {{ 0xfd }}  
359 082 30fd            movlw 253
360 083 009e            movwf slave_send__data
361 084 20f1            call slave_send
362                     ; Get the first 8 bytes :
363                     ;   call slave_id8 {{ }}  
364 085 20d1            call slave_id8
365                     ; Get the next 8 bytes of random numbers :
366                     ;   call slave_id8 {{ }}  
367 086 20d1            call slave_id8
368                     ; Get the next 8 bytes of random numbers :
369                     ;   call slave_id8 {{ }}  
370 087 20d1            call slave_id8
371                     ; Get the slave brick name :
372                     ;   call slave_id_string {{ }}  
373 088 20e2            call slave_id_string
374                     ; Get the vendor name :
375                     ;   call slave_id_string {{ }}  
376 089 20e2            call slave_id_string
377                     ; else_if { char = 0c'i' } body end
378 08a 289e            goto label140__0end
379             label140__0false:
380 08b 30fc            movlw 252
381 08c 020c            subwf main__char,w
382                     ; expression=`{ char != 0xfc }' exp_delay=2 true_delay=-1  false_delay=0 true_size=15 false_size=0
383 08d 1903            btfsc z___byte,z___bit
384 08e 289e            goto label160__0end
385                     ; else_if { char != 0xfc } body start
386                     ; Just echo back the current number :
387                     ;   call master_send {{ 0c'<' }}  
388 08f 303c            movlw 60
389 090 0097            movwf master_send__character
390 091 20ac            call master_send
391                     ;   call master_octal {{ char }}  
392 092 080c            movf main__char,w
393 093 0098            movwf master_octal__number
394 094 20b2            call master_octal
395                     ;   call master_send {{ 0c'>' }}  
396 095 303e            movlw 62
397 096 0097            movwf master_send__character
398 097 20ac            call master_send
399                     ; Send a carriage - return line - feed :
400                     ;   call master_crlf {{ }}  
401 098 209f            call master_crlf
402                     ; Output the character in octal :
403                     ;   call master_octal {{ number }}  
404 099 080d            movf main__number,w
405 09a 0098            movwf master_octal__number
406 09b 20b2            call master_octal
407                     ; Send a carriage - return line - feed :
408                     ;   call master_crlf {{ }}  
409 09c 209f            call master_crlf
410                     ; Reset number
411                     ;   number := 0  
412 09d 018d            clrf main__number
413                     ; else_if { char != 0xfc } body end
414             label160__0end:
415                     ; if exp=` char != 0xfc ' empty false
416                     ; Other expression=`{ char != 0xfc }' delay=-1
417                     ; if exp=` char = 0c'i' ' generic
418             label140__0end:
419                     ; Other expression=`{ char = 0c'i' }' delay=-1
420                     ; if exp=` char = 0c'w' ' generic
421             label112__0end:
422                     ; Other expression=`{ char = 0c'w' }' delay=-1
423                     ; if exp=` char = 0c's' ' generic
424             label101__0end:
425                     ; Other expression=`{ char = 0c's' }' delay=-1
426                     ; if exp=`char < {{ 0c'9' + 1 }}' generic
427             label97__1end:
428                     ; Other expression=`char < {{ 0c'9' + 1 }}' delay=-1
429                     ; if exp=`0c'0' <= char' false goto
430                     ; Other expression=`0c'0' <= char' delay=-1
431             and97__0end:
432                     ; if { 0c'0' <= char && char < {{ 0c'9' + 1 }} } end
433 09e 282d            goto main__88loop__forever
434                     ; loop_forever ... end
435                     ; procedure main end
436             
437                     ; procedure master_crlf start
438             master_crlf:
439     0016    master_crlf__variables__base equ global__variables__bank0+10
440     0016    master_crlf__bytes__base equ master_crlf__variables__base+0
441     0016    master_crlf__bits__base equ master_crlf__variables__base+0
442     0000    master_crlf__total__bytes equ 0
443                     ;   arguments_none  
444                     ; This procedure will output a carriage - return line - feed
445                     ; to the master .
446                     ;   call master_send {{ cr }}  
447 09f 300d            movlw 13
448 0a0 0097            movwf master_send__character
449 0a1 20ac            call master_send
450                     ;   call master_send {{ lf }}  
451 0a2 300a            movlw 10
452 0a3 0097            movwf master_send__character
453 0a4 20ac            call master_send
454                     ; procedure master_crlf end
455 0a5 3400            retlw 0
456             
457                     ; procedure master_get start
458             master_get:
459     0016    master_get__variables__base equ global__variables__bank0+10
460     0016    master_get__bytes__base equ master_get__variables__base+0
461     0017    master_get__bits__base equ master_get__variables__base+1
462     0001    master_get__total__bytes equ 1
463                     ;   arguments_none  
464     0016    master_get__0return__byte equ master_get__bytes__base+0
465                     ; This procedure will get the next byte or return 0xfc if
466                     ; no byte is forthcoming .
467                     ;   return get_byte {{ rx_master_mask }}  
468 0a6 3008            movlw 8
469 0a7 009f            movwf get_byte__mask
470 0a8 20f7            call get_byte
471 0a9 0820            movf get_byte__0return__byte,w
472 0aa 0096            movwf master_get__0return__byte
473 0ab 3400            retlw 0
474                     ; procedure master_get end
475             
476                     ; procedure master_send start
477             master_send:
478     0017    master_send__variables__base equ global__variables__bank0+11
479     0017    master_send__bytes__base equ master_send__variables__base+0
480     0018    master_send__bits__base equ master_send__variables__base+1
481     0001    master_send__total__bytes equ 1
482     0017    master_send__character equ master_send__bytes__base+0
483                     ; This procedure will output < character > to the master .
484                     ;   call send_byte {{ character , tx_master_mask }}  
485 0ac 0817            movf master_send__character,w
486 0ad 00a3            movwf send_byte__char
487 0ae 3004            movlw 4
488 0af 00a4            movwf send_byte__mask
489 0b0 211a            call send_byte
490                     ; procedure master_send end
491 0b1 3400            retlw 0
492             
493                     ; procedure master_octal start
494             master_octal:
495     0018    master_octal__variables__base equ global__variables__bank0+12
496     0018    master_octal__bytes__base equ master_octal__variables__base+0
497     001a    master_octal__bits__base equ master_octal__variables__base+2
498     0002    master_octal__total__bytes equ 2
499     0019    master_octal__220byte0 equ master_octal__bytes__base+1
500     0019    master_octal__219byte0 equ master_octal__bytes__base+1
501     0018    master_octal__number equ master_octal__bytes__base+0
502                     ; This procedure will output < number > in octal to the tx port .
503                     ; Output the character in octal :
504                     ;   call master_send {{ {{ number >> 6 }} + 0c'0' }}  
505 0b2 0e18            swapf master_octal__number,w
506 0b3 0099            movwf master_octal__219byte0
507 0b4 0c99            rrf master_octal__219byte0,f
508 0b5 0c19            rrf master_octal__219byte0,w
509 0b6 3903            andlw 3
510 0b7 3e30            addlw 48
511 0b8 0097            movwf master_send__character
512 0b9 20ac            call master_send
513                     ;   call master_send {{ {{ {{ number >> 3 }} & 7 }} + 0c'0' }}  
514 0ba 0c18            rrf master_octal__number,w
515 0bb 0099            movwf master_octal__220byte0
516 0bc 0c99            rrf master_octal__220byte0,f
517 0bd 0c19            rrf master_octal__220byte0,w
518 0be 3907            andlw 7
519 0bf 3e30            addlw 48
520 0c0 0097            movwf master_send__character
521 0c1 20ac            call master_send
522                     ;   call master_send {{ {{ number & 7 }} + 0c'0' }}  
523 0c2 3007            movlw 7
524 0c3 0518            andwf master_octal__number,w
525 0c4 3e30            addlw 48
526 0c5 0097            movwf master_send__character
527 0c6 20ac            call master_send
528                     ;   call master_send {{ sp }}  
529 0c7 3020            movlw 32
530 0c8 0097            movwf master_send__character
531 0c9 20ac            call master_send
532                     ; procedure master_octal end
533 0ca 3400            retlw 0
534             
535                     ; procedure slave_get start
536             slave_get:
537     001a    slave_get__variables__base equ global__variables__bank0+14
538     001a    slave_get__bytes__base equ slave_get__variables__base+0
539     001b    slave_get__bits__base equ slave_get__variables__base+1
540     0001    slave_get__total__bytes equ 1
541                     ;   arguments_none  
542     001a    slave_get__0return__byte equ slave_get__bytes__base+0
543                     ; This procedure will get a byte from the slave or return 0xfc
544                     ; if no byte is forthcoming .
545                     ;   return get_byte {{ rx_slave_mask }}  
546 0cb 3001            movlw 1
547 0cc 009f            movwf get_byte__mask
548 0cd 20f7            call get_byte
549 0ce 0820            movf get_byte__0return__byte,w
550 0cf 009a            movwf slave_get__0return__byte
551 0d0 3400            retlw 0
552                     ; procedure slave_get end
553             
554                     ; procedure slave_id8 start
555             slave_id8:
556     001b    slave_id8__variables__base equ global__variables__bank0+15
557     001b    slave_id8__bytes__base equ slave_id8__variables__base+0
558     001c    slave_id8__bits__base equ slave_id8__variables__base+1
559     0001    slave_id8__total__bytes equ 1
560                     ;   arguments_none  
561                     ; This procedure will print out the next 8 bytes of data from
562                     ; the slave RoboBrick id bytes .
563     001b    slave_id8__counter equ slave_id8__bytes__base+0
564                     ; `count_down counter 8 ...' start
565 0d1 3008            movlw 8
566 0d2 009b            movwf slave_id8__counter
567             slave_id8__244_loop:
568                     ;   call master_octal {{ slave_id_next {{ }} }}  
569 0d3 20db            call slave_id_next
570 0d4 081c            movf slave_id_next__0return__byte,w
571 0d5 0098            movwf master_octal__number
572 0d6 20b2            call master_octal
573 0d7 0b9b            decfsz slave_id8__counter,f
574 0d8 28d3            goto slave_id8__244_loop
575             slave_id8__244_done:
576                     ; `count_down counter 8 ...' end
577                     ;   call master_crlf {{ }}  
578 0d9 209f            call master_crlf
579                     ; procedure slave_id8 end
580 0da 3400            retlw 0
581             
582                     ; procedure slave_id_next start
583             slave_id_next:
584     001c    slave_id_next__variables__base equ global__variables__bank0+16
585     001c    slave_id_next__bytes__base equ slave_id_next__variables__base+0
586     001d    slave_id_next__bits__base equ slave_id_next__variables__base+1
587     0001    slave_id_next__total__bytes equ 1
588                     ;   arguments_none  
589     001c    slave_id_next__0return__byte equ slave_id_next__bytes__base+0
590                     ; This procedure will return the next byte from the id bytes .
591                     ;   call slave_send {{ 0xfc }}  
592 0db 30fc            movlw 252
593 0dc 009e            movwf slave_send__data
594 0dd 20f1            call slave_send
595                     ;   return slave_get {{ }}  
596 0de 20cb            call slave_get
597 0df 081a            movf slave_get__0return__byte,w
598 0e0 009c            movwf slave_id_next__0return__byte
599 0e1 3400            retlw 0
600                     ; procedure slave_id_next end
601             
602                     ; procedure slave_id_string start
603             slave_id_string:
604     001d    slave_id_string__variables__base equ global__variables__bank0+17
605     001d    slave_id_string__bytes__base equ slave_id_string__variables__base+0
606     001e    slave_id_string__bits__base equ slave_id_string__variables__base+1
607     0001    slave_id_string__total__bytes equ 1
608                     ;   arguments_none  
609                     ; This procedure will return the string for the id bytes .
610     001d    slave_id_string__size equ slave_id_string__bytes__base+0
611                     ;   size := slave_id_next {{ }}  
612 0e2 20db            call slave_id_next
613 0e3 081c            movf slave_id_next__0return__byte,w
614 0e4 009d            movwf slave_id_string__size
615                     ;   call master_octal {{ size }}  
616 0e5 0098            movwf master_octal__number
617 0e6 20b2            call master_octal
618                     ; `count_down size size ...' start
619 0e7 081d            movf slave_id_string__size,w
620 0e8 009d            movwf slave_id_string__size
621             slave_id_string__270_loop:
622                     ;   call master_send {{ slave_id_next {{ }} }}  
623 0e9 20db            call slave_id_next
624 0ea 081c            movf slave_id_next__0return__byte,w
625 0eb 0097            movwf master_send__character
626 0ec 20ac            call master_send
627 0ed 0b9d            decfsz slave_id_string__size,f
628 0ee 28e9            goto slave_id_string__270_loop
629             slave_id_string__270_done:
630                     ; `count_down size size ...' end
631                     ;   call master_crlf {{ }}  
632 0ef 209f            call master_crlf
633                     ; procedure slave_id_string end
634 0f0 3400            retlw 0
635             
636                     ; procedure slave_send start
637             slave_send:
638     001e    slave_send__variables__base equ global__variables__bank0+18
639     001e    slave_send__bytes__base equ slave_send__variables__base+0
640     001f    slave_send__bits__base equ slave_send__variables__base+1
641     0001    slave_send__total__bytes equ 1
642     001e    slave_send__data equ slave_send__bytes__base+0
643                     ; This procedure will send one byte of < data > to the slave .
644                     ;   call send_byte {{ data , tx_slave_mask }}  
645 0f1 081e            movf slave_send__data,w
646 0f2 00a3            movwf send_byte__char
647 0f3 3002            movlw 2
648 0f4 00a4            movwf send_byte__mask
649 0f5 211a            call send_byte
650                     ; procedure slave_send end
651 0f6 3400            retlw 0
652             
653                     ; procedure get_byte start
654             get_byte:
655     001f    get_byte__variables__base equ global__variables__bank0+19
656     001f    get_byte__bytes__base equ get_byte__variables__base+0
657     0023    get_byte__bits__base equ get_byte__variables__base+4
658     0004    get_byte__total__bytes equ 4
659     001f    get_byte__mask equ get_byte__bytes__base+0
660     0020    get_byte__0return__byte equ get_byte__bytes__base+1
661                     ; Get an 8 - bit byte from < mask > bit of < porta > and return it .
662                     ; If no character shows up in a while 0xfc is returned .
663     0021    get_byte__count equ get_byte__bytes__base+2
664     0022    get_byte__char equ get_byte__bytes__base+3
665                     ; Wait until a start bit arrives :
666                     ;   count := 0  
667 0f7 01a1            clrf get_byte__count
668                     ; `while  porta & mask != 0  ...' start
669             get_byte__297while__continue:
670 0f8 0805            movf porta,w
671 0f9 051f            andwf get_byte__mask,w
672                     ; expression=` porta & mask != 0 ' exp_delay=2 true_delay=1  false_delay=2 true_size=9 false_size=1
673 0fa 1903            btfsc z___byte,z___bit
674 0fb 2905            goto get_byte__297while__break
675                     ;   count := count - 1  
676 0fc 03a1            decf get_byte__count,f
677                     ; if { count = 0 } start
678 0fd 0821            movf get_byte__count,w
679                     ; expression=`{ count = 0 }' exp_delay=1 true_delay=3  false_delay=0 true_size=3 false_size=0
680 0fe 1d03            btfss z___byte,z___bit
681 0ff 2903            goto label299__0end
682                     ; if { count = 0 } body start
683                     ;   return 0xfc  
684 100 30fc            movlw 252
685 101 00a0            movwf get_byte__0return__byte
686 102 3400            retlw 0
687                     ; if { count = 0 } body end
688             label299__0end:
689                     ; if exp=` count = 0 ' empty false
690                     ; Other expression=`{ count = 0 }' delay=-1
691                     ; if { count = 0 } end
692                     ;   call delay {{ }}  
693 103 2135            call delay
694 104 28f8            goto get_byte__297while__continue
695                     ; if exp=` porta & mask != 0 ' false goto
696                     ; Other expression=` porta & mask != 0 ' delay=-1
697             get_byte__297while__break:
698                     ; `while  porta & mask != 0  ...' end
699                     ; Skip over the start bit :
700                     ;   call delay {{ }}  
701 105 2135            call delay
702                     ;   call delay {{ }}  
703 106 2135            call delay
704                     ;   call delay {{ }}  
705 107 2135            call delay
706                     ; Sample in the middle third of each data bit :
707                     ;   char := 0  
708 108 01a2            clrf get_byte__char
709                     ; `count_down count 8 ...' start
710 109 3008            movlw 8
711 10a 00a1            movwf get_byte__count
712             get_byte__312_loop:
713                     ;   call delay {{ }}  
714 10b 2135            call delay
715                     ;   char := char >> 1  
716 10c 1003            bcf c___byte,c___bit
717 10d 0ca2            rrf get_byte__char,f
718                     ; if { porta & mask != 0 } start
719 10e 0805            movf porta,w
720 10f 051f            andwf get_byte__mask,w
721                     ; expression=`{ porta & mask != 0 }' exp_delay=2 true_delay=1  false_delay=0 true_size=1 false_size=0
722 110 1d03            btfss z___byte,z___bit
723                     ; if { porta & mask != 0 } body start
724                     ; char := char | 0x80
725                     ;   char @ 7 := 1  
726                     ; Select char @ 7
727     0022    get_byte__char__317select0 equ get_byte__char+0
728     0022    get_byte__char__317select0__byte equ get_byte__char+0
729     0007    get_byte__char__317select0__bit equ 7
730 111 17a2            bsf get_byte__char__317select0__byte,get_byte__char__317select0__bit
731                     ; if { porta & mask != 0 } body end
732                     ; if exp=` porta & mask != 0 ' false skip delay=4
733                     ; Other expression=`{ porta & mask != 0 }' delay=4
734                     ; if { porta & mask != 0 } end
735                     ;   call delay {{ }}  
736 112 2135            call delay
737                     ;   call delay {{ }}  
738 113 2135            call delay
739 114 0ba1            decfsz get_byte__count,f
740 115 290b            goto get_byte__312_loop
741             get_byte__312_done:
742                     ; `count_down count 8 ...' end
743                     ; Skip over 1 / 3 of the stop bit :
744                     ;   call delay {{ }}  
745 116 2135            call delay
746                     ;   return char  
747 117 0822            movf get_byte__char,w
748 118 00a0            movwf get_byte__0return__byte
749 119 3400            retlw 0
750                     ; procedure get_byte end
751             
752                     ; procedure send_byte start
753             send_byte:
754     0023    send_byte__variables__base equ global__variables__bank0+23
755     0023    send_byte__bytes__base equ send_byte__variables__base+0
756     0027    send_byte__bits__base equ send_byte__variables__base+4
757     0004    send_byte__total__bytes equ 4
758     0023    send_byte__char equ send_byte__bytes__base+0
759     0024    send_byte__mask equ send_byte__bytes__base+1
760                     ; Send < char > to < mask > bit of < porta > .
761     0025    send_byte__count equ send_byte__bytes__base+2
762     0026    send_byte__mark equ send_byte__bytes__base+3
763                     ; Send the start bit :
764                     ;   mark := mask ^ space  
765 11a 30ff            movlw 255
766 11b 0624            xorwf send_byte__mask,w
767 11c 00a6            movwf send_byte__mark
768                     ;   porta := mark  
769 11d 0085            movwf porta
770                     ;   call delay {{ }}  
771 11e 2135            call delay
772                     ;   call delay {{ }}  
773 11f 2135            call delay
774                     ;   call delay {{ }}  
775 120 2135            call delay
776                     ; Send the data :
777                     ; `count_down count 8 ...' start
778 121 3008            movlw 8
779 122 00a5            movwf send_byte__count
780             send_byte__347_loop:
781                     ; if { char @ 0 } start
782                     ; Alias variable for select char @ 0
783     0023    send_byte__char__348select0 equ send_byte__char+0
784     0023    send_byte__char__348select0__byte equ send_byte__char+0
785     0000    send_byte__char__348select0__bit equ 0
786                     ; expression=`{ char @ 0 }' exp_delay=0 true_delay=1  false_delay=1 true_size=1 false_size=1
787 123 1823            btfsc send_byte__char__348select0__byte,send_byte__char__348select0__bit
788                     ; if { char @ 0 } body start
789                     ;   porta := space  
790 124 30ff            movlw 255
791                     ; 1 instructions found for sharing
792 125 1c23            btfss send_byte__char__348select0__byte,send_byte__char__348select0__bit
793                     ; else body start
794                     ;   porta := mark  
795 126 0826            movf send_byte__mark,w
796                     ; 1 instructions found for sharing
797                     ; if exp=` char @ 0 ' single true and false skip delay=4
798                     ; Other expression=`{ char @ 0 }' delay=4
799                     ; 1 shared instructions follow
800 127 0085            movwf porta
801                     ; if { char @ 0 } end
802                     ;   char := char >> 1  
803 128 1003            bcf c___byte,c___bit
804 129 0ca3            rrf send_byte__char,f
805                     ;   call delay {{ }}  
806 12a 2135            call delay
807                     ;   call delay {{ }}  
808 12b 2135            call delay
809                     ;   call delay {{ }}  
810 12c 2135            call delay
811 12d 0ba5            decfsz send_byte__count,f
812 12e 2923            goto send_byte__347_loop
813             send_byte__347_done:
814                     ; `count_down count 8 ...' end
815                     ; Send the stop bit :
816                     ;   porta := space  
817 12f 30ff            movlw 255
818 130 0085            movwf porta
819                     ;   call delay {{ }}  
820 131 2135            call delay
821                     ;   call delay {{ }}  
822 132 2135            call delay
823                     ;   call delay {{ }}  
824 133 2135            call delay
825                     ; procedure send_byte end
826 134 3400            retlw 0
827             
828                     ; procedure delay start
829                     ; optimize 0
830             delay:
831     0027    delay__variables__base equ global__variables__bank0+27
832     0027    delay__bytes__base equ delay__variables__base+0
833     0028    delay__bits__base equ delay__variables__base+1
834     0001    delay__total__bytes equ 1
835     0027    delay__366byte1 equ delay__bytes__base+0
836                     ;   arguments_none  
837                     ;   uniform_delay instructions_per_delay  
838                     ; Uniform delay remaining = 134 Accumulated Delay = 0
839                     ; Uniform delay remaining = 134 Accumulated Delay = 0
840                     ; Delay 1 third of a bit :
841                     ; Uniform delay remaining = 134 Accumulated Delay = 0
842                     ; Uniform delay remaining = 134 Accumulated Delay = 0
843                     ; Soak up remaining 134 cycles
844                     ; Delay 134 cycles
845 135 302c            movlw 44
846 136 00a7            movwf delay__366byte1
847             delay__366delay0:
848 137 0ba7            decfsz delay__366byte1,f
849 138 2937            goto delay__366delay0
850 139 0000            nop
851                     ; procedure delay end
852 13a 3400            retlw 0
853                     ; optimize 1
854             
855                     ; Register bank 0 used 28 bytes of 68 available bytes
856                     ; Register bank 1 used 0 bytes of 0 available bytes
857             
858                     end

