  1                     radix dec
  2     0020    global__variables__bank0 equ 32
  3     00a0    global__variables__bank1 equ 160
  4     0120    global__variables__bank2 equ 288
  5     01f0    global__variables__bank3 equ 496
  6     005e    global__bit__variables__bank0 equ 94
  7     00a0    global__bit__variables__bank1 equ 160
  8     0120    global__bit__variables__bank2 equ 288
  9     01f0    global__bit__variables__bank3 equ 496
 10     0000    indf___register equ 0
 11     0002    pcl___register equ 2
 12     0003    c___byte equ 3
 13     0000    c___bit equ 0
 14     0003    z___byte equ 3
 15     0002    z___bit equ 2
 16     0003    rp0___byte equ 3
 17     0005    rp0___bit equ 5
 18     0003    rp1___byte equ 3
 19     0006    rp1___bit equ 6
 20     0003    irp___byte equ 3
 21     0007    irp___bit equ 7
 22     0085    trisa___register equ 0x85
 23     0086    trisb___register equ 0x86
 24     0004    fsr___register equ 4
 25     000a    pclath___register equ 10
 26                     org 0
 27             start:
 28 000 0000            nop
 29 001 0000            nop
 30 002 0000            nop
 31 003 2805            goto skip___interrupt
 32             interrupt___vector:
 33 004 0009            retfie
 34             skip___interrupt:
 35                     ; Initialize A/D system to allow digital I/O
 36 005 3007            movlw 7
 37 006 009f            movwf 31
 38                     ; Switch from register bank 0 to register bank 1 (which contains 159)
 39 007 1683            bsf rp0___byte,rp0___bit
 40                     ; Register bank is now 1
 41 008 019f            clrf 159
 42                     ; Initialize TRIS registers
 43 009 30eb            movlw 235
 44 00a 0086            movwf trisb___register
 45 00b 018a            clrf pclath___register
 46                     ; Switch from register bank 1 to register bank 0
 47 00c 1283            bcf rp0___byte,rp0___bit
 48                     ; Register bank is now 0
 49 00d 2875            goto main
 50                     ; comment #############################################################################
 51                     ; comment {}
 52                     ; comment {Copyright < c > 1999 - 2001 by Wayne C . Gramlich .}
 53                     ; comment {All rights reserved .}
 54                     ; comment {}
 55                     ; comment {Permission to use , copy , modify , distribute , and sell this software}
 56                     ; comment {for any purpose is hereby granted without fee provided that the above}
 57                     ; comment {copyright notice and this permission are retained . The author makes}
 58                     ; comment {no representations about the suitability of this software for any purpose .}
 59                     ; comment {It is provided { as is } without express or implied warranty .}
 60                     ; comment {}
 61                     ; comment {This is a test harness for testing the Motor2 RoboBrick . See :}
 62                     ; comment {}
 63                     ; comment {http : / / web . gramlich . net / projects / robobricks / motor2 / index . html}
 64                     ; comment {}
 65                     ; comment {for more details .}
 66                     ; comment {}
 67                     ; comment #############################################################################
 68                     ;   processor pic16f628 cp = off cpd = off lvp = off bowden = off mclre = on pwrte = off wdte = off fosc = xt  
 69                     ; 16169=0x3f29 8199=0x2007
 70                     __config 16169
 71     2007    configuration___address equ 8199
 72                     ; comment {processor pic16f84 cp = off dp = off pwrte = disabled wdte = disabled fosc = xt}
 73                     ;   constant clock_rate 10000000  
 74     989680    clock_rate equ 10000000
 75                     ;   constant clock_ticks_per_instruction 4  
 76     0004    clock_ticks_per_instruction equ 4
 77                     ;   constant instructions_per_second clock_rate / clock_ticks_per_instruction  
 78     2625a0    instructions_per_second equ 2500000
 79                     ;   constant baud_rate 2400  
 80     0960    baud_rate equ 2400
 81                     ;   constant instructions_per_bit clock_rate / {{ clock_ticks_per_instruction * baud_rate }}  
 82     0411    instructions_per_bit equ 1041
 83                     ;   constant delays_per_bit 3  
 84     0003    delays_per_bit equ 3
 85                     ;   constant instructions_per_delay instructions_per_bit / delays_per_bit  
 86     015b    instructions_per_delay equ 347
 87                     ;   constant extra_instructions_per_bit 12  
 88     000c    extra_instructions_per_bit equ 12
 89                     ; comment {constant extra_instructions_per_bit 0}
 90                     ;   constant extra_instructions_per_delay extra_instructions_per_bit / delays_per_bit  
 91     0004    extra_instructions_per_delay equ 4
 92                     ;   constant delay_instructions instructions_per_delay - extra_instructions_per_delay  
 93     0157    delay_instructions equ 343
 94                     ; comment {The null pulse that comes back from a clock pulse command is supposed to be}
 95                     ; comment {exactly 9 bits long . 9 bits at 2400 baud is 9 / 2400 = 3 . 75 mS . The number}
 96                     ; comment {iterations through the loop is 3 . 75 mS / < number of instructions per iteration . >}
 97                     ;   constant nine_bits_instructions {{ clock_rate * 9 }} / {{ clock_ticks_per_instruction * baud_rate }}  
 98     249f    nine_bits_instructions equ 9375
 99                     ;   constant instructions_per_iteration 7  
100     0007    instructions_per_iteration equ 7
101                     ;   constant iterations_for_nine_bits nine_bits_instructions / instructions_per_iteration  
102     053b    iterations_for_nine_bits equ 1339
103                     ;   constant iterations_high iterations_for_nine_bits / 256  
104     0005    iterations_high equ 5
105                     ;   constant iterations_low iterations_for_nine_bits - {{ iterations_high * 256 }}  
106     003b    iterations_low equ 59
107                     ; comment {Some character constants :}
108                     ;   constant sp 32  
109     0020    sp equ 32
110                     ;   constant cr 13  
111     000d    cr equ 13
112                     ;   constant lf 10  
113     000a    lf equ 10
114                     ; comment {Some bit definitions :}
115                     ;   constant rx_slave_bit 5  
116     0005    rx_slave_bit equ 5
117                     ;   constant tx_slave_bit 4  
118     0004    tx_slave_bit equ 4
119                     ;   constant rx_master_bit 1  
120     0001    rx_master_bit equ 1
121                     ;   constant tx_master_bit 2  
122     0002    tx_master_bit equ 2
123                     ;   constant rx_slave_mask 1 << rx_slave_bit  
124     0020    rx_slave_mask equ 32
125                     ;   constant tx_slave_mask 1 << tx_slave_bit  
126     0010    tx_slave_mask equ 16
127                     ;   constant rx_master_mask 1 << rx_master_bit  
128     0002    rx_master_mask equ 2
129                     ;   constant tx_master_mask 1 << tx_master_bit  
130     0004    tx_master_mask equ 4
131                     ; comment {Some register definitions :}
132     0003    status equ 3
133                     ;   bind c status @ 0  
134     0003    c equ status+0
135     0003    c__byte equ status+0
136     0000    c__bit equ 0
137                     ;   bind z status @ 2  
138     0003    z equ status+0
139     0003    z__byte equ status+0
140     0002    z__bit equ 2
141                     ; comment {Some port and pin defintions :}
142     0006    portb equ 6
143     0006    tx_master_pin__byte equ 6
144     0002    tx_master_pin__bit equ 2
145     0006    rx_master_pin__byte equ 6
146     0001    rx_master_pin__bit equ 1
147     0006    tx_slave_pin__byte equ 6
148     0004    tx_slave_pin__bit equ 4
149     0006    rx_slave_pin__byte equ 6
150     0005    rx_slave_pin__bit equ 5
151                     ; comment {Miscellaneous definitions :}
152                     ;   constant space 0xff  
153     00ff    space equ 255
154                     ;   constant buffer_size 5  
155     0005    buffer_size equ 5
156                     ; string_constants Start
157             string___fetch:
158 00e 0082            movwf pcl___register
159                     ;   clock_string = 0s'Clk'  
160     0000    clock_string___string equ 0
161             clock_string:
162 00f 0782            addwf pcl___register,f
163                     ; Length = 3
164 010 3403            retlw 3
165                     ; `Clk'
166 011 3443            retlw 67
167 012 346c            retlw 108
168 013 346b            retlw 107
169                     ;   common_string = 0s'Common'  
170     0005    common_string___string equ 5
171             common_string:
172 014 0782            addwf pcl___register,f
173                     ; Length = 6
174 015 3406            retlw 6
175                     ; `Common'
176 016 3443            retlw 67
177 017 346f            retlw 111
178 018 346d            retlw 109
179 019 346d            retlw 109
180 01a 346f            retlw 111
181 01b 346e            retlw 110
182                     ;   direction_string = 0s'Dir'  
183     000d    direction_string___string equ 13
184             direction_string:
185 01c 0782            addwf pcl___register,f
186                     ; Length = 3
187 01d 3403            retlw 3
188                     ; `Dir'
189 01e 3444            retlw 68
190 01f 3469            retlw 105
191 020 3472            retlw 114
192                     ;   done_string = 0s'Done'  
193     0012    done_string___string equ 18
194             done_string:
195 021 0782            addwf pcl___register,f
196                     ; Length = 4
197 022 3404            retlw 4
198                     ; `Done'
199 023 3444            retlw 68
200 024 346f            retlw 111
201 025 346e            retlw 110
202 026 3465            retlw 101
203                     ;   fail_string = 0s'Fail'  
204     0018    fail_string___string equ 24
205             fail_string:
206 027 0782            addwf pcl___register,f
207                     ; Length = 4
208 028 3404            retlw 4
209                     ; `Fail'
210 029 3446            retlw 70
211 02a 3461            retlw 97
212 02b 3469            retlw 105
213 02c 346c            retlw 108
214                     ;   failsafe_string = 0s'F/S'  
215     001e    failsafe_string___string equ 30
216             failsafe_string:
217 02d 0782            addwf pcl___register,f
218                     ; Length = 3
219 02e 3403            retlw 3
220                     ; `F/S'
221 02f 3446            retlw 70
222 030 342f            retlw 47
223 031 3453            retlw 83
224                     ;   hello_string = 0s'Motor2_Test'  
225     0023    hello_string___string equ 35
226             hello_string:
227 032 0782            addwf pcl___register,f
228                     ; Length = 11
229 033 340b            retlw 11
230                     ; `Motor2_Test'
231 034 344d            retlw 77
232 035 346f            retlw 111
233 036 3474            retlw 116
234 037 346f            retlw 111
235 038 3472            retlw 114
236 039 3432            retlw 50
237 03a 345f            retlw 95
238 03b 3454            retlw 84
239 03c 3465            retlw 101
240 03d 3473            retlw 115
241 03e 3474            retlw 116
242                     ;   mode_string = 0s'Mode'  
243     0030    mode_string___string equ 48
244             mode_string:
245 03f 0782            addwf pcl___register,f
246                     ; Length = 4
247 040 3404            retlw 4
248                     ; `Mode'
249 041 344d            retlw 77
250 042 346f            retlw 111
251 043 3464            retlw 100
252 044 3465            retlw 101
253                     ;   mode_dir_string = 0s'M/D'  
254     0036    mode_dir_string___string equ 54
255             mode_dir_string:
256 045 0782            addwf pcl___register,f
257                     ; Length = 3
258 046 3403            retlw 3
259                     ; `M/D'
260 047 344d            retlw 77
261 048 342f            retlw 47
262 049 3444            retlw 68
263                     ;   motor_string = 0s'Motor'  
264     003b    motor_string___string equ 59
265             motor_string:
266 04a 0782            addwf pcl___register,f
267                     ; Length = 5
268 04b 3405            retlw 5
269                     ; `Motor'
270 04c 344d            retlw 77
271 04d 346f            retlw 111
272 04e 3474            retlw 116
273 04f 346f            retlw 111
274 050 3472            retlw 114
275                     ;   ramps = 0 , 1 , 0x10 , 0x80 , 0xff  
276     0042    ramps___string equ 66
277             ramps:
278 051 0782            addwf pcl___register,f
279                     ; Length = 5
280 052 3405            retlw 5
281                     ; 0
282 053 3400            retlw 0
283                     ; 1
284 054 3401            retlw 1
285                     ; 0x10
286 055 3410            retlw 16
287                     ; 0x80
288 056 3480            retlw 128
289                     ; 0xff
290 057 34ff            retlw 255
291                     ;   ramp_string = 0s'Ramp'  
292     0049    ramp_string___string equ 73
293             ramp_string:
294 058 0782            addwf pcl___register,f
295                     ; Length = 4
296 059 3404            retlw 4
297                     ; `Ramp'
298 05a 3452            retlw 82
299 05b 3461            retlw 97
300 05c 346d            retlw 109
301 05d 3470            retlw 112
302                     ;   scaler_string = 0s'Scaler'  
303     004f    scaler_string___string equ 79
304             scaler_string:
305 05e 0782            addwf pcl___register,f
306                     ; Length = 6
307 05f 3406            retlw 6
308                     ; `Scaler'
309 060 3453            retlw 83
310 061 3463            retlw 99
311 062 3461            retlw 97
312 063 346c            retlw 108
313 064 3465            retlw 101
314 065 3472            retlw 114
315                     ;   speeds = 0x10 , 0x20 , 0x40 , 0x80 , 0xff , 0  
316     0057    speeds___string equ 87
317             speeds:
318 066 0782            addwf pcl___register,f
319                     ; Length = 6
320 067 3406            retlw 6
321                     ; 0x10
322 068 3410            retlw 16
323                     ; 0x20
324 069 3420            retlw 32
325                     ; 0x40
326 06a 3440            retlw 64
327                     ; 0x80
328 06b 3480            retlw 128
329                     ; 0xff
330 06c 34ff            retlw 255
331                     ; 0
332 06d 3400            retlw 0
333                     ;   speed_string = 0s'Speed'  
334     005f    speed_string___string equ 95
335             speed_string:
336 06e 0782            addwf pcl___register,f
337                     ; Length = 5
338 06f 3405            retlw 5
339                     ; `Speed'
340 070 3453            retlw 83
341 071 3470            retlw 112
342 072 3465            retlw 101
343 073 3465            retlw 101
344 074 3464            retlw 100
345                     ; string__constants End
346             
347                     ; procedure main start
348             main:
349     0020    main__variables__base equ global__variables__bank0+0
350     0020    main__bytes__base equ main__variables__base+0
351     002a    main__bits__base equ main__variables__base+10
352     000a    main__total__bytes equ 10
353     0029    main__122byte0 equ main__bytes__base+9
354     0029    main__150byte0 equ main__bytes__base+9
355                     ;   arguments_none  
356                     ; Read a byte .
357     0020    main__buffer equ main__bytes__base+0
358     0025    main__char equ main__bytes__base+5
359     0026    main__count equ main__bytes__base+6
360     0027    main__index equ main__bytes__base+7
361     0028    main__number equ main__bytes__base+8
362                     ; Print out a welcome message :
363                     ;   call master_crlf {{ }}  
364 075 238b            call master_crlf
365                     ;   call master_string {{ hello_string }}  
366 076 3033            movlw LOW hello_string+1
367 077 00da            movwf master_string__message
368 078 242e            call master_string
369                     ;   call master_crlf {{ }}  
370 079 238b            call master_crlf
371                     ; Main loop
372                     ;   number := 0  
373 07a 01a8            clrf main__number
374                     ; loop_forever ... start
375             main__110loop__forever:
376                     ; Get a character :
377                     ;   tx_slave_pin := 1  
378 07b 1606            bsf tx_slave_pin__byte,tx_slave_pin__bit
379                     ;   char := master_get {{ }}  
380 07c 239d            call master_get
381 07d 0849            movf master_get__0return__byte,w
382 07e 00a5            movwf main__char
383                     ; Delay 2 / 3 ' s of bit make sure that get_byte is done .
384                     ;   call delay {{ }}  
385 07f 2441            call delay
386                     ;   call delay {{ }}  
387 080 2441            call delay
388                     ; if { 0c'0' <= char && char < {{ 0c'9' + 1 }} } start
389 081 3030            movlw 48
390 082 0225            subwf main__char,w
391                     ; expression=`0c'0' <= char' exp_delay=2 true_delay=-1  false_delay=1 true_size=131 false_size=1
392 083 1c03            btfss c___byte,c___bit
393 084 2895            goto and119__0false
394 085 303a            movlw 58
395 086 0225            subwf main__char,w
396                     ; expression=`char < {{ 0c'9' + 1 }}' exp_delay=2 true_delay=9  false_delay=-1 true_size=11 false_size=115
397 087 1803            btfsc c___byte,c___bit
398 088 2895            goto label119__1false
399             label119__1true:
400             and119__0true:
401                     ; if { 0c'0' <= char && char < {{ 0c'9' + 1 }} } body start
402                     ; Do a multiply by 8 then add in digit :
403                     ;   call master_send {{ char }}  
404 089 0825            movf main__char,w
405 08a 00d9            movwf master_send__character
406 08b 2428            call master_send
407                     ;   number := {{ number << 3 }} + char - 0c'0'  
408 08c 0d28            rlf main__number,w
409 08d 00a9            movwf main__122byte0
410 08e 0da9            rlf main__122byte0,f
411 08f 0d29            rlf main__122byte0,w
412 090 39f8            andlw 248
413 091 0725            addwf main__char,w
414 092 3ed0            addlw 208
415 093 00a8            movwf main__number
416                     ; if { 0c'0' <= char && char < {{ 0c'9' + 1 }} } body end
417 094 2908            goto label119__1end
418             label119__1false:
419             and119__0false:
420 095 3073            movlw 115
421 096 0225            subwf main__char,w
422                     ; expression=`{ char = 0c's' }' exp_delay=2 true_delay=-1  false_delay=-1 true_size=8 false_size=102
423 097 1d03            btfss z___byte,z___bit
424 098 28a2            goto label123__0false
425             label123__0true:
426                     ; else_if { char = 0c's' } body start
427                     ; Send byte to brick , no wait :
428                     ; Echo command and send CRLF :
429                     ;   call master_send {{ char }}  
430 099 0825            movf main__char,w
431 09a 00d9            movwf master_send__character
432 09b 2428            call master_send
433                     ;   call master_crlf {{ }}  
434 09c 238b            call master_crlf
435                     ; Ship the byte down to the brick :
436                     ;   call slave_send {{ number }}  
437 09d 0828            movf main__number,w
438 09e 00d0            movwf slave_send__data
439 09f 23e2            call slave_send
440                     ;   number := 0  
441 0a0 01a8            clrf main__number
442                     ; else_if { char = 0c's' } body end
443 0a1 2908            goto label123__0end
444             label123__0false:
445 0a2 3077            movlw 119
446 0a3 0225            subwf main__char,w
447                     ; expression=`{ char = 0c'w' }' exp_delay=2 true_delay=-1  false_delay=-1 true_size=39 false_size=58
448 0a4 1d03            btfss z___byte,z___bit
449 0a5 28ce            goto label134__0false
450             label134__0true:
451                     ; else_if { char = 0c'w' } body start
452                     ; Send byte to brick , wait for results :
453                     ; Echo command and send CRLF :
454                     ;   call master_send {{ char }}  
455 0a6 0825            movf main__char,w
456 0a7 00d9            movwf master_send__character
457 0a8 2428            call master_send
458                     ;   call master_crlf {{ }}  
459 0a9 238b            call master_crlf
460                     ; Ship the byte down to the brick ...
461                     ;   call slave_send {{ number }}  
462 0aa 0828            movf main__number,w
463 0ab 00d0            movwf slave_send__data
464 0ac 23e2            call slave_send
465                     ;   number := 0  
466 0ad 01a8            clrf main__number
467                     ; call delay < >
468                     ; ... and wait for a response :
469                     ;   index := 0  
470 0ae 01a7            clrf main__index
471                     ; `while  index < buffer_size  ...' start
472             main__149while__continue:
473 0af 3005            movlw 5
474 0b0 0227            subwf main__index,w
475                     ; expression=` index < buffer_size ' exp_delay=2 true_delay=10  false_delay=2 true_size=11 false_size=1
476 0b1 1803            btfsc c___byte,c___bit
477 0b2 28be            goto main__149while__break
478                     ;   buffer ~~ {{ index }} := slave_get {{ }}  
479 0b3 23bc            call slave_get
480 0b4 084c            movf slave_get__0return__byte,w
481 0b5 00a9            movwf main__150byte0
482 0b6 3020            movlw LOW main__buffer
483 0b7 0727            addwf main__index,w
484 0b8 0084            movwf fsr___register
485 0b9 0829            movf main__150byte0,w
486 0ba 1383            bcf irp___register,irp___bit
487 0bb 0080            movwf indf___register
488                     ;   index := index + 1  
489 0bc 0aa7            incf main__index,f
490 0bd 28af            goto main__149while__continue
491                     ; if exp=` index < buffer_size ' false goto
492                     ; Other expression=` index < buffer_size ' delay=-1
493             main__149while__break:
494                     ; `while  index < buffer_size  ...' end
495                     ;   index := 0  
496 0be 01a7            clrf main__index
497                     ; `while  index < buffer_size  ...' start
498             main__155while__continue:
499 0bf 3005            movlw 5
500 0c0 0227            subwf main__index,w
501                     ; expression=` index < buffer_size ' exp_delay=2 true_delay=8  false_delay=2 true_size=9 false_size=1
502 0c1 1803            btfsc c___byte,c___bit
503 0c2 28cc            goto main__155while__break
504                     ;   call master_octal {{ buffer ~~ {{ index }} }}  
505 0c3 3020            movlw LOW main__buffer
506 0c4 0727            addwf main__index,w
507 0c5 0084            movwf fsr___register
508 0c6 1383            bcf irp___register,irp___bit
509 0c7 0800            movf indf___register,w
510 0c8 00ca            movwf master_octal__number
511 0c9 23a3            call master_octal
512                     ;   index := index + 1  
513 0ca 0aa7            incf main__index,f
514 0cb 28bf            goto main__155while__continue
515                     ; if exp=` index < buffer_size ' false goto
516                     ; Other expression=` index < buffer_size ' delay=-1
517             main__155while__break:
518                     ; `while  index < buffer_size  ...' end
519                     ; Terminate the output list
520                     ;   call master_crlf {{ }}  
521 0cc 238b            call master_crlf
522                     ; else_if { char = 0c'w' } body end
523 0cd 2908            goto label134__0end
524             label134__0false:
525 0ce 3069            movlw 105
526 0cf 0225            subwf main__char,w
527                     ; expression=`{ char = 0c'i' }' exp_delay=2 true_delay=-1  false_delay=-1 true_size=12 false_size=41
528 0d0 1d03            btfss z___byte,z___bit
529 0d1 28df            goto label162__0false
530             label162__0true:
531                     ; else_if { char = 0c'i' } body start
532                     ; Interrogate the slave RoboBrick :
533                     ;   call master_send {{ char }}  
534 0d2 0825            movf main__char,w
535 0d3 00d9            movwf master_send__character
536 0d4 2428            call master_send
537                     ;   call master_crlf {{ }}  
538 0d5 238b            call master_crlf
539                     ; Initialize the id index :
540                     ;   call slave_send {{ 0xfd }}  
541 0d6 30fd            movlw 253
542 0d7 00d0            movwf slave_send__data
543 0d8 23e2            call slave_send
544                     ; Get the first 8 bytes :
545                     ;   call slave_id8 {{ }}  
546 0d9 23c2            call slave_id8
547                     ; Get the next 8 bytes of random numbers :
548                     ;   call slave_id8 {{ }}  
549 0da 23c2            call slave_id8
550                     ; Get the next 8 bytes of random numbers :
551                     ;   call slave_id8 {{ }}  
552 0db 23c2            call slave_id8
553                     ; Get the slave brick name :
554                     ;   call slave_id_string {{ }}  
555 0dc 23d3            call slave_id_string
556                     ; Get the vendor name :
557                     ;   call slave_id_string {{ }}  
558 0dd 23d3            call slave_id_string
559                     ; else_if { char = 0c'i' } body end
560 0de 2908            goto label162__0end
561             label162__0false:
562 0df 3074            movlw 116
563 0e0 0225            subwf main__char,w
564                     ; expression=`{ char = 0c't' }' exp_delay=2 true_delay=-1  false_delay=-1 true_size=5 false_size=31
565 0e1 1d03            btfss z___byte,z___bit
566 0e2 28e9            goto label185__0false
567             label185__0true:
568                     ; else_if { char = 0c't' } body start
569                     ; Do testing :
570                     ;   call master_send {{ char }}  
571 0e3 0825            movf main__char,w
572 0e4 00d9            movwf master_send__character
573 0e5 2428            call master_send
574                     ;   call master_crlf {{ }}  
575 0e6 238b            call master_crlf
576                     ;   call test {{ }}  
577 0e7 2198            call test
578                     ; else_if { char = 0c't' } body end
579 0e8 2908            goto label185__0end
580             label185__0false:
581 0e9 3063            movlw 99
582 0ea 0225            subwf main__char,w
583                     ; expression=`{ char = 0c'c' }' exp_delay=2 true_delay=-1  false_delay=-1 true_size=7 false_size=19
584 0eb 1d03            btfss z___byte,z___bit
585 0ec 28f5            goto label190__0false
586             label190__0true:
587                     ; else_if { char = 0c'c' } body start
588                     ;   call master_send {{ char }}  
589 0ed 0825            movf main__char,w
590 0ee 00d9            movwf master_send__character
591 0ef 2428            call master_send
592                     ;   call master_crlf {{ }}  
593 0f0 238b            call master_crlf
594                     ;   call clock_adjust {{ 0 }}  
595 0f1 01aa            clrf clock_adjust__adjust
596 0f2 2109            call clock_adjust
597                     ;   number := 0  
598 0f3 01a8            clrf main__number
599                     ; else_if { char = 0c'c' } body end
600 0f4 2908            goto label190__0end
601             label190__0false:
602 0f5 30fc            movlw 252
603 0f6 0225            subwf main__char,w
604                     ; expression=`{ char != 0xfc }' exp_delay=2 true_delay=-1  false_delay=0 true_size=15 false_size=0
605 0f7 1903            btfsc z___byte,z___bit
606 0f8 2908            goto label195__0end
607                     ; else_if { char != 0xfc } body start
608                     ; Just echo back the current number :
609                     ;   call master_send {{ 0c'<' }}  
610 0f9 303c            movlw 60
611 0fa 00d9            movwf master_send__character
612 0fb 2428            call master_send
613                     ;   call master_octal {{ char }}  
614 0fc 0825            movf main__char,w
615 0fd 00ca            movwf master_octal__number
616 0fe 23a3            call master_octal
617                     ;   call master_send {{ 0c'>' }}  
618 0ff 303e            movlw 62
619 100 00d9            movwf master_send__character
620 101 2428            call master_send
621                     ; Send a carriage - return line - feed :
622                     ;   call master_crlf {{ }}  
623 102 238b            call master_crlf
624                     ; Output the character in octal :
625                     ;   call master_octal {{ number }}  
626 103 0828            movf main__number,w
627 104 00ca            movwf master_octal__number
628 105 23a3            call master_octal
629                     ; Send a carriage - return line - feed :
630                     ;   call master_crlf {{ }}  
631 106 238b            call master_crlf
632                     ; Reset number
633                     ;   number := 0  
634 107 01a8            clrf main__number
635                     ; else_if { char != 0xfc } body end
636             label195__0end:
637                     ; if exp=` char != 0xfc ' empty false
638                     ; Other expression=`{ char != 0xfc }' delay=-1
639                     ; if exp=` char = 0c'c' ' generic
640             label190__0end:
641                     ; Other expression=`{ char = 0c'c' }' delay=-1
642                     ; if exp=` char = 0c't' ' generic
643             label185__0end:
644                     ; Other expression=`{ char = 0c't' }' delay=-1
645                     ; if exp=` char = 0c'i' ' generic
646             label162__0end:
647                     ; Other expression=`{ char = 0c'i' }' delay=-1
648                     ; if exp=` char = 0c'w' ' generic
649             label134__0end:
650                     ; Other expression=`{ char = 0c'w' }' delay=-1
651                     ; if exp=` char = 0c's' ' generic
652             label123__0end:
653                     ; Other expression=`{ char = 0c's' }' delay=-1
654                     ; if exp=`char < {{ 0c'9' + 1 }}' generic
655             label119__1end:
656                     ; Other expression=`char < {{ 0c'9' + 1 }}' delay=-1
657                     ; if exp=`0c'0' <= char' false goto
658                     ; Other expression=`0c'0' <= char' delay=-1
659             and119__0end:
660                     ; if { 0c'0' <= char && char < {{ 0c'9' + 1 }} } end
661 108 287b            goto main__110loop__forever
662                     ; loop_forever ... end
663                     ; procedure main end
664             
665                     ; procedure clock_adjust start
666             clock_adjust:
667     002a    clock_adjust__variables__base equ global__variables__bank0+10
668     002a    clock_adjust__bytes__base equ clock_adjust__variables__base+0
669     0033    clock_adjust__bits__base equ clock_adjust__variables__base+9
670     0009    clock_adjust__total__bytes equ 9
671     0032    clock_adjust__273byte0 equ clock_adjust__bytes__base+8
672     0032    clock_adjust__283byte0 equ clock_adjust__bytes__base+8
673     0032    clock_adjust__287byte0 equ clock_adjust__bytes__base+8
674     0032    clock_adjust__231byte0 equ clock_adjust__bytes__base+8
675     002a    clock_adjust__adjust equ clock_adjust__bytes__base+0
676                     ; This procedure will adjust the clock to the slave .
677     002b    clock_adjust__command equ clock_adjust__bytes__base+1
678     002c    clock_adjust__count equ clock_adjust__bytes__base+2
679     002d    clock_adjust__error equ clock_adjust__bytes__base+3
680     002e    clock_adjust__error_minimum equ clock_adjust__bytes__base+4
681     002f    clock_adjust__high equ clock_adjust__bytes__base+5
682     0030    clock_adjust__low equ clock_adjust__bytes__base+6
683     0031    clock_adjust__target equ clock_adjust__bytes__base+7
684                     ;   target := iterations_low - adjust  
685 109 303b            movlw 59
686 10a 00b2            movwf clock_adjust__231byte0
687 10b 082a            movf clock_adjust__adjust,w
688 10c 0232            subwf clock_adjust__231byte0,w
689 10d 00b1            movwf clock_adjust__target
690                     ;   count := 2  
691 10e 3002            movlw 2
692 10f 00ac            movwf clock_adjust__count
693                     ;   error := 0xff  
694 110 30ff            movlw 255
695 111 00ad            movwf clock_adjust__error
696                     ;   error_minimum := 0xf0  
697 112 30f0            movlw 240
698 113 00ae            movwf clock_adjust__error_minimum
699                     ; Print out the target :
700                     ;   call master_send {{ 0c'T' }}  
701 114 3054            movlw 84
702 115 00d9            movwf master_send__character
703 116 2428            call master_send
704                     ;   call master_octal {{ iterations_high }}  
705 117 3005            movlw 5
706 118 00ca            movwf master_octal__number
707 119 23a3            call master_octal
708                     ;   call master_octal {{ target }}  
709 11a 0831            movf clock_adjust__target,w
710 11b 00ca            movwf master_octal__number
711 11c 23a3            call master_octal
712                     ;   call master_crlf {{ }}  
713 11d 238b            call master_crlf
714                     ; loop_forever ... start
715             clock_adjust__242loop__forever:
716                     ; Print out the clock value :
717                     ;   call master_send {{ 0c'C' }}  
718 11e 3043            movlw 67
719 11f 00d9            movwf master_send__character
720 120 2428            call master_send
721                     ;   call slave_send {{ 0xfa }}  
722 121 30fa            movlw 250
723 122 00d0            movwf slave_send__data
724 123 23e2            call slave_send
725                     ;   call master_octal {{ slave_get {{ }} }}  
726 124 23bc            call slave_get
727 125 084c            movf slave_get__0return__byte,w
728 126 00ca            movwf master_octal__number
729 127 23a3            call master_octal
730                     ; Ask for a timing byte :
731                     ;   call slave_send {{ 0xfb }}  
732 128 30fb            movlw 251
733 129 00d0            movwf slave_send__data
734 12a 23e2            call slave_send
735                     ;   low := 0  
736 12b 01b0            clrf clock_adjust__low
737                     ;   high := 0  
738 12c 01af            clrf clock_adjust__high
739                     ; `while rx_slave_pin ...' start
740             clock_adjust__253while__continue:
741                     ; expression=`rx_slave_pin' exp_delay=0 true_delay=2  false_delay=2 true_size=1 false_size=1
742 12d 1a86            btfsc rx_slave_pin__byte,rx_slave_pin__bit
743                     ; Do nothing :
744 12e 292d            goto clock_adjust__253while__continue
745 12f 2930            goto clock_adjust__253while__break
746                     ; if exp=`rx_slave_pin' true goto small true
747             clock_adjust__253while__break:
748                     ; `while rx_slave_pin ...' end
749                     ; `while  ! rx_slave_pin  ...' start
750             clock_adjust__256while__continue:
751                     ; expression=`rx_slave_pin' exp_delay=0 true_delay=2  false_delay=5 true_size=1 false_size=4
752 130 1a86            btfsc rx_slave_pin__byte,rx_slave_pin__bit
753 131 2936            goto clock_adjust__256while__break
754                     ;   low := low + 1  
755 132 0ab0            incf clock_adjust__low,f
756                     ; if { z } start
757                     ; expression=`{ z }' exp_delay=0 true_delay=1  false_delay=0 true_size=1 false_size=0
758 133 1903            btfsc z__byte,z__bit
759                     ; if { z } body start
760                     ;   high := high + 1  
761 134 0aaf            incf clock_adjust__high,f
762                     ; if { z } body end
763                     ; if exp=`z' false skip delay=2
764                     ; Other expression=`{ z }' delay=2
765                     ; if { z } end
766 135 2930            goto clock_adjust__256while__continue
767                     ; if exp=`rx_slave_pin' true goto
768                     ; Other expression=`rx_slave_pin' delay=-1
769             clock_adjust__256while__break:
770                     ; `while  ! rx_slave_pin  ...' end
771                     ; Print out high and low :
772                     ;   call master_send {{ 0c'H' }}  
773 136 3048            movlw 72
774 137 00d9            movwf master_send__character
775 138 2428            call master_send
776                     ;   call master_octal {{ high }}  
777 139 082f            movf clock_adjust__high,w
778 13a 00ca            movwf master_octal__number
779 13b 23a3            call master_octal
780                     ;   call master_send {{ 0c'L' }}  
781 13c 304c            movlw 76
782 13d 00d9            movwf master_send__character
783 13e 2428            call master_send
784                     ;   call master_octal {{ low }}  
785 13f 0830            movf clock_adjust__low,w
786 140 00ca            movwf master_octal__number
787 141 23a3            call master_octal
788                     ; Now think about adjusting clock .
789                     ; if { high > iterations_high } start
790 142 3006            movlw 6
791 143 022f            subwf clock_adjust__high,w
792                     ; expression=`{ high > iterations_high }' exp_delay=2 true_delay=7  false_delay=-1 true_size=7 false_size=36
793 144 1803            btfsc c___byte,c___bit
794 145 296b            goto label270__0true
795             label270__0false:
796 146 3005            movlw 5
797 147 022f            subwf clock_adjust__high,w
798                     ; expression=`{ high < iterations_high }' exp_delay=2 true_delay=4  false_delay=-1 true_size=4 false_size=27
799 148 1c03            btfss c___byte,c___bit
800 149 2966            goto label274__0true
801             label274__0false:
802                     ; else body start
803                     ; The high 8 - bits are equal :
804                     ; if { low > target } start
805 14a 0830            movf clock_adjust__low,w
806 14b 0231            subwf clock_adjust__target,w
807                     ; expression=`{ low > target }' exp_delay=2 true_delay=7  false_delay=-1 true_size=7 false_size=15
808 14c 1c03            btfss c___byte,c___bit
809 14d 295e            goto label280__0true
810             label280__0false:
811 14e 0831            movf clock_adjust__target,w
812 14f 0230            subwf clock_adjust__low,w
813                     ; expression=`{ low < target }' exp_delay=2 true_delay=7  false_delay=3 true_size=7 false_size=3
814 150 1c03            btfss c___byte,c___bit
815 151 2956            goto label284__0true
816             label284__0false:
817                     ; else body start
818                     ; Exact match ; we are done :
819                     ;   command := 0  
820 152 01ab            clrf clock_adjust__command
821                     ;   error := 0  
822 153 01ad            clrf clock_adjust__error
823                     ;   error_minimum := 0  
824 154 01ae            clrf clock_adjust__error_minimum
825                     ; else body end
826 155 295d            goto label284__0end
827             label284__0true:
828                     ; else_if { low < target } body start
829                     ; Clock pulse is too short ; slave clock is too fast :
830                     ;   command := 0xf8  
831 156 30f8            movlw 248
832 157 00ab            movwf clock_adjust__command
833                     ;   error := target - low  
834 158 0831            movf clock_adjust__target,w
835 159 00b2            movwf clock_adjust__287byte0
836 15a 0830            movf clock_adjust__low,w
837 15b 0232            subwf clock_adjust__287byte0,w
838 15c 00ad            movwf clock_adjust__error
839                     ; else_if { low < target } body end
840                     ; if exp=` low < target ' generic
841             label284__0end:
842                     ; Other expression=`{ low < target }' delay=-1
843 15d 2965            goto label280__0end
844             label280__0true:
845                     ; if { low > target } body start
846                     ; Clock pulse is too long ; slave clock is too slow :
847                     ;   command := 0xf9  
848 15e 30f9            movlw 249
849 15f 00ab            movwf clock_adjust__command
850                     ;   error := low - target  
851 160 0830            movf clock_adjust__low,w
852 161 00b2            movwf clock_adjust__283byte0
853 162 0831            movf clock_adjust__target,w
854 163 0232            subwf clock_adjust__283byte0,w
855 164 00ad            movwf clock_adjust__error
856                     ; if { low > target } body end
857                     ; if exp=` low > target ' generic
858             label280__0end:
859                     ; Other expression=`{ low > target }' delay=-1
860                     ; if { low > target } end
861                     ; else body end
862 165 296a            goto label274__0end
863             label274__0true:
864                     ; else_if { high < iterations_high } body start
865                     ; Clock pulse is too short ; slave clock is too fast :
866                     ;   command := 0xf8  
867 166 30f8            movlw 248
868 167 00ab            movwf clock_adjust__command
869                     ;   error := target  
870 168 0831            movf clock_adjust__target,w
871 169 00ad            movwf clock_adjust__error
872                     ; else_if { high < iterations_high } body end
873                     ; if exp=` high < iterations_high ' generic
874             label274__0end:
875                     ; Other expression=`{ high < iterations_high }' delay=-1
876 16a 2972            goto label270__0end
877             label270__0true:
878                     ; if { high > iterations_high } body start
879                     ; Clock pulse is too long ; slave clock is too slow :
880                     ;   command := 0xf9  
881 16b 30f9            movlw 249
882 16c 00ab            movwf clock_adjust__command
883                     ;   error := 0xff - target  
884 16d 30ff            movlw 255
885 16e 00b2            movwf clock_adjust__273byte0
886 16f 0831            movf clock_adjust__target,w
887 170 0232            subwf clock_adjust__273byte0,w
888 171 00ad            movwf clock_adjust__error
889                     ; if { high > iterations_high } body end
890                     ; if exp=` high > iterations_high ' generic
891             label270__0end:
892                     ; Other expression=`{ high > iterations_high }' delay=-1
893                     ; if { high > iterations_high } end
894                     ; Print out the error and error minimum :
895                     ;   call master_send {{ 0c'E' }}  
896 172 3045            movlw 69
897 173 00d9            movwf master_send__character
898 174 2428            call master_send
899                     ;   call master_octal {{ error }}  
900 175 082d            movf clock_adjust__error,w
901 176 00ca            movwf master_octal__number
902 177 23a3            call master_octal
903                     ;   call master_send {{ 0c'M' }}  
904 178 304d            movlw 77
905 179 00d9            movwf master_send__character
906 17a 2428            call master_send
907                     ;   call master_octal {{ error_minimum }}  
908 17b 082e            movf clock_adjust__error_minimum,w
909 17c 00ca            movwf master_octal__number
910 17d 23a3            call master_octal
911                     ; if { error = error_minimum } start
912 17e 082d            movf clock_adjust__error,w
913 17f 022e            subwf clock_adjust__error_minimum,w
914                     ; expression=`{ error = error_minimum }' exp_delay=2 true_delay=-1  false_delay=-1 true_size=2 false_size=14
915 180 1d03            btfss z___byte,z___bit
916 181 2985            goto label302__0false
917             label302__0true:
918                     ; if { error = error_minimum } body start
919                     ;   call master_crlf {{ }}  
920 182 238b            call master_crlf
921                     ;   return  
922 183 3400            retlw 0
923                     ; if { error = error_minimum } body end
924 184 2993            goto label302__0end
925             label302__0false:
926 185 082e            movf clock_adjust__error_minimum,w
927 186 022d            subwf clock_adjust__error,w
928                     ; expression=`{ error < error_minimum }' exp_delay=2 true_delay=3  false_delay=-1 true_size=3 false_size=6
929 187 1c03            btfss c___byte,c___bit
930 188 2990            goto label305__0true
931             label305__0false:
932                     ; else body start
933                     ;   count := count - 1  
934 189 03ac            decf clock_adjust__count,f
935                     ; if { z } start
936                     ; expression=`{ z }' exp_delay=0 true_delay=3  false_delay=0 true_size=3 false_size=0
937 18a 1d03            btfss z__byte,z__bit
938 18b 298f            goto label310__0end
939                     ; if { z } body start
940                     ;   error_minimum := error_minimum + 1  
941 18c 0aae            incf clock_adjust__error_minimum,f
942                     ;   count := 2  
943 18d 3002            movlw 2
944 18e 00ac            movwf clock_adjust__count
945                     ; if { z } body end
946             label310__0end:
947                     ; if exp=`z' empty false
948                     ; Other expression=`{ z }' delay=-1
949                     ; if { z } end
950                     ; else body end
951 18f 2993            goto label305__0end
952             label305__0true:
953                     ; else_if { error < error_minimum } body start
954                     ;   error_minimum := error  
955 190 082d            movf clock_adjust__error,w
956 191 00ae            movwf clock_adjust__error_minimum
957                     ;   error := error + 1  
958 192 0aad            incf clock_adjust__error,f
959                     ; else_if { error < error_minimum } body end
960                     ; if exp=` error < error_minimum ' generic
961             label305__0end:
962                     ; Other expression=`{ error < error_minimum }' delay=-1
963                     ; if exp=` error = error_minimum ' generic
964             label302__0end:
965                     ; Other expression=`{ error = error_minimum }' delay=-1
966                     ; if { error = error_minimum } end
967                     ; Now adjust the clock :
968                     ;   call slave_send {{ command }}  
969 193 082b            movf clock_adjust__command,w
970 194 00d0            movwf slave_send__data
971 195 23e2            call slave_send
972                     ;   call master_crlf {{ }}  
973 196 238b            call master_crlf
974 197 291e            goto clock_adjust__242loop__forever
975                     ; loop_forever ... end
976                     ; procedure clock_adjust end
977             
978                     ; procedure test start
979             test:
980     0033    test__variables__base equ global__variables__bank0+19
981     0033    test__bytes__base equ test__variables__base+0
982     0040    test__bits__base equ test__variables__base+13
983     000d    test__total__bytes equ 13
984     003f    test__457byte0 equ test__bytes__base+12
985     003f    test__454byte0 equ test__bytes__base+12
986                     ;   arguments_none  
987                     ; This procedure will test the Motor2 RoboBrick :
988     0033    test__counter1 equ test__bytes__base+0
989     0034    test__counter2 equ test__bytes__base+1
990     0035    test__direction equ test__bytes__base+2
991     0036    test__failsafe equ test__bytes__base+3
992     0037    test__mode equ test__bytes__base+4
993     0038    test__motor equ test__bytes__base+5
994     0039    test__prescaler equ test__bytes__base+6
995     003a    test__ramp equ test__bytes__base+7
996     003b    test__ramp_index equ test__bytes__base+8
997     003c    test__speed_index equ test__bytes__base+9
998     003d    test__speed equ test__bytes__base+10
999     003e    test__temp equ test__bytes__base+11
1000                     ; Verify that the common commands are working :
1001                     ;   call common_test {{ }}  
1002 198 22ef            call common_test
1003                     ; Reset everything :
1004                     ;   call slave_send {{ 0xa4 }}  
1005 199 30a4            movlw 164
1006 19a 00d0            movwf slave_send__data
1007 19b 23e2            call slave_send
1008                     ; Test with prescaler :
1009                     ;   call master_string {{ scaler_string }}  
1010 19c 305f            movlw LOW scaler_string+1
1011 19d 00da            movwf master_string__message
1012 19e 242e            call master_string
1013                     ;   call master_crlf {{ }}  
1014 19f 238b            call master_crlf
1015                     ;   prescaler := 0  
1016 1a0 01b9            clrf test__prescaler
1017                     ; `while  prescaler <= 7  ...' start
1018             test__352while__continue:
1019 1a1 3008            movlw 8
1020 1a2 0239            subwf test__prescaler,w
1021                     ; expression=` prescaler <= 7 ' exp_delay=2 true_delay=1  false_delay=2 true_size=24 false_size=1
1022 1a3 1803            btfsc c___byte,c___bit
1023 1a4 29bc            goto test__352while__break
1024                     ; Set Prescaler :
1025                     ;   call slave_send {{ 0x90 | prescaler }}  
1026 1a5 3090            movlw 144
1027 1a6 0439            iorwf test__prescaler,w
1028 1a7 00d0            movwf slave_send__data
1029 1a8 23e2            call slave_send
1030                     ; Read prescaler :
1031                     ;   call slave_send {{ 0x99 }}  
1032 1a9 3099            movlw 153
1033 1aa 00d0            movwf slave_send__data
1034 1ab 23e2            call slave_send
1035                     ;   temp := slave_get {{ }}  
1036 1ac 23bc            call slave_get
1037 1ad 084c            movf slave_get__0return__byte,w
1038 1ae 00be            movwf test__temp
1039                     ; if { temp != prescaler } start
1040 1af 0239            subwf test__prescaler,w
1041                     ; expression=`{ temp != prescaler }' exp_delay=2 true_delay=4  false_delay=0 true_size=8 false_size=0
1042 1b0 1903            btfsc z___byte,z___bit
1043 1b1 29ba            goto label360__0end
1044                     ; if { temp != prescaler } body start
1045                     ;   call master_octal {{ temp }}  
1046 1b2 083e            movf test__temp,w
1047 1b3 00ca            movwf master_octal__number
1048 1b4 23a3            call master_octal
1049                     ;   call master_fail {{ scaler_string , 0x30 }}  
1050 1b5 305f            movlw LOW scaler_string+1
1051 1b6 00c7            movwf master_fail__test_name
1052 1b7 3030            movlw 48
1053 1b8 00c8            movwf master_fail__test_number
1054 1b9 2392            call master_fail
1055                     ; if { temp != prescaler } body end
1056             label360__0end:
1057                     ; if exp=` temp != prescaler ' empty false
1058                     ; Other expression=`{ temp != prescaler }' delay=-1
1059                     ; if { temp != prescaler } end
1060                     ;   prescaler := prescaler + 1  
1061 1ba 0ab9            incf test__prescaler,f
1062 1bb 29a1            goto test__352while__continue
1063                     ; if exp=` prescaler <= 7 ' false goto
1064                     ; Other expression=` prescaler <= 7 ' delay=-1
1065             test__352while__break:
1066                     ; `while  prescaler <= 7  ...' end
1067                     ; Reset the prescaler to 5 :
1068                     ;   call slave_send {{ 0x95 }}  
1069 1bc 3095            movlw 149
1070 1bd 00d0            movwf slave_send__data
1071 1be 23e2            call slave_send
1072                     ; Test failsafe :
1073                     ;   call master_string {{ failsafe_string }}  
1074 1bf 302e            movlw LOW failsafe_string+1
1075 1c0 00da            movwf master_string__message
1076 1c1 242e            call master_string
1077                     ;   call master_crlf {{ }}  
1078 1c2 238b            call master_crlf
1079                     ; Set failsafe :
1080                     ;   call slave_send {{ 0x82 }}  
1081 1c3 3082            movlw 130
1082 1c4 00d0            movwf slave_send__data
1083 1c5 23e2            call slave_send
1084                     ;   call slave_send {{ 0xff }}  
1085 1c6 30ff            movlw 255
1086 1c7 00d0            movwf slave_send__data
1087 1c8 23e2            call slave_send
1088                     ; Set speed :
1089                     ;   call slave_send {{ 0x3c }}  
1090 1c9 303c            movlw 60
1091 1ca 00d0            movwf slave_send__data
1092 1cb 23e2            call slave_send
1093                     ; Wait for failsafe to trigger :
1094                     ;   failsafe := 0xff  
1095 1cc 30ff            movlw 255
1096 1cd 00b6            movwf test__failsafe
1097                     ; `while  failsafe != 0  ...' start
1098             test__382while__continue:
1099 1ce 0836            movf test__failsafe,w
1100                     ; expression=` failsafe != 0 ' exp_delay=1 true_delay=4  false_delay=2 true_size=7 false_size=1
1101 1cf 1903            btfsc z___byte,z___bit
1102 1d0 29d8            goto test__382while__break
1103                     ;   call slave_send {{ 0xa1 }}  
1104 1d1 30a1            movlw 161
1105 1d2 00d0            movwf slave_send__data
1106 1d3 23e2            call slave_send
1107                     ;   failsafe := slave_get {{ }}  
1108 1d4 23bc            call slave_get
1109 1d5 084c            movf slave_get__0return__byte,w
1110 1d6 00b6            movwf test__failsafe
1111 1d7 29ce            goto test__382while__continue
1112                     ; if exp=` failsafe != 0 ' false goto
1113                     ; Other expression=` failsafe != 0 ' delay=-1
1114             test__382while__break:
1115                     ; `while  failsafe != 0  ...' end
1116                     ; Read failsafe error counter :
1117                     ;   call slave_send {{ 0xa0 }}  
1118 1d8 30a0            movlw 160
1119 1d9 00d0            movwf slave_send__data
1120 1da 23e2            call slave_send
1121                     ;   temp := slave_get {{ }}  
1122 1db 23bc            call slave_get
1123 1dc 084c            movf slave_get__0return__byte,w
1124 1dd 00be            movwf test__temp
1125                     ; if { temp != 1 } start
1126 1de 033e            decf test__temp,w
1127                     ; expression=`{ temp != 1 }' exp_delay=1 true_delay=4  false_delay=0 true_size=8 false_size=0
1128 1df 1903            btfsc z___byte,z___bit
1129 1e0 29e9            goto label390__0end
1130                     ; if { temp != 1 } body start
1131                     ;   call master_octal {{ temp }}  
1132 1e1 083e            movf test__temp,w
1133 1e2 00ca            movwf master_octal__number
1134 1e3 23a3            call master_octal
1135                     ;   call master_fail {{ failsafe_string , 0x37 }}  
1136 1e4 302e            movlw LOW failsafe_string+1
1137 1e5 00c7            movwf master_fail__test_name
1138 1e6 3037            movlw 55
1139 1e7 00c8            movwf master_fail__test_number
1140 1e8 2392            call master_fail
1141                     ; if { temp != 1 } body end
1142             label390__0end:
1143                     ; if exp=` temp != 1 ' empty false
1144                     ; Other expression=`{ temp != 1 }' delay=-1
1145                     ; if { temp != 1 } end
1146                     ; Verify that failsafe error counter reset :
1147                     ;   call slave_send {{ 0xa0 }}  
1148 1e9 30a0            movlw 160
1149 1ea 00d0            movwf slave_send__data
1150 1eb 23e2            call slave_send
1151                     ;   temp := slave_get {{ }}  
1152 1ec 23bc            call slave_get
1153 1ed 084c            movf slave_get__0return__byte,w
1154 1ee 00be            movwf test__temp
1155                     ; if { temp != 0 } start
1156                     ; expression=`{ temp != 0 }' exp_delay=1 true_delay=4  false_delay=0 true_size=8 false_size=0
1157 1ef 1903            btfsc z___byte,z___bit
1158 1f0 29f9            goto label398__0end
1159                     ; if { temp != 0 } body start
1160                     ;   call master_octal {{ temp }}  
1161 1f1 083e            movf test__temp,w
1162 1f2 00ca            movwf master_octal__number
1163 1f3 23a3            call master_octal
1164                     ;   call master_fail {{ failsafe_string , 0x38 }}  
1165 1f4 302e            movlw LOW failsafe_string+1
1166 1f5 00c7            movwf master_fail__test_name
1167 1f6 3038            movlw 56
1168 1f7 00c8            movwf master_fail__test_number
1169 1f8 2392            call master_fail
1170                     ; if { temp != 0 } body end
1171             label398__0end:
1172                     ; if exp=` temp != 0 ' empty false
1173                     ; Other expression=`{ temp != 0 }' delay=-1
1174                     ; if { temp != 0 } end
1175                     ; Reset everything :
1176                     ;   call slave_send {{ 0xa4 }}  
1177 1f9 30a4            movlw 164
1178 1fa 00d0            movwf slave_send__data
1179 1fb 23e2            call slave_send
1180                     ; Do some ramp testing :
1181                     ;   ramp_index := 0  
1182 1fc 01bb            clrf test__ramp_index
1183                     ; `while  ramp_index < ramps . size  ...' start
1184             test__408while__continue:
1185 1fd 3005            movlw 5
1186 1fe 023b            subwf test__ramp_index,w
1187                     ; expression=` ramp_index < ramps . size ' exp_delay=2 true_delay=1  false_delay=2 true_size=232 false_size=1
1188 1ff 1803            btfsc c___byte,c___bit
1189 200 2ae7            goto test__408while__break
1190                     ; call master_send < 0c'R' >
1191                     ;   ramp := ramps ~~ {{ ramp_index }}  
1192 201 0a3b            incf test__ramp_index,w
1193 202 018a            clrf pclath___register
1194 203 2051            call ramps
1195 204 00ba            movwf test__ramp
1196                     ;   mode := 0  
1197 205 01b7            clrf test__mode
1198                     ; `while  mode < 2  ...' start
1199             test__412while__continue:
1200 206 3002            movlw 2
1201 207 0237            subwf test__mode,w
1202                     ; expression=` mode < 2 ' exp_delay=2 true_delay=1  false_delay=2 true_size=221 false_size=1
1203 208 1803            btfsc c___byte,c___bit
1204 209 2ae5            goto test__412while__break
1205                     ; call master_send < 0c'M' >
1206                     ;   direction := 0  
1207 20a 01b5            clrf test__direction
1208                     ; `while  direction < 2  ...' start
1209             test__415while__continue:
1210 20b 3002            movlw 2
1211 20c 0235            subwf test__direction,w
1212                     ; expression=` direction < 2 ' exp_delay=2 true_delay=1  false_delay=2 true_size=214 false_size=1
1213 20d 1803            btfsc c___byte,c___bit
1214 20e 2ae3            goto test__415while__break
1215                     ; call master_send < 0c'D' >
1216                     ;   motor := 0  
1217 20f 01b8            clrf test__motor
1218                     ; `while  motor < 2  ...' start
1219             test__418while__continue:
1220 210 3002            movlw 2
1221 211 0238            subwf test__motor,w
1222                     ; expression=` motor < 2 ' exp_delay=2 true_delay=1  false_delay=2 true_size=207 false_size=1
1223 212 1803            btfsc c___byte,c___bit
1224 213 2ae1            goto test__418while__break
1225                     ; call master_send < 0c'S' >
1226                     ;   call master_string {{ ramp_string }}  
1227 214 3059            movlw LOW ramp_string+1
1228 215 00da            movwf master_string__message
1229 216 242e            call master_string
1230                     ;   call master_octal {{ ramp }}  
1231 217 083a            movf test__ramp,w
1232 218 00ca            movwf master_octal__number
1233 219 23a3            call master_octal
1234                     ;   call master_string {{ mode_string }}  
1235 21a 3040            movlw LOW mode_string+1
1236 21b 00da            movwf master_string__message
1237 21c 242e            call master_string
1238                     ;   call master_octal {{ mode }}  
1239 21d 0837            movf test__mode,w
1240 21e 00ca            movwf master_octal__number
1241 21f 23a3            call master_octal
1242                     ;   call master_string {{ direction_string }}  
1243 220 301d            movlw LOW direction_string+1
1244 221 00da            movwf master_string__message
1245 222 242e            call master_string
1246                     ;   call master_octal {{ direction }}  
1247 223 0835            movf test__direction,w
1248 224 00ca            movwf master_octal__number
1249 225 23a3            call master_octal
1250                     ;   call master_string {{ motor_string }}  
1251 226 304b            movlw LOW motor_string+1
1252 227 00da            movwf master_string__message
1253 228 242e            call master_string
1254                     ;   call master_octal {{ motor }}  
1255 229 0838            movf test__motor,w
1256 22a 00ca            movwf master_octal__number
1257 22b 23a3            call master_octal
1258                     ;   call master_crlf {{ }}  
1259 22c 238b            call master_crlf
1260                     ; Set the mode :
1261                     ;   call slave_send {{ 0x88 | {{ mode << 1 }} | motor }}  
1262 22d 1003            bcf c___byte,c___bit
1263 22e 0d37            rlf test__mode,w
1264 22f 0438            iorwf test__motor,w
1265 230 3888            iorlw 136
1266 231 00d0            movwf slave_send__data
1267 232 23e2            call slave_send
1268                     ; Set the ramp :
1269                     ;   call slave_send {{ 0x80 | motor }}  
1270 233 3080            movlw 128
1271 234 0438            iorwf test__motor,w
1272 235 00d0            movwf slave_send__data
1273 236 23e2            call slave_send
1274                     ;   call slave_send {{ ramp }}  
1275 237 083a            movf test__ramp,w
1276 238 00d0            movwf slave_send__data
1277 239 23e2            call slave_send
1278                     ; Verify the ramp :
1279                     ;   call slave_send {{ 0x9e | motor }}  
1280 23a 309e            movlw 158
1281 23b 0438            iorwf test__motor,w
1282 23c 00d0            movwf slave_send__data
1283 23d 23e2            call slave_send
1284                     ;   temp := slave_get {{ }}  
1285 23e 23bc            call slave_get
1286 23f 084c            movf slave_get__0return__byte,w
1287 240 00be            movwf test__temp
1288                     ; if { temp != ramp } start
1289 241 023a            subwf test__ramp,w
1290                     ; expression=`{ temp != ramp }' exp_delay=2 true_delay=4  false_delay=0 true_size=8 false_size=0
1291 242 1903            btfsc z___byte,z___bit
1292 243 2a4c            goto label440__0end
1293                     ; if { temp != ramp } body start
1294                     ;   call master_octal {{ temp }}  
1295 244 083e            movf test__temp,w
1296 245 00ca            movwf master_octal__number
1297 246 23a3            call master_octal
1298                     ;   call master_fail {{ ramp_string , 0x31 }}  
1299 247 3059            movlw LOW ramp_string+1
1300 248 00c7            movwf master_fail__test_name
1301 249 3031            movlw 49
1302 24a 00c8            movwf master_fail__test_number
1303 24b 2392            call master_fail
1304                     ; if { temp != ramp } body end
1305             label440__0end:
1306                     ; if exp=` temp != ramp ' empty false
1307                     ; Other expression=`{ temp != ramp }' delay=-1
1308                     ; if { temp != ramp } end
1309                     ; Do a complete speed check when the ramp is zero :
1310                     ; if { ramp = 0 } start
1311 24c 083a            movf test__ramp,w
1312                     ; expression=`{ ramp = 0 }' exp_delay=1 true_delay=-1  false_delay=-1 true_size=88 false_size=56
1313 24d 1d03            btfss z___byte,z___bit
1314 24e 2aa7            goto label446__0false
1315             label446__0true:
1316                     ; if { ramp = 0 } body start
1317                     ; Ramp motor up through speeds :
1318                     ;   speed := 0  
1319 24f 01bd            clrf test__speed
1320                     ; `while  speed < 255  ...' start
1321             test__449while__continue:
1322 250 30ff            movlw 255
1323 251 023d            subwf test__speed,w
1324                     ; expression=` speed < 255 ' exp_delay=2 true_delay=1  false_delay=2 true_size=47 false_size=1
1325 252 1803            btfsc c___byte,c___bit
1326 253 2a82            goto test__449while__break
1327                     ; Set speed :
1328                     ;   temp := {{ direction << 1 }} | motor  
1329 254 1003            bcf c___byte,c___bit
1330 255 0d35            rlf test__direction,w
1331 256 0438            iorwf test__motor,w
1332 257 00be            movwf test__temp
1333                     ; if { speed & 0xf = 0 } start
1334 258 300f            movlw 15
1335 259 053d            andwf test__speed,w
1336                     ; expression=`{ speed & 0xf = 0 }' exp_delay=2 true_delay=3  false_delay=5 true_size=5 false_size=7
1337 25a 1d03            btfss z___byte,z___bit
1338 25b 2a62            goto label452__0false
1339             label452__0true:
1340                     ; if { speed & 0xf = 0 } body start
1341                     ; Set high :
1342                     ;   call slave_send {{ {{ speed >> 2 }} | temp }}  
1343 25c 0c3d            rrf test__speed,w
1344 25d 00bf            movwf test__454byte0
1345 25e 0c3f            rrf test__454byte0,w
1346 25f 393f            andlw 63
1347 260 043e            iorwf test__temp,w
1348                     ; 2 instructions found for sharing
1349 261 2a68            goto label452__0end
1350             label452__0false:
1351                     ; else body start
1352                     ; Set low :
1353                     ;   call slave_send {{ 0x40 | {{ speed << 2 }} & 0x3c | temp }}  
1354 262 0d3d            rlf test__speed,w
1355 263 00bf            movwf test__457byte0
1356 264 0d3f            rlf test__457byte0,w
1357 265 393c            andlw 60
1358 266 043e            iorwf test__temp,w
1359 267 3840            iorlw 64
1360                     ; 2 instructions found for sharing
1361                     ; if exp=` speed & 0xf = 0 ' generic
1362             label452__0end:
1363                     ; Other expression=`{ speed & 0xf = 0 }' delay=-1
1364                     ; 2 shared instructions follow
1365 268 00d0            movwf slave_send__data
1366 269 23e2            call slave_send
1367                     ; if { speed & 0xf = 0 } end
1368                     ; Read and verify speed :
1369                     ;   call slave_send {{ 0x9a | motor }}  
1370 26a 309a            movlw 154
1371 26b 0438            iorwf test__motor,w
1372 26c 00d0            movwf slave_send__data
1373 26d 23e2            call slave_send
1374                     ;   temp := slave_get {{ }}  
1375 26e 23bc            call slave_get
1376 26f 084c            movf slave_get__0return__byte,w
1377 270 00be            movwf test__temp
1378                     ; if { speed != temp } start
1379 271 083d            movf test__speed,w
1380 272 023e            subwf test__temp,w
1381                     ; expression=`{ speed != temp }' exp_delay=2 true_delay=5  false_delay=0 true_size=11 false_size=0
1382 273 1903            btfsc z___byte,z___bit
1383 274 2a80            goto label463__0end
1384                     ; if { speed != temp } body start
1385                     ;   call master_octal {{ speed }}  
1386 275 083d            movf test__speed,w
1387 276 00ca            movwf master_octal__number
1388 277 23a3            call master_octal
1389                     ;   call master_octal {{ temp }}  
1390 278 083e            movf test__temp,w
1391 279 00ca            movwf master_octal__number
1392 27a 23a3            call master_octal
1393                     ;   call master_fail {{ speed_string , 0x32 }}  
1394 27b 306f            movlw LOW speed_string+1
1395 27c 00c7            movwf master_fail__test_name
1396 27d 3032            movlw 50
1397 27e 00c8            movwf master_fail__test_number
1398 27f 2392            call master_fail
1399                     ; if { speed != temp } body end
1400             label463__0end:
1401                     ; if exp=` speed != temp ' empty false
1402                     ; Other expression=`{ speed != temp }' delay=-1
1403                     ; if { speed != temp } end
1404                     ;   speed := speed + 1  
1405 280 0abd            incf test__speed,f
1406 281 2a50            goto test__449while__continue
1407                     ; if exp=` speed < 255 ' false goto
1408                     ; Other expression=` speed < 255 ' delay=-1
1409             test__449while__break:
1410                     ; `while  speed < 255  ...' end
1411                     ; Ramp motor down through speeds :
1412                     ; `while  speed != 0  ...' start
1413             test__472while__continue:
1414 282 083d            movf test__speed,w
1415                     ; expression=` speed != 0 ' exp_delay=1 true_delay=1  false_delay=2 true_size=33 false_size=1
1416 283 1903            btfsc z___byte,z___bit
1417 284 2aa6            goto test__472while__break
1418                     ; Set speed :
1419                     ;   call slave_send {{ 0x84 | {{ direction << 1 }} | motor }}  
1420 285 1003            bcf c___byte,c___bit
1421 286 0d35            rlf test__direction,w
1422 287 0438            iorwf test__motor,w
1423 288 3884            iorlw 132
1424 289 00d0            movwf slave_send__data
1425 28a 23e2            call slave_send
1426                     ;   call slave_send {{ speed }}  
1427 28b 083d            movf test__speed,w
1428 28c 00d0            movwf slave_send__data
1429 28d 23e2            call slave_send
1430                     ; Read and verify speed :
1431                     ;   call slave_send {{ 0x9a | motor }}  
1432 28e 309a            movlw 154
1433 28f 0438            iorwf test__motor,w
1434 290 00d0            movwf slave_send__data
1435 291 23e2            call slave_send
1436                     ;   temp := slave_get {{ }}  
1437 292 23bc            call slave_get
1438 293 084c            movf slave_get__0return__byte,w
1439 294 00be            movwf test__temp
1440                     ; if { speed != temp } start
1441 295 083d            movf test__speed,w
1442 296 023e            subwf test__temp,w
1443                     ; expression=`{ speed != temp }' exp_delay=2 true_delay=5  false_delay=0 true_size=11 false_size=0
1444 297 1903            btfsc z___byte,z___bit
1445 298 2aa4            goto label480__0end
1446                     ; if { speed != temp } body start
1447                     ;   call master_octal {{ speed }}  
1448 299 083d            movf test__speed,w
1449 29a 00ca            movwf master_octal__number
1450 29b 23a3            call master_octal
1451                     ;   call master_octal {{ temp }}  
1452 29c 083e            movf test__temp,w
1453 29d 00ca            movwf master_octal__number
1454 29e 23a3            call master_octal
1455                     ;   call master_fail {{ speed_string , 0x33 }}  
1456 29f 306f            movlw LOW speed_string+1
1457 2a0 00c7            movwf master_fail__test_name
1458 2a1 3033            movlw 51
1459 2a2 00c8            movwf master_fail__test_number
1460 2a3 2392            call master_fail
1461                     ; if { speed != temp } body end
1462             label480__0end:
1463                     ; if exp=` speed != temp ' empty false
1464                     ; Other expression=`{ speed != temp }' delay=-1
1465                     ; if { speed != temp } end
1466                     ;   speed := speed - 1  
1467 2a4 03bd            decf test__speed,f
1468 2a5 2a82            goto test__472while__continue
1469                     ; if exp=` speed != 0 ' false goto
1470                     ; Other expression=` speed != 0 ' delay=-1
1471             test__472while__break:
1472                     ; `while  speed != 0  ...' end
1473                     ; if { ramp = 0 } body end
1474 2a6 2adf            goto label446__0end
1475             label446__0false:
1476                     ; else body start
1477                     ; Do ramp testing :
1478                     ;   speed_index := 0  
1479 2a7 01bc            clrf test__speed_index
1480                     ; `while  speed_index < speeds . size  ...' start
1481             test__490while__continue:
1482 2a8 3006            movlw 6
1483 2a9 023c            subwf test__speed_index,w
1484                     ; expression=` speed_index < speeds . size ' exp_delay=2 true_delay=1  false_delay=2 true_size=51 false_size=1
1485 2aa 1803            btfsc c___byte,c___bit
1486 2ab 2adf            goto test__490while__break
1487                     ; call master_send < 0c'S' >
1488                     ; Set the speed :
1489                     ;   speed := speeds ~~ {{ speed_index }}  
1490 2ac 0a3c            incf test__speed_index,w
1491 2ad 018a            clrf pclath___register
1492 2ae 2066            call speeds
1493 2af 00bd            movwf test__speed
1494                     ;   call slave_send {{ 0x84 | {{ direction << 1 }} | motor }}  
1495 2b0 1003            bcf c___byte,c___bit
1496 2b1 0d35            rlf test__direction,w
1497 2b2 0438            iorwf test__motor,w
1498 2b3 3884            iorlw 132
1499 2b4 00d0            movwf slave_send__data
1500 2b5 23e2            call slave_send
1501                     ;   call slave_send {{ speed }}  
1502 2b6 083d            movf test__speed,w
1503 2b7 00d0            movwf slave_send__data
1504 2b8 23e2            call slave_send
1505                     ; Now wait for the speed to ramp up :
1506                     ;   temp := speed - 1  
1507 2b9 033d            decf test__speed,w
1508 2ba 00be            movwf test__temp
1509                     ; `count_down counter1 8 ...' start
1510 2bb 3008            movlw 8
1511 2bc 00b3            movwf test__counter1
1512             test__499_loop:
1513                     ; `count_down counter2 255 ...' start
1514 2bd 30ff            movlw 255
1515 2be 00b4            movwf test__counter2
1516             test__500_loop:
1517                     ; Read actual speed :
1518                     ; if { temp != speed } start
1519 2bf 083e            movf test__temp,w
1520 2c0 023d            subwf test__speed,w
1521                     ; expression=`{ temp != speed }' exp_delay=2 true_delay=3  false_delay=0 true_size=7 false_size=0
1522 2c1 1903            btfsc z___byte,z___bit
1523 2c2 2aca            goto label502__0end
1524                     ; if { temp != speed } body start
1525                     ;   call slave_send {{ 0xa2 | motor }}  
1526 2c3 30a2            movlw 162
1527 2c4 0438            iorwf test__motor,w
1528 2c5 00d0            movwf slave_send__data
1529 2c6 23e2            call slave_send
1530                     ;   temp := slave_get {{ }}  
1531 2c7 23bc            call slave_get
1532 2c8 084c            movf slave_get__0return__byte,w
1533 2c9 00be            movwf test__temp
1534                     ; if { temp != speed } body end
1535             label502__0end:
1536                     ; if exp=` temp != speed ' empty false
1537                     ; Other expression=`{ temp != speed }' delay=-1
1538                     ; if { temp != speed } end
1539 2ca 0bb4            decfsz test__counter2,f
1540 2cb 2abf            goto test__500_loop
1541             test__500_done:
1542                     ; `count_down counter2 255 ...' end
1543 2cc 0bb3            decfsz test__counter1,f
1544 2cd 2abd            goto test__499_loop
1545             test__499_done:
1546                     ; `count_down counter1 8 ...' end
1547                     ; See whether we timed out :
1548                     ; if { temp != speed } start
1549 2ce 083e            movf test__temp,w
1550 2cf 023d            subwf test__speed,w
1551                     ; expression=`{ temp != speed }' exp_delay=2 true_delay=5  false_delay=0 true_size=11 false_size=0
1552 2d0 1903            btfsc z___byte,z___bit
1553 2d1 2add            goto label510__0end
1554                     ; if { temp != speed } body start
1555                     ;   call master_octal {{ temp }}  
1556 2d2 083e            movf test__temp,w
1557 2d3 00ca            movwf master_octal__number
1558 2d4 23a3            call master_octal
1559                     ;   call master_octal {{ speed }}  
1560 2d5 083d            movf test__speed,w
1561 2d6 00ca            movwf master_octal__number
1562 2d7 23a3            call master_octal
1563                     ;   call master_fail {{ ramp_string , 0x34 }}  
1564 2d8 3059            movlw LOW ramp_string+1
1565 2d9 00c7            movwf master_fail__test_name
1566 2da 3034            movlw 52
1567 2db 00c8            movwf master_fail__test_number
1568 2dc 2392            call master_fail
1569                     ; if { temp != speed } body end
1570             label510__0end:
1571                     ; if exp=` temp != speed ' empty false
1572                     ; Other expression=`{ temp != speed }' delay=-1
1573                     ; if { temp != speed } end
1574                     ;   speed_index := speed_index + 1  
1575 2dd 0abc            incf test__speed_index,f
1576 2de 2aa8            goto test__490while__continue
1577                     ; if exp=` speed_index < speeds . size ' false goto
1578                     ; Other expression=` speed_index < speeds . size ' delay=-1
1579             test__490while__break:
1580                     ; `while  speed_index < speeds . size  ...' end
1581                     ; else body end
1582                     ; if exp=` ramp = 0 ' generic
1583             label446__0end:
1584                     ; Other expression=`{ ramp = 0 }' delay=-1
1585                     ; if { ramp = 0 } end
1586                     ;   motor := motor + 1  
1587 2df 0ab8            incf test__motor,f
1588 2e0 2a10            goto test__418while__continue
1589                     ; if exp=` motor < 2 ' false goto
1590                     ; Other expression=` motor < 2 ' delay=-1
1591             test__418while__break:
1592                     ; `while  motor < 2  ...' end
1593                     ;   direction := direction + 1  
1594 2e1 0ab5            incf test__direction,f
1595 2e2 2a0b            goto test__415while__continue
1596                     ; if exp=` direction < 2 ' false goto
1597                     ; Other expression=` direction < 2 ' delay=-1
1598             test__415while__break:
1599                     ; `while  direction < 2  ...' end
1600                     ;   mode := mode + 1  
1601 2e3 0ab7            incf test__mode,f
1602 2e4 2a06            goto test__412while__continue
1603                     ; if exp=` mode < 2 ' false goto
1604                     ; Other expression=` mode < 2 ' delay=-1
1605             test__412while__break:
1606                     ; `while  mode < 2  ...' end
1607                     ;   ramp_index := ramp_index + 1  
1608 2e5 0abb            incf test__ramp_index,f
1609 2e6 29fd            goto test__408while__continue
1610                     ; if exp=` ramp_index < ramps . size ' false goto
1611                     ; Other expression=` ramp_index < ramps . size ' delay=-1
1612             test__408while__break:
1613                     ; `while  ramp_index < ramps . size  ...' end
1614                     ; Reset everything :
1615                     ;   call slave_send {{ 0xa4 }}  
1616 2e7 30a4            movlw 164
1617 2e8 00d0            movwf slave_send__data
1618 2e9 23e2            call slave_send
1619                     ; Announce end of test run :
1620                     ;   call master_string {{ done_string }}  
1621 2ea 3022            movlw LOW done_string+1
1622 2eb 00da            movwf master_string__message
1623 2ec 242e            call master_string
1624                     ;   call master_crlf {{ }}  
1625 2ed 238b            call master_crlf
1626                     ; procedure test end
1627 2ee 3400            retlw 0
1628                     ; comment {The procedures below are used to test the common shared commands :}
1629             
1630                     ; procedure common_test start
1631             common_test:
1632     0040    common_test__variables__base equ global__variables__bank0+32
1633     0040    common_test__bytes__base equ common_test__variables__base+0
1634     0042    common_test__bits__base equ common_test__variables__base+2
1635     0002    common_test__total__bytes equ 2
1636     0041    common_test__580byte0 equ common_test__bytes__base+1
1637                     ;   arguments_none  
1638                     ; This procedure will verify that the common shared commands work .
1639     0040    common_test__actual equ common_test__bytes__base+0
1640                     ; Print the ID information :
1641                     ; ID reset :
1642                     ;   call slave_send {{ 0xfd }}  
1643 2ef 30fd            movlw 253
1644 2f0 00d0            movwf slave_send__data
1645 2f1 23e2            call slave_send
1646                     ; Read the fixed bytes :
1647                     ;   call common_test_id_match {{ 1 , 0xc0 }}  
1648 2f2 3001            movlw 1
1649 2f3 00c2            movwf common_test_id_match__desired
1650 2f4 30c0            movlw 192
1651 2f5 00c3            movwf common_test_id_match__test_number
1652 2f6 2364            call common_test_id_match
1653                     ;   call common_test_id_match {{ 0 , 0xc1 }}  
1654 2f7 01c2            clrf common_test_id_match__desired
1655 2f8 30c1            movlw 193
1656 2f9 00c3            movwf common_test_id_match__test_number
1657 2fa 2364            call common_test_id_match
1658                     ;   call common_test_id_match {{ 14 , 0xc2 }}  
1659 2fb 300e            movlw 14
1660 2fc 00c2            movwf common_test_id_match__desired
1661 2fd 30c2            movlw 194
1662 2fe 00c3            movwf common_test_id_match__test_number
1663 2ff 2364            call common_test_id_match
1664                     ;   call common_test_id_match {{ 0 , 0xc3 }}  
1665 300 01c2            clrf common_test_id_match__desired
1666 301 30c3            movlw 195
1667 302 00c3            movwf common_test_id_match__test_number
1668 303 2364            call common_test_id_match
1669                     ;   call common_test_id_match {{ 0 , 0xc4 }}  
1670 304 01c2            clrf common_test_id_match__desired
1671 305 30c4            movlw 196
1672 306 00c3            movwf common_test_id_match__test_number
1673 307 2364            call common_test_id_match
1674                     ;   call common_test_id_match {{ 0 , 0xc5 }}  
1675 308 01c2            clrf common_test_id_match__desired
1676 309 30c5            movlw 197
1677 30a 00c3            movwf common_test_id_match__test_number
1678 30b 2364            call common_test_id_match
1679                     ;   call common_test_id_match {{ 0 , 0xc6 }}  
1680 30c 01c2            clrf common_test_id_match__desired
1681 30d 30c6            movlw 198
1682 30e 00c3            movwf common_test_id_match__test_number
1683 30f 2364            call common_test_id_match
1684                     ;   call common_test_id_match {{ 0 , 0xc7 }}  
1685 310 01c2            clrf common_test_id_match__desired
1686 311 30c7            movlw 199
1687 312 00c3            movwf common_test_id_match__test_number
1688 313 2364            call common_test_id_match
1689                     ;   call master_crlf {{ }}  
1690 314 238b            call master_crlf
1691                     ;   call common_test_id_bytes8 {{ }}  
1692 315 236f            call common_test_id_bytes8
1693                     ;   call common_test_id_bytes8 {{ }}  
1694 316 236f            call common_test_id_bytes8
1695                     ; Read the brick name :
1696                     ;   call common_test_id_string {{ }}  
1697 317 2379            call common_test_id_string
1698                     ; Read the vendor name :
1699                     ;   call common_test_id_string {{ }}  
1700 318 2379            call common_test_id_string
1701                     ; Verfify that we don ' t read off the end of the id and crash :
1702                     ;   call common_test_id_next {{ }}  
1703 319 2384            call common_test_id_next
1704 31a 0846            movf common_test_id_next__0return__byte,w
1705                     ; Reset id :
1706                     ;   call slave_send {{ 0xfd }}  
1707 31b 30fd            movlw 253
1708 31c 00d0            movwf slave_send__data
1709 31d 23e2            call slave_send
1710                     ; Verify that we are still alive :
1711                     ;   call common_test_id_match {{ 1 , 0xc8 }}  
1712 31e 3001            movlw 1
1713 31f 00c2            movwf common_test_id_match__desired
1714 320 30c8            movlw 200
1715 321 00c3            movwf common_test_id_match__test_number
1716 322 2364            call common_test_id_match
1717                     ; Read glitch :
1718                     ; Clear glitch register :
1719                     ;   call slave_send {{ 0xfe }}  
1720 323 30fe            movlw 254
1721 324 00d0            movwf slave_send__data
1722 325 23e2            call slave_send
1723                     ;   actual := slave_get {{ }}  
1724 326 23bc            call slave_get
1725 327 084c            movf slave_get__0return__byte,w
1726 328 00c0            movwf common_test__actual
1727                     ; Send a couple of glitches :
1728                     ;   call slave_send {{ 0xff }}  
1729 329 30ff            movlw 255
1730 32a 00d0            movwf slave_send__data
1731 32b 23e2            call slave_send
1732                     ;   call slave_send {{ 0xff }}  
1733 32c 30ff            movlw 255
1734 32d 00d0            movwf slave_send__data
1735 32e 23e2            call slave_send
1736                     ; Read the glitch register :
1737                     ;   call slave_send {{ 0xfe }}  
1738 32f 30fe            movlw 254
1739 330 00d0            movwf slave_send__data
1740 331 23e2            call slave_send
1741                     ; if { slave_get {{ }} != 2 } start
1742 332 23bc            call slave_get
1743 333 084c            movf slave_get__0return__byte,w
1744 334 00c1            movwf common_test__580byte0
1745 335 3002            movlw 2
1746 336 0241            subwf common_test__580byte0,w
1747                     ; expression=`{ slave_get {{ }} != 2 }' exp_delay=3 true_delay=3  false_delay=0 true_size=5 false_size=0
1748 337 1903            btfsc z___byte,z___bit
1749 338 2b3e            goto label580__1end
1750                     ; if { slave_get {{ }} != 2 } body start
1751                     ;   call master_fail {{ common_string , 0xc9 }}  
1752 339 3015            movlw LOW common_string+1
1753 33a 00c7            movwf master_fail__test_name
1754 33b 30c9            movlw 201
1755 33c 00c8            movwf master_fail__test_number
1756 33d 2392            call master_fail
1757                     ; if { slave_get {{ }} != 2 } body end
1758             label580__1end:
1759                     ; if exp=` slave_get ## {{ }} != 2 ' empty false
1760                     ; Other expression=`{ slave_get {{ }} != 2 }' delay=-1
1761                     ; if { slave_get {{ }} != 2 } end
1762                     ; Do a clock pulse :
1763                     ;   call slave_send {{ 0xfb }}  
1764 33e 30fb            movlw 251
1765 33f 00d0            movwf slave_send__data
1766 340 23e2            call slave_send
1767                     ; if { slave_get {{ }} != 0 } start
1768 341 23bc            call slave_get
1769 342 084c            movf slave_get__0return__byte,w
1770                     ; expression=`{ slave_get {{ }} != 0 }' exp_delay=0 true_delay=3  false_delay=0 true_size=5 false_size=0
1771 343 1903            btfsc z___byte,z___bit
1772 344 2b4a            goto label586__0end
1773                     ; if { slave_get {{ }} != 0 } body start
1774                     ;   call master_fail {{ common_string , 0xca }}  
1775 345 3015            movlw LOW common_string+1
1776 346 00c7            movwf master_fail__test_name
1777 347 30ca            movlw 202
1778 348 00c8            movwf master_fail__test_number
1779 349 2392            call master_fail
1780                     ; if { slave_get {{ }} != 0 } body end
1781             label586__0end:
1782                     ; if exp=` slave_get ## {{ }} != 0 ' empty false
1783                     ; Other expression=`{ slave_get {{ }} != 0 }' delay=-1
1784                     ; if { slave_get {{ }} != 0 } end
1785                     ; Read clock :
1786                     ;   call slave_send {{ 0xfa }}  
1787 34a 30fa            movlw 250
1788 34b 00d0            movwf slave_send__data
1789 34c 23e2            call slave_send
1790                     ;   actual := slave_get {{ }}  
1791 34d 23bc            call slave_get
1792 34e 084c            movf slave_get__0return__byte,w
1793 34f 00c0            movwf common_test__actual
1794                     ; Increment :
1795                     ;   call slave_send {{ 0xf9 }}  
1796 350 30f9            movlw 249
1797 351 00d0            movwf slave_send__data
1798 352 23e2            call slave_send
1799                     ; Decrement :
1800                     ;   call slave_send {{ 0xf8 }}  
1801 353 30f8            movlw 248
1802 354 00d0            movwf slave_send__data
1803 355 23e2            call slave_send
1804                     ; Read clock again :
1805                     ;   call slave_send {{ 0xfa }}  
1806 356 30fa            movlw 250
1807 357 00d0            movwf slave_send__data
1808 358 23e2            call slave_send
1809                     ; if { actual != slave_get {{ }} } start
1810 359 23bc            call slave_get
1811 35a 084c            movf slave_get__0return__byte,w
1812 35b 0240            subwf common_test__actual,w
1813                     ; expression=`{ actual != slave_get {{ }} }' exp_delay=1 true_delay=3  false_delay=0 true_size=5 false_size=0
1814 35c 1903            btfsc z___byte,z___bit
1815 35d 2b63            goto label598__0end
1816                     ; if { actual != slave_get {{ }} } body start
1817                     ;   call master_fail {{ common_string , 0xcb }}  
1818 35e 3015            movlw LOW common_string+1
1819 35f 00c7            movwf master_fail__test_name
1820 360 30cb            movlw 203
1821 361 00c8            movwf master_fail__test_number
1822 362 2392            call master_fail
1823                     ; if { actual != slave_get {{ }} } body end
1824             label598__0end:
1825                     ; if exp=` actual != slave_get ## {{ }} ' empty false
1826                     ; Other expression=`{ actual != slave_get {{ }} }' delay=-1
1827                     ; if { actual != slave_get {{ }} } end
1828                     ; procedure common_test end
1829 363 3400            retlw 0
1830             
1831                     ; procedure common_test_id_match start
1832             common_test_id_match:
1833     0042    common_test_id_match__variables__base equ global__variables__bank0+34
1834     0042    common_test_id_match__bytes__base equ common_test_id_match__variables__base+0
1835     0044    common_test_id_match__bits__base equ common_test_id_match__variables__base+2
1836     0002    common_test_id_match__total__bytes equ 2
1837     0042    common_test_id_match__desired equ common_test_id_match__bytes__base+0
1838     0043    common_test_id_match__test_number equ common_test_id_match__bytes__base+1
1839                     ; This procedure will verify that the next byte in the id is < desired > .
1840                     ; if { desired != common_test_id_next {{ }} } start
1841 364 2384            call common_test_id_next
1842 365 0846            movf common_test_id_next__0return__byte,w
1843 366 0242            subwf common_test_id_match__desired,w
1844                     ; expression=`{ desired != common_test_id_next {{ }} }' exp_delay=1 true_delay=3  false_delay=0 true_size=5 false_size=0
1845 367 1903            btfsc z___byte,z___bit
1846 368 2b6e            goto label610__0end
1847                     ; if { desired != common_test_id_next {{ }} } body start
1848                     ;   call master_fail {{ common_string , test_number }}  
1849 369 3015            movlw LOW common_string+1
1850 36a 00c7            movwf master_fail__test_name
1851 36b 0843            movf common_test_id_match__test_number,w
1852 36c 00c8            movwf master_fail__test_number
1853 36d 2392            call master_fail
1854                     ; if { desired != common_test_id_next {{ }} } body end
1855             label610__0end:
1856                     ; if exp=` desired != common_test_id_next ## {{ }} ' empty false
1857                     ; Other expression=`{ desired != common_test_id_next {{ }} }' delay=-1
1858                     ; if { desired != common_test_id_next {{ }} } end
1859                     ; procedure common_test_id_match end
1860 36e 3400            retlw 0
1861             
1862                     ; procedure common_test_id_bytes8 start
1863             common_test_id_bytes8:
1864     0044    common_test_id_bytes8__variables__base equ global__variables__bank0+36
1865     0044    common_test_id_bytes8__bytes__base equ common_test_id_bytes8__variables__base+0
1866     0045    common_test_id_bytes8__bits__base equ common_test_id_bytes8__variables__base+1
1867     0001    common_test_id_bytes8__total__bytes equ 1
1868                     ;   arguments_none  
1869                     ; This procedure will print out the next 8 bytes of the id in octal .
1870     0044    common_test_id_bytes8__count equ common_test_id_bytes8__bytes__base+0
1871                     ; `count_down count 8 ...' start
1872 36f 3008            movlw 8
1873 370 00c4            movwf common_test_id_bytes8__count
1874             common_test_id_bytes8__623_loop:
1875                     ;   call master_octal {{ common_test_id_next {{ }} }}  
1876 371 2384            call common_test_id_next
1877 372 0846            movf common_test_id_next__0return__byte,w
1878 373 00ca            movwf master_octal__number
1879 374 23a3            call master_octal
1880 375 0bc4            decfsz common_test_id_bytes8__count,f
1881 376 2b71            goto common_test_id_bytes8__623_loop
1882             common_test_id_bytes8__623_done:
1883                     ; `count_down count 8 ...' end
1884                     ;   call master_crlf {{ }}  
1885 377 238b            call master_crlf
1886                     ; procedure common_test_id_bytes8 end
1887 378 3400            retlw 0
1888             
1889                     ; procedure common_test_id_string start
1890             common_test_id_string:
1891     0045    common_test_id_string__variables__base equ global__variables__bank0+37
1892     0045    common_test_id_string__bytes__base equ common_test_id_string__variables__base+0
1893     0046    common_test_id_string__bits__base equ common_test_id_string__variables__base+1
1894     0001    common_test_id_string__total__bytes equ 1
1895                     ;   arguments_none  
1896                     ; This procedure will print out the next id string .
1897     0045    common_test_id_string__count equ common_test_id_string__bytes__base+0
1898                     ; `count_down count  common_test_id_next ## {{ }}  ...' start
1899 379 2384            call common_test_id_next
1900 37a 0846            movf common_test_id_next__0return__byte,w
1901 37b 00c5            movwf common_test_id_string__count
1902             common_test_id_string__636_loop:
1903                     ;   call master_send {{ common_test_id_next {{ }} }}  
1904 37c 2384            call common_test_id_next
1905 37d 0846            movf common_test_id_next__0return__byte,w
1906 37e 00d9            movwf master_send__character
1907 37f 2428            call master_send
1908 380 0bc5            decfsz common_test_id_string__count,f
1909 381 2b7c            goto common_test_id_string__636_loop
1910             common_test_id_string__636_done:
1911                     ; `count_down count  common_test_id_next ## {{ }}  ...' end
1912                     ;   call master_crlf {{ }}  
1913 382 238b            call master_crlf
1914                     ; procedure common_test_id_string end
1915 383 3400            retlw 0
1916             
1917                     ; procedure common_test_id_next start
1918             common_test_id_next:
1919     0046    common_test_id_next__variables__base equ global__variables__bank0+38
1920     0046    common_test_id_next__bytes__base equ common_test_id_next__variables__base+0
1921     0047    common_test_id_next__bits__base equ common_test_id_next__variables__base+1
1922     0001    common_test_id_next__total__bytes equ 1
1923                     ;   arguments_none  
1924     0046    common_test_id_next__0return__byte equ common_test_id_next__bytes__base+0
1925                     ; This procedure returns the next byte from the identification string .
1926                     ;   call slave_send {{ 0xfc }}  
1927 384 30fc            movlw 252
1928 385 00d0            movwf slave_send__data
1929 386 23e2            call slave_send
1930                     ;   return slave_get {{ }}  
1931 387 23bc            call slave_get
1932 388 084c            movf slave_get__0return__byte,w
1933 389 00c6            movwf common_test_id_next__0return__byte
1934 38a 3400            retlw 0
1935                     ; procedure common_test_id_next end
1936                     ; comment {The following procedures are used to communicate with the master :}
1937             
1938                     ; procedure master_crlf start
1939             master_crlf:
1940     0047    master_crlf__variables__base equ global__variables__bank0+39
1941     0047    master_crlf__bytes__base equ master_crlf__variables__base+0
1942     0047    master_crlf__bits__base equ master_crlf__variables__base+0
1943     0000    master_crlf__total__bytes equ 0
1944                     ;   arguments_none  
1945                     ; This procedure will output a carriage - return line - feed
1946                     ; to the master .
1947                     ;   call master_send {{ cr }}  
1948 38b 300d            movlw 13
1949 38c 00d9            movwf master_send__character
1950 38d 2428            call master_send
1951                     ;   call master_send {{ lf }}  
1952 38e 300a            movlw 10
1953 38f 00d9            movwf master_send__character
1954 390 2428            call master_send
1955                     ; procedure master_crlf end
1956 391 3400            retlw 0
1957             
1958                     ; procedure master_fail start
1959             master_fail:
1960     0047    master_fail__variables__base equ global__variables__bank0+39
1961     0047    master_fail__bytes__base equ master_fail__variables__base+0
1962     0049    master_fail__bits__base equ master_fail__variables__base+2
1963     0002    master_fail__total__bytes equ 2
1964     0047    master_fail__test_name equ master_fail__bytes__base+0
1965     0048    master_fail__test_number equ master_fail__bytes__base+1
1966                     ; This procedure will output ` fail ' followed by a carriage return
1967                     ; and line feed .
1968                     ;   call master_string {{ fail_string }}  
1969 392 3028            movlw LOW fail_string+1
1970 393 00da            movwf master_string__message
1971 394 242e            call master_string
1972                     ;   call master_string {{ test_name }}  
1973 395 0847            movf master_fail__test_name,w
1974 396 00da            movwf master_string__message
1975 397 242e            call master_string
1976                     ;   call master_octal {{ test_number }}  
1977 398 0848            movf master_fail__test_number,w
1978 399 00ca            movwf master_octal__number
1979 39a 23a3            call master_octal
1980                     ;   call master_crlf {{ }}  
1981 39b 238b            call master_crlf
1982                     ; procedure master_fail end
1983 39c 3400            retlw 0
1984             
1985                     ; procedure master_get start
1986             master_get:
1987     0049    master_get__variables__base equ global__variables__bank0+41
1988     0049    master_get__bytes__base equ master_get__variables__base+0
1989     004a    master_get__bits__base equ master_get__variables__base+1
1990     0001    master_get__total__bytes equ 1
1991                     ;   arguments_none  
1992     0049    master_get__0return__byte equ master_get__bytes__base+0
1993                     ; This procedure will get the next byte or return 0xfc if
1994                     ; no byte is forthcoming .
1995                     ;   return get_byte {{ rx_master_mask }}  
1996 39d 3002            movlw 2
1997 39e 00d1            movwf get_byte__mask
1998 39f 23e8            call get_byte
1999 3a0 0852            movf get_byte__0return__byte,w
2000 3a1 00c9            movwf master_get__0return__byte
2001 3a2 3400            retlw 0
2002                     ; procedure master_get end
2003             
2004                     ; procedure master_octal start
2005             master_octal:
2006     004a    master_octal__variables__base equ global__variables__bank0+42
2007     004a    master_octal__bytes__base equ master_octal__variables__base+0
2008     004c    master_octal__bits__base equ master_octal__variables__base+2
2009     0002    master_octal__total__bytes equ 2
2010     004b    master_octal__696byte0 equ master_octal__bytes__base+1
2011     004b    master_octal__697byte0 equ master_octal__bytes__base+1
2012     004a    master_octal__number equ master_octal__bytes__base+0
2013                     ; This procedure will output < number > in octal to the tx port .
2014                     ; Output the character in octal :
2015                     ;   call master_send {{ {{ number >> 6 }} + 0c'0' }}  
2016 3a3 0e4a            swapf master_octal__number,w
2017 3a4 00cb            movwf master_octal__696byte0
2018 3a5 0ccb            rrf master_octal__696byte0,f
2019 3a6 0c4b            rrf master_octal__696byte0,w
2020 3a7 3903            andlw 3
2021 3a8 3e30            addlw 48
2022 3a9 00d9            movwf master_send__character
2023 3aa 2428            call master_send
2024                     ;   call master_send {{ {{ {{ number >> 3 }} & 7 }} + 0c'0' }}  
2025 3ab 0c4a            rrf master_octal__number,w
2026 3ac 00cb            movwf master_octal__697byte0
2027 3ad 0ccb            rrf master_octal__697byte0,f
2028 3ae 0c4b            rrf master_octal__697byte0,w
2029 3af 3907            andlw 7
2030 3b0 3e30            addlw 48
2031 3b1 00d9            movwf master_send__character
2032 3b2 2428            call master_send
2033                     ;   call master_send {{ {{ number & 7 }} + 0c'0' }}  
2034 3b3 3007            movlw 7
2035 3b4 054a            andwf master_octal__number,w
2036 3b5 3e30            addlw 48
2037 3b6 00d9            movwf master_send__character
2038 3b7 2428            call master_send
2039                     ;   call master_send {{ sp }}  
2040 3b8 3020            movlw 32
2041 3b9 00d9            movwf master_send__character
2042 3ba 2428            call master_send
2043                     ; procedure master_octal end
2044 3bb 3400            retlw 0
2045             
2046                     ; procedure slave_get start
2047             slave_get:
2048     004c    slave_get__variables__base equ global__variables__bank0+44
2049     004c    slave_get__bytes__base equ slave_get__variables__base+0
2050     004d    slave_get__bits__base equ slave_get__variables__base+1
2051     0001    slave_get__total__bytes equ 1
2052                     ;   arguments_none  
2053     004c    slave_get__0return__byte equ slave_get__bytes__base+0
2054                     ; This procedure will get a byte from the slave or return 0xfc
2055                     ; if no byte is forthcoming .
2056                     ;   return get_byte {{ rx_slave_mask }}  
2057 3bc 3020            movlw 32
2058 3bd 00d1            movwf get_byte__mask
2059 3be 23e8            call get_byte
2060 3bf 0852            movf get_byte__0return__byte,w
2061 3c0 00cc            movwf slave_get__0return__byte
2062 3c1 3400            retlw 0
2063                     ; procedure slave_get end
2064             
2065                     ; procedure slave_id8 start
2066             slave_id8:
2067     004d    slave_id8__variables__base equ global__variables__bank0+45
2068     004d    slave_id8__bytes__base equ slave_id8__variables__base+0
2069     004e    slave_id8__bits__base equ slave_id8__variables__base+1
2070     0001    slave_id8__total__bytes equ 1
2071                     ;   arguments_none  
2072                     ; This procedure will print out the next 8 bytes of data from
2073                     ; the slave RoboBrick id bytes .
2074     004d    slave_id8__counter equ slave_id8__bytes__base+0
2075                     ; `count_down counter 8 ...' start
2076 3c2 3008            movlw 8
2077 3c3 00cd            movwf slave_id8__counter
2078             slave_id8__721_loop:
2079                     ;   call master_octal {{ slave_id_next {{ }} }}  
2080 3c4 23cc            call slave_id_next
2081 3c5 084e            movf slave_id_next__0return__byte,w
2082 3c6 00ca            movwf master_octal__number
2083 3c7 23a3            call master_octal
2084 3c8 0bcd            decfsz slave_id8__counter,f
2085 3c9 2bc4            goto slave_id8__721_loop
2086             slave_id8__721_done:
2087                     ; `count_down counter 8 ...' end
2088                     ;   call master_crlf {{ }}  
2089 3ca 238b            call master_crlf
2090                     ; procedure slave_id8 end
2091 3cb 3400            retlw 0
2092             
2093                     ; procedure slave_id_next start
2094             slave_id_next:
2095     004e    slave_id_next__variables__base equ global__variables__bank0+46
2096     004e    slave_id_next__bytes__base equ slave_id_next__variables__base+0
2097     004f    slave_id_next__bits__base equ slave_id_next__variables__base+1
2098     0001    slave_id_next__total__bytes equ 1
2099                     ;   arguments_none  
2100     004e    slave_id_next__0return__byte equ slave_id_next__bytes__base+0
2101                     ; This procedure will return the next byte from the id bytes .
2102                     ;   call slave_send {{ 0xfc }}  
2103 3cc 30fc            movlw 252
2104 3cd 00d0            movwf slave_send__data
2105 3ce 23e2            call slave_send
2106                     ;   return slave_get {{ }}  
2107 3cf 23bc            call slave_get
2108 3d0 084c            movf slave_get__0return__byte,w
2109 3d1 00ce            movwf slave_id_next__0return__byte
2110 3d2 3400            retlw 0
2111                     ; procedure slave_id_next end
2112             
2113                     ; procedure slave_id_string start
2114             slave_id_string:
2115     004f    slave_id_string__variables__base equ global__variables__bank0+47
2116     004f    slave_id_string__bytes__base equ slave_id_string__variables__base+0
2117     0050    slave_id_string__bits__base equ slave_id_string__variables__base+1
2118     0001    slave_id_string__total__bytes equ 1
2119                     ;   arguments_none  
2120                     ; This procedure will return the string for the id bytes .
2121     004f    slave_id_string__size equ slave_id_string__bytes__base+0
2122                     ;   size := slave_id_next {{ }}  
2123 3d3 23cc            call slave_id_next
2124 3d4 084e            movf slave_id_next__0return__byte,w
2125 3d5 00cf            movwf slave_id_string__size
2126                     ;   call master_octal {{ size }}  
2127 3d6 00ca            movwf master_octal__number
2128 3d7 23a3            call master_octal
2129                     ; `count_down size size ...' start
2130 3d8 084f            movf slave_id_string__size,w
2131 3d9 00cf            movwf slave_id_string__size
2132             slave_id_string__747_loop:
2133                     ;   call master_send {{ slave_id_next {{ }} }}  
2134 3da 23cc            call slave_id_next
2135 3db 084e            movf slave_id_next__0return__byte,w
2136 3dc 00d9            movwf master_send__character
2137 3dd 2428            call master_send
2138 3de 0bcf            decfsz slave_id_string__size,f
2139 3df 2bda            goto slave_id_string__747_loop
2140             slave_id_string__747_done:
2141                     ; `count_down size size ...' end
2142                     ;   call master_crlf {{ }}  
2143 3e0 238b            call master_crlf
2144                     ; procedure slave_id_string end
2145 3e1 3400            retlw 0
2146             
2147                     ; procedure slave_send start
2148             slave_send:
2149     0050    slave_send__variables__base equ global__variables__bank0+48
2150     0050    slave_send__bytes__base equ slave_send__variables__base+0
2151     0051    slave_send__bits__base equ slave_send__variables__base+1
2152     0001    slave_send__total__bytes equ 1
2153     0050    slave_send__data equ slave_send__bytes__base+0
2154                     ; This procedure will send one byte of < data > to the slave .
2155                     ;   call send_byte {{ data , tx_slave_mask }}  
2156 3e2 0850            movf slave_send__data,w
2157 3e3 00d5            movwf send_byte__char
2158 3e4 3010            movlw 16
2159 3e5 00d6            movwf send_byte__mask
2160 3e6 240d            call send_byte
2161                     ; procedure slave_send end
2162 3e7 3400            retlw 0
2163                     ; comment {The last procedures do character sending and receiving :}
2164             
2165                     ; procedure get_byte start
2166             get_byte:
2167     0051    get_byte__variables__base equ global__variables__bank0+49
2168     0051    get_byte__bytes__base equ get_byte__variables__base+0
2169     0055    get_byte__bits__base equ get_byte__variables__base+4
2170     0004    get_byte__total__bytes equ 4
2171     0051    get_byte__mask equ get_byte__bytes__base+0
2172     0052    get_byte__0return__byte equ get_byte__bytes__base+1
2173                     ; Get an 8 - bit byte from < mask > bit of < portb > and return it .
2174                     ; If no character shows up in a while 0xfc is returned .
2175     0053    get_byte__count equ get_byte__bytes__base+2
2176     0054    get_byte__char equ get_byte__bytes__base+3
2177                     ; Wait until a start bit arrives :
2178                     ;   count := 0  
2179 3e8 01d3            clrf get_byte__count
2180                     ; `while  portb & mask != 0  ...' start
2181             get_byte__776while__continue:
2182 3e9 0806            movf portb,w
2183 3ea 0551            andwf get_byte__mask,w
2184                     ; expression=` portb & mask != 0 ' exp_delay=2 true_delay=1  false_delay=2 true_size=9 false_size=1
2185 3eb 1903            btfsc z___byte,z___bit
2186 3ec 2bf6            goto get_byte__776while__break
2187                     ;   count := count - 1  
2188 3ed 03d3            decf get_byte__count,f
2189                     ; if { count = 0 } start
2190 3ee 0853            movf get_byte__count,w
2191                     ; expression=`{ count = 0 }' exp_delay=1 true_delay=3  false_delay=0 true_size=3 false_size=0
2192 3ef 1d03            btfss z___byte,z___bit
2193 3f0 2bf4            goto label778__0end
2194                     ; if { count = 0 } body start
2195                     ;   return 0xfc  
2196 3f1 30fc            movlw 252
2197 3f2 00d2            movwf get_byte__0return__byte
2198 3f3 3400            retlw 0
2199                     ; if { count = 0 } body end
2200             label778__0end:
2201                     ; if exp=` count = 0 ' empty false
2202                     ; Other expression=`{ count = 0 }' delay=-1
2203                     ; if { count = 0 } end
2204                     ;   call delay {{ }}  
2205 3f4 2441            call delay
2206 3f5 2be9            goto get_byte__776while__continue
2207                     ; if exp=` portb & mask != 0 ' false goto
2208                     ; Other expression=` portb & mask != 0 ' delay=-1
2209             get_byte__776while__break:
2210                     ; `while  portb & mask != 0  ...' end
2211                     ; Skip over the start bit :
2212                     ;   call delay {{ }}  
2213 3f6 2441            call delay
2214                     ;   call delay {{ }}  
2215 3f7 2441            call delay
2216                     ;   call delay {{ }}  
2217 3f8 2441            call delay
2218                     ; Sample in the middle third of each data bit :
2219                     ;   char := 0  
2220 3f9 01d4            clrf get_byte__char
2221                     ; `count_down count 8 ...' start
2222 3fa 3008            movlw 8
2223 3fb 00d3            movwf get_byte__count
2224             get_byte__791_loop:
2225                     ;   call delay {{ }}  
2226 3fc 2441            call delay
2227                     ;   char := char >> 1  
2228 3fd 1003            bcf c___byte,c___bit
2229 3fe 0cd4            rrf get_byte__char,f
2230                     ; if { portb & mask != 0 } start
2231 3ff 0806            movf portb,w
2232 400 0551            andwf get_byte__mask,w
2233                     ; expression=`{ portb & mask != 0 }' exp_delay=2 true_delay=2  false_delay=0 true_size=2 false_size=0
2234 401 1903            btfsc z___byte,z___bit
2235 402 2c05            goto label794__0end
2236                     ; if { portb & mask != 0 } body start
2237                     ;   char := char | 0x80  
2238 403 3080            movlw 128
2239 404 04d4            iorwf get_byte__char,f
2240                     ; if { portb & mask != 0 } body end
2241             label794__0end:
2242                     ; if exp=` portb & mask != 0 ' empty false
2243                     ; Other expression=`{ portb & mask != 0 }' delay=-1
2244                     ; if { portb & mask != 0 } end
2245                     ;   call delay {{ }}  
2246 405 2441            call delay
2247                     ;   call delay {{ }}  
2248 406 2441            call delay
2249 407 0bd3            decfsz get_byte__count,f
2250 408 2bfc            goto get_byte__791_loop
2251             get_byte__791_done:
2252                     ; `count_down count 8 ...' end
2253                     ; Skip over 1 / 3 of the stop bit :
2254                     ;   call delay {{ }}  
2255 409 2441            call delay
2256                     ;   return char  
2257 40a 0854            movf get_byte__char,w
2258 40b 00d2            movwf get_byte__0return__byte
2259 40c 3400            retlw 0
2260                     ; procedure get_byte end
2261             
2262                     ; procedure send_byte start
2263             send_byte:
2264     0055    send_byte__variables__base equ global__variables__bank0+53
2265     0055    send_byte__bytes__base equ send_byte__variables__base+0
2266     0059    send_byte__bits__base equ send_byte__variables__base+4
2267     0004    send_byte__total__bytes equ 4
2268     0055    send_byte__char equ send_byte__bytes__base+0
2269     0056    send_byte__mask equ send_byte__bytes__base+1
2270                     ; Send < char > to < mask > bit of < portb > .
2271     0057    send_byte__count equ send_byte__bytes__base+2
2272     0058    send_byte__mark equ send_byte__bytes__base+3
2273                     ; Send the start bit :
2274                     ;   mark := mask ^ space  
2275 40d 30ff            movlw 255
2276 40e 0656            xorwf send_byte__mask,w
2277 40f 00d8            movwf send_byte__mark
2278                     ;   portb := mark  
2279 410 0086            movwf portb
2280                     ;   call delay {{ }}  
2281 411 2441            call delay
2282                     ;   call delay {{ }}  
2283 412 2441            call delay
2284                     ;   call delay {{ }}  
2285 413 2441            call delay
2286                     ; Send the data :
2287                     ; `count_down count 8 ...' start
2288 414 3008            movlw 8
2289 415 00d7            movwf send_byte__count
2290             send_byte__825_loop:
2291                     ; if { char @ 0 } start
2292                     ; Alias variable for select char @ 0
2293     0055    send_byte__char__826select0 equ send_byte__char+0
2294     0055    send_byte__char__826select0__byte equ send_byte__char+0
2295     0000    send_byte__char__826select0__bit equ 0
2296                     ; expression=`{ char @ 0 }' exp_delay=0 true_delay=1  false_delay=1 true_size=1 false_size=1
2297 416 1855            btfsc send_byte__char__826select0__byte,send_byte__char__826select0__bit
2298                     ; if { char @ 0 } body start
2299                     ;   portb := space  
2300 417 30ff            movlw 255
2301                     ; 1 instructions found for sharing
2302 418 1c55            btfss send_byte__char__826select0__byte,send_byte__char__826select0__bit
2303                     ; else body start
2304                     ;   portb := mark  
2305 419 0858            movf send_byte__mark,w
2306                     ; 1 instructions found for sharing
2307                     ; if exp=` char @ 0 ' single true and false skip delay=4
2308                     ; Other expression=`{ char @ 0 }' delay=4
2309                     ; 1 shared instructions follow
2310 41a 0086            movwf portb
2311                     ; if { char @ 0 } end
2312                     ;   char := char >> 1  
2313 41b 1003            bcf c___byte,c___bit
2314 41c 0cd5            rrf send_byte__char,f
2315                     ;   call delay {{ }}  
2316 41d 2441            call delay
2317                     ;   call delay {{ }}  
2318 41e 2441            call delay
2319                     ;   call delay {{ }}  
2320 41f 2441            call delay
2321 420 0bd7            decfsz send_byte__count,f
2322 421 2c16            goto send_byte__825_loop
2323             send_byte__825_done:
2324                     ; `count_down count 8 ...' end
2325                     ; Send the stop bit :
2326                     ;   portb := space  
2327 422 30ff            movlw 255
2328 423 0086            movwf portb
2329                     ;   call delay {{ }}  
2330 424 2441            call delay
2331                     ;   call delay {{ }}  
2332 425 2441            call delay
2333                     ;   call delay {{ }}  
2334 426 2441            call delay
2335                     ; procedure send_byte end
2336 427 3400            retlw 0
2337             
2338                     ; procedure master_send start
2339             master_send:
2340     0059    master_send__variables__base equ global__variables__bank0+57
2341     0059    master_send__bytes__base equ master_send__variables__base+0
2342     005a    master_send__bits__base equ master_send__variables__base+1
2343     0001    master_send__total__bytes equ 1
2344     0059    master_send__character equ master_send__bytes__base+0
2345                     ; This procedure will output < character > to the master .
2346                     ;   call send_byte {{ character , tx_master_mask }}  
2347 428 0859            movf master_send__character,w
2348 429 00d5            movwf send_byte__char
2349 42a 3004            movlw 4
2350 42b 00d6            movwf send_byte__mask
2351 42c 240d            call send_byte
2352                     ; procedure master_send end
2353 42d 3400            retlw 0
2354             
2355                     ; procedure master_string start
2356             master_string:
2357     005a    master_string__variables__base equ global__variables__bank0+58
2358     005a    master_string__bytes__base equ master_string__variables__base+0
2359     005d    master_string__bits__base equ master_string__variables__base+3
2360     0003    master_string__total__bytes equ 3
2361     005a    master_string__message equ master_string__bytes__base+0
2362                     ; This procedure will output < message > to the master .
2363     005b    master_string__size equ master_string__bytes__base+1
2364     005c    master_string__index equ master_string__bytes__base+2
2365                     ;   index := 0  
2366 42e 01dc            clrf master_string__index
2367                     ; `while  index < message . size  ...' start
2368             master_string__863while__continue:
2369 42f 018a            clrf pclath___register
2370 430 085a            movf master_string__message,w
2371 431 200e            call string___fetch
2372 432 025c            subwf master_string__index,w
2373                     ; expression=` index < message . size ' exp_delay=4 true_delay=7  false_delay=2 true_size=8 false_size=1
2374 433 1803            btfsc c___byte,c___bit
2375 434 2c3d            goto master_string__863while__break
2376                     ;   call master_send {{ message ~~ {{ index }} }}  
2377 435 0a5c            incf master_string__index,w
2378 436 075a            addwf master_string__message,w
2379 437 018a            clrf pclath___register
2380 438 200e            call string___fetch
2381 439 00d9            movwf master_send__character
2382 43a 2428            call master_send
2383                     ;   index := index + 1  
2384 43b 0adc            incf master_string__index,f
2385 43c 2c2f            goto master_string__863while__continue
2386                     ; if exp=` index < message . size ' false goto
2387                     ; Other expression=` index < message . size ' delay=-1
2388             master_string__863while__break:
2389                     ; `while  index < message . size  ...' end
2390                     ;   call master_send {{ sp }}  
2391 43d 3020            movlw 32
2392 43e 00d9            movwf master_send__character
2393 43f 2428            call master_send
2394                     ; procedure master_string end
2395 440 3400            retlw 0
2396             
2397                     ; procedure delay start
2398                     ; optimize 0
2399             delay:
2400     005d    delay__variables__base equ global__variables__bank0+61
2401     005d    delay__bytes__base equ delay__variables__base+0
2402     005e    delay__bits__base equ delay__variables__base+1
2403     0001    delay__total__bytes equ 1
2404     005d    delay__870byte1 equ delay__bytes__base+0
2405                     ;   arguments_none  
2406                     ;   uniform_delay instructions_per_delay  
2407                     ; Uniform delay remaining = 343 Accumulated Delay = 0
2408                     ; Uniform delay remaining = 343 Accumulated Delay = 0
2409                     ; Delay 1 third of a bit :
2410                     ; Uniform delay remaining = 343 Accumulated Delay = 0
2411                     ; Uniform delay remaining = 343 Accumulated Delay = 0
2412                     ; Soak up remaining 343 cycles
2413                     ; Delay 343 cycles
2414 441 3072            movlw 114
2415 442 00dd            movwf delay__870byte1
2416             delay__870delay0:
2417 443 0bdd            decfsz delay__870byte1,f
2418 444 2c43            goto delay__870delay0
2419                     ; procedure delay end
2420 445 3400            retlw 0
2421                     ; optimize 1
2422             
2423                     ; Register bank 0 used 62 bytes of 96 available bytes
2424                     ; Register bank 1 used 0 bytes of 80 available bytes
2425                     ; Register bank 2 used 0 bytes of 48 available bytes
2426                     ; Register bank 3 used 0 bytes of 0 available bytes
2427             
2428                     end

