<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">        radix dec
global__variables__bank0 equ 12
global__variables__bank1 equ 255
global__bit__variables__bank0 equ 73
global__bit__variables__bank1 equ 255
indf___register equ 0
pcl___register equ 2
c___byte equ 3
c___bit equ 0
z___byte equ 3
z___bit equ 2
rp0___byte equ 3
rp0___bit equ 5
rp1___byte equ 3
rp1___bit equ 6
irp___byte equ 3
irp___bit equ 7
trisa___register equ 0x85
trisb___register equ 0x86
fsr___register equ 4
pclath___register equ 10
        org 0
start:
        nop
        nop
        nop
        goto skip___interrupt
interrupt___vector:
        retfie
skip___interrupt:
        ; Initialize TRIS registers
        movlw 233
        ; Switch from register bank 0 to register bank 1 (which contains trisa___register)
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
        movwf trisa___register
        clrf pclath___register
        ; Switch from register bank 1 to register bank 0
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        goto main
        ; comment #############################################################################
        ; comment {}
        ; comment {Copyright &lt; c &gt; 1999 - 2001 by Wayne C . Gramlich .}
        ; comment {All rights reserved .}
        ; comment {}
        ; comment {Permission to use , copy , modify , distribute , and sell this software}
        ; comment {for any purpose is hereby granted without fee provided that the above}
        ; comment {copyright notice and this permission are retained . The author makes}
        ; comment {no representations about the suitability of this software for any purpose .}
        ; comment {It is provided { as is } without express or implied warranty .}
        ; comment {}
        ; comment {This is a test harness for testing the Threshold4 RoboBrick . Please see :}
        ; comment {}
        ; comment {http : / / web . gramlich . net / projects / robobricks / threshold4 / index . html}
        ; comment {}
        ; comment {for more details .}
        ; comment {}
        ; comment #############################################################################
        ;   processor pic16f84 cp = off dp = off pwrte = disabled wdte = disabled fosc = xt  
        ; 16377=0x3ff9 8199=0x2007
        __config 16377
configuration___address equ 8199
        ;   constant clock_rate 4000000  
clock_rate equ 4000000
        ;   constant instruction_rate clock_rate / 4  
instruction_rate equ 1000000
        ;   constant baud_rate 2400  
baud_rate equ 2400
        ;   constant instructions_per_bit instruction_rate / baud_rate  
instructions_per_bit equ 416
        ;   constant delays_per_bit 3  
delays_per_bit equ 3
        ;   constant instructions_per_delay instructions_per_bit / delays_per_bit  
instructions_per_delay equ 138
        ;   constant delay_count instructions_per_delay / 6  
delay_count equ 23
        ;   constant cr 13  
cr equ 13
        ;   constant lf 10  
lf equ 10
        ;   constant sp 32  
sp equ 32
        ; comment {Some bit definitions :}
        ;   constant rx_slave_bit 0  
rx_slave_bit equ 0
        ;   constant tx_slave_bit 1  
tx_slave_bit equ 1
        ;   constant tx_master_bit 2  
tx_master_bit equ 2
        ;   constant rx_master_bit 3  
rx_master_bit equ 3
        ;   constant rx_slave_mask 1 &lt;&lt; rx_slave_bit  
rx_slave_mask equ 1
        ;   constant tx_slave_mask 1 &lt;&lt; tx_slave_bit  
tx_slave_mask equ 2
        ;   constant rx_master_mask 1 &lt;&lt; rx_master_bit  
rx_master_mask equ 8
        ;   constant tx_master_mask 1 &lt;&lt; tx_master_bit  
tx_master_mask equ 4
porta equ 5
tx_master_pin__byte equ 5
tx_master_pin__bit equ 2
rx_master_pin__byte equ 5
rx_master_pin__bit equ 3
tx_slave_pin__byte equ 5
tx_slave_pin__bit equ 1
rx_slave_pin__byte equ 5
rx_slave_pin__bit equ 0
heart__byte equ 5
heart__bit equ 4
portb equ 6
        ;   constant space 0xff  
space equ 255
receiving equ global__bit__variables__bank0+0
receiving__byte equ global__bit__variables__bank0+0
receiving__bit equ 0
        ; string_constants Start
string___fetch:
        movwf pcl___register
        ;   hello_string = 0s'Threshold4'  
hello_string___string equ 0
hello_string:
        addwf pcl___register,f
        ; Length = 10
        retlw 10
        ; `Threshold4'
        retlw 84
        retlw 104
        retlw 114
        retlw 101
        retlw 115
        retlw 104
        retlw 111
        retlw 108
        retlw 100
        retlw 52
        ;   common_string = 0s'Common'  
common_string___string equ 12
common_string:
        addwf pcl___register,f
        ; Length = 6
        retlw 6
        ; `Common'
        retlw 67
        retlw 111
        retlw 109
        retlw 109
        retlw 111
        retlw 110
        ;   interrupt_string = 0s'Interrupt'  
interrupt_string___string equ 20
interrupt_string:
        addwf pcl___register,f
        ; Length = 9
        retlw 9
        ; `Interrupt'
        retlw 73
        retlw 110
        retlw 116
        retlw 101
        retlw 114
        retlw 114
        retlw 117
        retlw 112
        retlw 116
        ;   complement_string = 0s'Compl'  
complement_string___string equ 31
complement_string:
        addwf pcl___register,f
        ; Length = 5
        retlw 5
        ; `Compl'
        retlw 67
        retlw 111
        retlw 109
        retlw 112
        retlw 108
        ;   register_string = 0s'Reg'  
register_string___string equ 38
register_string:
        addwf pcl___register,f
        ; Length = 3
        retlw 3
        ; `Reg'
        retlw 82
        retlw 101
        retlw 103
        ;   high_string = 0s'High'  
high_string___string equ 43
high_string:
        addwf pcl___register,f
        ; Length = 4
        retlw 4
        ; `High'
        retlw 72
        retlw 105
        retlw 103
        retlw 104
        ;   low_string = 0s'Low'  
low_string___string equ 49
low_string:
        addwf pcl___register,f
        ; Length = 3
        retlw 3
        ; `Low'
        retlw 76
        retlw 111
        retlw 119
        ;   raising_string = 0s'Raise'  
raising_string___string equ 54
raising_string:
        addwf pcl___register,f
        ; Length = 5
        retlw 5
        ; `Raise'
        retlw 82
        retlw 97
        retlw 105
        retlw 115
        retlw 101
        ;   falling_string = 0s'Fall'  
falling_string___string equ 61
falling_string:
        addwf pcl___register,f
        ; Length = 4
        retlw 4
        ; `Fall'
        retlw 70
        retlw 97
        retlw 108
        retlw 108
        ;   fail_string = 0s'Fail'  
fail_string___string equ 67
fail_string:
        addwf pcl___register,f
        ; Length = 4
        retlw 4
        ; `Fail'
        retlw 70
        retlw 97
        retlw 105
        retlw 108
        ;   succeed_string = 0s'Succeed'  
succeed_string___string equ 73
succeed_string:
        addwf pcl___register,f
        ; Length = 7
        retlw 7
        ; `Succeed'
        retlw 83
        retlw 117
        retlw 99
        retlw 99
        retlw 101
        retlw 101
        retlw 100
        ;   pattern_string = 0s'Pattern'  
pattern_string___string equ 82
pattern_string:
        addwf pcl___register,f
        ; Length = 7
        retlw 7
        ; `Pattern'
        retlw 80
        retlw 97
        retlw 116
        retlw 116
        retlw 101
        retlw 114
        retlw 110
        ;   masks_string = 0s'Masks'  
masks_string___string equ 91
masks_string:
        addwf pcl___register,f
        ; Length = 5
        retlw 5
        ; `Masks'
        retlw 77
        retlw 97
        retlw 115
        retlw 107
        retlw 115
        ;   done_string = 0s'Done'  
done_string___string equ 98
done_string:
        addwf pcl___register,f
        ; Length = 4
        retlw 4
        ; `Done'
        retlw 68
        retlw 111
        retlw 110
        retlw 101
        ;   patterns = 0 , 1 , 2 , 4 , 8 , 15 , 15 - 1 , 15 - 2 , 15 - 4 , 15 - 8 , 0  
patterns___string equ 104
patterns:
        addwf pcl___register,f
        ; Length = 11
        retlw 11
        ; 0
        retlw 0
        ; 1
        retlw 1
        ; 2
        retlw 2
        ; 4
        retlw 4
        ; 8
        retlw 8
        ; 15
        retlw 15
        ; 15 - 1
        retlw 14
        ; 15 - 2
        retlw 13
        ; 15 - 4
        retlw 11
        ; 15 - 8
        retlw 7
        ; 0
        retlw 0
        ; string__constants End

        ; procedure main start
main:
main__variables__base equ global__variables__bank0+0
main__bytes__base equ main__variables__base+0
main__bits__base equ main__variables__base+1
main__total__bytes equ 2
        ;   arguments_none  
        ; This is the main procedure :
main__counter equ main__bytes__base+0
        ; Initialize :
        ;   tx_slave_pin := 1  
        bsf tx_slave_pin__byte,tx_slave_pin__bit
        ;   tx_master_pin := 1  
        bsf tx_master_pin__byte,tx_master_pin__bit
        ; Wait for capacitors to charge up :
        ; `count_down counter 254 ...' start
        movlw 254
        movwf main__counter
main__85_loop:
        ;   call delay {{ }}  
        call delay
        decfsz main__counter,f
        goto main__85_loop
main__85_done:
        ; `count_down counter 254 ...' end
        ;   call master_string {{ hello_string }}  
        movlw LOW hello_string+1
        movwf master_string__message
        call master_string
        ;   call master_crlf {{ }}  
        call master_crlf
        ; Main loop :
        ; loop_forever ... start
main__92loop__forever:
        ; Get a character :
        ;   call master_string {{ hello_string }}  
        movlw LOW hello_string+1
        movwf master_string__message
        call master_string
        ;   call master_prompt {{ }}  
        call master_prompt
        ;   call test {{ }}  
        call test
        ;   call master_string {{ done_string }}  
        movlw LOW done_string+1
        movwf master_string__message
        call master_string
        ;   call master_crlf {{ }}  
        call master_crlf
        goto main__92loop__forever
        ; loop_forever ... end
        ; procedure main end

        ; procedure test start
test:
test__variables__base equ global__variables__bank0+2
test__bytes__base equ test__variables__base+0
test__bits__base equ test__variables__base+3
test__total__bytes equ 4
        ;   arguments_none  
        ; This procedure will test out a Threshold4 RoboBrick .
test__index equ test__bytes__base+0
test__result equ test__bytes__base+1
test__pattern equ test__bytes__base+2
test__error equ test__bits__base+0
test__error__byte equ test__bits__base+0
test__error__bit equ 0
        ; Test common shared commands :
        ;   call common_test {{ }}  
        call common_test
        ; Test shared interrupt commands :
        ;   call interrupt_test {{ }}  
        call interrupt_test
        ; Test the registers :
        ; Test Complement Mask Register
        ;   call test_register {{ complement_string , 1 , 0x10 }}  
        movlw LOW complement_string+1
        movwf test_register__name
        movlw 1
        movwf test_register__read_command
        movlw 16
        movwf test_register__write_command
        call test_register
        ; Test Low Mask Register
        ;   call test_register {{ high_string , 2 , 0x20 }}  
        movlw LOW high_string+1
        movwf test_register__name
        movlw 2
        movwf test_register__read_command
        movlw 32
        movwf test_register__write_command
        call test_register
        ; Test High Mask Register
        ;   call test_register {{ low_string , 3 , 0x30 }}  
        movlw LOW low_string+1
        movwf test_register__name
        movlw 3
        movwf test_register__read_command
        movlw 48
        movwf test_register__write_command
        call test_register
        ; Test Raising Mask Register
        ;   call test_register {{ raising_string , 4 , 0x40 }}  
        movlw LOW raising_string+1
        movwf test_register__name
        movlw 4
        movwf test_register__read_command
        movlw 64
        movwf test_register__write_command
        call test_register
        ; Test Falling Mask Register
        ;   call test_register {{ falling_string , 5 , 0x50 }}  
        movlw LOW falling_string+1
        movwf test_register__name
        movlw 5
        movwf test_register__read_command
        movlw 80
        movwf test_register__write_command
        call test_register
        ; Test high interrupt mask :
        ;   call test_interrupt {{ high_string , 0 , 0xf , 0x20 }}  
        movlw LOW high_string+1
        movwf test_interrupt__name
        clrf test_interrupt__start_pattern
        movlw 15
        movwf test_interrupt__end_pattern
        movlw 32
        movwf test_interrupt__set_command
        call test_interrupt
        ; Test low interrupt mask :
        ;   call test_interrupt {{ low_string , 0xf , 0 , 0x30 }}  
        movlw LOW low_string+1
        movwf test_interrupt__name
        movlw 15
        movwf test_interrupt__start_pattern
        clrf test_interrupt__end_pattern
        movlw 48
        movwf test_interrupt__set_command
        call test_interrupt
        ; Test raising interrupt mask :
        ;   call test_interrupt {{ raising_string , 0 , 0xf , 0x40 }}  
        movlw LOW raising_string+1
        movwf test_interrupt__name
        clrf test_interrupt__start_pattern
        movlw 15
        movwf test_interrupt__end_pattern
        movlw 64
        movwf test_interrupt__set_command
        call test_interrupt
        ; Test falling interrupt mask :
        ;   call test_interrupt {{ falling_string , 0xf , 0 , 0x50 }}  
        movlw LOW falling_string+1
        movwf test_interrupt__name
        movlw 15
        movwf test_interrupt__start_pattern
        clrf test_interrupt__end_pattern
        movlw 80
        movwf test_interrupt__set_command
        call test_interrupt
        ; Do some read pattern tests :
        ;   index := 0  
        clrf test__index
        ; `while  index &lt; patterns . size  ...' start
test__142while__continue:
        movlw 11
        subwf test__index,w
        ; expression=` index &lt; patterns . size ' exp_delay=2 true_delay=1  false_delay=2 true_size=46 false_size=1
        btfsc c___byte,c___bit
        goto test__142while__break
        ;   pattern := patterns ~~ {{ index }}  
        incf test__index,w
        clrf pclath___register
        call patterns
        movwf test__pattern
        ;   error := 1  
        bsf test__error__byte,test__error__bit
        ; `while error ...' start
test__146while__continue:
        ; expression=`error' exp_delay=0 true_delay=1  false_delay=2 true_size=37 false_size=1
        btfss test__error__byte,test__error__bit
        goto test__146while__break
        ;   call test_pattern_prompt {{ pattern }}  
        movf test__pattern,w
        movwf test_pattern_prompt__pattern
        call test_pattern_prompt
        ;   call master_prompt {{ }}  
        call master_prompt
        ;   error := test_pattern {{ pattern , 0 , 5 }}  
        movf test__pattern,w
        movwf test_pattern__pattern
        clrf test_pattern__complement
        movlw 5
        movwf test_pattern__error
        call test_pattern
        bcf test__error__byte,test__error__bit
        btfsc test_pattern__0return__bit__byte,test_pattern__0return__bit__bit
        bsf test__error__byte,test__error__bit
        ; if { ! error } start
        ; expression=`error' exp_delay=0 true_delay=0  false_delay=-1 true_size=0 false_size=21
        btfsc test__error__byte,test__error__bit
        goto label151__0end
        ; if { ! error } body start
        ;   error := test_pattern {{ pattern , 0xf , 0x12 }}  
        movf test__pattern,w
        movwf test_pattern__pattern
        movlw 15
        movwf test_pattern__complement
        movlw 18
        movwf test_pattern__error
        call test_pattern
        bcf test__error__byte,test__error__bit
        btfsc test_pattern__0return__bit__byte,test_pattern__0return__bit__bit
        bsf test__error__byte,test__error__bit
        ; if { ! error } start
        ; expression=`error' exp_delay=0 true_delay=0  false_delay=7 true_size=0 false_size=9
        btfsc test__error__byte,test__error__bit
        goto label153__0end
        ; if { ! error } body start
        ;   error := test_pattern {{ pattern , 0 , 0x14 }}  
        movf test__pattern,w
        movwf test_pattern__pattern
        clrf test_pattern__complement
        movlw 20
        movwf test_pattern__error
        call test_pattern
        bcf test__error__byte,test__error__bit
        btfsc test_pattern__0return__bit__byte,test_pattern__0return__bit__bit
        bsf test__error__byte,test__error__bit
        ; if { ! error } body end
label153__0end:
        ; if exp=`error' empty true
        ; Other expression=`error' delay=-1
        ; if { ! error } end
        ; if { ! error } body end
label151__0end:
        ; if exp=`error' empty true
        ; Other expression=`error' delay=-1
        ; if { ! error } end
        goto test__146while__continue
        ; if exp=`error' false goto
        ; Other expression=`error' delay=-1
test__146while__break:
        ; `while error ...' end
        ;   index := index + 1  
        incf test__index,f
        goto test__142while__continue
        ; if exp=` index &lt; patterns . size ' false goto
        ; Other expression=` index &lt; patterns . size ' delay=-1
test__142while__break:
        ; `while  index &lt; patterns . size  ...' end
        ; procedure test end
        retlw 0
        ; comment {The procedures below are used to test the common shared commands :}

        ; procedure common_test start
common_test:
common_test__variables__base equ global__variables__bank0+6
common_test__bytes__base equ common_test__variables__base+0
common_test__bits__base equ common_test__variables__base+2
common_test__total__bytes equ 2
common_test__207byte0 equ common_test__bytes__base+1
        ;   arguments_none  
        ; This procedure will verify that the common shared commands work .
common_test__actual equ common_test__bytes__base+0
        ; Print the ID information :
        ; ID reset :
        ;   call slave_send {{ 0xfd }}  
        movlw 253
        movwf slave_send__character
        call slave_send
        ; Read the fixed bytes :
        ;   call common_test_id_match {{ 1 , 0xc0 }}  
        movlw 1
        movwf common_test_id_match__desired
        movlw 192
        movwf common_test_id_match__test_number
        call common_test_id_match
        ;   call common_test_id_match {{ 0 , 0xc1 }}  
        clrf common_test_id_match__desired
        movlw 193
        movwf common_test_id_match__test_number
        call common_test_id_match
        ;   call common_test_id_match {{ 19 , 0xc2 }}  
        movlw 19
        movwf common_test_id_match__desired
        movlw 194
        movwf common_test_id_match__test_number
        call common_test_id_match
        ;   call common_test_id_match {{ 0 , 0xc3 }}  
        clrf common_test_id_match__desired
        movlw 195
        movwf common_test_id_match__test_number
        call common_test_id_match
        ;   call common_test_id_match {{ 0 , 0xc4 }}  
        clrf common_test_id_match__desired
        movlw 196
        movwf common_test_id_match__test_number
        call common_test_id_match
        ;   call common_test_id_match {{ 0 , 0xc5 }}  
        clrf common_test_id_match__desired
        movlw 197
        movwf common_test_id_match__test_number
        call common_test_id_match
        ;   call common_test_id_match {{ 0 , 0xc6 }}  
        clrf common_test_id_match__desired
        movlw 198
        movwf common_test_id_match__test_number
        call common_test_id_match
        ;   call common_test_id_match {{ 0 , 0xc7 }}  
        clrf common_test_id_match__desired
        movlw 199
        movwf common_test_id_match__test_number
        call common_test_id_match
        ;   call master_crlf {{ }}  
        call master_crlf
        ;   call common_test_id_bytes8 {{ }}  
        call common_test_id_bytes8
        ;   call common_test_id_bytes8 {{ }}  
        call common_test_id_bytes8
        ; Read the brick name :
        ;   call common_test_id_string {{ }}  
        call common_test_id_string
        ; Read the vendor name :
        ;   call common_test_id_string {{ }}  
        call common_test_id_string
        ; Verfify that we don ' t read off the end of the id and crash :
        ;   call common_test_id_next {{ }}  
        call common_test_id_next
        movf common_test_id_next__0return__byte,w
        ; Reset id :
        ;   call slave_send {{ 0xfd }}  
        movlw 253
        movwf slave_send__character
        call slave_send
        ; Verify that we are still alive :
        ;   call common_test_id_match {{ 1 , 0xc8 }}  
        movlw 1
        movwf common_test_id_match__desired
        movlw 200
        movwf common_test_id_match__test_number
        call common_test_id_match
        ; Read glitch :
        ; Clear glitch register :
        ;   call slave_send {{ 0xfe }}  
        movlw 254
        movwf slave_send__character
        call slave_send
        ;   actual := slave_get {{ }}  
        call slave_get
        movf slave_get__0return__byte,w
        movwf common_test__actual
        ; Send a couple of glitches :
        ;   call slave_send {{ 0xff }}  
        movlw 255
        movwf slave_send__character
        call slave_send
        ;   call slave_send {{ 0xff }}  
        movlw 255
        movwf slave_send__character
        call slave_send
        ; Read the glitch register :
        ;   call slave_send {{ 0xfe }}  
        movlw 254
        movwf slave_send__character
        call slave_send
        ; if { slave_get {{ }} != 2 } start
        call slave_get
        movf slave_get__0return__byte,w
        movwf common_test__207byte0
        movlw 2
        subwf common_test__207byte0,w
        ; expression=`{ slave_get {{ }} != 2 }' exp_delay=3 true_delay=3  false_delay=0 true_size=5 false_size=0
        btfsc z___byte,z___bit
        goto label207__1end
        ; if { slave_get {{ }} != 2 } body start
        ;   call master_fail {{ common_string , 0xc9 }}  
        movlw LOW common_string+1
        movwf master_fail__test_name
        movlw 201
        movwf master_fail__test_number
        call master_fail
        ; if { slave_get {{ }} != 2 } body end
label207__1end:
        ; if exp=` slave_get ## {{ }} != 2 ' empty false
        ; Other expression=`{ slave_get {{ }} != 2 }' delay=-1
        ; if { slave_get {{ }} != 2 } end
        ; Do a clock pulse :
        ;   call slave_send {{ 0xfb }}  
        movlw 251
        movwf slave_send__character
        call slave_send
        ; if { slave_get {{ }} != 0 } start
        call slave_get
        movf slave_get__0return__byte,w
        ; expression=`{ slave_get {{ }} != 0 }' exp_delay=0 true_delay=3  false_delay=0 true_size=5 false_size=0
        btfsc z___byte,z___bit
        goto label213__0end
        ; if { slave_get {{ }} != 0 } body start
        ;   call master_fail {{ common_string , 0xca }}  
        movlw LOW common_string+1
        movwf master_fail__test_name
        movlw 202
        movwf master_fail__test_number
        call master_fail
        ; if { slave_get {{ }} != 0 } body end
label213__0end:
        ; if exp=` slave_get ## {{ }} != 0 ' empty false
        ; Other expression=`{ slave_get {{ }} != 0 }' delay=-1
        ; if { slave_get {{ }} != 0 } end
        ; Read clock :
        ;   call slave_send {{ 0xfa }}  
        movlw 250
        movwf slave_send__character
        call slave_send
        ;   actual := slave_get {{ }}  
        call slave_get
        movf slave_get__0return__byte,w
        movwf common_test__actual
        ; Increment :
        ;   call slave_send {{ 0xf9 }}  
        movlw 249
        movwf slave_send__character
        call slave_send
        ; Decrement :
        ;   call slave_send {{ 0xf8 }}  
        movlw 248
        movwf slave_send__character
        call slave_send
        ; Read clock again :
        ;   call slave_send {{ 0xfa }}  
        movlw 250
        movwf slave_send__character
        call slave_send
        ; if { actual != slave_get {{ }} } start
        call slave_get
        movf slave_get__0return__byte,w
        subwf common_test__actual,w
        ; expression=`{ actual != slave_get {{ }} }' exp_delay=1 true_delay=3  false_delay=0 true_size=5 false_size=0
        btfsc z___byte,z___bit
        goto label225__0end
        ; if { actual != slave_get {{ }} } body start
        ;   call master_fail {{ common_string , 0xcb }}  
        movlw LOW common_string+1
        movwf master_fail__test_name
        movlw 203
        movwf master_fail__test_number
        call master_fail
        ; if { actual != slave_get {{ }} } body end
label225__0end:
        ; if exp=` actual != slave_get ## {{ }} ' empty false
        ; Other expression=`{ actual != slave_get {{ }} }' delay=-1
        ; if { actual != slave_get {{ }} } end
        ; procedure common_test end
        retlw 0

        ; procedure common_test_id_match start
common_test_id_match:
common_test_id_match__variables__base equ global__variables__bank0+8
common_test_id_match__bytes__base equ common_test_id_match__variables__base+0
common_test_id_match__bits__base equ common_test_id_match__variables__base+2
common_test_id_match__total__bytes equ 2
common_test_id_match__desired equ common_test_id_match__bytes__base+0
common_test_id_match__test_number equ common_test_id_match__bytes__base+1
        ; This procedure will verify that the next byte in the id is &lt; desired &gt; .
        ; if { desired != common_test_id_next {{ }} } start
        call common_test_id_next
        movf common_test_id_next__0return__byte,w
        subwf common_test_id_match__desired,w
        ; expression=`{ desired != common_test_id_next {{ }} }' exp_delay=1 true_delay=3  false_delay=0 true_size=5 false_size=0
        btfsc z___byte,z___bit
        goto label237__0end
        ; if { desired != common_test_id_next {{ }} } body start
        ;   call master_fail {{ common_string , test_number }}  
        movlw LOW common_string+1
        movwf master_fail__test_name
        movf common_test_id_match__test_number,w
        movwf master_fail__test_number
        call master_fail
        ; if { desired != common_test_id_next {{ }} } body end
label237__0end:
        ; if exp=` desired != common_test_id_next ## {{ }} ' empty false
        ; Other expression=`{ desired != common_test_id_next {{ }} }' delay=-1
        ; if { desired != common_test_id_next {{ }} } end
        ; procedure common_test_id_match end
        retlw 0

        ; procedure common_test_id_bytes8 start
common_test_id_bytes8:
common_test_id_bytes8__variables__base equ global__variables__bank0+10
common_test_id_bytes8__bytes__base equ common_test_id_bytes8__variables__base+0
common_test_id_bytes8__bits__base equ common_test_id_bytes8__variables__base+1
common_test_id_bytes8__total__bytes equ 1
        ;   arguments_none  
        ; This procedure will print out the next 8 bytes of the id in octal .
common_test_id_bytes8__count equ common_test_id_bytes8__bytes__base+0
        ; `count_down count 8 ...' start
        movlw 8
        movwf common_test_id_bytes8__count
common_test_id_bytes8__250_loop:
        ;   call master_octal {{ common_test_id_next {{ }} }}  
        call common_test_id_next
        movf common_test_id_next__0return__byte,w
        movwf master_octal__number
        call master_octal
        decfsz common_test_id_bytes8__count,f
        goto common_test_id_bytes8__250_loop
common_test_id_bytes8__250_done:
        ; `count_down count 8 ...' end
        ;   call master_crlf {{ }}  
        call master_crlf
        ; procedure common_test_id_bytes8 end
        retlw 0

        ; procedure common_test_id_string start
common_test_id_string:
common_test_id_string__variables__base equ global__variables__bank0+11
common_test_id_string__bytes__base equ common_test_id_string__variables__base+0
common_test_id_string__bits__base equ common_test_id_string__variables__base+1
common_test_id_string__total__bytes equ 1
        ;   arguments_none  
        ; This procedure will print out the next id string .
common_test_id_string__count equ common_test_id_string__bytes__base+0
        ; `count_down count  common_test_id_next ## {{ }}  ...' start
        call common_test_id_next
        movf common_test_id_next__0return__byte,w
        movwf common_test_id_string__count
common_test_id_string__264_loop:
        ;   call master_send {{ common_test_id_next {{ }} }}  
        call common_test_id_next
        movf common_test_id_next__0return__byte,w
        movwf master_send__character
        call master_send
        decfsz common_test_id_string__count,f
        goto common_test_id_string__264_loop
common_test_id_string__264_done:
        ; `count_down count  common_test_id_next ## {{ }}  ...' end
        ;   call master_crlf {{ }}  
        call master_crlf
        ; procedure common_test_id_string end
        retlw 0

        ; procedure common_test_id_next start
common_test_id_next:
common_test_id_next__variables__base equ global__variables__bank0+12
common_test_id_next__bytes__base equ common_test_id_next__variables__base+0
common_test_id_next__bits__base equ common_test_id_next__variables__base+1
common_test_id_next__total__bytes equ 1
        ;   arguments_none  
common_test_id_next__0return__byte equ common_test_id_next__bytes__base+0
        ; This procedure returns the next byte from the identification string .
        ;   call slave_send {{ 0xfc }}  
        movlw 252
        movwf slave_send__character
        call slave_send
        ;   return slave_get {{ }}  
        call slave_get
        movf slave_get__0return__byte,w
        movwf common_test_id_next__0return__byte
        retlw 0
        ; procedure common_test_id_next end
        ; comment {The procedures below are used to test the shared interrupt commands :}

        ; procedure interrupt_test start
interrupt_test:
interrupt_test__variables__base equ global__variables__bank0+13
interrupt_test__bytes__base equ interrupt_test__variables__base+0
interrupt_test__bits__base equ interrupt_test__variables__base+1
interrupt_test__total__bytes equ 1
        ;   arguments_none  
        ; This procedure tests the common shared interrupt commands .
interrupt_test__counter equ interrupt_test__bytes__base+0
        ; Clear interrupt bits :
        ;   call slave_send {{ 0xf0 }}  
        movlw 240
        movwf slave_send__character
        call slave_send
        ;   call interrupt_read {{ 0 , 0xd0 }}  
        clrf interrupt_read__desired
        movlw 208
        movwf interrupt_read__test_number
        call interrupt_read
        ; Set / clear interrupt pending bit only :
        ;   call slave_send {{ 0xf5 }}  
        movlw 245
        movwf slave_send__character
        call slave_send
        ;   call interrupt_read {{ 1 , 0xd1 }}  
        movlw 1
        movwf interrupt_read__desired
        movlw 209
        movwf interrupt_read__test_number
        call interrupt_read
        ;   call slave_send {{ 0xf4 }}  
        movlw 244
        movwf slave_send__character
        call slave_send
        ;   call interrupt_read {{ 0 , 0xd2 }}  
        clrf interrupt_read__desired
        movlw 210
        movwf interrupt_read__test_number
        call interrupt_read
        ;   call slave_send {{ 0xf1 }}  
        movlw 241
        movwf slave_send__character
        call slave_send
        ;   call interrupt_read {{ 1 , 0xd3 }}  
        movlw 1
        movwf interrupt_read__desired
        movlw 211
        movwf interrupt_read__test_number
        call interrupt_read
        ;   call slave_send {{ 0xf0 }}  
        movlw 240
        movwf slave_send__character
        call slave_send
        ;   call interrupt_read {{ 0 , 0xd4 }}  
        clrf interrupt_read__desired
        movlw 212
        movwf interrupt_read__test_number
        call interrupt_read
        ; Set / clear interrupt enable bit only :
        ;   call slave_send {{ 0xf7 }}  
        movlw 247
        movwf slave_send__character
        call slave_send
        ;   call interrupt_read {{ 2 , 0xd5 }}  
        movlw 2
        movwf interrupt_read__desired
        movlw 213
        movwf interrupt_read__test_number
        call interrupt_read
        ;   call slave_send {{ 0xf6 }}  
        movlw 246
        movwf slave_send__character
        call slave_send
        ;   call interrupt_read {{ 0 , 0xd6 }}  
        clrf interrupt_read__desired
        movlw 214
        movwf interrupt_read__test_number
        call interrupt_read
        ;   call slave_send {{ 0xf2 }}  
        movlw 242
        movwf slave_send__character
        call slave_send
        ;   call interrupt_read {{ 2 , 0xd7 }}  
        movlw 2
        movwf interrupt_read__desired
        movlw 215
        movwf interrupt_read__test_number
        call interrupt_read
        ;   call slave_send {{ 0xf0 }}  
        movlw 240
        movwf slave_send__character
        call slave_send
        ;   call interrupt_read {{ 0 , 0xd8 }}  
        clrf interrupt_read__desired
        movlw 216
        movwf interrupt_read__test_number
        call interrupt_read
        ; Now set both the interrupt enable and pending bit .
        ; This must trigger an interrupt .
        ;   call slave_send {{ 0xf3 }}  
        movlw 243
        movwf slave_send__character
        call slave_send
        ; `count_down counter 3 ...' start
        movlw 3
        movwf interrupt_test__counter
interrupt_test__318_loop:
        ;   call delay {{ }}  
        call delay
        decfsz interrupt_test__counter,f
        goto interrupt_test__318_loop
interrupt_test__318_done:
        ; `count_down counter 3 ...' end
        ; if { rx_slave_pin } start
        ; expression=`{ rx_slave_pin }' exp_delay=0 true_delay=3  false_delay=0 true_size=5 false_size=0
        btfss rx_slave_pin__byte,rx_slave_pin__bit
        goto label321__0end
        ; if { rx_slave_pin } body start
        ; No interrupt detected :
        ;   call master_fail {{ interrupt_string , 0xd9 }}  
        movlw LOW interrupt_string+1
        movwf master_fail__test_name
        movlw 217
        movwf master_fail__test_number
        call master_fail
        ; if { rx_slave_pin } body end
label321__0end:
        ; if exp=`rx_slave_pin' empty false
        ; Other expression=`{ rx_slave_pin }' delay=-1
        ; if { rx_slave_pin } end
        ; Read the interrupt enable bit is cleared as a side effect
        ; of reading the bit .
        ;   call interrupt_read {{ 1 , 0xda }}  
        movlw 1
        movwf interrupt_read__desired
        movlw 218
        movwf interrupt_read__test_number
        call interrupt_read
        ; Clear the interrupt pending big :
        ;   call slave_send {{ 0xf0 }}  
        movlw 240
        movwf slave_send__character
        call slave_send
        ;   call interrupt_read {{ 0 , 0xdb }}  
        clrf interrupt_read__desired
        movlw 219
        movwf interrupt_read__test_number
        call interrupt_read
        ; procedure interrupt_test end
        retlw 0

        ; procedure interrupt_read start
interrupt_read:
interrupt_read__variables__base equ global__variables__bank0+14
interrupt_read__bytes__base equ interrupt_read__variables__base+0
interrupt_read__bits__base equ interrupt_read__variables__base+2
interrupt_read__total__bytes equ 2
interrupt_read__desired equ interrupt_read__bytes__base+0
interrupt_read__test_number equ interrupt_read__bytes__base+1
        ; This procedure will verify that the interrupt bits match &lt; desired &gt; .
        ;   call slave_send {{ 0xef }}  
        movlw 239
        movwf slave_send__character
        call slave_send
        ; if { slave_get {{ }} != desired } start
        call slave_get
        movf slave_get__0return__byte,w
        subwf interrupt_read__desired,w
        ; expression=`{ slave_get {{ }} != desired }' exp_delay=1 true_delay=3  false_delay=0 true_size=5 false_size=0
        btfsc z___byte,z___bit
        goto label342__0end
        ; if { slave_get {{ }} != desired } body start
        ;   call master_fail {{ interrupt_string , test_number }}  
        movlw LOW interrupt_string+1
        movwf master_fail__test_name
        movf interrupt_read__test_number,w
        movwf master_fail__test_number
        call master_fail
        ; if { slave_get {{ }} != desired } body end
label342__0end:
        ; if exp=` slave_get ## {{ }} != desired ' empty false
        ; Other expression=`{ slave_get {{ }} != desired }' delay=-1
        ; if { slave_get {{ }} != desired } end
        ; procedure interrupt_read end
        retlw 0
        ; comment {The procedures below are more specific to testing the Threshold4 :}

        ; procedure test_masks start
test_masks:
test_masks__variables__base equ global__variables__bank0+16
test_masks__bytes__base equ test_masks__variables__base+0
test_masks__bits__base equ test_masks__variables__base+1
test_masks__total__bytes equ 1
        ;   arguments_none  
test_masks__command equ test_masks__bytes__base+0
        ;   call master_string {{ masks_string }}  
        movlw LOW masks_string+1
        movwf master_string__message
        call master_string
        ;   command := 1  
        movlw 1
        movwf test_masks__command
        ; `while  command &lt;= 5  ...' start
test_masks__357while__continue:
        movlw 6
        subwf test_masks__command,w
        ; expression=` command &lt;= 5 ' exp_delay=2 true_delay=4  false_delay=2 true_size=9 false_size=1
        btfsc c___byte,c___bit
        goto test_masks__357while__break
        ;   call slave_send {{ command }}  
        movf test_masks__command,w
        movwf slave_send__character
        call slave_send
        ;   call master_octal {{ slave_get {{ }} }}  
        call slave_get
        movf slave_get__0return__byte,w
        movwf master_octal__number
        call master_octal
        ;   command := command + 1  
        incf test_masks__command,f
        goto test_masks__357while__continue
        ; if exp=` command &lt;= 5 ' false goto
        ; Other expression=` command &lt;= 5 ' delay=-1
test_masks__357while__break:
        ; `while  command &lt;= 5  ...' end
        ;   call master_crlf {{ }}  
        call master_crlf
        ; procedure test_masks end
        retlw 0

        ; procedure test_register start
test_register:
test_register__variables__base equ global__variables__bank0+17
test_register__bytes__base equ test_register__variables__base+0
test_register__bits__base equ test_register__variables__base+5
test_register__total__bytes equ 5
test_register__name equ test_register__bytes__base+0
test_register__read_command equ test_register__bytes__base+1
test_register__write_command equ test_register__bytes__base+2
        ; This procedure will test out a register .
test_register__index equ test_register__bytes__base+3
test_register__pattern equ test_register__bytes__base+4
        ;   index := 0  
        clrf test_register__index
        ; `while  index &lt; patterns . size  ...' start
test_register__377while__continue:
        movlw 11
        subwf test_register__index,w
        ; expression=` index &lt; patterns . size ' exp_delay=2 true_delay=1  false_delay=2 true_size=23 false_size=1
        btfsc c___byte,c___bit
        goto test_register__377while__break
        ;   pattern := patterns ~~ {{ index }}  
        incf test_register__index,w
        clrf pclath___register
        call patterns
        movwf test_register__pattern
        ;   call slave_send {{ write_command | pattern }}  
        movf test_register__write_command,w
        iorwf test_register__pattern,w
        movwf slave_send__character
        call slave_send
        ;   call slave_send {{ read_command }}  
        movf test_register__read_command,w
        movwf slave_send__character
        call slave_send
        ; if { slave_get {{ }} != pattern } start
        call slave_get
        movf slave_get__0return__byte,w
        subwf test_register__pattern,w
        ; expression=`{ slave_get {{ }} != pattern }' exp_delay=1 true_delay=3  false_delay=0 true_size=5 false_size=0
        btfsc z___byte,z___bit
        goto label381__0end
        ; if { slave_get {{ }} != pattern } body start
        ;   call master_fail {{ name , pattern }}  
        movf test_register__name,w
        movwf master_fail__test_name
        movf test_register__pattern,w
        movwf master_fail__test_number
        call master_fail
        ; if { slave_get {{ }} != pattern } body end
label381__0end:
        ; if exp=` slave_get ## {{ }} != pattern ' empty false
        ; Other expression=`{ slave_get {{ }} != pattern }' delay=-1
        ; if { slave_get {{ }} != pattern } end
        ;   index := index + 1  
        incf test_register__index,f
        goto test_register__377while__continue
        ; if exp=` index &lt; patterns . size ' false goto
        ; Other expression=` index &lt; patterns . size ' delay=-1
test_register__377while__break:
        ; `while  index &lt; patterns . size  ...' end
        ; procedure test_register end
        retlw 0

        ; procedure test_pattern start
test_pattern:
test_pattern__variables__base equ global__variables__bank0+22
test_pattern__bytes__base equ test_pattern__variables__base+0
test_pattern__bits__base equ test_pattern__variables__base+4
test_pattern__total__bytes equ 5
test_pattern__pattern equ test_pattern__bytes__base+0
test_pattern__complement equ test_pattern__bytes__base+1
test_pattern__error equ test_pattern__bytes__base+2
test_pattern__0return__bit equ test_pattern__bits__base+0
test_pattern__0return__bit__byte equ test_pattern__bits__base+0
test_pattern__0return__bit__bit equ 0
test_pattern__result equ test_pattern__bytes__base+3
        ; Set complement mask :
        ;   call slave_send {{ 0x10 | complement }}  
        movlw 16
        iorwf test_pattern__complement,w
        movwf slave_send__character
        call slave_send
        ; Raw read :
        ;   call slave_send {{ 6 }}  
        movlw 6
        movwf slave_send__character
        call slave_send
        ;   result := slave_get {{ }}  
        call slave_get
        movf slave_get__0return__byte,w
        movwf test_pattern__result
        ; if { result != pattern } start
        subwf test_pattern__pattern,w
        ; expression=`{ result != pattern }' exp_delay=2 true_delay=6  false_delay=0 true_size=10 false_size=0
        btfsc z___byte,z___bit
        goto label402__0end
        ; if { result != pattern } body start
        ;   call master_octal {{ result }}  
        movf test_pattern__result,w
        movwf master_octal__number
        call master_octal
        ;   call master_fail {{ pattern_string , error }}  
        movlw LOW pattern_string+1
        movwf master_fail__test_name
        movf test_pattern__error,w
        movwf master_fail__test_number
        call master_fail
        ;   return 1  
        bsf test_pattern__0return__bit__byte,test_pattern__0return__bit__bit
        retlw 0
        ; if { result != pattern } body end
label402__0end:
        ; if exp=` result != pattern ' empty false
        ; Other expression=`{ result != pattern }' delay=-1
        ; if { result != pattern } end
        ; Regular Read :
        ;   call slave_send {{ 0 }}  
        clrf slave_send__character
        call slave_send
        ;   result := slave_get {{ }}  
        call slave_get
        movf slave_get__0return__byte,w
        movwf test_pattern__result
        ; if { result != pattern ^ complement } start
        movf test_pattern__pattern,w
        xorwf test_pattern__complement,w
        subwf test_pattern__result,w
        ; expression=`{ result != pattern ^ complement }' exp_delay=3 true_delay=7  false_delay=0 true_size=11 false_size=0
        btfsc z___byte,z___bit
        goto label411__0end
        ; if { result != pattern ^ complement } body start
        ;   call master_octal {{ result }}  
        movf test_pattern__result,w
        movwf master_octal__number
        call master_octal
        ;   call master_fail {{ pattern_string , error | 1 }}  
        movlw LOW pattern_string+1
        movwf master_fail__test_name
        movlw 1
        iorwf test_pattern__error,w
        movwf master_fail__test_number
        call master_fail
        ;   return 1  
        bsf test_pattern__0return__bit__byte,test_pattern__0return__bit__bit
        retlw 0
        ; if { result != pattern ^ complement } body end
label411__0end:
        ; if exp=` result != pattern ^ complement ' empty false
        ; Other expression=`{ result != pattern ^ complement }' delay=-1
        ; if { result != pattern ^ complement } end
        ;   return 0  
        bcf test_pattern__0return__bit__byte,test_pattern__0return__bit__bit
        retlw 0
        ; procedure test_pattern end

        ; procedure test_pattern_prompt start
test_pattern_prompt:
test_pattern_prompt__variables__base equ global__variables__bank0+27
test_pattern_prompt__bytes__base equ test_pattern_prompt__variables__base+0
test_pattern_prompt__bits__base equ test_pattern_prompt__variables__base+2
test_pattern_prompt__total__bytes equ 2
test_pattern_prompt__pattern equ test_pattern_prompt__bytes__base+0
        ; This procedure will outpu ` 0 ' s and ` * ' s for each bit in pattern .
test_pattern_prompt__count equ test_pattern_prompt__bytes__base+1
        ; `count_down count 4 ...' start
        movlw 4
        movwf test_pattern_prompt__count
test_pattern_prompt__428_loop:
        ; if { pattern @ 3 } start
        ; Alias variable for select pattern @ 3
test_pattern_prompt__pattern__429select0 equ test_pattern_prompt__pattern+0
test_pattern_prompt__pattern__429select0__byte equ test_pattern_prompt__pattern+0
test_pattern_prompt__pattern__429select0__bit equ 3
        ; expression=`{ pattern @ 3 }' exp_delay=0 true_delay=-1  false_delay=-1 true_size=1 false_size=1
        btfsc test_pattern_prompt__pattern__429select0__byte,test_pattern_prompt__pattern__429select0__bit
        ; if { pattern @ 3 } body start
        ;   call master_send {{ 0c'*' }}  
        movlw 42
        ; 2 instructions found for sharing
        btfss test_pattern_prompt__pattern__429select0__byte,test_pattern_prompt__pattern__429select0__bit
        ; else body start
        ;   call master_send {{ 0c'0' }}  
        movlw 48
        ; 2 instructions found for sharing
        ; if exp=` pattern @ 3 ' single true and false skip delay=4
        ; Other expression=`{ pattern @ 3 }' delay=4
        ; 2 shared instructions follow
        movwf master_send__character
        call master_send
        ; if { pattern @ 3 } end
        ;   pattern := pattern &lt;&lt; 1  
        bcf c___byte,c___bit
        rlf test_pattern_prompt__pattern,f
        decfsz test_pattern_prompt__count,f
        goto test_pattern_prompt__428_loop
test_pattern_prompt__428_done:
        ; `count_down count 4 ...' end
        ; procedure test_pattern_prompt end
        retlw 0

        ; procedure test_interrupt start
test_interrupt:
test_interrupt__variables__base equ global__variables__bank0+29
test_interrupt__bytes__base equ test_interrupt__variables__base+0
test_interrupt__bits__base equ test_interrupt__variables__base+9
test_interrupt__total__bytes equ 9
test_interrupt__504byte0 equ test_interrupt__bytes__base+8
test_interrupt__name equ test_interrupt__bytes__base+0
test_interrupt__start_pattern equ test_interrupt__bytes__base+1
test_interrupt__end_pattern equ test_interrupt__bytes__base+2
test_interrupt__set_command equ test_interrupt__bytes__base+3
        ; This procedure will test to see that an interrupt occurs .
test_interrupt__pattern equ test_interrupt__bytes__base+4
test_interrupt__temp equ test_interrupt__bytes__base+5
test_interrupt__counter1 equ test_interrupt__bytes__base+6
test_interrupt__counter2 equ test_interrupt__bytes__base+7
        ; Do the setup :
        ;   pattern := start_pattern + 1  
        incf test_interrupt__start_pattern,w
        movwf test_interrupt__pattern
        ; `while  pattern != start_pattern  ...' start
test_interrupt__454while__continue:
        movf test_interrupt__pattern,w
        subwf test_interrupt__start_pattern,w
        ; expression=` pattern != start_pattern ' exp_delay=2 true_delay=1  false_delay=2 true_size=10 false_size=1
        btfsc z___byte,z___bit
        goto test_interrupt__454while__break
        ;   call test_pattern_prompt {{ start_pattern }}  
        movf test_interrupt__start_pattern,w
        movwf test_pattern_prompt__pattern
        call test_pattern_prompt
        ;   call master_prompt {{ }}  
        call master_prompt
        ;   call slave_send {{ 0 }}  
        clrf slave_send__character
        call slave_send
        ;   pattern := slave_get {{ }}  
        call slave_get
        movf slave_get__0return__byte,w
        movwf test_interrupt__pattern
        goto test_interrupt__454while__continue
        ; if exp=` pattern != start_pattern ' false goto
        ; Other expression=` pattern != start_pattern ' delay=-1
test_interrupt__454while__break:
        ; `while  pattern != start_pattern  ...' end
        ;   call test_masks {{ }}  
        call test_masks
        ; Set the mask :
        ;   call slave_send {{ set_command | 0xf }}  
        movlw 15
        iorwf test_interrupt__set_command,w
        movwf slave_send__character
        call slave_send
        ;   call test_masks {{ }}  
        call test_masks
        ; Enable interrupt :
        ;   call slave_send {{ 0xf2 }}  
        movlw 242
        movwf slave_send__character
        call slave_send
        ; Verify that interrupt flag is off :
        ;   call slave_send {{ 0xef }}  
        movlw 239
        movwf slave_send__character
        call slave_send
        ;   temp := slave_get {{ }}  
        call slave_get
        movf slave_get__0return__byte,w
        movwf test_interrupt__temp
        ; if { temp != 2 } start
        movlw 2
        subwf test_interrupt__temp,w
        ; expression=`{ temp != 2 }' exp_delay=2 true_delay=6  false_delay=0 true_size=12 false_size=0
        btfsc z___byte,z___bit
        goto label471__0end
        ; if { temp != 2 } body start
        ;   call master_octal {{ temp }}  
        movf test_interrupt__temp,w
        movwf master_octal__number
        call master_octal
        ;   call master_fail {{ name , 0x20 }}  
        movf test_interrupt__name,w
        movwf master_fail__test_name
        movlw 32
        movwf master_fail__test_number
        call master_fail
        ; Clear the mask :
        ;   call slave_send {{ set_command }}  
        movf test_interrupt__set_command,w
        movwf slave_send__character
        call slave_send
        ;   return  
        retlw 0
        ; if { temp != 2 } body end
label471__0end:
        ; if exp=` temp != 2 ' empty false
        ; Other expression=`{ temp != 2 }' delay=-1
        ; if { temp != 2 } end
        ; Now ask the user to change the input .
        ;   call test_pattern_prompt {{ end_pattern }}  
        movf test_interrupt__end_pattern,w
        movwf test_pattern_prompt__pattern
        call test_pattern_prompt
        ; Wait for the interrupt :
        ; &lt; 255 * 255 &gt; / &lt; 3 * 2400 &gt;= 9 . 03 sec :
        ;   counter1 := 255  
        movlw 255
        movwf test_interrupt__counter1
        ; `while  counter1 != 0  ...' start
test_interrupt__487while__continue:
        movf test_interrupt__counter1,w
        ; expression=` counter1 != 0 ' exp_delay=1 true_delay=1  false_delay=2 true_size=14 false_size=1
        btfsc z___byte,z___bit
        goto test_interrupt__487while__break
        ;   counter1 := counter1 - 1  
        decf test_interrupt__counter1,f
        ;   counter2 := 255  
        movlw 255
        movwf test_interrupt__counter2
        ; `while  counter2 != 0  ...' start
test_interrupt__490while__continue:
        movf test_interrupt__counter2,w
        ; expression=` counter2 != 0 ' exp_delay=1 true_delay=1  false_delay=2 true_size=7 false_size=1
        btfsc z___byte,z___bit
        goto test_interrupt__490while__break
        ;   counter2 := counter2 - 1  
        decf test_interrupt__counter2,f
        ;   call delay {{ }}  
        call delay
        ; if { ! rx_slave_pin } start
        ; expression=`rx_slave_pin' exp_delay=0 true_delay=0  false_delay=2 true_size=0 false_size=2
        btfsc rx_slave_pin__byte,rx_slave_pin__bit
        goto label493__0end
        ; if { ! rx_slave_pin } body start
        ;   counter2 := 0  
        clrf test_interrupt__counter2
        ;   counter1 := 0  
        clrf test_interrupt__counter1
        ; if { ! rx_slave_pin } body end
label493__0end:
        ; if exp=`rx_slave_pin' empty true
        ; Other expression=`rx_slave_pin' delay=-1
        ; if { ! rx_slave_pin } end
        goto test_interrupt__490while__continue
        ; if exp=` counter2 != 0 ' false goto
        ; Other expression=` counter2 != 0 ' delay=-1
test_interrupt__490while__break:
        ; `while  counter2 != 0  ...' end
        goto test_interrupt__487while__continue
        ; if exp=` counter1 != 0 ' false goto
        ; Other expression=` counter1 != 0 ' delay=-1
test_interrupt__487while__break:
        ; `while  counter1 != 0  ...' end
        ; if { rx_slave_pin } start
        ; expression=`{ rx_slave_pin }' exp_delay=0 true_delay=-1  false_delay=-1 true_size=20 false_size=7
        btfss rx_slave_pin__byte,rx_slave_pin__bit
        goto label499__0false
label499__0true:
        ; if { rx_slave_pin } body start
        ; We timed out :
        ;   call master_fail {{ name , 0x21 }}  
        movf test_interrupt__name,w
        movwf master_fail__test_name
        movlw 33
        movwf master_fail__test_number
        call master_fail
        ; Verify that pending bit is on and enable bit gets turned off :
        ;   call slave_send {{ 0xef }}  
        movlw 239
        movwf slave_send__character
        call slave_send
        ; if { slave_get {{ }} != 1 } start
        call slave_get
        movf slave_get__0return__byte,w
        movwf test_interrupt__504byte0
        movlw 1
        subwf test_interrupt__504byte0,w
        ; expression=`{ slave_get {{ }} != 1 }' exp_delay=3 true_delay=3  false_delay=0 true_size=5 false_size=0
        btfsc z___byte,z___bit
        goto label504__1end
        ; if { slave_get {{ }} != 1 } body start
        ;   call master_fail {{ name , 0x22 }}  
        movf test_interrupt__name,w
        movwf master_fail__test_name
        movlw 34
        movwf master_fail__test_number
        call master_fail
        ; if { slave_get {{ }} != 1 } body end
label504__1end:
        ; if exp=` slave_get ## {{ }} != 1 ' empty false
        ; Other expression=`{ slave_get {{ }} != 1 }' delay=-1
        ; if { slave_get {{ }} != 1 } end
        ; if { rx_slave_pin } body end
        goto label499__0end
label499__0false:
        ; else body start
        ;   call master_string {{ name }}  
        movf test_interrupt__name,w
        movwf master_string__message
        call master_string
        ;   call master_string {{ succeed_string }}  
        movlw LOW succeed_string+1
        movwf master_string__message
        call master_string
        ;   call master_crlf {{ }}  
        call master_crlf
        ; else body end
        ; if exp=`rx_slave_pin' generic
label499__0end:
        ; Other expression=`{ rx_slave_pin }' delay=-1
        ; if { rx_slave_pin } end
        ; Clear the mask :
        ;   call slave_send {{ set_command }}  
        movf test_interrupt__set_command,w
        movwf slave_send__character
        call slave_send
        ; Clear the interrupt pending and enable mask :
        ;   call slave_send {{ 0xf0 }}  
        movlw 240
        movwf slave_send__character
        call slave_send
        ; procedure test_interrupt end
        retlw 0

        ; procedure master_prompt start
master_prompt:
master_prompt__variables__base equ global__variables__bank0+38
master_prompt__bytes__base equ master_prompt__variables__base+0
master_prompt__bits__base equ master_prompt__variables__base+1
master_prompt__total__bytes equ 1
        ;   arguments_none  
        ; This procedure will wait until the user types a character :
master_prompt__character equ master_prompt__bytes__base+0
        ;   call master_send {{ 0c'?' }}  
        movlw 63
        movwf master_send__character
        call master_send
        ;   character := master_get {{ }}  
        call master_get
        movf master_get__0return__byte,w
        movwf master_prompt__character
        ;   call master_send {{ character }}  
        movwf master_send__character
        call master_send
        ;   call master_crlf {{ }}  
        call master_crlf
        ; procedure master_prompt end
        retlw 0

        ; procedure master_get start
master_get:
master_get__variables__base equ global__variables__bank0+39
master_get__bytes__base equ master_get__variables__base+0
master_get__bits__base equ master_get__variables__base+2
master_get__total__bytes equ 2
        ;   arguments_none  
master_get__0return__byte equ master_get__bytes__base+0
        ; This procedure will wait for , receive and return the next byte
        ; from the master .
master_get__character equ master_get__bytes__base+1
        ; FIXME : should be  return get_byte &lt; rx_master_mask &gt; 
        ;   character := 0xfc  
        movlw 252
        movwf master_get__character
        ; `while  character = 0xfc  ...' start
master_get__547while__continue:
        movlw 252
        subwf master_get__character,w
        ; expression=` character = 0xfc ' exp_delay=2 true_delay=5  false_delay=2 true_size=6 false_size=1
        btfss z___byte,z___bit
        goto master_get__547while__break
        ;   character := get_byte {{ rx_master_mask }}  
        movlw 8
        movwf get_byte__mask
        call get_byte
        movf get_byte__0return__byte,w
        movwf master_get__character
        goto master_get__547while__continue
        ; if exp=` character = 0xfc ' false goto
        ; Other expression=` character = 0xfc ' delay=-1
master_get__547while__break:
        ; `while  character = 0xfc  ...' end
        ;   return character  
        movf master_get__character,w
        movwf master_get__0return__byte
        retlw 0
        ; procedure master_get end

        ; procedure master_fail start
master_fail:
master_fail__variables__base equ global__variables__bank0+41
master_fail__bytes__base equ master_fail__variables__base+0
master_fail__bits__base equ master_fail__variables__base+2
master_fail__total__bytes equ 2
master_fail__test_name equ master_fail__bytes__base+0
master_fail__test_number equ master_fail__bytes__base+1
        ; This procedure will output ` fail ' followed by a carriage return
        ; and line feed .
        ;   call master_string {{ fail_string }}  
        movlw LOW fail_string+1
        movwf master_string__message
        call master_string
        ;   call master_string {{ test_name }}  
        movf master_fail__test_name,w
        movwf master_string__message
        call master_string
        ;   call master_octal {{ test_number }}  
        movf master_fail__test_number,w
        movwf master_octal__number
        call master_octal
        ;   call master_crlf {{ }}  
        call master_crlf
        ; procedure master_fail end
        retlw 0

        ; procedure master_crlf start
master_crlf:
master_crlf__variables__base equ global__variables__bank0+43
master_crlf__bytes__base equ master_crlf__variables__base+0
master_crlf__bits__base equ master_crlf__variables__base+0
master_crlf__total__bytes equ 0
        ;   arguments_none  
        ; This procedure will output a carriage return line feed to the master .
        ;   call master_send {{ cr }}  
        movlw 13
        movwf master_send__character
        call master_send
        ;   call master_send {{ lf }}  
        movlw 10
        movwf master_send__character
        call master_send
        ; procedure master_crlf end
        retlw 0

        ; procedure master_string start
master_string:
master_string__variables__base equ global__variables__bank0+43
master_string__bytes__base equ master_string__variables__base+0
master_string__bits__base equ master_string__variables__base+3
master_string__total__bytes equ 3
master_string__message equ master_string__bytes__base+0
        ; This procedure will output &lt; message &gt; to the master .
master_string__size equ master_string__bytes__base+1
master_string__index equ master_string__bytes__base+2
        ;   index := 0  
        clrf master_string__index
        ; `count_down size  message . size  ...' start
        clrf pclath___register
        movf master_string__message,w
        call string___fetch
        movwf master_string__size
master_string__587_loop:
        ;   call master_send {{ message ~~ {{ index }} }}  
        incf master_string__index,w
        addwf master_string__message,w
        clrf pclath___register
        call string___fetch
        movwf master_send__character
        call master_send
        ;   index := index + 1  
        incf master_string__index,f
        decfsz master_string__size,f
        goto master_string__587_loop
master_string__587_done:
        ; `count_down size  message . size  ...' end
        ;   call master_send {{ sp }}  
        movlw 32
        movwf master_send__character
        call master_send
        ; procedure master_string end
        retlw 0

        ; procedure master_octal start
master_octal:
master_octal__variables__base equ global__variables__bank0+46
master_octal__bytes__base equ master_octal__variables__base+0
master_octal__bits__base equ master_octal__variables__base+2
master_octal__total__bytes equ 2
master_octal__602byte0 equ master_octal__bytes__base+1
master_octal__601byte0 equ master_octal__bytes__base+1
master_octal__number equ master_octal__bytes__base+0
        ; This procedure will output &lt; number &gt; in octal to the master .
        ; Output the character in octal :
        ;   call master_send {{ {{ number &gt;&gt; 6 }} + 0c'0' }}  
        swapf master_octal__number,w
        movwf master_octal__601byte0
        rrf master_octal__601byte0,f
        rrf master_octal__601byte0,w
        andlw 3
        addlw 48
        movwf master_send__character
        call master_send
        ;   call master_send {{ {{ {{ number &gt;&gt; 3 }} &amp; 7 }} + 0c'0' }}  
        rrf master_octal__number,w
        movwf master_octal__602byte0
        rrf master_octal__602byte0,f
        rrf master_octal__602byte0,w
        andlw 7
        addlw 48
        movwf master_send__character
        call master_send
        ;   call master_send {{ {{ number &amp; 7 }} + 0c'0' }}  
        movlw 7
        andwf master_octal__number,w
        addlw 48
        movwf master_send__character
        call master_send
        ;   call master_send {{ 32 }}  
        movlw 32
        movwf master_send__character
        call master_send
        ; procedure master_octal end
        retlw 0

        ; procedure slave_send start
slave_send:
slave_send__variables__base equ global__variables__bank0+48
slave_send__bytes__base equ slave_send__variables__base+0
slave_send__bits__base equ slave_send__variables__base+1
slave_send__total__bytes equ 1
slave_send__character equ slave_send__bytes__base+0
        ; This procedure will send &lt; character &gt; to the slave RoboBrick .
        ;   call send_byte {{ character , tx_slave_mask }}  
        movf slave_send__character,w
        movwf send_byte__char
        movlw 2
        movwf send_byte__mask
        call send_byte
        ; procedure slave_send end
        retlw 0

        ; procedure master_send start
master_send:
master_send__variables__base equ global__variables__bank0+49
master_send__bytes__base equ master_send__variables__base+0
master_send__bits__base equ master_send__variables__base+1
master_send__total__bytes equ 1
master_send__character equ master_send__bytes__base+0
        ; This procedure will send &lt; character &gt; to the master .
        ;   call send_byte {{ character , tx_master_mask }}  
        movf master_send__character,w
        movwf send_byte__char
        movlw 4
        movwf send_byte__mask
        call send_byte
        ; procedure master_send end
        retlw 0

        ; procedure slave_get start
slave_get:
slave_get__variables__base equ global__variables__bank0+50
slave_get__bytes__base equ slave_get__variables__base+0
slave_get__bits__base equ slave_get__variables__base+2
slave_get__total__bytes equ 2
        ;   arguments_none  
slave_get__0return__byte equ slave_get__bytes__base+0
        ; This procedure will wait for , receive and return the next byte
        ; from the slave
slave_get__result equ slave_get__bytes__base+1
        ; FIXME : should be  return get_byte &lt; rx_slave_mask &gt; 
        ;   result := get_byte {{ rx_slave_mask }}  
        movlw 1
        movwf get_byte__mask
        call get_byte
        movf get_byte__0return__byte,w
        movwf slave_get__result
        ;   return result  
        movwf slave_get__0return__byte
        retlw 0
        ; procedure slave_get end

        ; procedure get_byte start
get_byte:
get_byte__variables__base equ global__variables__bank0+52
get_byte__bytes__base equ get_byte__variables__base+0
get_byte__bits__base equ get_byte__variables__base+4
get_byte__total__bytes equ 4
get_byte__mask equ get_byte__bytes__base+0
get_byte__0return__byte equ get_byte__bytes__base+1
        ; Get an 8 - bit byte from &lt; mask &gt; bit of &lt; porta &gt; and return it .
        ; If no character shows up in a while 0xfc is returned .
get_byte__count equ get_byte__bytes__base+2
get_byte__char equ get_byte__bytes__base+3
        ; Wait until a start bit arrives :
        ;   receiving := 1  
        bsf receiving__byte,receiving__bit
        ;   count := 0  
        clrf get_byte__count
        ; `while  porta &amp; mask != 0  ...' start
get_byte__653while__continue:
        movf porta,w
        andwf get_byte__mask,w
        ; expression=` porta &amp; mask != 0 ' exp_delay=2 true_delay=1  false_delay=2 true_size=9 false_size=1
        btfsc z___byte,z___bit
        goto get_byte__653while__break
        ;   count := count - 1  
        decf get_byte__count,f
        ; if { count = 0 } start
        movf get_byte__count,w
        ; expression=`{ count = 0 }' exp_delay=1 true_delay=3  false_delay=0 true_size=3 false_size=0
        btfss z___byte,z___bit
        goto label655__0end
        ; if { count = 0 } body start
        ;   return 0xfc  
        movlw 252
        movwf get_byte__0return__byte
        retlw 0
        ; if { count = 0 } body end
label655__0end:
        ; if exp=` count = 0 ' empty false
        ; Other expression=`{ count = 0 }' delay=-1
        ; if { count = 0 } end
        ;   call delay {{ }}  
        call delay
        goto get_byte__653while__continue
        ; if exp=` porta &amp; mask != 0 ' false goto
        ; Other expression=` porta &amp; mask != 0 ' delay=-1
get_byte__653while__break:
        ; `while  porta &amp; mask != 0  ...' end
        ; Skip over the start bit :
        ;   call delay {{ }}  
        call delay
        ;   call delay {{ }}  
        call delay
        ;   call delay {{ }}  
        call delay
        ; Sample in the middle third of each data bit :
        ;   char := 0  
        clrf get_byte__char
        ; `count_down count 8 ...' start
        movlw 8
        movwf get_byte__count
get_byte__668_loop:
        ;   call delay {{ }}  
        call delay
        ;   char := char &gt;&gt; 1  
        bcf c___byte,c___bit
        rrf get_byte__char,f
        ; if { porta &amp; mask != 0 } start
        movf porta,w
        andwf get_byte__mask,w
        ; expression=`{ porta &amp; mask != 0 }' exp_delay=2 true_delay=2  false_delay=0 true_size=2 false_size=0
        btfsc z___byte,z___bit
        goto label671__0end
        ; if { porta &amp; mask != 0 } body start
        ;   char := char | 0x80  
        movlw 128
        iorwf get_byte__char,f
        ; if { porta &amp; mask != 0 } body end
label671__0end:
        ; if exp=` porta &amp; mask != 0 ' empty false
        ; Other expression=`{ porta &amp; mask != 0 }' delay=-1
        ; if { porta &amp; mask != 0 } end
        ;   call delay {{ }}  
        call delay
        ;   call delay {{ }}  
        call delay
        decfsz get_byte__count,f
        goto get_byte__668_loop
get_byte__668_done:
        ; `count_down count 8 ...' end
        ; Skip over 1 / 3 of the stop bit :
        ;   call delay {{ }}  
        call delay
        ;   return char  
        movf get_byte__char,w
        movwf get_byte__0return__byte
        retlw 0
        ; procedure get_byte end

        ; procedure send_byte start
send_byte:
send_byte__variables__base equ global__variables__bank0+56
send_byte__bytes__base equ send_byte__variables__base+0
send_byte__bits__base equ send_byte__variables__base+4
send_byte__total__bytes equ 4
send_byte__char equ send_byte__bytes__base+0
send_byte__mask equ send_byte__bytes__base+1
        ; Send &lt; char &gt; to &lt; mask &gt; bit of &lt; porta &gt; .
send_byte__count equ send_byte__bytes__base+2
send_byte__mark equ send_byte__bytes__base+3
        ; if { receiving } start
        ; expression=`{ receiving }' exp_delay=0 true_delay=-1  false_delay=0 true_size=3 false_size=0
        btfss receiving__byte,receiving__bit
        goto label694__0end
        ; if { receiving } body start
        ;   receiving := 1  
        bsf receiving__byte,receiving__bit
        ;   call delay {{ }}  
        call delay
        ;   call delay {{ }}  
        call delay
        ; if { receiving } body end
label694__0end:
        ; if exp=`receiving' empty false
        ; Other expression=`{ receiving }' delay=-1
        ; if { receiving } end
        ; Send the start bit :
        ;   mark := mask ^ space  
        movlw 255
        xorwf send_byte__mask,w
        movwf send_byte__mark
        ;   porta := mark  
        movwf porta
        ;   call delay {{ }}  
        call delay
        ;   call delay {{ }}  
        call delay
        ;   call delay {{ }}  
        call delay
        ; Send the data :
        ; `count_down count 8 ...' start
        movlw 8
        movwf send_byte__count
send_byte__708_loop:
        ; if { char @ 0 } start
        ; Alias variable for select char @ 0
send_byte__char__709select0 equ send_byte__char+0
send_byte__char__709select0__byte equ send_byte__char+0
send_byte__char__709select0__bit equ 0
        ; expression=`{ char @ 0 }' exp_delay=0 true_delay=1  false_delay=1 true_size=1 false_size=1
        btfsc send_byte__char__709select0__byte,send_byte__char__709select0__bit
        ; if { char @ 0 } body start
        ;   porta := space  
        movlw 255
        ; 1 instructions found for sharing
        btfss send_byte__char__709select0__byte,send_byte__char__709select0__bit
        ; else body start
        ;   porta := mark  
        movf send_byte__mark,w
        ; 1 instructions found for sharing
        ; if exp=` char @ 0 ' single true and false skip delay=4
        ; Other expression=`{ char @ 0 }' delay=4
        ; 1 shared instructions follow
        movwf porta
        ; if { char @ 0 } end
        ;   char := char &gt;&gt; 1  
        bcf c___byte,c___bit
        rrf send_byte__char,f
        ;   call delay {{ }}  
        call delay
        ;   call delay {{ }}  
        call delay
        ;   call delay {{ }}  
        call delay
        decfsz send_byte__count,f
        goto send_byte__708_loop
send_byte__708_done:
        ; `count_down count 8 ...' end
        ; Send the stop bit :
        ;   porta := space  
        movlw 255
        movwf porta
        ;   call delay {{ }}  
        call delay
        ;   call delay {{ }}  
        call delay
        ;   call delay {{ }}  
        call delay
        ; procedure send_byte end
        retlw 0

        ; procedure delay start
        ; optimize 0
delay:
delay__variables__base equ global__variables__bank0+60
delay__bytes__base equ delay__variables__base+0
delay__bits__base equ delay__variables__base+1
delay__total__bytes equ 1
delay__727byte1 equ delay__bytes__base+0
        ;   arguments_none  
        ;   uniform_delay instructions_per_delay  
        ; Uniform delay remaining = 134 Accumulated Delay = 0
        ; Uniform delay remaining = 134 Accumulated Delay = 0
        ; This procedure will delay for 1 / 3 of a bit time .
        ; Uniform delay remaining = 134 Accumulated Delay = 0
        ; Uniform delay remaining = 134 Accumulated Delay = 0
        ; Soak up remaining 134 cycles
        ; Delay 134 cycles
        movlw 44
        movwf delay__727byte1
delay__727delay0:
        decfsz delay__727byte1,f
        goto delay__727delay0
        nop
        ; procedure delay end
        retlw 0
        ; optimize 1

        ; Register bank 0 used 61 bytes of 68 available bytes
        ; Register bank 1 used 0 bytes of 0 available bytes

        end

</pre></body></html>