  1                     radix dec
  2     000c    global__variables__bank0 equ 12
  3     00ff    global__variables__bank1 equ 255
  4     0049    global__bit__variables__bank0 equ 73
  5     00ff    global__bit__variables__bank1 equ 255
  6     0000    indf___register equ 0
  7     0002    pcl___register equ 2
  8     0003    c___byte equ 3
  9     0000    c___bit equ 0
 10     0003    z___byte equ 3
 11     0002    z___bit equ 2
 12     0003    rp0___byte equ 3
 13     0005    rp0___bit equ 5
 14     0003    rp1___byte equ 3
 15     0006    rp1___bit equ 6
 16     0003    irp___byte equ 3
 17     0007    irp___bit equ 7
 18     0085    trisa___register equ 0x85
 19     0086    trisb___register equ 0x86
 20     0004    fsr___register equ 4
 21     000a    pclath___register equ 10
 22                     org 0
 23             start:
 24 000 0000            nop
 25 001 0000            nop
 26 002 0000            nop
 27 003 2805            goto skip___interrupt
 28             interrupt___vector:
 29 004 0009            retfie
 30             skip___interrupt:
 31                     ; Initialize TRIS registers
 32 005 30e9            movlw 233
 33                     ; Switch from register bank 0 to register bank 1 (which contains trisa___register)
 34 006 1683            bsf rp0___byte,rp0___bit
 35                     ; Register bank is now 1
 36 007 0085            movwf trisa___register
 37 008 018a            clrf pclath___register
 38                     ; Switch from register bank 1 to register bank 0
 39 009 1283            bcf rp0___byte,rp0___bit
 40                     ; Register bank is now 0
 41 00a 2881            goto main
 42                     ; comment #############################################################################
 43                     ; comment {}
 44                     ; comment {Copyright < c > 1999 - 2001 by Wayne C . Gramlich .}
 45                     ; comment {All rights reserved .}
 46                     ; comment {}
 47                     ; comment {Permission to use , copy , modify , distribute , and sell this software}
 48                     ; comment {for any purpose is hereby granted without fee provided that the above}
 49                     ; comment {copyright notice and this permission are retained . The author makes}
 50                     ; comment {no representations about the suitability of this software for any purpose .}
 51                     ; comment {It is provided { as is } without express or implied warranty .}
 52                     ; comment {}
 53                     ; comment {This is a test harness for testing the Threshold4 RoboBrick . Please see :}
 54                     ; comment {}
 55                     ; comment {http : / / web . gramlich . net / projects / robobricks / threshold4 / index . html}
 56                     ; comment {}
 57                     ; comment {for more details .}
 58                     ; comment {}
 59                     ; comment #############################################################################
 60                     ;   processor pic16f84 cp = off dp = off pwrte = disabled wdte = disabled fosc = xt  
 61                     ; 16377=0x3ff9 8199=0x2007
 62                     __config 16377
 63     2007    configuration___address equ 8199
 64                     ;   constant clock_rate 4000000  
 65     3d0900    clock_rate equ 4000000
 66                     ;   constant instruction_rate clock_rate / 4  
 67     f4240    instruction_rate equ 1000000
 68                     ;   constant baud_rate 2400  
 69     0960    baud_rate equ 2400
 70                     ;   constant instructions_per_bit instruction_rate / baud_rate  
 71     01a0    instructions_per_bit equ 416
 72                     ;   constant delays_per_bit 3  
 73     0003    delays_per_bit equ 3
 74                     ;   constant instructions_per_delay instructions_per_bit / delays_per_bit  
 75     008a    instructions_per_delay equ 138
 76                     ;   constant delay_count instructions_per_delay / 6  
 77     0017    delay_count equ 23
 78                     ;   constant cr 13  
 79     000d    cr equ 13
 80                     ;   constant lf 10  
 81     000a    lf equ 10
 82                     ;   constant sp 32  
 83     0020    sp equ 32
 84                     ; comment {Some bit definitions :}
 85                     ;   constant rx_slave_bit 0  
 86     0000    rx_slave_bit equ 0
 87                     ;   constant tx_slave_bit 1  
 88     0001    tx_slave_bit equ 1
 89                     ;   constant tx_master_bit 2  
 90     0002    tx_master_bit equ 2
 91                     ;   constant rx_master_bit 3  
 92     0003    rx_master_bit equ 3
 93                     ;   constant rx_slave_mask 1 << rx_slave_bit  
 94     0001    rx_slave_mask equ 1
 95                     ;   constant tx_slave_mask 1 << tx_slave_bit  
 96     0002    tx_slave_mask equ 2
 97                     ;   constant rx_master_mask 1 << rx_master_bit  
 98     0008    rx_master_mask equ 8
 99                     ;   constant tx_master_mask 1 << tx_master_bit  
100     0004    tx_master_mask equ 4
101     0005    porta equ 5
102     0005    tx_master_pin__byte equ 5
103     0002    tx_master_pin__bit equ 2
104     0005    rx_master_pin__byte equ 5
105     0003    rx_master_pin__bit equ 3
106     0005    tx_slave_pin__byte equ 5
107     0001    tx_slave_pin__bit equ 1
108     0005    rx_slave_pin__byte equ 5
109     0000    rx_slave_pin__bit equ 0
110     0005    heart__byte equ 5
111     0004    heart__bit equ 4
112     0006    portb equ 6
113                     ;   constant space 0xff  
114     00ff    space equ 255
115     0049    receiving equ global__bit__variables__bank0+0
116     0049    receiving__byte equ global__bit__variables__bank0+0
117     0000    receiving__bit equ 0
118                     ; string_constants Start
119             string___fetch:
120 00b 0082            movwf pcl___register
121                     ;   hello_string = 0s'Threshold4'  
122     0000    hello_string___string equ 0
123             hello_string:
124 00c 0782            addwf pcl___register,f
125                     ; Length = 10
126 00d 340a            retlw 10
127                     ; `Threshold4'
128 00e 3454            retlw 84
129 00f 3468            retlw 104
130 010 3472            retlw 114
131 011 3465            retlw 101
132 012 3473            retlw 115
133 013 3468            retlw 104
134 014 346f            retlw 111
135 015 346c            retlw 108
136 016 3464            retlw 100
137 017 3434            retlw 52
138                     ;   common_string = 0s'Common'  
139     000c    common_string___string equ 12
140             common_string:
141 018 0782            addwf pcl___register,f
142                     ; Length = 6
143 019 3406            retlw 6
144                     ; `Common'
145 01a 3443            retlw 67
146 01b 346f            retlw 111
147 01c 346d            retlw 109
148 01d 346d            retlw 109
149 01e 346f            retlw 111
150 01f 346e            retlw 110
151                     ;   interrupt_string = 0s'Interrupt'  
152     0014    interrupt_string___string equ 20
153             interrupt_string:
154 020 0782            addwf pcl___register,f
155                     ; Length = 9
156 021 3409            retlw 9
157                     ; `Interrupt'
158 022 3449            retlw 73
159 023 346e            retlw 110
160 024 3474            retlw 116
161 025 3465            retlw 101
162 026 3472            retlw 114
163 027 3472            retlw 114
164 028 3475            retlw 117
165 029 3470            retlw 112
166 02a 3474            retlw 116
167                     ;   complement_string = 0s'Compl'  
168     001f    complement_string___string equ 31
169             complement_string:
170 02b 0782            addwf pcl___register,f
171                     ; Length = 5
172 02c 3405            retlw 5
173                     ; `Compl'
174 02d 3443            retlw 67
175 02e 346f            retlw 111
176 02f 346d            retlw 109
177 030 3470            retlw 112
178 031 346c            retlw 108
179                     ;   register_string = 0s'Reg'  
180     0026    register_string___string equ 38
181             register_string:
182 032 0782            addwf pcl___register,f
183                     ; Length = 3
184 033 3403            retlw 3
185                     ; `Reg'
186 034 3452            retlw 82
187 035 3465            retlw 101
188 036 3467            retlw 103
189                     ;   high_string = 0s'High'  
190     002b    high_string___string equ 43
191             high_string:
192 037 0782            addwf pcl___register,f
193                     ; Length = 4
194 038 3404            retlw 4
195                     ; `High'
196 039 3448            retlw 72
197 03a 3469            retlw 105
198 03b 3467            retlw 103
199 03c 3468            retlw 104
200                     ;   low_string = 0s'Low'  
201     0031    low_string___string equ 49
202             low_string:
203 03d 0782            addwf pcl___register,f
204                     ; Length = 3
205 03e 3403            retlw 3
206                     ; `Low'
207 03f 344c            retlw 76
208 040 346f            retlw 111
209 041 3477            retlw 119
210                     ;   raising_string = 0s'Raise'  
211     0036    raising_string___string equ 54
212             raising_string:
213 042 0782            addwf pcl___register,f
214                     ; Length = 5
215 043 3405            retlw 5
216                     ; `Raise'
217 044 3452            retlw 82
218 045 3461            retlw 97
219 046 3469            retlw 105
220 047 3473            retlw 115
221 048 3465            retlw 101
222                     ;   falling_string = 0s'Fall'  
223     003d    falling_string___string equ 61
224             falling_string:
225 049 0782            addwf pcl___register,f
226                     ; Length = 4
227 04a 3404            retlw 4
228                     ; `Fall'
229 04b 3446            retlw 70
230 04c 3461            retlw 97
231 04d 346c            retlw 108
232 04e 346c            retlw 108
233                     ;   fail_string = 0s'Fail'  
234     0043    fail_string___string equ 67
235             fail_string:
236 04f 0782            addwf pcl___register,f
237                     ; Length = 4
238 050 3404            retlw 4
239                     ; `Fail'
240 051 3446            retlw 70
241 052 3461            retlw 97
242 053 3469            retlw 105
243 054 346c            retlw 108
244                     ;   succeed_string = 0s'Succeed'  
245     0049    succeed_string___string equ 73
246             succeed_string:
247 055 0782            addwf pcl___register,f
248                     ; Length = 7
249 056 3407            retlw 7
250                     ; `Succeed'
251 057 3453            retlw 83
252 058 3475            retlw 117
253 059 3463            retlw 99
254 05a 3463            retlw 99
255 05b 3465            retlw 101
256 05c 3465            retlw 101
257 05d 3464            retlw 100
258                     ;   pattern_string = 0s'Pattern'  
259     0052    pattern_string___string equ 82
260             pattern_string:
261 05e 0782            addwf pcl___register,f
262                     ; Length = 7
263 05f 3407            retlw 7
264                     ; `Pattern'
265 060 3450            retlw 80
266 061 3461            retlw 97
267 062 3474            retlw 116
268 063 3474            retlw 116
269 064 3465            retlw 101
270 065 3472            retlw 114
271 066 346e            retlw 110
272                     ;   masks_string = 0s'Masks'  
273     005b    masks_string___string equ 91
274             masks_string:
275 067 0782            addwf pcl___register,f
276                     ; Length = 5
277 068 3405            retlw 5
278                     ; `Masks'
279 069 344d            retlw 77
280 06a 3461            retlw 97
281 06b 3473            retlw 115
282 06c 346b            retlw 107
283 06d 3473            retlw 115
284                     ;   done_string = 0s'Done'  
285     0062    done_string___string equ 98
286             done_string:
287 06e 0782            addwf pcl___register,f
288                     ; Length = 4
289 06f 3404            retlw 4
290                     ; `Done'
291 070 3444            retlw 68
292 071 346f            retlw 111
293 072 346e            retlw 110
294 073 3465            retlw 101
295                     ;   patterns = 0 , 1 , 2 , 4 , 8 , 15 , 15 - 1 , 15 - 2 , 15 - 4 , 15 - 8 , 0  
296     0068    patterns___string equ 104
297             patterns:
298 074 0782            addwf pcl___register,f
299                     ; Length = 11
300 075 340b            retlw 11
301                     ; 0
302 076 3400            retlw 0
303                     ; 1
304 077 3401            retlw 1
305                     ; 2
306 078 3402            retlw 2
307                     ; 4
308 079 3404            retlw 4
309                     ; 8
310 07a 3408            retlw 8
311                     ; 15
312 07b 340f            retlw 15
313                     ; 15 - 1
314 07c 340e            retlw 14
315                     ; 15 - 2
316 07d 340d            retlw 13
317                     ; 15 - 4
318 07e 340b            retlw 11
319                     ; 15 - 8
320 07f 3407            retlw 7
321                     ; 0
322 080 3400            retlw 0
323                     ; string__constants End
324             
325                     ; procedure main start
326             main:
327     000c    main__variables__base equ global__variables__bank0+0
328     000c    main__bytes__base equ main__variables__base+0
329     000d    main__bits__base equ main__variables__base+1
330     0002    main__total__bytes equ 2
331                     ;   arguments_none  
332                     ; This is the main procedure :
333     000c    main__counter equ main__bytes__base+0
334                     ; Initialize :
335                     ;   tx_slave_pin := 1  
336 081 1485            bsf tx_slave_pin__byte,tx_slave_pin__bit
337                     ;   tx_master_pin := 1  
338 082 1505            bsf tx_master_pin__byte,tx_master_pin__bit
339                     ; Wait for capacitors to charge up :
340                     ; `count_down counter 254 ...' start
341 083 30fe            movlw 254
342 084 008c            movwf main__counter
343             main__85_loop:
344                     ;   call delay {{ }}  
345 085 239d            call delay
346 086 0b8c            decfsz main__counter,f
347 087 2885            goto main__85_loop
348             main__85_done:
349                     ; `count_down counter 254 ...' end
350                     ;   call master_string {{ hello_string }}  
351 088 300d            movlw LOW hello_string+1
352 089 00b7            movwf master_string__message
353 08a 2319            call master_string
354                     ;   call master_crlf {{ }}  
355 08b 2312            call master_crlf
356                     ; Main loop :
357                     ; loop_forever ... start
358             main__92loop__forever:
359                     ; Get a character :
360                     ;   call master_string {{ hello_string }}  
361 08c 300d            movlw LOW hello_string+1
362 08d 00b7            movwf master_string__message
363 08e 2319            call master_string
364                     ;   call master_prompt {{ }}  
365 08f 22ee            call master_prompt
366                     ;   call test {{ }}  
367 090 2096            call test
368                     ;   call master_string {{ done_string }}  
369 091 306f            movlw LOW done_string+1
370 092 00b7            movwf master_string__message
371 093 2319            call master_string
372                     ;   call master_crlf {{ }}  
373 094 2312            call master_crlf
374 095 288c            goto main__92loop__forever
375                     ; loop_forever ... end
376                     ; procedure main end
377             
378                     ; procedure test start
379             test:
380     000e    test__variables__base equ global__variables__bank0+2
381     000e    test__bytes__base equ test__variables__base+0
382     0011    test__bits__base equ test__variables__base+3
383     0004    test__total__bytes equ 4
384                     ;   arguments_none  
385                     ; This procedure will test out a Threshold4 RoboBrick .
386     000e    test__index equ test__bytes__base+0
387     000f    test__result equ test__bytes__base+1
388     0010    test__pattern equ test__bytes__base+2
389     0011    test__error equ test__bits__base+0
390     0011    test__error__byte equ test__bits__base+0
391     0000    test__error__bit equ 0
392                     ; Test common shared commands :
393                     ;   call common_test {{ }}  
394 096 210f            call common_test
395                     ; Test shared interrupt commands :
396                     ;   call interrupt_test {{ }}  
397 097 21ab            call interrupt_test
398                     ; Test the registers :
399                     ; Test Complement Mask Register
400                     ;   call test_register {{ complement_string , 1 , 0x10 }}  
401 098 302c            movlw LOW complement_string+1
402 099 009d            movwf test_register__name
403 09a 3001            movlw 1
404 09b 009e            movwf test_register__read_command
405 09c 3010            movlw 16
406 09d 009f            movwf test_register__write_command
407 09e 222c            call test_register
408                     ; Test Low Mask Register
409                     ;   call test_register {{ high_string , 2 , 0x20 }}  
410 09f 3038            movlw LOW high_string+1
411 0a0 009d            movwf test_register__name
412 0a1 3002            movlw 2
413 0a2 009e            movwf test_register__read_command
414 0a3 3020            movlw 32
415 0a4 009f            movwf test_register__write_command
416 0a5 222c            call test_register
417                     ; Test High Mask Register
418                     ;   call test_register {{ low_string , 3 , 0x30 }}  
419 0a6 303e            movlw LOW low_string+1
420 0a7 009d            movwf test_register__name
421 0a8 3003            movlw 3
422 0a9 009e            movwf test_register__read_command
423 0aa 3030            movlw 48
424 0ab 009f            movwf test_register__write_command
425 0ac 222c            call test_register
426                     ; Test Raising Mask Register
427                     ;   call test_register {{ raising_string , 4 , 0x40 }}  
428 0ad 3043            movlw LOW raising_string+1
429 0ae 009d            movwf test_register__name
430 0af 3004            movlw 4
431 0b0 009e            movwf test_register__read_command
432 0b1 3040            movlw 64
433 0b2 009f            movwf test_register__write_command
434 0b3 222c            call test_register
435                     ; Test Falling Mask Register
436                     ;   call test_register {{ falling_string , 5 , 0x50 }}  
437 0b4 304a            movlw LOW falling_string+1
438 0b5 009d            movwf test_register__name
439 0b6 3005            movlw 5
440 0b7 009e            movwf test_register__read_command
441 0b8 3050            movlw 80
442 0b9 009f            movwf test_register__write_command
443 0ba 222c            call test_register
444                     ; Test high interrupt mask :
445                     ;   call test_interrupt {{ high_string , 0 , 0xf , 0x20 }}  
446 0bb 3038            movlw LOW high_string+1
447 0bc 00a9            movwf test_interrupt__name
448 0bd 01aa            clrf test_interrupt__start_pattern
449 0be 300f            movlw 15
450 0bf 00ab            movwf test_interrupt__end_pattern
451 0c0 3020            movlw 32
452 0c1 00ac            movwf test_interrupt__set_command
453 0c2 2284            call test_interrupt
454                     ; Test low interrupt mask :
455                     ;   call test_interrupt {{ low_string , 0xf , 0 , 0x30 }}  
456 0c3 303e            movlw LOW low_string+1
457 0c4 00a9            movwf test_interrupt__name
458 0c5 300f            movlw 15
459 0c6 00aa            movwf test_interrupt__start_pattern
460 0c7 01ab            clrf test_interrupt__end_pattern
461 0c8 3030            movlw 48
462 0c9 00ac            movwf test_interrupt__set_command
463 0ca 2284            call test_interrupt
464                     ; Test raising interrupt mask :
465                     ;   call test_interrupt {{ raising_string , 0 , 0xf , 0x40 }}  
466 0cb 3043            movlw LOW raising_string+1
467 0cc 00a9            movwf test_interrupt__name
468 0cd 01aa            clrf test_interrupt__start_pattern
469 0ce 300f            movlw 15
470 0cf 00ab            movwf test_interrupt__end_pattern
471 0d0 3040            movlw 64
472 0d1 00ac            movwf test_interrupt__set_command
473 0d2 2284            call test_interrupt
474                     ; Test falling interrupt mask :
475                     ;   call test_interrupt {{ falling_string , 0xf , 0 , 0x50 }}  
476 0d3 304a            movlw LOW falling_string+1
477 0d4 00a9            movwf test_interrupt__name
478 0d5 300f            movlw 15
479 0d6 00aa            movwf test_interrupt__start_pattern
480 0d7 01ab            clrf test_interrupt__end_pattern
481 0d8 3050            movlw 80
482 0d9 00ac            movwf test_interrupt__set_command
483 0da 2284            call test_interrupt
484                     ; Do some read pattern tests :
485                     ;   index := 0  
486 0db 018e            clrf test__index
487                     ; `while  index < patterns . size  ...' start
488             test__142while__continue:
489 0dc 300b            movlw 11
490 0dd 020e            subwf test__index,w
491                     ; expression=` index < patterns . size ' exp_delay=2 true_delay=1  false_delay=2 true_size=46 false_size=1
492 0de 1803            btfsc c___byte,c___bit
493 0df 290e            goto test__142while__break
494                     ;   pattern := patterns ~~ {{ index }}  
495 0e0 0a0e            incf test__index,w
496 0e1 018a            clrf pclath___register
497 0e2 2074            call patterns
498 0e3 0090            movwf test__pattern
499                     ;   error := 1  
500 0e4 1411            bsf test__error__byte,test__error__bit
501                     ; `while error ...' start
502             test__146while__continue:
503                     ; expression=`error' exp_delay=0 true_delay=1  false_delay=2 true_size=37 false_size=1
504 0e5 1c11            btfss test__error__byte,test__error__bit
505 0e6 290c            goto test__146while__break
506                     ;   call test_pattern_prompt {{ pattern }}  
507 0e7 0810            movf test__pattern,w
508 0e8 00a7            movwf test_pattern_prompt__pattern
509 0e9 2277            call test_pattern_prompt
510                     ;   call master_prompt {{ }}  
511 0ea 22ee            call master_prompt
512                     ;   error := test_pattern {{ pattern , 0 , 5 }}  
513 0eb 0810            movf test__pattern,w
514 0ec 00a2            movwf test_pattern__pattern
515 0ed 01a3            clrf test_pattern__complement
516 0ee 3005            movlw 5
517 0ef 00a4            movwf test_pattern__error
518 0f0 2249            call test_pattern
519 0f1 1011            bcf test__error__byte,test__error__bit
520 0f2 1826            btfsc test_pattern__0return__bit__byte,test_pattern__0return__bit__bit
521 0f3 1411            bsf test__error__byte,test__error__bit
522                     ; if { ! error } start
523                     ; expression=`error' exp_delay=0 true_delay=0  false_delay=-1 true_size=0 false_size=21
524 0f4 1811            btfsc test__error__byte,test__error__bit
525 0f5 290b            goto label151__0end
526                     ; if { ! error } body start
527                     ;   error := test_pattern {{ pattern , 0xf , 0x12 }}  
528 0f6 0810            movf test__pattern,w
529 0f7 00a2            movwf test_pattern__pattern
530 0f8 300f            movlw 15
531 0f9 00a3            movwf test_pattern__complement
532 0fa 3012            movlw 18
533 0fb 00a4            movwf test_pattern__error
534 0fc 2249            call test_pattern
535 0fd 1011            bcf test__error__byte,test__error__bit
536 0fe 1826            btfsc test_pattern__0return__bit__byte,test_pattern__0return__bit__bit
537 0ff 1411            bsf test__error__byte,test__error__bit
538                     ; if { ! error } start
539                     ; expression=`error' exp_delay=0 true_delay=0  false_delay=7 true_size=0 false_size=9
540 100 1811            btfsc test__error__byte,test__error__bit
541 101 290b            goto label153__0end
542                     ; if { ! error } body start
543                     ;   error := test_pattern {{ pattern , 0 , 0x14 }}  
544 102 0810            movf test__pattern,w
545 103 00a2            movwf test_pattern__pattern
546 104 01a3            clrf test_pattern__complement
547 105 3014            movlw 20
548 106 00a4            movwf test_pattern__error
549 107 2249            call test_pattern
550 108 1011            bcf test__error__byte,test__error__bit
551 109 1826            btfsc test_pattern__0return__bit__byte,test_pattern__0return__bit__bit
552 10a 1411            bsf test__error__byte,test__error__bit
553                     ; if { ! error } body end
554             label153__0end:
555                     ; if exp=`error' empty true
556                     ; Other expression=`error' delay=-1
557                     ; if { ! error } end
558                     ; if { ! error } body end
559             label151__0end:
560                     ; if exp=`error' empty true
561                     ; Other expression=`error' delay=-1
562                     ; if { ! error } end
563 10b 28e5            goto test__146while__continue
564                     ; if exp=`error' false goto
565                     ; Other expression=`error' delay=-1
566             test__146while__break:
567                     ; `while error ...' end
568                     ;   index := index + 1  
569 10c 0a8e            incf test__index,f
570 10d 28dc            goto test__142while__continue
571                     ; if exp=` index < patterns . size ' false goto
572                     ; Other expression=` index < patterns . size ' delay=-1
573             test__142while__break:
574                     ; `while  index < patterns . size  ...' end
575                     ; procedure test end
576 10e 3400            retlw 0
577                     ; comment {The procedures below are used to test the common shared commands :}
578             
579                     ; procedure common_test start
580             common_test:
581     0012    common_test__variables__base equ global__variables__bank0+6
582     0012    common_test__bytes__base equ common_test__variables__base+0
583     0014    common_test__bits__base equ common_test__variables__base+2
584     0002    common_test__total__bytes equ 2
585     0013    common_test__207byte0 equ common_test__bytes__base+1
586                     ;   arguments_none  
587                     ; This procedure will verify that the common shared commands work .
588     0012    common_test__actual equ common_test__bytes__base+0
589                     ; Print the ID information :
590                     ; ID reset :
591                     ;   call slave_send {{ 0xfd }}  
592 10f 30fd            movlw 253
593 110 00bc            movwf slave_send__character
594 111 2344            call slave_send
595                     ; Read the fixed bytes :
596                     ;   call common_test_id_match {{ 1 , 0xc0 }}  
597 112 3001            movlw 1
598 113 0094            movwf common_test_id_match__desired
599 114 30c0            movlw 192
600 115 0095            movwf common_test_id_match__test_number
601 116 2184            call common_test_id_match
602                     ;   call common_test_id_match {{ 0 , 0xc1 }}  
603 117 0194            clrf common_test_id_match__desired
604 118 30c1            movlw 193
605 119 0095            movwf common_test_id_match__test_number
606 11a 2184            call common_test_id_match
607                     ;   call common_test_id_match {{ 19 , 0xc2 }}  
608 11b 3013            movlw 19
609 11c 0094            movwf common_test_id_match__desired
610 11d 30c2            movlw 194
611 11e 0095            movwf common_test_id_match__test_number
612 11f 2184            call common_test_id_match
613                     ;   call common_test_id_match {{ 0 , 0xc3 }}  
614 120 0194            clrf common_test_id_match__desired
615 121 30c3            movlw 195
616 122 0095            movwf common_test_id_match__test_number
617 123 2184            call common_test_id_match
618                     ;   call common_test_id_match {{ 0 , 0xc4 }}  
619 124 0194            clrf common_test_id_match__desired
620 125 30c4            movlw 196
621 126 0095            movwf common_test_id_match__test_number
622 127 2184            call common_test_id_match
623                     ;   call common_test_id_match {{ 0 , 0xc5 }}  
624 128 0194            clrf common_test_id_match__desired
625 129 30c5            movlw 197
626 12a 0095            movwf common_test_id_match__test_number
627 12b 2184            call common_test_id_match
628                     ;   call common_test_id_match {{ 0 , 0xc6 }}  
629 12c 0194            clrf common_test_id_match__desired
630 12d 30c6            movlw 198
631 12e 0095            movwf common_test_id_match__test_number
632 12f 2184            call common_test_id_match
633                     ;   call common_test_id_match {{ 0 , 0xc7 }}  
634 130 0194            clrf common_test_id_match__desired
635 131 30c7            movlw 199
636 132 0095            movwf common_test_id_match__test_number
637 133 2184            call common_test_id_match
638                     ;   call master_crlf {{ }}  
639 134 2312            call master_crlf
640                     ;   call common_test_id_bytes8 {{ }}  
641 135 218f            call common_test_id_bytes8
642                     ;   call common_test_id_bytes8 {{ }}  
643 136 218f            call common_test_id_bytes8
644                     ; Read the brick name :
645                     ;   call common_test_id_string {{ }}  
646 137 2199            call common_test_id_string
647                     ; Read the vendor name :
648                     ;   call common_test_id_string {{ }}  
649 138 2199            call common_test_id_string
650                     ; Verfify that we don ' t read off the end of the id and crash :
651                     ;   call common_test_id_next {{ }}  
652 139 21a4            call common_test_id_next
653 13a 0818            movf common_test_id_next__0return__byte,w
654                     ; Reset id :
655                     ;   call slave_send {{ 0xfd }}  
656 13b 30fd            movlw 253
657 13c 00bc            movwf slave_send__character
658 13d 2344            call slave_send
659                     ; Verify that we are still alive :
660                     ;   call common_test_id_match {{ 1 , 0xc8 }}  
661 13e 3001            movlw 1
662 13f 0094            movwf common_test_id_match__desired
663 140 30c8            movlw 200
664 141 0095            movwf common_test_id_match__test_number
665 142 2184            call common_test_id_match
666                     ; Read glitch :
667                     ; Clear glitch register :
668                     ;   call slave_send {{ 0xfe }}  
669 143 30fe            movlw 254
670 144 00bc            movwf slave_send__character
671 145 2344            call slave_send
672                     ;   actual := slave_get {{ }}  
673 146 2350            call slave_get
674 147 083e            movf slave_get__0return__byte,w
675 148 0092            movwf common_test__actual
676                     ; Send a couple of glitches :
677                     ;   call slave_send {{ 0xff }}  
678 149 30ff            movlw 255
679 14a 00bc            movwf slave_send__character
680 14b 2344            call slave_send
681                     ;   call slave_send {{ 0xff }}  
682 14c 30ff            movlw 255
683 14d 00bc            movwf slave_send__character
684 14e 2344            call slave_send
685                     ; Read the glitch register :
686                     ;   call slave_send {{ 0xfe }}  
687 14f 30fe            movlw 254
688 150 00bc            movwf slave_send__character
689 151 2344            call slave_send
690                     ; if { slave_get {{ }} != 2 } start
691 152 2350            call slave_get
692 153 083e            movf slave_get__0return__byte,w
693 154 0093            movwf common_test__207byte0
694 155 3002            movlw 2
695 156 0213            subwf common_test__207byte0,w
696                     ; expression=`{ slave_get {{ }} != 2 }' exp_delay=3 true_delay=3  false_delay=0 true_size=5 false_size=0
697 157 1903            btfsc z___byte,z___bit
698 158 295e            goto label207__1end
699                     ; if { slave_get {{ }} != 2 } body start
700                     ;   call master_fail {{ common_string , 0xc9 }}  
701 159 3019            movlw LOW common_string+1
702 15a 00b5            movwf master_fail__test_name
703 15b 30c9            movlw 201
704 15c 00b6            movwf master_fail__test_number
705 15d 2307            call master_fail
706                     ; if { slave_get {{ }} != 2 } body end
707             label207__1end:
708                     ; if exp=` slave_get ## {{ }} != 2 ' empty false
709                     ; Other expression=`{ slave_get {{ }} != 2 }' delay=-1
710                     ; if { slave_get {{ }} != 2 } end
711                     ; Do a clock pulse :
712                     ;   call slave_send {{ 0xfb }}  
713 15e 30fb            movlw 251
714 15f 00bc            movwf slave_send__character
715 160 2344            call slave_send
716                     ; if { slave_get {{ }} != 0 } start
717 161 2350            call slave_get
718 162 083e            movf slave_get__0return__byte,w
719                     ; expression=`{ slave_get {{ }} != 0 }' exp_delay=0 true_delay=3  false_delay=0 true_size=5 false_size=0
720 163 1903            btfsc z___byte,z___bit
721 164 296a            goto label213__0end
722                     ; if { slave_get {{ }} != 0 } body start
723                     ;   call master_fail {{ common_string , 0xca }}  
724 165 3019            movlw LOW common_string+1
725 166 00b5            movwf master_fail__test_name
726 167 30ca            movlw 202
727 168 00b6            movwf master_fail__test_number
728 169 2307            call master_fail
729                     ; if { slave_get {{ }} != 0 } body end
730             label213__0end:
731                     ; if exp=` slave_get ## {{ }} != 0 ' empty false
732                     ; Other expression=`{ slave_get {{ }} != 0 }' delay=-1
733                     ; if { slave_get {{ }} != 0 } end
734                     ; Read clock :
735                     ;   call slave_send {{ 0xfa }}  
736 16a 30fa            movlw 250
737 16b 00bc            movwf slave_send__character
738 16c 2344            call slave_send
739                     ;   actual := slave_get {{ }}  
740 16d 2350            call slave_get
741 16e 083e            movf slave_get__0return__byte,w
742 16f 0092            movwf common_test__actual
743                     ; Increment :
744                     ;   call slave_send {{ 0xf9 }}  
745 170 30f9            movlw 249
746 171 00bc            movwf slave_send__character
747 172 2344            call slave_send
748                     ; Decrement :
749                     ;   call slave_send {{ 0xf8 }}  
750 173 30f8            movlw 248
751 174 00bc            movwf slave_send__character
752 175 2344            call slave_send
753                     ; Read clock again :
754                     ;   call slave_send {{ 0xfa }}  
755 176 30fa            movlw 250
756 177 00bc            movwf slave_send__character
757 178 2344            call slave_send
758                     ; if { actual != slave_get {{ }} } start
759 179 2350            call slave_get
760 17a 083e            movf slave_get__0return__byte,w
761 17b 0212            subwf common_test__actual,w
762                     ; expression=`{ actual != slave_get {{ }} }' exp_delay=1 true_delay=3  false_delay=0 true_size=5 false_size=0
763 17c 1903            btfsc z___byte,z___bit
764 17d 2983            goto label225__0end
765                     ; if { actual != slave_get {{ }} } body start
766                     ;   call master_fail {{ common_string , 0xcb }}  
767 17e 3019            movlw LOW common_string+1
768 17f 00b5            movwf master_fail__test_name
769 180 30cb            movlw 203
770 181 00b6            movwf master_fail__test_number
771 182 2307            call master_fail
772                     ; if { actual != slave_get {{ }} } body end
773             label225__0end:
774                     ; if exp=` actual != slave_get ## {{ }} ' empty false
775                     ; Other expression=`{ actual != slave_get {{ }} }' delay=-1
776                     ; if { actual != slave_get {{ }} } end
777                     ; procedure common_test end
778 183 3400            retlw 0
779             
780                     ; procedure common_test_id_match start
781             common_test_id_match:
782     0014    common_test_id_match__variables__base equ global__variables__bank0+8
783     0014    common_test_id_match__bytes__base equ common_test_id_match__variables__base+0
784     0016    common_test_id_match__bits__base equ common_test_id_match__variables__base+2
785     0002    common_test_id_match__total__bytes equ 2
786     0014    common_test_id_match__desired equ common_test_id_match__bytes__base+0
787     0015    common_test_id_match__test_number equ common_test_id_match__bytes__base+1
788                     ; This procedure will verify that the next byte in the id is < desired > .
789                     ; if { desired != common_test_id_next {{ }} } start
790 184 21a4            call common_test_id_next
791 185 0818            movf common_test_id_next__0return__byte,w
792 186 0214            subwf common_test_id_match__desired,w
793                     ; expression=`{ desired != common_test_id_next {{ }} }' exp_delay=1 true_delay=3  false_delay=0 true_size=5 false_size=0
794 187 1903            btfsc z___byte,z___bit
795 188 298e            goto label237__0end
796                     ; if { desired != common_test_id_next {{ }} } body start
797                     ;   call master_fail {{ common_string , test_number }}  
798 189 3019            movlw LOW common_string+1
799 18a 00b5            movwf master_fail__test_name
800 18b 0815            movf common_test_id_match__test_number,w
801 18c 00b6            movwf master_fail__test_number
802 18d 2307            call master_fail
803                     ; if { desired != common_test_id_next {{ }} } body end
804             label237__0end:
805                     ; if exp=` desired != common_test_id_next ## {{ }} ' empty false
806                     ; Other expression=`{ desired != common_test_id_next {{ }} }' delay=-1
807                     ; if { desired != common_test_id_next {{ }} } end
808                     ; procedure common_test_id_match end
809 18e 3400            retlw 0
810             
811                     ; procedure common_test_id_bytes8 start
812             common_test_id_bytes8:
813     0016    common_test_id_bytes8__variables__base equ global__variables__bank0+10
814     0016    common_test_id_bytes8__bytes__base equ common_test_id_bytes8__variables__base+0
815     0017    common_test_id_bytes8__bits__base equ common_test_id_bytes8__variables__base+1
816     0001    common_test_id_bytes8__total__bytes equ 1
817                     ;   arguments_none  
818                     ; This procedure will print out the next 8 bytes of the id in octal .
819     0016    common_test_id_bytes8__count equ common_test_id_bytes8__bytes__base+0
820                     ; `count_down count 8 ...' start
821 18f 3008            movlw 8
822 190 0096            movwf common_test_id_bytes8__count
823             common_test_id_bytes8__250_loop:
824                     ;   call master_octal {{ common_test_id_next {{ }} }}  
825 191 21a4            call common_test_id_next
826 192 0818            movf common_test_id_next__0return__byte,w
827 193 00ba            movwf master_octal__number
828 194 232b            call master_octal
829 195 0b96            decfsz common_test_id_bytes8__count,f
830 196 2991            goto common_test_id_bytes8__250_loop
831             common_test_id_bytes8__250_done:
832                     ; `count_down count 8 ...' end
833                     ;   call master_crlf {{ }}  
834 197 2312            call master_crlf
835                     ; procedure common_test_id_bytes8 end
836 198 3400            retlw 0
837             
838                     ; procedure common_test_id_string start
839             common_test_id_string:
840     0017    common_test_id_string__variables__base equ global__variables__bank0+11
841     0017    common_test_id_string__bytes__base equ common_test_id_string__variables__base+0
842     0018    common_test_id_string__bits__base equ common_test_id_string__variables__base+1
843     0001    common_test_id_string__total__bytes equ 1
844                     ;   arguments_none  
845                     ; This procedure will print out the next id string .
846     0017    common_test_id_string__count equ common_test_id_string__bytes__base+0
847                     ; `count_down count  common_test_id_next ## {{ }}  ...' start
848 199 21a4            call common_test_id_next
849 19a 0818            movf common_test_id_next__0return__byte,w
850 19b 0097            movwf common_test_id_string__count
851             common_test_id_string__264_loop:
852                     ;   call master_send {{ common_test_id_next {{ }} }}  
853 19c 21a4            call common_test_id_next
854 19d 0818            movf common_test_id_next__0return__byte,w
855 19e 00bd            movwf master_send__character
856 19f 234a            call master_send
857 1a0 0b97            decfsz common_test_id_string__count,f
858 1a1 299c            goto common_test_id_string__264_loop
859             common_test_id_string__264_done:
860                     ; `count_down count  common_test_id_next ## {{ }}  ...' end
861                     ;   call master_crlf {{ }}  
862 1a2 2312            call master_crlf
863                     ; procedure common_test_id_string end
864 1a3 3400            retlw 0
865             
866                     ; procedure common_test_id_next start
867             common_test_id_next:
868     0018    common_test_id_next__variables__base equ global__variables__bank0+12
869     0018    common_test_id_next__bytes__base equ common_test_id_next__variables__base+0
870     0019    common_test_id_next__bits__base equ common_test_id_next__variables__base+1
871     0001    common_test_id_next__total__bytes equ 1
872                     ;   arguments_none  
873     0018    common_test_id_next__0return__byte equ common_test_id_next__bytes__base+0
874                     ; This procedure returns the next byte from the identification string .
875                     ;   call slave_send {{ 0xfc }}  
876 1a4 30fc            movlw 252
877 1a5 00bc            movwf slave_send__character
878 1a6 2344            call slave_send
879                     ;   return slave_get {{ }}  
880 1a7 2350            call slave_get
881 1a8 083e            movf slave_get__0return__byte,w
882 1a9 0098            movwf common_test_id_next__0return__byte
883 1aa 3400            retlw 0
884                     ; procedure common_test_id_next end
885                     ; comment {The procedures below are used to test the shared interrupt commands :}
886             
887                     ; procedure interrupt_test start
888             interrupt_test:
889     0019    interrupt_test__variables__base equ global__variables__bank0+13
890     0019    interrupt_test__bytes__base equ interrupt_test__variables__base+0
891     001a    interrupt_test__bits__base equ interrupt_test__variables__base+1
892     0001    interrupt_test__total__bytes equ 1
893                     ;   arguments_none  
894                     ; This procedure tests the common shared interrupt commands .
895     0019    interrupt_test__counter equ interrupt_test__bytes__base+0
896                     ; Clear interrupt bits :
897                     ;   call slave_send {{ 0xf0 }}  
898 1ab 30f0            movlw 240
899 1ac 00bc            movwf slave_send__character
900 1ad 2344            call slave_send
901                     ;   call interrupt_read {{ 0 , 0xd0 }}  
902 1ae 019a            clrf interrupt_read__desired
903 1af 30d0            movlw 208
904 1b0 009b            movwf interrupt_read__test_number
905 1b1 220a            call interrupt_read
906                     ; Set / clear interrupt pending bit only :
907                     ;   call slave_send {{ 0xf5 }}  
908 1b2 30f5            movlw 245
909 1b3 00bc            movwf slave_send__character
910 1b4 2344            call slave_send
911                     ;   call interrupt_read {{ 1 , 0xd1 }}  
912 1b5 3001            movlw 1
913 1b6 009a            movwf interrupt_read__desired
914 1b7 30d1            movlw 209
915 1b8 009b            movwf interrupt_read__test_number
916 1b9 220a            call interrupt_read
917                     ;   call slave_send {{ 0xf4 }}  
918 1ba 30f4            movlw 244
919 1bb 00bc            movwf slave_send__character
920 1bc 2344            call slave_send
921                     ;   call interrupt_read {{ 0 , 0xd2 }}  
922 1bd 019a            clrf interrupt_read__desired
923 1be 30d2            movlw 210
924 1bf 009b            movwf interrupt_read__test_number
925 1c0 220a            call interrupt_read
926                     ;   call slave_send {{ 0xf1 }}  
927 1c1 30f1            movlw 241
928 1c2 00bc            movwf slave_send__character
929 1c3 2344            call slave_send
930                     ;   call interrupt_read {{ 1 , 0xd3 }}  
931 1c4 3001            movlw 1
932 1c5 009a            movwf interrupt_read__desired
933 1c6 30d3            movlw 211
934 1c7 009b            movwf interrupt_read__test_number
935 1c8 220a            call interrupt_read
936                     ;   call slave_send {{ 0xf0 }}  
937 1c9 30f0            movlw 240
938 1ca 00bc            movwf slave_send__character
939 1cb 2344            call slave_send
940                     ;   call interrupt_read {{ 0 , 0xd4 }}  
941 1cc 019a            clrf interrupt_read__desired
942 1cd 30d4            movlw 212
943 1ce 009b            movwf interrupt_read__test_number
944 1cf 220a            call interrupt_read
945                     ; Set / clear interrupt enable bit only :
946                     ;   call slave_send {{ 0xf7 }}  
947 1d0 30f7            movlw 247
948 1d1 00bc            movwf slave_send__character
949 1d2 2344            call slave_send
950                     ;   call interrupt_read {{ 2 , 0xd5 }}  
951 1d3 3002            movlw 2
952 1d4 009a            movwf interrupt_read__desired
953 1d5 30d5            movlw 213
954 1d6 009b            movwf interrupt_read__test_number
955 1d7 220a            call interrupt_read
956                     ;   call slave_send {{ 0xf6 }}  
957 1d8 30f6            movlw 246
958 1d9 00bc            movwf slave_send__character
959 1da 2344            call slave_send
960                     ;   call interrupt_read {{ 0 , 0xd6 }}  
961 1db 019a            clrf interrupt_read__desired
962 1dc 30d6            movlw 214
963 1dd 009b            movwf interrupt_read__test_number
964 1de 220a            call interrupt_read
965                     ;   call slave_send {{ 0xf2 }}  
966 1df 30f2            movlw 242
967 1e0 00bc            movwf slave_send__character
968 1e1 2344            call slave_send
969                     ;   call interrupt_read {{ 2 , 0xd7 }}  
970 1e2 3002            movlw 2
971 1e3 009a            movwf interrupt_read__desired
972 1e4 30d7            movlw 215
973 1e5 009b            movwf interrupt_read__test_number
974 1e6 220a            call interrupt_read
975                     ;   call slave_send {{ 0xf0 }}  
976 1e7 30f0            movlw 240
977 1e8 00bc            movwf slave_send__character
978 1e9 2344            call slave_send
979                     ;   call interrupt_read {{ 0 , 0xd8 }}  
980 1ea 019a            clrf interrupt_read__desired
981 1eb 30d8            movlw 216
982 1ec 009b            movwf interrupt_read__test_number
983 1ed 220a            call interrupt_read
984                     ; Now set both the interrupt enable and pending bit .
985                     ; This must trigger an interrupt .
986                     ;   call slave_send {{ 0xf3 }}  
987 1ee 30f3            movlw 243
988 1ef 00bc            movwf slave_send__character
989 1f0 2344            call slave_send
990                     ; `count_down counter 3 ...' start
991 1f1 3003            movlw 3
992 1f2 0099            movwf interrupt_test__counter
993             interrupt_test__318_loop:
994                     ;   call delay {{ }}  
995 1f3 239d            call delay
996 1f4 0b99            decfsz interrupt_test__counter,f
997 1f5 29f3            goto interrupt_test__318_loop
998             interrupt_test__318_done:
999                     ; `count_down counter 3 ...' end
1000                     ; if { rx_slave_pin } start
1001                     ; expression=`{ rx_slave_pin }' exp_delay=0 true_delay=3  false_delay=0 true_size=5 false_size=0
1002 1f6 1c05            btfss rx_slave_pin__byte,rx_slave_pin__bit
1003 1f7 29fd            goto label321__0end
1004                     ; if { rx_slave_pin } body start
1005                     ; No interrupt detected :
1006                     ;   call master_fail {{ interrupt_string , 0xd9 }}  
1007 1f8 3021            movlw LOW interrupt_string+1
1008 1f9 00b5            movwf master_fail__test_name
1009 1fa 30d9            movlw 217
1010 1fb 00b6            movwf master_fail__test_number
1011 1fc 2307            call master_fail
1012                     ; if { rx_slave_pin } body end
1013             label321__0end:
1014                     ; if exp=`rx_slave_pin' empty false
1015                     ; Other expression=`{ rx_slave_pin }' delay=-1
1016                     ; if { rx_slave_pin } end
1017                     ; Read the interrupt enable bit is cleared as a side effect
1018                     ; of reading the bit .
1019                     ;   call interrupt_read {{ 1 , 0xda }}  
1020 1fd 3001            movlw 1
1021 1fe 009a            movwf interrupt_read__desired
1022 1ff 30da            movlw 218
1023 200 009b            movwf interrupt_read__test_number
1024 201 220a            call interrupt_read
1025                     ; Clear the interrupt pending big :
1026                     ;   call slave_send {{ 0xf0 }}  
1027 202 30f0            movlw 240
1028 203 00bc            movwf slave_send__character
1029 204 2344            call slave_send
1030                     ;   call interrupt_read {{ 0 , 0xdb }}  
1031 205 019a            clrf interrupt_read__desired
1032 206 30db            movlw 219
1033 207 009b            movwf interrupt_read__test_number
1034 208 220a            call interrupt_read
1035                     ; procedure interrupt_test end
1036 209 3400            retlw 0
1037             
1038                     ; procedure interrupt_read start
1039             interrupt_read:
1040     001a    interrupt_read__variables__base equ global__variables__bank0+14
1041     001a    interrupt_read__bytes__base equ interrupt_read__variables__base+0
1042     001c    interrupt_read__bits__base equ interrupt_read__variables__base+2
1043     0002    interrupt_read__total__bytes equ 2
1044     001a    interrupt_read__desired equ interrupt_read__bytes__base+0
1045     001b    interrupt_read__test_number equ interrupt_read__bytes__base+1
1046                     ; This procedure will verify that the interrupt bits match < desired > .
1047                     ;   call slave_send {{ 0xef }}  
1048 20a 30ef            movlw 239
1049 20b 00bc            movwf slave_send__character
1050 20c 2344            call slave_send
1051                     ; if { slave_get {{ }} != desired } start
1052 20d 2350            call slave_get
1053 20e 083e            movf slave_get__0return__byte,w
1054 20f 021a            subwf interrupt_read__desired,w
1055                     ; expression=`{ slave_get {{ }} != desired }' exp_delay=1 true_delay=3  false_delay=0 true_size=5 false_size=0
1056 210 1903            btfsc z___byte,z___bit
1057 211 2a17            goto label342__0end
1058                     ; if { slave_get {{ }} != desired } body start
1059                     ;   call master_fail {{ interrupt_string , test_number }}  
1060 212 3021            movlw LOW interrupt_string+1
1061 213 00b5            movwf master_fail__test_name
1062 214 081b            movf interrupt_read__test_number,w
1063 215 00b6            movwf master_fail__test_number
1064 216 2307            call master_fail
1065                     ; if { slave_get {{ }} != desired } body end
1066             label342__0end:
1067                     ; if exp=` slave_get ## {{ }} != desired ' empty false
1068                     ; Other expression=`{ slave_get {{ }} != desired }' delay=-1
1069                     ; if { slave_get {{ }} != desired } end
1070                     ; procedure interrupt_read end
1071 217 3400            retlw 0
1072                     ; comment {The procedures below are more specific to testing the Threshold4 :}
1073             
1074                     ; procedure test_masks start
1075             test_masks:
1076     001c    test_masks__variables__base equ global__variables__bank0+16
1077     001c    test_masks__bytes__base equ test_masks__variables__base+0
1078     001d    test_masks__bits__base equ test_masks__variables__base+1
1079     0001    test_masks__total__bytes equ 1
1080                     ;   arguments_none  
1081     001c    test_masks__command equ test_masks__bytes__base+0
1082                     ;   call master_string {{ masks_string }}  
1083 218 3068            movlw LOW masks_string+1
1084 219 00b7            movwf master_string__message
1085 21a 2319            call master_string
1086                     ;   command := 1  
1087 21b 3001            movlw 1
1088 21c 009c            movwf test_masks__command
1089                     ; `while  command <= 5  ...' start
1090             test_masks__357while__continue:
1091 21d 3006            movlw 6
1092 21e 021c            subwf test_masks__command,w
1093                     ; expression=` command <= 5 ' exp_delay=2 true_delay=4  false_delay=2 true_size=9 false_size=1
1094 21f 1803            btfsc c___byte,c___bit
1095 220 2a2a            goto test_masks__357while__break
1096                     ;   call slave_send {{ command }}  
1097 221 081c            movf test_masks__command,w
1098 222 00bc            movwf slave_send__character
1099 223 2344            call slave_send
1100                     ;   call master_octal {{ slave_get {{ }} }}  
1101 224 2350            call slave_get
1102 225 083e            movf slave_get__0return__byte,w
1103 226 00ba            movwf master_octal__number
1104 227 232b            call master_octal
1105                     ;   command := command + 1  
1106 228 0a9c            incf test_masks__command,f
1107 229 2a1d            goto test_masks__357while__continue
1108                     ; if exp=` command <= 5 ' false goto
1109                     ; Other expression=` command <= 5 ' delay=-1
1110             test_masks__357while__break:
1111                     ; `while  command <= 5  ...' end
1112                     ;   call master_crlf {{ }}  
1113 22a 2312            call master_crlf
1114                     ; procedure test_masks end
1115 22b 3400            retlw 0
1116             
1117                     ; procedure test_register start
1118             test_register:
1119     001d    test_register__variables__base equ global__variables__bank0+17
1120     001d    test_register__bytes__base equ test_register__variables__base+0
1121     0022    test_register__bits__base equ test_register__variables__base+5
1122     0005    test_register__total__bytes equ 5
1123     001d    test_register__name equ test_register__bytes__base+0
1124     001e    test_register__read_command equ test_register__bytes__base+1
1125     001f    test_register__write_command equ test_register__bytes__base+2
1126                     ; This procedure will test out a register .
1127     0020    test_register__index equ test_register__bytes__base+3
1128     0021    test_register__pattern equ test_register__bytes__base+4
1129                     ;   index := 0  
1130 22c 01a0            clrf test_register__index
1131                     ; `while  index < patterns . size  ...' start
1132             test_register__377while__continue:
1133 22d 300b            movlw 11
1134 22e 0220            subwf test_register__index,w
1135                     ; expression=` index < patterns . size ' exp_delay=2 true_delay=1  false_delay=2 true_size=23 false_size=1
1136 22f 1803            btfsc c___byte,c___bit
1137 230 2a48            goto test_register__377while__break
1138                     ;   pattern := patterns ~~ {{ index }}  
1139 231 0a20            incf test_register__index,w
1140 232 018a            clrf pclath___register
1141 233 2074            call patterns
1142 234 00a1            movwf test_register__pattern
1143                     ;   call slave_send {{ write_command | pattern }}  
1144 235 081f            movf test_register__write_command,w
1145 236 0421            iorwf test_register__pattern,w
1146 237 00bc            movwf slave_send__character
1147 238 2344            call slave_send
1148                     ;   call slave_send {{ read_command }}  
1149 239 081e            movf test_register__read_command,w
1150 23a 00bc            movwf slave_send__character
1151 23b 2344            call slave_send
1152                     ; if { slave_get {{ }} != pattern } start
1153 23c 2350            call slave_get
1154 23d 083e            movf slave_get__0return__byte,w
1155 23e 0221            subwf test_register__pattern,w
1156                     ; expression=`{ slave_get {{ }} != pattern }' exp_delay=1 true_delay=3  false_delay=0 true_size=5 false_size=0
1157 23f 1903            btfsc z___byte,z___bit
1158 240 2a46            goto label381__0end
1159                     ; if { slave_get {{ }} != pattern } body start
1160                     ;   call master_fail {{ name , pattern }}  
1161 241 081d            movf test_register__name,w
1162 242 00b5            movwf master_fail__test_name
1163 243 0821            movf test_register__pattern,w
1164 244 00b6            movwf master_fail__test_number
1165 245 2307            call master_fail
1166                     ; if { slave_get {{ }} != pattern } body end
1167             label381__0end:
1168                     ; if exp=` slave_get ## {{ }} != pattern ' empty false
1169                     ; Other expression=`{ slave_get {{ }} != pattern }' delay=-1
1170                     ; if { slave_get {{ }} != pattern } end
1171                     ;   index := index + 1  
1172 246 0aa0            incf test_register__index,f
1173 247 2a2d            goto test_register__377while__continue
1174                     ; if exp=` index < patterns . size ' false goto
1175                     ; Other expression=` index < patterns . size ' delay=-1
1176             test_register__377while__break:
1177                     ; `while  index < patterns . size  ...' end
1178                     ; procedure test_register end
1179 248 3400            retlw 0
1180             
1181                     ; procedure test_pattern start
1182             test_pattern:
1183     0022    test_pattern__variables__base equ global__variables__bank0+22
1184     0022    test_pattern__bytes__base equ test_pattern__variables__base+0
1185     0026    test_pattern__bits__base equ test_pattern__variables__base+4
1186     0005    test_pattern__total__bytes equ 5
1187     0022    test_pattern__pattern equ test_pattern__bytes__base+0
1188     0023    test_pattern__complement equ test_pattern__bytes__base+1
1189     0024    test_pattern__error equ test_pattern__bytes__base+2
1190     0026    test_pattern__0return__bit equ test_pattern__bits__base+0
1191     0026    test_pattern__0return__bit__byte equ test_pattern__bits__base+0
1192     0000    test_pattern__0return__bit__bit equ 0
1193     0025    test_pattern__result equ test_pattern__bytes__base+3
1194                     ; Set complement mask :
1195                     ;   call slave_send {{ 0x10 | complement }}  
1196 249 3010            movlw 16
1197 24a 0423            iorwf test_pattern__complement,w
1198 24b 00bc            movwf slave_send__character
1199 24c 2344            call slave_send
1200                     ; Raw read :
1201                     ;   call slave_send {{ 6 }}  
1202 24d 3006            movlw 6
1203 24e 00bc            movwf slave_send__character
1204 24f 2344            call slave_send
1205                     ;   result := slave_get {{ }}  
1206 250 2350            call slave_get
1207 251 083e            movf slave_get__0return__byte,w
1208 252 00a5            movwf test_pattern__result
1209                     ; if { result != pattern } start
1210 253 0222            subwf test_pattern__pattern,w
1211                     ; expression=`{ result != pattern }' exp_delay=2 true_delay=6  false_delay=0 true_size=10 false_size=0
1212 254 1903            btfsc z___byte,z___bit
1213 255 2a60            goto label402__0end
1214                     ; if { result != pattern } body start
1215                     ;   call master_octal {{ result }}  
1216 256 0825            movf test_pattern__result,w
1217 257 00ba            movwf master_octal__number
1218 258 232b            call master_octal
1219                     ;   call master_fail {{ pattern_string , error }}  
1220 259 305f            movlw LOW pattern_string+1
1221 25a 00b5            movwf master_fail__test_name
1222 25b 0824            movf test_pattern__error,w
1223 25c 00b6            movwf master_fail__test_number
1224 25d 2307            call master_fail
1225                     ;   return 1  
1226 25e 1426            bsf test_pattern__0return__bit__byte,test_pattern__0return__bit__bit
1227 25f 3400            retlw 0
1228                     ; if { result != pattern } body end
1229             label402__0end:
1230                     ; if exp=` result != pattern ' empty false
1231                     ; Other expression=`{ result != pattern }' delay=-1
1232                     ; if { result != pattern } end
1233                     ; Regular Read :
1234                     ;   call slave_send {{ 0 }}  
1235 260 01bc            clrf slave_send__character
1236 261 2344            call slave_send
1237                     ;   result := slave_get {{ }}  
1238 262 2350            call slave_get
1239 263 083e            movf slave_get__0return__byte,w
1240 264 00a5            movwf test_pattern__result
1241                     ; if { result != pattern ^ complement } start
1242 265 0822            movf test_pattern__pattern,w
1243 266 0623            xorwf test_pattern__complement,w
1244 267 0225            subwf test_pattern__result,w
1245                     ; expression=`{ result != pattern ^ complement }' exp_delay=3 true_delay=7  false_delay=0 true_size=11 false_size=0
1246 268 1903            btfsc z___byte,z___bit
1247 269 2a75            goto label411__0end
1248                     ; if { result != pattern ^ complement } body start
1249                     ;   call master_octal {{ result }}  
1250 26a 0825            movf test_pattern__result,w
1251 26b 00ba            movwf master_octal__number
1252 26c 232b            call master_octal
1253                     ;   call master_fail {{ pattern_string , error | 1 }}  
1254 26d 305f            movlw LOW pattern_string+1
1255 26e 00b5            movwf master_fail__test_name
1256 26f 3001            movlw 1
1257 270 0424            iorwf test_pattern__error,w
1258 271 00b6            movwf master_fail__test_number
1259 272 2307            call master_fail
1260                     ;   return 1  
1261 273 1426            bsf test_pattern__0return__bit__byte,test_pattern__0return__bit__bit
1262 274 3400            retlw 0
1263                     ; if { result != pattern ^ complement } body end
1264             label411__0end:
1265                     ; if exp=` result != pattern ^ complement ' empty false
1266                     ; Other expression=`{ result != pattern ^ complement }' delay=-1
1267                     ; if { result != pattern ^ complement } end
1268                     ;   return 0  
1269 275 1026            bcf test_pattern__0return__bit__byte,test_pattern__0return__bit__bit
1270 276 3400            retlw 0
1271                     ; procedure test_pattern end
1272             
1273                     ; procedure test_pattern_prompt start
1274             test_pattern_prompt:
1275     0027    test_pattern_prompt__variables__base equ global__variables__bank0+27
1276     0027    test_pattern_prompt__bytes__base equ test_pattern_prompt__variables__base+0
1277     0029    test_pattern_prompt__bits__base equ test_pattern_prompt__variables__base+2
1278     0002    test_pattern_prompt__total__bytes equ 2
1279     0027    test_pattern_prompt__pattern equ test_pattern_prompt__bytes__base+0
1280                     ; This procedure will outpu ` 0 ' s and ` * ' s for each bit in pattern .
1281     0028    test_pattern_prompt__count equ test_pattern_prompt__bytes__base+1
1282                     ; `count_down count 4 ...' start
1283 277 3004            movlw 4
1284 278 00a8            movwf test_pattern_prompt__count
1285             test_pattern_prompt__428_loop:
1286                     ; if { pattern @ 3 } start
1287                     ; Alias variable for select pattern @ 3
1288     0027    test_pattern_prompt__pattern__429select0 equ test_pattern_prompt__pattern+0
1289     0027    test_pattern_prompt__pattern__429select0__byte equ test_pattern_prompt__pattern+0
1290     0003    test_pattern_prompt__pattern__429select0__bit equ 3
1291                     ; expression=`{ pattern @ 3 }' exp_delay=0 true_delay=-1  false_delay=-1 true_size=1 false_size=1
1292 279 19a7            btfsc test_pattern_prompt__pattern__429select0__byte,test_pattern_prompt__pattern__429select0__bit
1293                     ; if { pattern @ 3 } body start
1294                     ;   call master_send {{ 0c'*' }}  
1295 27a 302a            movlw 42
1296                     ; 2 instructions found for sharing
1297 27b 1da7            btfss test_pattern_prompt__pattern__429select0__byte,test_pattern_prompt__pattern__429select0__bit
1298                     ; else body start
1299                     ;   call master_send {{ 0c'0' }}  
1300 27c 3030            movlw 48
1301                     ; 2 instructions found for sharing
1302                     ; if exp=` pattern @ 3 ' single true and false skip delay=4
1303                     ; Other expression=`{ pattern @ 3 }' delay=4
1304                     ; 2 shared instructions follow
1305 27d 00bd            movwf master_send__character
1306 27e 234a            call master_send
1307                     ; if { pattern @ 3 } end
1308                     ;   pattern := pattern << 1  
1309 27f 1003            bcf c___byte,c___bit
1310 280 0da7            rlf test_pattern_prompt__pattern,f
1311 281 0ba8            decfsz test_pattern_prompt__count,f
1312 282 2a79            goto test_pattern_prompt__428_loop
1313             test_pattern_prompt__428_done:
1314                     ; `count_down count 4 ...' end
1315                     ; procedure test_pattern_prompt end
1316 283 3400            retlw 0
1317             
1318                     ; procedure test_interrupt start
1319             test_interrupt:
1320     0029    test_interrupt__variables__base equ global__variables__bank0+29
1321     0029    test_interrupt__bytes__base equ test_interrupt__variables__base+0
1322     0032    test_interrupt__bits__base equ test_interrupt__variables__base+9
1323     0009    test_interrupt__total__bytes equ 9
1324     0031    test_interrupt__504byte0 equ test_interrupt__bytes__base+8
1325     0029    test_interrupt__name equ test_interrupt__bytes__base+0
1326     002a    test_interrupt__start_pattern equ test_interrupt__bytes__base+1
1327     002b    test_interrupt__end_pattern equ test_interrupt__bytes__base+2
1328     002c    test_interrupt__set_command equ test_interrupt__bytes__base+3
1329                     ; This procedure will test to see that an interrupt occurs .
1330     002d    test_interrupt__pattern equ test_interrupt__bytes__base+4
1331     002e    test_interrupt__temp equ test_interrupt__bytes__base+5
1332     002f    test_interrupt__counter1 equ test_interrupt__bytes__base+6
1333     0030    test_interrupt__counter2 equ test_interrupt__bytes__base+7
1334                     ; Do the setup :
1335                     ;   pattern := start_pattern + 1  
1336 284 0a2a            incf test_interrupt__start_pattern,w
1337 285 00ad            movwf test_interrupt__pattern
1338                     ; `while  pattern != start_pattern  ...' start
1339             test_interrupt__454while__continue:
1340 286 082d            movf test_interrupt__pattern,w
1341 287 022a            subwf test_interrupt__start_pattern,w
1342                     ; expression=` pattern != start_pattern ' exp_delay=2 true_delay=1  false_delay=2 true_size=10 false_size=1
1343 288 1903            btfsc z___byte,z___bit
1344 289 2a94            goto test_interrupt__454while__break
1345                     ;   call test_pattern_prompt {{ start_pattern }}  
1346 28a 082a            movf test_interrupt__start_pattern,w
1347 28b 00a7            movwf test_pattern_prompt__pattern
1348 28c 2277            call test_pattern_prompt
1349                     ;   call master_prompt {{ }}  
1350 28d 22ee            call master_prompt
1351                     ;   call slave_send {{ 0 }}  
1352 28e 01bc            clrf slave_send__character
1353 28f 2344            call slave_send
1354                     ;   pattern := slave_get {{ }}  
1355 290 2350            call slave_get
1356 291 083e            movf slave_get__0return__byte,w
1357 292 00ad            movwf test_interrupt__pattern
1358 293 2a86            goto test_interrupt__454while__continue
1359                     ; if exp=` pattern != start_pattern ' false goto
1360                     ; Other expression=` pattern != start_pattern ' delay=-1
1361             test_interrupt__454while__break:
1362                     ; `while  pattern != start_pattern  ...' end
1363                     ;   call test_masks {{ }}  
1364 294 2218            call test_masks
1365                     ; Set the mask :
1366                     ;   call slave_send {{ set_command | 0xf }}  
1367 295 300f            movlw 15
1368 296 042c            iorwf test_interrupt__set_command,w
1369 297 00bc            movwf slave_send__character
1370 298 2344            call slave_send
1371                     ;   call test_masks {{ }}  
1372 299 2218            call test_masks
1373                     ; Enable interrupt :
1374                     ;   call slave_send {{ 0xf2 }}  
1375 29a 30f2            movlw 242
1376 29b 00bc            movwf slave_send__character
1377 29c 2344            call slave_send
1378                     ; Verify that interrupt flag is off :
1379                     ;   call slave_send {{ 0xef }}  
1380 29d 30ef            movlw 239
1381 29e 00bc            movwf slave_send__character
1382 29f 2344            call slave_send
1383                     ;   temp := slave_get {{ }}  
1384 2a0 2350            call slave_get
1385 2a1 083e            movf slave_get__0return__byte,w
1386 2a2 00ae            movwf test_interrupt__temp
1387                     ; if { temp != 2 } start
1388 2a3 3002            movlw 2
1389 2a4 022e            subwf test_interrupt__temp,w
1390                     ; expression=`{ temp != 2 }' exp_delay=2 true_delay=6  false_delay=0 true_size=12 false_size=0
1391 2a5 1903            btfsc z___byte,z___bit
1392 2a6 2ab3            goto label471__0end
1393                     ; if { temp != 2 } body start
1394                     ;   call master_octal {{ temp }}  
1395 2a7 082e            movf test_interrupt__temp,w
1396 2a8 00ba            movwf master_octal__number
1397 2a9 232b            call master_octal
1398                     ;   call master_fail {{ name , 0x20 }}  
1399 2aa 0829            movf test_interrupt__name,w
1400 2ab 00b5            movwf master_fail__test_name
1401 2ac 3020            movlw 32
1402 2ad 00b6            movwf master_fail__test_number
1403 2ae 2307            call master_fail
1404                     ; Clear the mask :
1405                     ;   call slave_send {{ set_command }}  
1406 2af 082c            movf test_interrupt__set_command,w
1407 2b0 00bc            movwf slave_send__character
1408 2b1 2344            call slave_send
1409                     ;   return  
1410 2b2 3400            retlw 0
1411                     ; if { temp != 2 } body end
1412             label471__0end:
1413                     ; if exp=` temp != 2 ' empty false
1414                     ; Other expression=`{ temp != 2 }' delay=-1
1415                     ; if { temp != 2 } end
1416                     ; Now ask the user to change the input .
1417                     ;   call test_pattern_prompt {{ end_pattern }}  
1418 2b3 082b            movf test_interrupt__end_pattern,w
1419 2b4 00a7            movwf test_pattern_prompt__pattern
1420 2b5 2277            call test_pattern_prompt
1421                     ; Wait for the interrupt :
1422                     ; < 255 * 255 > / < 3 * 2400 >= 9 . 03 sec :
1423                     ;   counter1 := 255  
1424 2b6 30ff            movlw 255
1425 2b7 00af            movwf test_interrupt__counter1
1426                     ; `while  counter1 != 0  ...' start
1427             test_interrupt__487while__continue:
1428 2b8 082f            movf test_interrupt__counter1,w
1429                     ; expression=` counter1 != 0 ' exp_delay=1 true_delay=1  false_delay=2 true_size=14 false_size=1
1430 2b9 1903            btfsc z___byte,z___bit
1431 2ba 2ac9            goto test_interrupt__487while__break
1432                     ;   counter1 := counter1 - 1  
1433 2bb 03af            decf test_interrupt__counter1,f
1434                     ;   counter2 := 255  
1435 2bc 30ff            movlw 255
1436 2bd 00b0            movwf test_interrupt__counter2
1437                     ; `while  counter2 != 0  ...' start
1438             test_interrupt__490while__continue:
1439 2be 0830            movf test_interrupt__counter2,w
1440                     ; expression=` counter2 != 0 ' exp_delay=1 true_delay=1  false_delay=2 true_size=7 false_size=1
1441 2bf 1903            btfsc z___byte,z___bit
1442 2c0 2ac8            goto test_interrupt__490while__break
1443                     ;   counter2 := counter2 - 1  
1444 2c1 03b0            decf test_interrupt__counter2,f
1445                     ;   call delay {{ }}  
1446 2c2 239d            call delay
1447                     ; if { ! rx_slave_pin } start
1448                     ; expression=`rx_slave_pin' exp_delay=0 true_delay=0  false_delay=2 true_size=0 false_size=2
1449 2c3 1805            btfsc rx_slave_pin__byte,rx_slave_pin__bit
1450 2c4 2ac7            goto label493__0end
1451                     ; if { ! rx_slave_pin } body start
1452                     ;   counter2 := 0  
1453 2c5 01b0            clrf test_interrupt__counter2
1454                     ;   counter1 := 0  
1455 2c6 01af            clrf test_interrupt__counter1
1456                     ; if { ! rx_slave_pin } body end
1457             label493__0end:
1458                     ; if exp=`rx_slave_pin' empty true
1459                     ; Other expression=`rx_slave_pin' delay=-1
1460                     ; if { ! rx_slave_pin } end
1461 2c7 2abe            goto test_interrupt__490while__continue
1462                     ; if exp=` counter2 != 0 ' false goto
1463                     ; Other expression=` counter2 != 0 ' delay=-1
1464             test_interrupt__490while__break:
1465                     ; `while  counter2 != 0  ...' end
1466 2c8 2ab8            goto test_interrupt__487while__continue
1467                     ; if exp=` counter1 != 0 ' false goto
1468                     ; Other expression=` counter1 != 0 ' delay=-1
1469             test_interrupt__487while__break:
1470                     ; `while  counter1 != 0  ...' end
1471                     ; if { rx_slave_pin } start
1472                     ; expression=`{ rx_slave_pin }' exp_delay=0 true_delay=-1  false_delay=-1 true_size=20 false_size=7
1473 2c9 1c05            btfss rx_slave_pin__byte,rx_slave_pin__bit
1474 2ca 2ae0            goto label499__0false
1475             label499__0true:
1476                     ; if { rx_slave_pin } body start
1477                     ; We timed out :
1478                     ;   call master_fail {{ name , 0x21 }}  
1479 2cb 0829            movf test_interrupt__name,w
1480 2cc 00b5            movwf master_fail__test_name
1481 2cd 3021            movlw 33
1482 2ce 00b6            movwf master_fail__test_number
1483 2cf 2307            call master_fail
1484                     ; Verify that pending bit is on and enable bit gets turned off :
1485                     ;   call slave_send {{ 0xef }}  
1486 2d0 30ef            movlw 239
1487 2d1 00bc            movwf slave_send__character
1488 2d2 2344            call slave_send
1489                     ; if { slave_get {{ }} != 1 } start
1490 2d3 2350            call slave_get
1491 2d4 083e            movf slave_get__0return__byte,w
1492 2d5 00b1            movwf test_interrupt__504byte0
1493 2d6 3001            movlw 1
1494 2d7 0231            subwf test_interrupt__504byte0,w
1495                     ; expression=`{ slave_get {{ }} != 1 }' exp_delay=3 true_delay=3  false_delay=0 true_size=5 false_size=0
1496 2d8 1903            btfsc z___byte,z___bit
1497 2d9 2adf            goto label504__1end
1498                     ; if { slave_get {{ }} != 1 } body start
1499                     ;   call master_fail {{ name , 0x22 }}  
1500 2da 0829            movf test_interrupt__name,w
1501 2db 00b5            movwf master_fail__test_name
1502 2dc 3022            movlw 34
1503 2dd 00b6            movwf master_fail__test_number
1504 2de 2307            call master_fail
1505                     ; if { slave_get {{ }} != 1 } body end
1506             label504__1end:
1507                     ; if exp=` slave_get ## {{ }} != 1 ' empty false
1508                     ; Other expression=`{ slave_get {{ }} != 1 }' delay=-1
1509                     ; if { slave_get {{ }} != 1 } end
1510                     ; if { rx_slave_pin } body end
1511 2df 2ae7            goto label499__0end
1512             label499__0false:
1513                     ; else body start
1514                     ;   call master_string {{ name }}  
1515 2e0 0829            movf test_interrupt__name,w
1516 2e1 00b7            movwf master_string__message
1517 2e2 2319            call master_string
1518                     ;   call master_string {{ succeed_string }}  
1519 2e3 3056            movlw LOW succeed_string+1
1520 2e4 00b7            movwf master_string__message
1521 2e5 2319            call master_string
1522                     ;   call master_crlf {{ }}  
1523 2e6 2312            call master_crlf
1524                     ; else body end
1525                     ; if exp=`rx_slave_pin' generic
1526             label499__0end:
1527                     ; Other expression=`{ rx_slave_pin }' delay=-1
1528                     ; if { rx_slave_pin } end
1529                     ; Clear the mask :
1530                     ;   call slave_send {{ set_command }}  
1531 2e7 082c            movf test_interrupt__set_command,w
1532 2e8 00bc            movwf slave_send__character
1533 2e9 2344            call slave_send
1534                     ; Clear the interrupt pending and enable mask :
1535                     ;   call slave_send {{ 0xf0 }}  
1536 2ea 30f0            movlw 240
1537 2eb 00bc            movwf slave_send__character
1538 2ec 2344            call slave_send
1539                     ; procedure test_interrupt end
1540 2ed 3400            retlw 0
1541             
1542                     ; procedure master_prompt start
1543             master_prompt:
1544     0032    master_prompt__variables__base equ global__variables__bank0+38
1545     0032    master_prompt__bytes__base equ master_prompt__variables__base+0
1546     0033    master_prompt__bits__base equ master_prompt__variables__base+1
1547     0001    master_prompt__total__bytes equ 1
1548                     ;   arguments_none  
1549                     ; This procedure will wait until the user types a character :
1550     0032    master_prompt__character equ master_prompt__bytes__base+0
1551                     ;   call master_send {{ 0c'?' }}  
1552 2ee 303f            movlw 63
1553 2ef 00bd            movwf master_send__character
1554 2f0 234a            call master_send
1555                     ;   character := master_get {{ }}  
1556 2f1 22f8            call master_get
1557 2f2 0833            movf master_get__0return__byte,w
1558 2f3 00b2            movwf master_prompt__character
1559                     ;   call master_send {{ character }}  
1560 2f4 00bd            movwf master_send__character
1561 2f5 234a            call master_send
1562                     ;   call master_crlf {{ }}  
1563 2f6 2312            call master_crlf
1564                     ; procedure master_prompt end
1565 2f7 3400            retlw 0
1566             
1567                     ; procedure master_get start
1568             master_get:
1569     0033    master_get__variables__base equ global__variables__bank0+39
1570     0033    master_get__bytes__base equ master_get__variables__base+0
1571     0035    master_get__bits__base equ master_get__variables__base+2
1572     0002    master_get__total__bytes equ 2
1573                     ;   arguments_none  
1574     0033    master_get__0return__byte equ master_get__bytes__base+0
1575                     ; This procedure will wait for , receive and return the next byte
1576                     ; from the master .
1577     0034    master_get__character equ master_get__bytes__base+1
1578                     ; FIXME : should be  return get_byte < rx_master_mask > 
1579                     ;   character := 0xfc  
1580 2f8 30fc            movlw 252
1581 2f9 00b4            movwf master_get__character
1582                     ; `while  character = 0xfc  ...' start
1583             master_get__547while__continue:
1584 2fa 30fc            movlw 252
1585 2fb 0234            subwf master_get__character,w
1586                     ; expression=` character = 0xfc ' exp_delay=2 true_delay=5  false_delay=2 true_size=6 false_size=1
1587 2fc 1d03            btfss z___byte,z___bit
1588 2fd 2b04            goto master_get__547while__break
1589                     ;   character := get_byte {{ rx_master_mask }}  
1590 2fe 3008            movlw 8
1591 2ff 00c0            movwf get_byte__mask
1592 300 2357            call get_byte
1593 301 0841            movf get_byte__0return__byte,w
1594 302 00b4            movwf master_get__character
1595 303 2afa            goto master_get__547while__continue
1596                     ; if exp=` character = 0xfc ' false goto
1597                     ; Other expression=` character = 0xfc ' delay=-1
1598             master_get__547while__break:
1599                     ; `while  character = 0xfc  ...' end
1600                     ;   return character  
1601 304 0834            movf master_get__character,w
1602 305 00b3            movwf master_get__0return__byte
1603 306 3400            retlw 0
1604                     ; procedure master_get end
1605             
1606                     ; procedure master_fail start
1607             master_fail:
1608     0035    master_fail__variables__base equ global__variables__bank0+41
1609     0035    master_fail__bytes__base equ master_fail__variables__base+0
1610     0037    master_fail__bits__base equ master_fail__variables__base+2
1611     0002    master_fail__total__bytes equ 2
1612     0035    master_fail__test_name equ master_fail__bytes__base+0
1613     0036    master_fail__test_number equ master_fail__bytes__base+1
1614                     ; This procedure will output ` fail ' followed by a carriage return
1615                     ; and line feed .
1616                     ;   call master_string {{ fail_string }}  
1617 307 3050            movlw LOW fail_string+1
1618 308 00b7            movwf master_string__message
1619 309 2319            call master_string
1620                     ;   call master_string {{ test_name }}  
1621 30a 0835            movf master_fail__test_name,w
1622 30b 00b7            movwf master_string__message
1623 30c 2319            call master_string
1624                     ;   call master_octal {{ test_number }}  
1625 30d 0836            movf master_fail__test_number,w
1626 30e 00ba            movwf master_octal__number
1627 30f 232b            call master_octal
1628                     ;   call master_crlf {{ }}  
1629 310 2312            call master_crlf
1630                     ; procedure master_fail end
1631 311 3400            retlw 0
1632             
1633                     ; procedure master_crlf start
1634             master_crlf:
1635     0037    master_crlf__variables__base equ global__variables__bank0+43
1636     0037    master_crlf__bytes__base equ master_crlf__variables__base+0
1637     0037    master_crlf__bits__base equ master_crlf__variables__base+0
1638     0000    master_crlf__total__bytes equ 0
1639                     ;   arguments_none  
1640                     ; This procedure will output a carriage return line feed to the master .
1641                     ;   call master_send {{ cr }}  
1642 312 300d            movlw 13
1643 313 00bd            movwf master_send__character
1644 314 234a            call master_send
1645                     ;   call master_send {{ lf }}  
1646 315 300a            movlw 10
1647 316 00bd            movwf master_send__character
1648 317 234a            call master_send
1649                     ; procedure master_crlf end
1650 318 3400            retlw 0
1651             
1652                     ; procedure master_string start
1653             master_string:
1654     0037    master_string__variables__base equ global__variables__bank0+43
1655     0037    master_string__bytes__base equ master_string__variables__base+0
1656     003a    master_string__bits__base equ master_string__variables__base+3
1657     0003    master_string__total__bytes equ 3
1658     0037    master_string__message equ master_string__bytes__base+0
1659                     ; This procedure will output < message > to the master .
1660     0038    master_string__size equ master_string__bytes__base+1
1661     0039    master_string__index equ master_string__bytes__base+2
1662                     ;   index := 0  
1663 319 01b9            clrf master_string__index
1664                     ; `count_down size  message . size  ...' start
1665 31a 018a            clrf pclath___register
1666 31b 0837            movf master_string__message,w
1667 31c 200b            call string___fetch
1668 31d 00b8            movwf master_string__size
1669             master_string__587_loop:
1670                     ;   call master_send {{ message ~~ {{ index }} }}  
1671 31e 0a39            incf master_string__index,w
1672 31f 0737            addwf master_string__message,w
1673 320 018a            clrf pclath___register
1674 321 200b            call string___fetch
1675 322 00bd            movwf master_send__character
1676 323 234a            call master_send
1677                     ;   index := index + 1  
1678 324 0ab9            incf master_string__index,f
1679 325 0bb8            decfsz master_string__size,f
1680 326 2b1e            goto master_string__587_loop
1681             master_string__587_done:
1682                     ; `count_down size  message . size  ...' end
1683                     ;   call master_send {{ sp }}  
1684 327 3020            movlw 32
1685 328 00bd            movwf master_send__character
1686 329 234a            call master_send
1687                     ; procedure master_string end
1688 32a 3400            retlw 0
1689             
1690                     ; procedure master_octal start
1691             master_octal:
1692     003a    master_octal__variables__base equ global__variables__bank0+46
1693     003a    master_octal__bytes__base equ master_octal__variables__base+0
1694     003c    master_octal__bits__base equ master_octal__variables__base+2
1695     0002    master_octal__total__bytes equ 2
1696     003b    master_octal__602byte0 equ master_octal__bytes__base+1
1697     003b    master_octal__601byte0 equ master_octal__bytes__base+1
1698     003a    master_octal__number equ master_octal__bytes__base+0
1699                     ; This procedure will output < number > in octal to the master .
1700                     ; Output the character in octal :
1701                     ;   call master_send {{ {{ number >> 6 }} + 0c'0' }}  
1702 32b 0e3a            swapf master_octal__number,w
1703 32c 00bb            movwf master_octal__601byte0
1704 32d 0cbb            rrf master_octal__601byte0,f
1705 32e 0c3b            rrf master_octal__601byte0,w
1706 32f 3903            andlw 3
1707 330 3e30            addlw 48
1708 331 00bd            movwf master_send__character
1709 332 234a            call master_send
1710                     ;   call master_send {{ {{ {{ number >> 3 }} & 7 }} + 0c'0' }}  
1711 333 0c3a            rrf master_octal__number,w
1712 334 00bb            movwf master_octal__602byte0
1713 335 0cbb            rrf master_octal__602byte0,f
1714 336 0c3b            rrf master_octal__602byte0,w
1715 337 3907            andlw 7
1716 338 3e30            addlw 48
1717 339 00bd            movwf master_send__character
1718 33a 234a            call master_send
1719                     ;   call master_send {{ {{ number & 7 }} + 0c'0' }}  
1720 33b 3007            movlw 7
1721 33c 053a            andwf master_octal__number,w
1722 33d 3e30            addlw 48
1723 33e 00bd            movwf master_send__character
1724 33f 234a            call master_send
1725                     ;   call master_send {{ 32 }}  
1726 340 3020            movlw 32
1727 341 00bd            movwf master_send__character
1728 342 234a            call master_send
1729                     ; procedure master_octal end
1730 343 3400            retlw 0
1731             
1732                     ; procedure slave_send start
1733             slave_send:
1734     003c    slave_send__variables__base equ global__variables__bank0+48
1735     003c    slave_send__bytes__base equ slave_send__variables__base+0
1736     003d    slave_send__bits__base equ slave_send__variables__base+1
1737     0001    slave_send__total__bytes equ 1
1738     003c    slave_send__character equ slave_send__bytes__base+0
1739                     ; This procedure will send < character > to the slave RoboBrick .
1740                     ;   call send_byte {{ character , tx_slave_mask }}  
1741 344 083c            movf slave_send__character,w
1742 345 00c4            movwf send_byte__char
1743 346 3002            movlw 2
1744 347 00c5            movwf send_byte__mask
1745 348 237d            call send_byte
1746                     ; procedure slave_send end
1747 349 3400            retlw 0
1748             
1749                     ; procedure master_send start
1750             master_send:
1751     003d    master_send__variables__base equ global__variables__bank0+49
1752     003d    master_send__bytes__base equ master_send__variables__base+0
1753     003e    master_send__bits__base equ master_send__variables__base+1
1754     0001    master_send__total__bytes equ 1
1755     003d    master_send__character equ master_send__bytes__base+0
1756                     ; This procedure will send < character > to the master .
1757                     ;   call send_byte {{ character , tx_master_mask }}  
1758 34a 083d            movf master_send__character,w
1759 34b 00c4            movwf send_byte__char
1760 34c 3004            movlw 4
1761 34d 00c5            movwf send_byte__mask
1762 34e 237d            call send_byte
1763                     ; procedure master_send end
1764 34f 3400            retlw 0
1765             
1766                     ; procedure slave_get start
1767             slave_get:
1768     003e    slave_get__variables__base equ global__variables__bank0+50
1769     003e    slave_get__bytes__base equ slave_get__variables__base+0
1770     0040    slave_get__bits__base equ slave_get__variables__base+2
1771     0002    slave_get__total__bytes equ 2
1772                     ;   arguments_none  
1773     003e    slave_get__0return__byte equ slave_get__bytes__base+0
1774                     ; This procedure will wait for , receive and return the next byte
1775                     ; from the slave
1776     003f    slave_get__result equ slave_get__bytes__base+1
1777                     ; FIXME : should be  return get_byte < rx_slave_mask > 
1778                     ;   result := get_byte {{ rx_slave_mask }}  
1779 350 3001            movlw 1
1780 351 00c0            movwf get_byte__mask
1781 352 2357            call get_byte
1782 353 0841            movf get_byte__0return__byte,w
1783 354 00bf            movwf slave_get__result
1784                     ;   return result  
1785 355 00be            movwf slave_get__0return__byte
1786 356 3400            retlw 0
1787                     ; procedure slave_get end
1788             
1789                     ; procedure get_byte start
1790             get_byte:
1791     0040    get_byte__variables__base equ global__variables__bank0+52
1792     0040    get_byte__bytes__base equ get_byte__variables__base+0
1793     0044    get_byte__bits__base equ get_byte__variables__base+4
1794     0004    get_byte__total__bytes equ 4
1795     0040    get_byte__mask equ get_byte__bytes__base+0
1796     0041    get_byte__0return__byte equ get_byte__bytes__base+1
1797                     ; Get an 8 - bit byte from < mask > bit of < porta > and return it .
1798                     ; If no character shows up in a while 0xfc is returned .
1799     0042    get_byte__count equ get_byte__bytes__base+2
1800     0043    get_byte__char equ get_byte__bytes__base+3
1801                     ; Wait until a start bit arrives :
1802                     ;   receiving := 1  
1803 357 1449            bsf receiving__byte,receiving__bit
1804                     ;   count := 0  
1805 358 01c2            clrf get_byte__count
1806                     ; `while  porta & mask != 0  ...' start
1807             get_byte__653while__continue:
1808 359 0805            movf porta,w
1809 35a 0540            andwf get_byte__mask,w
1810                     ; expression=` porta & mask != 0 ' exp_delay=2 true_delay=1  false_delay=2 true_size=9 false_size=1
1811 35b 1903            btfsc z___byte,z___bit
1812 35c 2b66            goto get_byte__653while__break
1813                     ;   count := count - 1  
1814 35d 03c2            decf get_byte__count,f
1815                     ; if { count = 0 } start
1816 35e 0842            movf get_byte__count,w
1817                     ; expression=`{ count = 0 }' exp_delay=1 true_delay=3  false_delay=0 true_size=3 false_size=0
1818 35f 1d03            btfss z___byte,z___bit
1819 360 2b64            goto label655__0end
1820                     ; if { count = 0 } body start
1821                     ;   return 0xfc  
1822 361 30fc            movlw 252
1823 362 00c1            movwf get_byte__0return__byte
1824 363 3400            retlw 0
1825                     ; if { count = 0 } body end
1826             label655__0end:
1827                     ; if exp=` count = 0 ' empty false
1828                     ; Other expression=`{ count = 0 }' delay=-1
1829                     ; if { count = 0 } end
1830                     ;   call delay {{ }}  
1831 364 239d            call delay
1832 365 2b59            goto get_byte__653while__continue
1833                     ; if exp=` porta & mask != 0 ' false goto
1834                     ; Other expression=` porta & mask != 0 ' delay=-1
1835             get_byte__653while__break:
1836                     ; `while  porta & mask != 0  ...' end
1837                     ; Skip over the start bit :
1838                     ;   call delay {{ }}  
1839 366 239d            call delay
1840                     ;   call delay {{ }}  
1841 367 239d            call delay
1842                     ;   call delay {{ }}  
1843 368 239d            call delay
1844                     ; Sample in the middle third of each data bit :
1845                     ;   char := 0  
1846 369 01c3            clrf get_byte__char
1847                     ; `count_down count 8 ...' start
1848 36a 3008            movlw 8
1849 36b 00c2            movwf get_byte__count
1850             get_byte__668_loop:
1851                     ;   call delay {{ }}  
1852 36c 239d            call delay
1853                     ;   char := char >> 1  
1854 36d 1003            bcf c___byte,c___bit
1855 36e 0cc3            rrf get_byte__char,f
1856                     ; if { porta & mask != 0 } start
1857 36f 0805            movf porta,w
1858 370 0540            andwf get_byte__mask,w
1859                     ; expression=`{ porta & mask != 0 }' exp_delay=2 true_delay=2  false_delay=0 true_size=2 false_size=0
1860 371 1903            btfsc z___byte,z___bit
1861 372 2b75            goto label671__0end
1862                     ; if { porta & mask != 0 } body start
1863                     ;   char := char | 0x80  
1864 373 3080            movlw 128
1865 374 04c3            iorwf get_byte__char,f
1866                     ; if { porta & mask != 0 } body end
1867             label671__0end:
1868                     ; if exp=` porta & mask != 0 ' empty false
1869                     ; Other expression=`{ porta & mask != 0 }' delay=-1
1870                     ; if { porta & mask != 0 } end
1871                     ;   call delay {{ }}  
1872 375 239d            call delay
1873                     ;   call delay {{ }}  
1874 376 239d            call delay
1875 377 0bc2            decfsz get_byte__count,f
1876 378 2b6c            goto get_byte__668_loop
1877             get_byte__668_done:
1878                     ; `count_down count 8 ...' end
1879                     ; Skip over 1 / 3 of the stop bit :
1880                     ;   call delay {{ }}  
1881 379 239d            call delay
1882                     ;   return char  
1883 37a 0843            movf get_byte__char,w
1884 37b 00c1            movwf get_byte__0return__byte
1885 37c 3400            retlw 0
1886                     ; procedure get_byte end
1887             
1888                     ; procedure send_byte start
1889             send_byte:
1890     0044    send_byte__variables__base equ global__variables__bank0+56
1891     0044    send_byte__bytes__base equ send_byte__variables__base+0
1892     0048    send_byte__bits__base equ send_byte__variables__base+4
1893     0004    send_byte__total__bytes equ 4
1894     0044    send_byte__char equ send_byte__bytes__base+0
1895     0045    send_byte__mask equ send_byte__bytes__base+1
1896                     ; Send < char > to < mask > bit of < porta > .
1897     0046    send_byte__count equ send_byte__bytes__base+2
1898     0047    send_byte__mark equ send_byte__bytes__base+3
1899                     ; if { receiving } start
1900                     ; expression=`{ receiving }' exp_delay=0 true_delay=-1  false_delay=0 true_size=3 false_size=0
1901 37d 1c49            btfss receiving__byte,receiving__bit
1902 37e 2b82            goto label694__0end
1903                     ; if { receiving } body start
1904                     ;   receiving := 1  
1905 37f 1449            bsf receiving__byte,receiving__bit
1906                     ;   call delay {{ }}  
1907 380 239d            call delay
1908                     ;   call delay {{ }}  
1909 381 239d            call delay
1910                     ; if { receiving } body end
1911             label694__0end:
1912                     ; if exp=`receiving' empty false
1913                     ; Other expression=`{ receiving }' delay=-1
1914                     ; if { receiving } end
1915                     ; Send the start bit :
1916                     ;   mark := mask ^ space  
1917 382 30ff            movlw 255
1918 383 0645            xorwf send_byte__mask,w
1919 384 00c7            movwf send_byte__mark
1920                     ;   porta := mark  
1921 385 0085            movwf porta
1922                     ;   call delay {{ }}  
1923 386 239d            call delay
1924                     ;   call delay {{ }}  
1925 387 239d            call delay
1926                     ;   call delay {{ }}  
1927 388 239d            call delay
1928                     ; Send the data :
1929                     ; `count_down count 8 ...' start
1930 389 3008            movlw 8
1931 38a 00c6            movwf send_byte__count
1932             send_byte__708_loop:
1933                     ; if { char @ 0 } start
1934                     ; Alias variable for select char @ 0
1935     0044    send_byte__char__709select0 equ send_byte__char+0
1936     0044    send_byte__char__709select0__byte equ send_byte__char+0
1937     0000    send_byte__char__709select0__bit equ 0
1938                     ; expression=`{ char @ 0 }' exp_delay=0 true_delay=1  false_delay=1 true_size=1 false_size=1
1939 38b 1844            btfsc send_byte__char__709select0__byte,send_byte__char__709select0__bit
1940                     ; if { char @ 0 } body start
1941                     ;   porta := space  
1942 38c 30ff            movlw 255
1943                     ; 1 instructions found for sharing
1944 38d 1c44            btfss send_byte__char__709select0__byte,send_byte__char__709select0__bit
1945                     ; else body start
1946                     ;   porta := mark  
1947 38e 0847            movf send_byte__mark,w
1948                     ; 1 instructions found for sharing
1949                     ; if exp=` char @ 0 ' single true and false skip delay=4
1950                     ; Other expression=`{ char @ 0 }' delay=4
1951                     ; 1 shared instructions follow
1952 38f 0085            movwf porta
1953                     ; if { char @ 0 } end
1954                     ;   char := char >> 1  
1955 390 1003            bcf c___byte,c___bit
1956 391 0cc4            rrf send_byte__char,f
1957                     ;   call delay {{ }}  
1958 392 239d            call delay
1959                     ;   call delay {{ }}  
1960 393 239d            call delay
1961                     ;   call delay {{ }}  
1962 394 239d            call delay
1963 395 0bc6            decfsz send_byte__count,f
1964 396 2b8b            goto send_byte__708_loop
1965             send_byte__708_done:
1966                     ; `count_down count 8 ...' end
1967                     ; Send the stop bit :
1968                     ;   porta := space  
1969 397 30ff            movlw 255
1970 398 0085            movwf porta
1971                     ;   call delay {{ }}  
1972 399 239d            call delay
1973                     ;   call delay {{ }}  
1974 39a 239d            call delay
1975                     ;   call delay {{ }}  
1976 39b 239d            call delay
1977                     ; procedure send_byte end
1978 39c 3400            retlw 0
1979             
1980                     ; procedure delay start
1981                     ; optimize 0
1982             delay:
1983     0048    delay__variables__base equ global__variables__bank0+60
1984     0048    delay__bytes__base equ delay__variables__base+0
1985     0049    delay__bits__base equ delay__variables__base+1
1986     0001    delay__total__bytes equ 1
1987     0048    delay__727byte1 equ delay__bytes__base+0
1988                     ;   arguments_none  
1989                     ;   uniform_delay instructions_per_delay  
1990                     ; Uniform delay remaining = 134 Accumulated Delay = 0
1991                     ; Uniform delay remaining = 134 Accumulated Delay = 0
1992                     ; This procedure will delay for 1 / 3 of a bit time .
1993                     ; Uniform delay remaining = 134 Accumulated Delay = 0
1994                     ; Uniform delay remaining = 134 Accumulated Delay = 0
1995                     ; Soak up remaining 134 cycles
1996                     ; Delay 134 cycles
1997 39d 302c            movlw 44
1998 39e 00c8            movwf delay__727byte1
1999             delay__727delay0:
2000 39f 0bc8            decfsz delay__727byte1,f
2001 3a0 2b9f            goto delay__727delay0
2002 3a1 0000            nop
2003                     ; procedure delay end
2004 3a2 3400            retlw 0
2005                     ; optimize 1
2006             
2007                     ; Register bank 0 used 61 bytes of 68 available bytes
2008                     ; Register bank 1 used 0 bytes of 0 available bytes
2009             
2010                     end

