  1                     radix dec
  2     000c    global__variables__bank0 equ 12
  3     00ff    global__variables__bank1 equ 255
  4     0043    global__bit__variables__bank0 equ 67
  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 284e            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 testing the LED10 RoboBrick . See :}
 54                     ; comment {}
 55                     ; comment {http : / / web . gramlich . net / projects / robobricks / led10 / index . html}
 56                     ; comment {}
 57                     ; comment {for more details .}
 58                     ; comment {}
 59                     ; comment #############################################################################
 60                     ;   processor pic16f84 cp = off dp = off pwrte = disabled wdte = disabled fosc = xt  
 61                     ; 16377=0x3ff9 8199=0x2007
 62                     __config 16377
 63     2007    configuration___address equ 8199
 64                     ;   constant clock_rate 4000000  
 65     3d0900    clock_rate equ 4000000
 66                     ;   constant instruction_rate clock_rate / 4  
 67     f4240    instruction_rate equ 1000000
 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                     ; comment {The null pulse that comes back from a clock pulse command is supposed to be}
 77                     ; comment {9 bits long . At 4 Mhz = 1 instruction per microsecond , 9 bits is 9 / 2400 =}
 78                     ; comment {3 . 75 ms . The count loop below is 7 instruction long . 3 . 75 / . 007 = 536 = 0x217 .}
 79                     ; comment {So we want our timer loop to get as close to 0x217 as possible .}
 80                     ;   constant clock_fudge 4  
 81     0004    clock_fudge equ 4
 82                     ;   constant clock_target 0x17 + clock_fudge  
 83     001b    clock_target equ 27
 84                     ;   constant sp 32  
 85     0020    sp equ 32
 86                     ;   constant cr 13  
 87     000d    cr equ 13
 88                     ;   constant lf 10  
 89     000a    lf equ 10
 90                     ; comment {Some bit definitions :}
 91                     ;   constant rx_slave_bit 0  
 92     0000    rx_slave_bit equ 0
 93                     ;   constant tx_slave_bit 1  
 94     0001    tx_slave_bit equ 1
 95                     ;   constant tx_master_bit 2  
 96     0002    tx_master_bit equ 2
 97                     ;   constant rx_master_bit 3  
 98     0003    rx_master_bit equ 3
 99                     ;   constant rx_slave_mask 1 << rx_slave_bit  
100     0001    rx_slave_mask equ 1
101                     ;   constant tx_slave_mask 1 << tx_slave_bit  
102     0002    tx_slave_mask equ 2
103                     ;   constant rx_master_mask 1 << rx_master_bit  
104     0008    rx_master_mask equ 8
105                     ;   constant tx_master_mask 1 << tx_master_bit  
106     0004    tx_master_mask equ 4
107     0003    status equ 3
108                     ;   bind c status @ 0  
109     0003    c equ status+0
110     0003    c__byte equ status+0
111     0000    c__bit equ 0
112                     ;   bind z status @ 2  
113     0003    z equ status+0
114     0003    z__byte equ status+0
115     0002    z__bit equ 2
116     0005    porta equ 5
117     0005    tx_master_pin__byte equ 5
118     0002    tx_master_pin__bit equ 2
119     0005    rx_master_pin__byte equ 5
120     0003    rx_master_pin__bit equ 3
121     0005    tx_slave_pin__byte equ 5
122     0001    tx_slave_pin__bit equ 1
123     0005    rx_slave_pin__byte equ 5
124     0000    rx_slave_pin__bit equ 0
125     0005    heart__byte equ 5
126     0004    heart__bit equ 4
127                     ;   constant space 0xff  
128     00ff    space equ 255
129                     ;   constant buffer_size 5  
130     0005    buffer_size equ 5
131                     ; string_constants Start
132             string___fetch:
133 00b 0082            movwf pcl___register
134                     ;   bit_string = 0s'Bit'  
135     0000    bit_string___string equ 0
136             bit_string:
137 00c 0782            addwf pcl___register,f
138                     ; Length = 3
139 00d 3403            retlw 3
140                     ; `Bit'
141 00e 3442            retlw 66
142 00f 3469            retlw 105
143 010 3474            retlw 116
144                     ;   blink_string = 0s'Blink'  
145     0005    blink_string___string equ 5
146             blink_string:
147 011 0782            addwf pcl___register,f
148                     ; Length = 5
149 012 3405            retlw 5
150                     ; `Blink'
151 013 3442            retlw 66
152 014 346c            retlw 108
153 015 3469            retlw 105
154 016 346e            retlw 110
155 017 346b            retlw 107
156                     ;   clock_string = 0s'Clk'  
157     000c    clock_string___string equ 12
158             clock_string:
159 018 0782            addwf pcl___register,f
160                     ; Length = 3
161 019 3403            retlw 3
162                     ; `Clk'
163 01a 3443            retlw 67
164 01b 346c            retlw 108
165 01c 346b            retlw 107
166                     ;   common_string = 0s'Common'  
167     0011    common_string___string equ 17
168             common_string:
169 01d 0782            addwf pcl___register,f
170                     ; Length = 6
171 01e 3406            retlw 6
172                     ; `Common'
173 01f 3443            retlw 67
174 020 346f            retlw 111
175 021 346d            retlw 109
176 022 346d            retlw 109
177 023 346f            retlw 111
178 024 346e            retlw 110
179                     ;   done_string = 0s'Done'  
180     0019    done_string___string equ 25
181             done_string:
182 025 0782            addwf pcl___register,f
183                     ; Length = 4
184 026 3404            retlw 4
185                     ; `Done'
186 027 3444            retlw 68
187 028 346f            retlw 111
188 029 346e            retlw 110
189 02a 3465            retlw 101
190                     ;   fail_string = 0s'Fail'  
191     001f    fail_string___string equ 31
192             fail_string:
193 02b 0782            addwf pcl___register,f
194                     ; Length = 4
195 02c 3404            retlw 4
196                     ; `Fail'
197 02d 3446            retlw 70
198 02e 3461            retlw 97
199 02f 3469            retlw 105
200 030 346c            retlw 108
201                     ;   hello_string = 0s'LED4_Test'  
202     0025    hello_string___string equ 37
203             hello_string:
204 031 0782            addwf pcl___register,f
205                     ; Length = 9
206 032 3409            retlw 9
207                     ; `LED4_Test'
208 033 344c            retlw 76
209 034 3445            retlw 69
210 035 3444            retlw 68
211 036 3434            retlw 52
212 037 345f            retlw 95
213 038 3454            retlw 84
214 039 3465            retlw 101
215 03a 3473            retlw 115
216 03b 3474            retlw 116
217                     ;   ramps = 0 , 1 , 0x10 , 0x80 , 0xff  
218     0030    ramps___string equ 48
219             ramps:
220 03c 0782            addwf pcl___register,f
221                     ; Length = 5
222 03d 3405            retlw 5
223                     ; 0
224 03e 3400            retlw 0
225                     ; 1
226 03f 3401            retlw 1
227                     ; 0x10
228 040 3410            retlw 16
229                     ; 0x80
230 041 3480            retlw 128
231                     ; 0xff
232 042 34ff            retlw 255
233                     ;   read_string = 0s'Read'  
234     0037    read_string___string equ 55
235             read_string:
236 043 0782            addwf pcl___register,f
237                     ; Length = 4
238 044 3404            retlw 4
239                     ; `Read'
240 045 3452            retlw 82
241 046 3465            retlw 101
242 047 3461            retlw 97
243 048 3464            retlw 100
244                     ;   register_string = 0s'Reg'  
245     003d    register_string___string equ 61
246             register_string:
247 049 0782            addwf pcl___register,f
248                     ; Length = 3
249 04a 3403            retlw 3
250                     ; `Reg'
251 04b 3452            retlw 82
252 04c 3465            retlw 101
253 04d 3467            retlw 103
254                     ; string__constants End
255             
256                     ; procedure main start
257             main:
258     000c    main__variables__base equ global__variables__bank0+0
259     000c    main__bytes__base equ main__variables__base+0
260     0016    main__bits__base equ main__variables__base+10
261     000a    main__total__bytes equ 10
262     0015    main__108byte0 equ main__bytes__base+9
263     0015    main__136byte0 equ main__bytes__base+9
264                     ;   arguments_none  
265                     ; Read a byte .
266     000c    main__buffer equ main__bytes__base+0
267     0011    main__char equ main__bytes__base+5
268     0012    main__count equ main__bytes__base+6
269     0013    main__index equ main__bytes__base+7
270     0014    main__number equ main__bytes__base+8
271                     ; Print out a welcome message :
272                     ;   call master_crlf {{ }}  
273 04e 22e7            call master_crlf
274                     ;   call master_string {{ hello_string }}  
275 04f 3032            movlw LOW hello_string+1
276 050 00bf            movwf master_string__message
277 051 236a            call master_string
278                     ;   call master_crlf {{ }}  
279 052 22e7            call master_crlf
280                     ; Main loop
281                     ;   number := 0  
282 053 0194            clrf main__number
283                     ; loop_forever ... start
284             main__96loop__forever:
285                     ; Get a character :
286                     ;   tx_slave_pin := 1  
287 054 1485            bsf tx_slave_pin__byte,tx_slave_pin__bit
288                     ;   char := master_get {{ }}  
289 055 22f9            call master_get
290 056 0831            movf master_get__0return__byte,w
291 057 0091            movwf main__char
292                     ; Delay 2 / 3 ' s of bit make sure that get_byte is done .
293                     ;   call delay {{ }}  
294 058 237d            call delay
295                     ;   call delay {{ }}  
296 059 237d            call delay
297                     ; if { 0c'0' <= char && char < {{ 0c'9' + 1 }} } start
298 05a 3030            movlw 48
299 05b 0211            subwf main__char,w
300                     ; expression=`0c'0' <= char' exp_delay=2 true_delay=-1  false_delay=1 true_size=127 false_size=1
301 05c 1c03            btfss c___byte,c___bit
302 05d 286e            goto and105__0false
303 05e 303a            movlw 58
304 05f 0211            subwf main__char,w
305                     ; expression=`char < {{ 0c'9' + 1 }}' exp_delay=2 true_delay=9  false_delay=-1 true_size=11 false_size=111
306 060 1803            btfsc c___byte,c___bit
307 061 286e            goto label105__1false
308             label105__1true:
309             and105__0true:
310                     ; if { 0c'0' <= char && char < {{ 0c'9' + 1 }} } body start
311                     ; Do a multiply by 8 then add in digit :
312                     ;   call master_send {{ char }}  
313 062 0811            movf main__char,w
314 063 00be            movwf master_send__character
315 064 2364            call master_send
316                     ;   number := {{ number << 3 }} + char - 0c'0'  
317 065 0d14            rlf main__number,w
318 066 0095            movwf main__108byte0
319 067 0d95            rlf main__108byte0,f
320 068 0d15            rlf main__108byte0,w
321 069 39f8            andlw 248
322 06a 0711            addwf main__char,w
323 06b 3ed0            addlw 208
324 06c 0094            movwf main__number
325                     ; if { 0c'0' <= char && char < {{ 0c'9' + 1 }} } body end
326 06d 28dd            goto label105__1end
327             label105__1false:
328             and105__0false:
329 06e 3073            movlw 115
330 06f 0211            subwf main__char,w
331                     ; expression=`{ char = 0c's' }' exp_delay=2 true_delay=-1  false_delay=-1 true_size=8 false_size=98
332 070 1d03            btfss z___byte,z___bit
333 071 287b            goto label109__0false
334             label109__0true:
335                     ; else_if { char = 0c's' } body start
336                     ; Send byte to brick , no wait :
337                     ; Echo command and send CRLF :
338                     ;   call master_send {{ char }}  
339 072 0811            movf main__char,w
340 073 00be            movwf master_send__character
341 074 2364            call master_send
342                     ;   call master_crlf {{ }}  
343 075 22e7            call master_crlf
344                     ; Ship the byte down to the brick :
345                     ;   call slave_send {{ number }}  
346 076 0814            movf main__number,w
347 077 00b5            movwf slave_send__data
348 078 231e            call slave_send
349                     ;   number := 0  
350 079 0194            clrf main__number
351                     ; else_if { char = 0c's' } body end
352 07a 28dd            goto label109__0end
353             label109__0false:
354 07b 3077            movlw 119
355 07c 0211            subwf main__char,w
356                     ; expression=`{ char = 0c'w' }' exp_delay=2 true_delay=-1  false_delay=-1 true_size=37 false_size=56
357 07d 1d03            btfss z___byte,z___bit
358 07e 28a5            goto label120__0false
359             label120__0true:
360                     ; else_if { char = 0c'w' } body start
361                     ; Send byte to brick , wait for results :
362                     ; Echo command and send CRLF :
363                     ;   call master_send {{ char }}  
364 07f 0811            movf main__char,w
365 080 00be            movwf master_send__character
366 081 2364            call master_send
367                     ;   call master_crlf {{ }}  
368 082 22e7            call master_crlf
369                     ; Ship the byte down to the brick ...
370                     ;   call slave_send {{ number }}  
371 083 0814            movf main__number,w
372 084 00b5            movwf slave_send__data
373 085 231e            call slave_send
374                     ;   number := 0  
375 086 0194            clrf main__number
376                     ; call delay < >
377                     ; ... and wait for a response :
378                     ;   index := 0  
379 087 0193            clrf main__index
380                     ; `while  index < buffer_size  ...' start
381             main__135while__continue:
382 088 3005            movlw 5
383 089 0213            subwf main__index,w
384                     ; expression=` index < buffer_size ' exp_delay=2 true_delay=9  false_delay=2 true_size=10 false_size=1
385 08a 1803            btfsc c___byte,c___bit
386 08b 2896            goto main__135while__break
387                     ;   buffer ~~ {{ index }} := slave_get {{ }}  
388 08c 2318            call slave_get
389 08d 0834            movf slave_get__0return__byte,w
390 08e 0095            movwf main__136byte0
391 08f 300c            movlw LOW main__buffer
392 090 0713            addwf main__index,w
393 091 0084            movwf fsr___register
394 092 0815            movf main__136byte0,w
395 093 0080            movwf indf___register
396                     ;   index := index + 1  
397 094 0a93            incf main__index,f
398 095 2888            goto main__135while__continue
399                     ; if exp=` index < buffer_size ' false goto
400                     ; Other expression=` index < buffer_size ' delay=-1
401             main__135while__break:
402                     ; `while  index < buffer_size  ...' end
403                     ;   index := 0  
404 096 0193            clrf main__index
405                     ; `while  index < buffer_size  ...' start
406             main__141while__continue:
407 097 3005            movlw 5
408 098 0213            subwf main__index,w
409                     ; expression=` index < buffer_size ' exp_delay=2 true_delay=7  false_delay=2 true_size=8 false_size=1
410 099 1803            btfsc c___byte,c___bit
411 09a 28a3            goto main__141while__break
412                     ;   call master_octal {{ buffer ~~ {{ index }} }}  
413 09b 300c            movlw LOW main__buffer
414 09c 0713            addwf main__index,w
415 09d 0084            movwf fsr___register
416 09e 0800            movf indf___register,w
417 09f 00b2            movwf master_octal__number
418 0a0 22ff            call master_octal
419                     ;   index := index + 1  
420 0a1 0a93            incf main__index,f
421 0a2 2897            goto main__141while__continue
422                     ; if exp=` index < buffer_size ' false goto
423                     ; Other expression=` index < buffer_size ' delay=-1
424             main__141while__break:
425                     ; `while  index < buffer_size  ...' end
426                     ; Terminate the output list
427                     ;   call master_crlf {{ }}  
428 0a3 22e7            call master_crlf
429                     ; else_if { char = 0c'w' } body end
430 0a4 28dd            goto label120__0end
431             label120__0false:
432 0a5 3069            movlw 105
433 0a6 0211            subwf main__char,w
434                     ; expression=`{ char = 0c'i' }' exp_delay=2 true_delay=-1  false_delay=-1 true_size=12 false_size=39
435 0a7 1d03            btfss z___byte,z___bit
436 0a8 28b6            goto label148__0false
437             label148__0true:
438                     ; else_if { char = 0c'i' } body start
439                     ; Interrogate the slave RoboBrick :
440                     ;   call master_send {{ char }}  
441 0a9 0811            movf main__char,w
442 0aa 00be            movwf master_send__character
443 0ab 2364            call master_send
444                     ;   call master_crlf {{ }}  
445 0ac 22e7            call master_crlf
446                     ; Initialize the id index :
447                     ;   call slave_send {{ 0xfd }}  
448 0ad 30fd            movlw 253
449 0ae 00b5            movwf slave_send__data
450 0af 231e            call slave_send
451                     ; Get the first 8 bytes :
452                     ;   call common_test_id_bytes8 {{ }}  
453 0b0 22cb            call common_test_id_bytes8
454                     ; Get the next 8 bytes of random numbers :
455                     ;   call common_test_id_bytes8 {{ }}  
456 0b1 22cb            call common_test_id_bytes8
457                     ; Get the next 8 bytes of random numbers :
458                     ;   call common_test_id_bytes8 {{ }}  
459 0b2 22cb            call common_test_id_bytes8
460                     ; Get the slave brick name :
461                     ;   call common_test_id_string {{ }}  
462 0b3 22d5            call common_test_id_string
463                     ; Get the vendor name :
464                     ;   call common_test_id_string {{ }}  
465 0b4 22d5            call common_test_id_string
466                     ; else_if { char = 0c'i' } body end
467 0b5 28dd            goto label148__0end
468             label148__0false:
469 0b6 3074            movlw 116
470 0b7 0211            subwf main__char,w
471                     ; expression=`{ char = 0c't' }' exp_delay=2 true_delay=-1  false_delay=-1 true_size=5 false_size=29
472 0b8 1d03            btfss z___byte,z___bit
473 0b9 28c0            goto label171__0false
474             label171__0true:
475                     ; else_if { char = 0c't' } body start
476                     ; Do testing :
477                     ;   call master_send {{ char }}  
478 0ba 0811            movf main__char,w
479 0bb 00be            movwf master_send__character
480 0bc 2364            call master_send
481                     ;   call master_crlf {{ }}  
482 0bd 22e7            call master_crlf
483                     ;   call test {{ }}  
484 0be 214f            call test
485                     ; else_if { char = 0c't' } body end
486 0bf 28dd            goto label171__0end
487             label171__0false:
488 0c0 3063            movlw 99
489 0c1 0211            subwf main__char,w
490                     ; expression=`{ char = 0c'c' }' exp_delay=2 true_delay=-1  false_delay=-1 true_size=5 false_size=19
491 0c2 1d03            btfss z___byte,z___bit
492 0c3 28ca            goto label176__0false
493             label176__0true:
494                     ; else_if { char = 0c'c' } body start
495                     ;   call master_send {{ char }}  
496 0c4 0811            movf main__char,w
497 0c5 00be            movwf master_send__character
498 0c6 2364            call master_send
499                     ;   call master_crlf {{ }}  
500 0c7 22e7            call master_crlf
501                     ;   call clock_adjust {{ }}  
502 0c8 20de            call clock_adjust
503                     ; else_if { char = 0c'c' } body end
504 0c9 28dd            goto label176__0end
505             label176__0false:
506 0ca 30fc            movlw 252
507 0cb 0211            subwf main__char,w
508                     ; expression=`{ char != 0xfc }' exp_delay=2 true_delay=-1  false_delay=0 true_size=15 false_size=0
509 0cc 1903            btfsc z___byte,z___bit
510 0cd 28dd            goto label181__0end
511                     ; else_if { char != 0xfc } body start
512                     ; Just echo back the current number :
513                     ;   call master_send {{ 0c'<' }}  
514 0ce 303c            movlw 60
515 0cf 00be            movwf master_send__character
516 0d0 2364            call master_send
517                     ;   call master_octal {{ char }}  
518 0d1 0811            movf main__char,w
519 0d2 00b2            movwf master_octal__number
520 0d3 22ff            call master_octal
521                     ;   call master_send {{ 0c'>' }}  
522 0d4 303e            movlw 62
523 0d5 00be            movwf master_send__character
524 0d6 2364            call master_send
525                     ; Send a carriage - return line - feed :
526                     ;   call master_crlf {{ }}  
527 0d7 22e7            call master_crlf
528                     ; Output the character in octal :
529                     ;   call master_octal {{ number }}  
530 0d8 0814            movf main__number,w
531 0d9 00b2            movwf master_octal__number
532 0da 22ff            call master_octal
533                     ; Send a carriage - return line - feed :
534                     ;   call master_crlf {{ }}  
535 0db 22e7            call master_crlf
536                     ; Reset number
537                     ;   number := 0  
538 0dc 0194            clrf main__number
539                     ; else_if { char != 0xfc } body end
540             label181__0end:
541                     ; if exp=` char != 0xfc ' empty false
542                     ; Other expression=`{ char != 0xfc }' delay=-1
543                     ; if exp=` char = 0c'c' ' generic
544             label176__0end:
545                     ; Other expression=`{ char = 0c'c' }' delay=-1
546                     ; if exp=` char = 0c't' ' generic
547             label171__0end:
548                     ; Other expression=`{ char = 0c't' }' delay=-1
549                     ; if exp=` char = 0c'i' ' generic
550             label148__0end:
551                     ; Other expression=`{ char = 0c'i' }' delay=-1
552                     ; if exp=` char = 0c'w' ' generic
553             label120__0end:
554                     ; Other expression=`{ char = 0c'w' }' delay=-1
555                     ; if exp=` char = 0c's' ' generic
556             label109__0end:
557                     ; Other expression=`{ char = 0c's' }' delay=-1
558                     ; if exp=`char < {{ 0c'9' + 1 }}' generic
559             label105__1end:
560                     ; Other expression=`char < {{ 0c'9' + 1 }}' delay=-1
561                     ; if exp=`0c'0' <= char' false goto
562                     ; Other expression=`0c'0' <= char' delay=-1
563             and105__0end:
564                     ; if { 0c'0' <= char && char < {{ 0c'9' + 1 }} } end
565 0dd 2854            goto main__96loop__forever
566                     ; loop_forever ... end
567                     ; procedure main end
568             
569                     ; procedure clock_adjust start
570             clock_adjust:
571     0016    clock_adjust__variables__base equ global__variables__bank0+10
572     0016    clock_adjust__bytes__base equ clock_adjust__variables__base+0
573     001d    clock_adjust__bits__base equ clock_adjust__variables__base+7
574     0007    clock_adjust__total__bytes equ 7
575     001c    clock_adjust__266byte0 equ clock_adjust__bytes__base+6
576                     ;   arguments_none  
577                     ; This procedure will adjust the clock to the slave .
578     0016    clock_adjust__command equ clock_adjust__bytes__base+0
579     0017    clock_adjust__count equ clock_adjust__bytes__base+1
580     0018    clock_adjust__error equ clock_adjust__bytes__base+2
581     0019    clock_adjust__error_minimum equ clock_adjust__bytes__base+3
582     001a    clock_adjust__high equ clock_adjust__bytes__base+4
583     001b    clock_adjust__low equ clock_adjust__bytes__base+5
584                     ;   call master_string {{ clock_string }}  
585 0de 3019            movlw LOW clock_string+1
586 0df 00bf            movwf master_string__message
587 0e0 236a            call master_string
588                     ;   call master_crlf {{ }}  
589 0e1 22e7            call master_crlf
590                     ;   count := 4  
591 0e2 3004            movlw 4
592 0e3 0097            movwf clock_adjust__count
593                     ;   error := 0xff  
594 0e4 30ff            movlw 255
595 0e5 0098            movwf clock_adjust__error
596                     ;   error_minimum := 0xf0  
597 0e6 30f0            movlw 240
598 0e7 0099            movwf clock_adjust__error_minimum
599                     ; loop_forever ... start
600             clock_adjust__221loop__forever:
601                     ; Print out the clock value :
602                     ;   call master_send {{ 0c'C' }}  
603 0e8 3043            movlw 67
604 0e9 00be            movwf master_send__character
605 0ea 2364            call master_send
606                     ;   call slave_send {{ 0xfa }}  
607 0eb 30fa            movlw 250
608 0ec 00b5            movwf slave_send__data
609 0ed 231e            call slave_send
610                     ;   call master_octal {{ slave_get {{ }} }}  
611 0ee 2318            call slave_get
612 0ef 0834            movf slave_get__0return__byte,w
613 0f0 00b2            movwf master_octal__number
614 0f1 22ff            call master_octal
615                     ; Ask for a timing byte :
616                     ;   call slave_send {{ 0xfb }}  
617 0f2 30fb            movlw 251
618 0f3 00b5            movwf slave_send__data
619 0f4 231e            call slave_send
620                     ;   low := 0  
621 0f5 019b            clrf clock_adjust__low
622                     ;   high := 0  
623 0f6 019a            clrf clock_adjust__high
624                     ; `while rx_slave_pin ...' start
625             clock_adjust__232while__continue:
626                     ; expression=`rx_slave_pin' exp_delay=0 true_delay=2  false_delay=2 true_size=1 false_size=1
627 0f7 1805            btfsc rx_slave_pin__byte,rx_slave_pin__bit
628                     ; Do nothing :
629 0f8 28f7            goto clock_adjust__232while__continue
630 0f9 28fa            goto clock_adjust__232while__break
631                     ; if exp=`rx_slave_pin' true goto small true
632             clock_adjust__232while__break:
633                     ; `while rx_slave_pin ...' end
634                     ; `while  ! rx_slave_pin  ...' start
635             clock_adjust__235while__continue:
636                     ; expression=`rx_slave_pin' exp_delay=0 true_delay=2  false_delay=5 true_size=1 false_size=4
637 0fa 1805            btfsc rx_slave_pin__byte,rx_slave_pin__bit
638 0fb 2900            goto clock_adjust__235while__break
639                     ;   low := low + 1  
640 0fc 0a9b            incf clock_adjust__low,f
641                     ; if { z } start
642                     ; expression=`{ z }' exp_delay=0 true_delay=1  false_delay=0 true_size=1 false_size=0
643 0fd 1903            btfsc z__byte,z__bit
644                     ; if { z } body start
645                     ;   high := high + 1  
646 0fe 0a9a            incf clock_adjust__high,f
647                     ; if { z } body end
648                     ; if exp=`z' false skip delay=2
649                     ; Other expression=`{ z }' delay=2
650                     ; if { z } end
651 0ff 28fa            goto clock_adjust__235while__continue
652                     ; if exp=`rx_slave_pin' true goto
653                     ; Other expression=`rx_slave_pin' delay=-1
654             clock_adjust__235while__break:
655                     ; `while  ! rx_slave_pin  ...' end
656                     ; Print out high and low :
657                     ;   call master_send {{ 0c'H' }}  
658 100 3048            movlw 72
659 101 00be            movwf master_send__character
660 102 2364            call master_send
661                     ;   call master_octal {{ high }}  
662 103 081a            movf clock_adjust__high,w
663 104 00b2            movwf master_octal__number
664 105 22ff            call master_octal
665                     ;   call master_send {{ 0c'L' }}  
666 106 304c            movlw 76
667 107 00be            movwf master_send__character
668 108 2364            call master_send
669                     ;   call master_octal {{ low }}  
670 109 081b            movf clock_adjust__low,w
671 10a 00b2            movwf master_octal__number
672 10b 22ff            call master_octal
673                     ; If high is less than 2 , things are probably pretty broken .
674                     ; We ' ll try a little fix here , but we are probably pretty
675                     ; screwed up .
676                     ; if { high < 2 } start
677 10c 3002            movlw 2
678 10d 021a            subwf clock_adjust__high,w
679                     ; expression=`{ high < 2 }' exp_delay=2 true_delay=1  false_delay=0 true_size=1 false_size=0
680 10e 1c03            btfss c___byte,c___bit
681                     ; if { high < 2 } body start
682                     ;   low := 0  
683 10f 019b            clrf clock_adjust__low
684                     ; if { high < 2 } body end
685                     ; if exp=` high < 2 ' false skip delay=4
686                     ; Other expression=`{ high < 2 }' delay=4
687                     ; if { high < 2 } end
688                     ; Now think about adjusting clock .
689                     ; if { low > clock_target } start
690 110 301c            movlw 28
691 111 021b            subwf clock_adjust__low,w
692                     ; expression=`{ low > clock_target }' exp_delay=2 true_delay=5  false_delay=-1 true_size=5 false_size=15
693 112 1803            btfsc c___byte,c___bit
694 113 2924            goto label256__0true
695             label256__0false:
696 114 301b            movlw 27
697 115 021b            subwf clock_adjust__low,w
698                     ; expression=`{ low < clock_target }' exp_delay=2 true_delay=7  false_delay=3 true_size=7 false_size=3
699 116 1c03            btfss c___byte,c___bit
700 117 291c            goto label263__0true
701             label263__0false:
702                     ; else body start
703                     ; call master_send < 0c'x' >
704                     ;   command := 0  
705 118 0196            clrf clock_adjust__command
706                     ;   error := 0  
707 119 0198            clrf clock_adjust__error
708                     ;   error_minimum := 0  
709 11a 0199            clrf clock_adjust__error_minimum
710                     ; else body end
711 11b 2923            goto label263__0end
712             label263__0true:
713                     ; else_if { low < clock_target } body start
714                     ; call master_send < 0c'-' >
715                     ; Slave clock is too fast < i . e . pulse too short . >
716                     ;   error := clock_target - low  
717 11c 301b            movlw 27
718 11d 009c            movwf clock_adjust__266byte0
719 11e 081b            movf clock_adjust__low,w
720 11f 021c            subwf clock_adjust__266byte0,w
721 120 0098            movwf clock_adjust__error
722                     ; Decrement clock :
723                     ;   command := 0xf8  
724 121 30f8            movlw 248
725 122 0096            movwf clock_adjust__command
726                     ; call slave_send < 0xf8 >
727                     ; else_if { low < clock_target } body end
728                     ; if exp=` low < clock_target ' generic
729             label263__0end:
730                     ; Other expression=`{ low < clock_target }' delay=-1
731 123 2929            goto label256__0end
732             label256__0true:
733                     ; if { low > clock_target } body start
734                     ; call master_send < 0c'+' >
735                     ; Slave clock is too slow < i . e . pulse too long . >
736                     ;   error := low - clock_target  
737 124 30e5            movlw 229
738 125 071b            addwf clock_adjust__low,w
739 126 0098            movwf clock_adjust__error
740                     ; Increment clock :
741                     ;   command := 0xf9  
742 127 30f9            movlw 249
743 128 0096            movwf clock_adjust__command
744                     ; call slave_send < 0xf9 >
745                     ; if { low > clock_target } body end
746                     ; if exp=` low > clock_target ' generic
747             label256__0end:
748                     ; Other expression=`{ low > clock_target }' delay=-1
749                     ; if { low > clock_target } end
750                     ; Print out the error and error minimum :
751                     ;   call master_send {{ 0c'E' }}  
752 129 3045            movlw 69
753 12a 00be            movwf master_send__character
754 12b 2364            call master_send
755                     ;   call master_octal {{ error }}  
756 12c 0818            movf clock_adjust__error,w
757 12d 00b2            movwf master_octal__number
758 12e 22ff            call master_octal
759                     ;   call master_send {{ 0c'M' }}  
760 12f 304d            movlw 77
761 130 00be            movwf master_send__character
762 131 2364            call master_send
763                     ;   call master_octal {{ error_minimum }}  
764 132 0819            movf clock_adjust__error_minimum,w
765 133 00b2            movwf master_octal__number
766 134 22ff            call master_octal
767                     ; if { error = error_minimum } start
768 135 0818            movf clock_adjust__error,w
769 136 0219            subwf clock_adjust__error_minimum,w
770                     ; expression=`{ error = error_minimum }' exp_delay=2 true_delay=-1  false_delay=-1 true_size=2 false_size=14
771 137 1d03            btfss z___byte,z___bit
772 138 293c            goto label283__0false
773             label283__0true:
774                     ; if { error = error_minimum } body start
775                     ;   call master_crlf {{ }}  
776 139 22e7            call master_crlf
777                     ;   return  
778 13a 3400            retlw 0
779                     ; if { error = error_minimum } body end
780 13b 294a            goto label283__0end
781             label283__0false:
782 13c 0819            movf clock_adjust__error_minimum,w
783 13d 0218            subwf clock_adjust__error,w
784                     ; expression=`{ error < error_minimum }' exp_delay=2 true_delay=3  false_delay=-1 true_size=3 false_size=6
785 13e 1c03            btfss c___byte,c___bit
786 13f 2947            goto label286__0true
787             label286__0false:
788                     ; else body start
789                     ;   count := count - 1  
790 140 0397            decf clock_adjust__count,f
791                     ; if { z } start
792                     ; expression=`{ z }' exp_delay=0 true_delay=3  false_delay=0 true_size=3 false_size=0
793 141 1d03            btfss z__byte,z__bit
794 142 2946            goto label291__0end
795                     ; if { z } body start
796                     ;   error_minimum := error_minimum + 1  
797 143 0a99            incf clock_adjust__error_minimum,f
798                     ;   count := 4  
799 144 3004            movlw 4
800 145 0097            movwf clock_adjust__count
801                     ; if { z } body end
802             label291__0end:
803                     ; if exp=`z' empty false
804                     ; Other expression=`{ z }' delay=-1
805                     ; if { z } end
806                     ; else body end
807 146 294a            goto label286__0end
808             label286__0true:
809                     ; else_if { error < error_minimum } body start
810                     ;   error_minimum := error  
811 147 0818            movf clock_adjust__error,w
812 148 0099            movwf clock_adjust__error_minimum
813                     ;   error := error + 1  
814 149 0a98            incf clock_adjust__error,f
815                     ; else_if { error < error_minimum } body end
816                     ; if exp=` error < error_minimum ' generic
817             label286__0end:
818                     ; Other expression=`{ error < error_minimum }' delay=-1
819                     ; if exp=` error = error_minimum ' generic
820             label283__0end:
821                     ; Other expression=`{ error = error_minimum }' delay=-1
822                     ; if { error = error_minimum } end
823                     ; Now adjust the clock :
824                     ;   call slave_send {{ command }}  
825 14a 0816            movf clock_adjust__command,w
826 14b 00b5            movwf slave_send__data
827 14c 231e            call slave_send
828                     ;   call master_crlf {{ }}  
829 14d 22e7            call master_crlf
830 14e 28e8            goto clock_adjust__221loop__forever
831                     ; loop_forever ... end
832                     ; procedure clock_adjust end
833             
834                     ; procedure test start
835             test:
836     001d    test__variables__base equ global__variables__bank0+17
837     001d    test__bytes__base equ test__variables__base+0
838     0022    test__bits__base equ test__variables__base+5
839     0005    test__total__bytes equ 5
840     0021    test__390byte0 equ test__bytes__base+4
841                     ;   arguments_none  
842                     ; This procedure will test the LED10 RoboBrick :
843     001d    test__bit equ test__bytes__base+0
844     001e    test__leds equ test__bytes__base+1
845     001f    test__temp equ test__bytes__base+2
846     0020    test__pattern equ test__bytes__base+3
847                     ; Adjust the clock :
848                     ;   call clock_adjust {{ }}  
849 14f 20de            call clock_adjust
850                     ; Verify that the common commands are working :
851                     ;   call common_test {{ }}  
852 150 224b            call common_test
853                     ; Clear the LEDS :
854                     ;   call slave_send {{ 0 }}  
855 151 01b5            clrf slave_send__data
856 152 231e            call slave_send
857                     ;   call test_prompt {{ 0 }}  
858 153 01a4            clrf test_prompt__leds
859 154 222f            call test_prompt
860                     ; Let ' s do some simple testing first :
861                     ;   leds := 1  
862 155 3001            movlw 1
863 156 009e            movwf test__leds
864                     ; `while  ! {{ leds @ 4 }}  ...' start
865             test__327while__continue:
866                     ; Alias variable for select leds @ 4
867     001e    test__leds__327select0 equ test__leds+0
868     001e    test__leds__327select0__byte equ test__leds+0
869     0004    test__leds__327select0__bit equ 4
870                     ; expression=`{{ leds @ 4 }}' exp_delay=0 true_delay=2  false_delay=7 true_size=1 false_size=12
871 157 1a1e            btfsc test__leds__327select0__byte,test__leds__327select0__bit
872 158 2965            goto test__327while__break
873                     ; Set the bits :
874                     ;   call slave_send {{ leds }}  
875 159 081e            movf test__leds,w
876 15a 00b5            movwf slave_send__data
877 15b 231e            call slave_send
878                     ;   call test_prompt {{ leds }}  
879 15c 081e            movf test__leds,w
880 15d 00a4            movwf test_prompt__leds
881 15e 222f            call test_prompt
882                     ;   call test_verify {{ leds }}  
883 15f 081e            movf test__leds,w
884 160 00a2            movwf test_verify__leds
885 161 221a            call test_verify
886                     ;   leds := leds << 1  
887 162 1003            bcf c___byte,c___bit
888 163 0d9e            rlf test__leds,f
889 164 2957            goto test__327while__continue
890                     ; if exp=` leds @ 4 ' true goto
891                     ; Other expression=`{{ leds @ 4 }}' delay=-1
892             test__327while__break:
893                     ; `while  ! {{ leds @ 4 }}  ...' end
894                     ; Clear the leds :
895                     ;   call slave_send {{ 0 }}  
896 165 01b5            clrf slave_send__data
897 166 231e            call slave_send
898                     ; Let ' s test out the bit twiddle commands :
899                     ;   call master_string {{ bit_string }}  
900 167 300d            movlw LOW bit_string+1
901 168 00bf            movwf master_string__message
902 169 236a            call master_string
903                     ;   call master_crlf {{ }}  
904 16a 22e7            call master_crlf
905                     ;   bit := 0  
906 16b 019d            clrf test__bit
907                     ;   leds := 1  
908 16c 3001            movlw 1
909 16d 009e            movwf test__leds
910                     ; `while  bit < 4  ...' start
911             test__343while__continue:
912 16e 3004            movlw 4
913 16f 021d            subwf test__bit,w
914                     ; expression=` bit < 4 ' exp_delay=2 true_delay=1  false_delay=2 true_size=72 false_size=1
915 170 1803            btfsc c___byte,c___bit
916 171 29b9            goto test__343while__break
917                     ; Bit set :
918                     ;   call slave_send {{ 0x14 | bit }}  
919 172 3014            movlw 20
920 173 041d            iorwf test__bit,w
921 174 00b5            movwf slave_send__data
922 175 231e            call slave_send
923                     ;   call test_verify {{ leds }}  
924 176 081e            movf test__leds,w
925 177 00a2            movwf test_verify__leds
926 178 221a            call test_verify
927                     ; Read the bit :
928                     ;   call slave_send {{ 0x1c | bit }}  
929 179 301c            movlw 28
930 17a 041d            iorwf test__bit,w
931 17b 00b5            movwf slave_send__data
932 17c 231e            call slave_send
933                     ;   temp := slave_get {{ }}  
934 17d 2318            call slave_get
935 17e 0834            movf slave_get__0return__byte,w
936 17f 009f            movwf test__temp
937                     ; if { temp != 1 } start
938 180 031f            decf test__temp,w
939                     ; expression=`{ temp != 1 }' exp_delay=1 true_delay=5  false_delay=0 true_size=11 false_size=0
940 181 1903            btfsc z___byte,z___bit
941 182 298e            goto label351__0end
942                     ; if { temp != 1 } body start
943                     ;   call master_octal {{ bit }}  
944 183 081d            movf test__bit,w
945 184 00b2            movwf master_octal__number
946 185 22ff            call master_octal
947                     ;   call master_octal {{ temp }}  
948 186 081f            movf test__temp,w
949 187 00b2            movwf master_octal__number
950 188 22ff            call master_octal
951                     ;   call master_fail {{ bit_string , 0x30 }}  
952 189 300d            movlw LOW bit_string+1
953 18a 00af            movwf master_fail__test_name
954 18b 3030            movlw 48
955 18c 00b0            movwf master_fail__test_number
956 18d 22ee            call master_fail
957                     ; if { temp != 1 } body end
958             label351__0end:
959                     ; if exp=` temp != 1 ' empty false
960                     ; Other expression=`{ temp != 1 }' delay=-1
961                     ; if { temp != 1 } end
962                     ; Bit clear :
963                     ;   call slave_send {{ 0x10 | bit }}  
964 18e 3010            movlw 16
965 18f 041d            iorwf test__bit,w
966 190 00b5            movwf slave_send__data
967 191 231e            call slave_send
968                     ;   call test_verify {{ 0 }}  
969 192 01a2            clrf test_verify__leds
970 193 221a            call test_verify
971                     ; Read the bit again :
972                     ;   call slave_send {{ 0x1c | bit }}  
973 194 301c            movlw 28
974 195 041d            iorwf test__bit,w
975 196 00b5            movwf slave_send__data
976 197 231e            call slave_send
977                     ;   temp := slave_get {{ }}  
978 198 2318            call slave_get
979 199 0834            movf slave_get__0return__byte,w
980 19a 009f            movwf test__temp
981                     ; if { temp != 0 } start
982                     ; expression=`{ temp != 0 }' exp_delay=1 true_delay=5  false_delay=0 true_size=11 false_size=0
983 19b 1903            btfsc z___byte,z___bit
984 19c 29a8            goto label364__0end
985                     ; if { temp != 0 } body start
986                     ;   call master_octal {{ bit }}  
987 19d 081d            movf test__bit,w
988 19e 00b2            movwf master_octal__number
989 19f 22ff            call master_octal
990                     ;   call master_octal {{ temp }}  
991 1a0 081f            movf test__temp,w
992 1a1 00b2            movwf master_octal__number
993 1a2 22ff            call master_octal
994                     ;   call master_fail {{ bit_string , 0x31 }}  
995 1a3 300d            movlw LOW bit_string+1
996 1a4 00af            movwf master_fail__test_name
997 1a5 3031            movlw 49
998 1a6 00b0            movwf master_fail__test_number
999 1a7 22ee            call master_fail
1000                     ; if { temp != 0 } body end
1001             label364__0end:
1002                     ; if exp=` temp != 0 ' empty false
1003                     ; Other expression=`{ temp != 0 }' delay=-1
1004                     ; if { temp != 0 } end
1005                     ; Bit toggle :
1006                     ;   call slave_send {{ 0x18 | bit }}  
1007 1a8 3018            movlw 24
1008 1a9 041d            iorwf test__bit,w
1009 1aa 00b5            movwf slave_send__data
1010 1ab 231e            call slave_send
1011                     ;   call test_verify {{ leds }}  
1012 1ac 081e            movf test__leds,w
1013 1ad 00a2            movwf test_verify__leds
1014 1ae 221a            call test_verify
1015                     ; Bit toggle again :
1016                     ;   call slave_send {{ 0x18 | bit }}  
1017 1af 3018            movlw 24
1018 1b0 041d            iorwf test__bit,w
1019 1b1 00b5            movwf slave_send__data
1020 1b2 231e            call slave_send
1021                     ;   call test_verify {{ 0 }}  
1022 1b3 01a2            clrf test_verify__leds
1023 1b4 221a            call test_verify
1024                     ;   leds := leds << 1  
1025 1b5 1003            bcf c___byte,c___bit
1026 1b6 0d9e            rlf test__leds,f
1027                     ;   bit := bit + 1  
1028 1b7 0a9d            incf test__bit,f
1029 1b8 296e            goto test__343while__continue
1030                     ; if exp=` bit < 4 ' false goto
1031                     ; Other expression=` bit < 4 ' delay=-1
1032             test__343while__break:
1033                     ; `while  bit < 4  ...' end
1034                     ; Now do some blink rate tests :
1035                     ;   call master_string {{ blink_string }}  
1036 1b9 3012            movlw LOW blink_string+1
1037 1ba 00bf            movwf master_string__message
1038 1bb 236a            call master_string
1039                     ;   call master_crlf {{ }}  
1040 1bc 22e7            call master_crlf
1041                     ; First turn the bits on :
1042                     ;   call slave_send {{ 0xf }}  
1043 1bd 300f            movlw 15
1044 1be 00b5            movwf slave_send__data
1045 1bf 231e            call slave_send
1046                     ;   bit := 0  
1047 1c0 019d            clrf test__bit
1048                     ; `while  bit < 4  ...' start
1049             test__388while__continue:
1050 1c1 3004            movlw 4
1051 1c2 021d            subwf test__bit,w
1052                     ; expression=` bit < 4 ' exp_delay=2 true_delay=1  false_delay=2 true_size=36 false_size=1
1053 1c3 1803            btfsc c___byte,c___bit
1054 1c4 29e9            goto test__388while__break
1055                     ; Set the blink rate :
1056                     ;   call slave_send {{ 0x30 | {{ bit << 2 }} | bit }}  
1057 1c5 0d1d            rlf test__bit,w
1058 1c6 00a1            movwf test__390byte0
1059 1c7 0d21            rlf test__390byte0,w
1060 1c8 39fc            andlw 252
1061 1c9 041d            iorwf test__bit,w
1062 1ca 3830            iorlw 48
1063 1cb 00b5            movwf slave_send__data
1064 1cc 231e            call slave_send
1065                     ; Read the blink rate back :
1066                     ;   call slave_send {{ 0x1c | bit }}  
1067 1cd 301c            movlw 28
1068 1ce 041d            iorwf test__bit,w
1069 1cf 00b5            movwf slave_send__data
1070 1d0 231e            call slave_send
1071                     ;   temp := slave_get {{ }}  
1072 1d1 2318            call slave_get
1073 1d2 0834            movf slave_get__0return__byte,w
1074 1d3 009f            movwf test__temp
1075                     ;   pattern := {{ bit << 1 }} | 9  
1076 1d4 1003            bcf c___byte,c___bit
1077 1d5 0d1d            rlf test__bit,w
1078 1d6 3809            iorlw 9
1079 1d7 00a0            movwf test__pattern
1080                     ; if { temp != pattern } start
1081 1d8 081f            movf test__temp,w
1082 1d9 0220            subwf test__pattern,w
1083                     ; expression=`{ temp != pattern }' exp_delay=2 true_delay=5  false_delay=0 true_size=11 false_size=0
1084 1da 1903            btfsc z___byte,z___bit
1085 1db 29e7            goto label396__0end
1086                     ; if { temp != pattern } body start
1087                     ;   call master_octal {{ temp }}  
1088 1dc 081f            movf test__temp,w
1089 1dd 00b2            movwf master_octal__number
1090 1de 22ff            call master_octal
1091                     ;   call master_octal {{ pattern }}  
1092 1df 0820            movf test__pattern,w
1093 1e0 00b2            movwf master_octal__number
1094 1e1 22ff            call master_octal
1095                     ;   call master_fail {{ blink_string , 0x32 }}  
1096 1e2 3012            movlw LOW blink_string+1
1097 1e3 00af            movwf master_fail__test_name
1098 1e4 3032            movlw 50
1099 1e5 00b0            movwf master_fail__test_number
1100 1e6 22ee            call master_fail
1101                     ; if { temp != pattern } body end
1102             label396__0end:
1103                     ; if exp=` temp != pattern ' empty false
1104                     ; Other expression=`{ temp != pattern }' delay=-1
1105                     ; if { temp != pattern } end
1106                     ;   bit := bit + 1  
1107 1e7 0a9d            incf test__bit,f
1108 1e8 29c1            goto test__388while__continue
1109                     ; if exp=` bit < 4 ' false goto
1110                     ; Other expression=` bit < 4 ' delay=-1
1111             test__388while__break:
1112                     ; `while  bit < 4  ...' end
1113                     ; Now turn the bits on and let them blink :
1114                     ;   call test_prompt {{ 0xf }}  
1115 1e9 300f            movlw 15
1116 1ea 00a4            movwf test_prompt__leds
1117 1eb 222f            call test_prompt
1118                     ; Now clear the blink rates :
1119                     ;   bit := 0  
1120 1ec 019d            clrf test__bit
1121                     ; `while  bit < 4  ...' start
1122             test__408while__continue:
1123 1ed 3004            movlw 4
1124 1ee 021d            subwf test__bit,w
1125                     ; expression=` bit < 4 ' exp_delay=2 true_delay=5  false_delay=2 true_size=6 false_size=1
1126 1ef 1803            btfsc c___byte,c___bit
1127 1f0 29f7            goto test__408while__break
1128                     ; Clear the blink rate :
1129                     ;   call slave_send {{ 0x20 | bit }}  
1130 1f1 3020            movlw 32
1131 1f2 041d            iorwf test__bit,w
1132 1f3 00b5            movwf slave_send__data
1133 1f4 231e            call slave_send
1134                     ;   bit := bit + 1  
1135 1f5 0a9d            incf test__bit,f
1136 1f6 29ed            goto test__408while__continue
1137                     ; if exp=` bit < 4 ' false goto
1138                     ; Other expression=` bit < 4 ' delay=-1
1139             test__408while__break:
1140                     ; `while  bit < 4  ...' end
1141                     ;   call slave_send {{ 0 }}  
1142 1f7 01b5            clrf slave_send__data
1143 1f8 231e            call slave_send
1144                     ; Now test increment :
1145                     ;   leds := 0  
1146 1f9 019e            clrf test__leds
1147                     ; `while  leds < 0x10  ...' start
1148             test__417while__continue:
1149 1fa 3010            movlw 16
1150 1fb 021e            subwf test__leds,w
1151                     ; expression=` leds < 0x10 ' exp_delay=2 true_delay=5  false_delay=2 true_size=8 false_size=1
1152 1fc 1803            btfsc c___byte,c___bit
1153 1fd 2a06            goto test__417while__break
1154                     ;   call test_verify {{ leds }}  
1155 1fe 081e            movf test__leds,w
1156 1ff 00a2            movwf test_verify__leds
1157 200 221a            call test_verify
1158                     ; Now increment the LED ' s :
1159                     ;   call slave_send {{ 0x44 }}  
1160 201 3044            movlw 68
1161 202 00b5            movwf slave_send__data
1162 203 231e            call slave_send
1163                     ;   leds := leds + 1  
1164 204 0a9e            incf test__leds,f
1165 205 29fa            goto test__417while__continue
1166                     ; if exp=` leds < 0x10 ' false goto
1167                     ; Other expression=` leds < 0x10 ' delay=-1
1168             test__417while__break:
1169                     ; `while  leds < 0x10  ...' end
1170                     ; Now test decrement :
1171                     ;   leds := 0x10  
1172 206 3010            movlw 16
1173 207 009e            movwf test__leds
1174                     ; `while  leds != 0  ...' start
1175             test__427while__continue:
1176 208 081e            movf test__leds,w
1177                     ; expression=` leds != 0 ' exp_delay=1 true_delay=5  false_delay=2 true_size=8 false_size=1
1178 209 1903            btfsc z___byte,z___bit
1179 20a 2a13            goto test__427while__break
1180                     ;   leds := leds - 1  
1181 20b 039e            decf test__leds,f
1182                     ; Now decrement the LED ' s :
1183                     ;   call slave_send {{ 0x48 }}  
1184 20c 3048            movlw 72
1185 20d 00b5            movwf slave_send__data
1186 20e 231e            call slave_send
1187                     ; Now verify :
1188                     ;   call test_verify {{ leds }}  
1189 20f 081e            movf test__leds,w
1190 210 00a2            movwf test_verify__leds
1191 211 221a            call test_verify
1192 212 2a08            goto test__427while__continue
1193                     ; if exp=` leds != 0 ' false goto
1194                     ; Other expression=` leds != 0 ' delay=-1
1195             test__427while__break:
1196                     ; `while  leds != 0  ...' end
1197                     ; Let ' s clear the LED ' s :
1198                     ;   call slave_send {{ 0 }}  
1199 213 01b5            clrf slave_send__data
1200 214 231e            call slave_send
1201                     ; Announce that we are done :
1202                     ;   call master_string {{ done_string }}  
1203 215 3026            movlw LOW done_string+1
1204 216 00bf            movwf master_string__message
1205 217 236a            call master_string
1206                     ;   call master_crlf {{ }}  
1207 218 22e7            call master_crlf
1208                     ; procedure test end
1209 219 3400            retlw 0
1210             
1211                     ; procedure test_verify start
1212             test_verify:
1213     0022    test_verify__variables__base equ global__variables__bank0+22
1214     0022    test_verify__bytes__base equ test_verify__variables__base+0
1215     0024    test_verify__bits__base equ test_verify__variables__base+2
1216     0002    test_verify__total__bytes equ 2
1217     0022    test_verify__leds equ test_verify__bytes__base+0
1218                     ; This procedure will verify that the registers contain high and low .
1219     0023    test_verify__temp equ test_verify__bytes__base+1
1220                     ; Read leds register :
1221                     ;   call slave_send {{ 0x40 }}  
1222 21a 3040            movlw 64
1223 21b 00b5            movwf slave_send__data
1224 21c 231e            call slave_send
1225                     ;   temp := slave_get {{ }}  
1226 21d 2318            call slave_get
1227 21e 0834            movf slave_get__0return__byte,w
1228 21f 00a3            movwf test_verify__temp
1229                     ; if { temp != leds } start
1230 220 0222            subwf test_verify__leds,w
1231                     ; expression=`{ temp != leds }' exp_delay=2 true_delay=5  false_delay=0 true_size=11 false_size=0
1232 221 1903            btfsc z___byte,z___bit
1233 222 2a2e            goto label456__0end
1234                     ; if { temp != leds } body start
1235                     ;   call master_octal {{ temp }}  
1236 223 0823            movf test_verify__temp,w
1237 224 00b2            movwf master_octal__number
1238 225 22ff            call master_octal
1239                     ;   call master_octal {{ leds }}  
1240 226 0822            movf test_verify__leds,w
1241 227 00b2            movwf master_octal__number
1242 228 22ff            call master_octal
1243                     ;   call master_fail {{ read_string , 0x50 }}  
1244 229 3044            movlw LOW read_string+1
1245 22a 00af            movwf master_fail__test_name
1246 22b 3050            movlw 80
1247 22c 00b0            movwf master_fail__test_number
1248 22d 22ee            call master_fail
1249                     ; if { temp != leds } body end
1250             label456__0end:
1251                     ; if exp=` temp != leds ' empty false
1252                     ; Other expression=`{ temp != leds }' delay=-1
1253                     ; if { temp != leds } end
1254                     ; procedure test_verify end
1255 22e 3400            retlw 0
1256             
1257                     ; procedure test_prompt start
1258             test_prompt:
1259     0024    test_prompt__variables__base equ global__variables__bank0+24
1260     0024    test_prompt__bytes__base equ test_prompt__variables__base+0
1261     0028    test_prompt__bits__base equ test_prompt__variables__base+4
1262     0004    test_prompt__total__bytes equ 4
1263     0027    test_prompt__483byte0 equ test_prompt__bytes__base+3
1264     0024    test_prompt__leds equ test_prompt__bytes__base+0
1265                     ; This procedure will prompt the user to input a paticular pattern :
1266     0025    test_prompt__count equ test_prompt__bytes__base+1
1267     0026    test_prompt__char equ test_prompt__bytes__base+2
1268                     ; Print high order pattern :
1269                     ; `count_down count 4 ...' start
1270 22f 3004            movlw 4
1271 230 00a5            movwf test_prompt__count
1272             test_prompt__473_loop:
1273                     ;   char := 0c'.'  
1274 231 302e            movlw 46
1275 232 00a6            movwf test_prompt__char
1276                     ; if { leds @ 3 } start
1277                     ; Alias variable for select leds @ 3
1278     0024    test_prompt__leds__475select0 equ test_prompt__leds+0
1279     0024    test_prompt__leds__475select0__byte equ test_prompt__leds+0
1280     0003    test_prompt__leds__475select0__bit equ 3
1281                     ; expression=`{ leds @ 3 }' exp_delay=0 true_delay=2  false_delay=0 true_size=2 false_size=0
1282 233 1da4            btfss test_prompt__leds__475select0__byte,test_prompt__leds__475select0__bit
1283 234 2a37            goto label475__1end
1284                     ; if { leds @ 3 } body start
1285                     ;   char := 0c'*'  
1286 235 302a            movlw 42
1287 236 00a6            movwf test_prompt__char
1288                     ; if { leds @ 3 } body end
1289             label475__1end:
1290                     ; if exp=` leds @ 3 ' empty false
1291                     ; Other expression=`{ leds @ 3 }' delay=-1
1292                     ; if { leds @ 3 } end
1293                     ;   call master_send {{ char }}  
1294 237 0826            movf test_prompt__char,w
1295 238 00be            movwf master_send__character
1296 239 2364            call master_send
1297                     ;   leds := leds << 1  
1298 23a 1003            bcf c___byte,c___bit
1299 23b 0da4            rlf test_prompt__leds,f
1300 23c 0ba5            decfsz test_prompt__count,f
1301 23d 2a31            goto test_prompt__473_loop
1302             test_prompt__473_done:
1303                     ; `count_down count 4 ...' end
1304                     ;   call master_send {{ 0c':' }}  
1305 23e 303a            movlw 58
1306 23f 00be            movwf master_send__character
1307 240 2364            call master_send
1308                     ; `while  master_get ## {{ }} = 0xfc  ...' start
1309             test_prompt__483while__continue:
1310 241 22f9            call master_get
1311 242 0831            movf master_get__0return__byte,w
1312 243 00a7            movwf test_prompt__483byte0
1313 244 30fc            movlw 252
1314 245 0227            subwf test_prompt__483byte0,w
1315                     ; expression=` master_get ## {{ }} = 0xfc ' exp_delay=3 true_delay=2  false_delay=2 true_size=1 false_size=1
1316 246 1903            btfsc z___byte,z___bit
1317                     ; Do nothing :
1318 247 2a41            goto test_prompt__483while__continue
1319 248 2a49            goto test_prompt__483while__break
1320                     ; if exp=` master_get ## {{ }} = 0xfc ' true goto small true
1321             test_prompt__483while__break:
1322                     ; `while  master_get ## {{ }} = 0xfc  ...' end
1323                     ;   call master_crlf {{ }}  
1324 249 22e7            call master_crlf
1325                     ; procedure test_prompt end
1326 24a 3400            retlw 0
1327                     ; comment {The procedures below are used to test the common shared commands :}
1328             
1329                     ; procedure common_test start
1330             common_test:
1331     0028    common_test__variables__base equ global__variables__bank0+28
1332     0028    common_test__bytes__base equ common_test__variables__base+0
1333     002a    common_test__bits__base equ common_test__variables__base+2
1334     0002    common_test__total__bytes equ 2
1335     0029    common_test__534byte0 equ common_test__bytes__base+1
1336                     ;   arguments_none  
1337                     ; This procedure will verify that the common shared commands work .
1338     0028    common_test__actual equ common_test__bytes__base+0
1339                     ; Print the ID information :
1340                     ; ID reset :
1341                     ;   call slave_send {{ 0xfd }}  
1342 24b 30fd            movlw 253
1343 24c 00b5            movwf slave_send__data
1344 24d 231e            call slave_send
1345                     ; Read the fixed bytes :
1346                     ;   call common_test_id_match {{ 1 , 0xc0 }}  
1347 24e 3001            movlw 1
1348 24f 00aa            movwf common_test_id_match__desired
1349 250 30c0            movlw 192
1350 251 00ab            movwf common_test_id_match__test_number
1351 252 22c0            call common_test_id_match
1352                     ;   call common_test_id_match {{ 0 , 0xc1 }}  
1353 253 01aa            clrf common_test_id_match__desired
1354 254 30c1            movlw 193
1355 255 00ab            movwf common_test_id_match__test_number
1356 256 22c0            call common_test_id_match
1357                     ;   call common_test_id_match {{ 8 , 0xc2 }}  
1358 257 3008            movlw 8
1359 258 00aa            movwf common_test_id_match__desired
1360 259 30c2            movlw 194
1361 25a 00ab            movwf common_test_id_match__test_number
1362 25b 22c0            call common_test_id_match
1363                     ;   call common_test_id_match {{ 0 , 0xc3 }}  
1364 25c 01aa            clrf common_test_id_match__desired
1365 25d 30c3            movlw 195
1366 25e 00ab            movwf common_test_id_match__test_number
1367 25f 22c0            call common_test_id_match
1368                     ;   call common_test_id_match {{ 0 , 0xc4 }}  
1369 260 01aa            clrf common_test_id_match__desired
1370 261 30c4            movlw 196
1371 262 00ab            movwf common_test_id_match__test_number
1372 263 22c0            call common_test_id_match
1373                     ;   call common_test_id_match {{ 0 , 0xc5 }}  
1374 264 01aa            clrf common_test_id_match__desired
1375 265 30c5            movlw 197
1376 266 00ab            movwf common_test_id_match__test_number
1377 267 22c0            call common_test_id_match
1378                     ;   call common_test_id_match {{ 0 , 0xc6 }}  
1379 268 01aa            clrf common_test_id_match__desired
1380 269 30c6            movlw 198
1381 26a 00ab            movwf common_test_id_match__test_number
1382 26b 22c0            call common_test_id_match
1383                     ;   call common_test_id_match {{ 0 , 0xc7 }}  
1384 26c 01aa            clrf common_test_id_match__desired
1385 26d 30c7            movlw 199
1386 26e 00ab            movwf common_test_id_match__test_number
1387 26f 22c0            call common_test_id_match
1388                     ;   call master_crlf {{ }}  
1389 270 22e7            call master_crlf
1390                     ;   call common_test_id_bytes8 {{ }}  
1391 271 22cb            call common_test_id_bytes8
1392                     ;   call common_test_id_bytes8 {{ }}  
1393 272 22cb            call common_test_id_bytes8
1394                     ; Read the brick name :
1395                     ;   call common_test_id_string {{ }}  
1396 273 22d5            call common_test_id_string
1397                     ; Read the vendor name :
1398                     ;   call common_test_id_string {{ }}  
1399 274 22d5            call common_test_id_string
1400                     ; Verfify that we don ' t read off the end of the id and crash :
1401                     ;   call common_test_id_next {{ }}  
1402 275 22e0            call common_test_id_next
1403 276 082e            movf common_test_id_next__0return__byte,w
1404                     ; Reset id :
1405                     ;   call slave_send {{ 0xfd }}  
1406 277 30fd            movlw 253
1407 278 00b5            movwf slave_send__data
1408 279 231e            call slave_send
1409                     ; Verify that we are still alive :
1410                     ;   call common_test_id_match {{ 1 , 0xc8 }}  
1411 27a 3001            movlw 1
1412 27b 00aa            movwf common_test_id_match__desired
1413 27c 30c8            movlw 200
1414 27d 00ab            movwf common_test_id_match__test_number
1415 27e 22c0            call common_test_id_match
1416                     ; Read glitch :
1417                     ; Clear glitch register :
1418                     ;   call slave_send {{ 0xfe }}  
1419 27f 30fe            movlw 254
1420 280 00b5            movwf slave_send__data
1421 281 231e            call slave_send
1422                     ;   actual := slave_get {{ }}  
1423 282 2318            call slave_get
1424 283 0834            movf slave_get__0return__byte,w
1425 284 00a8            movwf common_test__actual
1426                     ; Send a couple of glitches :
1427                     ;   call slave_send {{ 0xff }}  
1428 285 30ff            movlw 255
1429 286 00b5            movwf slave_send__data
1430 287 231e            call slave_send
1431                     ;   call slave_send {{ 0xff }}  
1432 288 30ff            movlw 255
1433 289 00b5            movwf slave_send__data
1434 28a 231e            call slave_send
1435                     ; Read the glitch register :
1436                     ;   call slave_send {{ 0xfe }}  
1437 28b 30fe            movlw 254
1438 28c 00b5            movwf slave_send__data
1439 28d 231e            call slave_send
1440                     ; if { slave_get {{ }} != 2 } start
1441 28e 2318            call slave_get
1442 28f 0834            movf slave_get__0return__byte,w
1443 290 00a9            movwf common_test__534byte0
1444 291 3002            movlw 2
1445 292 0229            subwf common_test__534byte0,w
1446                     ; expression=`{ slave_get {{ }} != 2 }' exp_delay=3 true_delay=3  false_delay=0 true_size=5 false_size=0
1447 293 1903            btfsc z___byte,z___bit
1448 294 2a9a            goto label534__1end
1449                     ; if { slave_get {{ }} != 2 } body start
1450                     ;   call master_fail {{ common_string , 0xc9 }}  
1451 295 301e            movlw LOW common_string+1
1452 296 00af            movwf master_fail__test_name
1453 297 30c9            movlw 201
1454 298 00b0            movwf master_fail__test_number
1455 299 22ee            call master_fail
1456                     ; if { slave_get {{ }} != 2 } body end
1457             label534__1end:
1458                     ; if exp=` slave_get ## {{ }} != 2 ' empty false
1459                     ; Other expression=`{ slave_get {{ }} != 2 }' delay=-1
1460                     ; if { slave_get {{ }} != 2 } end
1461                     ; Do a clock pulse :
1462                     ;   call slave_send {{ 0xfb }}  
1463 29a 30fb            movlw 251
1464 29b 00b5            movwf slave_send__data
1465 29c 231e            call slave_send
1466                     ; if { slave_get {{ }} != 0 } start
1467 29d 2318            call slave_get
1468 29e 0834            movf slave_get__0return__byte,w
1469                     ; expression=`{ slave_get {{ }} != 0 }' exp_delay=0 true_delay=3  false_delay=0 true_size=5 false_size=0
1470 29f 1903            btfsc z___byte,z___bit
1471 2a0 2aa6            goto label540__0end
1472                     ; if { slave_get {{ }} != 0 } body start
1473                     ;   call master_fail {{ common_string , 0xca }}  
1474 2a1 301e            movlw LOW common_string+1
1475 2a2 00af            movwf master_fail__test_name
1476 2a3 30ca            movlw 202
1477 2a4 00b0            movwf master_fail__test_number
1478 2a5 22ee            call master_fail
1479                     ; if { slave_get {{ }} != 0 } body end
1480             label540__0end:
1481                     ; if exp=` slave_get ## {{ }} != 0 ' empty false
1482                     ; Other expression=`{ slave_get {{ }} != 0 }' delay=-1
1483                     ; if { slave_get {{ }} != 0 } end
1484                     ; Read clock :
1485                     ;   call slave_send {{ 0xfa }}  
1486 2a6 30fa            movlw 250
1487 2a7 00b5            movwf slave_send__data
1488 2a8 231e            call slave_send
1489                     ;   actual := slave_get {{ }}  
1490 2a9 2318            call slave_get
1491 2aa 0834            movf slave_get__0return__byte,w
1492 2ab 00a8            movwf common_test__actual
1493                     ; Increment :
1494                     ;   call slave_send {{ 0xf9 }}  
1495 2ac 30f9            movlw 249
1496 2ad 00b5            movwf slave_send__data
1497 2ae 231e            call slave_send
1498                     ; Decrement :
1499                     ;   call slave_send {{ 0xf8 }}  
1500 2af 30f8            movlw 248
1501 2b0 00b5            movwf slave_send__data
1502 2b1 231e            call slave_send
1503                     ; Read clock again :
1504                     ;   call slave_send {{ 0xfa }}  
1505 2b2 30fa            movlw 250
1506 2b3 00b5            movwf slave_send__data
1507 2b4 231e            call slave_send
1508                     ; if { actual != slave_get {{ }} } start
1509 2b5 2318            call slave_get
1510 2b6 0834            movf slave_get__0return__byte,w
1511 2b7 0228            subwf common_test__actual,w
1512                     ; expression=`{ actual != slave_get {{ }} }' exp_delay=1 true_delay=3  false_delay=0 true_size=5 false_size=0
1513 2b8 1903            btfsc z___byte,z___bit
1514 2b9 2abf            goto label552__0end
1515                     ; if { actual != slave_get {{ }} } body start
1516                     ;   call master_fail {{ common_string , 0xcb }}  
1517 2ba 301e            movlw LOW common_string+1
1518 2bb 00af            movwf master_fail__test_name
1519 2bc 30cb            movlw 203
1520 2bd 00b0            movwf master_fail__test_number
1521 2be 22ee            call master_fail
1522                     ; if { actual != slave_get {{ }} } body end
1523             label552__0end:
1524                     ; if exp=` actual != slave_get ## {{ }} ' empty false
1525                     ; Other expression=`{ actual != slave_get {{ }} }' delay=-1
1526                     ; if { actual != slave_get {{ }} } end
1527                     ; procedure common_test end
1528 2bf 3400            retlw 0
1529             
1530                     ; procedure common_test_id_match start
1531             common_test_id_match:
1532     002a    common_test_id_match__variables__base equ global__variables__bank0+30
1533     002a    common_test_id_match__bytes__base equ common_test_id_match__variables__base+0
1534     002c    common_test_id_match__bits__base equ common_test_id_match__variables__base+2
1535     0002    common_test_id_match__total__bytes equ 2
1536     002a    common_test_id_match__desired equ common_test_id_match__bytes__base+0
1537     002b    common_test_id_match__test_number equ common_test_id_match__bytes__base+1
1538                     ; This procedure will verify that the next byte in the id is < desired > .
1539                     ; if { desired != common_test_id_next {{ }} } start
1540 2c0 22e0            call common_test_id_next
1541 2c1 082e            movf common_test_id_next__0return__byte,w
1542 2c2 022a            subwf common_test_id_match__desired,w
1543                     ; expression=`{ desired != common_test_id_next {{ }} }' exp_delay=1 true_delay=3  false_delay=0 true_size=5 false_size=0
1544 2c3 1903            btfsc z___byte,z___bit
1545 2c4 2aca            goto label564__0end
1546                     ; if { desired != common_test_id_next {{ }} } body start
1547                     ;   call master_fail {{ common_string , test_number }}  
1548 2c5 301e            movlw LOW common_string+1
1549 2c6 00af            movwf master_fail__test_name
1550 2c7 082b            movf common_test_id_match__test_number,w
1551 2c8 00b0            movwf master_fail__test_number
1552 2c9 22ee            call master_fail
1553                     ; if { desired != common_test_id_next {{ }} } body end
1554             label564__0end:
1555                     ; if exp=` desired != common_test_id_next ## {{ }} ' empty false
1556                     ; Other expression=`{ desired != common_test_id_next {{ }} }' delay=-1
1557                     ; if { desired != common_test_id_next {{ }} } end
1558                     ; procedure common_test_id_match end
1559 2ca 3400            retlw 0
1560             
1561                     ; procedure common_test_id_bytes8 start
1562             common_test_id_bytes8:
1563     002c    common_test_id_bytes8__variables__base equ global__variables__bank0+32
1564     002c    common_test_id_bytes8__bytes__base equ common_test_id_bytes8__variables__base+0
1565     002d    common_test_id_bytes8__bits__base equ common_test_id_bytes8__variables__base+1
1566     0001    common_test_id_bytes8__total__bytes equ 1
1567                     ;   arguments_none  
1568                     ; This procedure will print out the next 8 bytes of the id in octal .
1569     002c    common_test_id_bytes8__count equ common_test_id_bytes8__bytes__base+0
1570                     ; `count_down count 8 ...' start
1571 2cb 3008            movlw 8
1572 2cc 00ac            movwf common_test_id_bytes8__count
1573             common_test_id_bytes8__577_loop:
1574                     ;   call master_octal {{ common_test_id_next {{ }} }}  
1575 2cd 22e0            call common_test_id_next
1576 2ce 082e            movf common_test_id_next__0return__byte,w
1577 2cf 00b2            movwf master_octal__number
1578 2d0 22ff            call master_octal
1579 2d1 0bac            decfsz common_test_id_bytes8__count,f
1580 2d2 2acd            goto common_test_id_bytes8__577_loop
1581             common_test_id_bytes8__577_done:
1582                     ; `count_down count 8 ...' end
1583                     ;   call master_crlf {{ }}  
1584 2d3 22e7            call master_crlf
1585                     ; procedure common_test_id_bytes8 end
1586 2d4 3400            retlw 0
1587             
1588                     ; procedure common_test_id_string start
1589             common_test_id_string:
1590     002d    common_test_id_string__variables__base equ global__variables__bank0+33
1591     002d    common_test_id_string__bytes__base equ common_test_id_string__variables__base+0
1592     002e    common_test_id_string__bits__base equ common_test_id_string__variables__base+1
1593     0001    common_test_id_string__total__bytes equ 1
1594                     ;   arguments_none  
1595                     ; This procedure will print out the next id string .
1596     002d    common_test_id_string__count equ common_test_id_string__bytes__base+0
1597                     ; `count_down count  common_test_id_next ## {{ }}  ...' start
1598 2d5 22e0            call common_test_id_next
1599 2d6 082e            movf common_test_id_next__0return__byte,w
1600 2d7 00ad            movwf common_test_id_string__count
1601             common_test_id_string__591_loop:
1602                     ;   call master_send {{ common_test_id_next {{ }} }}  
1603 2d8 22e0            call common_test_id_next
1604 2d9 082e            movf common_test_id_next__0return__byte,w
1605 2da 00be            movwf master_send__character
1606 2db 2364            call master_send
1607 2dc 0bad            decfsz common_test_id_string__count,f
1608 2dd 2ad8            goto common_test_id_string__591_loop
1609             common_test_id_string__591_done:
1610                     ; `count_down count  common_test_id_next ## {{ }}  ...' end
1611                     ;   call master_crlf {{ }}  
1612 2de 22e7            call master_crlf
1613                     ; procedure common_test_id_string end
1614 2df 3400            retlw 0
1615             
1616                     ; procedure common_test_id_next start
1617             common_test_id_next:
1618     002e    common_test_id_next__variables__base equ global__variables__bank0+34
1619     002e    common_test_id_next__bytes__base equ common_test_id_next__variables__base+0
1620     002f    common_test_id_next__bits__base equ common_test_id_next__variables__base+1
1621     0001    common_test_id_next__total__bytes equ 1
1622                     ;   arguments_none  
1623     002e    common_test_id_next__0return__byte equ common_test_id_next__bytes__base+0
1624                     ; This procedure returns the next byte from the identification string .
1625                     ;   call slave_send {{ 0xfc }}  
1626 2e0 30fc            movlw 252
1627 2e1 00b5            movwf slave_send__data
1628 2e2 231e            call slave_send
1629                     ;   return slave_get {{ }}  
1630 2e3 2318            call slave_get
1631 2e4 0834            movf slave_get__0return__byte,w
1632 2e5 00ae            movwf common_test_id_next__0return__byte
1633 2e6 3400            retlw 0
1634                     ; procedure common_test_id_next end
1635                     ; comment {The following procedures are used to communicate with the master :}
1636             
1637                     ; procedure master_crlf start
1638             master_crlf:
1639     002f    master_crlf__variables__base equ global__variables__bank0+35
1640     002f    master_crlf__bytes__base equ master_crlf__variables__base+0
1641     002f    master_crlf__bits__base equ master_crlf__variables__base+0
1642     0000    master_crlf__total__bytes equ 0
1643                     ;   arguments_none  
1644                     ; This procedure will output a carriage - return line - feed
1645                     ; to the master .
1646                     ;   call master_send {{ cr }}  
1647 2e7 300d            movlw 13
1648 2e8 00be            movwf master_send__character
1649 2e9 2364            call master_send
1650                     ;   call master_send {{ lf }}  
1651 2ea 300a            movlw 10
1652 2eb 00be            movwf master_send__character
1653 2ec 2364            call master_send
1654                     ; procedure master_crlf end
1655 2ed 3400            retlw 0
1656             
1657                     ; procedure master_fail start
1658             master_fail:
1659     002f    master_fail__variables__base equ global__variables__bank0+35
1660     002f    master_fail__bytes__base equ master_fail__variables__base+0
1661     0031    master_fail__bits__base equ master_fail__variables__base+2
1662     0002    master_fail__total__bytes equ 2
1663     002f    master_fail__test_name equ master_fail__bytes__base+0
1664     0030    master_fail__test_number equ master_fail__bytes__base+1
1665                     ; This procedure will output ` fail ' followed by a carriage return
1666                     ; and line feed .
1667                     ;   call master_string {{ fail_string }}  
1668 2ee 302c            movlw LOW fail_string+1
1669 2ef 00bf            movwf master_string__message
1670 2f0 236a            call master_string
1671                     ;   call master_string {{ test_name }}  
1672 2f1 082f            movf master_fail__test_name,w
1673 2f2 00bf            movwf master_string__message
1674 2f3 236a            call master_string
1675                     ;   call master_octal {{ test_number }}  
1676 2f4 0830            movf master_fail__test_number,w
1677 2f5 00b2            movwf master_octal__number
1678 2f6 22ff            call master_octal
1679                     ;   call master_crlf {{ }}  
1680 2f7 22e7            call master_crlf
1681                     ; procedure master_fail end
1682 2f8 3400            retlw 0
1683             
1684                     ; procedure master_get start
1685             master_get:
1686     0031    master_get__variables__base equ global__variables__bank0+37
1687     0031    master_get__bytes__base equ master_get__variables__base+0
1688     0032    master_get__bits__base equ master_get__variables__base+1
1689     0001    master_get__total__bytes equ 1
1690                     ;   arguments_none  
1691     0031    master_get__0return__byte equ master_get__bytes__base+0
1692                     ; This procedure will get the next byte or return 0xfc if
1693                     ; no byte is forthcoming .
1694                     ;   return get_byte {{ rx_master_mask }}  
1695 2f9 3008            movlw 8
1696 2fa 00b6            movwf get_byte__mask
1697 2fb 2324            call get_byte
1698 2fc 0837            movf get_byte__0return__byte,w
1699 2fd 00b1            movwf master_get__0return__byte
1700 2fe 3400            retlw 0
1701                     ; procedure master_get end
1702             
1703                     ; procedure master_octal start
1704             master_octal:
1705     0032    master_octal__variables__base equ global__variables__bank0+38
1706     0032    master_octal__bytes__base equ master_octal__variables__base+0
1707     0034    master_octal__bits__base equ master_octal__variables__base+2
1708     0002    master_octal__total__bytes equ 2
1709     0033    master_octal__651byte0 equ master_octal__bytes__base+1
1710     0033    master_octal__652byte0 equ master_octal__bytes__base+1
1711     0032    master_octal__number equ master_octal__bytes__base+0
1712                     ; This procedure will output < number > in octal to the tx port .
1713                     ; Output the character in octal :
1714                     ;   call master_send {{ {{ number >> 6 }} + 0c'0' }}  
1715 2ff 0e32            swapf master_octal__number,w
1716 300 00b3            movwf master_octal__651byte0
1717 301 0cb3            rrf master_octal__651byte0,f
1718 302 0c33            rrf master_octal__651byte0,w
1719 303 3903            andlw 3
1720 304 3e30            addlw 48
1721 305 00be            movwf master_send__character
1722 306 2364            call master_send
1723                     ;   call master_send {{ {{ {{ number >> 3 }} & 7 }} + 0c'0' }}  
1724 307 0c32            rrf master_octal__number,w
1725 308 00b3            movwf master_octal__652byte0
1726 309 0cb3            rrf master_octal__652byte0,f
1727 30a 0c33            rrf master_octal__652byte0,w
1728 30b 3907            andlw 7
1729 30c 3e30            addlw 48
1730 30d 00be            movwf master_send__character
1731 30e 2364            call master_send
1732                     ;   call master_send {{ {{ number & 7 }} + 0c'0' }}  
1733 30f 3007            movlw 7
1734 310 0532            andwf master_octal__number,w
1735 311 3e30            addlw 48
1736 312 00be            movwf master_send__character
1737 313 2364            call master_send
1738                     ;   call master_send {{ sp }}  
1739 314 3020            movlw 32
1740 315 00be            movwf master_send__character
1741 316 2364            call master_send
1742                     ; procedure master_octal end
1743 317 3400            retlw 0
1744             
1745                     ; procedure slave_get start
1746             slave_get:
1747     0034    slave_get__variables__base equ global__variables__bank0+40
1748     0034    slave_get__bytes__base equ slave_get__variables__base+0
1749     0035    slave_get__bits__base equ slave_get__variables__base+1
1750     0001    slave_get__total__bytes equ 1
1751                     ;   arguments_none  
1752     0034    slave_get__0return__byte equ slave_get__bytes__base+0
1753                     ; This procedure will get a byte from the slave or return 0xfc
1754                     ; if no byte is forthcoming .
1755                     ;   return get_byte {{ rx_slave_mask }}  
1756 318 3001            movlw 1
1757 319 00b6            movwf get_byte__mask
1758 31a 2324            call get_byte
1759 31b 0837            movf get_byte__0return__byte,w
1760 31c 00b4            movwf slave_get__0return__byte
1761 31d 3400            retlw 0
1762                     ; procedure slave_get end
1763             
1764                     ; procedure slave_send start
1765             slave_send:
1766     0035    slave_send__variables__base equ global__variables__bank0+41
1767     0035    slave_send__bytes__base equ slave_send__variables__base+0
1768     0036    slave_send__bits__base equ slave_send__variables__base+1
1769     0001    slave_send__total__bytes equ 1
1770     0035    slave_send__data equ slave_send__bytes__base+0
1771                     ; This procedure will send one byte of < data > to the slave .
1772                     ;   call send_byte {{ data , tx_slave_mask }}  
1773 31e 0835            movf slave_send__data,w
1774 31f 00ba            movwf send_byte__char
1775 320 3002            movlw 2
1776 321 00bb            movwf send_byte__mask
1777 322 2349            call send_byte
1778                     ; procedure slave_send end
1779 323 3400            retlw 0
1780                     ; comment {The last procedures do character sending and receiving :}
1781             
1782                     ; procedure get_byte start
1783             get_byte:
1784     0036    get_byte__variables__base equ global__variables__bank0+42
1785     0036    get_byte__bytes__base equ get_byte__variables__base+0
1786     003a    get_byte__bits__base equ get_byte__variables__base+4
1787     0004    get_byte__total__bytes equ 4
1788     0036    get_byte__mask equ get_byte__bytes__base+0
1789     0037    get_byte__0return__byte equ get_byte__bytes__base+1
1790                     ; Get an 8 - bit byte from < mask > bit of < porta > and return it .
1791                     ; If no character shows up in a while 0xfc is returned .
1792     0038    get_byte__count equ get_byte__bytes__base+2
1793     0039    get_byte__char equ get_byte__bytes__base+3
1794                     ; Wait until a start bit arrives :
1795                     ;   count := 0  
1796 324 01b8            clrf get_byte__count
1797                     ; `while  porta & mask != 0  ...' start
1798             get_byte__690while__continue:
1799 325 0805            movf porta,w
1800 326 0536            andwf get_byte__mask,w
1801                     ; expression=` porta & mask != 0 ' exp_delay=2 true_delay=1  false_delay=2 true_size=9 false_size=1
1802 327 1903            btfsc z___byte,z___bit
1803 328 2b32            goto get_byte__690while__break
1804                     ;   count := count - 1  
1805 329 03b8            decf get_byte__count,f
1806                     ; if { count = 0 } start
1807 32a 0838            movf get_byte__count,w
1808                     ; expression=`{ count = 0 }' exp_delay=1 true_delay=3  false_delay=0 true_size=3 false_size=0
1809 32b 1d03            btfss z___byte,z___bit
1810 32c 2b30            goto label692__0end
1811                     ; if { count = 0 } body start
1812                     ;   return 0xfc  
1813 32d 30fc            movlw 252
1814 32e 00b7            movwf get_byte__0return__byte
1815 32f 3400            retlw 0
1816                     ; if { count = 0 } body end
1817             label692__0end:
1818                     ; if exp=` count = 0 ' empty false
1819                     ; Other expression=`{ count = 0 }' delay=-1
1820                     ; if { count = 0 } end
1821                     ;   call delay {{ }}  
1822 330 237d            call delay
1823 331 2b25            goto get_byte__690while__continue
1824                     ; if exp=` porta & mask != 0 ' false goto
1825                     ; Other expression=` porta & mask != 0 ' delay=-1
1826             get_byte__690while__break:
1827                     ; `while  porta & mask != 0  ...' end
1828                     ; Skip over the start bit :
1829                     ;   call delay {{ }}  
1830 332 237d            call delay
1831                     ;   call delay {{ }}  
1832 333 237d            call delay
1833                     ;   call delay {{ }}  
1834 334 237d            call delay
1835                     ; Sample in the middle third of each data bit :
1836                     ;   char := 0  
1837 335 01b9            clrf get_byte__char
1838                     ; `count_down count 8 ...' start
1839 336 3008            movlw 8
1840 337 00b8            movwf get_byte__count
1841             get_byte__705_loop:
1842                     ;   call delay {{ }}  
1843 338 237d            call delay
1844                     ;   char := char >> 1  
1845 339 1003            bcf c___byte,c___bit
1846 33a 0cb9            rrf get_byte__char,f
1847                     ; if { porta & mask != 0 } start
1848 33b 0805            movf porta,w
1849 33c 0536            andwf get_byte__mask,w
1850                     ; expression=`{ porta & mask != 0 }' exp_delay=2 true_delay=2  false_delay=0 true_size=2 false_size=0
1851 33d 1903            btfsc z___byte,z___bit
1852 33e 2b41            goto label708__0end
1853                     ; if { porta & mask != 0 } body start
1854                     ;   char := char | 0x80  
1855 33f 3080            movlw 128
1856 340 04b9            iorwf get_byte__char,f
1857                     ; if { porta & mask != 0 } body end
1858             label708__0end:
1859                     ; if exp=` porta & mask != 0 ' empty false
1860                     ; Other expression=`{ porta & mask != 0 }' delay=-1
1861                     ; if { porta & mask != 0 } end
1862                     ;   call delay {{ }}  
1863 341 237d            call delay
1864                     ;   call delay {{ }}  
1865 342 237d            call delay
1866 343 0bb8            decfsz get_byte__count,f
1867 344 2b38            goto get_byte__705_loop
1868             get_byte__705_done:
1869                     ; `count_down count 8 ...' end
1870                     ; Skip over 1 / 3 of the stop bit :
1871                     ;   call delay {{ }}  
1872 345 237d            call delay
1873                     ;   return char  
1874 346 0839            movf get_byte__char,w
1875 347 00b7            movwf get_byte__0return__byte
1876 348 3400            retlw 0
1877                     ; procedure get_byte end
1878             
1879                     ; procedure send_byte start
1880             send_byte:
1881     003a    send_byte__variables__base equ global__variables__bank0+46
1882     003a    send_byte__bytes__base equ send_byte__variables__base+0
1883     003e    send_byte__bits__base equ send_byte__variables__base+4
1884     0004    send_byte__total__bytes equ 4
1885     003a    send_byte__char equ send_byte__bytes__base+0
1886     003b    send_byte__mask equ send_byte__bytes__base+1
1887                     ; Send < char > to < mask > bit of < porta > .
1888     003c    send_byte__count equ send_byte__bytes__base+2
1889     003d    send_byte__mark equ send_byte__bytes__base+3
1890                     ; Send the start bit :
1891                     ;   mark := mask ^ space  
1892 349 30ff            movlw 255
1893 34a 063b            xorwf send_byte__mask,w
1894 34b 00bd            movwf send_byte__mark
1895                     ;   porta := mark  
1896 34c 0085            movwf porta
1897                     ;   call delay {{ }}  
1898 34d 237d            call delay
1899                     ;   call delay {{ }}  
1900 34e 237d            call delay
1901                     ;   call delay {{ }}  
1902 34f 237d            call delay
1903                     ; Send the data :
1904                     ; `count_down count 8 ...' start
1905 350 3008            movlw 8
1906 351 00bc            movwf send_byte__count
1907             send_byte__740_loop:
1908                     ; if { char @ 0 } start
1909                     ; Alias variable for select char @ 0
1910     003a    send_byte__char__741select0 equ send_byte__char+0
1911     003a    send_byte__char__741select0__byte equ send_byte__char+0
1912     0000    send_byte__char__741select0__bit equ 0
1913                     ; expression=`{ char @ 0 }' exp_delay=0 true_delay=1  false_delay=1 true_size=1 false_size=1
1914 352 183a            btfsc send_byte__char__741select0__byte,send_byte__char__741select0__bit
1915                     ; if { char @ 0 } body start
1916                     ;   porta := space  
1917 353 30ff            movlw 255
1918                     ; 1 instructions found for sharing
1919 354 1c3a            btfss send_byte__char__741select0__byte,send_byte__char__741select0__bit
1920                     ; else body start
1921                     ;   porta := mark  
1922 355 083d            movf send_byte__mark,w
1923                     ; 1 instructions found for sharing
1924                     ; if exp=` char @ 0 ' single true and false skip delay=4
1925                     ; Other expression=`{ char @ 0 }' delay=4
1926                     ; 1 shared instructions follow
1927 356 0085            movwf porta
1928                     ; if { char @ 0 } end
1929                     ;   char := char >> 1  
1930 357 1003            bcf c___byte,c___bit
1931 358 0cba            rrf send_byte__char,f
1932                     ;   call delay {{ }}  
1933 359 237d            call delay
1934                     ;   call delay {{ }}  
1935 35a 237d            call delay
1936                     ;   call delay {{ }}  
1937 35b 237d            call delay
1938 35c 0bbc            decfsz send_byte__count,f
1939 35d 2b52            goto send_byte__740_loop
1940             send_byte__740_done:
1941                     ; `count_down count 8 ...' end
1942                     ; Send the stop bit :
1943                     ;   porta := space  
1944 35e 30ff            movlw 255
1945 35f 0085            movwf porta
1946                     ;   call delay {{ }}  
1947 360 237d            call delay
1948                     ;   call delay {{ }}  
1949 361 237d            call delay
1950                     ;   call delay {{ }}  
1951 362 237d            call delay
1952                     ; procedure send_byte end
1953 363 3400            retlw 0
1954             
1955                     ; procedure master_send start
1956             master_send:
1957     003e    master_send__variables__base equ global__variables__bank0+50
1958     003e    master_send__bytes__base equ master_send__variables__base+0
1959     003f    master_send__bits__base equ master_send__variables__base+1
1960     0001    master_send__total__bytes equ 1
1961     003e    master_send__character equ master_send__bytes__base+0
1962                     ; This procedure will output < character > to the master .
1963                     ;   call send_byte {{ character , tx_master_mask }}  
1964 364 083e            movf master_send__character,w
1965 365 00ba            movwf send_byte__char
1966 366 3004            movlw 4
1967 367 00bb            movwf send_byte__mask
1968 368 2349            call send_byte
1969                     ; procedure master_send end
1970 369 3400            retlw 0
1971             
1972                     ; procedure master_string start
1973             master_string:
1974     003f    master_string__variables__base equ global__variables__bank0+51
1975     003f    master_string__bytes__base equ master_string__variables__base+0
1976     0042    master_string__bits__base equ master_string__variables__base+3
1977     0003    master_string__total__bytes equ 3
1978     003f    master_string__message equ master_string__bytes__base+0
1979                     ; This procedure will output < message > to the master .
1980     0040    master_string__size equ master_string__bytes__base+1
1981     0041    master_string__index equ master_string__bytes__base+2
1982                     ;   index := 0  
1983 36a 01c1            clrf master_string__index
1984                     ; `while  index < message . size  ...' start
1985             master_string__778while__continue:
1986 36b 018a            clrf pclath___register
1987 36c 083f            movf master_string__message,w
1988 36d 200b            call string___fetch
1989 36e 0241            subwf master_string__index,w
1990                     ; expression=` index < message . size ' exp_delay=4 true_delay=7  false_delay=2 true_size=8 false_size=1
1991 36f 1803            btfsc c___byte,c___bit
1992 370 2b79            goto master_string__778while__break
1993                     ;   call master_send {{ message ~~ {{ index }} }}  
1994 371 0a41            incf master_string__index,w
1995 372 073f            addwf master_string__message,w
1996 373 018a            clrf pclath___register
1997 374 200b            call string___fetch
1998 375 00be            movwf master_send__character
1999 376 2364            call master_send
2000                     ;   index := index + 1  
2001 377 0ac1            incf master_string__index,f
2002 378 2b6b            goto master_string__778while__continue
2003                     ; if exp=` index < message . size ' false goto
2004                     ; Other expression=` index < message . size ' delay=-1
2005             master_string__778while__break:
2006                     ; `while  index < message . size  ...' end
2007                     ;   call master_send {{ sp }}  
2008 379 3020            movlw 32
2009 37a 00be            movwf master_send__character
2010 37b 2364            call master_send
2011                     ; procedure master_string end
2012 37c 3400            retlw 0
2013             
2014                     ; procedure delay start
2015                     ; optimize 0
2016             delay:
2017     0042    delay__variables__base equ global__variables__bank0+54
2018     0042    delay__bytes__base equ delay__variables__base+0
2019     0043    delay__bits__base equ delay__variables__base+1
2020     0001    delay__total__bytes equ 1
2021     0042    delay__785byte1 equ delay__bytes__base+0
2022                     ;   arguments_none  
2023                     ;   uniform_delay instructions_per_delay  
2024                     ; Uniform delay remaining = 134 Accumulated Delay = 0
2025                     ; Uniform delay remaining = 134 Accumulated Delay = 0
2026                     ; Delay 1 third of a bit :
2027                     ; Uniform delay remaining = 134 Accumulated Delay = 0
2028                     ; Uniform delay remaining = 134 Accumulated Delay = 0
2029                     ; Soak up remaining 134 cycles
2030                     ; Delay 134 cycles
2031 37d 302c            movlw 44
2032 37e 00c2            movwf delay__785byte1
2033             delay__785delay0:
2034 37f 0bc2            decfsz delay__785byte1,f
2035 380 2b7f            goto delay__785delay0
2036 381 0000            nop
2037                     ; procedure delay end
2038 382 3400            retlw 0
2039                     ; optimize 1
2040             
2041                     ; Register bank 0 used 55 bytes of 68 available bytes
2042                     ; Register bank 1 used 0 bytes of 0 available bytes
2043             
2044                     end

