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

