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

