  1                     radix dec
  2     000c    global__variables__bank0 equ 12
  3     00ff    global__variables__bank1 equ 255
  4     0046    global__bit__variables__bank0 equ 70
  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 2872            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 Motor2 RoboBrick . See :}
 54                     ; comment {}
 55                     ; comment {http : / / web . gramlich . net / projects / robobricks / motor2 / 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                     ;   constant sp 32  
 77     0020    sp equ 32
 78                     ;   constant cr 13  
 79     000d    cr equ 13
 80                     ;   constant lf 10  
 81     000a    lf equ 10
 82                     ; comment {Some bit definitions :}
 83                     ;   constant rx_slave_bit 0  
 84     0000    rx_slave_bit equ 0
 85                     ;   constant tx_slave_bit 1  
 86     0001    tx_slave_bit equ 1
 87                     ;   constant tx_master_bit 2  
 88     0002    tx_master_bit equ 2
 89                     ;   constant rx_master_bit 3  
 90     0003    rx_master_bit equ 3
 91                     ;   constant rx_slave_mask 1 << rx_slave_bit  
 92     0001    rx_slave_mask equ 1
 93                     ;   constant tx_slave_mask 1 << tx_slave_bit  
 94     0002    tx_slave_mask equ 2
 95                     ;   constant rx_master_mask 1 << rx_master_bit  
 96     0008    rx_master_mask equ 8
 97                     ;   constant tx_master_mask 1 << tx_master_bit  
 98     0004    tx_master_mask equ 4
 99     0003    status equ 3
100                     ;   bind c status @ 0  
101     0003    c equ status+0
102     0003    c__byte equ status+0
103     0000    c__bit equ 0
104                     ;   bind z status @ 2  
105     0003    z equ status+0
106     0003    z__byte equ status+0
107     0002    z__bit equ 2
108     0005    porta equ 5
109     0005    tx_master_pin__byte equ 5
110     0002    tx_master_pin__bit equ 2
111     0005    rx_master_pin__byte equ 5
112     0003    rx_master_pin__bit equ 3
113     0005    tx_slave_pin__byte equ 5
114     0001    tx_slave_pin__bit equ 1
115     0005    rx_slave_pin__byte equ 5
116     0000    rx_slave_pin__bit equ 0
117     0005    heart__byte equ 5
118     0004    heart__bit equ 4
119                     ;   constant space 0xff  
120     00ff    space equ 255
121                     ;   constant buffer_size 5  
122     0005    buffer_size equ 5
123                     ; string_constants Start
124             string___fetch:
125 00b 0082            movwf pcl___register
126                     ;   clock_string = 0s'Clk'  
127     0000    clock_string___string equ 0
128             clock_string:
129 00c 0782            addwf pcl___register,f
130                     ; Length = 3
131 00d 3403            retlw 3
132                     ; `Clk'
133 00e 3443            retlw 67
134 00f 346c            retlw 108
135 010 346b            retlw 107
136                     ;   common_string = 0s'Common'  
137     0005    common_string___string equ 5
138             common_string:
139 011 0782            addwf pcl___register,f
140                     ; Length = 6
141 012 3406            retlw 6
142                     ; `Common'
143 013 3443            retlw 67
144 014 346f            retlw 111
145 015 346d            retlw 109
146 016 346d            retlw 109
147 017 346f            retlw 111
148 018 346e            retlw 110
149                     ;   direction_string = 0s'Dir'  
150     000d    direction_string___string equ 13
151             direction_string:
152 019 0782            addwf pcl___register,f
153                     ; Length = 3
154 01a 3403            retlw 3
155                     ; `Dir'
156 01b 3444            retlw 68
157 01c 3469            retlw 105
158 01d 3472            retlw 114
159                     ;   done_string = 0s'Done'  
160     0012    done_string___string equ 18
161             done_string:
162 01e 0782            addwf pcl___register,f
163                     ; Length = 4
164 01f 3404            retlw 4
165                     ; `Done'
166 020 3444            retlw 68
167 021 346f            retlw 111
168 022 346e            retlw 110
169 023 3465            retlw 101
170                     ;   fail_string = 0s'Fail'  
171     0018    fail_string___string equ 24
172             fail_string:
173 024 0782            addwf pcl___register,f
174                     ; Length = 4
175 025 3404            retlw 4
176                     ; `Fail'
177 026 3446            retlw 70
178 027 3461            retlw 97
179 028 3469            retlw 105
180 029 346c            retlw 108
181                     ;   failsafe_string = 0s'F/S'  
182     001e    failsafe_string___string equ 30
183             failsafe_string:
184 02a 0782            addwf pcl___register,f
185                     ; Length = 3
186 02b 3403            retlw 3
187                     ; `F/S'
188 02c 3446            retlw 70
189 02d 342f            retlw 47
190 02e 3453            retlw 83
191                     ;   hello_string = 0s'Motor2_Test'  
192     0023    hello_string___string equ 35
193             hello_string:
194 02f 0782            addwf pcl___register,f
195                     ; Length = 11
196 030 340b            retlw 11
197                     ; `Motor2_Test'
198 031 344d            retlw 77
199 032 346f            retlw 111
200 033 3474            retlw 116
201 034 346f            retlw 111
202 035 3472            retlw 114
203 036 3432            retlw 50
204 037 345f            retlw 95
205 038 3454            retlw 84
206 039 3465            retlw 101
207 03a 3473            retlw 115
208 03b 3474            retlw 116
209                     ;   mode_string = 0s'Mode'  
210     0030    mode_string___string equ 48
211             mode_string:
212 03c 0782            addwf pcl___register,f
213                     ; Length = 4
214 03d 3404            retlw 4
215                     ; `Mode'
216 03e 344d            retlw 77
217 03f 346f            retlw 111
218 040 3464            retlw 100
219 041 3465            retlw 101
220                     ;   mode_dir_string = 0s'M/D'  
221     0036    mode_dir_string___string equ 54
222             mode_dir_string:
223 042 0782            addwf pcl___register,f
224                     ; Length = 3
225 043 3403            retlw 3
226                     ; `M/D'
227 044 344d            retlw 77
228 045 342f            retlw 47
229 046 3444            retlw 68
230                     ;   motor_string = 0s'Motor'  
231     003b    motor_string___string equ 59
232             motor_string:
233 047 0782            addwf pcl___register,f
234                     ; Length = 5
235 048 3405            retlw 5
236                     ; `Motor'
237 049 344d            retlw 77
238 04a 346f            retlw 111
239 04b 3474            retlw 116
240 04c 346f            retlw 111
241 04d 3472            retlw 114
242                     ;   ramps = 0 , 1 , 0x10 , 0x80 , 0xff  
243     0042    ramps___string equ 66
244             ramps:
245 04e 0782            addwf pcl___register,f
246                     ; Length = 5
247 04f 3405            retlw 5
248                     ; 0
249 050 3400            retlw 0
250                     ; 1
251 051 3401            retlw 1
252                     ; 0x10
253 052 3410            retlw 16
254                     ; 0x80
255 053 3480            retlw 128
256                     ; 0xff
257 054 34ff            retlw 255
258                     ;   ramp_string = 0s'Ramp'  
259     0049    ramp_string___string equ 73
260             ramp_string:
261 055 0782            addwf pcl___register,f
262                     ; Length = 4
263 056 3404            retlw 4
264                     ; `Ramp'
265 057 3452            retlw 82
266 058 3461            retlw 97
267 059 346d            retlw 109
268 05a 3470            retlw 112
269                     ;   scaler_string = 0s'Scaler'  
270     004f    scaler_string___string equ 79
271             scaler_string:
272 05b 0782            addwf pcl___register,f
273                     ; Length = 6
274 05c 3406            retlw 6
275                     ; `Scaler'
276 05d 3453            retlw 83
277 05e 3463            retlw 99
278 05f 3461            retlw 97
279 060 346c            retlw 108
280 061 3465            retlw 101
281 062 3472            retlw 114
282                     ;   speeds = 0x10 , 0x20 , 0x40 , 0x80 , 0xff , 0  
283     0057    speeds___string equ 87
284             speeds:
285 063 0782            addwf pcl___register,f
286                     ; Length = 6
287 064 3406            retlw 6
288                     ; 0x10
289 065 3410            retlw 16
290                     ; 0x20
291 066 3420            retlw 32
292                     ; 0x40
293 067 3440            retlw 64
294                     ; 0x80
295 068 3480            retlw 128
296                     ; 0xff
297 069 34ff            retlw 255
298                     ; 0
299 06a 3400            retlw 0
300                     ;   speed_string = 0s'Speed'  
301     005f    speed_string___string equ 95
302             speed_string:
303 06b 0782            addwf pcl___register,f
304                     ; Length = 5
305 06c 3405            retlw 5
306                     ; `Speed'
307 06d 3453            retlw 83
308 06e 3470            retlw 112
309 06f 3465            retlw 101
310 070 3465            retlw 101
311 071 3464            retlw 100
312                     ; string__constants End
313             
314                     ; procedure main start
315             main:
316     000c    main__variables__base equ global__variables__bank0+0
317     000c    main__bytes__base equ main__variables__base+0
318     0016    main__bits__base equ main__variables__base+10
319     000a    main__total__bytes equ 10
320     0015    main__106byte0 equ main__bytes__base+9
321     0015    main__134byte0 equ main__bytes__base+9
322                     ;   arguments_none  
323                     ; Read a byte .
324     000c    main__buffer equ main__bytes__base+0
325     0011    main__char equ main__bytes__base+5
326     0012    main__count equ main__bytes__base+6
327     0013    main__index equ main__bytes__base+7
328     0014    main__number equ main__bytes__base+8
329                     ; Print out a welcome message :
330                     ;   call master_crlf {{ }}  
331 072 233a            call master_crlf
332                     ;   call master_string {{ hello_string }}  
333 073 3030            movlw LOW hello_string+1
334 074 00c2            movwf master_string__message
335 075 23dd            call master_string
336                     ;   call master_crlf {{ }}  
337 076 233a            call master_crlf
338                     ; Main loop
339                     ;   number := 0  
340 077 0194            clrf main__number
341                     ; loop_forever ... start
342             main__94loop__forever:
343                     ; Get a character :
344                     ;   tx_slave_pin := 1  
345 078 1485            bsf tx_slave_pin__byte,tx_slave_pin__bit
346                     ;   char := master_get {{ }}  
347 079 234c            call master_get
348 07a 0831            movf master_get__0return__byte,w
349 07b 0091            movwf main__char
350                     ; Delay 2 / 3 ' s of bit make sure that get_byte is done .
351                     ;   call delay {{ }}  
352 07c 23f0            call delay
353                     ;   call delay {{ }}  
354 07d 23f0            call delay
355                     ; if { 0c'0' <= char && char < {{ 0c'9' + 1 }} } start
356 07e 3030            movlw 48
357 07f 0211            subwf main__char,w
358                     ; expression=`0c'0' <= char' exp_delay=2 true_delay=-1  false_delay=1 true_size=127 false_size=1
359 080 1c03            btfss c___byte,c___bit
360 081 2892            goto and103__0false
361 082 303a            movlw 58
362 083 0211            subwf main__char,w
363                     ; expression=`char < {{ 0c'9' + 1 }}' exp_delay=2 true_delay=9  false_delay=-1 true_size=11 false_size=111
364 084 1803            btfsc c___byte,c___bit
365 085 2892            goto label103__1false
366             label103__1true:
367             and103__0true:
368                     ; if { 0c'0' <= char && char < {{ 0c'9' + 1 }} } body start
369                     ; Do a multiply by 8 then add in digit :
370                     ;   call master_send {{ char }}  
371 086 0811            movf main__char,w
372 087 00c1            movwf master_send__character
373 088 23d7            call master_send
374                     ;   number := {{ number << 3 }} + char - 0c'0'  
375 089 0d14            rlf main__number,w
376 08a 0095            movwf main__106byte0
377 08b 0d95            rlf main__106byte0,f
378 08c 0d15            rlf main__106byte0,w
379 08d 39f8            andlw 248
380 08e 0711            addwf main__char,w
381 08f 3ed0            addlw 208
382 090 0094            movwf main__number
383                     ; if { 0c'0' <= char && char < {{ 0c'9' + 1 }} } body end
384 091 2901            goto label103__1end
385             label103__1false:
386             and103__0false:
387 092 3073            movlw 115
388 093 0211            subwf main__char,w
389                     ; expression=`{ char = 0c's' }' exp_delay=2 true_delay=-1  false_delay=-1 true_size=8 false_size=98
390 094 1d03            btfss z___byte,z___bit
391 095 289f            goto label107__0false
392             label107__0true:
393                     ; else_if { char = 0c's' } body start
394                     ; Send byte to brick , no wait :
395                     ; Echo command and send CRLF :
396                     ;   call master_send {{ char }}  
397 096 0811            movf main__char,w
398 097 00c1            movwf master_send__character
399 098 23d7            call master_send
400                     ;   call master_crlf {{ }}  
401 099 233a            call master_crlf
402                     ; Ship the byte down to the brick :
403                     ;   call slave_send {{ number }}  
404 09a 0814            movf main__number,w
405 09b 00b8            movwf slave_send__data
406 09c 2391            call slave_send
407                     ;   number := 0  
408 09d 0194            clrf main__number
409                     ; else_if { char = 0c's' } body end
410 09e 2901            goto label107__0end
411             label107__0false:
412 09f 3077            movlw 119
413 0a0 0211            subwf main__char,w
414                     ; expression=`{ char = 0c'w' }' exp_delay=2 true_delay=-1  false_delay=-1 true_size=37 false_size=56
415 0a1 1d03            btfss z___byte,z___bit
416 0a2 28c9            goto label118__0false
417             label118__0true:
418                     ; else_if { char = 0c'w' } body start
419                     ; Send byte to brick , wait for results :
420                     ; Echo command and send CRLF :
421                     ;   call master_send {{ char }}  
422 0a3 0811            movf main__char,w
423 0a4 00c1            movwf master_send__character
424 0a5 23d7            call master_send
425                     ;   call master_crlf {{ }}  
426 0a6 233a            call master_crlf
427                     ; Ship the byte down to the brick ...
428                     ;   call slave_send {{ number }}  
429 0a7 0814            movf main__number,w
430 0a8 00b8            movwf slave_send__data
431 0a9 2391            call slave_send
432                     ;   number := 0  
433 0aa 0194            clrf main__number
434                     ; call delay < >
435                     ; ... and wait for a response :
436                     ;   index := 0  
437 0ab 0193            clrf main__index
438                     ; `while  index < buffer_size  ...' start
439             main__133while__continue:
440 0ac 3005            movlw 5
441 0ad 0213            subwf main__index,w
442                     ; expression=` index < buffer_size ' exp_delay=2 true_delay=9  false_delay=2 true_size=10 false_size=1
443 0ae 1803            btfsc c___byte,c___bit
444 0af 28ba            goto main__133while__break
445                     ;   buffer ~~ {{ index }} := slave_get {{ }}  
446 0b0 236b            call slave_get
447 0b1 0834            movf slave_get__0return__byte,w
448 0b2 0095            movwf main__134byte0
449 0b3 300c            movlw LOW main__buffer
450 0b4 0713            addwf main__index,w
451 0b5 0084            movwf fsr___register
452 0b6 0815            movf main__134byte0,w
453 0b7 0080            movwf indf___register
454                     ;   index := index + 1  
455 0b8 0a93            incf main__index,f
456 0b9 28ac            goto main__133while__continue
457                     ; if exp=` index < buffer_size ' false goto
458                     ; Other expression=` index < buffer_size ' delay=-1
459             main__133while__break:
460                     ; `while  index < buffer_size  ...' end
461                     ;   index := 0  
462 0ba 0193            clrf main__index
463                     ; `while  index < buffer_size  ...' start
464             main__139while__continue:
465 0bb 3005            movlw 5
466 0bc 0213            subwf main__index,w
467                     ; expression=` index < buffer_size ' exp_delay=2 true_delay=7  false_delay=2 true_size=8 false_size=1
468 0bd 1803            btfsc c___byte,c___bit
469 0be 28c7            goto main__139while__break
470                     ;   call master_octal {{ buffer ~~ {{ index }} }}  
471 0bf 300c            movlw LOW main__buffer
472 0c0 0713            addwf main__index,w
473 0c1 0084            movwf fsr___register
474 0c2 0800            movf indf___register,w
475 0c3 00b2            movwf master_octal__number
476 0c4 2352            call master_octal
477                     ;   index := index + 1  
478 0c5 0a93            incf main__index,f
479 0c6 28bb            goto main__139while__continue
480                     ; if exp=` index < buffer_size ' false goto
481                     ; Other expression=` index < buffer_size ' delay=-1
482             main__139while__break:
483                     ; `while  index < buffer_size  ...' end
484                     ; Terminate the output list
485                     ;   call master_crlf {{ }}  
486 0c7 233a            call master_crlf
487                     ; else_if { char = 0c'w' } body end
488 0c8 2901            goto label118__0end
489             label118__0false:
490 0c9 3069            movlw 105
491 0ca 0211            subwf main__char,w
492                     ; expression=`{ char = 0c'i' }' exp_delay=2 true_delay=-1  false_delay=-1 true_size=12 false_size=39
493 0cb 1d03            btfss z___byte,z___bit
494 0cc 28da            goto label146__0false
495             label146__0true:
496                     ; else_if { char = 0c'i' } body start
497                     ; Interrogate the slave RoboBrick :
498                     ;   call master_send {{ char }}  
499 0cd 0811            movf main__char,w
500 0ce 00c1            movwf master_send__character
501 0cf 23d7            call master_send
502                     ;   call master_crlf {{ }}  
503 0d0 233a            call master_crlf
504                     ; Initialize the id index :
505                     ;   call slave_send {{ 0xfd }}  
506 0d1 30fd            movlw 253
507 0d2 00b8            movwf slave_send__data
508 0d3 2391            call slave_send
509                     ; Get the first 8 bytes :
510                     ;   call slave_id8 {{ }}  
511 0d4 2371            call slave_id8
512                     ; Get the next 8 bytes of random numbers :
513                     ;   call slave_id8 {{ }}  
514 0d5 2371            call slave_id8
515                     ; Get the next 8 bytes of random numbers :
516                     ;   call slave_id8 {{ }}  
517 0d6 2371            call slave_id8
518                     ; Get the slave brick name :
519                     ;   call slave_id_string {{ }}  
520 0d7 2382            call slave_id_string
521                     ; Get the vendor name :
522                     ;   call slave_id_string {{ }}  
523 0d8 2382            call slave_id_string
524                     ; else_if { char = 0c'i' } body end
525 0d9 2901            goto label146__0end
526             label146__0false:
527 0da 3074            movlw 116
528 0db 0211            subwf main__char,w
529                     ; expression=`{ char = 0c't' }' exp_delay=2 true_delay=-1  false_delay=-1 true_size=5 false_size=29
530 0dc 1d03            btfss z___byte,z___bit
531 0dd 28e4            goto label169__0false
532             label169__0true:
533                     ; else_if { char = 0c't' } body start
534                     ; Do testing :
535                     ;   call master_send {{ char }}  
536 0de 0811            movf main__char,w
537 0df 00c1            movwf master_send__character
538 0e0 23d7            call master_send
539                     ;   call master_crlf {{ }}  
540 0e1 233a            call master_crlf
541                     ;   call test {{ }}  
542 0e2 2146            call test
543                     ; else_if { char = 0c't' } body end
544 0e3 2901            goto label169__0end
545             label169__0false:
546 0e4 3063            movlw 99
547 0e5 0211            subwf main__char,w
548                     ; expression=`{ char = 0c'c' }' exp_delay=2 true_delay=-1  false_delay=-1 true_size=5 false_size=19
549 0e6 1d03            btfss z___byte,z___bit
550 0e7 28ee            goto label174__0false
551             label174__0true:
552                     ; else_if { char = 0c'c' } body start
553                     ;   call master_send {{ char }}  
554 0e8 0811            movf main__char,w
555 0e9 00c1            movwf master_send__character
556 0ea 23d7            call master_send
557                     ;   call master_crlf {{ }}  
558 0eb 233a            call master_crlf
559                     ;   call clock_adjust {{ }}  
560 0ec 2102            call clock_adjust
561                     ; else_if { char = 0c'c' } body end
562 0ed 2901            goto label174__0end
563             label174__0false:
564 0ee 30fc            movlw 252
565 0ef 0211            subwf main__char,w
566                     ; expression=`{ char != 0xfc }' exp_delay=2 true_delay=-1  false_delay=0 true_size=15 false_size=0
567 0f0 1903            btfsc z___byte,z___bit
568 0f1 2901            goto label179__0end
569                     ; else_if { char != 0xfc } body start
570                     ; Just echo back the current number :
571                     ;   call master_send {{ 0c'<' }}  
572 0f2 303c            movlw 60
573 0f3 00c1            movwf master_send__character
574 0f4 23d7            call master_send
575                     ;   call master_octal {{ char }}  
576 0f5 0811            movf main__char,w
577 0f6 00b2            movwf master_octal__number
578 0f7 2352            call master_octal
579                     ;   call master_send {{ 0c'>' }}  
580 0f8 303e            movlw 62
581 0f9 00c1            movwf master_send__character
582 0fa 23d7            call master_send
583                     ; Send a carriage - return line - feed :
584                     ;   call master_crlf {{ }}  
585 0fb 233a            call master_crlf
586                     ; Output the character in octal :
587                     ;   call master_octal {{ number }}  
588 0fc 0814            movf main__number,w
589 0fd 00b2            movwf master_octal__number
590 0fe 2352            call master_octal
591                     ; Send a carriage - return line - feed :
592                     ;   call master_crlf {{ }}  
593 0ff 233a            call master_crlf
594                     ; Reset number
595                     ;   number := 0  
596 100 0194            clrf main__number
597                     ; else_if { char != 0xfc } body end
598             label179__0end:
599                     ; if exp=` char != 0xfc ' empty false
600                     ; Other expression=`{ char != 0xfc }' delay=-1
601                     ; if exp=` char = 0c'c' ' generic
602             label174__0end:
603                     ; Other expression=`{ char = 0c'c' }' delay=-1
604                     ; if exp=` char = 0c't' ' generic
605             label169__0end:
606                     ; Other expression=`{ char = 0c't' }' delay=-1
607                     ; if exp=` char = 0c'i' ' generic
608             label146__0end:
609                     ; Other expression=`{ char = 0c'i' }' delay=-1
610                     ; if exp=` char = 0c'w' ' generic
611             label118__0end:
612                     ; Other expression=`{ char = 0c'w' }' delay=-1
613                     ; if exp=` char = 0c's' ' generic
614             label107__0end:
615                     ; Other expression=`{ char = 0c's' }' delay=-1
616                     ; if exp=`char < {{ 0c'9' + 1 }}' generic
617             label103__1end:
618                     ; Other expression=`char < {{ 0c'9' + 1 }}' delay=-1
619                     ; if exp=`0c'0' <= char' false goto
620                     ; Other expression=`0c'0' <= char' delay=-1
621             and103__0end:
622                     ; if { 0c'0' <= char && char < {{ 0c'9' + 1 }} } end
623 101 2878            goto main__94loop__forever
624                     ; loop_forever ... end
625                     ; procedure main end
626             
627                     ; procedure clock_adjust start
628             clock_adjust:
629     0016    clock_adjust__variables__base equ global__variables__bank0+10
630     0016    clock_adjust__bytes__base equ clock_adjust__variables__base+0
631     001b    clock_adjust__bits__base equ clock_adjust__variables__base+5
632     0005    clock_adjust__total__bytes equ 5
633     001a    clock_adjust__252byte0 equ clock_adjust__bytes__base+4
634                     ;   arguments_none  
635                     ; This procedure will adjust the clock to the slave .
636                     ; The null pulse that comes back is supposed to be 9 bits long .
637                     ; At 4 Mhz = 1 instruction per microsecond , 9 bits is 9 / 2400 =
638                     ; 3 . 75 ms . The count loop below is 7 instruction long . 3 . 75 / . 007 =
639                     ; 536 = 0x217 . So we want our timer loop to get as close to 0x217
640                     ; as possible .
641     0016    clock_adjust__error equ clock_adjust__bytes__base+0
642     0017    clock_adjust__error_minimum equ clock_adjust__bytes__base+1
643     0018    clock_adjust__high equ clock_adjust__bytes__base+2
644     0019    clock_adjust__low equ clock_adjust__bytes__base+3
645                     ;   call master_string {{ clock_string }}  
646 102 300d            movlw LOW clock_string+1
647 103 00c2            movwf master_string__message
648 104 23dd            call master_string
649                     ;   error := 0xff  
650 105 30ff            movlw 255
651 106 0096            movwf clock_adjust__error
652                     ;   error_minimum := 0xf0  
653 107 30f0            movlw 240
654 108 0097            movwf clock_adjust__error_minimum
655                     ; `while  error > error_minimum  ...' start
656             clock_adjust__221while__continue:
657 109 0816            movf clock_adjust__error,w
658 10a 0217            subwf clock_adjust__error_minimum,w
659                     ; expression=` error > error_minimum ' exp_delay=2 true_delay=1  false_delay=2 true_size=55 false_size=1
660 10b 1803            btfsc c___byte,c___bit
661 10c 2944            goto clock_adjust__221while__break
662                     ; Ask for a timing byte :
663                     ;   call slave_send {{ 0xfb }}  
664 10d 30fb            movlw 251
665 10e 00b8            movwf slave_send__data
666 10f 2391            call slave_send
667                     ;   low := 0  
668 110 0199            clrf clock_adjust__low
669                     ;   high := 0  
670 111 0198            clrf clock_adjust__high
671                     ; `while rx_slave_pin ...' start
672             clock_adjust__227while__continue:
673                     ; expression=`rx_slave_pin' exp_delay=0 true_delay=2  false_delay=2 true_size=1 false_size=1
674 112 1805            btfsc rx_slave_pin__byte,rx_slave_pin__bit
675                     ; Do nothing :
676 113 2912            goto clock_adjust__227while__continue
677 114 2915            goto clock_adjust__227while__break
678                     ; if exp=`rx_slave_pin' true goto small true
679             clock_adjust__227while__break:
680                     ; `while rx_slave_pin ...' end
681                     ; `while  ! rx_slave_pin  ...' start
682             clock_adjust__230while__continue:
683                     ; expression=`rx_slave_pin' exp_delay=0 true_delay=2  false_delay=5 true_size=1 false_size=4
684 115 1805            btfsc rx_slave_pin__byte,rx_slave_pin__bit
685 116 291b            goto clock_adjust__230while__break
686                     ;   low := low + 1  
687 117 0a99            incf clock_adjust__low,f
688                     ; if { z } start
689                     ; expression=`{ z }' exp_delay=0 true_delay=1  false_delay=0 true_size=1 false_size=0
690 118 1903            btfsc z__byte,z__bit
691                     ; if { z } body start
692                     ;   high := high + 1  
693 119 0a98            incf clock_adjust__high,f
694                     ; if { z } body end
695                     ; if exp=`z' false skip delay=2
696                     ; Other expression=`{ z }' delay=2
697                     ; if { z } end
698 11a 2915            goto clock_adjust__230while__continue
699                     ; if exp=`rx_slave_pin' true goto
700                     ; Other expression=`rx_slave_pin' delay=-1
701             clock_adjust__230while__break:
702                     ; `while  ! rx_slave_pin  ...' end
703                     ; If high is less than 2 , things are probably pretty broken .
704                     ; We ' ll try a little fix here , but we are probably pretty
705                     ; screwed up .
706                     ; if { high < 2 } start
707 11b 3002            movlw 2
708 11c 0218            subwf clock_adjust__high,w
709                     ; expression=`{ high < 2 }' exp_delay=2 true_delay=1  false_delay=0 true_size=1 false_size=0
710 11d 1c03            btfss c___byte,c___bit
711                     ; if { high < 2 } body start
712                     ;   low := 0  
713 11e 0199            clrf clock_adjust__low
714                     ; if { high < 2 } body end
715                     ; if exp=` high < 2 ' false skip delay=4
716                     ; Other expression=`{ high < 2 }' delay=4
717                     ; if { high < 2 } end
718                     ;   call master_octal {{ low }}  
719 11f 0819            movf clock_adjust__low,w
720 120 00b2            movwf master_octal__number
721 121 2352            call master_octal
722                     ; Now think about adjusting clock .
723                     ; if { low > 0x17 } start
724 122 3018            movlw 24
725 123 0219            subwf clock_adjust__low,w
726                     ; expression=`{ low > 0x17 }' exp_delay=2 true_delay=4  false_delay=-1 true_size=6 false_size=15
727 124 1803            btfsc c___byte,c___bit
728 125 2936            goto label245__0true
729             label245__0false:
730 126 3017            movlw 23
731 127 0219            subwf clock_adjust__low,w
732                     ; expression=`{ low < 0x17 }' exp_delay=2 true_delay=6  false_delay=2 true_size=8 false_size=2
733 128 1c03            btfss c___byte,c___bit
734 129 292d            goto label250__0true
735             label250__0false:
736                     ; else body start
737                     ;   error := 0  
738 12a 0196            clrf clock_adjust__error
739                     ;   error_minimum := 0  
740 12b 0197            clrf clock_adjust__error_minimum
741                     ; else body end
742 12c 2935            goto label250__0end
743             label250__0true:
744                     ; else_if { low < 0x17 } body start
745                     ; Slave clock is too fast < i . e . pulse too short . >
746                     ;   error := 0x17 - low  
747 12d 3017            movlw 23
748 12e 009a            movwf clock_adjust__252byte0
749 12f 0819            movf clock_adjust__low,w
750 130 021a            subwf clock_adjust__252byte0,w
751 131 0096            movwf clock_adjust__error
752                     ; Decrement clock :
753                     ;   call slave_send {{ 0xf8 }}  
754 132 30f8            movlw 248
755 133 00b8            movwf slave_send__data
756 134 2391            call slave_send
757                     ; else_if { low < 0x17 } body end
758                     ; if exp=` low < 0x17 ' generic
759             label250__0end:
760                     ; Other expression=`{ low < 0x17 }' delay=-1
761 135 293c            goto label245__0end
762             label245__0true:
763                     ; if { low > 0x17 } body start
764                     ; Slave clock is too slow < i . e . pulse too long . >
765                     ;   error := low - 0x17  
766 136 30e9            movlw 233
767 137 0719            addwf clock_adjust__low,w
768 138 0096            movwf clock_adjust__error
769                     ; Increment clock :
770                     ;   call slave_send {{ 0xf9 }}  
771 139 30f9            movlw 249
772 13a 00b8            movwf slave_send__data
773 13b 2391            call slave_send
774                     ; if { low > 0x17 } body end
775                     ; if exp=` low > 0x17 ' generic
776             label245__0end:
777                     ; Other expression=`{ low > 0x17 }' delay=-1
778                     ; if { low > 0x17 } end
779                     ; if { error < error_minimum } start
780 13c 0817            movf clock_adjust__error_minimum,w
781 13d 0216            subwf clock_adjust__error,w
782                     ; expression=`{ error < error_minimum }' exp_delay=2 true_delay=3  false_delay=0 true_size=3 false_size=0
783 13e 1803            btfsc c___byte,c___bit
784 13f 2943            goto label259__0end
785                     ; if { error < error_minimum } body start
786                     ;   error_minimum := error  
787 140 0816            movf clock_adjust__error,w
788 141 0097            movwf clock_adjust__error_minimum
789                     ;   error := error + 1  
790 142 0a96            incf clock_adjust__error,f
791                     ; if { error < error_minimum } body end
792             label259__0end:
793                     ; if exp=` error < error_minimum ' empty false
794                     ; Other expression=`{ error < error_minimum }' delay=-1
795                     ; if { error < error_minimum } end
796 143 2909            goto clock_adjust__221while__continue
797                     ; if exp=` error > error_minimum ' false goto
798                     ; Other expression=` error > error_minimum ' delay=-1
799             clock_adjust__221while__break:
800                     ; `while  error > error_minimum  ...' end
801                     ;   call master_crlf {{ }}  
802 144 233a            call master_crlf
803                     ; procedure clock_adjust end
804 145 3400            retlw 0
805             
806                     ; procedure test start
807             test:
808     001b    test__variables__base equ global__variables__bank0+15
809     001b    test__bytes__base equ test__variables__base+0
810     0028    test__bits__base equ test__variables__base+13
811     000d    test__total__bytes equ 13
812     0027    test__404byte0 equ test__bytes__base+12
813     0027    test__401byte0 equ test__bytes__base+12
814                     ;   arguments_none  
815                     ; This procedure will test the Motor2 RoboBrick :
816     001b    test__counter1 equ test__bytes__base+0
817     001c    test__counter2 equ test__bytes__base+1
818     001d    test__direction equ test__bytes__base+2
819     001e    test__failsafe equ test__bytes__base+3
820     001f    test__mode equ test__bytes__base+4
821     0020    test__motor equ test__bytes__base+5
822     0021    test__prescaler equ test__bytes__base+6
823     0022    test__ramp equ test__bytes__base+7
824     0023    test__ramp_index equ test__bytes__base+8
825     0024    test__speed_index equ test__bytes__base+9
826     0025    test__speed equ test__bytes__base+10
827     0026    test__temp equ test__bytes__base+11
828                     ; Adjust the clock :
829                     ;   call clock_adjust {{ }}  
830 146 2102            call clock_adjust
831                     ; Verify that the common commands are working :
832                     ;   call common_test {{ }}  
833 147 229e            call common_test
834                     ; Reset everything :
835                     ;   call slave_send {{ 0xa4 }}  
836 148 30a4            movlw 164
837 149 00b8            movwf slave_send__data
838 14a 2391            call slave_send
839                     ; Test with prescaler :
840                     ;   call master_string {{ scaler_string }}  
841 14b 305c            movlw LOW scaler_string+1
842 14c 00c2            movwf master_string__message
843 14d 23dd            call master_string
844                     ;   call master_crlf {{ }}  
845 14e 233a            call master_crlf
846                     ;   prescaler := 0  
847 14f 01a1            clrf test__prescaler
848                     ; `while  prescaler <= 7  ...' start
849             test__299while__continue:
850 150 3008            movlw 8
851 151 0221            subwf test__prescaler,w
852                     ; expression=` prescaler <= 7 ' exp_delay=2 true_delay=1  false_delay=2 true_size=24 false_size=1
853 152 1803            btfsc c___byte,c___bit
854 153 296b            goto test__299while__break
855                     ; Set Prescaler :
856                     ;   call slave_send {{ 0x90 | prescaler }}  
857 154 3090            movlw 144
858 155 0421            iorwf test__prescaler,w
859 156 00b8            movwf slave_send__data
860 157 2391            call slave_send
861                     ; Read prescaler :
862                     ;   call slave_send {{ 0x99 }}  
863 158 3099            movlw 153
864 159 00b8            movwf slave_send__data
865 15a 2391            call slave_send
866                     ;   temp := slave_get {{ }}  
867 15b 236b            call slave_get
868 15c 0834            movf slave_get__0return__byte,w
869 15d 00a6            movwf test__temp
870                     ; if { temp != prescaler } start
871 15e 0221            subwf test__prescaler,w
872                     ; expression=`{ temp != prescaler }' exp_delay=2 true_delay=4  false_delay=0 true_size=8 false_size=0
873 15f 1903            btfsc z___byte,z___bit
874 160 2969            goto label307__0end
875                     ; if { temp != prescaler } body start
876                     ;   call master_octal {{ temp }}  
877 161 0826            movf test__temp,w
878 162 00b2            movwf master_octal__number
879 163 2352            call master_octal
880                     ;   call master_fail {{ scaler_string , 0x30 }}  
881 164 305c            movlw LOW scaler_string+1
882 165 00af            movwf master_fail__test_name
883 166 3030            movlw 48
884 167 00b0            movwf master_fail__test_number
885 168 2341            call master_fail
886                     ; if { temp != prescaler } body end
887             label307__0end:
888                     ; if exp=` temp != prescaler ' empty false
889                     ; Other expression=`{ temp != prescaler }' delay=-1
890                     ; if { temp != prescaler } end
891                     ;   prescaler := prescaler + 1  
892 169 0aa1            incf test__prescaler,f
893 16a 2950            goto test__299while__continue
894                     ; if exp=` prescaler <= 7 ' false goto
895                     ; Other expression=` prescaler <= 7 ' delay=-1
896             test__299while__break:
897                     ; `while  prescaler <= 7  ...' end
898                     ; Reset the prescaler to 5 :
899                     ;   call slave_send {{ 0x95 }}  
900 16b 3095            movlw 149
901 16c 00b8            movwf slave_send__data
902 16d 2391            call slave_send
903                     ; Test failsafe :
904                     ;   call master_string {{ failsafe_string }}  
905 16e 302b            movlw LOW failsafe_string+1
906 16f 00c2            movwf master_string__message
907 170 23dd            call master_string
908                     ;   call master_crlf {{ }}  
909 171 233a            call master_crlf
910                     ; Set failsafe :
911                     ;   call slave_send {{ 0x82 }}  
912 172 3082            movlw 130
913 173 00b8            movwf slave_send__data
914 174 2391            call slave_send
915                     ;   call slave_send {{ 0xff }}  
916 175 30ff            movlw 255
917 176 00b8            movwf slave_send__data
918 177 2391            call slave_send
919                     ; Set speed :
920                     ;   call slave_send {{ 0x3c }}  
921 178 303c            movlw 60
922 179 00b8            movwf slave_send__data
923 17a 2391            call slave_send
924                     ; Wait for failsafe to trigger :
925                     ;   failsafe := 0xff  
926 17b 30ff            movlw 255
927 17c 009e            movwf test__failsafe
928                     ; `while  failsafe != 0  ...' start
929             test__329while__continue:
930 17d 081e            movf test__failsafe,w
931                     ; expression=` failsafe != 0 ' exp_delay=1 true_delay=4  false_delay=2 true_size=7 false_size=1
932 17e 1903            btfsc z___byte,z___bit
933 17f 2987            goto test__329while__break
934                     ;   call slave_send {{ 0xa1 }}  
935 180 30a1            movlw 161
936 181 00b8            movwf slave_send__data
937 182 2391            call slave_send
938                     ;   failsafe := slave_get {{ }}  
939 183 236b            call slave_get
940 184 0834            movf slave_get__0return__byte,w
941 185 009e            movwf test__failsafe
942 186 297d            goto test__329while__continue
943                     ; if exp=` failsafe != 0 ' false goto
944                     ; Other expression=` failsafe != 0 ' delay=-1
945             test__329while__break:
946                     ; `while  failsafe != 0  ...' end
947                     ; Read failsafe error counter :
948                     ;   call slave_send {{ 0xa0 }}  
949 187 30a0            movlw 160
950 188 00b8            movwf slave_send__data
951 189 2391            call slave_send
952                     ;   temp := slave_get {{ }}  
953 18a 236b            call slave_get
954 18b 0834            movf slave_get__0return__byte,w
955 18c 00a6            movwf test__temp
956                     ; if { temp != 1 } start
957 18d 0326            decf test__temp,w
958                     ; expression=`{ temp != 1 }' exp_delay=1 true_delay=4  false_delay=0 true_size=8 false_size=0
959 18e 1903            btfsc z___byte,z___bit
960 18f 2998            goto label337__0end
961                     ; if { temp != 1 } body start
962                     ;   call master_octal {{ temp }}  
963 190 0826            movf test__temp,w
964 191 00b2            movwf master_octal__number
965 192 2352            call master_octal
966                     ;   call master_fail {{ failsafe_string , 0x37 }}  
967 193 302b            movlw LOW failsafe_string+1
968 194 00af            movwf master_fail__test_name
969 195 3037            movlw 55
970 196 00b0            movwf master_fail__test_number
971 197 2341            call master_fail
972                     ; if { temp != 1 } body end
973             label337__0end:
974                     ; if exp=` temp != 1 ' empty false
975                     ; Other expression=`{ temp != 1 }' delay=-1
976                     ; if { temp != 1 } end
977                     ; Verify that failsafe error counter reset :
978                     ;   call slave_send {{ 0xa0 }}  
979 198 30a0            movlw 160
980 199 00b8            movwf slave_send__data
981 19a 2391            call slave_send
982                     ;   temp := slave_get {{ }}  
983 19b 236b            call slave_get
984 19c 0834            movf slave_get__0return__byte,w
985 19d 00a6            movwf test__temp
986                     ; if { temp != 0 } start
987                     ; expression=`{ temp != 0 }' exp_delay=1 true_delay=4  false_delay=0 true_size=8 false_size=0
988 19e 1903            btfsc z___byte,z___bit
989 19f 29a8            goto label345__0end
990                     ; if { temp != 0 } body start
991                     ;   call master_octal {{ temp }}  
992 1a0 0826            movf test__temp,w
993 1a1 00b2            movwf master_octal__number
994 1a2 2352            call master_octal
995                     ;   call master_fail {{ failsafe_string , 0x38 }}  
996 1a3 302b            movlw LOW failsafe_string+1
997 1a4 00af            movwf master_fail__test_name
998 1a5 3038            movlw 56
999 1a6 00b0            movwf master_fail__test_number
1000 1a7 2341            call master_fail
1001                     ; if { temp != 0 } body end
1002             label345__0end:
1003                     ; if exp=` temp != 0 ' empty false
1004                     ; Other expression=`{ temp != 0 }' delay=-1
1005                     ; if { temp != 0 } end
1006                     ; Reset everything :
1007                     ;   call slave_send {{ 0xa4 }}  
1008 1a8 30a4            movlw 164
1009 1a9 00b8            movwf slave_send__data
1010 1aa 2391            call slave_send
1011                     ; Do some ramp testing :
1012                     ;   ramp_index := 0  
1013 1ab 01a3            clrf test__ramp_index
1014                     ; `while  ramp_index < ramps . size  ...' start
1015             test__355while__continue:
1016 1ac 3005            movlw 5
1017 1ad 0223            subwf test__ramp_index,w
1018                     ; expression=` ramp_index < ramps . size ' exp_delay=2 true_delay=1  false_delay=2 true_size=232 false_size=1
1019 1ae 1803            btfsc c___byte,c___bit
1020 1af 2a96            goto test__355while__break
1021                     ; call master_send < 0c'R' >
1022                     ;   ramp := ramps ~~ {{ ramp_index }}  
1023 1b0 0a23            incf test__ramp_index,w
1024 1b1 018a            clrf pclath___register
1025 1b2 204e            call ramps
1026 1b3 00a2            movwf test__ramp
1027                     ;   mode := 0  
1028 1b4 019f            clrf test__mode
1029                     ; `while  mode < 2  ...' start
1030             test__359while__continue:
1031 1b5 3002            movlw 2
1032 1b6 021f            subwf test__mode,w
1033                     ; expression=` mode < 2 ' exp_delay=2 true_delay=1  false_delay=2 true_size=221 false_size=1
1034 1b7 1803            btfsc c___byte,c___bit
1035 1b8 2a94            goto test__359while__break
1036                     ; call master_send < 0c'M' >
1037                     ;   direction := 0  
1038 1b9 019d            clrf test__direction
1039                     ; `while  direction < 2  ...' start
1040             test__362while__continue:
1041 1ba 3002            movlw 2
1042 1bb 021d            subwf test__direction,w
1043                     ; expression=` direction < 2 ' exp_delay=2 true_delay=1  false_delay=2 true_size=214 false_size=1
1044 1bc 1803            btfsc c___byte,c___bit
1045 1bd 2a92            goto test__362while__break
1046                     ; call master_send < 0c'D' >
1047                     ;   motor := 0  
1048 1be 01a0            clrf test__motor
1049                     ; `while  motor < 2  ...' start
1050             test__365while__continue:
1051 1bf 3002            movlw 2
1052 1c0 0220            subwf test__motor,w
1053                     ; expression=` motor < 2 ' exp_delay=2 true_delay=1  false_delay=2 true_size=207 false_size=1
1054 1c1 1803            btfsc c___byte,c___bit
1055 1c2 2a90            goto test__365while__break
1056                     ; call master_send < 0c'S' >
1057                     ;   call master_string {{ ramp_string }}  
1058 1c3 3056            movlw LOW ramp_string+1
1059 1c4 00c2            movwf master_string__message
1060 1c5 23dd            call master_string
1061                     ;   call master_octal {{ ramp }}  
1062 1c6 0822            movf test__ramp,w
1063 1c7 00b2            movwf master_octal__number
1064 1c8 2352            call master_octal
1065                     ;   call master_string {{ mode_string }}  
1066 1c9 303d            movlw LOW mode_string+1
1067 1ca 00c2            movwf master_string__message
1068 1cb 23dd            call master_string
1069                     ;   call master_octal {{ mode }}  
1070 1cc 081f            movf test__mode,w
1071 1cd 00b2            movwf master_octal__number
1072 1ce 2352            call master_octal
1073                     ;   call master_string {{ direction_string }}  
1074 1cf 301a            movlw LOW direction_string+1
1075 1d0 00c2            movwf master_string__message
1076 1d1 23dd            call master_string
1077                     ;   call master_octal {{ direction }}  
1078 1d2 081d            movf test__direction,w
1079 1d3 00b2            movwf master_octal__number
1080 1d4 2352            call master_octal
1081                     ;   call master_string {{ motor_string }}  
1082 1d5 3048            movlw LOW motor_string+1
1083 1d6 00c2            movwf master_string__message
1084 1d7 23dd            call master_string
1085                     ;   call master_octal {{ motor }}  
1086 1d8 0820            movf test__motor,w
1087 1d9 00b2            movwf master_octal__number
1088 1da 2352            call master_octal
1089                     ;   call master_crlf {{ }}  
1090 1db 233a            call master_crlf
1091                     ; Set the mode :
1092                     ;   call slave_send {{ 0x88 | {{ mode << 1 }} | motor }}  
1093 1dc 1003            bcf c___byte,c___bit
1094 1dd 0d1f            rlf test__mode,w
1095 1de 0420            iorwf test__motor,w
1096 1df 3888            iorlw 136
1097 1e0 00b8            movwf slave_send__data
1098 1e1 2391            call slave_send
1099                     ; Set the ramp :
1100                     ;   call slave_send {{ 0x80 | motor }}  
1101 1e2 3080            movlw 128
1102 1e3 0420            iorwf test__motor,w
1103 1e4 00b8            movwf slave_send__data
1104 1e5 2391            call slave_send
1105                     ;   call slave_send {{ ramp }}  
1106 1e6 0822            movf test__ramp,w
1107 1e7 00b8            movwf slave_send__data
1108 1e8 2391            call slave_send
1109                     ; Verify the ramp :
1110                     ;   call slave_send {{ 0x9e | motor }}  
1111 1e9 309e            movlw 158
1112 1ea 0420            iorwf test__motor,w
1113 1eb 00b8            movwf slave_send__data
1114 1ec 2391            call slave_send
1115                     ;   temp := slave_get {{ }}  
1116 1ed 236b            call slave_get
1117 1ee 0834            movf slave_get__0return__byte,w
1118 1ef 00a6            movwf test__temp
1119                     ; if { temp != ramp } start
1120 1f0 0222            subwf test__ramp,w
1121                     ; expression=`{ temp != ramp }' exp_delay=2 true_delay=4  false_delay=0 true_size=8 false_size=0
1122 1f1 1903            btfsc z___byte,z___bit
1123 1f2 29fb            goto label387__0end
1124                     ; if { temp != ramp } body start
1125                     ;   call master_octal {{ temp }}  
1126 1f3 0826            movf test__temp,w
1127 1f4 00b2            movwf master_octal__number
1128 1f5 2352            call master_octal
1129                     ;   call master_fail {{ ramp_string , 0x31 }}  
1130 1f6 3056            movlw LOW ramp_string+1
1131 1f7 00af            movwf master_fail__test_name
1132 1f8 3031            movlw 49
1133 1f9 00b0            movwf master_fail__test_number
1134 1fa 2341            call master_fail
1135                     ; if { temp != ramp } body end
1136             label387__0end:
1137                     ; if exp=` temp != ramp ' empty false
1138                     ; Other expression=`{ temp != ramp }' delay=-1
1139                     ; if { temp != ramp } end
1140                     ; Do a complete speed check when the ramp is zero :
1141                     ; if { ramp = 0 } start
1142 1fb 0822            movf test__ramp,w
1143                     ; expression=`{ ramp = 0 }' exp_delay=1 true_delay=-1  false_delay=-1 true_size=88 false_size=56
1144 1fc 1d03            btfss z___byte,z___bit
1145 1fd 2a56            goto label393__0false
1146             label393__0true:
1147                     ; if { ramp = 0 } body start
1148                     ; Ramp motor up through speeds :
1149                     ;   speed := 0  
1150 1fe 01a5            clrf test__speed
1151                     ; `while  speed < 255  ...' start
1152             test__396while__continue:
1153 1ff 30ff            movlw 255
1154 200 0225            subwf test__speed,w
1155                     ; expression=` speed < 255 ' exp_delay=2 true_delay=1  false_delay=2 true_size=47 false_size=1
1156 201 1803            btfsc c___byte,c___bit
1157 202 2a31            goto test__396while__break
1158                     ; Set speed :
1159                     ;   temp := {{ direction << 1 }} | motor  
1160 203 1003            bcf c___byte,c___bit
1161 204 0d1d            rlf test__direction,w
1162 205 0420            iorwf test__motor,w
1163 206 00a6            movwf test__temp
1164                     ; if { speed & 0xf = 0 } start
1165 207 300f            movlw 15
1166 208 0525            andwf test__speed,w
1167                     ; expression=`{ speed & 0xf = 0 }' exp_delay=2 true_delay=3  false_delay=5 true_size=5 false_size=7
1168 209 1d03            btfss z___byte,z___bit
1169 20a 2a11            goto label399__0false
1170             label399__0true:
1171                     ; if { speed & 0xf = 0 } body start
1172                     ; Set high :
1173                     ;   call slave_send {{ {{ speed >> 2 }} | temp }}  
1174 20b 0c25            rrf test__speed,w
1175 20c 00a7            movwf test__401byte0
1176 20d 0c27            rrf test__401byte0,w
1177 20e 393f            andlw 63
1178 20f 0426            iorwf test__temp,w
1179                     ; 2 instructions found for sharing
1180 210 2a17            goto label399__0end
1181             label399__0false:
1182                     ; else body start
1183                     ; Set low :
1184                     ;   call slave_send {{ 0x40 | {{ speed << 2 }} & 0x3c | temp }}  
1185 211 0d25            rlf test__speed,w
1186 212 00a7            movwf test__404byte0
1187 213 0d27            rlf test__404byte0,w
1188 214 393c            andlw 60
1189 215 0426            iorwf test__temp,w
1190 216 3840            iorlw 64
1191                     ; 2 instructions found for sharing
1192                     ; if exp=` speed & 0xf = 0 ' generic
1193             label399__0end:
1194                     ; Other expression=`{ speed & 0xf = 0 }' delay=-1
1195                     ; 2 shared instructions follow
1196 217 00b8            movwf slave_send__data
1197 218 2391            call slave_send
1198                     ; if { speed & 0xf = 0 } end
1199                     ; Read and verify speed :
1200                     ;   call slave_send {{ 0x9a | motor }}  
1201 219 309a            movlw 154
1202 21a 0420            iorwf test__motor,w
1203 21b 00b8            movwf slave_send__data
1204 21c 2391            call slave_send
1205                     ;   temp := slave_get {{ }}  
1206 21d 236b            call slave_get
1207 21e 0834            movf slave_get__0return__byte,w
1208 21f 00a6            movwf test__temp
1209                     ; if { speed != temp } start
1210 220 0825            movf test__speed,w
1211 221 0226            subwf test__temp,w
1212                     ; expression=`{ speed != temp }' exp_delay=2 true_delay=5  false_delay=0 true_size=11 false_size=0
1213 222 1903            btfsc z___byte,z___bit
1214 223 2a2f            goto label410__0end
1215                     ; if { speed != temp } body start
1216                     ;   call master_octal {{ speed }}  
1217 224 0825            movf test__speed,w
1218 225 00b2            movwf master_octal__number
1219 226 2352            call master_octal
1220                     ;   call master_octal {{ temp }}  
1221 227 0826            movf test__temp,w
1222 228 00b2            movwf master_octal__number
1223 229 2352            call master_octal
1224                     ;   call master_fail {{ speed_string , 0x32 }}  
1225 22a 306c            movlw LOW speed_string+1
1226 22b 00af            movwf master_fail__test_name
1227 22c 3032            movlw 50
1228 22d 00b0            movwf master_fail__test_number
1229 22e 2341            call master_fail
1230                     ; if { speed != temp } body end
1231             label410__0end:
1232                     ; if exp=` speed != temp ' empty false
1233                     ; Other expression=`{ speed != temp }' delay=-1
1234                     ; if { speed != temp } end
1235                     ;   speed := speed + 1  
1236 22f 0aa5            incf test__speed,f
1237 230 29ff            goto test__396while__continue
1238                     ; if exp=` speed < 255 ' false goto
1239                     ; Other expression=` speed < 255 ' delay=-1
1240             test__396while__break:
1241                     ; `while  speed < 255  ...' end
1242                     ; Ramp motor down through speeds :
1243                     ; `while  speed != 0  ...' start
1244             test__419while__continue:
1245 231 0825            movf test__speed,w
1246                     ; expression=` speed != 0 ' exp_delay=1 true_delay=1  false_delay=2 true_size=33 false_size=1
1247 232 1903            btfsc z___byte,z___bit
1248 233 2a55            goto test__419while__break
1249                     ; Set speed :
1250                     ;   call slave_send {{ 0x84 | {{ direction << 1 }} | motor }}  
1251 234 1003            bcf c___byte,c___bit
1252 235 0d1d            rlf test__direction,w
1253 236 0420            iorwf test__motor,w
1254 237 3884            iorlw 132
1255 238 00b8            movwf slave_send__data
1256 239 2391            call slave_send
1257                     ;   call slave_send {{ speed }}  
1258 23a 0825            movf test__speed,w
1259 23b 00b8            movwf slave_send__data
1260 23c 2391            call slave_send
1261                     ; Read and verify speed :
1262                     ;   call slave_send {{ 0x9a | motor }}  
1263 23d 309a            movlw 154
1264 23e 0420            iorwf test__motor,w
1265 23f 00b8            movwf slave_send__data
1266 240 2391            call slave_send
1267                     ;   temp := slave_get {{ }}  
1268 241 236b            call slave_get
1269 242 0834            movf slave_get__0return__byte,w
1270 243 00a6            movwf test__temp
1271                     ; if { speed != temp } start
1272 244 0825            movf test__speed,w
1273 245 0226            subwf test__temp,w
1274                     ; expression=`{ speed != temp }' exp_delay=2 true_delay=5  false_delay=0 true_size=11 false_size=0
1275 246 1903            btfsc z___byte,z___bit
1276 247 2a53            goto label427__0end
1277                     ; if { speed != temp } body start
1278                     ;   call master_octal {{ speed }}  
1279 248 0825            movf test__speed,w
1280 249 00b2            movwf master_octal__number
1281 24a 2352            call master_octal
1282                     ;   call master_octal {{ temp }}  
1283 24b 0826            movf test__temp,w
1284 24c 00b2            movwf master_octal__number
1285 24d 2352            call master_octal
1286                     ;   call master_fail {{ speed_string , 0x33 }}  
1287 24e 306c            movlw LOW speed_string+1
1288 24f 00af            movwf master_fail__test_name
1289 250 3033            movlw 51
1290 251 00b0            movwf master_fail__test_number
1291 252 2341            call master_fail
1292                     ; if { speed != temp } body end
1293             label427__0end:
1294                     ; if exp=` speed != temp ' empty false
1295                     ; Other expression=`{ speed != temp }' delay=-1
1296                     ; if { speed != temp } end
1297                     ;   speed := speed - 1  
1298 253 03a5            decf test__speed,f
1299 254 2a31            goto test__419while__continue
1300                     ; if exp=` speed != 0 ' false goto
1301                     ; Other expression=` speed != 0 ' delay=-1
1302             test__419while__break:
1303                     ; `while  speed != 0  ...' end
1304                     ; if { ramp = 0 } body end
1305 255 2a8e            goto label393__0end
1306             label393__0false:
1307                     ; else body start
1308                     ; Do ramp testing :
1309                     ;   speed_index := 0  
1310 256 01a4            clrf test__speed_index
1311                     ; `while  speed_index < speeds . size  ...' start
1312             test__437while__continue:
1313 257 3006            movlw 6
1314 258 0224            subwf test__speed_index,w
1315                     ; expression=` speed_index < speeds . size ' exp_delay=2 true_delay=1  false_delay=2 true_size=51 false_size=1
1316 259 1803            btfsc c___byte,c___bit
1317 25a 2a8e            goto test__437while__break
1318                     ; call master_send < 0c'S' >
1319                     ; Set the speed :
1320                     ;   speed := speeds ~~ {{ speed_index }}  
1321 25b 0a24            incf test__speed_index,w
1322 25c 018a            clrf pclath___register
1323 25d 2063            call speeds
1324 25e 00a5            movwf test__speed
1325                     ;   call slave_send {{ 0x84 | {{ direction << 1 }} | motor }}  
1326 25f 1003            bcf c___byte,c___bit
1327 260 0d1d            rlf test__direction,w
1328 261 0420            iorwf test__motor,w
1329 262 3884            iorlw 132
1330 263 00b8            movwf slave_send__data
1331 264 2391            call slave_send
1332                     ;   call slave_send {{ speed }}  
1333 265 0825            movf test__speed,w
1334 266 00b8            movwf slave_send__data
1335 267 2391            call slave_send
1336                     ; Now wait for the speed to ramp up :
1337                     ;   temp := speed - 1  
1338 268 0325            decf test__speed,w
1339 269 00a6            movwf test__temp
1340                     ; `count_down counter1 8 ...' start
1341 26a 3008            movlw 8
1342 26b 009b            movwf test__counter1
1343             test__446_loop:
1344                     ; `count_down counter2 255 ...' start
1345 26c 30ff            movlw 255
1346 26d 009c            movwf test__counter2
1347             test__447_loop:
1348                     ; Read actual speed :
1349                     ; if { temp != speed } start
1350 26e 0826            movf test__temp,w
1351 26f 0225            subwf test__speed,w
1352                     ; expression=`{ temp != speed }' exp_delay=2 true_delay=3  false_delay=0 true_size=7 false_size=0
1353 270 1903            btfsc z___byte,z___bit
1354 271 2a79            goto label449__0end
1355                     ; if { temp != speed } body start
1356                     ;   call slave_send {{ 0xa2 | motor }}  
1357 272 30a2            movlw 162
1358 273 0420            iorwf test__motor,w
1359 274 00b8            movwf slave_send__data
1360 275 2391            call slave_send
1361                     ;   temp := slave_get {{ }}  
1362 276 236b            call slave_get
1363 277 0834            movf slave_get__0return__byte,w
1364 278 00a6            movwf test__temp
1365                     ; if { temp != speed } body end
1366             label449__0end:
1367                     ; if exp=` temp != speed ' empty false
1368                     ; Other expression=`{ temp != speed }' delay=-1
1369                     ; if { temp != speed } end
1370 279 0b9c            decfsz test__counter2,f
1371 27a 2a6e            goto test__447_loop
1372             test__447_done:
1373                     ; `count_down counter2 255 ...' end
1374 27b 0b9b            decfsz test__counter1,f
1375 27c 2a6c            goto test__446_loop
1376             test__446_done:
1377                     ; `count_down counter1 8 ...' end
1378                     ; See whether we timed out :
1379                     ; if { temp != speed } start
1380 27d 0826            movf test__temp,w
1381 27e 0225            subwf test__speed,w
1382                     ; expression=`{ temp != speed }' exp_delay=2 true_delay=5  false_delay=0 true_size=11 false_size=0
1383 27f 1903            btfsc z___byte,z___bit
1384 280 2a8c            goto label457__0end
1385                     ; if { temp != speed } body start
1386                     ;   call master_octal {{ temp }}  
1387 281 0826            movf test__temp,w
1388 282 00b2            movwf master_octal__number
1389 283 2352            call master_octal
1390                     ;   call master_octal {{ speed }}  
1391 284 0825            movf test__speed,w
1392 285 00b2            movwf master_octal__number
1393 286 2352            call master_octal
1394                     ;   call master_fail {{ ramp_string , 0x34 }}  
1395 287 3056            movlw LOW ramp_string+1
1396 288 00af            movwf master_fail__test_name
1397 289 3034            movlw 52
1398 28a 00b0            movwf master_fail__test_number
1399 28b 2341            call master_fail
1400                     ; if { temp != speed } body end
1401             label457__0end:
1402                     ; if exp=` temp != speed ' empty false
1403                     ; Other expression=`{ temp != speed }' delay=-1
1404                     ; if { temp != speed } end
1405                     ;   speed_index := speed_index + 1  
1406 28c 0aa4            incf test__speed_index,f
1407 28d 2a57            goto test__437while__continue
1408                     ; if exp=` speed_index < speeds . size ' false goto
1409                     ; Other expression=` speed_index < speeds . size ' delay=-1
1410             test__437while__break:
1411                     ; `while  speed_index < speeds . size  ...' end
1412                     ; else body end
1413                     ; if exp=` ramp = 0 ' generic
1414             label393__0end:
1415                     ; Other expression=`{ ramp = 0 }' delay=-1
1416                     ; if { ramp = 0 } end
1417                     ;   motor := motor + 1  
1418 28e 0aa0            incf test__motor,f
1419 28f 29bf            goto test__365while__continue
1420                     ; if exp=` motor < 2 ' false goto
1421                     ; Other expression=` motor < 2 ' delay=-1
1422             test__365while__break:
1423                     ; `while  motor < 2  ...' end
1424                     ;   direction := direction + 1  
1425 290 0a9d            incf test__direction,f
1426 291 29ba            goto test__362while__continue
1427                     ; if exp=` direction < 2 ' false goto
1428                     ; Other expression=` direction < 2 ' delay=-1
1429             test__362while__break:
1430                     ; `while  direction < 2  ...' end
1431                     ;   mode := mode + 1  
1432 292 0a9f            incf test__mode,f
1433 293 29b5            goto test__359while__continue
1434                     ; if exp=` mode < 2 ' false goto
1435                     ; Other expression=` mode < 2 ' delay=-1
1436             test__359while__break:
1437                     ; `while  mode < 2  ...' end
1438                     ;   ramp_index := ramp_index + 1  
1439 294 0aa3            incf test__ramp_index,f
1440 295 29ac            goto test__355while__continue
1441                     ; if exp=` ramp_index < ramps . size ' false goto
1442                     ; Other expression=` ramp_index < ramps . size ' delay=-1
1443             test__355while__break:
1444                     ; `while  ramp_index < ramps . size  ...' end
1445                     ; Reset everything :
1446                     ;   call slave_send {{ 0xa4 }}  
1447 296 30a4            movlw 164
1448 297 00b8            movwf slave_send__data
1449 298 2391            call slave_send
1450                     ; Announce end of test run :
1451                     ;   call master_string {{ done_string }}  
1452 299 301f            movlw LOW done_string+1
1453 29a 00c2            movwf master_string__message
1454 29b 23dd            call master_string
1455                     ;   call master_crlf {{ }}  
1456 29c 233a            call master_crlf
1457                     ; procedure test end
1458 29d 3400            retlw 0
1459                     ; comment {The procedures below are used to test the common shared commands :}
1460             
1461                     ; procedure common_test start
1462             common_test:
1463     0028    common_test__variables__base equ global__variables__bank0+28
1464     0028    common_test__bytes__base equ common_test__variables__base+0
1465     002a    common_test__bits__base equ common_test__variables__base+2
1466     0002    common_test__total__bytes equ 2
1467     0029    common_test__527byte0 equ common_test__bytes__base+1
1468                     ;   arguments_none  
1469                     ; This procedure will verify that the common shared commands work .
1470     0028    common_test__actual equ common_test__bytes__base+0
1471                     ; Print the ID information :
1472                     ; ID reset :
1473                     ;   call slave_send {{ 0xfd }}  
1474 29e 30fd            movlw 253
1475 29f 00b8            movwf slave_send__data
1476 2a0 2391            call slave_send
1477                     ; Read the fixed bytes :
1478                     ;   call common_test_id_match {{ 1 , 0xc0 }}  
1479 2a1 3001            movlw 1
1480 2a2 00aa            movwf common_test_id_match__desired
1481 2a3 30c0            movlw 192
1482 2a4 00ab            movwf common_test_id_match__test_number
1483 2a5 2313            call common_test_id_match
1484                     ;   call common_test_id_match {{ 0 , 0xc1 }}  
1485 2a6 01aa            clrf common_test_id_match__desired
1486 2a7 30c1            movlw 193
1487 2a8 00ab            movwf common_test_id_match__test_number
1488 2a9 2313            call common_test_id_match
1489                     ;   call common_test_id_match {{ 14 , 0xc2 }}  
1490 2aa 300e            movlw 14
1491 2ab 00aa            movwf common_test_id_match__desired
1492 2ac 30c2            movlw 194
1493 2ad 00ab            movwf common_test_id_match__test_number
1494 2ae 2313            call common_test_id_match
1495                     ;   call common_test_id_match {{ 0 , 0xc3 }}  
1496 2af 01aa            clrf common_test_id_match__desired
1497 2b0 30c3            movlw 195
1498 2b1 00ab            movwf common_test_id_match__test_number
1499 2b2 2313            call common_test_id_match
1500                     ;   call common_test_id_match {{ 0 , 0xc4 }}  
1501 2b3 01aa            clrf common_test_id_match__desired
1502 2b4 30c4            movlw 196
1503 2b5 00ab            movwf common_test_id_match__test_number
1504 2b6 2313            call common_test_id_match
1505                     ;   call common_test_id_match {{ 0 , 0xc5 }}  
1506 2b7 01aa            clrf common_test_id_match__desired
1507 2b8 30c5            movlw 197
1508 2b9 00ab            movwf common_test_id_match__test_number
1509 2ba 2313            call common_test_id_match
1510                     ;   call common_test_id_match {{ 0 , 0xc6 }}  
1511 2bb 01aa            clrf common_test_id_match__desired
1512 2bc 30c6            movlw 198
1513 2bd 00ab            movwf common_test_id_match__test_number
1514 2be 2313            call common_test_id_match
1515                     ;   call common_test_id_match {{ 0 , 0xc7 }}  
1516 2bf 01aa            clrf common_test_id_match__desired
1517 2c0 30c7            movlw 199
1518 2c1 00ab            movwf common_test_id_match__test_number
1519 2c2 2313            call common_test_id_match
1520                     ;   call master_crlf {{ }}  
1521 2c3 233a            call master_crlf
1522                     ;   call common_test_id_bytes8 {{ }}  
1523 2c4 231e            call common_test_id_bytes8
1524                     ;   call common_test_id_bytes8 {{ }}  
1525 2c5 231e            call common_test_id_bytes8
1526                     ; Read the brick name :
1527                     ;   call common_test_id_string {{ }}  
1528 2c6 2328            call common_test_id_string
1529                     ; Read the vendor name :
1530                     ;   call common_test_id_string {{ }}  
1531 2c7 2328            call common_test_id_string
1532                     ; Verfify that we don ' t read off the end of the id and crash :
1533                     ;   call common_test_id_next {{ }}  
1534 2c8 2333            call common_test_id_next
1535 2c9 082e            movf common_test_id_next__0return__byte,w
1536                     ; Reset id :
1537                     ;   call slave_send {{ 0xfd }}  
1538 2ca 30fd            movlw 253
1539 2cb 00b8            movwf slave_send__data
1540 2cc 2391            call slave_send
1541                     ; Verify that we are still alive :
1542                     ;   call common_test_id_match {{ 1 , 0xc8 }}  
1543 2cd 3001            movlw 1
1544 2ce 00aa            movwf common_test_id_match__desired
1545 2cf 30c8            movlw 200
1546 2d0 00ab            movwf common_test_id_match__test_number
1547 2d1 2313            call common_test_id_match
1548                     ; Read glitch :
1549                     ; Clear glitch register :
1550                     ;   call slave_send {{ 0xfe }}  
1551 2d2 30fe            movlw 254
1552 2d3 00b8            movwf slave_send__data
1553 2d4 2391            call slave_send
1554                     ;   actual := slave_get {{ }}  
1555 2d5 236b            call slave_get
1556 2d6 0834            movf slave_get__0return__byte,w
1557 2d7 00a8            movwf common_test__actual
1558                     ; Send a couple of glitches :
1559                     ;   call slave_send {{ 0xff }}  
1560 2d8 30ff            movlw 255
1561 2d9 00b8            movwf slave_send__data
1562 2da 2391            call slave_send
1563                     ;   call slave_send {{ 0xff }}  
1564 2db 30ff            movlw 255
1565 2dc 00b8            movwf slave_send__data
1566 2dd 2391            call slave_send
1567                     ; Read the glitch register :
1568                     ;   call slave_send {{ 0xfe }}  
1569 2de 30fe            movlw 254
1570 2df 00b8            movwf slave_send__data
1571 2e0 2391            call slave_send
1572                     ; if { slave_get {{ }} != 2 } start
1573 2e1 236b            call slave_get
1574 2e2 0834            movf slave_get__0return__byte,w
1575 2e3 00a9            movwf common_test__527byte0
1576 2e4 3002            movlw 2
1577 2e5 0229            subwf common_test__527byte0,w
1578                     ; expression=`{ slave_get {{ }} != 2 }' exp_delay=3 true_delay=3  false_delay=0 true_size=5 false_size=0
1579 2e6 1903            btfsc z___byte,z___bit
1580 2e7 2aed            goto label527__1end
1581                     ; if { slave_get {{ }} != 2 } body start
1582                     ;   call master_fail {{ common_string , 0xc9 }}  
1583 2e8 3012            movlw LOW common_string+1
1584 2e9 00af            movwf master_fail__test_name
1585 2ea 30c9            movlw 201
1586 2eb 00b0            movwf master_fail__test_number
1587 2ec 2341            call master_fail
1588                     ; if { slave_get {{ }} != 2 } body end
1589             label527__1end:
1590                     ; if exp=` slave_get ## {{ }} != 2 ' empty false
1591                     ; Other expression=`{ slave_get {{ }} != 2 }' delay=-1
1592                     ; if { slave_get {{ }} != 2 } end
1593                     ; Do a clock pulse :
1594                     ;   call slave_send {{ 0xfb }}  
1595 2ed 30fb            movlw 251
1596 2ee 00b8            movwf slave_send__data
1597 2ef 2391            call slave_send
1598                     ; if { slave_get {{ }} != 0 } start
1599 2f0 236b            call slave_get
1600 2f1 0834            movf slave_get__0return__byte,w
1601                     ; expression=`{ slave_get {{ }} != 0 }' exp_delay=0 true_delay=3  false_delay=0 true_size=5 false_size=0
1602 2f2 1903            btfsc z___byte,z___bit
1603 2f3 2af9            goto label533__0end
1604                     ; if { slave_get {{ }} != 0 } body start
1605                     ;   call master_fail {{ common_string , 0xca }}  
1606 2f4 3012            movlw LOW common_string+1
1607 2f5 00af            movwf master_fail__test_name
1608 2f6 30ca            movlw 202
1609 2f7 00b0            movwf master_fail__test_number
1610 2f8 2341            call master_fail
1611                     ; if { slave_get {{ }} != 0 } body end
1612             label533__0end:
1613                     ; if exp=` slave_get ## {{ }} != 0 ' empty false
1614                     ; Other expression=`{ slave_get {{ }} != 0 }' delay=-1
1615                     ; if { slave_get {{ }} != 0 } end
1616                     ; Read clock :
1617                     ;   call slave_send {{ 0xfa }}  
1618 2f9 30fa            movlw 250
1619 2fa 00b8            movwf slave_send__data
1620 2fb 2391            call slave_send
1621                     ;   actual := slave_get {{ }}  
1622 2fc 236b            call slave_get
1623 2fd 0834            movf slave_get__0return__byte,w
1624 2fe 00a8            movwf common_test__actual
1625                     ; Increment :
1626                     ;   call slave_send {{ 0xf9 }}  
1627 2ff 30f9            movlw 249
1628 300 00b8            movwf slave_send__data
1629 301 2391            call slave_send
1630                     ; Decrement :
1631                     ;   call slave_send {{ 0xf8 }}  
1632 302 30f8            movlw 248
1633 303 00b8            movwf slave_send__data
1634 304 2391            call slave_send
1635                     ; Read clock again :
1636                     ;   call slave_send {{ 0xfa }}  
1637 305 30fa            movlw 250
1638 306 00b8            movwf slave_send__data
1639 307 2391            call slave_send
1640                     ; if { actual != slave_get {{ }} } start
1641 308 236b            call slave_get
1642 309 0834            movf slave_get__0return__byte,w
1643 30a 0228            subwf common_test__actual,w
1644                     ; expression=`{ actual != slave_get {{ }} }' exp_delay=1 true_delay=3  false_delay=0 true_size=5 false_size=0
1645 30b 1903            btfsc z___byte,z___bit
1646 30c 2b12            goto label545__0end
1647                     ; if { actual != slave_get {{ }} } body start
1648                     ;   call master_fail {{ common_string , 0xcb }}  
1649 30d 3012            movlw LOW common_string+1
1650 30e 00af            movwf master_fail__test_name
1651 30f 30cb            movlw 203
1652 310 00b0            movwf master_fail__test_number
1653 311 2341            call master_fail
1654                     ; if { actual != slave_get {{ }} } body end
1655             label545__0end:
1656                     ; if exp=` actual != slave_get ## {{ }} ' empty false
1657                     ; Other expression=`{ actual != slave_get {{ }} }' delay=-1
1658                     ; if { actual != slave_get {{ }} } end
1659                     ; procedure common_test end
1660 312 3400            retlw 0
1661             
1662                     ; procedure common_test_id_match start
1663             common_test_id_match:
1664     002a    common_test_id_match__variables__base equ global__variables__bank0+30
1665     002a    common_test_id_match__bytes__base equ common_test_id_match__variables__base+0
1666     002c    common_test_id_match__bits__base equ common_test_id_match__variables__base+2
1667     0002    common_test_id_match__total__bytes equ 2
1668     002a    common_test_id_match__desired equ common_test_id_match__bytes__base+0
1669     002b    common_test_id_match__test_number equ common_test_id_match__bytes__base+1
1670                     ; This procedure will verify that the next byte in the id is < desired > .
1671                     ; if { desired != common_test_id_next {{ }} } start
1672 313 2333            call common_test_id_next
1673 314 082e            movf common_test_id_next__0return__byte,w
1674 315 022a            subwf common_test_id_match__desired,w
1675                     ; expression=`{ desired != common_test_id_next {{ }} }' exp_delay=1 true_delay=3  false_delay=0 true_size=5 false_size=0
1676 316 1903            btfsc z___byte,z___bit
1677 317 2b1d            goto label557__0end
1678                     ; if { desired != common_test_id_next {{ }} } body start
1679                     ;   call master_fail {{ common_string , test_number }}  
1680 318 3012            movlw LOW common_string+1
1681 319 00af            movwf master_fail__test_name
1682 31a 082b            movf common_test_id_match__test_number,w
1683 31b 00b0            movwf master_fail__test_number
1684 31c 2341            call master_fail
1685                     ; if { desired != common_test_id_next {{ }} } body end
1686             label557__0end:
1687                     ; if exp=` desired != common_test_id_next ## {{ }} ' empty false
1688                     ; Other expression=`{ desired != common_test_id_next {{ }} }' delay=-1
1689                     ; if { desired != common_test_id_next {{ }} } end
1690                     ; procedure common_test_id_match end
1691 31d 3400            retlw 0
1692             
1693                     ; procedure common_test_id_bytes8 start
1694             common_test_id_bytes8:
1695     002c    common_test_id_bytes8__variables__base equ global__variables__bank0+32
1696     002c    common_test_id_bytes8__bytes__base equ common_test_id_bytes8__variables__base+0
1697     002d    common_test_id_bytes8__bits__base equ common_test_id_bytes8__variables__base+1
1698     0001    common_test_id_bytes8__total__bytes equ 1
1699                     ;   arguments_none  
1700                     ; This procedure will print out the next 8 bytes of the id in octal .
1701     002c    common_test_id_bytes8__count equ common_test_id_bytes8__bytes__base+0
1702                     ; `count_down count 8 ...' start
1703 31e 3008            movlw 8
1704 31f 00ac            movwf common_test_id_bytes8__count
1705             common_test_id_bytes8__570_loop:
1706                     ;   call master_octal {{ common_test_id_next {{ }} }}  
1707 320 2333            call common_test_id_next
1708 321 082e            movf common_test_id_next__0return__byte,w
1709 322 00b2            movwf master_octal__number
1710 323 2352            call master_octal
1711 324 0bac            decfsz common_test_id_bytes8__count,f
1712 325 2b20            goto common_test_id_bytes8__570_loop
1713             common_test_id_bytes8__570_done:
1714                     ; `count_down count 8 ...' end
1715                     ;   call master_crlf {{ }}  
1716 326 233a            call master_crlf
1717                     ; procedure common_test_id_bytes8 end
1718 327 3400            retlw 0
1719             
1720                     ; procedure common_test_id_string start
1721             common_test_id_string:
1722     002d    common_test_id_string__variables__base equ global__variables__bank0+33
1723     002d    common_test_id_string__bytes__base equ common_test_id_string__variables__base+0
1724     002e    common_test_id_string__bits__base equ common_test_id_string__variables__base+1
1725     0001    common_test_id_string__total__bytes equ 1
1726                     ;   arguments_none  
1727                     ; This procedure will print out the next id string .
1728     002d    common_test_id_string__count equ common_test_id_string__bytes__base+0
1729                     ; `count_down count  common_test_id_next ## {{ }}  ...' start
1730 328 2333            call common_test_id_next
1731 329 082e            movf common_test_id_next__0return__byte,w
1732 32a 00ad            movwf common_test_id_string__count
1733             common_test_id_string__583_loop:
1734                     ;   call master_send {{ common_test_id_next {{ }} }}  
1735 32b 2333            call common_test_id_next
1736 32c 082e            movf common_test_id_next__0return__byte,w
1737 32d 00c1            movwf master_send__character
1738 32e 23d7            call master_send
1739 32f 0bad            decfsz common_test_id_string__count,f
1740 330 2b2b            goto common_test_id_string__583_loop
1741             common_test_id_string__583_done:
1742                     ; `count_down count  common_test_id_next ## {{ }}  ...' end
1743                     ;   call master_crlf {{ }}  
1744 331 233a            call master_crlf
1745                     ; procedure common_test_id_string end
1746 332 3400            retlw 0
1747             
1748                     ; procedure common_test_id_next start
1749             common_test_id_next:
1750     002e    common_test_id_next__variables__base equ global__variables__bank0+34
1751     002e    common_test_id_next__bytes__base equ common_test_id_next__variables__base+0
1752     002f    common_test_id_next__bits__base equ common_test_id_next__variables__base+1
1753     0001    common_test_id_next__total__bytes equ 1
1754                     ;   arguments_none  
1755     002e    common_test_id_next__0return__byte equ common_test_id_next__bytes__base+0
1756                     ; This procedure returns the next byte from the identification string .
1757                     ;   call slave_send {{ 0xfc }}  
1758 333 30fc            movlw 252
1759 334 00b8            movwf slave_send__data
1760 335 2391            call slave_send
1761                     ;   return slave_get {{ }}  
1762 336 236b            call slave_get
1763 337 0834            movf slave_get__0return__byte,w
1764 338 00ae            movwf common_test_id_next__0return__byte
1765 339 3400            retlw 0
1766                     ; procedure common_test_id_next end
1767                     ; comment {The following procedures are used to communicate with the master :}
1768             
1769                     ; procedure master_crlf start
1770             master_crlf:
1771     002f    master_crlf__variables__base equ global__variables__bank0+35
1772     002f    master_crlf__bytes__base equ master_crlf__variables__base+0
1773     002f    master_crlf__bits__base equ master_crlf__variables__base+0
1774     0000    master_crlf__total__bytes equ 0
1775                     ;   arguments_none  
1776                     ; This procedure will output a carriage - return line - feed
1777                     ; to the master .
1778                     ;   call master_send {{ cr }}  
1779 33a 300d            movlw 13
1780 33b 00c1            movwf master_send__character
1781 33c 23d7            call master_send
1782                     ;   call master_send {{ lf }}  
1783 33d 300a            movlw 10
1784 33e 00c1            movwf master_send__character
1785 33f 23d7            call master_send
1786                     ; procedure master_crlf end
1787 340 3400            retlw 0
1788             
1789                     ; procedure master_fail start
1790             master_fail:
1791     002f    master_fail__variables__base equ global__variables__bank0+35
1792     002f    master_fail__bytes__base equ master_fail__variables__base+0
1793     0031    master_fail__bits__base equ master_fail__variables__base+2
1794     0002    master_fail__total__bytes equ 2
1795     002f    master_fail__test_name equ master_fail__bytes__base+0
1796     0030    master_fail__test_number equ master_fail__bytes__base+1
1797                     ; This procedure will output ` fail ' followed by a carriage return
1798                     ; and line feed .
1799                     ;   call master_string {{ fail_string }}  
1800 341 3025            movlw LOW fail_string+1
1801 342 00c2            movwf master_string__message
1802 343 23dd            call master_string
1803                     ;   call master_string {{ test_name }}  
1804 344 082f            movf master_fail__test_name,w
1805 345 00c2            movwf master_string__message
1806 346 23dd            call master_string
1807                     ;   call master_octal {{ test_number }}  
1808 347 0830            movf master_fail__test_number,w
1809 348 00b2            movwf master_octal__number
1810 349 2352            call master_octal
1811                     ;   call master_crlf {{ }}  
1812 34a 233a            call master_crlf
1813                     ; procedure master_fail end
1814 34b 3400            retlw 0
1815             
1816                     ; procedure master_get start
1817             master_get:
1818     0031    master_get__variables__base equ global__variables__bank0+37
1819     0031    master_get__bytes__base equ master_get__variables__base+0
1820     0032    master_get__bits__base equ master_get__variables__base+1
1821     0001    master_get__total__bytes equ 1
1822                     ;   arguments_none  
1823     0031    master_get__0return__byte equ master_get__bytes__base+0
1824                     ; This procedure will get the next byte or return 0xfc if
1825                     ; no byte is forthcoming .
1826                     ;   return get_byte {{ rx_master_mask }}  
1827 34c 3008            movlw 8
1828 34d 00b9            movwf get_byte__mask
1829 34e 2397            call get_byte
1830 34f 083a            movf get_byte__0return__byte,w
1831 350 00b1            movwf master_get__0return__byte
1832 351 3400            retlw 0
1833                     ; procedure master_get end
1834             
1835                     ; procedure master_octal start
1836             master_octal:
1837     0032    master_octal__variables__base equ global__variables__bank0+38
1838     0032    master_octal__bytes__base equ master_octal__variables__base+0
1839     0034    master_octal__bits__base equ master_octal__variables__base+2
1840     0002    master_octal__total__bytes equ 2
1841     0033    master_octal__643byte0 equ master_octal__bytes__base+1
1842     0033    master_octal__644byte0 equ master_octal__bytes__base+1
1843     0032    master_octal__number equ master_octal__bytes__base+0
1844                     ; This procedure will output < number > in octal to the tx port .
1845                     ; Output the character in octal :
1846                     ;   call master_send {{ {{ number >> 6 }} + 0c'0' }}  
1847 352 0e32            swapf master_octal__number,w
1848 353 00b3            movwf master_octal__643byte0
1849 354 0cb3            rrf master_octal__643byte0,f
1850 355 0c33            rrf master_octal__643byte0,w
1851 356 3903            andlw 3
1852 357 3e30            addlw 48
1853 358 00c1            movwf master_send__character
1854 359 23d7            call master_send
1855                     ;   call master_send {{ {{ {{ number >> 3 }} & 7 }} + 0c'0' }}  
1856 35a 0c32            rrf master_octal__number,w
1857 35b 00b3            movwf master_octal__644byte0
1858 35c 0cb3            rrf master_octal__644byte0,f
1859 35d 0c33            rrf master_octal__644byte0,w
1860 35e 3907            andlw 7
1861 35f 3e30            addlw 48
1862 360 00c1            movwf master_send__character
1863 361 23d7            call master_send
1864                     ;   call master_send {{ {{ number & 7 }} + 0c'0' }}  
1865 362 3007            movlw 7
1866 363 0532            andwf master_octal__number,w
1867 364 3e30            addlw 48
1868 365 00c1            movwf master_send__character
1869 366 23d7            call master_send
1870                     ;   call master_send {{ sp }}  
1871 367 3020            movlw 32
1872 368 00c1            movwf master_send__character
1873 369 23d7            call master_send
1874                     ; procedure master_octal end
1875 36a 3400            retlw 0
1876             
1877                     ; procedure slave_get start
1878             slave_get:
1879     0034    slave_get__variables__base equ global__variables__bank0+40
1880     0034    slave_get__bytes__base equ slave_get__variables__base+0
1881     0035    slave_get__bits__base equ slave_get__variables__base+1
1882     0001    slave_get__total__bytes equ 1
1883                     ;   arguments_none  
1884     0034    slave_get__0return__byte equ slave_get__bytes__base+0
1885                     ; This procedure will get a byte from the slave or return 0xfc
1886                     ; if no byte is forthcoming .
1887                     ;   return get_byte {{ rx_slave_mask }}  
1888 36b 3001            movlw 1
1889 36c 00b9            movwf get_byte__mask
1890 36d 2397            call get_byte
1891 36e 083a            movf get_byte__0return__byte,w
1892 36f 00b4            movwf slave_get__0return__byte
1893 370 3400            retlw 0
1894                     ; procedure slave_get end
1895             
1896                     ; procedure slave_id8 start
1897             slave_id8:
1898     0035    slave_id8__variables__base equ global__variables__bank0+41
1899     0035    slave_id8__bytes__base equ slave_id8__variables__base+0
1900     0036    slave_id8__bits__base equ slave_id8__variables__base+1
1901     0001    slave_id8__total__bytes equ 1
1902                     ;   arguments_none  
1903                     ; This procedure will print out the next 8 bytes of data from
1904                     ; the slave RoboBrick id bytes .
1905     0035    slave_id8__counter equ slave_id8__bytes__base+0
1906                     ; `count_down counter 8 ...' start
1907 371 3008            movlw 8
1908 372 00b5            movwf slave_id8__counter
1909             slave_id8__668_loop:
1910                     ;   call master_octal {{ slave_id_next {{ }} }}  
1911 373 237b            call slave_id_next
1912 374 0836            movf slave_id_next__0return__byte,w
1913 375 00b2            movwf master_octal__number
1914 376 2352            call master_octal
1915 377 0bb5            decfsz slave_id8__counter,f
1916 378 2b73            goto slave_id8__668_loop
1917             slave_id8__668_done:
1918                     ; `count_down counter 8 ...' end
1919                     ;   call master_crlf {{ }}  
1920 379 233a            call master_crlf
1921                     ; procedure slave_id8 end
1922 37a 3400            retlw 0
1923             
1924                     ; procedure slave_id_next start
1925             slave_id_next:
1926     0036    slave_id_next__variables__base equ global__variables__bank0+42
1927     0036    slave_id_next__bytes__base equ slave_id_next__variables__base+0
1928     0037    slave_id_next__bits__base equ slave_id_next__variables__base+1
1929     0001    slave_id_next__total__bytes equ 1
1930                     ;   arguments_none  
1931     0036    slave_id_next__0return__byte equ slave_id_next__bytes__base+0
1932                     ; This procedure will return the next byte from the id bytes .
1933                     ;   call slave_send {{ 0xfc }}  
1934 37b 30fc            movlw 252
1935 37c 00b8            movwf slave_send__data
1936 37d 2391            call slave_send
1937                     ;   return slave_get {{ }}  
1938 37e 236b            call slave_get
1939 37f 0834            movf slave_get__0return__byte,w
1940 380 00b6            movwf slave_id_next__0return__byte
1941 381 3400            retlw 0
1942                     ; procedure slave_id_next end
1943             
1944                     ; procedure slave_id_string start
1945             slave_id_string:
1946     0037    slave_id_string__variables__base equ global__variables__bank0+43
1947     0037    slave_id_string__bytes__base equ slave_id_string__variables__base+0
1948     0038    slave_id_string__bits__base equ slave_id_string__variables__base+1
1949     0001    slave_id_string__total__bytes equ 1
1950                     ;   arguments_none  
1951                     ; This procedure will return the string for the id bytes .
1952     0037    slave_id_string__size equ slave_id_string__bytes__base+0
1953                     ;   size := slave_id_next {{ }}  
1954 382 237b            call slave_id_next
1955 383 0836            movf slave_id_next__0return__byte,w
1956 384 00b7            movwf slave_id_string__size
1957                     ;   call master_octal {{ size }}  
1958 385 00b2            movwf master_octal__number
1959 386 2352            call master_octal
1960                     ; `count_down size size ...' start
1961 387 0837            movf slave_id_string__size,w
1962 388 00b7            movwf slave_id_string__size
1963             slave_id_string__694_loop:
1964                     ;   call master_send {{ slave_id_next {{ }} }}  
1965 389 237b            call slave_id_next
1966 38a 0836            movf slave_id_next__0return__byte,w
1967 38b 00c1            movwf master_send__character
1968 38c 23d7            call master_send
1969 38d 0bb7            decfsz slave_id_string__size,f
1970 38e 2b89            goto slave_id_string__694_loop
1971             slave_id_string__694_done:
1972                     ; `count_down size size ...' end
1973                     ;   call master_crlf {{ }}  
1974 38f 233a            call master_crlf
1975                     ; procedure slave_id_string end
1976 390 3400            retlw 0
1977             
1978                     ; procedure slave_send start
1979             slave_send:
1980     0038    slave_send__variables__base equ global__variables__bank0+44
1981     0038    slave_send__bytes__base equ slave_send__variables__base+0
1982     0039    slave_send__bits__base equ slave_send__variables__base+1
1983     0001    slave_send__total__bytes equ 1
1984     0038    slave_send__data equ slave_send__bytes__base+0
1985                     ; This procedure will send one byte of < data > to the slave .
1986                     ;   call send_byte {{ data , tx_slave_mask }}  
1987 391 0838            movf slave_send__data,w
1988 392 00bd            movwf send_byte__char
1989 393 3002            movlw 2
1990 394 00be            movwf send_byte__mask
1991 395 23bc            call send_byte
1992                     ; procedure slave_send end
1993 396 3400            retlw 0
1994                     ; comment {The last procedures do character sending and receiving :}
1995             
1996                     ; procedure get_byte start
1997             get_byte:
1998     0039    get_byte__variables__base equ global__variables__bank0+45
1999     0039    get_byte__bytes__base equ get_byte__variables__base+0
2000     003d    get_byte__bits__base equ get_byte__variables__base+4
2001     0004    get_byte__total__bytes equ 4
2002     0039    get_byte__mask equ get_byte__bytes__base+0
2003     003a    get_byte__0return__byte equ get_byte__bytes__base+1
2004                     ; Get an 8 - bit byte from < mask > bit of < porta > and return it .
2005                     ; If no character shows up in a while 0xfc is returned .
2006     003b    get_byte__count equ get_byte__bytes__base+2
2007     003c    get_byte__char equ get_byte__bytes__base+3
2008                     ; Wait until a start bit arrives :
2009                     ;   count := 0  
2010 397 01bb            clrf get_byte__count
2011                     ; `while  porta & mask != 0  ...' start
2012             get_byte__723while__continue:
2013 398 0805            movf porta,w
2014 399 0539            andwf get_byte__mask,w
2015                     ; expression=` porta & mask != 0 ' exp_delay=2 true_delay=1  false_delay=2 true_size=9 false_size=1
2016 39a 1903            btfsc z___byte,z___bit
2017 39b 2ba5            goto get_byte__723while__break
2018                     ;   count := count - 1  
2019 39c 03bb            decf get_byte__count,f
2020                     ; if { count = 0 } start
2021 39d 083b            movf get_byte__count,w
2022                     ; expression=`{ count = 0 }' exp_delay=1 true_delay=3  false_delay=0 true_size=3 false_size=0
2023 39e 1d03            btfss z___byte,z___bit
2024 39f 2ba3            goto label725__0end
2025                     ; if { count = 0 } body start
2026                     ;   return 0xfc  
2027 3a0 30fc            movlw 252
2028 3a1 00ba            movwf get_byte__0return__byte
2029 3a2 3400            retlw 0
2030                     ; if { count = 0 } body end
2031             label725__0end:
2032                     ; if exp=` count = 0 ' empty false
2033                     ; Other expression=`{ count = 0 }' delay=-1
2034                     ; if { count = 0 } end
2035                     ;   call delay {{ }}  
2036 3a3 23f0            call delay
2037 3a4 2b98            goto get_byte__723while__continue
2038                     ; if exp=` porta & mask != 0 ' false goto
2039                     ; Other expression=` porta & mask != 0 ' delay=-1
2040             get_byte__723while__break:
2041                     ; `while  porta & mask != 0  ...' end
2042                     ; Skip over the start bit :
2043                     ;   call delay {{ }}  
2044 3a5 23f0            call delay
2045                     ;   call delay {{ }}  
2046 3a6 23f0            call delay
2047                     ;   call delay {{ }}  
2048 3a7 23f0            call delay
2049                     ; Sample in the middle third of each data bit :
2050                     ;   char := 0  
2051 3a8 01bc            clrf get_byte__char
2052                     ; `count_down count 8 ...' start
2053 3a9 3008            movlw 8
2054 3aa 00bb            movwf get_byte__count
2055             get_byte__738_loop:
2056                     ;   call delay {{ }}  
2057 3ab 23f0            call delay
2058                     ;   char := char >> 1  
2059 3ac 1003            bcf c___byte,c___bit
2060 3ad 0cbc            rrf get_byte__char,f
2061                     ; if { porta & mask != 0 } start
2062 3ae 0805            movf porta,w
2063 3af 0539            andwf get_byte__mask,w
2064                     ; expression=`{ porta & mask != 0 }' exp_delay=2 true_delay=2  false_delay=0 true_size=2 false_size=0
2065 3b0 1903            btfsc z___byte,z___bit
2066 3b1 2bb4            goto label741__0end
2067                     ; if { porta & mask != 0 } body start
2068                     ;   char := char | 0x80  
2069 3b2 3080            movlw 128
2070 3b3 04bc            iorwf get_byte__char,f
2071                     ; if { porta & mask != 0 } body end
2072             label741__0end:
2073                     ; if exp=` porta & mask != 0 ' empty false
2074                     ; Other expression=`{ porta & mask != 0 }' delay=-1
2075                     ; if { porta & mask != 0 } end
2076                     ;   call delay {{ }}  
2077 3b4 23f0            call delay
2078                     ;   call delay {{ }}  
2079 3b5 23f0            call delay
2080 3b6 0bbb            decfsz get_byte__count,f
2081 3b7 2bab            goto get_byte__738_loop
2082             get_byte__738_done:
2083                     ; `count_down count 8 ...' end
2084                     ; Skip over 1 / 3 of the stop bit :
2085                     ;   call delay {{ }}  
2086 3b8 23f0            call delay
2087                     ;   return char  
2088 3b9 083c            movf get_byte__char,w
2089 3ba 00ba            movwf get_byte__0return__byte
2090 3bb 3400            retlw 0
2091                     ; procedure get_byte end
2092             
2093                     ; procedure send_byte start
2094             send_byte:
2095     003d    send_byte__variables__base equ global__variables__bank0+49
2096     003d    send_byte__bytes__base equ send_byte__variables__base+0
2097     0041    send_byte__bits__base equ send_byte__variables__base+4
2098     0004    send_byte__total__bytes equ 4
2099     003d    send_byte__char equ send_byte__bytes__base+0
2100     003e    send_byte__mask equ send_byte__bytes__base+1
2101                     ; Send < char > to < mask > bit of < porta > .
2102     003f    send_byte__count equ send_byte__bytes__base+2
2103     0040    send_byte__mark equ send_byte__bytes__base+3
2104                     ; Send the start bit :
2105                     ;   mark := mask ^ space  
2106 3bc 30ff            movlw 255
2107 3bd 063e            xorwf send_byte__mask,w
2108 3be 00c0            movwf send_byte__mark
2109                     ;   porta := mark  
2110 3bf 0085            movwf porta
2111                     ;   call delay {{ }}  
2112 3c0 23f0            call delay
2113                     ;   call delay {{ }}  
2114 3c1 23f0            call delay
2115                     ;   call delay {{ }}  
2116 3c2 23f0            call delay
2117                     ; Send the data :
2118                     ; `count_down count 8 ...' start
2119 3c3 3008            movlw 8
2120 3c4 00bf            movwf send_byte__count
2121             send_byte__773_loop:
2122                     ; if { char @ 0 } start
2123                     ; Alias variable for select char @ 0
2124     003d    send_byte__char__774select0 equ send_byte__char+0
2125     003d    send_byte__char__774select0__byte equ send_byte__char+0
2126     0000    send_byte__char__774select0__bit equ 0
2127                     ; expression=`{ char @ 0 }' exp_delay=0 true_delay=1  false_delay=1 true_size=1 false_size=1
2128 3c5 183d            btfsc send_byte__char__774select0__byte,send_byte__char__774select0__bit
2129                     ; if { char @ 0 } body start
2130                     ;   porta := space  
2131 3c6 30ff            movlw 255
2132                     ; 1 instructions found for sharing
2133 3c7 1c3d            btfss send_byte__char__774select0__byte,send_byte__char__774select0__bit
2134                     ; else body start
2135                     ;   porta := mark  
2136 3c8 0840            movf send_byte__mark,w
2137                     ; 1 instructions found for sharing
2138                     ; if exp=` char @ 0 ' single true and false skip delay=4
2139                     ; Other expression=`{ char @ 0 }' delay=4
2140                     ; 1 shared instructions follow
2141 3c9 0085            movwf porta
2142                     ; if { char @ 0 } end
2143                     ;   char := char >> 1  
2144 3ca 1003            bcf c___byte,c___bit
2145 3cb 0cbd            rrf send_byte__char,f
2146                     ;   call delay {{ }}  
2147 3cc 23f0            call delay
2148                     ;   call delay {{ }}  
2149 3cd 23f0            call delay
2150                     ;   call delay {{ }}  
2151 3ce 23f0            call delay
2152 3cf 0bbf            decfsz send_byte__count,f
2153 3d0 2bc5            goto send_byte__773_loop
2154             send_byte__773_done:
2155                     ; `count_down count 8 ...' end
2156                     ; Send the stop bit :
2157                     ;   porta := space  
2158 3d1 30ff            movlw 255
2159 3d2 0085            movwf porta
2160                     ;   call delay {{ }}  
2161 3d3 23f0            call delay
2162                     ;   call delay {{ }}  
2163 3d4 23f0            call delay
2164                     ;   call delay {{ }}  
2165 3d5 23f0            call delay
2166                     ; procedure send_byte end
2167 3d6 3400            retlw 0
2168             
2169                     ; procedure master_send start
2170             master_send:
2171     0041    master_send__variables__base equ global__variables__bank0+53
2172     0041    master_send__bytes__base equ master_send__variables__base+0
2173     0042    master_send__bits__base equ master_send__variables__base+1
2174     0001    master_send__total__bytes equ 1
2175     0041    master_send__character equ master_send__bytes__base+0
2176                     ; This procedure will output < character > to the master .
2177                     ;   call send_byte {{ character , tx_master_mask }}  
2178 3d7 0841            movf master_send__character,w
2179 3d8 00bd            movwf send_byte__char
2180 3d9 3004            movlw 4
2181 3da 00be            movwf send_byte__mask
2182 3db 23bc            call send_byte
2183                     ; procedure master_send end
2184 3dc 3400            retlw 0
2185             
2186                     ; procedure master_string start
2187             master_string:
2188     0042    master_string__variables__base equ global__variables__bank0+54
2189     0042    master_string__bytes__base equ master_string__variables__base+0
2190     0045    master_string__bits__base equ master_string__variables__base+3
2191     0003    master_string__total__bytes equ 3
2192     0042    master_string__message equ master_string__bytes__base+0
2193                     ; This procedure will output < message > to the master .
2194     0043    master_string__size equ master_string__bytes__base+1
2195     0044    master_string__index equ master_string__bytes__base+2
2196                     ;   index := 0  
2197 3dd 01c4            clrf master_string__index
2198                     ; `while  index < message . size  ...' start
2199             master_string__811while__continue:
2200 3de 018a            clrf pclath___register
2201 3df 0842            movf master_string__message,w
2202 3e0 200b            call string___fetch
2203 3e1 0244            subwf master_string__index,w
2204                     ; expression=` index < message . size ' exp_delay=4 true_delay=7  false_delay=2 true_size=8 false_size=1
2205 3e2 1803            btfsc c___byte,c___bit
2206 3e3 2bec            goto master_string__811while__break
2207                     ;   call master_send {{ message ~~ {{ index }} }}  
2208 3e4 0a44            incf master_string__index,w
2209 3e5 0742            addwf master_string__message,w
2210 3e6 018a            clrf pclath___register
2211 3e7 200b            call string___fetch
2212 3e8 00c1            movwf master_send__character
2213 3e9 23d7            call master_send
2214                     ;   index := index + 1  
2215 3ea 0ac4            incf master_string__index,f
2216 3eb 2bde            goto master_string__811while__continue
2217                     ; if exp=` index < message . size ' false goto
2218                     ; Other expression=` index < message . size ' delay=-1
2219             master_string__811while__break:
2220                     ; `while  index < message . size  ...' end
2221                     ;   call master_send {{ sp }}  
2222 3ec 3020            movlw 32
2223 3ed 00c1            movwf master_send__character
2224 3ee 23d7            call master_send
2225                     ; procedure master_string end
2226 3ef 3400            retlw 0
2227             
2228                     ; procedure delay start
2229                     ; optimize 0
2230             delay:
2231     0045    delay__variables__base equ global__variables__bank0+57
2232     0045    delay__bytes__base equ delay__variables__base+0
2233     0046    delay__bits__base equ delay__variables__base+1
2234     0001    delay__total__bytes equ 1
2235     0045    delay__818byte1 equ delay__bytes__base+0
2236                     ;   arguments_none  
2237                     ;   uniform_delay instructions_per_delay  
2238                     ; Uniform delay remaining = 134 Accumulated Delay = 0
2239                     ; Uniform delay remaining = 134 Accumulated Delay = 0
2240                     ; Delay 1 third of a bit :
2241                     ; Uniform delay remaining = 134 Accumulated Delay = 0
2242                     ; Uniform delay remaining = 134 Accumulated Delay = 0
2243                     ; Soak up remaining 134 cycles
2244                     ; Delay 134 cycles
2245 3f0 302c            movlw 44
2246 3f1 00c5            movwf delay__818byte1
2247             delay__818delay0:
2248 3f2 0bc5            decfsz delay__818byte1,f
2249 3f3 2bf2            goto delay__818delay0
2250 3f4 0000            nop
2251                     ; procedure delay end
2252 3f5 3400            retlw 0
2253                     ; optimize 1
2254             
2255                     ; Register bank 0 used 58 bytes of 68 available bytes
2256                     ; Register bank 1 used 0 bytes of 0 available bytes
2257             
2258                     end

