  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     0063    global__bit__variables__bank0 equ 99
  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 2888            goto main
 50                     ; comment #############################################################################
 51                     ; comment {}
 52                     ; comment {Copyright < c > 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 AnalogIn4 RoboBrick . See :}
 62                     ; comment {}
 63                     ; comment {http : / / web . gramlich . net / projects / robobricks / analogin4 / 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 {Some register definitions :}
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                     ; comment {port porta a unused none}
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                     ; comment {Miscellaneous constants :}
151                     ;   constant space 0xff  
152     00ff    space equ 255
153                     ;   constant buffer_size 3  
154     0003    buffer_size equ 3
155                     ; string_constants Start
156             string___fetch:
157 00e 0082            movwf pcl___register
158                     ;   binary_string = 0s'Binary'  
159     0000    binary_string___string equ 0
160             binary_string:
161 00f 0782            addwf pcl___register,f
162                     ; Length = 6
163 010 3406            retlw 6
164                     ; `Binary'
165 011 3442            retlw 66
166 012 3469            retlw 105
167 013 346e            retlw 110
168 014 3461            retlw 97
169 015 3472            retlw 114
170 016 3479            retlw 121
171                     ;   bit_string = 0s'Bit'  
172     0008    bit_string___string equ 8
173             bit_string:
174 017 0782            addwf pcl___register,f
175                     ; Length = 3
176 018 3403            retlw 3
177                     ; `Bit'
178 019 3442            retlw 66
179 01a 3469            retlw 105
180 01b 3474            retlw 116
181                     ;   channel_string = 0s'Channel'  
182     000d    channel_string___string equ 13
183             channel_string:
184 01c 0782            addwf pcl___register,f
185                     ; Length = 7
186 01d 3407            retlw 7
187                     ; `Channel'
188 01e 3443            retlw 67
189 01f 3468            retlw 104
190 020 3461            retlw 97
191 021 346e            retlw 110
192 022 346e            retlw 110
193 023 3465            retlw 101
194 024 346c            retlw 108
195                     ;   clock_string = 0s'Clk'  
196     0016    clock_string___string equ 22
197             clock_string:
198 025 0782            addwf pcl___register,f
199                     ; Length = 3
200 026 3403            retlw 3
201                     ; `Clk'
202 027 3443            retlw 67
203 028 346c            retlw 108
204 029 346b            retlw 107
205                     ;   common_string = 0s'Common'  
206     001b    common_string___string equ 27
207             common_string:
208 02a 0782            addwf pcl___register,f
209                     ; Length = 6
210 02b 3406            retlw 6
211                     ; `Common'
212 02c 3443            retlw 67
213 02d 346f            retlw 111
214 02e 346d            retlw 109
215 02f 346d            retlw 109
216 030 346f            retlw 111
217 031 346e            retlw 110
218                     ;   done_string = 0s'Done'  
219     0023    done_string___string equ 35
220             done_string:
221 032 0782            addwf pcl___register,f
222                     ; Length = 4
223 033 3404            retlw 4
224                     ; `Done'
225 034 3444            retlw 68
226 035 346f            retlw 111
227 036 346e            retlw 110
228 037 3465            retlw 101
229                     ;   fail_string = 0s'Fail'  
230     0029    fail_string___string equ 41
231             fail_string:
232 038 0782            addwf pcl___register,f
233                     ; Length = 4
234 039 3404            retlw 4
235                     ; `Fail'
236 03a 3446            retlw 70
237 03b 3461            retlw 97
238 03c 3469            retlw 105
239 03d 346c            retlw 108
240                     ;   hello_string = 0s'AnalogIn4_Test'  
241     002f    hello_string___string equ 47
242             hello_string:
243 03e 0782            addwf pcl___register,f
244                     ; Length = 14
245 03f 340e            retlw 14
246                     ; `AnalogIn4_Test'
247 040 3441            retlw 65
248 041 346e            retlw 110
249 042 3461            retlw 97
250 043 346c            retlw 108
251 044 346f            retlw 111
252 045 3467            retlw 103
253 046 3449            retlw 73
254 047 346e            retlw 110
255 048 3434            retlw 52
256 049 345f            retlw 95
257 04a 3454            retlw 84
258 04b 3465            retlw 101
259 04c 3473            retlw 115
260 04d 3474            retlw 116
261                     ;   input_string = 0s'Input'  
262     003f    input_string___string equ 63
263             input_string:
264 04e 0782            addwf pcl___register,f
265                     ; Length = 5
266 04f 3405            retlw 5
267                     ; `Input'
268 050 3449            retlw 73
269 051 346e            retlw 110
270 052 3470            retlw 112
271 053 3475            retlw 117
272 054 3474            retlw 116
273                     ;   interrupt_string = 0s'Interrupt'  
274     0046    interrupt_string___string equ 70
275             interrupt_string:
276 055 0782            addwf pcl___register,f
277                     ; Length = 9
278 056 3409            retlw 9
279                     ; `Interrupt'
280 057 3449            retlw 73
281 058 346e            retlw 110
282 059 3474            retlw 116
283 05a 3465            retlw 101
284 05b 3472            retlw 114
285 05c 3472            retlw 114
286 05d 3475            retlw 117
287 05e 3470            retlw 112
288 05f 3474            retlw 116
289                     ;   patterns = 0 , 1 , 2 , 4 , 8 , 0x10 , 0x20 , 0x40 , 0x80 , 0xff , 0  
290     0051    patterns___string equ 81
291             patterns:
292 060 0782            addwf pcl___register,f
293                     ; Length = 11
294 061 340b            retlw 11
295                     ; 0
296 062 3400            retlw 0
297                     ; 1
298 063 3401            retlw 1
299                     ; 2
300 064 3402            retlw 2
301                     ; 4
302 065 3404            retlw 4
303                     ; 8
304 066 3408            retlw 8
305                     ; 0x10
306 067 3410            retlw 16
307                     ; 0x20
308 068 3420            retlw 32
309                     ; 0x40
310 069 3440            retlw 64
311                     ; 0x80
312 06a 3480            retlw 128
313                     ; 0xff
314 06b 34ff            retlw 255
315                     ; 0
316 06c 3400            retlw 0
317                     ;   register_string = 0s'Register'  
318     005e    register_string___string equ 94
319             register_string:
320 06d 0782            addwf pcl___register,f
321                     ; Length = 8
322 06e 3408            retlw 8
323                     ; `Register'
324 06f 3452            retlw 82
325 070 3465            retlw 101
326 071 3467            retlw 103
327 072 3469            retlw 105
328 073 3473            retlw 115
329 074 3474            retlw 116
330 075 3465            retlw 101
331 076 3472            retlw 114
332                     ;   test_string = 0s'Test'  
333     0068    test_string___string equ 104
334             test_string:
335 077 0782            addwf pcl___register,f
336                     ; Length = 4
337 078 3404            retlw 4
338                     ; `Test'
339 079 3454            retlw 84
340 07a 3465            retlw 101
341 07b 3473            retlw 115
342 07c 3474            retlw 116
343                     ;   threshold_string = 0s'Threshold'  
344     006e    threshold_string___string equ 110
345             threshold_string:
346 07d 0782            addwf pcl___register,f
347                     ; Length = 9
348 07e 3409            retlw 9
349                     ; `Threshold'
350 07f 3454            retlw 84
351 080 3468            retlw 104
352 081 3472            retlw 114
353 082 3465            retlw 101
354 083 3473            retlw 115
355 084 3468            retlw 104
356 085 346f            retlw 111
357 086 346c            retlw 108
358 087 3464            retlw 100
359                     ; string__constants End
360     0020    temp equ global__variables__bank0+0
361             
362                     ; procedure main start
363             main:
364     0021    main__variables__base equ global__variables__bank0+1
365     0021    main__bytes__base equ main__variables__base+0
366     0028    main__bits__base equ main__variables__base+7
367     0007    main__total__bytes equ 7
368     0027    main__124byte0 equ main__bytes__base+6
369     0027    main__152byte0 equ main__bytes__base+6
370                     ;   arguments_none  
371                     ; Read a byte .
372     0021    main__buffer equ main__bytes__base+0
373     0024    main__char equ main__bytes__base+3
374     0025    main__index equ main__bytes__base+4
375     0026    main__number equ main__bytes__base+5
376                     ; Print out a welcome message :
377                     ;   call master_crlf {{ }}  
378 088 24ab            call master_crlf
379                     ;   call master_string {{ hello_string }}  
380 089 303f            movlw LOW hello_string+1
381 08a 00df            movwf master_string__message
382 08b 2541            call master_string
383                     ;   call master_crlf {{ }}  
384 08c 24ab            call master_crlf
385                     ; Main loop
386                     ;   number := 0  
387 08d 01a6            clrf main__number
388                     ; loop_forever ... start
389             main__112loop__forever:
390                     ; Get a character :
391                     ;   tx_slave_pin := 1  
392 08e 1606            bsf tx_slave_pin__byte,tx_slave_pin__bit
393                     ;   char := master_get {{ }}  
394 08f 24bd            call master_get
395 090 0850            movf master_get__0return__byte,w
396 091 00a4            movwf main__char
397                     ; Delay 2 / 3 ' s of bit make sure that get_byte is done .
398                     ;   call delay {{ }}  
399 092 2554            call delay
400                     ;   call delay {{ }}  
401 093 2554            call delay
402                     ; if { 0c'0' <= char && char < {{ 0c'9' + 1 }} } start
403 094 3030            movlw 48
404 095 0224            subwf main__char,w
405                     ; expression=`0c'0' <= char' exp_delay=2 true_delay=-1  false_delay=1 true_size=132 false_size=1
406 096 1c03            btfss c___byte,c___bit
407 097 28a8            goto and121__0false
408 098 303a            movlw 58
409 099 0224            subwf main__char,w
410                     ; expression=`char < {{ 0c'9' + 1 }}' exp_delay=2 true_delay=9  false_delay=-1 true_size=11 false_size=116
411 09a 1803            btfsc c___byte,c___bit
412 09b 28a8            goto label121__1false
413             label121__1true:
414             and121__0true:
415                     ; if { 0c'0' <= char && char < {{ 0c'9' + 1 }} } body start
416                     ; Do a multiply by 8 then add in digit :
417                     ;   call master_send {{ char }}  
418 09c 0824            movf main__char,w
419 09d 00de            movwf master_send__character
420 09e 253b            call master_send
421                     ;   number := {{ number << 3 }} + char - 0c'0'  
422 09f 0d26            rlf main__number,w
423 0a0 00a7            movwf main__124byte0
424 0a1 0da7            rlf main__124byte0,f
425 0a2 0d27            rlf main__124byte0,w
426 0a3 39f8            andlw 248
427 0a4 0724            addwf main__char,w
428 0a5 3ed0            addlw 208
429 0a6 00a6            movwf main__number
430                     ; if { 0c'0' <= char && char < {{ 0c'9' + 1 }} } body end
431 0a7 291c            goto label121__1end
432             label121__1false:
433             and121__0false:
434 0a8 3073            movlw 115
435 0a9 0224            subwf main__char,w
436                     ; expression=`{ char = 0c's' }' exp_delay=2 true_delay=-1  false_delay=-1 true_size=8 false_size=103
437 0aa 1d03            btfss z___byte,z___bit
438 0ab 28b5            goto label125__0false
439             label125__0true:
440                     ; else_if { char = 0c's' } body start
441                     ; Send byte to brick , no wait :
442                     ; Echo command and send CRLF :
443                     ;   call master_send {{ char }}  
444 0ac 0824            movf main__char,w
445 0ad 00de            movwf master_send__character
446 0ae 253b            call master_send
447                     ;   call master_crlf {{ }}  
448 0af 24ab            call master_crlf
449                     ; Ship the byte down to the brick :
450                     ;   call slave_send {{ number }}  
451 0b0 0826            movf main__number,w
452 0b1 00d4            movwf slave_send__data
453 0b2 24e2            call slave_send
454                     ;   number := 0  
455 0b3 01a6            clrf main__number
456                     ; else_if { char = 0c's' } body end
457 0b4 291c            goto label125__0end
458             label125__0false:
459 0b5 3077            movlw 119
460 0b6 0224            subwf main__char,w
461                     ; expression=`{ char = 0c'w' }' exp_delay=2 true_delay=-1  false_delay=-1 true_size=39 false_size=59
462 0b7 1d03            btfss z___byte,z___bit
463 0b8 28e1            goto label136__0false
464             label136__0true:
465                     ; else_if { char = 0c'w' } body start
466                     ; Send byte to brick , wait for results :
467                     ; Echo command and send CRLF :
468                     ;   call master_send {{ char }}  
469 0b9 0824            movf main__char,w
470 0ba 00de            movwf master_send__character
471 0bb 253b            call master_send
472                     ;   call master_crlf {{ }}  
473 0bc 24ab            call master_crlf
474                     ; Ship the byte down to the brick ...
475                     ;   call slave_send {{ number }}  
476 0bd 0826            movf main__number,w
477 0be 00d4            movwf slave_send__data
478 0bf 24e2            call slave_send
479                     ;   number := 0  
480 0c0 01a6            clrf main__number
481                     ; call delay < >
482                     ; ... and wait for a response :
483                     ;   index := 0  
484 0c1 01a5            clrf main__index
485                     ; `while  index < buffer_size  ...' start
486             main__151while__continue:
487 0c2 3003            movlw 3
488 0c3 0225            subwf main__index,w
489                     ; expression=` index < buffer_size ' exp_delay=2 true_delay=10  false_delay=2 true_size=11 false_size=1
490 0c4 1803            btfsc c___byte,c___bit
491 0c5 28d1            goto main__151while__break
492                     ;   buffer ~~ {{ index }} := slave_get {{ }}  
493 0c6 24dc            call slave_get
494 0c7 0853            movf slave_get__0return__byte,w
495 0c8 00a7            movwf main__152byte0
496 0c9 3021            movlw LOW main__buffer
497 0ca 0725            addwf main__index,w
498 0cb 0084            movwf fsr___register
499 0cc 0827            movf main__152byte0,w
500 0cd 1383            bcf irp___register,irp___bit
501 0ce 0080            movwf indf___register
502                     ;   index := index + 1  
503 0cf 0aa5            incf main__index,f
504 0d0 28c2            goto main__151while__continue
505                     ; if exp=` index < buffer_size ' false goto
506                     ; Other expression=` index < buffer_size ' delay=-1
507             main__151while__break:
508                     ; `while  index < buffer_size  ...' end
509                     ;   index := 0  
510 0d1 01a5            clrf main__index
511                     ; `while  index < buffer_size  ...' start
512             main__157while__continue:
513 0d2 3003            movlw 3
514 0d3 0225            subwf main__index,w
515                     ; expression=` index < buffer_size ' exp_delay=2 true_delay=8  false_delay=2 true_size=9 false_size=1
516 0d4 1803            btfsc c___byte,c___bit
517 0d5 28df            goto main__157while__break
518                     ;   call master_octal {{ buffer ~~ {{ index }} }}  
519 0d6 3021            movlw LOW main__buffer
520 0d7 0725            addwf main__index,w
521 0d8 0084            movwf fsr___register
522 0d9 1383            bcf irp___register,irp___bit
523 0da 0800            movf indf___register,w
524 0db 00d1            movwf master_octal__number
525 0dc 24c3            call master_octal
526                     ;   index := index + 1  
527 0dd 0aa5            incf main__index,f
528 0de 28d2            goto main__157while__continue
529                     ; if exp=` index < buffer_size ' false goto
530                     ; Other expression=` index < buffer_size ' delay=-1
531             main__157while__break:
532                     ; `while  index < buffer_size  ...' end
533                     ; Terminate the output list
534                     ;   call master_crlf {{ }}  
535 0df 24ab            call master_crlf
536                     ; else_if { char = 0c'w' } body end
537 0e0 291c            goto label136__0end
538             label136__0false:
539 0e1 3069            movlw 105
540 0e2 0224            subwf main__char,w
541                     ; expression=`{ char = 0c'i' }' exp_delay=2 true_delay=-1  false_delay=-1 true_size=12 false_size=42
542 0e3 1d03            btfss z___byte,z___bit
543 0e4 28f2            goto label164__0false
544             label164__0true:
545                     ; else_if { char = 0c'i' } body start
546                     ; Interrogate the slave RoboBrick :
547                     ;   call master_send {{ char }}  
548 0e5 0824            movf main__char,w
549 0e6 00de            movwf master_send__character
550 0e7 253b            call master_send
551                     ;   call master_crlf {{ }}  
552 0e8 24ab            call master_crlf
553                     ; Initialize the id index :
554                     ;   call slave_send {{ 0xfd }}  
555 0e9 30fd            movlw 253
556 0ea 00d4            movwf slave_send__data
557 0eb 24e2            call slave_send
558                     ; Get the first 8 bytes :
559                     ;   call common_test_id_bytes8 {{ }}  
560 0ec 241e            call common_test_id_bytes8
561                     ; Get the next 8 bytes of random numbers :
562                     ;   call common_test_id_bytes8 {{ }}  
563 0ed 241e            call common_test_id_bytes8
564                     ; Get the next 8 bytes of random numbers :
565                     ;   call common_test_id_bytes8 {{ }}  
566 0ee 241e            call common_test_id_bytes8
567                     ; Get the slave brick name :
568                     ;   call common_test_id_string {{ }}  
569 0ef 2428            call common_test_id_string
570                     ; Get the vendor name :
571                     ;   call common_test_id_string {{ }}  
572 0f0 2428            call common_test_id_string
573                     ; else_if { char = 0c'i' } body end
574 0f1 291c            goto label164__0end
575             label164__0false:
576 0f2 3074            movlw 116
577 0f3 0224            subwf main__char,w
578                     ; expression=`{ char = 0c't' }' exp_delay=2 true_delay=-1  false_delay=-1 true_size=5 false_size=32
579 0f4 1d03            btfss z___byte,z___bit
580 0f5 28fc            goto label187__0false
581             label187__0true:
582                     ; else_if { char = 0c't' } body start
583                     ; Do testing :
584                     ;   call master_send {{ char }}  
585 0f6 0824            movf main__char,w
586 0f7 00de            movwf master_send__character
587 0f8 253b            call master_send
588                     ;   call master_crlf {{ }}  
589 0f9 24ab            call master_crlf
590                     ;   call test {{ }}  
591 0fa 21b4            call test
592                     ; else_if { char = 0c't' } body end
593 0fb 291c            goto label187__0end
594             label187__0false:
595 0fc 3063            movlw 99
596 0fd 0224            subwf main__char,w
597                     ; expression=`{ char = 0c'c' }' exp_delay=2 true_delay=-1  false_delay=-1 true_size=8 false_size=19
598 0fe 1d03            btfss z___byte,z___bit
599 0ff 2909            goto label192__0false
600             label192__0true:
601                     ; else_if { char = 0c'c' } body start
602                     ;   call master_send {{ char }}  
603 100 0824            movf main__char,w
604 101 00de            movwf master_send__character
605 102 253b            call master_send
606                     ;   call master_crlf {{ }}  
607 103 24ab            call master_crlf
608                     ;   call clock_adjust {{ number }}  
609 104 0826            movf main__number,w
610 105 00a8            movwf clock_adjust__adjust
611 106 211d            call clock_adjust
612                     ;   number := 0  
613 107 01a6            clrf main__number
614                     ; else_if { char = 0c'c' } body end
615 108 291c            goto label192__0end
616             label192__0false:
617 109 30fc            movlw 252
618 10a 0224            subwf main__char,w
619                     ; expression=`{ char != 0xfc }' exp_delay=2 true_delay=-1  false_delay=0 true_size=15 false_size=0
620 10b 1903            btfsc z___byte,z___bit
621 10c 291c            goto label197__0end
622                     ; else_if { char != 0xfc } body start
623                     ; Just echo back the current number :
624                     ;   call master_send {{ 0c'<' }}  
625 10d 303c            movlw 60
626 10e 00de            movwf master_send__character
627 10f 253b            call master_send
628                     ;   call master_octal {{ char }}  
629 110 0824            movf main__char,w
630 111 00d1            movwf master_octal__number
631 112 24c3            call master_octal
632                     ;   call master_send {{ 0c'>' }}  
633 113 303e            movlw 62
634 114 00de            movwf master_send__character
635 115 253b            call master_send
636                     ; Send a carriage - return line - feed :
637                     ;   call master_crlf {{ }}  
638 116 24ab            call master_crlf
639                     ; Output the character in octal :
640                     ;   call master_octal {{ number }}  
641 117 0826            movf main__number,w
642 118 00d1            movwf master_octal__number
643 119 24c3            call master_octal
644                     ; Send a carriage - return line - feed :
645                     ;   call master_crlf {{ }}  
646 11a 24ab            call master_crlf
647                     ; Reset number
648                     ;   number := 0  
649 11b 01a6            clrf main__number
650                     ; else_if { char != 0xfc } body end
651             label197__0end:
652                     ; if exp=` char != 0xfc ' empty false
653                     ; Other expression=`{ char != 0xfc }' delay=-1
654                     ; if exp=` char = 0c'c' ' generic
655             label192__0end:
656                     ; Other expression=`{ char = 0c'c' }' delay=-1
657                     ; if exp=` char = 0c't' ' generic
658             label187__0end:
659                     ; Other expression=`{ char = 0c't' }' delay=-1
660                     ; if exp=` char = 0c'i' ' generic
661             label164__0end:
662                     ; Other expression=`{ char = 0c'i' }' delay=-1
663                     ; if exp=` char = 0c'w' ' generic
664             label136__0end:
665                     ; Other expression=`{ char = 0c'w' }' delay=-1
666                     ; if exp=` char = 0c's' ' generic
667             label125__0end:
668                     ; Other expression=`{ char = 0c's' }' delay=-1
669                     ; if exp=`char < {{ 0c'9' + 1 }}' generic
670             label121__1end:
671                     ; Other expression=`char < {{ 0c'9' + 1 }}' delay=-1
672                     ; if exp=`0c'0' <= char' false goto
673                     ; Other expression=`0c'0' <= char' delay=-1
674             and121__0end:
675                     ; if { 0c'0' <= char && char < {{ 0c'9' + 1 }} } end
676 11c 288e            goto main__112loop__forever
677                     ; loop_forever ... end
678                     ; procedure main end
679             
680                     ; procedure clock_adjust start
681             clock_adjust:
682     0028    clock_adjust__variables__base equ global__variables__bank0+8
683     0028    clock_adjust__bytes__base equ clock_adjust__variables__base+0
684     0032    clock_adjust__bits__base equ clock_adjust__variables__base+10
685     000a    clock_adjust__total__bytes equ 10
686     0031    clock_adjust__234byte0 equ clock_adjust__bytes__base+9
687     0031    clock_adjust__280byte0 equ clock_adjust__bytes__base+9
688     0031    clock_adjust__290byte0 equ clock_adjust__bytes__base+9
689     0031    clock_adjust__294byte0 equ clock_adjust__bytes__base+9
690     0028    clock_adjust__adjust equ clock_adjust__bytes__base+0
691                     ; This procedure will adjust the clock to the slave .
692     0029    clock_adjust__command equ clock_adjust__bytes__base+1
693     002a    clock_adjust__count equ clock_adjust__bytes__base+2
694     002b    clock_adjust__error equ clock_adjust__bytes__base+3
695     002c    clock_adjust__error_minimum equ clock_adjust__bytes__base+4
696     002d    clock_adjust__high equ clock_adjust__bytes__base+5
697     002e    clock_adjust__low equ clock_adjust__bytes__base+6
698     002f    clock_adjust__target equ clock_adjust__bytes__base+7
699     0030    clock_adjust__wait equ clock_adjust__bytes__base+8
700                     ;   target := iterations_low - adjust  
701 11d 303b            movlw 59
702 11e 00b1            movwf clock_adjust__234byte0
703 11f 0828            movf clock_adjust__adjust,w
704 120 0231            subwf clock_adjust__234byte0,w
705 121 00af            movwf clock_adjust__target
706                     ;   count := 2  
707 122 3002            movlw 2
708 123 00aa            movwf clock_adjust__count
709                     ;   error := 0xff  
710 124 30ff            movlw 255
711 125 00ab            movwf clock_adjust__error
712                     ;   error_minimum := 0xf0  
713 126 30f0            movlw 240
714 127 00ac            movwf clock_adjust__error_minimum
715                     ; Print out the target :
716                     ;   call master_send {{ 0c'T' }}  
717 128 3054            movlw 84
718 129 00de            movwf master_send__character
719 12a 253b            call master_send
720                     ;   call master_octal {{ iterations_high }}  
721 12b 3005            movlw 5
722 12c 00d1            movwf master_octal__number
723 12d 24c3            call master_octal
724                     ;   call master_octal {{ target }}  
725 12e 082f            movf clock_adjust__target,w
726 12f 00d1            movwf master_octal__number
727 130 24c3            call master_octal
728                     ;   call master_crlf {{ }}  
729 131 24ab            call master_crlf
730                     ; loop_forever ... start
731             clock_adjust__245loop__forever:
732                     ; Print out the clock value :
733                     ;   call master_send {{ 0c'C' }}  
734 132 3043            movlw 67
735 133 00de            movwf master_send__character
736 134 253b            call master_send
737                     ;   call slave_send {{ 0xfa }}  
738 135 30fa            movlw 250
739 136 00d4            movwf slave_send__data
740 137 24e2            call slave_send
741                     ;   call master_octal {{ slave_get {{ }} }}  
742 138 24dc            call slave_get
743 139 0853            movf slave_get__0return__byte,w
744 13a 00d1            movwf master_octal__number
745 13b 24c3            call master_octal
746                     ; Ask for a timing byte :
747                     ;   call slave_send {{ 0xfb }}  
748 13c 30fb            movlw 251
749 13d 00d4            movwf slave_send__data
750 13e 24e2            call slave_send
751                     ;   wait := 0  
752 13f 01b0            clrf clock_adjust__wait
753                     ;   low := 0  
754 140 01ae            clrf clock_adjust__low
755                     ;   high := 0  
756 141 01ad            clrf clock_adjust__high
757                     ; `while rx_slave_pin ...' start
758             clock_adjust__257while__continue:
759                     ; expression=`rx_slave_pin' exp_delay=0 true_delay=3  false_delay=2 true_size=2 false_size=1
760 142 1e86            btfss rx_slave_pin__byte,rx_slave_pin__bit
761 143 2946            goto clock_adjust__257while__break
762                     ; Do nothing :
763                     ;   wait := wait + 1  
764 144 0ab0            incf clock_adjust__wait,f
765 145 2942            goto clock_adjust__257while__continue
766                     ; if exp=`rx_slave_pin' false goto
767                     ; Other expression=`rx_slave_pin' delay=-1
768             clock_adjust__257while__break:
769                     ; `while rx_slave_pin ...' end
770                     ; `while  ! rx_slave_pin  ...' start
771             clock_adjust__261while__continue:
772                     ; expression=`rx_slave_pin' exp_delay=0 true_delay=2  false_delay=5 true_size=1 false_size=4
773 146 1a86            btfsc rx_slave_pin__byte,rx_slave_pin__bit
774 147 294c            goto clock_adjust__261while__break
775                     ;   low := low + 1  
776 148 0aae            incf clock_adjust__low,f
777                     ; if { z } start
778                     ; expression=`{ z }' exp_delay=0 true_delay=1  false_delay=0 true_size=1 false_size=0
779 149 1903            btfsc z__byte,z__bit
780                     ; if { z } body start
781                     ;   high := high + 1  
782 14a 0aad            incf clock_adjust__high,f
783                     ; if { z } body end
784                     ; if exp=`z' false skip delay=2
785                     ; Other expression=`{ z }' delay=2
786                     ; if { z } end
787 14b 2946            goto clock_adjust__261while__continue
788                     ; if exp=`rx_slave_pin' true goto
789                     ; Other expression=`rx_slave_pin' delay=-1
790             clock_adjust__261while__break:
791                     ; `while  ! rx_slave_pin  ...' end
792                     ; Print out high and low :
793                     ;   call master_send {{ 0c'H' }}  
794 14c 3048            movlw 72
795 14d 00de            movwf master_send__character
796 14e 253b            call master_send
797                     ;   call master_octal {{ high }}  
798 14f 082d            movf clock_adjust__high,w
799 150 00d1            movwf master_octal__number
800 151 24c3            call master_octal
801                     ;   call master_send {{ 0c'L' }}  
802 152 304c            movlw 76
803 153 00de            movwf master_send__character
804 154 253b            call master_send
805                     ;   call master_octal {{ low }}  
806 155 082e            movf clock_adjust__low,w
807 156 00d1            movwf master_octal__number
808 157 24c3            call master_octal
809                     ;   call master_send {{ 0c'W' }}  
810 158 3057            movlw 87
811 159 00de            movwf master_send__character
812 15a 253b            call master_send
813                     ;   call master_octal {{ wait }}  
814 15b 0830            movf clock_adjust__wait,w
815 15c 00d1            movwf master_octal__number
816 15d 24c3            call master_octal
817                     ; Now think about adjusting clock .
818                     ; if { high > iterations_high } start
819 15e 3006            movlw 6
820 15f 022d            subwf clock_adjust__high,w
821                     ; expression=`{ high > iterations_high }' exp_delay=2 true_delay=7  false_delay=-1 true_size=7 false_size=36
822 160 1803            btfsc c___byte,c___bit
823 161 2987            goto label277__0true
824             label277__0false:
825 162 3005            movlw 5
826 163 022d            subwf clock_adjust__high,w
827                     ; expression=`{ high < iterations_high }' exp_delay=2 true_delay=4  false_delay=-1 true_size=4 false_size=27
828 164 1c03            btfss c___byte,c___bit
829 165 2982            goto label281__0true
830             label281__0false:
831                     ; else body start
832                     ; The high 8 - bits are equal :
833                     ; if { low > target } start
834 166 082e            movf clock_adjust__low,w
835 167 022f            subwf clock_adjust__target,w
836                     ; expression=`{ low > target }' exp_delay=2 true_delay=7  false_delay=-1 true_size=7 false_size=15
837 168 1c03            btfss c___byte,c___bit
838 169 297a            goto label287__0true
839             label287__0false:
840 16a 082f            movf clock_adjust__target,w
841 16b 022e            subwf clock_adjust__low,w
842                     ; expression=`{ low < target }' exp_delay=2 true_delay=7  false_delay=3 true_size=7 false_size=3
843 16c 1c03            btfss c___byte,c___bit
844 16d 2972            goto label291__0true
845             label291__0false:
846                     ; else body start
847                     ; Exact match ; we are done :
848                     ;   command := 0  
849 16e 01a9            clrf clock_adjust__command
850                     ;   error := 0  
851 16f 01ab            clrf clock_adjust__error
852                     ;   error_minimum := 0  
853 170 01ac            clrf clock_adjust__error_minimum
854                     ; else body end
855 171 2979            goto label291__0end
856             label291__0true:
857                     ; else_if { low < target } body start
858                     ; Clock pulse is too short ; slave clock is too fast :
859                     ;   command := 0xf8  
860 172 30f8            movlw 248
861 173 00a9            movwf clock_adjust__command
862                     ;   error := target - low  
863 174 082f            movf clock_adjust__target,w
864 175 00b1            movwf clock_adjust__294byte0
865 176 082e            movf clock_adjust__low,w
866 177 0231            subwf clock_adjust__294byte0,w
867 178 00ab            movwf clock_adjust__error
868                     ; else_if { low < target } body end
869                     ; if exp=` low < target ' generic
870             label291__0end:
871                     ; Other expression=`{ low < target }' delay=-1
872 179 2981            goto label287__0end
873             label287__0true:
874                     ; if { low > target } body start
875                     ; Clock pulse is too long ; slave clock is too slow :
876                     ;   command := 0xf9  
877 17a 30f9            movlw 249
878 17b 00a9            movwf clock_adjust__command
879                     ;   error := low - target  
880 17c 082e            movf clock_adjust__low,w
881 17d 00b1            movwf clock_adjust__290byte0
882 17e 082f            movf clock_adjust__target,w
883 17f 0231            subwf clock_adjust__290byte0,w
884 180 00ab            movwf clock_adjust__error
885                     ; if { low > target } body end
886                     ; if exp=` low > target ' generic
887             label287__0end:
888                     ; Other expression=`{ low > target }' delay=-1
889                     ; if { low > target } end
890                     ; else body end
891 181 2986            goto label281__0end
892             label281__0true:
893                     ; else_if { high < iterations_high } body start
894                     ; Clock pulse is too short ; slave clock is too fast :
895                     ;   command := 0xf8  
896 182 30f8            movlw 248
897 183 00a9            movwf clock_adjust__command
898                     ;   error := target  
899 184 082f            movf clock_adjust__target,w
900 185 00ab            movwf clock_adjust__error
901                     ; else_if { high < iterations_high } body end
902                     ; if exp=` high < iterations_high ' generic
903             label281__0end:
904                     ; Other expression=`{ high < iterations_high }' delay=-1
905 186 298e            goto label277__0end
906             label277__0true:
907                     ; if { high > iterations_high } body start
908                     ; Clock pulse is too long ; slave clock is too slow :
909                     ;   command := 0xf9  
910 187 30f9            movlw 249
911 188 00a9            movwf clock_adjust__command
912                     ;   error := 0xff - target  
913 189 30ff            movlw 255
914 18a 00b1            movwf clock_adjust__280byte0
915 18b 082f            movf clock_adjust__target,w
916 18c 0231            subwf clock_adjust__280byte0,w
917 18d 00ab            movwf clock_adjust__error
918                     ; if { high > iterations_high } body end
919                     ; if exp=` high > iterations_high ' generic
920             label277__0end:
921                     ; Other expression=`{ high > iterations_high }' delay=-1
922                     ; if { high > iterations_high } end
923                     ; Print out the error and error minimum :
924                     ;   call master_send {{ 0c'E' }}  
925 18e 3045            movlw 69
926 18f 00de            movwf master_send__character
927 190 253b            call master_send
928                     ;   call master_octal {{ error }}  
929 191 082b            movf clock_adjust__error,w
930 192 00d1            movwf master_octal__number
931 193 24c3            call master_octal
932                     ;   call master_send {{ 0c'M' }}  
933 194 304d            movlw 77
934 195 00de            movwf master_send__character
935 196 253b            call master_send
936                     ;   call master_octal {{ error_minimum }}  
937 197 082c            movf clock_adjust__error_minimum,w
938 198 00d1            movwf master_octal__number
939 199 24c3            call master_octal
940                     ; if { error = error_minimum } start
941 19a 082b            movf clock_adjust__error,w
942 19b 022c            subwf clock_adjust__error_minimum,w
943                     ; expression=`{ error = error_minimum }' exp_delay=2 true_delay=-1  false_delay=-1 true_size=2 false_size=14
944 19c 1d03            btfss z___byte,z___bit
945 19d 29a1            goto label309__0false
946             label309__0true:
947                     ; if { error = error_minimum } body start
948                     ;   call master_crlf {{ }}  
949 19e 24ab            call master_crlf
950                     ;   return  
951 19f 3400            retlw 0
952                     ; if { error = error_minimum } body end
953 1a0 29af            goto label309__0end
954             label309__0false:
955 1a1 082c            movf clock_adjust__error_minimum,w
956 1a2 022b            subwf clock_adjust__error,w
957                     ; expression=`{ error < error_minimum }' exp_delay=2 true_delay=3  false_delay=-1 true_size=3 false_size=6
958 1a3 1c03            btfss c___byte,c___bit
959 1a4 29ac            goto label312__0true
960             label312__0false:
961                     ; else body start
962                     ;   count := count - 1  
963 1a5 03aa            decf clock_adjust__count,f
964                     ; if { z } start
965                     ; expression=`{ z }' exp_delay=0 true_delay=3  false_delay=0 true_size=3 false_size=0
966 1a6 1d03            btfss z__byte,z__bit
967 1a7 29ab            goto label317__0end
968                     ; if { z } body start
969                     ;   error_minimum := error_minimum + 1  
970 1a8 0aac            incf clock_adjust__error_minimum,f
971                     ;   count := 2  
972 1a9 3002            movlw 2
973 1aa 00aa            movwf clock_adjust__count
974                     ; if { z } body end
975             label317__0end:
976                     ; if exp=`z' empty false
977                     ; Other expression=`{ z }' delay=-1
978                     ; if { z } end
979                     ; else body end
980 1ab 29af            goto label312__0end
981             label312__0true:
982                     ; else_if { error < error_minimum } body start
983                     ;   error_minimum := error  
984 1ac 082b            movf clock_adjust__error,w
985 1ad 00ac            movwf clock_adjust__error_minimum
986                     ;   error := error + 1  
987 1ae 0aab            incf clock_adjust__error,f
988                     ; else_if { error < error_minimum } body end
989                     ; if exp=` error < error_minimum ' generic
990             label312__0end:
991                     ; Other expression=`{ error < error_minimum }' delay=-1
992                     ; if exp=` error = error_minimum ' generic
993             label309__0end:
994                     ; Other expression=`{ error = error_minimum }' delay=-1
995                     ; if { error = error_minimum } end
996                     ; Now adjust the clock :
997                     ;   call slave_send {{ command }}  
998 1af 0829            movf clock_adjust__command,w
999 1b0 00d4            movwf slave_send__data
1000 1b1 24e2            call slave_send
1001                     ;   call master_crlf {{ }}  
1002 1b2 24ab            call master_crlf
1003 1b3 2932            goto clock_adjust__245loop__forever
1004                     ; loop_forever ... end
1005                     ; procedure clock_adjust end
1006             
1007                     ; procedure test start
1008             test:
1009     0032    test__variables__base equ global__variables__bank0+18
1010     0032    test__bytes__base equ test__variables__base+0
1011     0036    test__bits__base equ test__variables__base+4
1012     0004    test__total__bytes equ 4
1013                     ;   arguments_none  
1014                     ; This procedure will test the Shaft2 RoboBrick :
1015     0032    test__channel equ test__bytes__base+0
1016     0033    test__index equ test__bytes__base+1
1017     0034    test__pattern equ test__bytes__base+2
1018     0035    test__result equ test__bytes__base+3
1019                     ; Verify that the common commands are working :
1020                     ;   call master_string {{ common_string }}  
1021 1b4 302b            movlw LOW common_string+1
1022 1b5 00df            movwf master_string__message
1023 1b6 2541            call master_string
1024                     ;   call master_string {{ test_string }}  
1025 1b7 3078            movlw LOW test_string+1
1026 1b8 00df            movwf master_string__message
1027 1b9 2541            call master_string
1028                     ;   call master_crlf {{ }}  
1029 1ba 24ab            call master_crlf
1030                     ;   call common_test {{ }}  
1031 1bb 2399            call common_test
1032                     ;   call interrupt_test {{ }}  
1033 1bc 243a            call interrupt_test
1034                     ; Test registers :
1035                     ;   call master_string {{ register_string }}  
1036 1bd 306e            movlw LOW register_string+1
1037 1be 00df            movwf master_string__message
1038 1bf 2541            call master_string
1039                     ;   call master_string {{ test_string }}  
1040 1c0 3078            movlw LOW test_string+1
1041 1c1 00df            movwf master_string__message
1042 1c2 2541            call master_string
1043                     ;   call master_crlf {{ }}  
1044 1c3 24ab            call master_crlf
1045                     ; Complement :
1046                     ;   call test_register_nibble {{ 0x20 , 8 , 0x30 }}  
1047 1c4 3020            movlw 32
1048 1c5 00b9            movwf test_register_nibble__set_command
1049 1c6 3008            movlw 8
1050 1c7 00ba            movwf test_register_nibble__get_command
1051 1c8 3030            movlw 48
1052 1c9 00bb            movwf test_register_nibble__error
1053 1ca 2319            call test_register_nibble
1054                     ; High :
1055                     ;   call test_register_nibble {{ 0x40 , 9 , 0x31 }}  
1056 1cb 3040            movlw 64
1057 1cc 00b9            movwf test_register_nibble__set_command
1058 1cd 3009            movlw 9
1059 1ce 00ba            movwf test_register_nibble__get_command
1060 1cf 3031            movlw 49
1061 1d0 00bb            movwf test_register_nibble__error
1062 1d1 2319            call test_register_nibble
1063                     ; Low :
1064                     ;   call test_register_nibble {{ 0x50 , 0xa , 0x32 }}  
1065 1d2 3050            movlw 80
1066 1d3 00b9            movwf test_register_nibble__set_command
1067 1d4 300a            movlw 10
1068 1d5 00ba            movwf test_register_nibble__get_command
1069 1d6 3032            movlw 50
1070 1d7 00bb            movwf test_register_nibble__error
1071 1d8 2319            call test_register_nibble
1072                     ; Raising :
1073                     ;   call test_register_nibble {{ 0x60 , 0xb , 0x33 }}  
1074 1d9 3060            movlw 96
1075 1da 00b9            movwf test_register_nibble__set_command
1076 1db 300b            movlw 11
1077 1dc 00ba            movwf test_register_nibble__get_command
1078 1dd 3033            movlw 51
1079 1de 00bb            movwf test_register_nibble__error
1080 1df 2319            call test_register_nibble
1081                     ; Falling :
1082                     ;   call test_register_nibble {{ 0x70 , 0xc , 0x34 }}  
1083 1e0 3070            movlw 112
1084 1e1 00b9            movwf test_register_nibble__set_command
1085 1e2 300c            movlw 12
1086 1e3 00ba            movwf test_register_nibble__get_command
1087 1e4 3034            movlw 52
1088 1e5 00bb            movwf test_register_nibble__error
1089 1e6 2319            call test_register_nibble
1090                     ; Test threshold registers :
1091                     ;   call master_string {{ threshold_string }}  
1092 1e7 307e            movlw LOW threshold_string+1
1093 1e8 00df            movwf master_string__message
1094 1e9 2541            call master_string
1095                     ;   call master_string {{ register_string }}  
1096 1ea 306e            movlw LOW register_string+1
1097 1eb 00df            movwf master_string__message
1098 1ec 2541            call master_string
1099                     ;   call master_string {{ test_string }}  
1100 1ed 3078            movlw LOW test_string+1
1101 1ee 00df            movwf master_string__message
1102 1ef 2541            call master_string
1103                     ;   call master_crlf {{ }}  
1104 1f0 24ab            call master_crlf
1105                     ;   channel := 0  
1106 1f1 01b2            clrf test__channel
1107                     ; `while  channel < 4  ...' start
1108             test__369while__continue:
1109 1f2 3004            movlw 4
1110 1f3 0232            subwf test__channel,w
1111                     ; expression=` channel < 4 ' exp_delay=2 true_delay=1  false_delay=2 true_size=77 false_size=1
1112 1f4 1803            btfsc c___byte,c___bit
1113 1f5 2a43            goto test__369while__break
1114                     ;   index := 0  
1115 1f6 01b3            clrf test__index
1116                     ; `while  index < patterns . size  ...' start
1117             test__371while__continue:
1118 1f7 300b            movlw 11
1119 1f8 0233            subwf test__index,w
1120                     ; expression=` index < patterns . size ' exp_delay=2 true_delay=1  false_delay=2 true_size=70 false_size=1
1121 1f9 1803            btfsc c___byte,c___bit
1122 1fa 2a41            goto test__371while__break
1123                     ;   pattern := patterns ~~ {{ index }}  
1124 1fb 0a33            incf test__index,w
1125 1fc 018a            clrf pclath___register
1126 1fd 2060            call patterns
1127 1fe 00b4            movwf test__pattern
1128                     ; Set high threshold :
1129                     ;   call slave_send {{ 0x18 | channel }}  
1130 1ff 3018            movlw 24
1131 200 0432            iorwf test__channel,w
1132 201 00d4            movwf slave_send__data
1133 202 24e2            call slave_send
1134                     ;   call slave_send {{ pattern }}  
1135 203 0834            movf test__pattern,w
1136 204 00d4            movwf slave_send__data
1137 205 24e2            call slave_send
1138                     ; Read high threshold :
1139                     ;   call slave_send {{ 0x10 | channel }}  
1140 206 3010            movlw 16
1141 207 0432            iorwf test__channel,w
1142 208 00d4            movwf slave_send__data
1143 209 24e2            call slave_send
1144                     ;   result := slave_get {{ }}  
1145 20a 24dc            call slave_get
1146 20b 0853            movf slave_get__0return__byte,w
1147 20c 00b5            movwf test__result
1148                     ; if { pattern != result } start
1149 20d 0834            movf test__pattern,w
1150 20e 0235            subwf test__result,w
1151                     ; expression=`{ pattern != result }' exp_delay=2 true_delay=6  false_delay=0 true_size=14 false_size=0
1152 20f 1903            btfsc z___byte,z___bit
1153 210 2a1f            goto label381__0end
1154                     ; if { pattern != result } body start
1155                     ;   call master_octal {{ channel }}  
1156 211 0832            movf test__channel,w
1157 212 00d1            movwf master_octal__number
1158 213 24c3            call master_octal
1159                     ;   call master_octal {{ pattern }}  
1160 214 0834            movf test__pattern,w
1161 215 00d1            movwf master_octal__number
1162 216 24c3            call master_octal
1163                     ;   call master_octal {{ result }}  
1164 217 0835            movf test__result,w
1165 218 00d1            movwf master_octal__number
1166 219 24c3            call master_octal
1167                     ;   call master_fail {{ threshold_string , 0x50 }}  
1168 21a 307e            movlw LOW threshold_string+1
1169 21b 00ce            movwf master_fail__test_name
1170 21c 3050            movlw 80
1171 21d 00cf            movwf master_fail__test_number
1172 21e 24b2            call master_fail
1173                     ; if { pattern != result } body end
1174             label381__0end:
1175                     ; if exp=` pattern != result ' empty false
1176                     ; Other expression=`{ pattern != result }' delay=-1
1177                     ; if { pattern != result } end
1178                     ; Set low threshold :
1179                     ;   call slave_send {{ 0x1c | channel }}  
1180 21f 301c            movlw 28
1181 220 0432            iorwf test__channel,w
1182 221 00d4            movwf slave_send__data
1183 222 24e2            call slave_send
1184                     ;   call slave_send {{ pattern }}  
1185 223 0834            movf test__pattern,w
1186 224 00d4            movwf slave_send__data
1187 225 24e2            call slave_send
1188                     ; Read high threshold :
1189                     ;   call slave_send {{ 0x14 | channel }}  
1190 226 3014            movlw 20
1191 227 0432            iorwf test__channel,w
1192 228 00d4            movwf slave_send__data
1193 229 24e2            call slave_send
1194                     ;   result := slave_get {{ }}  
1195 22a 24dc            call slave_get
1196 22b 0853            movf slave_get__0return__byte,w
1197 22c 00b5            movwf test__result
1198                     ; if { pattern != result } start
1199 22d 0834            movf test__pattern,w
1200 22e 0235            subwf test__result,w
1201                     ; expression=`{ pattern != result }' exp_delay=2 true_delay=6  false_delay=0 true_size=14 false_size=0
1202 22f 1903            btfsc z___byte,z___bit
1203 230 2a3f            goto label395__0end
1204                     ; if { pattern != result } body start
1205                     ;   call master_octal {{ channel }}  
1206 231 0832            movf test__channel,w
1207 232 00d1            movwf master_octal__number
1208 233 24c3            call master_octal
1209                     ;   call master_octal {{ pattern }}  
1210 234 0834            movf test__pattern,w
1211 235 00d1            movwf master_octal__number
1212 236 24c3            call master_octal
1213                     ;   call master_octal {{ result }}  
1214 237 0835            movf test__result,w
1215 238 00d1            movwf master_octal__number
1216 239 24c3            call master_octal
1217                     ;   call master_fail {{ threshold_string , 0x51 }}  
1218 23a 307e            movlw LOW threshold_string+1
1219 23b 00ce            movwf master_fail__test_name
1220 23c 3051            movlw 81
1221 23d 00cf            movwf master_fail__test_number
1222 23e 24b2            call master_fail
1223                     ; if { pattern != result } body end
1224             label395__0end:
1225                     ; if exp=` pattern != result ' empty false
1226                     ; Other expression=`{ pattern != result }' delay=-1
1227                     ; if { pattern != result } end
1228                     ;   index := index + 1  
1229 23f 0ab3            incf test__index,f
1230 240 29f7            goto test__371while__continue
1231                     ; if exp=` index < patterns . size ' false goto
1232                     ; Other expression=` index < patterns . size ' delay=-1
1233             test__371while__break:
1234                     ; `while  index < patterns . size  ...' end
1235                     ;   channel := channel + 1  
1236 241 0ab2            incf test__channel,f
1237 242 29f2            goto test__369while__continue
1238                     ; if exp=` channel < 4 ' false goto
1239                     ; Other expression=` channel < 4 ' delay=-1
1240             test__369while__break:
1241                     ; `while  channel < 4  ...' end
1242                     ; Set the Vref bit :
1243                     ;   call slave_send {{ 0xf }}  
1244 243 300f            movlw 15
1245 244 00d4            movwf slave_send__data
1246 245 24e2            call slave_send
1247                     ; Test Vref bit :
1248                     ;   call slave_send {{ 0xd }}  
1249 246 300d            movlw 13
1250 247 00d4            movwf slave_send__data
1251 248 24e2            call slave_send
1252                     ;   result := slave_get {{ }}  
1253 249 24dc            call slave_get
1254 24a 0853            movf slave_get__0return__byte,w
1255 24b 00b5            movwf test__result
1256                     ; if { result != 1 } start
1257 24c 0335            decf test__result,w
1258                     ; expression=`{ result != 1 }' exp_delay=1 true_delay=4  false_delay=0 true_size=8 false_size=0
1259 24d 1903            btfsc z___byte,z___bit
1260 24e 2a57            goto label411__0end
1261                     ; if { result != 1 } body start
1262                     ;   call master_octal {{ result }}  
1263 24f 0835            movf test__result,w
1264 250 00d1            movwf master_octal__number
1265 251 24c3            call master_octal
1266                     ;   call master_fail {{ register_string , 0x52 }}  
1267 252 306e            movlw LOW register_string+1
1268 253 00ce            movwf master_fail__test_name
1269 254 3052            movlw 82
1270 255 00cf            movwf master_fail__test_number
1271 256 24b2            call master_fail
1272                     ; if { result != 1 } body end
1273             label411__0end:
1274                     ; if exp=` result != 1 ' empty false
1275                     ; Other expression=`{ result != 1 }' delay=-1
1276                     ; if { result != 1 } end
1277                     ; Clear the Vref bit :
1278                     ;   call slave_send {{ 0xe }}  
1279 257 300e            movlw 14
1280 258 00d4            movwf slave_send__data
1281 259 24e2            call slave_send
1282                     ; Test Vref bit :
1283                     ;   call slave_send {{ 0xd }}  
1284 25a 300d            movlw 13
1285 25b 00d4            movwf slave_send__data
1286 25c 24e2            call slave_send
1287                     ;   result := slave_get {{ }}  
1288 25d 24dc            call slave_get
1289 25e 0853            movf slave_get__0return__byte,w
1290 25f 00b5            movwf test__result
1291                     ; if { result != 0 } start
1292                     ; expression=`{ result != 0 }' exp_delay=1 true_delay=4  false_delay=0 true_size=8 false_size=0
1293 260 1903            btfsc z___byte,z___bit
1294 261 2a6a            goto label420__0end
1295                     ; if { result != 0 } body start
1296                     ;   call master_octal {{ result }}  
1297 262 0835            movf test__result,w
1298 263 00d1            movwf master_octal__number
1299 264 24c3            call master_octal
1300                     ;   call master_fail {{ register_string , 0x53 }}  
1301 265 306e            movlw LOW register_string+1
1302 266 00ce            movwf master_fail__test_name
1303 267 3053            movlw 83
1304 268 00cf            movwf master_fail__test_number
1305 269 24b2            call master_fail
1306                     ; if { result != 0 } body end
1307             label420__0end:
1308                     ; if exp=` result != 0 ' empty false
1309                     ; Other expression=`{ result != 0 }' delay=-1
1310                     ; if { result != 0 } end
1311                     ; Now set all of the thresholds :
1312                     ;   channel := 0  
1313 26a 01b2            clrf test__channel
1314                     ; `while  channel < 4  ...' start
1315             test__427while__continue:
1316 26b 3004            movlw 4
1317 26c 0232            subwf test__channel,w
1318                     ; expression=` channel < 4 ' exp_delay=2 true_delay=9  false_delay=2 true_size=16 false_size=1
1319 26d 1803            btfsc c___byte,c___bit
1320 26e 2a7f            goto test__427while__break
1321                     ; Set high threshold :
1322                     ;   call slave_send {{ 0x18 | channel }}  
1323 26f 3018            movlw 24
1324 270 0432            iorwf test__channel,w
1325 271 00d4            movwf slave_send__data
1326 272 24e2            call slave_send
1327                     ;   call slave_send {{ 0xc0 }}  
1328 273 30c0            movlw 192
1329 274 00d4            movwf slave_send__data
1330 275 24e2            call slave_send
1331                     ; Set low threshold :
1332                     ;   call slave_send {{ 0x1c | channel }}  
1333 276 301c            movlw 28
1334 277 0432            iorwf test__channel,w
1335 278 00d4            movwf slave_send__data
1336 279 24e2            call slave_send
1337                     ;   call slave_send {{ 0x40 }}  
1338 27a 3040            movlw 64
1339 27b 00d4            movwf slave_send__data
1340 27c 24e2            call slave_send
1341                     ;   channel := channel + 1  
1342 27d 0ab2            incf test__channel,f
1343 27e 2a6b            goto test__427while__continue
1344                     ; if exp=` channel < 4 ' false goto
1345                     ; Other expression=` channel < 4 ' delay=-1
1346             test__427while__break:
1347                     ; `while  channel < 4  ...' end
1348                     ; Test some shaft inputs :
1349                     ;   call master_string {{ input_string }}  
1350 27f 304f            movlw LOW input_string+1
1351 280 00df            movwf master_string__message
1352 281 2541            call master_string
1353                     ;   call master_string {{ test_string }}  
1354 282 3078            movlw LOW test_string+1
1355 283 00df            movwf master_string__message
1356 284 2541            call master_string
1357                     ;   call master_crlf {{ }}  
1358 285 24ab            call master_crlf
1359                     ; Set all inputs low :
1360                     ;   call test_input {{ 0 , 0 }}  
1361 286 01b6            clrf test_input__channel
1362 287 01b7            clrf test_input__target
1363 288 22ed            call test_input
1364                     ;   call test_input {{ 1 , 0 }}  
1365 289 3001            movlw 1
1366 28a 00b6            movwf test_input__channel
1367 28b 01b7            clrf test_input__target
1368 28c 22ed            call test_input
1369                     ;   call test_input {{ 2 , 0 }}  
1370 28d 3002            movlw 2
1371 28e 00b6            movwf test_input__channel
1372 28f 01b7            clrf test_input__target
1373 290 22ed            call test_input
1374                     ;   call test_input {{ 3 , 0 }}  
1375 291 3003            movlw 3
1376 292 00b6            movwf test_input__channel
1377 293 01b7            clrf test_input__target
1378 294 22ed            call test_input
1379                     ;   call test_binary {{ 0 , 0x60 }}  
1380 295 01be            clrf test_binary__pattern
1381 296 3060            movlw 96
1382 297 00bf            movwf test_binary__error
1383 298 233d            call test_binary
1384                     ; Set all inputs high , one by one :
1385                     ;   call test_input {{ 0 , 0xff }}  
1386 299 01b6            clrf test_input__channel
1387 29a 30ff            movlw 255
1388 29b 00b7            movwf test_input__target
1389 29c 22ed            call test_input
1390                     ;   call test_binary {{ 1 , 0x64 }}  
1391 29d 3001            movlw 1
1392 29e 00be            movwf test_binary__pattern
1393 29f 3064            movlw 100
1394 2a0 00bf            movwf test_binary__error
1395 2a1 233d            call test_binary
1396                     ;   call test_input {{ 1 , 0xff }}  
1397 2a2 3001            movlw 1
1398 2a3 00b6            movwf test_input__channel
1399 2a4 30ff            movlw 255
1400 2a5 00b7            movwf test_input__target
1401 2a6 22ed            call test_input
1402                     ;   call test_binary {{ 3 , 0x68 }}  
1403 2a7 3003            movlw 3
1404 2a8 00be            movwf test_binary__pattern
1405 2a9 3068            movlw 104
1406 2aa 00bf            movwf test_binary__error
1407 2ab 233d            call test_binary
1408                     ;   call test_input {{ 2 , 0xff }}  
1409 2ac 3002            movlw 2
1410 2ad 00b6            movwf test_input__channel
1411 2ae 30ff            movlw 255
1412 2af 00b7            movwf test_input__target
1413 2b0 22ed            call test_input
1414                     ;   call test_binary {{ 7 , 0x6c }}  
1415 2b1 3007            movlw 7
1416 2b2 00be            movwf test_binary__pattern
1417 2b3 306c            movlw 108
1418 2b4 00bf            movwf test_binary__error
1419 2b5 233d            call test_binary
1420                     ;   call test_input {{ 3 , 0xff }}  
1421 2b6 3003            movlw 3
1422 2b7 00b6            movwf test_input__channel
1423 2b8 30ff            movlw 255
1424 2b9 00b7            movwf test_input__target
1425 2ba 22ed            call test_input
1426                     ;   call test_binary {{ 0xf , 0x70 }}  
1427 2bb 300f            movlw 15
1428 2bc 00be            movwf test_binary__pattern
1429 2bd 3070            movlw 112
1430 2be 00bf            movwf test_binary__error
1431 2bf 233d            call test_binary
1432                     ; Now do some interrupt tests :
1433                     ; Low :
1434                     ;   call test_interrupt {{ 0x50 , 0 }}  
1435 2c0 3050            movlw 80
1436 2c1 00c1            movwf test_interrupt__mask_set_command
1437 2c2 01c2            clrf test_interrupt__target
1438 2c3 2384            call test_interrupt
1439                     ; High :
1440                     ;   call test_interrupt {{ 0x40 , 0xff }}  
1441 2c4 3040            movlw 64
1442 2c5 00c1            movwf test_interrupt__mask_set_command
1443 2c6 30ff            movlw 255
1444 2c7 00c2            movwf test_interrupt__target
1445 2c8 2384            call test_interrupt
1446                     ; Falling :
1447                     ;   call test_interrupt {{ 0x70 , 0 }}  
1448 2c9 3070            movlw 112
1449 2ca 00c1            movwf test_interrupt__mask_set_command
1450 2cb 01c2            clrf test_interrupt__target
1451 2cc 2384            call test_interrupt
1452                     ; Raising :
1453                     ;   call test_interrupt {{ 0x60 , 0xff }}  
1454 2cd 3060            movlw 96
1455 2ce 00c1            movwf test_interrupt__mask_set_command
1456 2cf 30ff            movlw 255
1457 2d0 00c2            movwf test_interrupt__target
1458 2d1 2384            call test_interrupt
1459                     ; Set channel 1 to half value :
1460                     ;   call test_input {{ 1 , 0x80 }}  
1461 2d2 3001            movlw 1
1462 2d3 00b6            movwf test_input__channel
1463 2d4 3080            movlw 128
1464 2d5 00b7            movwf test_input__target
1465 2d6 22ed            call test_input
1466                     ; Lastly put the puppy in Vref mode :
1467                     ;   call slave_send {{ 0xf }}  
1468 2d7 300f            movlw 15
1469 2d8 00d4            movwf slave_send__data
1470 2d9 24e2            call slave_send
1471                     ;   call test_input {{ 0 , 0x80 }}  
1472 2da 01b6            clrf test_input__channel
1473 2db 3080            movlw 128
1474 2dc 00b7            movwf test_input__target
1475 2dd 22ed            call test_input
1476                     ;   call test_input {{ 2 , 0x80 }}  
1477 2de 3002            movlw 2
1478 2df 00b6            movwf test_input__channel
1479 2e0 3080            movlw 128
1480 2e1 00b7            movwf test_input__target
1481 2e2 22ed            call test_input
1482                     ;   call test_input {{ 3 , 0x80 }}  
1483 2e3 3003            movlw 3
1484 2e4 00b6            movwf test_input__channel
1485 2e5 3080            movlw 128
1486 2e6 00b7            movwf test_input__target
1487 2e7 22ed            call test_input
1488                     ; Say we are done :
1489                     ;   call master_string {{ done_string }}  
1490 2e8 3033            movlw LOW done_string+1
1491 2e9 00df            movwf master_string__message
1492 2ea 2541            call master_string
1493                     ;   call master_crlf {{ }}  
1494 2eb 24ab            call master_crlf
1495                     ; procedure test end
1496 2ec 3400            retlw 0
1497             
1498                     ; procedure test_input start
1499             test_input:
1500     0036    test_input__variables__base equ global__variables__bank0+22
1501     0036    test_input__bytes__base equ test_input__variables__base+0
1502     0039    test_input__bits__base equ test_input__variables__base+3
1503     0003    test_input__total__bytes equ 3
1504     0036    test_input__channel equ test_input__bytes__base+0
1505     0037    test_input__target equ test_input__bytes__base+1
1506                     ; This procedure will verify that we can input a value of < target >
1507                     ; from < channel > .
1508     0038    test_input__actual equ test_input__bytes__base+2
1509                     ;   actual := target ^ 0x55  
1510 2ed 3055            movlw 85
1511 2ee 0637            xorwf test_input__target,w
1512 2ef 00b8            movwf test_input__actual
1513                     ; `while  actual != target  ...' start
1514             test_input__495while__continue:
1515 2f0 0838            movf test_input__actual,w
1516 2f1 0237            subwf test_input__target,w
1517                     ; expression=` actual != target ' exp_delay=2 true_delay=20  false_delay=2 true_size=36 false_size=1
1518 2f2 1903            btfsc z___byte,z___bit
1519 2f3 2b17            goto test_input__495while__break
1520                     ;   call master_send {{ cr }}  
1521 2f4 300d            movlw 13
1522 2f5 00de            movwf master_send__character
1523 2f6 253b            call master_send
1524                     ;   call master_string {{ channel_string }}  
1525 2f7 301d            movlw LOW channel_string+1
1526 2f8 00df            movwf master_string__message
1527 2f9 2541            call master_string
1528                     ;   call master_octal {{ channel }}  
1529 2fa 0836            movf test_input__channel,w
1530 2fb 00d1            movwf master_octal__number
1531 2fc 24c3            call master_octal
1532                     ;   call master_string {{ input_string }}  
1533 2fd 304f            movlw LOW input_string+1
1534 2fe 00df            movwf master_string__message
1535 2ff 2541            call master_string
1536                     ;   call slave_send {{ channel }}  
1537 300 0836            movf test_input__channel,w
1538 301 00d4            movwf slave_send__data
1539 302 24e2            call slave_send
1540                     ;   actual := slave_get {{ }}  
1541 303 24dc            call slave_get
1542 304 0853            movf slave_get__0return__byte,w
1543 305 00b8            movwf test_input__actual
1544                     ;   call master_octal {{ actual }}  
1545 306 00d1            movwf master_octal__number
1546 307 24c3            call master_octal
1547                     ; if { actual = target } start
1548 308 0838            movf test_input__actual,w
1549 309 0237            subwf test_input__target,w
1550                     ; expression=`{ actual = target }' exp_delay=2 true_delay=-1  false_delay=-1 true_size=1 false_size=1
1551 30a 1903            btfsc z___byte,z___bit
1552                     ; if { actual = target } body start
1553                     ;   call master_send {{ 0c'=' }}  
1554 30b 303d            movlw 61
1555                     ; 2 instructions found for sharing
1556 30c 1d03            btfss z___byte,z___bit
1557                     ; else body start
1558                     ;   call master_send {{ 0c'~' }}  
1559 30d 307e            movlw 126
1560                     ; 2 instructions found for sharing
1561                     ; if exp=` actual = target ' single true and false skip delay=6
1562                     ; Other expression=`{ actual = target }' delay=6
1563                     ; 2 shared instructions follow
1564 30e 00de            movwf master_send__character
1565 30f 253b            call master_send
1566                     ; if { actual = target } end
1567                     ;   call master_octal {{ target }}  
1568 310 0837            movf test_input__target,w
1569 311 00d1            movwf master_octal__number
1570 312 24c3            call master_octal
1571                     ;   call master_send {{ 0c':' }}  
1572 313 303a            movlw 58
1573 314 00de            movwf master_send__character
1574 315 253b            call master_send
1575 316 2af0            goto test_input__495while__continue
1576                     ; if exp=` actual != target ' false goto
1577                     ; Other expression=` actual != target ' delay=-1
1578             test_input__495while__break:
1579                     ; `while  actual != target  ...' end
1580                     ;   call master_crlf {{ }}  
1581 317 24ab            call master_crlf
1582                     ; procedure test_input end
1583 318 3400            retlw 0
1584             
1585                     ; procedure test_register_nibble start
1586             test_register_nibble:
1587     0039    test_register_nibble__variables__base equ global__variables__bank0+25
1588     0039    test_register_nibble__bytes__base equ test_register_nibble__variables__base+0
1589     003e    test_register_nibble__bits__base equ test_register_nibble__variables__base+5
1590     0005    test_register_nibble__total__bytes equ 5
1591     0039    test_register_nibble__set_command equ test_register_nibble__bytes__base+0
1592     003a    test_register_nibble__get_command equ test_register_nibble__bytes__base+1
1593     003b    test_register_nibble__error equ test_register_nibble__bytes__base+2
1594                     ; This procedure will verify that the register that is set with
1595                     ; < set_command > and read with < get_command > can take values between
1596                     ; 0 and < maximum > . If there are any problems < error > is used as the
1597                     ; error code .
1598     003c    test_register_nibble__value equ test_register_nibble__bytes__base+3
1599     003d    test_register_nibble__result equ test_register_nibble__bytes__base+4
1600                     ;   value := 0  
1601 319 01bc            clrf test_register_nibble__value
1602                     ; `while  value < 16  ...' start
1603             test_register_nibble__529while__continue:
1604 31a 3010            movlw 16
1605 31b 023c            subwf test_register_nibble__value,w
1606                     ; expression=` value < 16 ' exp_delay=2 true_delay=1  false_delay=2 true_size=27 false_size=1
1607 31c 1803            btfsc c___byte,c___bit
1608 31d 2b39            goto test_register_nibble__529while__break
1609                     ;   call slave_send {{ set_command | value }}  
1610 31e 0839            movf test_register_nibble__set_command,w
1611 31f 043c            iorwf test_register_nibble__value,w
1612 320 00d4            movwf slave_send__data
1613 321 24e2            call slave_send
1614                     ;   call slave_send {{ get_command }}  
1615 322 083a            movf test_register_nibble__get_command,w
1616 323 00d4            movwf slave_send__data
1617 324 24e2            call slave_send
1618                     ;   result := slave_get {{ }}  
1619 325 24dc            call slave_get
1620 326 0853            movf slave_get__0return__byte,w
1621 327 00bd            movwf test_register_nibble__result
1622                     ; if { value != result } start
1623 328 083c            movf test_register_nibble__value,w
1624 329 023d            subwf test_register_nibble__result,w
1625                     ; expression=`{ value != result }' exp_delay=2 true_delay=5  false_delay=0 true_size=11 false_size=0
1626 32a 1903            btfsc z___byte,z___bit
1627 32b 2b37            goto label533__0end
1628                     ; if { value != result } body start
1629                     ;   call master_octal {{ value }}  
1630 32c 083c            movf test_register_nibble__value,w
1631 32d 00d1            movwf master_octal__number
1632 32e 24c3            call master_octal
1633                     ;   call master_octal {{ result }}  
1634 32f 083d            movf test_register_nibble__result,w
1635 330 00d1            movwf master_octal__number
1636 331 24c3            call master_octal
1637                     ;   call master_fail {{ register_string , error }}  
1638 332 306e            movlw LOW register_string+1
1639 333 00ce            movwf master_fail__test_name
1640 334 083b            movf test_register_nibble__error,w
1641 335 00cf            movwf master_fail__test_number
1642 336 24b2            call master_fail
1643                     ; if { value != result } body end
1644             label533__0end:
1645                     ; if exp=` value != result ' empty false
1646                     ; Other expression=`{ value != result }' delay=-1
1647                     ; if { value != result } end
1648                     ;   value := value + 1  
1649 337 0abc            incf test_register_nibble__value,f
1650 338 2b1a            goto test_register_nibble__529while__continue
1651                     ; if exp=` value < 16 ' false goto
1652                     ; Other expression=` value < 16 ' delay=-1
1653             test_register_nibble__529while__break:
1654                     ; `while  value < 16  ...' end
1655                     ; Clear the pattern :
1656                     ;   call slave_send {{ set_command }}  
1657 339 0839            movf test_register_nibble__set_command,w
1658 33a 00d4            movwf slave_send__data
1659 33b 24e2            call slave_send
1660                     ; procedure test_register_nibble end
1661 33c 3400            retlw 0
1662             
1663                     ; procedure test_binary start
1664             test_binary:
1665     003e    test_binary__variables__base equ global__variables__bank0+30
1666     003e    test_binary__bytes__base equ test_binary__variables__base+0
1667     0041    test_binary__bits__base equ test_binary__variables__base+3
1668     0003    test_binary__total__bytes equ 3
1669     003e    test_binary__pattern equ test_binary__bytes__base+0
1670     003f    test_binary__error equ test_binary__bytes__base+1
1671                     ; This procedure will verify that the binary pattern matches < pattern > .
1672                     ; If it does not , < error > is the error code used .
1673     0040    test_binary__result equ test_binary__bytes__base+2
1674                     ; First verify that we read out the correct pattern :
1675                     ;   call slave_send {{ 4 }}  
1676 33d 3004            movlw 4
1677 33e 00d4            movwf slave_send__data
1678 33f 24e2            call slave_send
1679                     ;   result := slave_get {{ }}  
1680 340 24dc            call slave_get
1681 341 0853            movf slave_get__0return__byte,w
1682 342 00c0            movwf test_binary__result
1683                     ; if { result != pattern } start
1684 343 023e            subwf test_binary__pattern,w
1685                     ; expression=`{ result != pattern }' exp_delay=2 true_delay=5  false_delay=0 true_size=11 false_size=0
1686 344 1903            btfsc z___byte,z___bit
1687 345 2b51            goto label557__0end
1688                     ; if { result != pattern } body start
1689                     ;   call master_octal {{ pattern }}  
1690 346 083e            movf test_binary__pattern,w
1691 347 00d1            movwf master_octal__number
1692 348 24c3            call master_octal
1693                     ;   call master_octal {{ result }}  
1694 349 0840            movf test_binary__result,w
1695 34a 00d1            movwf master_octal__number
1696 34b 24c3            call master_octal
1697                     ;   call master_fail {{ binary_string , error }}  
1698 34c 3010            movlw LOW binary_string+1
1699 34d 00ce            movwf master_fail__test_name
1700 34e 083f            movf test_binary__error,w
1701 34f 00cf            movwf master_fail__test_number
1702 350 24b2            call master_fail
1703                     ; if { result != pattern } body end
1704             label557__0end:
1705                     ; if exp=` result != pattern ' empty false
1706                     ; Other expression=`{ result != pattern }' delay=-1
1707                     ; if { result != pattern } end
1708                     ; Test complement :
1709                     ;   call slave_send {{ 0x2f }}  
1710 351 302f            movlw 47
1711 352 00d4            movwf slave_send__data
1712 353 24e2            call slave_send
1713                     ;   call slave_send {{ 4 }}  
1714 354 3004            movlw 4
1715 355 00d4            movwf slave_send__data
1716 356 24e2            call slave_send
1717                     ;   result := slave_get {{ }}  
1718 357 24dc            call slave_get
1719 358 0853            movf slave_get__0return__byte,w
1720 359 00c0            movwf test_binary__result
1721                     ; if { result != pattern ^ 0xf } start
1722 35a 300f            movlw 15
1723 35b 063e            xorwf test_binary__pattern,w
1724 35c 0240            subwf test_binary__result,w
1725                     ; expression=`{ result != pattern ^ 0xf }' exp_delay=3 true_delay=6  false_delay=0 true_size=12 false_size=0
1726 35d 1903            btfsc z___byte,z___bit
1727 35e 2b6b            goto label567__0end
1728                     ; if { result != pattern ^ 0xf } body start
1729                     ;   call master_octal {{ pattern }}  
1730 35f 083e            movf test_binary__pattern,w
1731 360 00d1            movwf master_octal__number
1732 361 24c3            call master_octal
1733                     ;   call master_octal {{ result }}  
1734 362 0840            movf test_binary__result,w
1735 363 00d1            movwf master_octal__number
1736 364 24c3            call master_octal
1737                     ;   call master_fail {{ binary_string , error | 1 }}  
1738 365 3010            movlw LOW binary_string+1
1739 366 00ce            movwf master_fail__test_name
1740 367 3001            movlw 1
1741 368 043f            iorwf test_binary__error,w
1742 369 00cf            movwf master_fail__test_number
1743 36a 24b2            call master_fail
1744                     ; if { result != pattern ^ 0xf } body end
1745             label567__0end:
1746                     ; if exp=` result != pattern ^ 0xf ' empty false
1747                     ; Other expression=`{ result != pattern ^ 0xf }' delay=-1
1748                     ; if { result != pattern ^ 0xf } end
1749                     ; Test raw :
1750                     ;   call slave_send {{ 5 }}  
1751 36b 3005            movlw 5
1752 36c 00d4            movwf slave_send__data
1753 36d 24e2            call slave_send
1754                     ;   result := slave_get {{ }}  
1755 36e 24dc            call slave_get
1756 36f 0853            movf slave_get__0return__byte,w
1757 370 00c0            movwf test_binary__result
1758                     ; if { result != pattern } start
1759 371 023e            subwf test_binary__pattern,w
1760                     ; expression=`{ result != pattern }' exp_delay=2 true_delay=6  false_delay=0 true_size=12 false_size=0
1761 372 1903            btfsc z___byte,z___bit
1762 373 2b80            goto label576__0end
1763                     ; if { result != pattern } body start
1764                     ;   call master_octal {{ pattern }}  
1765 374 083e            movf test_binary__pattern,w
1766 375 00d1            movwf master_octal__number
1767 376 24c3            call master_octal
1768                     ;   call master_octal {{ result }}  
1769 377 0840            movf test_binary__result,w
1770 378 00d1            movwf master_octal__number
1771 379 24c3            call master_octal
1772                     ;   call master_fail {{ binary_string , error | 2 }}  
1773 37a 3010            movlw LOW binary_string+1
1774 37b 00ce            movwf master_fail__test_name
1775 37c 3002            movlw 2
1776 37d 043f            iorwf test_binary__error,w
1777 37e 00cf            movwf master_fail__test_number
1778 37f 24b2            call master_fail
1779                     ; if { result != pattern } body end
1780             label576__0end:
1781                     ; if exp=` result != pattern ' empty false
1782                     ; Other expression=`{ result != pattern }' delay=-1
1783                     ; if { result != pattern } end
1784                     ; Reset complement :
1785                     ;   call slave_send {{ 0x20 }}  
1786 380 3020            movlw 32
1787 381 00d4            movwf slave_send__data
1788 382 24e2            call slave_send
1789                     ; procedure test_binary end
1790 383 3400            retlw 0
1791             
1792                     ; procedure test_interrupt start
1793             test_interrupt:
1794     0041    test_interrupt__variables__base equ global__variables__bank0+33
1795     0041    test_interrupt__bytes__base equ test_interrupt__variables__base+0
1796     0043    test_interrupt__bits__base equ test_interrupt__variables__base+2
1797     0002    test_interrupt__total__bytes equ 2
1798     0041    test_interrupt__mask_set_command equ test_interrupt__bytes__base+0
1799     0042    test_interrupt__target equ test_interrupt__bytes__base+1
1800                     ; This procedure will test interrupts shaft .
1801                     ; Set mask bit :
1802                     ;   call slave_send {{ mask_set_command | 1 }}  
1803 384 3001            movlw 1
1804 385 0441            iorwf test_interrupt__mask_set_command,w
1805 386 00d4            movwf slave_send__data
1806 387 24e2            call slave_send
1807                     ;   call master_octal {{ target }}  
1808 388 0842            movf test_interrupt__target,w
1809 389 00d1            movwf master_octal__number
1810 38a 24c3            call master_octal
1811                     ;   call master_send {{ 0c':' }}  
1812 38b 303a            movlw 58
1813 38c 00de            movwf master_send__character
1814 38d 253b            call master_send
1815                     ; Set interrupt enable and clear interrupt pending :
1816                     ;   call slave_send {{ 0xf2 }}  
1817 38e 30f2            movlw 242
1818 38f 00d4            movwf slave_send__data
1819 390 24e2            call slave_send
1820                     ; Wait for an interrupt :
1821                     ; `while rx_slave_pin ...' start
1822             test_interrupt__603while__continue:
1823                     ; expression=`rx_slave_pin' exp_delay=0 true_delay=2  false_delay=2 true_size=1 false_size=1
1824 391 1a86            btfsc rx_slave_pin__byte,rx_slave_pin__bit
1825                     ; Wait for bit to go low :
1826 392 2b91            goto test_interrupt__603while__continue
1827 393 2b94            goto test_interrupt__603while__break
1828                     ; if exp=`rx_slave_pin' true goto small true
1829             test_interrupt__603while__break:
1830                     ; `while rx_slave_pin ...' end
1831                     ; Clear mask bit :
1832                     ;   call slave_send {{ mask_set_command }}  
1833 394 0841            movf test_interrupt__mask_set_command,w
1834 395 00d4            movwf slave_send__data
1835 396 24e2            call slave_send
1836                     ;   call master_crlf {{ }}  
1837 397 24ab            call master_crlf
1838                     ; procedure test_interrupt end
1839 398 3400            retlw 0
1840                     ; comment {The procedures below are used to test the common shared commands :}
1841             
1842                     ; procedure common_test start
1843             common_test:
1844     0043    common_test__variables__base equ global__variables__bank0+35
1845     0043    common_test__bytes__base equ common_test__variables__base+0
1846     0045    common_test__bits__base equ common_test__variables__base+2
1847     0002    common_test__total__bytes equ 2
1848     0044    common_test__658byte0 equ common_test__bytes__base+1
1849                     ;   arguments_none  
1850                     ; This procedure will verify that the common shared commands work .
1851     0043    common_test__actual equ common_test__bytes__base+0
1852                     ; Print the ID information :
1853                     ; ID reset :
1854                     ;   call slave_send {{ 0xfd }}  
1855 399 30fd            movlw 253
1856 39a 00d4            movwf slave_send__data
1857 39b 24e2            call slave_send
1858                     ; Read the fixed bytes :
1859                     ;   call common_test_id_match {{ 1 , 0xc0 }}  
1860 39c 3001            movlw 1
1861 39d 00c5            movwf common_test_id_match__desired
1862 39e 30c0            movlw 192
1863 39f 00c6            movwf common_test_id_match__test_number
1864 3a0 240f            call common_test_id_match
1865                     ;   call common_test_id_match {{ 0 , 0xc1 }}  
1866 3a1 01c5            clrf common_test_id_match__desired
1867 3a2 30c1            movlw 193
1868 3a3 00c6            movwf common_test_id_match__test_number
1869 3a4 240f            call common_test_id_match
1870                     ;   call common_test_id_match {{ 12 , 0xc2 }}  
1871 3a5 300c            movlw 12
1872 3a6 00c5            movwf common_test_id_match__desired
1873 3a7 30c2            movlw 194
1874 3a8 00c6            movwf common_test_id_match__test_number
1875 3a9 240f            call common_test_id_match
1876                     ;   call common_test_id_match {{ 1 , 0xc3 }}  
1877 3aa 3001            movlw 1
1878 3ab 00c5            movwf common_test_id_match__desired
1879 3ac 30c3            movlw 195
1880 3ad 00c6            movwf common_test_id_match__test_number
1881 3ae 240f            call common_test_id_match
1882                     ;   call common_test_id_match {{ 0 , 0xc4 }}  
1883 3af 01c5            clrf common_test_id_match__desired
1884 3b0 30c4            movlw 196
1885 3b1 00c6            movwf common_test_id_match__test_number
1886 3b2 240f            call common_test_id_match
1887                     ;   call common_test_id_match {{ 0 , 0xc5 }}  
1888 3b3 01c5            clrf common_test_id_match__desired
1889 3b4 30c5            movlw 197
1890 3b5 00c6            movwf common_test_id_match__test_number
1891 3b6 240f            call common_test_id_match
1892                     ;   call common_test_id_match {{ 0 , 0xc6 }}  
1893 3b7 01c5            clrf common_test_id_match__desired
1894 3b8 30c6            movlw 198
1895 3b9 00c6            movwf common_test_id_match__test_number
1896 3ba 240f            call common_test_id_match
1897                     ;   call common_test_id_match {{ 0 , 0xc7 }}  
1898 3bb 01c5            clrf common_test_id_match__desired
1899 3bc 30c7            movlw 199
1900 3bd 00c6            movwf common_test_id_match__test_number
1901 3be 240f            call common_test_id_match
1902                     ;   call master_crlf {{ }}  
1903 3bf 24ab            call master_crlf
1904                     ;   call common_test_id_bytes8 {{ }}  
1905 3c0 241e            call common_test_id_bytes8
1906                     ;   call common_test_id_bytes8 {{ }}  
1907 3c1 241e            call common_test_id_bytes8
1908                     ; Read the brick name :
1909                     ;   call common_test_id_string {{ }}  
1910 3c2 2428            call common_test_id_string
1911                     ; Read the vendor name :
1912                     ;   call common_test_id_string {{ }}  
1913 3c3 2428            call common_test_id_string
1914                     ; Verfify that we don ' t read off the end of the id and crash :
1915                     ;   call common_test_id_next {{ }}  
1916 3c4 2433            call common_test_id_next
1917 3c5 084a            movf common_test_id_next__0return__byte,w
1918                     ; Reset id :
1919                     ;   call slave_send {{ 0xfd }}  
1920 3c6 30fd            movlw 253
1921 3c7 00d4            movwf slave_send__data
1922 3c8 24e2            call slave_send
1923                     ; Verify that we are still alive :
1924                     ;   call common_test_id_match {{ 1 , 0xc8 }}  
1925 3c9 3001            movlw 1
1926 3ca 00c5            movwf common_test_id_match__desired
1927 3cb 30c8            movlw 200
1928 3cc 00c6            movwf common_test_id_match__test_number
1929 3cd 240f            call common_test_id_match
1930                     ; Read glitch :
1931                     ; Clear glitch register :
1932                     ;   call slave_send {{ 0xfe }}  
1933 3ce 30fe            movlw 254
1934 3cf 00d4            movwf slave_send__data
1935 3d0 24e2            call slave_send
1936                     ;   actual := slave_get {{ }}  
1937 3d1 24dc            call slave_get
1938 3d2 0853            movf slave_get__0return__byte,w
1939 3d3 00c3            movwf common_test__actual
1940                     ; Send a couple of glitches :
1941                     ;   call slave_send {{ 0xff }}  
1942 3d4 30ff            movlw 255
1943 3d5 00d4            movwf slave_send__data
1944 3d6 24e2            call slave_send
1945                     ;   call slave_send {{ 0xff }}  
1946 3d7 30ff            movlw 255
1947 3d8 00d4            movwf slave_send__data
1948 3d9 24e2            call slave_send
1949                     ; Read the glitch register :
1950                     ;   call slave_send {{ 0xfe }}  
1951 3da 30fe            movlw 254
1952 3db 00d4            movwf slave_send__data
1953 3dc 24e2            call slave_send
1954                     ; if { slave_get {{ }} != 2 } start
1955 3dd 24dc            call slave_get
1956 3de 0853            movf slave_get__0return__byte,w
1957 3df 00c4            movwf common_test__658byte0
1958 3e0 3002            movlw 2
1959 3e1 0244            subwf common_test__658byte0,w
1960                     ; expression=`{ slave_get {{ }} != 2 }' exp_delay=3 true_delay=3  false_delay=0 true_size=5 false_size=0
1961 3e2 1903            btfsc z___byte,z___bit
1962 3e3 2be9            goto label658__1end
1963                     ; if { slave_get {{ }} != 2 } body start
1964                     ;   call master_fail {{ common_string , 0xc9 }}  
1965 3e4 302b            movlw LOW common_string+1
1966 3e5 00ce            movwf master_fail__test_name
1967 3e6 30c9            movlw 201
1968 3e7 00cf            movwf master_fail__test_number
1969 3e8 24b2            call master_fail
1970                     ; if { slave_get {{ }} != 2 } body end
1971             label658__1end:
1972                     ; if exp=` slave_get ## {{ }} != 2 ' empty false
1973                     ; Other expression=`{ slave_get {{ }} != 2 }' delay=-1
1974                     ; if { slave_get {{ }} != 2 } end
1975                     ; Do a clock pulse :
1976                     ;   call slave_send {{ 0xfb }}  
1977 3e9 30fb            movlw 251
1978 3ea 00d4            movwf slave_send__data
1979 3eb 24e2            call slave_send
1980                     ; if { slave_get {{ }} != 0 } start
1981 3ec 24dc            call slave_get
1982 3ed 0853            movf slave_get__0return__byte,w
1983                     ; expression=`{ slave_get {{ }} != 0 }' exp_delay=0 true_delay=3  false_delay=0 true_size=5 false_size=0
1984 3ee 1903            btfsc z___byte,z___bit
1985 3ef 2bf5            goto label664__0end
1986                     ; if { slave_get {{ }} != 0 } body start
1987                     ;   call master_fail {{ common_string , 0xca }}  
1988 3f0 302b            movlw LOW common_string+1
1989 3f1 00ce            movwf master_fail__test_name
1990 3f2 30ca            movlw 202
1991 3f3 00cf            movwf master_fail__test_number
1992 3f4 24b2            call master_fail
1993                     ; if { slave_get {{ }} != 0 } body end
1994             label664__0end:
1995                     ; if exp=` slave_get ## {{ }} != 0 ' empty false
1996                     ; Other expression=`{ slave_get {{ }} != 0 }' delay=-1
1997                     ; if { slave_get {{ }} != 0 } end
1998                     ; Read clock :
1999                     ;   call slave_send {{ 0xfa }}  
2000 3f5 30fa            movlw 250
2001 3f6 00d4            movwf slave_send__data
2002 3f7 24e2            call slave_send
2003                     ;   actual := slave_get {{ }}  
2004 3f8 24dc            call slave_get
2005 3f9 0853            movf slave_get__0return__byte,w
2006 3fa 00c3            movwf common_test__actual
2007                     ; Increment :
2008                     ;   call slave_send {{ 0xf9 }}  
2009 3fb 30f9            movlw 249
2010 3fc 00d4            movwf slave_send__data
2011 3fd 24e2            call slave_send
2012                     ; Decrement :
2013                     ;   call slave_send {{ 0xf8 }}  
2014 3fe 30f8            movlw 248
2015 3ff 00d4            movwf slave_send__data
2016 400 24e2            call slave_send
2017                     ; Read clock again :
2018                     ;   call slave_send {{ 0xfa }}  
2019 401 30fa            movlw 250
2020 402 00d4            movwf slave_send__data
2021 403 24e2            call slave_send
2022                     ; if { actual != slave_get {{ }} } start
2023 404 24dc            call slave_get
2024 405 0853            movf slave_get__0return__byte,w
2025 406 0243            subwf common_test__actual,w
2026                     ; expression=`{ actual != slave_get {{ }} }' exp_delay=1 true_delay=3  false_delay=0 true_size=5 false_size=0
2027 407 1903            btfsc z___byte,z___bit
2028 408 2c0e            goto label676__0end
2029                     ; if { actual != slave_get {{ }} } body start
2030                     ;   call master_fail {{ common_string , 0xcb }}  
2031 409 302b            movlw LOW common_string+1
2032 40a 00ce            movwf master_fail__test_name
2033 40b 30cb            movlw 203
2034 40c 00cf            movwf master_fail__test_number
2035 40d 24b2            call master_fail
2036                     ; if { actual != slave_get {{ }} } body end
2037             label676__0end:
2038                     ; if exp=` actual != slave_get ## {{ }} ' empty false
2039                     ; Other expression=`{ actual != slave_get {{ }} }' delay=-1
2040                     ; if { actual != slave_get {{ }} } end
2041                     ; procedure common_test end
2042 40e 3400            retlw 0
2043             
2044                     ; procedure common_test_id_match start
2045             common_test_id_match:
2046     0045    common_test_id_match__variables__base equ global__variables__bank0+37
2047     0045    common_test_id_match__bytes__base equ common_test_id_match__variables__base+0
2048     0048    common_test_id_match__bits__base equ common_test_id_match__variables__base+3
2049     0003    common_test_id_match__total__bytes equ 3
2050     0045    common_test_id_match__desired equ common_test_id_match__bytes__base+0
2051     0046    common_test_id_match__test_number equ common_test_id_match__bytes__base+1
2052                     ; This procedure will verify that the next byte in the id is < desired > .
2053     0047    common_test_id_match__id equ common_test_id_match__bytes__base+2
2054                     ;   id := common_test_id_next {{ }}  
2055 40f 2433            call common_test_id_next
2056 410 084a            movf common_test_id_next__0return__byte,w
2057 411 00c7            movwf common_test_id_match__id
2058                     ;   call master_octal {{ id }}  
2059 412 00d1            movwf master_octal__number
2060 413 24c3            call master_octal
2061                     ; if { desired != id } start
2062 414 0845            movf common_test_id_match__desired,w
2063 415 0247            subwf common_test_id_match__id,w
2064                     ; expression=`{ desired != id }' exp_delay=2 true_delay=3  false_delay=0 true_size=5 false_size=0
2065 416 1903            btfsc z___byte,z___bit
2066 417 2c1d            goto label692__0end
2067                     ; if { desired != id } body start
2068                     ;   call master_fail {{ common_string , test_number }}  
2069 418 302b            movlw LOW common_string+1
2070 419 00ce            movwf master_fail__test_name
2071 41a 0846            movf common_test_id_match__test_number,w
2072 41b 00cf            movwf master_fail__test_number
2073 41c 24b2            call master_fail
2074                     ; if { desired != id } body end
2075             label692__0end:
2076                     ; if exp=` desired != id ' empty false
2077                     ; Other expression=`{ desired != id }' delay=-1
2078                     ; if { desired != id } end
2079                     ; procedure common_test_id_match end
2080 41d 3400            retlw 0
2081             
2082                     ; procedure common_test_id_bytes8 start
2083             common_test_id_bytes8:
2084     0048    common_test_id_bytes8__variables__base equ global__variables__bank0+40
2085     0048    common_test_id_bytes8__bytes__base equ common_test_id_bytes8__variables__base+0
2086     0049    common_test_id_bytes8__bits__base equ common_test_id_bytes8__variables__base+1
2087     0001    common_test_id_bytes8__total__bytes equ 1
2088                     ;   arguments_none  
2089                     ; This procedure will print out the next 8 bytes of the id in octal .
2090     0048    common_test_id_bytes8__count equ common_test_id_bytes8__bytes__base+0
2091                     ; `count_down count 8 ...' start
2092 41e 3008            movlw 8
2093 41f 00c8            movwf common_test_id_bytes8__count
2094             common_test_id_bytes8__705_loop:
2095                     ;   call master_octal {{ common_test_id_next {{ }} }}  
2096 420 2433            call common_test_id_next
2097 421 084a            movf common_test_id_next__0return__byte,w
2098 422 00d1            movwf master_octal__number
2099 423 24c3            call master_octal
2100 424 0bc8            decfsz common_test_id_bytes8__count,f
2101 425 2c20            goto common_test_id_bytes8__705_loop
2102             common_test_id_bytes8__705_done:
2103                     ; `count_down count 8 ...' end
2104                     ;   call master_crlf {{ }}  
2105 426 24ab            call master_crlf
2106                     ; procedure common_test_id_bytes8 end
2107 427 3400            retlw 0
2108             
2109                     ; procedure common_test_id_string start
2110             common_test_id_string:
2111     0049    common_test_id_string__variables__base equ global__variables__bank0+41
2112     0049    common_test_id_string__bytes__base equ common_test_id_string__variables__base+0
2113     004a    common_test_id_string__bits__base equ common_test_id_string__variables__base+1
2114     0001    common_test_id_string__total__bytes equ 1
2115                     ;   arguments_none  
2116                     ; This procedure will print out the next id string .
2117     0049    common_test_id_string__count equ common_test_id_string__bytes__base+0
2118                     ; `count_down count  common_test_id_next ## {{ }}  ...' start
2119 428 2433            call common_test_id_next
2120 429 084a            movf common_test_id_next__0return__byte,w
2121 42a 00c9            movwf common_test_id_string__count
2122             common_test_id_string__719_loop:
2123                     ;   call master_send {{ common_test_id_next {{ }} }}  
2124 42b 2433            call common_test_id_next
2125 42c 084a            movf common_test_id_next__0return__byte,w
2126 42d 00de            movwf master_send__character
2127 42e 253b            call master_send
2128 42f 0bc9            decfsz common_test_id_string__count,f
2129 430 2c2b            goto common_test_id_string__719_loop
2130             common_test_id_string__719_done:
2131                     ; `count_down count  common_test_id_next ## {{ }}  ...' end
2132                     ;   call master_crlf {{ }}  
2133 431 24ab            call master_crlf
2134                     ; procedure common_test_id_string end
2135 432 3400            retlw 0
2136             
2137                     ; procedure common_test_id_next start
2138             common_test_id_next:
2139     004a    common_test_id_next__variables__base equ global__variables__bank0+42
2140     004a    common_test_id_next__bytes__base equ common_test_id_next__variables__base+0
2141     004b    common_test_id_next__bits__base equ common_test_id_next__variables__base+1
2142     0001    common_test_id_next__total__bytes equ 1
2143                     ;   arguments_none  
2144     004a    common_test_id_next__0return__byte equ common_test_id_next__bytes__base+0
2145                     ; This procedure returns the next byte from the identification string .
2146                     ;   call slave_send {{ 0xfc }}  
2147 433 30fc            movlw 252
2148 434 00d4            movwf slave_send__data
2149 435 24e2            call slave_send
2150                     ;   return slave_get {{ }}  
2151 436 24dc            call slave_get
2152 437 0853            movf slave_get__0return__byte,w
2153 438 00ca            movwf common_test_id_next__0return__byte
2154 439 3400            retlw 0
2155                     ; procedure common_test_id_next end
2156                     ; comment {The procedures below are used to test the shared interrupt commands :}
2157             
2158                     ; procedure interrupt_test start
2159             interrupt_test:
2160     004b    interrupt_test__variables__base equ global__variables__bank0+43
2161     004b    interrupt_test__bytes__base equ interrupt_test__variables__base+0
2162     004c    interrupt_test__bits__base equ interrupt_test__variables__base+1
2163     0001    interrupt_test__total__bytes equ 1
2164                     ;   arguments_none  
2165                     ; This procedure tests the common shared interrupt commands .
2166     004b    interrupt_test__counter equ interrupt_test__bytes__base+0
2167                     ; Clear interrupt bits :
2168                     ;   call slave_send {{ 0xf0 }}  
2169 43a 30f0            movlw 240
2170 43b 00d4            movwf slave_send__data
2171 43c 24e2            call slave_send
2172                     ;   call interrupt_read {{ 0 , 0xd0 }}  
2173 43d 01cc            clrf interrupt_read__desired
2174 43e 30d0            movlw 208
2175 43f 00cd            movwf interrupt_read__test_number
2176 440 2499            call interrupt_read
2177                     ; Set / clear interrupt pending bit only :
2178                     ;   call slave_send {{ 0xf5 }}  
2179 441 30f5            movlw 245
2180 442 00d4            movwf slave_send__data
2181 443 24e2            call slave_send
2182                     ;   call interrupt_read {{ 1 , 0xd1 }}  
2183 444 3001            movlw 1
2184 445 00cc            movwf interrupt_read__desired
2185 446 30d1            movlw 209
2186 447 00cd            movwf interrupt_read__test_number
2187 448 2499            call interrupt_read
2188                     ;   call slave_send {{ 0xf4 }}  
2189 449 30f4            movlw 244
2190 44a 00d4            movwf slave_send__data
2191 44b 24e2            call slave_send
2192                     ;   call interrupt_read {{ 0 , 0xd2 }}  
2193 44c 01cc            clrf interrupt_read__desired
2194 44d 30d2            movlw 210
2195 44e 00cd            movwf interrupt_read__test_number
2196 44f 2499            call interrupt_read
2197                     ;   call slave_send {{ 0xf1 }}  
2198 450 30f1            movlw 241
2199 451 00d4            movwf slave_send__data
2200 452 24e2            call slave_send
2201                     ;   call interrupt_read {{ 1 , 0xd3 }}  
2202 453 3001            movlw 1
2203 454 00cc            movwf interrupt_read__desired
2204 455 30d3            movlw 211
2205 456 00cd            movwf interrupt_read__test_number
2206 457 2499            call interrupt_read
2207                     ;   call slave_send {{ 0xf0 }}  
2208 458 30f0            movlw 240
2209 459 00d4            movwf slave_send__data
2210 45a 24e2            call slave_send
2211                     ;   call interrupt_read {{ 0 , 0xd4 }}  
2212 45b 01cc            clrf interrupt_read__desired
2213 45c 30d4            movlw 212
2214 45d 00cd            movwf interrupt_read__test_number
2215 45e 2499            call interrupt_read
2216                     ; Set / clear interrupt enable bit only :
2217                     ;   call slave_send {{ 0xf7 }}  
2218 45f 30f7            movlw 247
2219 460 00d4            movwf slave_send__data
2220 461 24e2            call slave_send
2221                     ;   call interrupt_read {{ 2 , 0xd5 }}  
2222 462 3002            movlw 2
2223 463 00cc            movwf interrupt_read__desired
2224 464 30d5            movlw 213
2225 465 00cd            movwf interrupt_read__test_number
2226 466 2499            call interrupt_read
2227                     ;   call slave_send {{ 0xf6 }}  
2228 467 30f6            movlw 246
2229 468 00d4            movwf slave_send__data
2230 469 24e2            call slave_send
2231                     ;   call interrupt_read {{ 0 , 0xd6 }}  
2232 46a 01cc            clrf interrupt_read__desired
2233 46b 30d6            movlw 214
2234 46c 00cd            movwf interrupt_read__test_number
2235 46d 2499            call interrupt_read
2236                     ;   call slave_send {{ 0xf2 }}  
2237 46e 30f2            movlw 242
2238 46f 00d4            movwf slave_send__data
2239 470 24e2            call slave_send
2240                     ;   call interrupt_read {{ 2 , 0xd7 }}  
2241 471 3002            movlw 2
2242 472 00cc            movwf interrupt_read__desired
2243 473 30d7            movlw 215
2244 474 00cd            movwf interrupt_read__test_number
2245 475 2499            call interrupt_read
2246                     ;   call slave_send {{ 0xf0 }}  
2247 476 30f0            movlw 240
2248 477 00d4            movwf slave_send__data
2249 478 24e2            call slave_send
2250                     ;   call interrupt_read {{ 0 , 0xd8 }}  
2251 479 01cc            clrf interrupt_read__desired
2252 47a 30d8            movlw 216
2253 47b 00cd            movwf interrupt_read__test_number
2254 47c 2499            call interrupt_read
2255                     ; Now set both the interrupt enable and pending bit .
2256                     ; This must trigger an interrupt .
2257                     ;   call slave_send {{ 0xf3 }}  
2258 47d 30f3            movlw 243
2259 47e 00d4            movwf slave_send__data
2260 47f 24e2            call slave_send
2261                     ; `count_down counter 3 ...' start
2262 480 3003            movlw 3
2263 481 00cb            movwf interrupt_test__counter
2264             interrupt_test__773_loop:
2265                     ;   call delay {{ }}  
2266 482 2554            call delay
2267 483 0bcb            decfsz interrupt_test__counter,f
2268 484 2c82            goto interrupt_test__773_loop
2269             interrupt_test__773_done:
2270                     ; `count_down counter 3 ...' end
2271                     ; if { rx_slave_pin } start
2272                     ; expression=`{ rx_slave_pin }' exp_delay=0 true_delay=3  false_delay=0 true_size=5 false_size=0
2273 485 1e86            btfss rx_slave_pin__byte,rx_slave_pin__bit
2274 486 2c8c            goto label776__0end
2275                     ; if { rx_slave_pin } body start
2276                     ; No interrupt detected :
2277                     ;   call master_fail {{ interrupt_string , 0xd9 }}  
2278 487 3056            movlw LOW interrupt_string+1
2279 488 00ce            movwf master_fail__test_name
2280 489 30d9            movlw 217
2281 48a 00cf            movwf master_fail__test_number
2282 48b 24b2            call master_fail
2283                     ; if { rx_slave_pin } body end
2284             label776__0end:
2285                     ; if exp=`rx_slave_pin' empty false
2286                     ; Other expression=`{ rx_slave_pin }' delay=-1
2287                     ; if { rx_slave_pin } end
2288                     ; Read the interrupt enable bit is cleared as a side effect
2289                     ; of reading the bit .
2290                     ;   call interrupt_read {{ 1 , 0xda }}  
2291 48c 3001            movlw 1
2292 48d 00cc            movwf interrupt_read__desired
2293 48e 30da            movlw 218
2294 48f 00cd            movwf interrupt_read__test_number
2295 490 2499            call interrupt_read
2296                     ; Clear the interrupt pending bit :
2297                     ;   call slave_send {{ 0xf0 }}  
2298 491 30f0            movlw 240
2299 492 00d4            movwf slave_send__data
2300 493 24e2            call slave_send
2301                     ;   call interrupt_read {{ 0 , 0xdb }}  
2302 494 01cc            clrf interrupt_read__desired
2303 495 30db            movlw 219
2304 496 00cd            movwf interrupt_read__test_number
2305 497 2499            call interrupt_read
2306                     ; procedure interrupt_test end
2307 498 3400            retlw 0
2308             
2309                     ; procedure interrupt_read start
2310             interrupt_read:
2311     004c    interrupt_read__variables__base equ global__variables__bank0+44
2312     004c    interrupt_read__bytes__base equ interrupt_read__variables__base+0
2313     004e    interrupt_read__bits__base equ interrupt_read__variables__base+2
2314     0002    interrupt_read__total__bytes equ 2
2315     004c    interrupt_read__desired equ interrupt_read__bytes__base+0
2316     004d    interrupt_read__test_number equ interrupt_read__bytes__base+1
2317                     ; This procedure will verify that the interrupt bits match < desired > .
2318                     ;   call slave_send {{ 0xef }}  
2319 499 30ef            movlw 239
2320 49a 00d4            movwf slave_send__data
2321 49b 24e2            call slave_send
2322                     ;   temp := slave_get {{ }}  
2323 49c 24dc            call slave_get
2324 49d 0853            movf slave_get__0return__byte,w
2325 49e 00a0            movwf temp
2326                     ; if { temp != desired } start
2327 49f 024c            subwf interrupt_read__desired,w
2328                     ; expression=`{ temp != desired }' exp_delay=2 true_delay=4  false_delay=0 true_size=8 false_size=0
2329 4a0 1903            btfsc z___byte,z___bit
2330 4a1 2caa            goto label798__0end
2331                     ; if { temp != desired } body start
2332                     ;   call master_octal {{ temp }}  
2333 4a2 0820            movf temp,w
2334 4a3 00d1            movwf master_octal__number
2335 4a4 24c3            call master_octal
2336                     ;   call master_fail {{ interrupt_string , test_number }}  
2337 4a5 3056            movlw LOW interrupt_string+1
2338 4a6 00ce            movwf master_fail__test_name
2339 4a7 084d            movf interrupt_read__test_number,w
2340 4a8 00cf            movwf master_fail__test_number
2341 4a9 24b2            call master_fail
2342                     ; if { temp != desired } body end
2343             label798__0end:
2344                     ; if exp=` temp != desired ' empty false
2345                     ; Other expression=`{ temp != desired }' delay=-1
2346                     ; if { temp != desired } end
2347                     ; procedure interrupt_read end
2348 4aa 3400            retlw 0
2349                     ; comment {The following procedures are used to communicate with the master :}
2350             
2351                     ; procedure master_crlf start
2352             master_crlf:
2353     004e    master_crlf__variables__base equ global__variables__bank0+46
2354     004e    master_crlf__bytes__base equ master_crlf__variables__base+0
2355     004e    master_crlf__bits__base equ master_crlf__variables__base+0
2356     0000    master_crlf__total__bytes equ 0
2357                     ;   arguments_none  
2358                     ; This procedure will output a carriage - return line - feed
2359                     ; to the master .
2360                     ;   call master_send {{ cr }}  
2361 4ab 300d            movlw 13
2362 4ac 00de            movwf master_send__character
2363 4ad 253b            call master_send
2364                     ;   call master_send {{ lf }}  
2365 4ae 300a            movlw 10
2366 4af 00de            movwf master_send__character
2367 4b0 253b            call master_send
2368                     ; procedure master_crlf end
2369 4b1 3400            retlw 0
2370             
2371                     ; procedure master_fail start
2372             master_fail:
2373     004e    master_fail__variables__base equ global__variables__bank0+46
2374     004e    master_fail__bytes__base equ master_fail__variables__base+0
2375     0050    master_fail__bits__base equ master_fail__variables__base+2
2376     0002    master_fail__total__bytes equ 2
2377     004e    master_fail__test_name equ master_fail__bytes__base+0
2378     004f    master_fail__test_number equ master_fail__bytes__base+1
2379                     ; This procedure will output ` fail ' followed by a carriage return
2380                     ; and line feed .
2381                     ;   call master_string {{ fail_string }}  
2382 4b2 3039            movlw LOW fail_string+1
2383 4b3 00df            movwf master_string__message
2384 4b4 2541            call master_string
2385                     ;   call master_string {{ test_name }}  
2386 4b5 084e            movf master_fail__test_name,w
2387 4b6 00df            movwf master_string__message
2388 4b7 2541            call master_string
2389                     ;   call master_octal {{ test_number }}  
2390 4b8 084f            movf master_fail__test_number,w
2391 4b9 00d1            movwf master_octal__number
2392 4ba 24c3            call master_octal
2393                     ;   call master_crlf {{ }}  
2394 4bb 24ab            call master_crlf
2395                     ; procedure master_fail end
2396 4bc 3400            retlw 0
2397             
2398                     ; procedure master_get start
2399             master_get:
2400     0050    master_get__variables__base equ global__variables__bank0+48
2401     0050    master_get__bytes__base equ master_get__variables__base+0
2402     0051    master_get__bits__base equ master_get__variables__base+1
2403     0001    master_get__total__bytes equ 1
2404                     ;   arguments_none  
2405     0050    master_get__0return__byte equ master_get__bytes__base+0
2406                     ; This procedure will get the next byte or return 0xfc if
2407                     ; no byte is forthcoming .
2408                     ;   return get_byte {{ rx_master_mask }}  
2409 4bd 3002            movlw 2
2410 4be 00d5            movwf get_byte__mask
2411 4bf 24e8            call get_byte
2412 4c0 0856            movf get_byte__0return__byte,w
2413 4c1 00d0            movwf master_get__0return__byte
2414 4c2 3400            retlw 0
2415                     ; procedure master_get end
2416             
2417                     ; procedure master_octal start
2418             master_octal:
2419     0051    master_octal__variables__base equ global__variables__bank0+49
2420     0051    master_octal__bytes__base equ master_octal__variables__base+0
2421     0053    master_octal__bits__base equ master_octal__variables__base+2
2422     0002    master_octal__total__bytes equ 2
2423     0052    master_octal__848byte0 equ master_octal__bytes__base+1
2424     0052    master_octal__849byte0 equ master_octal__bytes__base+1
2425     0051    master_octal__number equ master_octal__bytes__base+0
2426                     ; This procedure will output < number > in octal to the tx port .
2427                     ; Output the character in octal :
2428                     ;   call master_send {{ {{ number >> 6 }} + 0c'0' }}  
2429 4c3 0e51            swapf master_octal__number,w
2430 4c4 00d2            movwf master_octal__848byte0
2431 4c5 0cd2            rrf master_octal__848byte0,f
2432 4c6 0c52            rrf master_octal__848byte0,w
2433 4c7 3903            andlw 3
2434 4c8 3e30            addlw 48
2435 4c9 00de            movwf master_send__character
2436 4ca 253b            call master_send
2437                     ;   call master_send {{ {{ {{ number >> 3 }} & 7 }} + 0c'0' }}  
2438 4cb 0c51            rrf master_octal__number,w
2439 4cc 00d2            movwf master_octal__849byte0
2440 4cd 0cd2            rrf master_octal__849byte0,f
2441 4ce 0c52            rrf master_octal__849byte0,w
2442 4cf 3907            andlw 7
2443 4d0 3e30            addlw 48
2444 4d1 00de            movwf master_send__character
2445 4d2 253b            call master_send
2446                     ;   call master_send {{ {{ number & 7 }} + 0c'0' }}  
2447 4d3 3007            movlw 7
2448 4d4 0551            andwf master_octal__number,w
2449 4d5 3e30            addlw 48
2450 4d6 00de            movwf master_send__character
2451 4d7 253b            call master_send
2452                     ;   call master_send {{ sp }}  
2453 4d8 3020            movlw 32
2454 4d9 00de            movwf master_send__character
2455 4da 253b            call master_send
2456                     ; procedure master_octal end
2457 4db 3400            retlw 0
2458             
2459                     ; procedure slave_get start
2460             slave_get:
2461     0053    slave_get__variables__base equ global__variables__bank0+51
2462     0053    slave_get__bytes__base equ slave_get__variables__base+0
2463     0054    slave_get__bits__base equ slave_get__variables__base+1
2464     0001    slave_get__total__bytes equ 1
2465                     ;   arguments_none  
2466     0053    slave_get__0return__byte equ slave_get__bytes__base+0
2467                     ; This procedure will get a byte from the slave or return 0xfc
2468                     ; if no byte is forthcoming .
2469                     ;   return get_byte {{ rx_slave_mask }}  
2470 4dc 3020            movlw 32
2471 4dd 00d5            movwf get_byte__mask
2472 4de 24e8            call get_byte
2473 4df 0856            movf get_byte__0return__byte,w
2474 4e0 00d3            movwf slave_get__0return__byte
2475 4e1 3400            retlw 0
2476                     ; procedure slave_get end
2477             
2478                     ; procedure slave_send start
2479             slave_send:
2480     0054    slave_send__variables__base equ global__variables__bank0+52
2481     0054    slave_send__bytes__base equ slave_send__variables__base+0
2482     0055    slave_send__bits__base equ slave_send__variables__base+1
2483     0001    slave_send__total__bytes equ 1
2484     0054    slave_send__data equ slave_send__bytes__base+0
2485                     ; This procedure will send one byte of < data > to the slave .
2486                     ;   call send_byte {{ data , tx_slave_mask }}  
2487 4e2 0854            movf slave_send__data,w
2488 4e3 00da            movwf send_byte__char
2489 4e4 3010            movlw 16
2490 4e5 00db            movwf send_byte__mask
2491 4e6 2515            call send_byte
2492                     ; procedure slave_send end
2493 4e7 3400            retlw 0
2494                     ; comment {The last procedures do character sending and receiving :}
2495             
2496                     ; procedure get_byte start
2497             get_byte:
2498     0055    get_byte__variables__base equ global__variables__bank0+53
2499     0055    get_byte__bytes__base equ get_byte__variables__base+0
2500     005a    get_byte__bits__base equ get_byte__variables__base+5
2501     0005    get_byte__total__bytes equ 5
2502     0059    get_byte__905byte1 equ get_byte__bytes__base+4
2503     0055    get_byte__mask equ get_byte__bytes__base+0
2504     0056    get_byte__0return__byte equ get_byte__bytes__base+1
2505                     ; Get an 8 - bit byte from < mask > bit of < portb > and return it .
2506                     ; If no character shows up in a while 0xfc is returned .
2507     0057    get_byte__count equ get_byte__bytes__base+2
2508     0058    get_byte__char equ get_byte__bytes__base+3
2509                     ; Wait until a start bit arrives :
2510                     ;   count := 0  
2511 4e8 01d7            clrf get_byte__count
2512                     ; `while  portb & mask != 0  ...' start
2513             get_byte__887while__continue:
2514 4e9 0806            movf portb,w
2515 4ea 0555            andwf get_byte__mask,w
2516                     ; expression=` portb & mask != 0 ' exp_delay=2 true_delay=1  false_delay=2 true_size=9 false_size=1
2517 4eb 1903            btfsc z___byte,z___bit
2518 4ec 2cf6            goto get_byte__887while__break
2519                     ;   count := count - 1  
2520 4ed 03d7            decf get_byte__count,f
2521                     ; if { count = 0 } start
2522 4ee 0857            movf get_byte__count,w
2523                     ; expression=`{ count = 0 }' exp_delay=1 true_delay=3  false_delay=0 true_size=3 false_size=0
2524 4ef 1d03            btfss z___byte,z___bit
2525 4f0 2cf4            goto label889__0end
2526                     ; if { count = 0 } body start
2527                     ;   return 0xfc  
2528 4f1 30fc            movlw 252
2529 4f2 00d6            movwf get_byte__0return__byte
2530 4f3 3400            retlw 0
2531                     ; if { count = 0 } body end
2532             label889__0end:
2533                     ; if exp=` count = 0 ' empty false
2534                     ; Other expression=`{ count = 0 }' delay=-1
2535                     ; if { count = 0 } end
2536                     ;   call delay {{ }}  
2537 4f4 2554            call delay
2538 4f5 2ce9            goto get_byte__887while__continue
2539                     ; if exp=` portb & mask != 0 ' false goto
2540                     ; Other expression=` portb & mask != 0 ' delay=-1
2541             get_byte__887while__break:
2542                     ; `while  portb & mask != 0  ...' end
2543                     ; Skip over the start bit :
2544                     ;   call delay {{ }}  
2545 4f6 2554            call delay
2546                     ;   call delay {{ }}  
2547 4f7 2554            call delay
2548                     ;   call delay {{ }}  
2549 4f8 2554            call delay
2550                     ; Sample in the middle third of each data bit :
2551                     ; 1 cycle :
2552                     ;   char := 0  
2553 4f9 01d8            clrf get_byte__char
2554                     ; 2 cycles for loop setup :
2555                     ; 1 + 2 = 3
2556                     ; nop extra_instructions_per_bit - 3
2557                     ; Delay 9 cycles
2558 4fa 3002            movlw 2
2559 4fb 00d9            movwf get_byte__905byte1
2560             get_byte__905delay0:
2561 4fc 0bd9            decfsz get_byte__905byte1,f
2562 4fd 2cfc            goto get_byte__905delay0
2563 4fe 0000            nop
2564 4ff 0000            nop
2565                     ; `count_down count 8 ...' start
2566 500 3008            movlw 8
2567 501 00d7            movwf get_byte__count
2568             get_byte__906_loop:
2569                     ;   call delay {{ }}  
2570 502 2554            call delay
2571                     ; 2 cycles :
2572                     ;   char := char >> 1  
2573 503 1003            bcf c___byte,c___bit
2574 504 0cd8            rrf get_byte__char,f
2575                     ; 3 cycles :
2576                     ; if { portb & mask != 0 } start
2577 505 0806            movf portb,w
2578 506 0555            andwf get_byte__mask,w
2579                     ; expression=`{ portb & mask != 0 }' exp_delay=2 true_delay=1  false_delay=0 true_size=1 false_size=0
2580 507 1d03            btfss z___byte,z___bit
2581                     ; if { portb & mask != 0 } body start
2582                     ;   char @ 7 := 1  
2583                     ; Select char @ 7
2584     0058    get_byte__char__912select0 equ get_byte__char+0
2585     0058    get_byte__char__912select0__byte equ get_byte__char+0
2586     0007    get_byte__char__912select0__bit equ 7
2587 508 17d8            bsf get_byte__char__912select0__byte,get_byte__char__912select0__bit
2588                     ; if { portb & mask != 0 } body end
2589                     ; if exp=` portb & mask != 0 ' false skip delay=4
2590                     ; Other expression=`{ portb & mask != 0 }' delay=4
2591                     ; if { portb & mask != 0 } end
2592                     ;   call delay {{ }}  
2593 509 2554            call delay
2594                     ;   call delay {{ }}  
2595 50a 2554            call delay
2596                     ; 3 cycles at end of loop :
2597                     ; 2 + 3 + 3 = 8
2598                     ; nop extra_instructions_per_bit - 8
2599                     ; Delay 4 cycles
2600 50b 0000            nop
2601 50c 0000            nop
2602 50d 0000            nop
2603 50e 0000            nop
2604 50f 0bd7            decfsz get_byte__count,f
2605 510 2d02            goto get_byte__906_loop
2606             get_byte__906_done:
2607                     ; `count_down count 8 ...' end
2608                     ; Skip over 1 / 3 of the stop bit :
2609                     ;   call delay {{ }}  
2610 511 2554            call delay
2611                     ;   return char  
2612 512 0858            movf get_byte__char,w
2613 513 00d6            movwf get_byte__0return__byte
2614 514 3400            retlw 0
2615                     ; procedure get_byte end
2616             
2617                     ; procedure send_byte start
2618             send_byte:
2619     005a    send_byte__variables__base equ global__variables__bank0+58
2620     005a    send_byte__bytes__base equ send_byte__variables__base+0
2621     005e    send_byte__bits__base equ send_byte__variables__base+4
2622     0004    send_byte__total__bytes equ 4
2623     005a    send_byte__char equ send_byte__bytes__base+0
2624     005b    send_byte__mask equ send_byte__bytes__base+1
2625                     ; Send < char > to < mask > bit of < portb > .
2626     005c    send_byte__count equ send_byte__bytes__base+2
2627     005d    send_byte__mark equ send_byte__bytes__base+3
2628                     ; Send the start bit :
2629                     ; 3 cycles :
2630                     ;   mark := mask ^ space  
2631 515 30ff            movlw 255
2632 516 065b            xorwf send_byte__mask,w
2633 517 00dd            movwf send_byte__mark
2634                     ; 1 cycle < mark is already in W > :
2635                     ;   portb := mark  
2636 518 0086            movwf portb
2637                     ;   call delay {{ }}  
2638 519 2554            call delay
2639                     ;   call delay {{ }}  
2640 51a 2554            call delay
2641                     ;   call delay {{ }}  
2642 51b 2554            call delay
2643                     ; 2 cycles for loop setup :
2644                     ; 3 + 1 + 2 = 6
2645                     ; nop extra_instructions_per_bit - 6
2646                     ; Delay 6 cycles
2647 51c 0000            nop
2648 51d 0000            nop
2649 51e 0000            nop
2650 51f 0000            nop
2651 520 0000            nop
2652 521 0000            nop
2653                     ; Send the data :
2654                     ; `count_down count 8 ...' start
2655 522 3008            movlw 8
2656 523 00dc            movwf send_byte__count
2657             send_byte__950_loop:
2658                     ; 5 cycles :
2659                     ; if { char @ 0 } start
2660                     ; Alias variable for select char @ 0
2661     005a    send_byte__char__952select0 equ send_byte__char+0
2662     005a    send_byte__char__952select0__byte equ send_byte__char+0
2663     0000    send_byte__char__952select0__bit equ 0
2664                     ; expression=`{ char @ 0 }' exp_delay=0 true_delay=1  false_delay=1 true_size=1 false_size=1
2665 524 185a            btfsc send_byte__char__952select0__byte,send_byte__char__952select0__bit
2666                     ; if { char @ 0 } body start
2667                     ;   portb := space  
2668 525 30ff            movlw 255
2669                     ; 1 instructions found for sharing
2670 526 1c5a            btfss send_byte__char__952select0__byte,send_byte__char__952select0__bit
2671                     ; else body start
2672                     ;   portb := mark  
2673 527 085d            movf send_byte__mark,w
2674                     ; 1 instructions found for sharing
2675                     ; if exp=` char @ 0 ' single true and false skip delay=4
2676                     ; Other expression=`{ char @ 0 }' delay=4
2677                     ; 1 shared instructions follow
2678 528 0086            movwf portb
2679                     ; if { char @ 0 } end
2680                     ; 2 cycles :
2681                     ;   char := char >> 1  
2682 529 1003            bcf c___byte,c___bit
2683 52a 0cda            rrf send_byte__char,f
2684                     ;   call delay {{ }}  
2685 52b 2554            call delay
2686                     ;   call delay {{ }}  
2687 52c 2554            call delay
2688                     ;   call delay {{ }}  
2689 52d 2554            call delay
2690                     ; 3 cycles at end of loop :
2691                     ; 5 + 2 + 3 = 10
2692                     ; nop extra_instructions_per_bit - 10
2693                     ; Delay 2 cycles
2694 52e 0000            nop
2695 52f 0000            nop
2696 530 0bdc            decfsz send_byte__count,f
2697 531 2d24            goto send_byte__950_loop
2698             send_byte__950_done:
2699                     ; `count_down count 8 ...' end
2700                     ; Send the stop bit :
2701                     ; 1 cycle to finish off previous loop :
2702                     ; nop 1
2703                     ; Delay 1 cycles
2704 532 0000            nop
2705                     ; 2 cycles :
2706                     ;   portb := space  
2707 533 30ff            movlw 255
2708 534 0086            movwf portb
2709                     ;   call delay {{ }}  
2710 535 2554            call delay
2711                     ;   call delay {{ }}  
2712 536 2554            call delay
2713                     ;   call delay {{ }}  
2714 537 2554            call delay
2715                     ; 4 cycles for call / return :
2716                     ; 4 cycles for tw arguments :
2717                     ; 2 + 4 + 4 = 10
2718                     ; nop extra_instructions_per_bit - 10
2719                     ; Delay 2 cycles
2720 538 0000            nop
2721 539 0000            nop
2722                     ; procedure send_byte end
2723 53a 3400            retlw 0
2724             
2725                     ; procedure master_send start
2726             master_send:
2727     005e    master_send__variables__base equ global__variables__bank0+62
2728     005e    master_send__bytes__base equ master_send__variables__base+0
2729     005f    master_send__bits__base equ master_send__variables__base+1
2730     0001    master_send__total__bytes equ 1
2731     005e    master_send__character equ master_send__bytes__base+0
2732                     ; This procedure will output < character > to the master .
2733                     ;   call send_byte {{ character , tx_master_mask }}  
2734 53b 085e            movf master_send__character,w
2735 53c 00da            movwf send_byte__char
2736 53d 3004            movlw 4
2737 53e 00db            movwf send_byte__mask
2738 53f 2515            call send_byte
2739                     ; procedure master_send end
2740 540 3400            retlw 0
2741             
2742                     ; procedure master_string start
2743             master_string:
2744     005f    master_string__variables__base equ global__variables__bank0+63
2745     005f    master_string__bytes__base equ master_string__variables__base+0
2746     0062    master_string__bits__base equ master_string__variables__base+3
2747     0003    master_string__total__bytes equ 3
2748     005f    master_string__message equ master_string__bytes__base+0
2749                     ; This procedure will output < message > to the master .
2750     0060    master_string__size equ master_string__bytes__base+1
2751     0061    master_string__index equ master_string__bytes__base+2
2752                     ;   index := 0  
2753 541 01e1            clrf master_string__index
2754                     ; `while  index < message . size  ...' start
2755             master_string__1000while__continue:
2756 542 018a            clrf pclath___register
2757 543 085f            movf master_string__message,w
2758 544 200e            call string___fetch
2759 545 0261            subwf master_string__index,w
2760                     ; expression=` index < message . size ' exp_delay=4 true_delay=7  false_delay=2 true_size=8 false_size=1
2761 546 1803            btfsc c___byte,c___bit
2762 547 2d50            goto master_string__1000while__break
2763                     ;   call master_send {{ message ~~ {{ index }} }}  
2764 548 0a61            incf master_string__index,w
2765 549 075f            addwf master_string__message,w
2766 54a 018a            clrf pclath___register
2767 54b 200e            call string___fetch
2768 54c 00de            movwf master_send__character
2769 54d 253b            call master_send
2770                     ;   index := index + 1  
2771 54e 0ae1            incf master_string__index,f
2772 54f 2d42            goto master_string__1000while__continue
2773                     ; if exp=` index < message . size ' false goto
2774                     ; Other expression=` index < message . size ' delay=-1
2775             master_string__1000while__break:
2776                     ; `while  index < message . size  ...' end
2777                     ;   call master_send {{ sp }}  
2778 550 3020            movlw 32
2779 551 00de            movwf master_send__character
2780 552 253b            call master_send
2781                     ; procedure master_string end
2782 553 3400            retlw 0
2783             
2784                     ; procedure delay start
2785                     ; optimize 0
2786             delay:
2787     0062    delay__variables__base equ global__variables__bank0+66
2788     0062    delay__bytes__base equ delay__variables__base+0
2789     0063    delay__bits__base equ delay__variables__base+1
2790     0001    delay__total__bytes equ 1
2791     0062    delay__1007byte1 equ delay__bytes__base+0
2792                     ;   arguments_none  
2793                     ;   uniform_delay delay_instructions  
2794                     ; Uniform delay remaining = 339 Accumulated Delay = 0
2795                     ; Uniform delay remaining = 339 Accumulated Delay = 0
2796                     ; Delay 1 third of a bit :
2797                     ; Uniform delay remaining = 339 Accumulated Delay = 0
2798                     ;   watch_dog_reset  
2799 554 0064            clrwdt
2800                     ; Uniform delay remaining = 338 Accumulated Delay = 1
2801                     ; Uniform delay remaining = 338 Accumulated Delay = 1
2802                     ; Soak up remaining 338 cycles
2803                     ; Delay 338 cycles
2804 555 3070            movlw 112
2805 556 00e2            movwf delay__1007byte1
2806             delay__1007delay0:
2807 557 0be2            decfsz delay__1007byte1,f
2808 558 2d57            goto delay__1007delay0
2809 559 0000            nop
2810                     ; procedure delay end
2811 55a 3400            retlw 0
2812                     ; optimize 1
2813             
2814                     ; Register bank 0 used 67 bytes of 96 available bytes
2815                     ; Register bank 1 used 0 bytes of 80 available bytes
2816                     ; Register bank 2 used 0 bytes of 48 available bytes
2817                     ; Register bank 3 used 0 bytes of 0 available bytes
2818             
2819                     end

