  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     0064    global__bit__variables__bank0 equ 100
  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 2864            goto main
 50                     ; comment #############################################################################
 51                     ; comment {}
 52                     ; comment {Copyright < c > 1999 - 2001 by Wayne C . Gramlich .}
 53                     ; comment {All rights reserved .}
 54                     ; comment {}
 55                     ; comment {Permission to use , copy , modify , distribute , and sell this software}
 56                     ; comment {for any purpose is hereby granted without fee provided that the above}
 57                     ; comment {copyright notice and this permission are retained . The author makes}
 58                     ; comment {no representations about the suitability of this software for any purpose .}
 59                     ; comment {It is provided { as is } without express or implied warranty .}
 60                     ; comment {}
 61                     ; comment {This is a test harness for testing the LED10 RoboBrick . See :}
 62                     ; comment {}
 63                     ; comment {http : / / web . gramlich . net / projects / robobricks / led10 / 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                     ;   bit_string = 0s'Bit'  
159     0000    bit_string___string equ 0
160             bit_string:
161 00f 0782            addwf pcl___register,f
162                     ; Length = 3
163 010 3403            retlw 3
164                     ; `Bit'
165 011 3442            retlw 66
166 012 3469            retlw 105
167 013 3474            retlw 116
168                     ;   clock_string = 0s'Clk'  
169     0005    clock_string___string equ 5
170             clock_string:
171 014 0782            addwf pcl___register,f
172                     ; Length = 3
173 015 3403            retlw 3
174                     ; `Clk'
175 016 3443            retlw 67
176 017 346c            retlw 108
177 018 346b            retlw 107
178                     ;   common_string = 0s'Common'  
179     000a    common_string___string equ 10
180             common_string:
181 019 0782            addwf pcl___register,f
182                     ; Length = 6
183 01a 3406            retlw 6
184                     ; `Common'
185 01b 3443            retlw 67
186 01c 346f            retlw 111
187 01d 346d            retlw 109
188 01e 346d            retlw 109
189 01f 346f            retlw 111
190 020 346e            retlw 110
191                     ;   done_string = 0s'Done'  
192     0012    done_string___string equ 18
193             done_string:
194 021 0782            addwf pcl___register,f
195                     ; Length = 4
196 022 3404            retlw 4
197                     ; `Done'
198 023 3444            retlw 68
199 024 346f            retlw 111
200 025 346e            retlw 110
201 026 3465            retlw 101
202                     ;   fail_string = 0s'Fail'  
203     0018    fail_string___string equ 24
204             fail_string:
205 027 0782            addwf pcl___register,f
206                     ; Length = 4
207 028 3404            retlw 4
208                     ; `Fail'
209 029 3446            retlw 70
210 02a 3461            retlw 97
211 02b 3469            retlw 105
212 02c 346c            retlw 108
213                     ;   hello_string = 0s'Shaft2_Test'  
214     001e    hello_string___string equ 30
215             hello_string:
216 02d 0782            addwf pcl___register,f
217                     ; Length = 11
218 02e 340b            retlw 11
219                     ; `Shaft2_Test'
220 02f 3453            retlw 83
221 030 3468            retlw 104
222 031 3461            retlw 97
223 032 3466            retlw 102
224 033 3474            retlw 116
225 034 3432            retlw 50
226 035 345f            retlw 95
227 036 3454            retlw 84
228 037 3465            retlw 101
229 038 3473            retlw 115
230 039 3474            retlw 116
231                     ;   interrupt_string = 0s'Interrupt'  
232     002b    interrupt_string___string equ 43
233             interrupt_string:
234 03a 0782            addwf pcl___register,f
235                     ; Length = 9
236 03b 3409            retlw 9
237                     ; `Interrupt'
238 03c 3449            retlw 73
239 03d 346e            retlw 110
240 03e 3474            retlw 116
241 03f 3465            retlw 101
242 040 3472            retlw 114
243 041 3472            retlw 114
244 042 3475            retlw 117
245 043 3470            retlw 112
246 044 3474            retlw 116
247                     ;   patterns = 0 , 1 , 2 , 4 , 8 , 0x10 , 0x20 , 0x40 , 0x80 , 0xff , 0  
248     0036    patterns___string equ 54
249             patterns:
250 045 0782            addwf pcl___register,f
251                     ; Length = 11
252 046 340b            retlw 11
253                     ; 0
254 047 3400            retlw 0
255                     ; 1
256 048 3401            retlw 1
257                     ; 2
258 049 3402            retlw 2
259                     ; 4
260 04a 3404            retlw 4
261                     ; 8
262 04b 3408            retlw 8
263                     ; 0x10
264 04c 3410            retlw 16
265                     ; 0x20
266 04d 3420            retlw 32
267                     ; 0x40
268 04e 3440            retlw 64
269                     ; 0x80
270 04f 3480            retlw 128
271                     ; 0xff
272 050 34ff            retlw 255
273                     ; 0
274 051 3400            retlw 0
275                     ;   register_string = 0s'Reg'  
276     0043    register_string___string equ 67
277             register_string:
278 052 0782            addwf pcl___register,f
279                     ; Length = 3
280 053 3403            retlw 3
281                     ; `Reg'
282 054 3452            retlw 82
283 055 3465            retlw 101
284 056 3467            retlw 103
285                     ;   shaft_string = 0s'Shaft'  
286     0048    shaft_string___string equ 72
287             shaft_string:
288 057 0782            addwf pcl___register,f
289                     ; Length = 5
290 058 3405            retlw 5
291                     ; `Shaft'
292 059 3453            retlw 83
293 05a 3468            retlw 104
294 05b 3461            retlw 97
295 05c 3466            retlw 102
296 05d 3474            retlw 116
297                     ;   test_string = 0s'Test'  
298     004f    test_string___string equ 79
299             test_string:
300 05e 0782            addwf pcl___register,f
301                     ; Length = 4
302 05f 3404            retlw 4
303                     ; `Test'
304 060 3454            retlw 84
305 061 3465            retlw 101
306 062 3473            retlw 115
307 063 3474            retlw 116
308                     ; string__constants End
309     0020    temp equ global__variables__bank0+0
310             
311                     ; procedure main start
312             main:
313     0021    main__variables__base equ global__variables__bank0+1
314     0021    main__bytes__base equ main__variables__base+0
315     0028    main__bits__base equ main__variables__base+7
316     0007    main__total__bytes equ 7
317     0027    main__148byte0 equ main__bytes__base+6
318     0027    main__120byte0 equ main__bytes__base+6
319                     ;   arguments_none  
320                     ; Read a byte .
321     0021    main__buffer equ main__bytes__base+0
322     0024    main__char equ main__bytes__base+3
323     0025    main__index equ main__bytes__base+4
324     0026    main__number equ main__bytes__base+5
325                     ; Print out a welcome message :
326                     ;   call master_crlf {{ }}  
327 064 23cc            call master_crlf
328                     ;   call master_string {{ hello_string }}  
329 065 302e            movlw LOW hello_string+1
330 066 00e0            movwf master_string__message
331 067 2462            call master_string
332                     ;   call master_crlf {{ }}  
333 068 23cc            call master_crlf
334                     ; Main loop
335                     ;   number := 0  
336 069 01a6            clrf main__number
337                     ; loop_forever ... start
338             main__108loop__forever:
339                     ; Get a character :
340                     ;   tx_slave_pin := 1  
341 06a 1606            bsf tx_slave_pin__byte,tx_slave_pin__bit
342                     ;   char := master_get {{ }}  
343 06b 23de            call master_get
344 06c 0851            movf master_get__0return__byte,w
345 06d 00a4            movwf main__char
346                     ; Delay 2 / 3 ' s of bit make sure that get_byte is done .
347                     ;   call delay {{ }}  
348 06e 2475            call delay
349                     ;   call delay {{ }}  
350 06f 2475            call delay
351                     ; if { 0c'0' <= char && char < {{ 0c'9' + 1 }} } start
352 070 3030            movlw 48
353 071 0224            subwf main__char,w
354                     ; expression=`0c'0' <= char' exp_delay=2 true_delay=-1  false_delay=1 true_size=132 false_size=1
355 072 1c03            btfss c___byte,c___bit
356 073 2884            goto and117__0false
357 074 303a            movlw 58
358 075 0224            subwf main__char,w
359                     ; expression=`char < {{ 0c'9' + 1 }}' exp_delay=2 true_delay=9  false_delay=-1 true_size=11 false_size=116
360 076 1803            btfsc c___byte,c___bit
361 077 2884            goto label117__1false
362             label117__1true:
363             and117__0true:
364                     ; if { 0c'0' <= char && char < {{ 0c'9' + 1 }} } body start
365                     ; Do a multiply by 8 then add in digit :
366                     ;   call master_send {{ char }}  
367 078 0824            movf main__char,w
368 079 00df            movwf master_send__character
369 07a 245c            call master_send
370                     ;   number := {{ number << 3 }} + char - 0c'0'  
371 07b 0d26            rlf main__number,w
372 07c 00a7            movwf main__120byte0
373 07d 0da7            rlf main__120byte0,f
374 07e 0d27            rlf main__120byte0,w
375 07f 39f8            andlw 248
376 080 0724            addwf main__char,w
377 081 3ed0            addlw 208
378 082 00a6            movwf main__number
379                     ; if { 0c'0' <= char && char < {{ 0c'9' + 1 }} } body end
380 083 28f8            goto label117__1end
381             label117__1false:
382             and117__0false:
383 084 3073            movlw 115
384 085 0224            subwf main__char,w
385                     ; expression=`{ char = 0c's' }' exp_delay=2 true_delay=-1  false_delay=-1 true_size=8 false_size=103
386 086 1d03            btfss z___byte,z___bit
387 087 2891            goto label121__0false
388             label121__0true:
389                     ; else_if { char = 0c's' } body start
390                     ; Send byte to brick , no wait :
391                     ; Echo command and send CRLF :
392                     ;   call master_send {{ char }}  
393 088 0824            movf main__char,w
394 089 00df            movwf master_send__character
395 08a 245c            call master_send
396                     ;   call master_crlf {{ }}  
397 08b 23cc            call master_crlf
398                     ; Ship the byte down to the brick :
399                     ;   call slave_send {{ number }}  
400 08c 0826            movf main__number,w
401 08d 00d5            movwf slave_send__data
402 08e 2403            call slave_send
403                     ;   number := 0  
404 08f 01a6            clrf main__number
405                     ; else_if { char = 0c's' } body end
406 090 28f8            goto label121__0end
407             label121__0false:
408 091 3077            movlw 119
409 092 0224            subwf main__char,w
410                     ; expression=`{ char = 0c'w' }' exp_delay=2 true_delay=-1  false_delay=-1 true_size=39 false_size=59
411 093 1d03            btfss z___byte,z___bit
412 094 28bd            goto label132__0false
413             label132__0true:
414                     ; else_if { char = 0c'w' } body start
415                     ; Send byte to brick , wait for results :
416                     ; Echo command and send CRLF :
417                     ;   call master_send {{ char }}  
418 095 0824            movf main__char,w
419 096 00df            movwf master_send__character
420 097 245c            call master_send
421                     ;   call master_crlf {{ }}  
422 098 23cc            call master_crlf
423                     ; Ship the byte down to the brick ...
424                     ;   call slave_send {{ number }}  
425 099 0826            movf main__number,w
426 09a 00d5            movwf slave_send__data
427 09b 2403            call slave_send
428                     ;   number := 0  
429 09c 01a6            clrf main__number
430                     ; call delay < >
431                     ; ... and wait for a response :
432                     ;   index := 0  
433 09d 01a5            clrf main__index
434                     ; `while  index < buffer_size  ...' start
435             main__147while__continue:
436 09e 3003            movlw 3
437 09f 0225            subwf main__index,w
438                     ; expression=` index < buffer_size ' exp_delay=2 true_delay=10  false_delay=2 true_size=11 false_size=1
439 0a0 1803            btfsc c___byte,c___bit
440 0a1 28ad            goto main__147while__break
441                     ;   buffer ~~ {{ index }} := slave_get {{ }}  
442 0a2 23fd            call slave_get
443 0a3 0854            movf slave_get__0return__byte,w
444 0a4 00a7            movwf main__148byte0
445 0a5 3021            movlw LOW main__buffer
446 0a6 0725            addwf main__index,w
447 0a7 0084            movwf fsr___register
448 0a8 0827            movf main__148byte0,w
449 0a9 1383            bcf irp___register,irp___bit
450 0aa 0080            movwf indf___register
451                     ;   index := index + 1  
452 0ab 0aa5            incf main__index,f
453 0ac 289e            goto main__147while__continue
454                     ; if exp=` index < buffer_size ' false goto
455                     ; Other expression=` index < buffer_size ' delay=-1
456             main__147while__break:
457                     ; `while  index < buffer_size  ...' end
458                     ;   index := 0  
459 0ad 01a5            clrf main__index
460                     ; `while  index < buffer_size  ...' start
461             main__153while__continue:
462 0ae 3003            movlw 3
463 0af 0225            subwf main__index,w
464                     ; expression=` index < buffer_size ' exp_delay=2 true_delay=8  false_delay=2 true_size=9 false_size=1
465 0b0 1803            btfsc c___byte,c___bit
466 0b1 28bb            goto main__153while__break
467                     ;   call master_octal {{ buffer ~~ {{ index }} }}  
468 0b2 3021            movlw LOW main__buffer
469 0b3 0725            addwf main__index,w
470 0b4 0084            movwf fsr___register
471 0b5 1383            bcf irp___register,irp___bit
472 0b6 0800            movf indf___register,w
473 0b7 00d2            movwf master_octal__number
474 0b8 23e4            call master_octal
475                     ;   index := index + 1  
476 0b9 0aa5            incf main__index,f
477 0ba 28ae            goto main__153while__continue
478                     ; if exp=` index < buffer_size ' false goto
479                     ; Other expression=` index < buffer_size ' delay=-1
480             main__153while__break:
481                     ; `while  index < buffer_size  ...' end
482                     ; Terminate the output list
483                     ;   call master_crlf {{ }}  
484 0bb 23cc            call master_crlf
485                     ; else_if { char = 0c'w' } body end
486 0bc 28f8            goto label132__0end
487             label132__0false:
488 0bd 3069            movlw 105
489 0be 0224            subwf main__char,w
490                     ; expression=`{ char = 0c'i' }' exp_delay=2 true_delay=-1  false_delay=-1 true_size=12 false_size=42
491 0bf 1d03            btfss z___byte,z___bit
492 0c0 28ce            goto label160__0false
493             label160__0true:
494                     ; else_if { char = 0c'i' } body start
495                     ; Interrogate the slave RoboBrick :
496                     ;   call master_send {{ char }}  
497 0c1 0824            movf main__char,w
498 0c2 00df            movwf master_send__character
499 0c3 245c            call master_send
500                     ;   call master_crlf {{ }}  
501 0c4 23cc            call master_crlf
502                     ; Initialize the id index :
503                     ;   call slave_send {{ 0xfd }}  
504 0c5 30fd            movlw 253
505 0c6 00d5            movwf slave_send__data
506 0c7 2403            call slave_send
507                     ; Get the first 8 bytes :
508                     ;   call common_test_id_bytes8 {{ }}  
509 0c8 233f            call common_test_id_bytes8
510                     ; Get the next 8 bytes of random numbers :
511                     ;   call common_test_id_bytes8 {{ }}  
512 0c9 233f            call common_test_id_bytes8
513                     ; Get the next 8 bytes of random numbers :
514                     ;   call common_test_id_bytes8 {{ }}  
515 0ca 233f            call common_test_id_bytes8
516                     ; Get the slave brick name :
517                     ;   call common_test_id_string {{ }}  
518 0cb 2349            call common_test_id_string
519                     ; Get the vendor name :
520                     ;   call common_test_id_string {{ }}  
521 0cc 2349            call common_test_id_string
522                     ; else_if { char = 0c'i' } body end
523 0cd 28f8            goto label160__0end
524             label160__0false:
525 0ce 3074            movlw 116
526 0cf 0224            subwf main__char,w
527                     ; expression=`{ char = 0c't' }' exp_delay=2 true_delay=-1  false_delay=-1 true_size=5 false_size=32
528 0d0 1d03            btfss z___byte,z___bit
529 0d1 28d8            goto label183__0false
530             label183__0true:
531                     ; else_if { char = 0c't' } body start
532                     ; Do testing :
533                     ;   call master_send {{ char }}  
534 0d2 0824            movf main__char,w
535 0d3 00df            movwf master_send__character
536 0d4 245c            call master_send
537                     ;   call master_crlf {{ }}  
538 0d5 23cc            call master_crlf
539                     ;   call test {{ }}  
540 0d6 2188            call test
541                     ; else_if { char = 0c't' } body end
542 0d7 28f8            goto label183__0end
543             label183__0false:
544 0d8 3063            movlw 99
545 0d9 0224            subwf main__char,w
546                     ; expression=`{ char = 0c'c' }' exp_delay=2 true_delay=-1  false_delay=-1 true_size=8 false_size=19
547 0da 1d03            btfss z___byte,z___bit
548 0db 28e5            goto label188__0false
549             label188__0true:
550                     ; else_if { char = 0c'c' } body start
551                     ;   call master_send {{ char }}  
552 0dc 0824            movf main__char,w
553 0dd 00df            movwf master_send__character
554 0de 245c            call master_send
555                     ;   call master_crlf {{ }}  
556 0df 23cc            call master_crlf
557                     ;   call clock_adjust {{ number }}  
558 0e0 0826            movf main__number,w
559 0e1 00a8            movwf clock_adjust__adjust
560 0e2 20f9            call clock_adjust
561                     ;   number := 0  
562 0e3 01a6            clrf main__number
563                     ; else_if { char = 0c'c' } body end
564 0e4 28f8            goto label188__0end
565             label188__0false:
566 0e5 30fc            movlw 252
567 0e6 0224            subwf main__char,w
568                     ; expression=`{ char != 0xfc }' exp_delay=2 true_delay=-1  false_delay=0 true_size=15 false_size=0
569 0e7 1903            btfsc z___byte,z___bit
570 0e8 28f8            goto label193__0end
571                     ; else_if { char != 0xfc } body start
572                     ; Just echo back the current number :
573                     ;   call master_send {{ 0c'<' }}  
574 0e9 303c            movlw 60
575 0ea 00df            movwf master_send__character
576 0eb 245c            call master_send
577                     ;   call master_octal {{ char }}  
578 0ec 0824            movf main__char,w
579 0ed 00d2            movwf master_octal__number
580 0ee 23e4            call master_octal
581                     ;   call master_send {{ 0c'>' }}  
582 0ef 303e            movlw 62
583 0f0 00df            movwf master_send__character
584 0f1 245c            call master_send
585                     ; Send a carriage - return line - feed :
586                     ;   call master_crlf {{ }}  
587 0f2 23cc            call master_crlf
588                     ; Output the character in octal :
589                     ;   call master_octal {{ number }}  
590 0f3 0826            movf main__number,w
591 0f4 00d2            movwf master_octal__number
592 0f5 23e4            call master_octal
593                     ; Send a carriage - return line - feed :
594                     ;   call master_crlf {{ }}  
595 0f6 23cc            call master_crlf
596                     ; Reset number
597                     ;   number := 0  
598 0f7 01a6            clrf main__number
599                     ; else_if { char != 0xfc } body end
600             label193__0end:
601                     ; if exp=` char != 0xfc ' empty false
602                     ; Other expression=`{ char != 0xfc }' delay=-1
603                     ; if exp=` char = 0c'c' ' generic
604             label188__0end:
605                     ; Other expression=`{ char = 0c'c' }' delay=-1
606                     ; if exp=` char = 0c't' ' generic
607             label183__0end:
608                     ; Other expression=`{ char = 0c't' }' delay=-1
609                     ; if exp=` char = 0c'i' ' generic
610             label160__0end:
611                     ; Other expression=`{ char = 0c'i' }' delay=-1
612                     ; if exp=` char = 0c'w' ' generic
613             label132__0end:
614                     ; Other expression=`{ char = 0c'w' }' delay=-1
615                     ; if exp=` char = 0c's' ' generic
616             label121__0end:
617                     ; Other expression=`{ char = 0c's' }' delay=-1
618                     ; if exp=`char < {{ 0c'9' + 1 }}' generic
619             label117__1end:
620                     ; Other expression=`char < {{ 0c'9' + 1 }}' delay=-1
621                     ; if exp=`0c'0' <= char' false goto
622                     ; Other expression=`0c'0' <= char' delay=-1
623             and117__0end:
624                     ; if { 0c'0' <= char && char < {{ 0c'9' + 1 }} } end
625 0f8 286a            goto main__108loop__forever
626                     ; loop_forever ... end
627                     ; procedure main end
628             
629                     ; procedure clock_adjust start
630             clock_adjust:
631     0028    clock_adjust__variables__base equ global__variables__bank0+8
632     0028    clock_adjust__bytes__base equ clock_adjust__variables__base+0
633     0031    clock_adjust__bits__base equ clock_adjust__variables__base+9
634     0009    clock_adjust__total__bytes equ 9
635     0030    clock_adjust__229byte0 equ clock_adjust__bytes__base+8
636     0030    clock_adjust__271byte0 equ clock_adjust__bytes__base+8
637     0030    clock_adjust__281byte0 equ clock_adjust__bytes__base+8
638     0030    clock_adjust__285byte0 equ clock_adjust__bytes__base+8
639     0028    clock_adjust__adjust equ clock_adjust__bytes__base+0
640                     ; This procedure will adjust the clock to the slave .
641     0029    clock_adjust__command equ clock_adjust__bytes__base+1
642     002a    clock_adjust__count equ clock_adjust__bytes__base+2
643     002b    clock_adjust__error equ clock_adjust__bytes__base+3
644     002c    clock_adjust__error_minimum equ clock_adjust__bytes__base+4
645     002d    clock_adjust__high equ clock_adjust__bytes__base+5
646     002e    clock_adjust__low equ clock_adjust__bytes__base+6
647     002f    clock_adjust__target equ clock_adjust__bytes__base+7
648                     ;   target := iterations_low - adjust  
649 0f9 303b            movlw 59
650 0fa 00b0            movwf clock_adjust__229byte0
651 0fb 0828            movf clock_adjust__adjust,w
652 0fc 0230            subwf clock_adjust__229byte0,w
653 0fd 00af            movwf clock_adjust__target
654                     ;   count := 2  
655 0fe 3002            movlw 2
656 0ff 00aa            movwf clock_adjust__count
657                     ;   error := 0xff  
658 100 30ff            movlw 255
659 101 00ab            movwf clock_adjust__error
660                     ;   error_minimum := 0xf0  
661 102 30f0            movlw 240
662 103 00ac            movwf clock_adjust__error_minimum
663                     ; Print out the target :
664                     ;   call master_send {{ 0c'T' }}  
665 104 3054            movlw 84
666 105 00df            movwf master_send__character
667 106 245c            call master_send
668                     ;   call master_octal {{ iterations_high }}  
669 107 3005            movlw 5
670 108 00d2            movwf master_octal__number
671 109 23e4            call master_octal
672                     ;   call master_octal {{ target }}  
673 10a 082f            movf clock_adjust__target,w
674 10b 00d2            movwf master_octal__number
675 10c 23e4            call master_octal
676                     ;   call master_crlf {{ }}  
677 10d 23cc            call master_crlf
678                     ; loop_forever ... start
679             clock_adjust__240loop__forever:
680                     ; Print out the clock value :
681                     ;   call master_send {{ 0c'C' }}  
682 10e 3043            movlw 67
683 10f 00df            movwf master_send__character
684 110 245c            call master_send
685                     ;   call slave_send {{ 0xfa }}  
686 111 30fa            movlw 250
687 112 00d5            movwf slave_send__data
688 113 2403            call slave_send
689                     ;   call master_octal {{ slave_get {{ }} }}  
690 114 23fd            call slave_get
691 115 0854            movf slave_get__0return__byte,w
692 116 00d2            movwf master_octal__number
693 117 23e4            call master_octal
694                     ; Ask for a timing byte :
695                     ;   call slave_send {{ 0xfb }}  
696 118 30fb            movlw 251
697 119 00d5            movwf slave_send__data
698 11a 2403            call slave_send
699                     ;   low := 0  
700 11b 01ae            clrf clock_adjust__low
701                     ;   high := 0  
702 11c 01ad            clrf clock_adjust__high
703                     ; `while rx_slave_pin ...' start
704             clock_adjust__251while__continue:
705                     ; expression=`rx_slave_pin' exp_delay=0 true_delay=2  false_delay=2 true_size=1 false_size=1
706 11d 1a86            btfsc rx_slave_pin__byte,rx_slave_pin__bit
707                     ; Do nothing :
708 11e 291d            goto clock_adjust__251while__continue
709 11f 2920            goto clock_adjust__251while__break
710                     ; if exp=`rx_slave_pin' true goto small true
711             clock_adjust__251while__break:
712                     ; `while rx_slave_pin ...' end
713                     ; `while  ! rx_slave_pin  ...' start
714             clock_adjust__254while__continue:
715                     ; expression=`rx_slave_pin' exp_delay=0 true_delay=2  false_delay=5 true_size=1 false_size=4
716 120 1a86            btfsc rx_slave_pin__byte,rx_slave_pin__bit
717 121 2926            goto clock_adjust__254while__break
718                     ;   low := low + 1  
719 122 0aae            incf clock_adjust__low,f
720                     ; if { z } start
721                     ; expression=`{ z }' exp_delay=0 true_delay=1  false_delay=0 true_size=1 false_size=0
722 123 1903            btfsc z__byte,z__bit
723                     ; if { z } body start
724                     ;   high := high + 1  
725 124 0aad            incf clock_adjust__high,f
726                     ; if { z } body end
727                     ; if exp=`z' false skip delay=2
728                     ; Other expression=`{ z }' delay=2
729                     ; if { z } end
730 125 2920            goto clock_adjust__254while__continue
731                     ; if exp=`rx_slave_pin' true goto
732                     ; Other expression=`rx_slave_pin' delay=-1
733             clock_adjust__254while__break:
734                     ; `while  ! rx_slave_pin  ...' end
735                     ; Print out high and low :
736                     ;   call master_send {{ 0c'H' }}  
737 126 3048            movlw 72
738 127 00df            movwf master_send__character
739 128 245c            call master_send
740                     ;   call master_octal {{ high }}  
741 129 082d            movf clock_adjust__high,w
742 12a 00d2            movwf master_octal__number
743 12b 23e4            call master_octal
744                     ;   call master_send {{ 0c'L' }}  
745 12c 304c            movlw 76
746 12d 00df            movwf master_send__character
747 12e 245c            call master_send
748                     ;   call master_octal {{ low }}  
749 12f 082e            movf clock_adjust__low,w
750 130 00d2            movwf master_octal__number
751 131 23e4            call master_octal
752                     ; Now think about adjusting clock .
753                     ; if { high > iterations_high } start
754 132 3006            movlw 6
755 133 022d            subwf clock_adjust__high,w
756                     ; expression=`{ high > iterations_high }' exp_delay=2 true_delay=7  false_delay=-1 true_size=7 false_size=36
757 134 1803            btfsc c___byte,c___bit
758 135 295b            goto label268__0true
759             label268__0false:
760 136 3005            movlw 5
761 137 022d            subwf clock_adjust__high,w
762                     ; expression=`{ high < iterations_high }' exp_delay=2 true_delay=4  false_delay=-1 true_size=4 false_size=27
763 138 1c03            btfss c___byte,c___bit
764 139 2956            goto label272__0true
765             label272__0false:
766                     ; else body start
767                     ; The high 8 - bits are equal :
768                     ; if { low > target } start
769 13a 082e            movf clock_adjust__low,w
770 13b 022f            subwf clock_adjust__target,w
771                     ; expression=`{ low > target }' exp_delay=2 true_delay=7  false_delay=-1 true_size=7 false_size=15
772 13c 1c03            btfss c___byte,c___bit
773 13d 294e            goto label278__0true
774             label278__0false:
775 13e 082f            movf clock_adjust__target,w
776 13f 022e            subwf clock_adjust__low,w
777                     ; expression=`{ low < target }' exp_delay=2 true_delay=7  false_delay=3 true_size=7 false_size=3
778 140 1c03            btfss c___byte,c___bit
779 141 2946            goto label282__0true
780             label282__0false:
781                     ; else body start
782                     ; Exact match ; we are done :
783                     ;   command := 0  
784 142 01a9            clrf clock_adjust__command
785                     ;   error := 0  
786 143 01ab            clrf clock_adjust__error
787                     ;   error_minimum := 0  
788 144 01ac            clrf clock_adjust__error_minimum
789                     ; else body end
790 145 294d            goto label282__0end
791             label282__0true:
792                     ; else_if { low < target } body start
793                     ; Clock pulse is too short ; slave clock is too fast :
794                     ;   command := 0xf8  
795 146 30f8            movlw 248
796 147 00a9            movwf clock_adjust__command
797                     ;   error := target - low  
798 148 082f            movf clock_adjust__target,w
799 149 00b0            movwf clock_adjust__285byte0
800 14a 082e            movf clock_adjust__low,w
801 14b 0230            subwf clock_adjust__285byte0,w
802 14c 00ab            movwf clock_adjust__error
803                     ; else_if { low < target } body end
804                     ; if exp=` low < target ' generic
805             label282__0end:
806                     ; Other expression=`{ low < target }' delay=-1
807 14d 2955            goto label278__0end
808             label278__0true:
809                     ; if { low > target } body start
810                     ; Clock pulse is too long ; slave clock is too slow :
811                     ;   command := 0xf9  
812 14e 30f9            movlw 249
813 14f 00a9            movwf clock_adjust__command
814                     ;   error := low - target  
815 150 082e            movf clock_adjust__low,w
816 151 00b0            movwf clock_adjust__281byte0
817 152 082f            movf clock_adjust__target,w
818 153 0230            subwf clock_adjust__281byte0,w
819 154 00ab            movwf clock_adjust__error
820                     ; if { low > target } body end
821                     ; if exp=` low > target ' generic
822             label278__0end:
823                     ; Other expression=`{ low > target }' delay=-1
824                     ; if { low > target } end
825                     ; else body end
826 155 295a            goto label272__0end
827             label272__0true:
828                     ; else_if { high < iterations_high } body start
829                     ; Clock pulse is too short ; slave clock is too fast :
830                     ;   command := 0xf8  
831 156 30f8            movlw 248
832 157 00a9            movwf clock_adjust__command
833                     ;   error := target  
834 158 082f            movf clock_adjust__target,w
835 159 00ab            movwf clock_adjust__error
836                     ; else_if { high < iterations_high } body end
837                     ; if exp=` high < iterations_high ' generic
838             label272__0end:
839                     ; Other expression=`{ high < iterations_high }' delay=-1
840 15a 2962            goto label268__0end
841             label268__0true:
842                     ; if { high > iterations_high } body start
843                     ; Clock pulse is too long ; slave clock is too slow :
844                     ;   command := 0xf9  
845 15b 30f9            movlw 249
846 15c 00a9            movwf clock_adjust__command
847                     ;   error := 0xff - target  
848 15d 30ff            movlw 255
849 15e 00b0            movwf clock_adjust__271byte0
850 15f 082f            movf clock_adjust__target,w
851 160 0230            subwf clock_adjust__271byte0,w
852 161 00ab            movwf clock_adjust__error
853                     ; if { high > iterations_high } body end
854                     ; if exp=` high > iterations_high ' generic
855             label268__0end:
856                     ; Other expression=`{ high > iterations_high }' delay=-1
857                     ; if { high > iterations_high } end
858                     ; Print out the error and error minimum :
859                     ;   call master_send {{ 0c'E' }}  
860 162 3045            movlw 69
861 163 00df            movwf master_send__character
862 164 245c            call master_send
863                     ;   call master_octal {{ error }}  
864 165 082b            movf clock_adjust__error,w
865 166 00d2            movwf master_octal__number
866 167 23e4            call master_octal
867                     ;   call master_send {{ 0c'M' }}  
868 168 304d            movlw 77
869 169 00df            movwf master_send__character
870 16a 245c            call master_send
871                     ;   call master_octal {{ error_minimum }}  
872 16b 082c            movf clock_adjust__error_minimum,w
873 16c 00d2            movwf master_octal__number
874 16d 23e4            call master_octal
875                     ; if { error = error_minimum } start
876 16e 082b            movf clock_adjust__error,w
877 16f 022c            subwf clock_adjust__error_minimum,w
878                     ; expression=`{ error = error_minimum }' exp_delay=2 true_delay=-1  false_delay=-1 true_size=2 false_size=14
879 170 1d03            btfss z___byte,z___bit
880 171 2975            goto label300__0false
881             label300__0true:
882                     ; if { error = error_minimum } body start
883                     ;   call master_crlf {{ }}  
884 172 23cc            call master_crlf
885                     ;   return  
886 173 3400            retlw 0
887                     ; if { error = error_minimum } body end
888 174 2983            goto label300__0end
889             label300__0false:
890 175 082c            movf clock_adjust__error_minimum,w
891 176 022b            subwf clock_adjust__error,w
892                     ; expression=`{ error < error_minimum }' exp_delay=2 true_delay=3  false_delay=-1 true_size=3 false_size=6
893 177 1c03            btfss c___byte,c___bit
894 178 2980            goto label303__0true
895             label303__0false:
896                     ; else body start
897                     ;   count := count - 1  
898 179 03aa            decf clock_adjust__count,f
899                     ; if { z } start
900                     ; expression=`{ z }' exp_delay=0 true_delay=3  false_delay=0 true_size=3 false_size=0
901 17a 1d03            btfss z__byte,z__bit
902 17b 297f            goto label308__0end
903                     ; if { z } body start
904                     ;   error_minimum := error_minimum + 1  
905 17c 0aac            incf clock_adjust__error_minimum,f
906                     ;   count := 2  
907 17d 3002            movlw 2
908 17e 00aa            movwf clock_adjust__count
909                     ; if { z } body end
910             label308__0end:
911                     ; if exp=`z' empty false
912                     ; Other expression=`{ z }' delay=-1
913                     ; if { z } end
914                     ; else body end
915 17f 2983            goto label303__0end
916             label303__0true:
917                     ; else_if { error < error_minimum } body start
918                     ;   error_minimum := error  
919 180 082b            movf clock_adjust__error,w
920 181 00ac            movwf clock_adjust__error_minimum
921                     ;   error := error + 1  
922 182 0aab            incf clock_adjust__error,f
923                     ; else_if { error < error_minimum } body end
924                     ; if exp=` error < error_minimum ' generic
925             label303__0end:
926                     ; Other expression=`{ error < error_minimum }' delay=-1
927                     ; if exp=` error = error_minimum ' generic
928             label300__0end:
929                     ; Other expression=`{ error = error_minimum }' delay=-1
930                     ; if { error = error_minimum } end
931                     ; Now adjust the clock :
932                     ;   call slave_send {{ command }}  
933 183 0829            movf clock_adjust__command,w
934 184 00d5            movwf slave_send__data
935 185 2403            call slave_send
936                     ;   call master_crlf {{ }}  
937 186 23cc            call master_crlf
938 187 290e            goto clock_adjust__240loop__forever
939                     ; loop_forever ... end
940                     ; procedure clock_adjust end
941             
942                     ; procedure test start
943             test:
944     0031    test__variables__base equ global__variables__bank0+17
945     0031    test__bytes__base equ test__variables__base+0
946     0031    test__bits__base equ test__variables__base+0
947     0000    test__total__bytes equ 0
948                     ;   arguments_none  
949                     ; This procedure will test the Shaft2 RoboBrick :
950                     ; Verify that the common commands are working :
951                     ;   call common_test {{ }}  
952 188 22ba            call common_test
953                     ; Verify that we can interrupt :
954                     ; call test_interrupt_setup < 0 >
955                     ; call test_interrupt_setup < 1 >
956                     ; call interrupt_test < >
957                     ; Test some shaft inputs :
958                     ;   call master_string {{ shaft_string }}  
959 189 3058            movlw LOW shaft_string+1
960 18a 00e0            movwf master_string__message
961 18b 2462            call master_string
962                     ;   call master_string {{ test_string }}  
963 18c 305f            movlw LOW test_string+1
964 18d 00e0            movwf master_string__message
965 18e 2462            call master_string
966                     ;   call master_crlf {{ }}  
967 18f 23cc            call master_crlf
968                     ;   call test_shaft {{ 0 , 0x10 , 0 }}  
969 190 01b3            clrf test_shaft__high
970 191 3010            movlw 16
971 192 00b4            movwf test_shaft__low
972 193 01b5            clrf test_shaft__shaft
973 194 2223            call test_shaft
974                     ;   call test_shaft {{ 0 , 0x10 , 1 }}  
975 195 01b3            clrf test_shaft__high
976 196 3010            movlw 16
977 197 00b4            movwf test_shaft__low
978 198 3001            movlw 1
979 199 00b5            movwf test_shaft__shaft
980 19a 2223            call test_shaft
981                     ; Now test interrupt ranges :
982                     ;   call master_string {{ interrupt_string }}  
983 19b 303b            movlw LOW interrupt_string+1
984 19c 00e0            movwf master_string__message
985 19d 2462            call master_string
986                     ;   call master_string {{ test_string }}  
987 19e 305f            movlw LOW test_string+1
988 19f 00e0            movwf master_string__message
989 1a0 2462            call master_string
990                     ;   call master_crlf {{ }}  
991 1a1 23cc            call master_crlf
992                     ;   call test_interrupt {{ 0 }}  
993 1a2 01b2            clrf test_interrupt__shaft
994 1a3 2206            call test_interrupt
995                     ;   call test_interrupt {{ 1 }}  
996 1a4 3001            movlw 1
997 1a5 00b2            movwf test_interrupt__shaft
998 1a6 2206            call test_interrupt
999                     ; Let ' s go test some registers :
1000                     ;   call master_string {{ register_string }}  
1001 1a7 3053            movlw LOW register_string+1
1002 1a8 00e0            movwf master_string__message
1003 1a9 2462            call master_string
1004                     ;   call master_string {{ test_string }}  
1005 1aa 305f            movlw LOW test_string+1
1006 1ab 00e0            movwf master_string__message
1007 1ac 2462            call master_string
1008                     ;   call master_crlf {{ }}  
1009 1ad 23cc            call master_crlf
1010                     ; Shaft low :
1011                     ;   call test_byte_register {{ 6 , 2 , 0x30 }}  
1012 1ae 3006            movlw 6
1013 1af 00b8            movwf test_byte_register__set_command
1014 1b0 3002            movlw 2
1015 1b1 00b9            movwf test_byte_register__read_command
1016 1b2 3030            movlw 48
1017 1b3 00ba            movwf test_byte_register__error
1018 1b4 224e            call test_byte_register
1019                     ;   call test_byte_register {{ 7 , 3 , 0x31 }}  
1020 1b5 3007            movlw 7
1021 1b6 00b8            movwf test_byte_register__set_command
1022 1b7 3003            movlw 3
1023 1b8 00b9            movwf test_byte_register__read_command
1024 1b9 3031            movlw 49
1025 1ba 00ba            movwf test_byte_register__error
1026 1bb 224e            call test_byte_register
1027                     ; Shaft :
1028                     ;   call test_word_register {{ 4 , 0 , 0x34 }}  
1029 1bc 3004            movlw 4
1030 1bd 00bd            movwf test_word_register__set_command
1031 1be 01be            clrf test_word_register__read_command
1032 1bf 3034            movlw 52
1033 1c0 00bf            movwf test_word_register__error
1034 1c1 2274            call test_word_register
1035                     ;   call test_word_register {{ 5 , 1 , 0x36 }}  
1036 1c2 3005            movlw 5
1037 1c3 00bd            movwf test_word_register__set_command
1038 1c4 3001            movlw 1
1039 1c5 00be            movwf test_word_register__read_command
1040 1c6 3036            movlw 54
1041 1c7 00bf            movwf test_word_register__error
1042 1c8 2274            call test_word_register
1043                     ; High threshold :
1044                     ;   call test_word_register {{ 0x10 , 0x14 , 0x38 }}  
1045 1c9 3010            movlw 16
1046 1ca 00bd            movwf test_word_register__set_command
1047 1cb 3014            movlw 20
1048 1cc 00be            movwf test_word_register__read_command
1049 1cd 3038            movlw 56
1050 1ce 00bf            movwf test_word_register__error
1051 1cf 2274            call test_word_register
1052                     ;   call test_word_register {{ 0x11 , 0x15 , 0x39 }}  
1053 1d0 3011            movlw 17
1054 1d1 00bd            movwf test_word_register__set_command
1055 1d2 3015            movlw 21
1056 1d3 00be            movwf test_word_register__read_command
1057 1d4 3039            movlw 57
1058 1d5 00bf            movwf test_word_register__error
1059 1d6 2274            call test_word_register
1060                     ; Low threshold :
1061                     ;   call test_word_register {{ 0x12 , 0x16 , 0x3a }}  
1062 1d7 3012            movlw 18
1063 1d8 00bd            movwf test_word_register__set_command
1064 1d9 3016            movlw 22
1065 1da 00be            movwf test_word_register__read_command
1066 1db 303a            movlw 58
1067 1dc 00bf            movwf test_word_register__error
1068 1dd 2274            call test_word_register
1069                     ;   call test_word_register {{ 0x13 , 0x17 , 0x3b }}  
1070 1de 3013            movlw 19
1071 1df 00bd            movwf test_word_register__set_command
1072 1e0 3017            movlw 23
1073 1e1 00be            movwf test_word_register__read_command
1074 1e2 303b            movlw 59
1075 1e3 00bf            movwf test_word_register__error
1076 1e4 2274            call test_word_register
1077                     ; Announce we are done :
1078                     ;   call master_string {{ done_string }}  
1079 1e5 3022            movlw LOW done_string+1
1080 1e6 00e0            movwf master_string__message
1081 1e7 2462            call master_string
1082                     ;   call master_crlf {{ }}  
1083 1e8 23cc            call master_crlf
1084                     ; procedure test end
1085 1e9 3400            retlw 0
1086             
1087                     ; procedure test_interrupt_setup start
1088             test_interrupt_setup:
1089     0031    test_interrupt_setup__variables__base equ global__variables__bank0+17
1090     0031    test_interrupt_setup__bytes__base equ test_interrupt_setup__variables__base+0
1091     0032    test_interrupt_setup__bits__base equ test_interrupt_setup__variables__base+1
1092     0001    test_interrupt_setup__total__bytes equ 1
1093     0031    test_interrupt_setup__shaft equ test_interrupt_setup__bytes__base+0
1094                     ; This procedure will set up the registers for shaft to be interrupt safe .
1095                     ; Set low threshold :
1096                     ;   call slave_send {{ 0x12 | shaft }}  
1097 1ea 3012            movlw 18
1098 1eb 0431            iorwf test_interrupt_setup__shaft,w
1099 1ec 00d5            movwf slave_send__data
1100 1ed 2403            call slave_send
1101                     ;   call slave_send {{ 0 }}  
1102 1ee 01d5            clrf slave_send__data
1103 1ef 2403            call slave_send
1104                     ;   call slave_send {{ 0x10 }}  
1105 1f0 3010            movlw 16
1106 1f1 00d5            movwf slave_send__data
1107 1f2 2403            call slave_send
1108                     ; Set high threshold :
1109                     ;   call slave_send {{ 0x10 | shaft }}  
1110 1f3 3010            movlw 16
1111 1f4 0431            iorwf test_interrupt_setup__shaft,w
1112 1f5 00d5            movwf slave_send__data
1113 1f6 2403            call slave_send
1114                     ;   call slave_send {{ 0 }}  
1115 1f7 01d5            clrf slave_send__data
1116 1f8 2403            call slave_send
1117                     ;   call slave_send {{ 0x30 }}  
1118 1f9 3030            movlw 48
1119 1fa 00d5            movwf slave_send__data
1120 1fb 2403            call slave_send
1121                     ; Set the shaft to the middle :
1122                     ;   call slave_send {{ 4 | shaft }}  
1123 1fc 3004            movlw 4
1124 1fd 0431            iorwf test_interrupt_setup__shaft,w
1125 1fe 00d5            movwf slave_send__data
1126 1ff 2403            call slave_send
1127                     ;   call slave_send {{ 0 }}  
1128 200 01d5            clrf slave_send__data
1129 201 2403            call slave_send
1130                     ;   call slave_send {{ 0x20 }}  
1131 202 3020            movlw 32
1132 203 00d5            movwf slave_send__data
1133 204 2403            call slave_send
1134                     ; procedure test_interrupt_setup end
1135 205 3400            retlw 0
1136             
1137                     ; procedure test_interrupt start
1138             test_interrupt:
1139     0032    test_interrupt__variables__base equ global__variables__bank0+18
1140     0032    test_interrupt__bytes__base equ test_interrupt__variables__base+0
1141     0033    test_interrupt__bits__base equ test_interrupt__variables__base+1
1142     0001    test_interrupt__total__bytes equ 1
1143     0032    test_interrupt__shaft equ test_interrupt__bytes__base+0
1144                     ; This procedure will test interrupts shaft .
1145                     ;   call test_interrupt_setup {{ 0 }}  
1146 206 01b1            clrf test_interrupt_setup__shaft
1147 207 21ea            call test_interrupt_setup
1148                     ;   call test_interrupt_setup {{ 1 }}  
1149 208 3001            movlw 1
1150 209 00b1            movwf test_interrupt_setup__shaft
1151 20a 21ea            call test_interrupt_setup
1152                     ; Now enable interrupts :
1153                     ;   call slave_send {{ 0xf2 }}  
1154 20b 30f2            movlw 242
1155 20c 00d5            movwf slave_send__data
1156 20d 2403            call slave_send
1157                     ; Let people know what is going on :
1158                     ;   call master_octal {{ shaft }}  
1159 20e 0832            movf test_interrupt__shaft,w
1160 20f 00d2            movwf master_octal__number
1161 210 23e4            call master_octal
1162                     ;   call master_send {{ 0c':' }}  
1163 211 303a            movlw 58
1164 212 00df            movwf master_send__character
1165 213 245c            call master_send
1166                     ;   call master_octal {{ 0x10 }}  
1167 214 3010            movlw 16
1168 215 00d2            movwf master_octal__number
1169 216 23e4            call master_octal
1170                     ;   call master_send {{ 0c'?' }}  
1171 217 303f            movlw 63
1172 218 00df            movwf master_send__character
1173 219 245c            call master_send
1174                     ;   call master_octal {{ 0x30 }}  
1175 21a 3030            movlw 48
1176 21b 00d2            movwf master_octal__number
1177 21c 23e4            call master_octal
1178                     ; Now wait for interrupt :
1179                     ; `while rx_slave_pin ...' start
1180             test_interrupt__413while__continue:
1181                     ; expression=`rx_slave_pin' exp_delay=0 true_delay=1  false_delay=2 true_size=2 false_size=1
1182 21d 1e86            btfss rx_slave_pin__byte,rx_slave_pin__bit
1183 21e 2a21            goto test_interrupt__413while__break
1184                     ;   call delay {{ }}  
1185 21f 2475            call delay
1186 220 2a1d            goto test_interrupt__413while__continue
1187                     ; if exp=`rx_slave_pin' false goto
1188                     ; Other expression=`rx_slave_pin' delay=-1
1189             test_interrupt__413while__break:
1190                     ; `while rx_slave_pin ...' end
1191                     ;   call master_crlf {{ }}  
1192 221 23cc            call master_crlf
1193                     ; procedure test_interrupt end
1194 222 3400            retlw 0
1195             
1196                     ; procedure test_shaft start
1197             test_shaft:
1198     0033    test_shaft__variables__base equ global__variables__bank0+19
1199     0033    test_shaft__bytes__base equ test_shaft__variables__base+0
1200     0038    test_shaft__bits__base equ test_shaft__variables__base+5
1201     0005    test_shaft__total__bytes equ 5
1202     0033    test_shaft__high equ test_shaft__bytes__base+0
1203     0034    test_shaft__low equ test_shaft__bytes__base+1
1204     0035    test_shaft__shaft equ test_shaft__bytes__base+2
1205                     ; This procedure will verify that the shaft can be
1206                     ; positioned to < high > and < low > .
1207     0036    test_shaft__current_high equ test_shaft__bytes__base+3
1208     0037    test_shaft__current_low equ test_shaft__bytes__base+4
1209                     ; Let the user know what we are shooting for :
1210                     ;   call master_octal {{ high }}  
1211 223 0833            movf test_shaft__high,w
1212 224 00d2            movwf master_octal__number
1213 225 23e4            call master_octal
1214                     ;   call master_octal {{ low }}  
1215 226 0834            movf test_shaft__low,w
1216 227 00d2            movwf master_octal__number
1217 228 23e4            call master_octal
1218                     ;   call master_send {{ 0c':' }}  
1219 229 303a            movlw 58
1220 22a 00df            movwf master_send__character
1221 22b 245c            call master_send
1222                     ;   call master_crlf {{ }}  
1223 22c 23cc            call master_crlf
1224                     ;   current_high := high + 1  
1225 22d 0a33            incf test_shaft__high,w
1226 22e 00b6            movwf test_shaft__current_high
1227                     ;   current_low := low + 1  
1228 22f 0a34            incf test_shaft__low,w
1229 230 00b7            movwf test_shaft__current_low
1230                     ; `while  high != current_high || low != current_low  ...' start
1231             test_shaft__440while__continue:
1232 231 0833            movf test_shaft__high,w
1233 232 0236            subwf test_shaft__current_high,w
1234                     ; expression=`high != current_high' exp_delay=2 true_delay=10  false_delay=-1 true_size=1 false_size=23
1235 233 1d03            btfss z___byte,z___bit
1236 234 2a39            goto or440__0true
1237 235 0834            movf test_shaft__low,w
1238 236 0237            subwf test_shaft__current_low,w
1239                     ; expression=`low != current_low' exp_delay=2 true_delay=8  false_delay=2 true_size=19 false_size=1
1240 237 1903            btfsc z___byte,z___bit
1241             or440__0false:
1242 238 2a4c            goto test_shaft__440while__break
1243             or440__0true:
1244                     ;   call slave_send {{ shaft }}  
1245 239 0835            movf test_shaft__shaft,w
1246 23a 00d5            movwf slave_send__data
1247 23b 2403            call slave_send
1248                     ;   current_high := slave_get {{ }}  
1249 23c 23fd            call slave_get
1250 23d 0854            movf slave_get__0return__byte,w
1251 23e 00b6            movwf test_shaft__current_high
1252                     ;   current_low := slave_get {{ }}  
1253 23f 23fd            call slave_get
1254 240 0854            movf slave_get__0return__byte,w
1255 241 00b7            movwf test_shaft__current_low
1256                     ;   call master_octal {{ current_high }}  
1257 242 0836            movf test_shaft__current_high,w
1258 243 00d2            movwf master_octal__number
1259 244 23e4            call master_octal
1260                     ;   call master_octal {{ current_low }}  
1261 245 0837            movf test_shaft__current_low,w
1262 246 00d2            movwf master_octal__number
1263 247 23e4            call master_octal
1264                     ;   call master_send {{ cr }}  
1265 248 300d            movlw 13
1266 249 00df            movwf master_send__character
1267 24a 245c            call master_send
1268 24b 2a31            goto test_shaft__440while__continue
1269                     ; if exp=`low != current_low' false goto
1270                     ; Other expression=`low != current_low' delay=-1
1271                     ; if exp=`high != current_high' true goto
1272                     ; Other expression=`high != current_high' delay=-1
1273             or440__0end:
1274             test_shaft__440while__break:
1275                     ; `while  high != current_high || low != current_low  ...' end
1276                     ;   call master_crlf {{ }}  
1277 24c 23cc            call master_crlf
1278                     ; procedure test_shaft end
1279 24d 3400            retlw 0
1280             
1281                     ; procedure test_byte_register start
1282             test_byte_register:
1283     0038    test_byte_register__variables__base equ global__variables__bank0+24
1284     0038    test_byte_register__bytes__base equ test_byte_register__variables__base+0
1285     003d    test_byte_register__bits__base equ test_byte_register__variables__base+5
1286     0005    test_byte_register__total__bytes equ 5
1287     0038    test_byte_register__set_command equ test_byte_register__bytes__base+0
1288     0039    test_byte_register__read_command equ test_byte_register__bytes__base+1
1289     003a    test_byte_register__error equ test_byte_register__bytes__base+2
1290                     ; This procedure will test the ability to set and read back
1291                     ; a byte register :
1292     003b    test_byte_register__index equ test_byte_register__bytes__base+3
1293     003c    test_byte_register__pattern equ test_byte_register__bytes__base+4
1294                     ;   index := 0  
1295 24e 01bb            clrf test_byte_register__index
1296                     ; `while  index < patterns . size  ...' start
1297             test_byte_register__464while__continue:
1298 24f 300b            movlw 11
1299 250 023b            subwf test_byte_register__index,w
1300                     ; expression=` index < patterns . size ' exp_delay=2 true_delay=1  false_delay=2 true_size=33 false_size=1
1301 251 1803            btfsc c___byte,c___bit
1302 252 2a73            goto test_byte_register__464while__break
1303                     ;   pattern := patterns ~~ {{ index }}  
1304 253 0a3b            incf test_byte_register__index,w
1305 254 018a            clrf pclath___register
1306 255 2045            call patterns
1307 256 00bc            movwf test_byte_register__pattern
1308                     ;   call slave_send {{ set_command }}  
1309 257 0838            movf test_byte_register__set_command,w
1310 258 00d5            movwf slave_send__data
1311 259 2403            call slave_send
1312                     ;   call slave_send {{ pattern }}  
1313 25a 083c            movf test_byte_register__pattern,w
1314 25b 00d5            movwf slave_send__data
1315 25c 2403            call slave_send
1316                     ;   call slave_send {{ read_command }}  
1317 25d 0839            movf test_byte_register__read_command,w
1318 25e 00d5            movwf slave_send__data
1319 25f 2403            call slave_send
1320                     ;   temp := slave_get {{ }}  
1321 260 23fd            call slave_get
1322 261 0854            movf slave_get__0return__byte,w
1323 262 00a0            movwf temp
1324                     ; if { temp != pattern } start
1325 263 023c            subwf test_byte_register__pattern,w
1326                     ; expression=`{ temp != pattern }' exp_delay=2 true_delay=5  false_delay=0 true_size=11 false_size=0
1327 264 1903            btfsc z___byte,z___bit
1328 265 2a71            goto label471__0end
1329                     ; if { temp != pattern } body start
1330                     ;   call master_octal {{ pattern }}  
1331 266 083c            movf test_byte_register__pattern,w
1332 267 00d2            movwf master_octal__number
1333 268 23e4            call master_octal
1334                     ;   call master_octal {{ temp }}  
1335 269 0820            movf temp,w
1336 26a 00d2            movwf master_octal__number
1337 26b 23e4            call master_octal
1338                     ;   call master_fail {{ register_string , error }}  
1339 26c 3053            movlw LOW register_string+1
1340 26d 00cf            movwf master_fail__test_name
1341 26e 083a            movf test_byte_register__error,w
1342 26f 00d0            movwf master_fail__test_number
1343 270 23d3            call master_fail
1344                     ; if { temp != pattern } body end
1345             label471__0end:
1346                     ; if exp=` temp != pattern ' empty false
1347                     ; Other expression=`{ temp != pattern }' delay=-1
1348                     ; if { temp != pattern } end
1349                     ;   index := index + 1  
1350 271 0abb            incf test_byte_register__index,f
1351 272 2a4f            goto test_byte_register__464while__continue
1352                     ; if exp=` index < patterns . size ' false goto
1353                     ; Other expression=` index < patterns . size ' delay=-1
1354             test_byte_register__464while__break:
1355                     ; `while  index < patterns . size  ...' end
1356                     ; procedure test_byte_register end
1357 273 3400            retlw 0
1358             
1359                     ; procedure test_word_register start
1360             test_word_register:
1361     003d    test_word_register__variables__base equ global__variables__bank0+29
1362     003d    test_word_register__bytes__base equ test_word_register__variables__base+0
1363     0044    test_word_register__bits__base equ test_word_register__variables__base+7
1364     0007    test_word_register__total__bytes equ 7
1365     003d    test_word_register__set_command equ test_word_register__bytes__base+0
1366     003e    test_word_register__read_command equ test_word_register__bytes__base+1
1367     003f    test_word_register__error equ test_word_register__bytes__base+2
1368                     ; This procedure will test the ability to set and read
1369                     ; back a word register :
1370     0040    test_word_register__low equ test_word_register__bytes__base+3
1371     0041    test_word_register__low_index equ test_word_register__bytes__base+4
1372     0042    test_word_register__high equ test_word_register__bytes__base+5
1373     0043    test_word_register__high_index equ test_word_register__bytes__base+6
1374                     ;   high_index := 0  
1375 274 01c3            clrf test_word_register__high_index
1376                     ; `while  high_index < patterns . size  ...' start
1377             test_word_register__495while__continue:
1378 275 300b            movlw 11
1379 276 0243            subwf test_word_register__high_index,w
1380                     ; expression=` high_index < patterns . size ' exp_delay=2 true_delay=1  false_delay=2 true_size=66 false_size=1
1381 277 1803            btfsc c___byte,c___bit
1382 278 2ab9            goto test_word_register__495while__break
1383                     ;   high := patterns ~~ {{ high_index }}  
1384 279 0a43            incf test_word_register__high_index,w
1385 27a 018a            clrf pclath___register
1386 27b 2045            call patterns
1387 27c 00c2            movwf test_word_register__high
1388                     ;   low_index := 0  
1389 27d 01c1            clrf test_word_register__low_index
1390                     ; `while  low_index < patterns . size  ...' start
1391             test_word_register__498while__continue:
1392 27e 300b            movlw 11
1393 27f 0241            subwf test_word_register__low_index,w
1394                     ; expression=` low_index < patterns . size ' exp_delay=2 true_delay=1  false_delay=2 true_size=55 false_size=1
1395 280 1803            btfsc c___byte,c___bit
1396 281 2ab7            goto test_word_register__498while__break
1397                     ;   low := patterns ~~ {{ low_index }}  
1398 282 0a41            incf test_word_register__low_index,w
1399 283 018a            clrf pclath___register
1400 284 2045            call patterns
1401 285 00c0            movwf test_word_register__low
1402                     ; Set the register :
1403                     ;   call slave_send {{ set_command }}  
1404 286 083d            movf test_word_register__set_command,w
1405 287 00d5            movwf slave_send__data
1406 288 2403            call slave_send
1407                     ;   call slave_send {{ high }}  
1408 289 0842            movf test_word_register__high,w
1409 28a 00d5            movwf slave_send__data
1410 28b 2403            call slave_send
1411                     ;   call slave_send {{ low }}  
1412 28c 0840            movf test_word_register__low,w
1413 28d 00d5            movwf slave_send__data
1414 28e 2403            call slave_send
1415                     ; Verify its contents :
1416                     ;   call slave_send {{ read_command }}  
1417 28f 083e            movf test_word_register__read_command,w
1418 290 00d5            movwf slave_send__data
1419 291 2403            call slave_send
1420                     ;   temp := slave_get {{ }}  
1421 292 23fd            call slave_get
1422 293 0854            movf slave_get__0return__byte,w
1423 294 00a0            movwf temp
1424                     ; if { temp != high } start
1425 295 0242            subwf test_word_register__high,w
1426                     ; expression=`{ temp != high }' exp_delay=2 true_delay=5  false_delay=0 true_size=11 false_size=0
1427 296 1903            btfsc z___byte,z___bit
1428 297 2aa3            goto label508__0end
1429                     ; if { temp != high } body start
1430                     ;   call master_octal {{ high }}  
1431 298 0842            movf test_word_register__high,w
1432 299 00d2            movwf master_octal__number
1433 29a 23e4            call master_octal
1434                     ;   call master_octal {{ temp }}  
1435 29b 0820            movf temp,w
1436 29c 00d2            movwf master_octal__number
1437 29d 23e4            call master_octal
1438                     ;   call master_fail {{ register_string , error }}  
1439 29e 3053            movlw LOW register_string+1
1440 29f 00cf            movwf master_fail__test_name
1441 2a0 083f            movf test_word_register__error,w
1442 2a1 00d0            movwf master_fail__test_number
1443 2a2 23d3            call master_fail
1444                     ; if { temp != high } body end
1445             label508__0end:
1446                     ; if exp=` temp != high ' empty false
1447                     ; Other expression=`{ temp != high }' delay=-1
1448                     ; if { temp != high } end
1449                     ;   temp := slave_get {{ }}  
1450 2a3 23fd            call slave_get
1451 2a4 0854            movf slave_get__0return__byte,w
1452 2a5 00a0            movwf temp
1453                     ; if { temp != low } start
1454 2a6 0240            subwf test_word_register__low,w
1455                     ; expression=`{ temp != low }' exp_delay=2 true_delay=6  false_delay=0 true_size=12 false_size=0
1456 2a7 1903            btfsc z___byte,z___bit
1457 2a8 2ab5            goto label514__0end
1458                     ; if { temp != low } body start
1459                     ;   call master_octal {{ low }}  
1460 2a9 0840            movf test_word_register__low,w
1461 2aa 00d2            movwf master_octal__number
1462 2ab 23e4            call master_octal
1463                     ;   call master_octal {{ temp }}  
1464 2ac 0820            movf temp,w
1465 2ad 00d2            movwf master_octal__number
1466 2ae 23e4            call master_octal
1467                     ;   call master_fail {{ register_string , error | 1 }}  
1468 2af 3053            movlw LOW register_string+1
1469 2b0 00cf            movwf master_fail__test_name
1470 2b1 3001            movlw 1
1471 2b2 043f            iorwf test_word_register__error,w
1472 2b3 00d0            movwf master_fail__test_number
1473 2b4 23d3            call master_fail
1474                     ; if { temp != low } body end
1475             label514__0end:
1476                     ; if exp=` temp != low ' empty false
1477                     ; Other expression=`{ temp != low }' delay=-1
1478                     ; if { temp != low } end
1479                     ;   low_index := low_index + 1  
1480 2b5 0ac1            incf test_word_register__low_index,f
1481 2b6 2a7e            goto test_word_register__498while__continue
1482                     ; if exp=` low_index < patterns . size ' false goto
1483                     ; Other expression=` low_index < patterns . size ' delay=-1
1484             test_word_register__498while__break:
1485                     ; `while  low_index < patterns . size  ...' end
1486                     ;   high_index := high_index + 1  
1487 2b7 0ac3            incf test_word_register__high_index,f
1488 2b8 2a75            goto test_word_register__495while__continue
1489                     ; if exp=` high_index < patterns . size ' false goto
1490                     ; Other expression=` high_index < patterns . size ' delay=-1
1491             test_word_register__495while__break:
1492                     ; `while  high_index < patterns . size  ...' end
1493                     ; procedure test_word_register end
1494 2b9 3400            retlw 0
1495                     ; comment {The procedures below are used to test the common shared commands :}
1496             
1497                     ; procedure common_test start
1498             common_test:
1499     0044    common_test__variables__base equ global__variables__bank0+36
1500     0044    common_test__bytes__base equ common_test__variables__base+0
1501     0046    common_test__bits__base equ common_test__variables__base+2
1502     0002    common_test__total__bytes equ 2
1503     0045    common_test__570byte0 equ common_test__bytes__base+1
1504                     ;   arguments_none  
1505                     ; This procedure will verify that the common shared commands work .
1506     0044    common_test__actual equ common_test__bytes__base+0
1507                     ; Print the ID information :
1508                     ; ID reset :
1509                     ;   call slave_send {{ 0xfd }}  
1510 2ba 30fd            movlw 253
1511 2bb 00d5            movwf slave_send__data
1512 2bc 2403            call slave_send
1513                     ; Read the fixed bytes :
1514                     ;   call common_test_id_match {{ 1 , 0xc0 }}  
1515 2bd 3001            movlw 1
1516 2be 00c6            movwf common_test_id_match__desired
1517 2bf 30c0            movlw 192
1518 2c0 00c7            movwf common_test_id_match__test_number
1519 2c1 2330            call common_test_id_match
1520                     ;   call common_test_id_match {{ 0 , 0xc1 }}  
1521 2c2 01c6            clrf common_test_id_match__desired
1522 2c3 30c1            movlw 193
1523 2c4 00c7            movwf common_test_id_match__test_number
1524 2c5 2330            call common_test_id_match
1525                     ;   call common_test_id_match {{ 16 , 0xc2 }}  
1526 2c6 3010            movlw 16
1527 2c7 00c6            movwf common_test_id_match__desired
1528 2c8 30c2            movlw 194
1529 2c9 00c7            movwf common_test_id_match__test_number
1530 2ca 2330            call common_test_id_match
1531                     ;   call common_test_id_match {{ 1 , 0xc3 }}  
1532 2cb 3001            movlw 1
1533 2cc 00c6            movwf common_test_id_match__desired
1534 2cd 30c3            movlw 195
1535 2ce 00c7            movwf common_test_id_match__test_number
1536 2cf 2330            call common_test_id_match
1537                     ;   call common_test_id_match {{ 0 , 0xc4 }}  
1538 2d0 01c6            clrf common_test_id_match__desired
1539 2d1 30c4            movlw 196
1540 2d2 00c7            movwf common_test_id_match__test_number
1541 2d3 2330            call common_test_id_match
1542                     ;   call common_test_id_match {{ 0 , 0xc5 }}  
1543 2d4 01c6            clrf common_test_id_match__desired
1544 2d5 30c5            movlw 197
1545 2d6 00c7            movwf common_test_id_match__test_number
1546 2d7 2330            call common_test_id_match
1547                     ;   call common_test_id_match {{ 0 , 0xc6 }}  
1548 2d8 01c6            clrf common_test_id_match__desired
1549 2d9 30c6            movlw 198
1550 2da 00c7            movwf common_test_id_match__test_number
1551 2db 2330            call common_test_id_match
1552                     ;   call common_test_id_match {{ 0 , 0xc7 }}  
1553 2dc 01c6            clrf common_test_id_match__desired
1554 2dd 30c7            movlw 199
1555 2de 00c7            movwf common_test_id_match__test_number
1556 2df 2330            call common_test_id_match
1557                     ;   call master_crlf {{ }}  
1558 2e0 23cc            call master_crlf
1559                     ;   call common_test_id_bytes8 {{ }}  
1560 2e1 233f            call common_test_id_bytes8
1561                     ;   call common_test_id_bytes8 {{ }}  
1562 2e2 233f            call common_test_id_bytes8
1563                     ; Read the brick name :
1564                     ;   call common_test_id_string {{ }}  
1565 2e3 2349            call common_test_id_string
1566                     ; Read the vendor name :
1567                     ;   call common_test_id_string {{ }}  
1568 2e4 2349            call common_test_id_string
1569                     ; Verfify that we don ' t read off the end of the id and crash :
1570                     ;   call common_test_id_next {{ }}  
1571 2e5 2354            call common_test_id_next
1572 2e6 084b            movf common_test_id_next__0return__byte,w
1573                     ; Reset id :
1574                     ;   call slave_send {{ 0xfd }}  
1575 2e7 30fd            movlw 253
1576 2e8 00d5            movwf slave_send__data
1577 2e9 2403            call slave_send
1578                     ; Verify that we are still alive :
1579                     ;   call common_test_id_match {{ 1 , 0xc8 }}  
1580 2ea 3001            movlw 1
1581 2eb 00c6            movwf common_test_id_match__desired
1582 2ec 30c8            movlw 200
1583 2ed 00c7            movwf common_test_id_match__test_number
1584 2ee 2330            call common_test_id_match
1585                     ; Read glitch :
1586                     ; Clear glitch register :
1587                     ;   call slave_send {{ 0xfe }}  
1588 2ef 30fe            movlw 254
1589 2f0 00d5            movwf slave_send__data
1590 2f1 2403            call slave_send
1591                     ;   actual := slave_get {{ }}  
1592 2f2 23fd            call slave_get
1593 2f3 0854            movf slave_get__0return__byte,w
1594 2f4 00c4            movwf common_test__actual
1595                     ; Send a couple of glitches :
1596                     ;   call slave_send {{ 0xff }}  
1597 2f5 30ff            movlw 255
1598 2f6 00d5            movwf slave_send__data
1599 2f7 2403            call slave_send
1600                     ;   call slave_send {{ 0xff }}  
1601 2f8 30ff            movlw 255
1602 2f9 00d5            movwf slave_send__data
1603 2fa 2403            call slave_send
1604                     ; Read the glitch register :
1605                     ;   call slave_send {{ 0xfe }}  
1606 2fb 30fe            movlw 254
1607 2fc 00d5            movwf slave_send__data
1608 2fd 2403            call slave_send
1609                     ; if { slave_get {{ }} != 2 } start
1610 2fe 23fd            call slave_get
1611 2ff 0854            movf slave_get__0return__byte,w
1612 300 00c5            movwf common_test__570byte0
1613 301 3002            movlw 2
1614 302 0245            subwf common_test__570byte0,w
1615                     ; expression=`{ slave_get {{ }} != 2 }' exp_delay=3 true_delay=3  false_delay=0 true_size=5 false_size=0
1616 303 1903            btfsc z___byte,z___bit
1617 304 2b0a            goto label570__1end
1618                     ; if { slave_get {{ }} != 2 } body start
1619                     ;   call master_fail {{ common_string , 0xc9 }}  
1620 305 301a            movlw LOW common_string+1
1621 306 00cf            movwf master_fail__test_name
1622 307 30c9            movlw 201
1623 308 00d0            movwf master_fail__test_number
1624 309 23d3            call master_fail
1625                     ; if { slave_get {{ }} != 2 } body end
1626             label570__1end:
1627                     ; if exp=` slave_get ## {{ }} != 2 ' empty false
1628                     ; Other expression=`{ slave_get {{ }} != 2 }' delay=-1
1629                     ; if { slave_get {{ }} != 2 } end
1630                     ; Do a clock pulse :
1631                     ;   call slave_send {{ 0xfb }}  
1632 30a 30fb            movlw 251
1633 30b 00d5            movwf slave_send__data
1634 30c 2403            call slave_send
1635                     ; if { slave_get {{ }} != 0 } start
1636 30d 23fd            call slave_get
1637 30e 0854            movf slave_get__0return__byte,w
1638                     ; expression=`{ slave_get {{ }} != 0 }' exp_delay=0 true_delay=3  false_delay=0 true_size=5 false_size=0
1639 30f 1903            btfsc z___byte,z___bit
1640 310 2b16            goto label576__0end
1641                     ; if { slave_get {{ }} != 0 } body start
1642                     ;   call master_fail {{ common_string , 0xca }}  
1643 311 301a            movlw LOW common_string+1
1644 312 00cf            movwf master_fail__test_name
1645 313 30ca            movlw 202
1646 314 00d0            movwf master_fail__test_number
1647 315 23d3            call master_fail
1648                     ; if { slave_get {{ }} != 0 } body end
1649             label576__0end:
1650                     ; if exp=` slave_get ## {{ }} != 0 ' empty false
1651                     ; Other expression=`{ slave_get {{ }} != 0 }' delay=-1
1652                     ; if { slave_get {{ }} != 0 } end
1653                     ; Read clock :
1654                     ;   call slave_send {{ 0xfa }}  
1655 316 30fa            movlw 250
1656 317 00d5            movwf slave_send__data
1657 318 2403            call slave_send
1658                     ;   actual := slave_get {{ }}  
1659 319 23fd            call slave_get
1660 31a 0854            movf slave_get__0return__byte,w
1661 31b 00c4            movwf common_test__actual
1662                     ; Increment :
1663                     ;   call slave_send {{ 0xf9 }}  
1664 31c 30f9            movlw 249
1665 31d 00d5            movwf slave_send__data
1666 31e 2403            call slave_send
1667                     ; Decrement :
1668                     ;   call slave_send {{ 0xf8 }}  
1669 31f 30f8            movlw 248
1670 320 00d5            movwf slave_send__data
1671 321 2403            call slave_send
1672                     ; Read clock again :
1673                     ;   call slave_send {{ 0xfa }}  
1674 322 30fa            movlw 250
1675 323 00d5            movwf slave_send__data
1676 324 2403            call slave_send
1677                     ; if { actual != slave_get {{ }} } start
1678 325 23fd            call slave_get
1679 326 0854            movf slave_get__0return__byte,w
1680 327 0244            subwf common_test__actual,w
1681                     ; expression=`{ actual != slave_get {{ }} }' exp_delay=1 true_delay=3  false_delay=0 true_size=5 false_size=0
1682 328 1903            btfsc z___byte,z___bit
1683 329 2b2f            goto label588__0end
1684                     ; if { actual != slave_get {{ }} } body start
1685                     ;   call master_fail {{ common_string , 0xcb }}  
1686 32a 301a            movlw LOW common_string+1
1687 32b 00cf            movwf master_fail__test_name
1688 32c 30cb            movlw 203
1689 32d 00d0            movwf master_fail__test_number
1690 32e 23d3            call master_fail
1691                     ; if { actual != slave_get {{ }} } body end
1692             label588__0end:
1693                     ; if exp=` actual != slave_get ## {{ }} ' empty false
1694                     ; Other expression=`{ actual != slave_get {{ }} }' delay=-1
1695                     ; if { actual != slave_get {{ }} } end
1696                     ; procedure common_test end
1697 32f 3400            retlw 0
1698             
1699                     ; procedure common_test_id_match start
1700             common_test_id_match:
1701     0046    common_test_id_match__variables__base equ global__variables__bank0+38
1702     0046    common_test_id_match__bytes__base equ common_test_id_match__variables__base+0
1703     0049    common_test_id_match__bits__base equ common_test_id_match__variables__base+3
1704     0003    common_test_id_match__total__bytes equ 3
1705     0046    common_test_id_match__desired equ common_test_id_match__bytes__base+0
1706     0047    common_test_id_match__test_number equ common_test_id_match__bytes__base+1
1707                     ; This procedure will verify that the next byte in the id is < desired > .
1708     0048    common_test_id_match__id equ common_test_id_match__bytes__base+2
1709                     ;   id := common_test_id_next {{ }}  
1710 330 2354            call common_test_id_next
1711 331 084b            movf common_test_id_next__0return__byte,w
1712 332 00c8            movwf common_test_id_match__id
1713                     ;   call master_octal {{ id }}  
1714 333 00d2            movwf master_octal__number
1715 334 23e4            call master_octal
1716                     ; if { desired != id } start
1717 335 0846            movf common_test_id_match__desired,w
1718 336 0248            subwf common_test_id_match__id,w
1719                     ; expression=`{ desired != id }' exp_delay=2 true_delay=3  false_delay=0 true_size=5 false_size=0
1720 337 1903            btfsc z___byte,z___bit
1721 338 2b3e            goto label604__0end
1722                     ; if { desired != id } body start
1723                     ;   call master_fail {{ common_string , test_number }}  
1724 339 301a            movlw LOW common_string+1
1725 33a 00cf            movwf master_fail__test_name
1726 33b 0847            movf common_test_id_match__test_number,w
1727 33c 00d0            movwf master_fail__test_number
1728 33d 23d3            call master_fail
1729                     ; if { desired != id } body end
1730             label604__0end:
1731                     ; if exp=` desired != id ' empty false
1732                     ; Other expression=`{ desired != id }' delay=-1
1733                     ; if { desired != id } end
1734                     ; procedure common_test_id_match end
1735 33e 3400            retlw 0
1736             
1737                     ; procedure common_test_id_bytes8 start
1738             common_test_id_bytes8:
1739     0049    common_test_id_bytes8__variables__base equ global__variables__bank0+41
1740     0049    common_test_id_bytes8__bytes__base equ common_test_id_bytes8__variables__base+0
1741     004a    common_test_id_bytes8__bits__base equ common_test_id_bytes8__variables__base+1
1742     0001    common_test_id_bytes8__total__bytes equ 1
1743                     ;   arguments_none  
1744                     ; This procedure will print out the next 8 bytes of the id in octal .
1745     0049    common_test_id_bytes8__count equ common_test_id_bytes8__bytes__base+0
1746                     ; `count_down count 8 ...' start
1747 33f 3008            movlw 8
1748 340 00c9            movwf common_test_id_bytes8__count
1749             common_test_id_bytes8__617_loop:
1750                     ;   call master_octal {{ common_test_id_next {{ }} }}  
1751 341 2354            call common_test_id_next
1752 342 084b            movf common_test_id_next__0return__byte,w
1753 343 00d2            movwf master_octal__number
1754 344 23e4            call master_octal
1755 345 0bc9            decfsz common_test_id_bytes8__count,f
1756 346 2b41            goto common_test_id_bytes8__617_loop
1757             common_test_id_bytes8__617_done:
1758                     ; `count_down count 8 ...' end
1759                     ;   call master_crlf {{ }}  
1760 347 23cc            call master_crlf
1761                     ; procedure common_test_id_bytes8 end
1762 348 3400            retlw 0
1763             
1764                     ; procedure common_test_id_string start
1765             common_test_id_string:
1766     004a    common_test_id_string__variables__base equ global__variables__bank0+42
1767     004a    common_test_id_string__bytes__base equ common_test_id_string__variables__base+0
1768     004b    common_test_id_string__bits__base equ common_test_id_string__variables__base+1
1769     0001    common_test_id_string__total__bytes equ 1
1770                     ;   arguments_none  
1771                     ; This procedure will print out the next id string .
1772     004a    common_test_id_string__count equ common_test_id_string__bytes__base+0
1773                     ; `count_down count  common_test_id_next ## {{ }}  ...' start
1774 349 2354            call common_test_id_next
1775 34a 084b            movf common_test_id_next__0return__byte,w
1776 34b 00ca            movwf common_test_id_string__count
1777             common_test_id_string__631_loop:
1778                     ;   call master_send {{ common_test_id_next {{ }} }}  
1779 34c 2354            call common_test_id_next
1780 34d 084b            movf common_test_id_next__0return__byte,w
1781 34e 00df            movwf master_send__character
1782 34f 245c            call master_send
1783 350 0bca            decfsz common_test_id_string__count,f
1784 351 2b4c            goto common_test_id_string__631_loop
1785             common_test_id_string__631_done:
1786                     ; `count_down count  common_test_id_next ## {{ }}  ...' end
1787                     ;   call master_crlf {{ }}  
1788 352 23cc            call master_crlf
1789                     ; procedure common_test_id_string end
1790 353 3400            retlw 0
1791             
1792                     ; procedure common_test_id_next start
1793             common_test_id_next:
1794     004b    common_test_id_next__variables__base equ global__variables__bank0+43
1795     004b    common_test_id_next__bytes__base equ common_test_id_next__variables__base+0
1796     004c    common_test_id_next__bits__base equ common_test_id_next__variables__base+1
1797     0001    common_test_id_next__total__bytes equ 1
1798                     ;   arguments_none  
1799     004b    common_test_id_next__0return__byte equ common_test_id_next__bytes__base+0
1800                     ; This procedure returns the next byte from the identification string .
1801                     ;   call slave_send {{ 0xfc }}  
1802 354 30fc            movlw 252
1803 355 00d5            movwf slave_send__data
1804 356 2403            call slave_send
1805                     ;   return slave_get {{ }}  
1806 357 23fd            call slave_get
1807 358 0854            movf slave_get__0return__byte,w
1808 359 00cb            movwf common_test_id_next__0return__byte
1809 35a 3400            retlw 0
1810                     ; procedure common_test_id_next end
1811                     ; comment {The procedures below are used to test the shared interrupt commands :}
1812             
1813                     ; procedure interrupt_test start
1814             interrupt_test:
1815     004c    interrupt_test__variables__base equ global__variables__bank0+44
1816     004c    interrupt_test__bytes__base equ interrupt_test__variables__base+0
1817     004d    interrupt_test__bits__base equ interrupt_test__variables__base+1
1818     0001    interrupt_test__total__bytes equ 1
1819                     ;   arguments_none  
1820                     ; This procedure tests the common shared interrupt commands .
1821     004c    interrupt_test__counter equ interrupt_test__bytes__base+0
1822                     ; Clear interrupt bits :
1823                     ;   call slave_send {{ 0xf0 }}  
1824 35b 30f0            movlw 240
1825 35c 00d5            movwf slave_send__data
1826 35d 2403            call slave_send
1827                     ;   call interrupt_read {{ 0 , 0xd0 }}  
1828 35e 01cd            clrf interrupt_read__desired
1829 35f 30d0            movlw 208
1830 360 00ce            movwf interrupt_read__test_number
1831 361 23ba            call interrupt_read
1832                     ; Set / clear interrupt pending bit only :
1833                     ;   call slave_send {{ 0xf5 }}  
1834 362 30f5            movlw 245
1835 363 00d5            movwf slave_send__data
1836 364 2403            call slave_send
1837                     ;   call interrupt_read {{ 1 , 0xd1 }}  
1838 365 3001            movlw 1
1839 366 00cd            movwf interrupt_read__desired
1840 367 30d1            movlw 209
1841 368 00ce            movwf interrupt_read__test_number
1842 369 23ba            call interrupt_read
1843                     ;   call slave_send {{ 0xf4 }}  
1844 36a 30f4            movlw 244
1845 36b 00d5            movwf slave_send__data
1846 36c 2403            call slave_send
1847                     ;   call interrupt_read {{ 0 , 0xd2 }}  
1848 36d 01cd            clrf interrupt_read__desired
1849 36e 30d2            movlw 210
1850 36f 00ce            movwf interrupt_read__test_number
1851 370 23ba            call interrupt_read
1852                     ;   call slave_send {{ 0xf1 }}  
1853 371 30f1            movlw 241
1854 372 00d5            movwf slave_send__data
1855 373 2403            call slave_send
1856                     ;   call interrupt_read {{ 1 , 0xd3 }}  
1857 374 3001            movlw 1
1858 375 00cd            movwf interrupt_read__desired
1859 376 30d3            movlw 211
1860 377 00ce            movwf interrupt_read__test_number
1861 378 23ba            call interrupt_read
1862                     ;   call slave_send {{ 0xf0 }}  
1863 379 30f0            movlw 240
1864 37a 00d5            movwf slave_send__data
1865 37b 2403            call slave_send
1866                     ;   call interrupt_read {{ 0 , 0xd4 }}  
1867 37c 01cd            clrf interrupt_read__desired
1868 37d 30d4            movlw 212
1869 37e 00ce            movwf interrupt_read__test_number
1870 37f 23ba            call interrupt_read
1871                     ; Set / clear interrupt enable bit only :
1872                     ;   call slave_send {{ 0xf7 }}  
1873 380 30f7            movlw 247
1874 381 00d5            movwf slave_send__data
1875 382 2403            call slave_send
1876                     ;   call interrupt_read {{ 2 , 0xd5 }}  
1877 383 3002            movlw 2
1878 384 00cd            movwf interrupt_read__desired
1879 385 30d5            movlw 213
1880 386 00ce            movwf interrupt_read__test_number
1881 387 23ba            call interrupt_read
1882                     ;   call slave_send {{ 0xf6 }}  
1883 388 30f6            movlw 246
1884 389 00d5            movwf slave_send__data
1885 38a 2403            call slave_send
1886                     ;   call interrupt_read {{ 0 , 0xd6 }}  
1887 38b 01cd            clrf interrupt_read__desired
1888 38c 30d6            movlw 214
1889 38d 00ce            movwf interrupt_read__test_number
1890 38e 23ba            call interrupt_read
1891                     ;   call slave_send {{ 0xf2 }}  
1892 38f 30f2            movlw 242
1893 390 00d5            movwf slave_send__data
1894 391 2403            call slave_send
1895                     ;   call interrupt_read {{ 2 , 0xd7 }}  
1896 392 3002            movlw 2
1897 393 00cd            movwf interrupt_read__desired
1898 394 30d7            movlw 215
1899 395 00ce            movwf interrupt_read__test_number
1900 396 23ba            call interrupt_read
1901                     ;   call slave_send {{ 0xf0 }}  
1902 397 30f0            movlw 240
1903 398 00d5            movwf slave_send__data
1904 399 2403            call slave_send
1905                     ;   call interrupt_read {{ 0 , 0xd8 }}  
1906 39a 01cd            clrf interrupt_read__desired
1907 39b 30d8            movlw 216
1908 39c 00ce            movwf interrupt_read__test_number
1909 39d 23ba            call interrupt_read
1910                     ; Now set both the interrupt enable and pending bit .
1911                     ; This must trigger an interrupt .
1912                     ;   call slave_send {{ 0xf3 }}  
1913 39e 30f3            movlw 243
1914 39f 00d5            movwf slave_send__data
1915 3a0 2403            call slave_send
1916                     ; `count_down counter 3 ...' start
1917 3a1 3003            movlw 3
1918 3a2 00cc            movwf interrupt_test__counter
1919             interrupt_test__685_loop:
1920                     ;   call delay {{ }}  
1921 3a3 2475            call delay
1922 3a4 0bcc            decfsz interrupt_test__counter,f
1923 3a5 2ba3            goto interrupt_test__685_loop
1924             interrupt_test__685_done:
1925                     ; `count_down counter 3 ...' end
1926                     ; if { rx_slave_pin } start
1927                     ; expression=`{ rx_slave_pin }' exp_delay=0 true_delay=3  false_delay=0 true_size=5 false_size=0
1928 3a6 1e86            btfss rx_slave_pin__byte,rx_slave_pin__bit
1929 3a7 2bad            goto label688__0end
1930                     ; if { rx_slave_pin } body start
1931                     ; No interrupt detected :
1932                     ;   call master_fail {{ interrupt_string , 0xd9 }}  
1933 3a8 303b            movlw LOW interrupt_string+1
1934 3a9 00cf            movwf master_fail__test_name
1935 3aa 30d9            movlw 217
1936 3ab 00d0            movwf master_fail__test_number
1937 3ac 23d3            call master_fail
1938                     ; if { rx_slave_pin } body end
1939             label688__0end:
1940                     ; if exp=`rx_slave_pin' empty false
1941                     ; Other expression=`{ rx_slave_pin }' delay=-1
1942                     ; if { rx_slave_pin } end
1943                     ; Read the interrupt enable bit is cleared as a side effect
1944                     ; of reading the bit .
1945                     ;   call interrupt_read {{ 1 , 0xda }}  
1946 3ad 3001            movlw 1
1947 3ae 00cd            movwf interrupt_read__desired
1948 3af 30da            movlw 218
1949 3b0 00ce            movwf interrupt_read__test_number
1950 3b1 23ba            call interrupt_read
1951                     ; Clear the interrupt pending bit :
1952                     ;   call slave_send {{ 0xf0 }}  
1953 3b2 30f0            movlw 240
1954 3b3 00d5            movwf slave_send__data
1955 3b4 2403            call slave_send
1956                     ;   call interrupt_read {{ 0 , 0xdb }}  
1957 3b5 01cd            clrf interrupt_read__desired
1958 3b6 30db            movlw 219
1959 3b7 00ce            movwf interrupt_read__test_number
1960 3b8 23ba            call interrupt_read
1961                     ; procedure interrupt_test end
1962 3b9 3400            retlw 0
1963             
1964                     ; procedure interrupt_read start
1965             interrupt_read:
1966     004d    interrupt_read__variables__base equ global__variables__bank0+45
1967     004d    interrupt_read__bytes__base equ interrupt_read__variables__base+0
1968     004f    interrupt_read__bits__base equ interrupt_read__variables__base+2
1969     0002    interrupt_read__total__bytes equ 2
1970     004d    interrupt_read__desired equ interrupt_read__bytes__base+0
1971     004e    interrupt_read__test_number equ interrupt_read__bytes__base+1
1972                     ; This procedure will verify that the interrupt bits match < desired > .
1973                     ;   call slave_send {{ 0xef }}  
1974 3ba 30ef            movlw 239
1975 3bb 00d5            movwf slave_send__data
1976 3bc 2403            call slave_send
1977                     ;   temp := slave_get {{ }}  
1978 3bd 23fd            call slave_get
1979 3be 0854            movf slave_get__0return__byte,w
1980 3bf 00a0            movwf temp
1981                     ; if { temp != desired } start
1982 3c0 024d            subwf interrupt_read__desired,w
1983                     ; expression=`{ temp != desired }' exp_delay=2 true_delay=4  false_delay=0 true_size=8 false_size=0
1984 3c1 1903            btfsc z___byte,z___bit
1985 3c2 2bcb            goto label710__0end
1986                     ; if { temp != desired } body start
1987                     ;   call master_octal {{ temp }}  
1988 3c3 0820            movf temp,w
1989 3c4 00d2            movwf master_octal__number
1990 3c5 23e4            call master_octal
1991                     ;   call master_fail {{ interrupt_string , test_number }}  
1992 3c6 303b            movlw LOW interrupt_string+1
1993 3c7 00cf            movwf master_fail__test_name
1994 3c8 084e            movf interrupt_read__test_number,w
1995 3c9 00d0            movwf master_fail__test_number
1996 3ca 23d3            call master_fail
1997                     ; if { temp != desired } body end
1998             label710__0end:
1999                     ; if exp=` temp != desired ' empty false
2000                     ; Other expression=`{ temp != desired }' delay=-1
2001                     ; if { temp != desired } end
2002                     ; procedure interrupt_read end
2003 3cb 3400            retlw 0
2004                     ; comment {The following procedures are used to communicate with the master :}
2005             
2006                     ; procedure master_crlf start
2007             master_crlf:
2008     004f    master_crlf__variables__base equ global__variables__bank0+47
2009     004f    master_crlf__bytes__base equ master_crlf__variables__base+0
2010     004f    master_crlf__bits__base equ master_crlf__variables__base+0
2011     0000    master_crlf__total__bytes equ 0
2012                     ;   arguments_none  
2013                     ; This procedure will output a carriage - return line - feed
2014                     ; to the master .
2015                     ;   call master_send {{ cr }}  
2016 3cc 300d            movlw 13
2017 3cd 00df            movwf master_send__character
2018 3ce 245c            call master_send
2019                     ;   call master_send {{ lf }}  
2020 3cf 300a            movlw 10
2021 3d0 00df            movwf master_send__character
2022 3d1 245c            call master_send
2023                     ; procedure master_crlf end
2024 3d2 3400            retlw 0
2025             
2026                     ; procedure master_fail start
2027             master_fail:
2028     004f    master_fail__variables__base equ global__variables__bank0+47
2029     004f    master_fail__bytes__base equ master_fail__variables__base+0
2030     0051    master_fail__bits__base equ master_fail__variables__base+2
2031     0002    master_fail__total__bytes equ 2
2032     004f    master_fail__test_name equ master_fail__bytes__base+0
2033     0050    master_fail__test_number equ master_fail__bytes__base+1
2034                     ; This procedure will output ` fail ' followed by a carriage return
2035                     ; and line feed .
2036                     ;   call master_string {{ fail_string }}  
2037 3d3 3028            movlw LOW fail_string+1
2038 3d4 00e0            movwf master_string__message
2039 3d5 2462            call master_string
2040                     ;   call master_string {{ test_name }}  
2041 3d6 084f            movf master_fail__test_name,w
2042 3d7 00e0            movwf master_string__message
2043 3d8 2462            call master_string
2044                     ;   call master_octal {{ test_number }}  
2045 3d9 0850            movf master_fail__test_number,w
2046 3da 00d2            movwf master_octal__number
2047 3db 23e4            call master_octal
2048                     ;   call master_crlf {{ }}  
2049 3dc 23cc            call master_crlf
2050                     ; procedure master_fail end
2051 3dd 3400            retlw 0
2052             
2053                     ; procedure master_get start
2054             master_get:
2055     0051    master_get__variables__base equ global__variables__bank0+49
2056     0051    master_get__bytes__base equ master_get__variables__base+0
2057     0052    master_get__bits__base equ master_get__variables__base+1
2058     0001    master_get__total__bytes equ 1
2059                     ;   arguments_none  
2060     0051    master_get__0return__byte equ master_get__bytes__base+0
2061                     ; This procedure will get the next byte or return 0xfc if
2062                     ; no byte is forthcoming .
2063                     ;   return get_byte {{ rx_master_mask }}  
2064 3de 3002            movlw 2
2065 3df 00d6            movwf get_byte__mask
2066 3e0 2409            call get_byte
2067 3e1 0857            movf get_byte__0return__byte,w
2068 3e2 00d1            movwf master_get__0return__byte
2069 3e3 3400            retlw 0
2070                     ; procedure master_get end
2071             
2072                     ; procedure master_octal start
2073             master_octal:
2074     0052    master_octal__variables__base equ global__variables__bank0+50
2075     0052    master_octal__bytes__base equ master_octal__variables__base+0
2076     0054    master_octal__bits__base equ master_octal__variables__base+2
2077     0002    master_octal__total__bytes equ 2
2078     0053    master_octal__760byte0 equ master_octal__bytes__base+1
2079     0053    master_octal__761byte0 equ master_octal__bytes__base+1
2080     0052    master_octal__number equ master_octal__bytes__base+0
2081                     ; This procedure will output < number > in octal to the tx port .
2082                     ; Output the character in octal :
2083                     ;   call master_send {{ {{ number >> 6 }} + 0c'0' }}  
2084 3e4 0e52            swapf master_octal__number,w
2085 3e5 00d3            movwf master_octal__760byte0
2086 3e6 0cd3            rrf master_octal__760byte0,f
2087 3e7 0c53            rrf master_octal__760byte0,w
2088 3e8 3903            andlw 3
2089 3e9 3e30            addlw 48
2090 3ea 00df            movwf master_send__character
2091 3eb 245c            call master_send
2092                     ;   call master_send {{ {{ {{ number >> 3 }} & 7 }} + 0c'0' }}  
2093 3ec 0c52            rrf master_octal__number,w
2094 3ed 00d3            movwf master_octal__761byte0
2095 3ee 0cd3            rrf master_octal__761byte0,f
2096 3ef 0c53            rrf master_octal__761byte0,w
2097 3f0 3907            andlw 7
2098 3f1 3e30            addlw 48
2099 3f2 00df            movwf master_send__character
2100 3f3 245c            call master_send
2101                     ;   call master_send {{ {{ number & 7 }} + 0c'0' }}  
2102 3f4 3007            movlw 7
2103 3f5 0552            andwf master_octal__number,w
2104 3f6 3e30            addlw 48
2105 3f7 00df            movwf master_send__character
2106 3f8 245c            call master_send
2107                     ;   call master_send {{ sp }}  
2108 3f9 3020            movlw 32
2109 3fa 00df            movwf master_send__character
2110 3fb 245c            call master_send
2111                     ; procedure master_octal end
2112 3fc 3400            retlw 0
2113             
2114                     ; procedure slave_get start
2115             slave_get:
2116     0054    slave_get__variables__base equ global__variables__bank0+52
2117     0054    slave_get__bytes__base equ slave_get__variables__base+0
2118     0055    slave_get__bits__base equ slave_get__variables__base+1
2119     0001    slave_get__total__bytes equ 1
2120                     ;   arguments_none  
2121     0054    slave_get__0return__byte equ slave_get__bytes__base+0
2122                     ; This procedure will get a byte from the slave or return 0xfc
2123                     ; if no byte is forthcoming .
2124                     ;   return get_byte {{ rx_slave_mask }}  
2125 3fd 3020            movlw 32
2126 3fe 00d6            movwf get_byte__mask
2127 3ff 2409            call get_byte
2128 400 0857            movf get_byte__0return__byte,w
2129 401 00d4            movwf slave_get__0return__byte
2130 402 3400            retlw 0
2131                     ; procedure slave_get end
2132             
2133                     ; procedure slave_send start
2134             slave_send:
2135     0055    slave_send__variables__base equ global__variables__bank0+53
2136     0055    slave_send__bytes__base equ slave_send__variables__base+0
2137     0056    slave_send__bits__base equ slave_send__variables__base+1
2138     0001    slave_send__total__bytes equ 1
2139     0055    slave_send__data equ slave_send__bytes__base+0
2140                     ; This procedure will send one byte of < data > to the slave .
2141                     ;   call send_byte {{ data , tx_slave_mask }}  
2142 403 0855            movf slave_send__data,w
2143 404 00db            movwf send_byte__char
2144 405 3010            movlw 16
2145 406 00dc            movwf send_byte__mask
2146 407 2436            call send_byte
2147                     ; procedure slave_send end
2148 408 3400            retlw 0
2149                     ; comment {The last procedures do character sending and receiving :}
2150             
2151                     ; procedure get_byte start
2152             get_byte:
2153     0056    get_byte__variables__base equ global__variables__bank0+54
2154     0056    get_byte__bytes__base equ get_byte__variables__base+0
2155     005b    get_byte__bits__base equ get_byte__variables__base+5
2156     0005    get_byte__total__bytes equ 5
2157     005a    get_byte__817byte1 equ get_byte__bytes__base+4
2158     0056    get_byte__mask equ get_byte__bytes__base+0
2159     0057    get_byte__0return__byte equ get_byte__bytes__base+1
2160                     ; Get an 8 - bit byte from < mask > bit of < portb > and return it .
2161                     ; If no character shows up in a while 0xfc is returned .
2162     0058    get_byte__count equ get_byte__bytes__base+2
2163     0059    get_byte__char equ get_byte__bytes__base+3
2164                     ; Wait until a start bit arrives :
2165                     ;   count := 0  
2166 409 01d8            clrf get_byte__count
2167                     ; `while  portb & mask != 0  ...' start
2168             get_byte__799while__continue:
2169 40a 0806            movf portb,w
2170 40b 0556            andwf get_byte__mask,w
2171                     ; expression=` portb & mask != 0 ' exp_delay=2 true_delay=1  false_delay=2 true_size=9 false_size=1
2172 40c 1903            btfsc z___byte,z___bit
2173 40d 2c17            goto get_byte__799while__break
2174                     ;   count := count - 1  
2175 40e 03d8            decf get_byte__count,f
2176                     ; if { count = 0 } start
2177 40f 0858            movf get_byte__count,w
2178                     ; expression=`{ count = 0 }' exp_delay=1 true_delay=3  false_delay=0 true_size=3 false_size=0
2179 410 1d03            btfss z___byte,z___bit
2180 411 2c15            goto label801__0end
2181                     ; if { count = 0 } body start
2182                     ;   return 0xfc  
2183 412 30fc            movlw 252
2184 413 00d7            movwf get_byte__0return__byte
2185 414 3400            retlw 0
2186                     ; if { count = 0 } body end
2187             label801__0end:
2188                     ; if exp=` count = 0 ' empty false
2189                     ; Other expression=`{ count = 0 }' delay=-1
2190                     ; if { count = 0 } end
2191                     ;   call delay {{ }}  
2192 415 2475            call delay
2193 416 2c0a            goto get_byte__799while__continue
2194                     ; if exp=` portb & mask != 0 ' false goto
2195                     ; Other expression=` portb & mask != 0 ' delay=-1
2196             get_byte__799while__break:
2197                     ; `while  portb & mask != 0  ...' end
2198                     ; Skip over the start bit :
2199                     ;   call delay {{ }}  
2200 417 2475            call delay
2201                     ;   call delay {{ }}  
2202 418 2475            call delay
2203                     ;   call delay {{ }}  
2204 419 2475            call delay
2205                     ; Sample in the middle third of each data bit :
2206                     ; 1 cycle :
2207                     ;   char := 0  
2208 41a 01d9            clrf get_byte__char
2209                     ; 2 cycles for loop setup :
2210                     ; 1 + 2 = 3
2211                     ; nop extra_instructions_per_bit - 3
2212                     ; Delay 9 cycles
2213 41b 3002            movlw 2
2214 41c 00da            movwf get_byte__817byte1
2215             get_byte__817delay0:
2216 41d 0bda            decfsz get_byte__817byte1,f
2217 41e 2c1d            goto get_byte__817delay0
2218 41f 0000            nop
2219 420 0000            nop
2220                     ; `count_down count 8 ...' start
2221 421 3008            movlw 8
2222 422 00d8            movwf get_byte__count
2223             get_byte__818_loop:
2224                     ;   call delay {{ }}  
2225 423 2475            call delay
2226                     ; 2 cycles :
2227                     ;   char := char >> 1  
2228 424 1003            bcf c___byte,c___bit
2229 425 0cd9            rrf get_byte__char,f
2230                     ; 3 cycles :
2231                     ; if { portb & mask != 0 } start
2232 426 0806            movf portb,w
2233 427 0556            andwf get_byte__mask,w
2234                     ; expression=`{ portb & mask != 0 }' exp_delay=2 true_delay=1  false_delay=0 true_size=1 false_size=0
2235 428 1d03            btfss z___byte,z___bit
2236                     ; if { portb & mask != 0 } body start
2237                     ;   char @ 7 := 1  
2238                     ; Select char @ 7
2239     0059    get_byte__char__824select0 equ get_byte__char+0
2240     0059    get_byte__char__824select0__byte equ get_byte__char+0
2241     0007    get_byte__char__824select0__bit equ 7
2242 429 17d9            bsf get_byte__char__824select0__byte,get_byte__char__824select0__bit
2243                     ; if { portb & mask != 0 } body end
2244                     ; if exp=` portb & mask != 0 ' false skip delay=4
2245                     ; Other expression=`{ portb & mask != 0 }' delay=4
2246                     ; if { portb & mask != 0 } end
2247                     ;   call delay {{ }}  
2248 42a 2475            call delay
2249                     ;   call delay {{ }}  
2250 42b 2475            call delay
2251                     ; 3 cycles at end of loop :
2252                     ; 2 + 3 + 3 = 8
2253                     ; nop extra_instructions_per_bit - 8
2254                     ; Delay 4 cycles
2255 42c 0000            nop
2256 42d 0000            nop
2257 42e 0000            nop
2258 42f 0000            nop
2259 430 0bd8            decfsz get_byte__count,f
2260 431 2c23            goto get_byte__818_loop
2261             get_byte__818_done:
2262                     ; `count_down count 8 ...' end
2263                     ; Skip over 1 / 3 of the stop bit :
2264                     ;   call delay {{ }}  
2265 432 2475            call delay
2266                     ;   return char  
2267 433 0859            movf get_byte__char,w
2268 434 00d7            movwf get_byte__0return__byte
2269 435 3400            retlw 0
2270                     ; procedure get_byte end
2271             
2272                     ; procedure send_byte start
2273             send_byte:
2274     005b    send_byte__variables__base equ global__variables__bank0+59
2275     005b    send_byte__bytes__base equ send_byte__variables__base+0
2276     005f    send_byte__bits__base equ send_byte__variables__base+4
2277     0004    send_byte__total__bytes equ 4
2278     005b    send_byte__char equ send_byte__bytes__base+0
2279     005c    send_byte__mask equ send_byte__bytes__base+1
2280                     ; Send < char > to < mask > bit of < portb > .
2281     005d    send_byte__count equ send_byte__bytes__base+2
2282     005e    send_byte__mark equ send_byte__bytes__base+3
2283                     ; Send the start bit :
2284                     ; 3 cycles :
2285                     ;   mark := mask ^ space  
2286 436 30ff            movlw 255
2287 437 065c            xorwf send_byte__mask,w
2288 438 00de            movwf send_byte__mark
2289                     ; 1 cycle < mark is already in W > :
2290                     ;   portb := mark  
2291 439 0086            movwf portb
2292                     ;   call delay {{ }}  
2293 43a 2475            call delay
2294                     ;   call delay {{ }}  
2295 43b 2475            call delay
2296                     ;   call delay {{ }}  
2297 43c 2475            call delay
2298                     ; 2 cycles for loop setup :
2299                     ; 3 + 1 + 2 = 6
2300                     ; nop extra_instructions_per_bit - 6
2301                     ; Delay 6 cycles
2302 43d 0000            nop
2303 43e 0000            nop
2304 43f 0000            nop
2305 440 0000            nop
2306 441 0000            nop
2307 442 0000            nop
2308                     ; Send the data :
2309                     ; `count_down count 8 ...' start
2310 443 3008            movlw 8
2311 444 00dd            movwf send_byte__count
2312             send_byte__862_loop:
2313                     ; 5 cycles :
2314                     ; if { char @ 0 } start
2315                     ; Alias variable for select char @ 0
2316     005b    send_byte__char__864select0 equ send_byte__char+0
2317     005b    send_byte__char__864select0__byte equ send_byte__char+0
2318     0000    send_byte__char__864select0__bit equ 0
2319                     ; expression=`{ char @ 0 }' exp_delay=0 true_delay=1  false_delay=1 true_size=1 false_size=1
2320 445 185b            btfsc send_byte__char__864select0__byte,send_byte__char__864select0__bit
2321                     ; if { char @ 0 } body start
2322                     ;   portb := space  
2323 446 30ff            movlw 255
2324                     ; 1 instructions found for sharing
2325 447 1c5b            btfss send_byte__char__864select0__byte,send_byte__char__864select0__bit
2326                     ; else body start
2327                     ;   portb := mark  
2328 448 085e            movf send_byte__mark,w
2329                     ; 1 instructions found for sharing
2330                     ; if exp=` char @ 0 ' single true and false skip delay=4
2331                     ; Other expression=`{ char @ 0 }' delay=4
2332                     ; 1 shared instructions follow
2333 449 0086            movwf portb
2334                     ; if { char @ 0 } end
2335                     ; 2 cycles :
2336                     ;   char := char >> 1  
2337 44a 1003            bcf c___byte,c___bit
2338 44b 0cdb            rrf send_byte__char,f
2339                     ;   call delay {{ }}  
2340 44c 2475            call delay
2341                     ;   call delay {{ }}  
2342 44d 2475            call delay
2343                     ;   call delay {{ }}  
2344 44e 2475            call delay
2345                     ; 3 cycles at end of loop :
2346                     ; 5 + 2 + 3 = 10
2347                     ; nop extra_instructions_per_bit - 10
2348                     ; Delay 2 cycles
2349 44f 0000            nop
2350 450 0000            nop
2351 451 0bdd            decfsz send_byte__count,f
2352 452 2c45            goto send_byte__862_loop
2353             send_byte__862_done:
2354                     ; `count_down count 8 ...' end
2355                     ; Send the stop bit :
2356                     ; 1 cycle to finish off previous loop :
2357                     ; nop 1
2358                     ; Delay 1 cycles
2359 453 0000            nop
2360                     ; 2 cycles :
2361                     ;   portb := space  
2362 454 30ff            movlw 255
2363 455 0086            movwf portb
2364                     ;   call delay {{ }}  
2365 456 2475            call delay
2366                     ;   call delay {{ }}  
2367 457 2475            call delay
2368                     ;   call delay {{ }}  
2369 458 2475            call delay
2370                     ; 4 cycles for call / return :
2371                     ; 4 cycles for tw arguments :
2372                     ; 2 + 4 + 4 = 10
2373                     ; nop extra_instructions_per_bit - 10
2374                     ; Delay 2 cycles
2375 459 0000            nop
2376 45a 0000            nop
2377                     ; procedure send_byte end
2378 45b 3400            retlw 0
2379             
2380                     ; procedure master_send start
2381             master_send:
2382     005f    master_send__variables__base equ global__variables__bank0+63
2383     005f    master_send__bytes__base equ master_send__variables__base+0
2384     0060    master_send__bits__base equ master_send__variables__base+1
2385     0001    master_send__total__bytes equ 1
2386     005f    master_send__character equ master_send__bytes__base+0
2387                     ; This procedure will output < character > to the master .
2388                     ;   call send_byte {{ character , tx_master_mask }}  
2389 45c 085f            movf master_send__character,w
2390 45d 00db            movwf send_byte__char
2391 45e 3004            movlw 4
2392 45f 00dc            movwf send_byte__mask
2393 460 2436            call send_byte
2394                     ; procedure master_send end
2395 461 3400            retlw 0
2396             
2397                     ; procedure master_string start
2398             master_string:
2399     0060    master_string__variables__base equ global__variables__bank0+64
2400     0060    master_string__bytes__base equ master_string__variables__base+0
2401     0063    master_string__bits__base equ master_string__variables__base+3
2402     0003    master_string__total__bytes equ 3
2403     0060    master_string__message equ master_string__bytes__base+0
2404                     ; This procedure will output < message > to the master .
2405     0061    master_string__size equ master_string__bytes__base+1
2406     0062    master_string__index equ master_string__bytes__base+2
2407                     ;   index := 0  
2408 462 01e2            clrf master_string__index
2409                     ; `while  index < message . size  ...' start
2410             master_string__912while__continue:
2411 463 018a            clrf pclath___register
2412 464 0860            movf master_string__message,w
2413 465 200e            call string___fetch
2414 466 0262            subwf master_string__index,w
2415                     ; expression=` index < message . size ' exp_delay=4 true_delay=7  false_delay=2 true_size=8 false_size=1
2416 467 1803            btfsc c___byte,c___bit
2417 468 2c71            goto master_string__912while__break
2418                     ;   call master_send {{ message ~~ {{ index }} }}  
2419 469 0a62            incf master_string__index,w
2420 46a 0760            addwf master_string__message,w
2421 46b 018a            clrf pclath___register
2422 46c 200e            call string___fetch
2423 46d 00df            movwf master_send__character
2424 46e 245c            call master_send
2425                     ;   index := index + 1  
2426 46f 0ae2            incf master_string__index,f
2427 470 2c63            goto master_string__912while__continue
2428                     ; if exp=` index < message . size ' false goto
2429                     ; Other expression=` index < message . size ' delay=-1
2430             master_string__912while__break:
2431                     ; `while  index < message . size  ...' end
2432                     ;   call master_send {{ sp }}  
2433 471 3020            movlw 32
2434 472 00df            movwf master_send__character
2435 473 245c            call master_send
2436                     ; procedure master_string end
2437 474 3400            retlw 0
2438             
2439                     ; procedure delay start
2440                     ; optimize 0
2441             delay:
2442     0063    delay__variables__base equ global__variables__bank0+67
2443     0063    delay__bytes__base equ delay__variables__base+0
2444     0064    delay__bits__base equ delay__variables__base+1
2445     0001    delay__total__bytes equ 1
2446     0063    delay__919byte1 equ delay__bytes__base+0
2447                     ;   arguments_none  
2448                     ;   uniform_delay delay_instructions  
2449                     ; Uniform delay remaining = 339 Accumulated Delay = 0
2450                     ; Uniform delay remaining = 339 Accumulated Delay = 0
2451                     ; Delay 1 third of a bit :
2452                     ; Uniform delay remaining = 339 Accumulated Delay = 0
2453                     ;   watch_dog_reset  
2454 475 0064            clrwdt
2455                     ; Uniform delay remaining = 338 Accumulated Delay = 1
2456                     ; Uniform delay remaining = 338 Accumulated Delay = 1
2457                     ; Soak up remaining 338 cycles
2458                     ; Delay 338 cycles
2459 476 3070            movlw 112
2460 477 00e3            movwf delay__919byte1
2461             delay__919delay0:
2462 478 0be3            decfsz delay__919byte1,f
2463 479 2c78            goto delay__919delay0
2464 47a 0000            nop
2465                     ; procedure delay end
2466 47b 3400            retlw 0
2467                     ; optimize 1
2468             
2469                     ; Register bank 0 used 68 bytes of 96 available bytes
2470                     ; Register bank 1 used 0 bytes of 80 available bytes
2471                     ; Register bank 2 used 0 bytes of 48 available bytes
2472                     ; Register bank 3 used 0 bytes of 0 available bytes
2473             
2474                     end

