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

