<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 67
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 LED10 RoboBrick . See :}
        ; comment {}
        ; comment {http : / / web . gramlich . net / projects / robobricks / led10 / 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
        ; comment {The null pulse that comes back from a clock pulse command is supposed to be}
        ; comment {9 bits long . At 4 Mhz = 1 instruction per microsecond , 9 bits is 9 / 2400 =}
        ; comment {3 . 75 ms . The count loop below is 7 instruction long . 3 . 75 / . 007 = 536 = 0x217 .}
        ; comment {So we want our timer loop to get as close to 0x217 as possible .}
        ;   constant clock_fudge 4  
clock_fudge equ 4
        ;   constant clock_target 0x17 + clock_fudge  
clock_target equ 27
        ;   constant sp 32  
sp equ 32
        ;   constant cr 13  
cr equ 13
        ;   constant lf 10  
lf equ 10
        ; 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
status equ 3
        ;   bind c status @ 0  
c equ status+0
c__byte equ status+0
c__bit equ 0
        ;   bind z status @ 2  
z equ status+0
z__byte equ status+0
z__bit equ 2
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
        ;   constant space 0xff  
space equ 255
        ;   constant buffer_size 5  
buffer_size equ 5
        ; string_constants Start
string___fetch:
        movwf pcl___register
        ;   bit_string = 0s'Bit'  
bit_string___string equ 0
bit_string:
        addwf pcl___register,f
        ; Length = 3
        retlw 3
        ; `Bit'
        retlw 66
        retlw 105
        retlw 116
        ;   blink_string = 0s'Blink'  
blink_string___string equ 5
blink_string:
        addwf pcl___register,f
        ; Length = 5
        retlw 5
        ; `Blink'
        retlw 66
        retlw 108
        retlw 105
        retlw 110
        retlw 107
        ;   clock_string = 0s'Clk'  
clock_string___string equ 12
clock_string:
        addwf pcl___register,f
        ; Length = 3
        retlw 3
        ; `Clk'
        retlw 67
        retlw 108
        retlw 107
        ;   common_string = 0s'Common'  
common_string___string equ 17
common_string:
        addwf pcl___register,f
        ; Length = 6
        retlw 6
        ; `Common'
        retlw 67
        retlw 111
        retlw 109
        retlw 109
        retlw 111
        retlw 110
        ;   done_string = 0s'Done'  
done_string___string equ 25
done_string:
        addwf pcl___register,f
        ; Length = 4
        retlw 4
        ; `Done'
        retlw 68
        retlw 111
        retlw 110
        retlw 101
        ;   fail_string = 0s'Fail'  
fail_string___string equ 31
fail_string:
        addwf pcl___register,f
        ; Length = 4
        retlw 4
        ; `Fail'
        retlw 70
        retlw 97
        retlw 105
        retlw 108
        ;   hello_string = 0s'LED4_Test'  
hello_string___string equ 37
hello_string:
        addwf pcl___register,f
        ; Length = 9
        retlw 9
        ; `LED4_Test'
        retlw 76
        retlw 69
        retlw 68
        retlw 52
        retlw 95
        retlw 84
        retlw 101
        retlw 115
        retlw 116
        ;   ramps = 0 , 1 , 0x10 , 0x80 , 0xff  
ramps___string equ 48
ramps:
        addwf pcl___register,f
        ; Length = 5
        retlw 5
        ; 0
        retlw 0
        ; 1
        retlw 1
        ; 0x10
        retlw 16
        ; 0x80
        retlw 128
        ; 0xff
        retlw 255
        ;   read_string = 0s'Read'  
read_string___string equ 55
read_string:
        addwf pcl___register,f
        ; Length = 4
        retlw 4
        ; `Read'
        retlw 82
        retlw 101
        retlw 97
        retlw 100
        ;   register_string = 0s'Reg'  
register_string___string equ 61
register_string:
        addwf pcl___register,f
        ; Length = 3
        retlw 3
        ; `Reg'
        retlw 82
        retlw 101
        retlw 103
        ; 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+10
main__total__bytes equ 10
main__108byte0 equ main__bytes__base+9
main__136byte0 equ main__bytes__base+9
        ;   arguments_none  
        ; Read a byte .
main__buffer equ main__bytes__base+0
main__char equ main__bytes__base+5
main__count equ main__bytes__base+6
main__index equ main__bytes__base+7
main__number equ main__bytes__base+8
        ; Print out a welcome message :
        ;   call master_crlf {{ }}  
        call master_crlf
        ;   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
        ;   number := 0  
        clrf main__number
        ; loop_forever ... start
main__96loop__forever:
        ; Get a character :
        ;   tx_slave_pin := 1  
        bsf tx_slave_pin__byte,tx_slave_pin__bit
        ;   char := master_get {{ }}  
        call master_get
        movf master_get__0return__byte,w
        movwf main__char
        ; Delay 2 / 3 ' s of bit make sure that get_byte is done .
        ;   call delay {{ }}  
        call delay
        ;   call delay {{ }}  
        call delay
        ; if { 0c'0' &lt;= char &amp;&amp; char &lt; {{ 0c'9' + 1 }} } start
        movlw 48
        subwf main__char,w
        ; expression=`0c'0' &lt;= char' exp_delay=2 true_delay=-1  false_delay=1 true_size=127 false_size=1
        btfss c___byte,c___bit
        goto and105__0false
        movlw 58
        subwf main__char,w
        ; expression=`char &lt; {{ 0c'9' + 1 }}' exp_delay=2 true_delay=9  false_delay=-1 true_size=11 false_size=111
        btfsc c___byte,c___bit
        goto label105__1false
label105__1true:
and105__0true:
        ; if { 0c'0' &lt;= char &amp;&amp; char &lt; {{ 0c'9' + 1 }} } body start
        ; Do a multiply by 8 then add in digit :
        ;   call master_send {{ char }}  
        movf main__char,w
        movwf master_send__character
        call master_send
        ;   number := {{ number &lt;&lt; 3 }} + char - 0c'0'  
        rlf main__number,w
        movwf main__108byte0
        rlf main__108byte0,f
        rlf main__108byte0,w
        andlw 248
        addwf main__char,w
        addlw 208
        movwf main__number
        ; if { 0c'0' &lt;= char &amp;&amp; char &lt; {{ 0c'9' + 1 }} } body end
        goto label105__1end
label105__1false:
and105__0false:
        movlw 115
        subwf main__char,w
        ; expression=`{ char = 0c's' }' exp_delay=2 true_delay=-1  false_delay=-1 true_size=8 false_size=98
        btfss z___byte,z___bit
        goto label109__0false
label109__0true:
        ; else_if { char = 0c's' } body start
        ; Send byte to brick , no wait :
        ; Echo command and send CRLF :
        ;   call master_send {{ char }}  
        movf main__char,w
        movwf master_send__character
        call master_send
        ;   call master_crlf {{ }}  
        call master_crlf
        ; Ship the byte down to the brick :
        ;   call slave_send {{ number }}  
        movf main__number,w
        movwf slave_send__data
        call slave_send
        ;   number := 0  
        clrf main__number
        ; else_if { char = 0c's' } body end
        goto label109__0end
label109__0false:
        movlw 119
        subwf main__char,w
        ; expression=`{ char = 0c'w' }' exp_delay=2 true_delay=-1  false_delay=-1 true_size=37 false_size=56
        btfss z___byte,z___bit
        goto label120__0false
label120__0true:
        ; else_if { char = 0c'w' } body start
        ; Send byte to brick , wait for results :
        ; Echo command and send CRLF :
        ;   call master_send {{ char }}  
        movf main__char,w
        movwf master_send__character
        call master_send
        ;   call master_crlf {{ }}  
        call master_crlf
        ; Ship the byte down to the brick ...
        ;   call slave_send {{ number }}  
        movf main__number,w
        movwf slave_send__data
        call slave_send
        ;   number := 0  
        clrf main__number
        ; call delay &lt; &gt;
        ; ... and wait for a response :
        ;   index := 0  
        clrf main__index
        ; `while  index &lt; buffer_size  ...' start
main__135while__continue:
        movlw 5
        subwf main__index,w
        ; expression=` index &lt; buffer_size ' exp_delay=2 true_delay=9  false_delay=2 true_size=10 false_size=1
        btfsc c___byte,c___bit
        goto main__135while__break
        ;   buffer ~~ {{ index }} := slave_get {{ }}  
        call slave_get
        movf slave_get__0return__byte,w
        movwf main__136byte0
        movlw LOW main__buffer
        addwf main__index,w
        movwf fsr___register
        movf main__136byte0,w
        movwf indf___register
        ;   index := index + 1  
        incf main__index,f
        goto main__135while__continue
        ; if exp=` index &lt; buffer_size ' false goto
        ; Other expression=` index &lt; buffer_size ' delay=-1
main__135while__break:
        ; `while  index &lt; buffer_size  ...' end
        ;   index := 0  
        clrf main__index
        ; `while  index &lt; buffer_size  ...' start
main__141while__continue:
        movlw 5
        subwf main__index,w
        ; expression=` index &lt; buffer_size ' exp_delay=2 true_delay=7  false_delay=2 true_size=8 false_size=1
        btfsc c___byte,c___bit
        goto main__141while__break
        ;   call master_octal {{ buffer ~~ {{ index }} }}  
        movlw LOW main__buffer
        addwf main__index,w
        movwf fsr___register
        movf indf___register,w
        movwf master_octal__number
        call master_octal
        ;   index := index + 1  
        incf main__index,f
        goto main__141while__continue
        ; if exp=` index &lt; buffer_size ' false goto
        ; Other expression=` index &lt; buffer_size ' delay=-1
main__141while__break:
        ; `while  index &lt; buffer_size  ...' end
        ; Terminate the output list
        ;   call master_crlf {{ }}  
        call master_crlf
        ; else_if { char = 0c'w' } body end
        goto label120__0end
label120__0false:
        movlw 105
        subwf main__char,w
        ; expression=`{ char = 0c'i' }' exp_delay=2 true_delay=-1  false_delay=-1 true_size=12 false_size=39
        btfss z___byte,z___bit
        goto label148__0false
label148__0true:
        ; else_if { char = 0c'i' } body start
        ; Interrogate the slave RoboBrick :
        ;   call master_send {{ char }}  
        movf main__char,w
        movwf master_send__character
        call master_send
        ;   call master_crlf {{ }}  
        call master_crlf
        ; Initialize the id index :
        ;   call slave_send {{ 0xfd }}  
        movlw 253
        movwf slave_send__data
        call slave_send
        ; Get the first 8 bytes :
        ;   call common_test_id_bytes8 {{ }}  
        call common_test_id_bytes8
        ; Get the next 8 bytes of random numbers :
        ;   call common_test_id_bytes8 {{ }}  
        call common_test_id_bytes8
        ; Get the next 8 bytes of random numbers :
        ;   call common_test_id_bytes8 {{ }}  
        call common_test_id_bytes8
        ; Get the slave brick name :
        ;   call common_test_id_string {{ }}  
        call common_test_id_string
        ; Get the vendor name :
        ;   call common_test_id_string {{ }}  
        call common_test_id_string
        ; else_if { char = 0c'i' } body end
        goto label148__0end
label148__0false:
        movlw 116
        subwf main__char,w
        ; expression=`{ char = 0c't' }' exp_delay=2 true_delay=-1  false_delay=-1 true_size=5 false_size=29
        btfss z___byte,z___bit
        goto label171__0false
label171__0true:
        ; else_if { char = 0c't' } body start
        ; Do testing :
        ;   call master_send {{ char }}  
        movf main__char,w
        movwf master_send__character
        call master_send
        ;   call master_crlf {{ }}  
        call master_crlf
        ;   call test {{ }}  
        call test
        ; else_if { char = 0c't' } body end
        goto label171__0end
label171__0false:
        movlw 99
        subwf main__char,w
        ; expression=`{ char = 0c'c' }' exp_delay=2 true_delay=-1  false_delay=-1 true_size=5 false_size=19
        btfss z___byte,z___bit
        goto label176__0false
label176__0true:
        ; else_if { char = 0c'c' } body start
        ;   call master_send {{ char }}  
        movf main__char,w
        movwf master_send__character
        call master_send
        ;   call master_crlf {{ }}  
        call master_crlf
        ;   call clock_adjust {{ }}  
        call clock_adjust
        ; else_if { char = 0c'c' } body end
        goto label176__0end
label176__0false:
        movlw 252
        subwf main__char,w
        ; expression=`{ char != 0xfc }' exp_delay=2 true_delay=-1  false_delay=0 true_size=15 false_size=0
        btfsc z___byte,z___bit
        goto label181__0end
        ; else_if { char != 0xfc } body start
        ; Just echo back the current number :
        ;   call master_send {{ 0c'&lt;' }}  
        movlw 60
        movwf master_send__character
        call master_send
        ;   call master_octal {{ char }}  
        movf main__char,w
        movwf master_octal__number
        call master_octal
        ;   call master_send {{ 0c'&gt;' }}  
        movlw 62
        movwf master_send__character
        call master_send
        ; Send a carriage - return line - feed :
        ;   call master_crlf {{ }}  
        call master_crlf
        ; Output the character in octal :
        ;   call master_octal {{ number }}  
        movf main__number,w
        movwf master_octal__number
        call master_octal
        ; Send a carriage - return line - feed :
        ;   call master_crlf {{ }}  
        call master_crlf
        ; Reset number
        ;   number := 0  
        clrf main__number
        ; else_if { char != 0xfc } body end
label181__0end:
        ; if exp=` char != 0xfc ' empty false
        ; Other expression=`{ char != 0xfc }' delay=-1
        ; if exp=` char = 0c'c' ' generic
label176__0end:
        ; Other expression=`{ char = 0c'c' }' delay=-1
        ; if exp=` char = 0c't' ' generic
label171__0end:
        ; Other expression=`{ char = 0c't' }' delay=-1
        ; if exp=` char = 0c'i' ' generic
label148__0end:
        ; Other expression=`{ char = 0c'i' }' delay=-1
        ; if exp=` char = 0c'w' ' generic
label120__0end:
        ; Other expression=`{ char = 0c'w' }' delay=-1
        ; if exp=` char = 0c's' ' generic
label109__0end:
        ; Other expression=`{ char = 0c's' }' delay=-1
        ; if exp=`char &lt; {{ 0c'9' + 1 }}' generic
label105__1end:
        ; Other expression=`char &lt; {{ 0c'9' + 1 }}' delay=-1
        ; if exp=`0c'0' &lt;= char' false goto
        ; Other expression=`0c'0' &lt;= char' delay=-1
and105__0end:
        ; if { 0c'0' &lt;= char &amp;&amp; char &lt; {{ 0c'9' + 1 }} } end
        goto main__96loop__forever
        ; loop_forever ... end
        ; procedure main end

        ; procedure clock_adjust start
clock_adjust:
clock_adjust__variables__base equ global__variables__bank0+10
clock_adjust__bytes__base equ clock_adjust__variables__base+0
clock_adjust__bits__base equ clock_adjust__variables__base+7
clock_adjust__total__bytes equ 7
clock_adjust__266byte0 equ clock_adjust__bytes__base+6
        ;   arguments_none  
        ; This procedure will adjust the clock to the slave .
clock_adjust__command equ clock_adjust__bytes__base+0
clock_adjust__count equ clock_adjust__bytes__base+1
clock_adjust__error equ clock_adjust__bytes__base+2
clock_adjust__error_minimum equ clock_adjust__bytes__base+3
clock_adjust__high equ clock_adjust__bytes__base+4
clock_adjust__low equ clock_adjust__bytes__base+5
        ;   call master_string {{ clock_string }}  
        movlw LOW clock_string+1
        movwf master_string__message
        call master_string
        ;   call master_crlf {{ }}  
        call master_crlf
        ;   count := 4  
        movlw 4
        movwf clock_adjust__count
        ;   error := 0xff  
        movlw 255
        movwf clock_adjust__error
        ;   error_minimum := 0xf0  
        movlw 240
        movwf clock_adjust__error_minimum
        ; loop_forever ... start
clock_adjust__221loop__forever:
        ; Print out the clock value :
        ;   call master_send {{ 0c'C' }}  
        movlw 67
        movwf master_send__character
        call master_send
        ;   call slave_send {{ 0xfa }}  
        movlw 250
        movwf slave_send__data
        call slave_send
        ;   call master_octal {{ slave_get {{ }} }}  
        call slave_get
        movf slave_get__0return__byte,w
        movwf master_octal__number
        call master_octal
        ; Ask for a timing byte :
        ;   call slave_send {{ 0xfb }}  
        movlw 251
        movwf slave_send__data
        call slave_send
        ;   low := 0  
        clrf clock_adjust__low
        ;   high := 0  
        clrf clock_adjust__high
        ; `while rx_slave_pin ...' start
clock_adjust__232while__continue:
        ; expression=`rx_slave_pin' exp_delay=0 true_delay=2  false_delay=2 true_size=1 false_size=1
        btfsc rx_slave_pin__byte,rx_slave_pin__bit
        ; Do nothing :
        goto clock_adjust__232while__continue
        goto clock_adjust__232while__break
        ; if exp=`rx_slave_pin' true goto small true
clock_adjust__232while__break:
        ; `while rx_slave_pin ...' end
        ; `while  ! rx_slave_pin  ...' start
clock_adjust__235while__continue:
        ; expression=`rx_slave_pin' exp_delay=0 true_delay=2  false_delay=5 true_size=1 false_size=4
        btfsc rx_slave_pin__byte,rx_slave_pin__bit
        goto clock_adjust__235while__break
        ;   low := low + 1  
        incf clock_adjust__low,f
        ; if { z } start
        ; expression=`{ z }' exp_delay=0 true_delay=1  false_delay=0 true_size=1 false_size=0
        btfsc z__byte,z__bit
        ; if { z } body start
        ;   high := high + 1  
        incf clock_adjust__high,f
        ; if { z } body end
        ; if exp=`z' false skip delay=2
        ; Other expression=`{ z }' delay=2
        ; if { z } end
        goto clock_adjust__235while__continue
        ; if exp=`rx_slave_pin' true goto
        ; Other expression=`rx_slave_pin' delay=-1
clock_adjust__235while__break:
        ; `while  ! rx_slave_pin  ...' end
        ; Print out high and low :
        ;   call master_send {{ 0c'H' }}  
        movlw 72
        movwf master_send__character
        call master_send
        ;   call master_octal {{ high }}  
        movf clock_adjust__high,w
        movwf master_octal__number
        call master_octal
        ;   call master_send {{ 0c'L' }}  
        movlw 76
        movwf master_send__character
        call master_send
        ;   call master_octal {{ low }}  
        movf clock_adjust__low,w
        movwf master_octal__number
        call master_octal
        ; If high is less than 2 , things are probably pretty broken .
        ; We ' ll try a little fix here , but we are probably pretty
        ; screwed up .
        ; if { high &lt; 2 } start
        movlw 2
        subwf clock_adjust__high,w
        ; expression=`{ high &lt; 2 }' exp_delay=2 true_delay=1  false_delay=0 true_size=1 false_size=0
        btfss c___byte,c___bit
        ; if { high &lt; 2 } body start
        ;   low := 0  
        clrf clock_adjust__low
        ; if { high &lt; 2 } body end
        ; if exp=` high &lt; 2 ' false skip delay=4
        ; Other expression=`{ high &lt; 2 }' delay=4
        ; if { high &lt; 2 } end
        ; Now think about adjusting clock .
        ; if { low &gt; clock_target } start
        movlw 28
        subwf clock_adjust__low,w
        ; expression=`{ low &gt; clock_target }' exp_delay=2 true_delay=5  false_delay=-1 true_size=5 false_size=15
        btfsc c___byte,c___bit
        goto label256__0true
label256__0false:
        movlw 27
        subwf clock_adjust__low,w
        ; expression=`{ low &lt; clock_target }' exp_delay=2 true_delay=7  false_delay=3 true_size=7 false_size=3
        btfss c___byte,c___bit
        goto label263__0true
label263__0false:
        ; else body start
        ; call master_send &lt; 0c'x' &gt;
        ;   command := 0  
        clrf clock_adjust__command
        ;   error := 0  
        clrf clock_adjust__error
        ;   error_minimum := 0  
        clrf clock_adjust__error_minimum
        ; else body end
        goto label263__0end
label263__0true:
        ; else_if { low &lt; clock_target } body start
        ; call master_send &lt; 0c'-' &gt;
        ; Slave clock is too fast &lt; i . e . pulse too short . &gt;
        ;   error := clock_target - low  
        movlw 27
        movwf clock_adjust__266byte0
        movf clock_adjust__low,w
        subwf clock_adjust__266byte0,w
        movwf clock_adjust__error
        ; Decrement clock :
        ;   command := 0xf8  
        movlw 248
        movwf clock_adjust__command
        ; call slave_send &lt; 0xf8 &gt;
        ; else_if { low &lt; clock_target } body end
        ; if exp=` low &lt; clock_target ' generic
label263__0end:
        ; Other expression=`{ low &lt; clock_target }' delay=-1
        goto label256__0end
label256__0true:
        ; if { low &gt; clock_target } body start
        ; call master_send &lt; 0c'+' &gt;
        ; Slave clock is too slow &lt; i . e . pulse too long . &gt;
        ;   error := low - clock_target  
        movlw 229
        addwf clock_adjust__low,w
        movwf clock_adjust__error
        ; Increment clock :
        ;   command := 0xf9  
        movlw 249
        movwf clock_adjust__command
        ; call slave_send &lt; 0xf9 &gt;
        ; if { low &gt; clock_target } body end
        ; if exp=` low &gt; clock_target ' generic
label256__0end:
        ; Other expression=`{ low &gt; clock_target }' delay=-1
        ; if { low &gt; clock_target } end
        ; Print out the error and error minimum :
        ;   call master_send {{ 0c'E' }}  
        movlw 69
        movwf master_send__character
        call master_send
        ;   call master_octal {{ error }}  
        movf clock_adjust__error,w
        movwf master_octal__number
        call master_octal
        ;   call master_send {{ 0c'M' }}  
        movlw 77
        movwf master_send__character
        call master_send
        ;   call master_octal {{ error_minimum }}  
        movf clock_adjust__error_minimum,w
        movwf master_octal__number
        call master_octal
        ; if { error = error_minimum } start
        movf clock_adjust__error,w
        subwf clock_adjust__error_minimum,w
        ; expression=`{ error = error_minimum }' exp_delay=2 true_delay=-1  false_delay=-1 true_size=2 false_size=14
        btfss z___byte,z___bit
        goto label283__0false
label283__0true:
        ; if { error = error_minimum } body start
        ;   call master_crlf {{ }}  
        call master_crlf
        ;   return  
        retlw 0
        ; if { error = error_minimum } body end
        goto label283__0end
label283__0false:
        movf clock_adjust__error_minimum,w
        subwf clock_adjust__error,w
        ; expression=`{ error &lt; error_minimum }' exp_delay=2 true_delay=3  false_delay=-1 true_size=3 false_size=6
        btfss c___byte,c___bit
        goto label286__0true
label286__0false:
        ; else body start
        ;   count := count - 1  
        decf clock_adjust__count,f
        ; if { z } start
        ; expression=`{ z }' exp_delay=0 true_delay=3  false_delay=0 true_size=3 false_size=0
        btfss z__byte,z__bit
        goto label291__0end
        ; if { z } body start
        ;   error_minimum := error_minimum + 1  
        incf clock_adjust__error_minimum,f
        ;   count := 4  
        movlw 4
        movwf clock_adjust__count
        ; if { z } body end
label291__0end:
        ; if exp=`z' empty false
        ; Other expression=`{ z }' delay=-1
        ; if { z } end
        ; else body end
        goto label286__0end
label286__0true:
        ; else_if { error &lt; error_minimum } body start
        ;   error_minimum := error  
        movf clock_adjust__error,w
        movwf clock_adjust__error_minimum
        ;   error := error + 1  
        incf clock_adjust__error,f
        ; else_if { error &lt; error_minimum } body end
        ; if exp=` error &lt; error_minimum ' generic
label286__0end:
        ; Other expression=`{ error &lt; error_minimum }' delay=-1
        ; if exp=` error = error_minimum ' generic
label283__0end:
        ; Other expression=`{ error = error_minimum }' delay=-1
        ; if { error = error_minimum } end
        ; Now adjust the clock :
        ;   call slave_send {{ command }}  
        movf clock_adjust__command,w
        movwf slave_send__data
        call slave_send
        ;   call master_crlf {{ }}  
        call master_crlf
        goto clock_adjust__221loop__forever
        ; loop_forever ... end
        ; procedure clock_adjust end

        ; procedure test start
test:
test__variables__base equ global__variables__bank0+17
test__bytes__base equ test__variables__base+0
test__bits__base equ test__variables__base+5
test__total__bytes equ 5
test__390byte0 equ test__bytes__base+4
        ;   arguments_none  
        ; This procedure will test the LED10 RoboBrick :
test__bit equ test__bytes__base+0
test__leds equ test__bytes__base+1
test__temp equ test__bytes__base+2
test__pattern equ test__bytes__base+3
        ; Adjust the clock :
        ;   call clock_adjust {{ }}  
        call clock_adjust
        ; Verify that the common commands are working :
        ;   call common_test {{ }}  
        call common_test
        ; Clear the LEDS :
        ;   call slave_send {{ 0 }}  
        clrf slave_send__data
        call slave_send
        ;   call test_prompt {{ 0 }}  
        clrf test_prompt__leds
        call test_prompt
        ; Let ' s do some simple testing first :
        ;   leds := 1  
        movlw 1
        movwf test__leds
        ; `while  ! {{ leds @ 4 }}  ...' start
test__327while__continue:
        ; Alias variable for select leds @ 4
test__leds__327select0 equ test__leds+0
test__leds__327select0__byte equ test__leds+0
test__leds__327select0__bit equ 4
        ; expression=`{{ leds @ 4 }}' exp_delay=0 true_delay=2  false_delay=7 true_size=1 false_size=12
        btfsc test__leds__327select0__byte,test__leds__327select0__bit
        goto test__327while__break
        ; Set the bits :
        ;   call slave_send {{ leds }}  
        movf test__leds,w
        movwf slave_send__data
        call slave_send
        ;   call test_prompt {{ leds }}  
        movf test__leds,w
        movwf test_prompt__leds
        call test_prompt
        ;   call test_verify {{ leds }}  
        movf test__leds,w
        movwf test_verify__leds
        call test_verify
        ;   leds := leds &lt;&lt; 1  
        bcf c___byte,c___bit
        rlf test__leds,f
        goto test__327while__continue
        ; if exp=` leds @ 4 ' true goto
        ; Other expression=`{{ leds @ 4 }}' delay=-1
test__327while__break:
        ; `while  ! {{ leds @ 4 }}  ...' end
        ; Clear the leds :
        ;   call slave_send {{ 0 }}  
        clrf slave_send__data
        call slave_send
        ; Let ' s test out the bit twiddle commands :
        ;   call master_string {{ bit_string }}  
        movlw LOW bit_string+1
        movwf master_string__message
        call master_string
        ;   call master_crlf {{ }}  
        call master_crlf
        ;   bit := 0  
        clrf test__bit
        ;   leds := 1  
        movlw 1
        movwf test__leds
        ; `while  bit &lt; 4  ...' start
test__343while__continue:
        movlw 4
        subwf test__bit,w
        ; expression=` bit &lt; 4 ' exp_delay=2 true_delay=1  false_delay=2 true_size=72 false_size=1
        btfsc c___byte,c___bit
        goto test__343while__break
        ; Bit set :
        ;   call slave_send {{ 0x14 | bit }}  
        movlw 20
        iorwf test__bit,w
        movwf slave_send__data
        call slave_send
        ;   call test_verify {{ leds }}  
        movf test__leds,w
        movwf test_verify__leds
        call test_verify
        ; Read the bit :
        ;   call slave_send {{ 0x1c | bit }}  
        movlw 28
        iorwf test__bit,w
        movwf slave_send__data
        call slave_send
        ;   temp := slave_get {{ }}  
        call slave_get
        movf slave_get__0return__byte,w
        movwf test__temp
        ; if { temp != 1 } start
        decf test__temp,w
        ; expression=`{ temp != 1 }' exp_delay=1 true_delay=5  false_delay=0 true_size=11 false_size=0
        btfsc z___byte,z___bit
        goto label351__0end
        ; if { temp != 1 } body start
        ;   call master_octal {{ bit }}  
        movf test__bit,w
        movwf master_octal__number
        call master_octal
        ;   call master_octal {{ temp }}  
        movf test__temp,w
        movwf master_octal__number
        call master_octal
        ;   call master_fail {{ bit_string , 0x30 }}  
        movlw LOW bit_string+1
        movwf master_fail__test_name
        movlw 48
        movwf master_fail__test_number
        call master_fail
        ; if { temp != 1 } body end
label351__0end:
        ; if exp=` temp != 1 ' empty false
        ; Other expression=`{ temp != 1 }' delay=-1
        ; if { temp != 1 } end
        ; Bit clear :
        ;   call slave_send {{ 0x10 | bit }}  
        movlw 16
        iorwf test__bit,w
        movwf slave_send__data
        call slave_send
        ;   call test_verify {{ 0 }}  
        clrf test_verify__leds
        call test_verify
        ; Read the bit again :
        ;   call slave_send {{ 0x1c | bit }}  
        movlw 28
        iorwf test__bit,w
        movwf slave_send__data
        call slave_send
        ;   temp := slave_get {{ }}  
        call slave_get
        movf slave_get__0return__byte,w
        movwf test__temp
        ; if { temp != 0 } start
        ; expression=`{ temp != 0 }' exp_delay=1 true_delay=5  false_delay=0 true_size=11 false_size=0
        btfsc z___byte,z___bit
        goto label364__0end
        ; if { temp != 0 } body start
        ;   call master_octal {{ bit }}  
        movf test__bit,w
        movwf master_octal__number
        call master_octal
        ;   call master_octal {{ temp }}  
        movf test__temp,w
        movwf master_octal__number
        call master_octal
        ;   call master_fail {{ bit_string , 0x31 }}  
        movlw LOW bit_string+1
        movwf master_fail__test_name
        movlw 49
        movwf master_fail__test_number
        call master_fail
        ; if { temp != 0 } body end
label364__0end:
        ; if exp=` temp != 0 ' empty false
        ; Other expression=`{ temp != 0 }' delay=-1
        ; if { temp != 0 } end
        ; Bit toggle :
        ;   call slave_send {{ 0x18 | bit }}  
        movlw 24
        iorwf test__bit,w
        movwf slave_send__data
        call slave_send
        ;   call test_verify {{ leds }}  
        movf test__leds,w
        movwf test_verify__leds
        call test_verify
        ; Bit toggle again :
        ;   call slave_send {{ 0x18 | bit }}  
        movlw 24
        iorwf test__bit,w
        movwf slave_send__data
        call slave_send
        ;   call test_verify {{ 0 }}  
        clrf test_verify__leds
        call test_verify
        ;   leds := leds &lt;&lt; 1  
        bcf c___byte,c___bit
        rlf test__leds,f
        ;   bit := bit + 1  
        incf test__bit,f
        goto test__343while__continue
        ; if exp=` bit &lt; 4 ' false goto
        ; Other expression=` bit &lt; 4 ' delay=-1
test__343while__break:
        ; `while  bit &lt; 4  ...' end
        ; Now do some blink rate tests :
        ;   call master_string {{ blink_string }}  
        movlw LOW blink_string+1
        movwf master_string__message
        call master_string
        ;   call master_crlf {{ }}  
        call master_crlf
        ; First turn the bits on :
        ;   call slave_send {{ 0xf }}  
        movlw 15
        movwf slave_send__data
        call slave_send
        ;   bit := 0  
        clrf test__bit
        ; `while  bit &lt; 4  ...' start
test__388while__continue:
        movlw 4
        subwf test__bit,w
        ; expression=` bit &lt; 4 ' exp_delay=2 true_delay=1  false_delay=2 true_size=36 false_size=1
        btfsc c___byte,c___bit
        goto test__388while__break
        ; Set the blink rate :
        ;   call slave_send {{ 0x30 | {{ bit &lt;&lt; 2 }} | bit }}  
        rlf test__bit,w
        movwf test__390byte0
        rlf test__390byte0,w
        andlw 252
        iorwf test__bit,w
        iorlw 48
        movwf slave_send__data
        call slave_send
        ; Read the blink rate back :
        ;   call slave_send {{ 0x1c | bit }}  
        movlw 28
        iorwf test__bit,w
        movwf slave_send__data
        call slave_send
        ;   temp := slave_get {{ }}  
        call slave_get
        movf slave_get__0return__byte,w
        movwf test__temp
        ;   pattern := {{ bit &lt;&lt; 1 }} | 9  
        bcf c___byte,c___bit
        rlf test__bit,w
        iorlw 9
        movwf test__pattern
        ; if { temp != pattern } start
        movf test__temp,w
        subwf test__pattern,w
        ; expression=`{ temp != pattern }' exp_delay=2 true_delay=5  false_delay=0 true_size=11 false_size=0
        btfsc z___byte,z___bit
        goto label396__0end
        ; if { temp != pattern } body start
        ;   call master_octal {{ temp }}  
        movf test__temp,w
        movwf master_octal__number
        call master_octal
        ;   call master_octal {{ pattern }}  
        movf test__pattern,w
        movwf master_octal__number
        call master_octal
        ;   call master_fail {{ blink_string , 0x32 }}  
        movlw LOW blink_string+1
        movwf master_fail__test_name
        movlw 50
        movwf master_fail__test_number
        call master_fail
        ; if { temp != pattern } body end
label396__0end:
        ; if exp=` temp != pattern ' empty false
        ; Other expression=`{ temp != pattern }' delay=-1
        ; if { temp != pattern } end
        ;   bit := bit + 1  
        incf test__bit,f
        goto test__388while__continue
        ; if exp=` bit &lt; 4 ' false goto
        ; Other expression=` bit &lt; 4 ' delay=-1
test__388while__break:
        ; `while  bit &lt; 4  ...' end
        ; Now turn the bits on and let them blink :
        ;   call test_prompt {{ 0xf }}  
        movlw 15
        movwf test_prompt__leds
        call test_prompt
        ; Now clear the blink rates :
        ;   bit := 0  
        clrf test__bit
        ; `while  bit &lt; 4  ...' start
test__408while__continue:
        movlw 4
        subwf test__bit,w
        ; expression=` bit &lt; 4 ' exp_delay=2 true_delay=5  false_delay=2 true_size=6 false_size=1
        btfsc c___byte,c___bit
        goto test__408while__break
        ; Clear the blink rate :
        ;   call slave_send {{ 0x20 | bit }}  
        movlw 32
        iorwf test__bit,w
        movwf slave_send__data
        call slave_send
        ;   bit := bit + 1  
        incf test__bit,f
        goto test__408while__continue
        ; if exp=` bit &lt; 4 ' false goto
        ; Other expression=` bit &lt; 4 ' delay=-1
test__408while__break:
        ; `while  bit &lt; 4  ...' end
        ;   call slave_send {{ 0 }}  
        clrf slave_send__data
        call slave_send
        ; Now test increment :
        ;   leds := 0  
        clrf test__leds
        ; `while  leds &lt; 0x10  ...' start
test__417while__continue:
        movlw 16
        subwf test__leds,w
        ; expression=` leds &lt; 0x10 ' exp_delay=2 true_delay=5  false_delay=2 true_size=8 false_size=1
        btfsc c___byte,c___bit
        goto test__417while__break
        ;   call test_verify {{ leds }}  
        movf test__leds,w
        movwf test_verify__leds
        call test_verify
        ; Now increment the LED ' s :
        ;   call slave_send {{ 0x44 }}  
        movlw 68
        movwf slave_send__data
        call slave_send
        ;   leds := leds + 1  
        incf test__leds,f
        goto test__417while__continue
        ; if exp=` leds &lt; 0x10 ' false goto
        ; Other expression=` leds &lt; 0x10 ' delay=-1
test__417while__break:
        ; `while  leds &lt; 0x10  ...' end
        ; Now test decrement :
        ;   leds := 0x10  
        movlw 16
        movwf test__leds
        ; `while  leds != 0  ...' start
test__427while__continue:
        movf test__leds,w
        ; expression=` leds != 0 ' exp_delay=1 true_delay=5  false_delay=2 true_size=8 false_size=1
        btfsc z___byte,z___bit
        goto test__427while__break
        ;   leds := leds - 1  
        decf test__leds,f
        ; Now decrement the LED ' s :
        ;   call slave_send {{ 0x48 }}  
        movlw 72
        movwf slave_send__data
        call slave_send
        ; Now verify :
        ;   call test_verify {{ leds }}  
        movf test__leds,w
        movwf test_verify__leds
        call test_verify
        goto test__427while__continue
        ; if exp=` leds != 0 ' false goto
        ; Other expression=` leds != 0 ' delay=-1
test__427while__break:
        ; `while  leds != 0  ...' end
        ; Let ' s clear the LED ' s :
        ;   call slave_send {{ 0 }}  
        clrf slave_send__data
        call slave_send
        ; Announce that we are done :
        ;   call master_string {{ done_string }}  
        movlw LOW done_string+1
        movwf master_string__message
        call master_string
        ;   call master_crlf {{ }}  
        call master_crlf
        ; procedure test end
        retlw 0

        ; procedure test_verify start
test_verify:
test_verify__variables__base equ global__variables__bank0+22
test_verify__bytes__base equ test_verify__variables__base+0
test_verify__bits__base equ test_verify__variables__base+2
test_verify__total__bytes equ 2
test_verify__leds equ test_verify__bytes__base+0
        ; This procedure will verify that the registers contain high and low .
test_verify__temp equ test_verify__bytes__base+1
        ; Read leds register :
        ;   call slave_send {{ 0x40 }}  
        movlw 64
        movwf slave_send__data
        call slave_send
        ;   temp := slave_get {{ }}  
        call slave_get
        movf slave_get__0return__byte,w
        movwf test_verify__temp
        ; if { temp != leds } start
        subwf test_verify__leds,w
        ; expression=`{ temp != leds }' exp_delay=2 true_delay=5  false_delay=0 true_size=11 false_size=0
        btfsc z___byte,z___bit
        goto label456__0end
        ; if { temp != leds } body start
        ;   call master_octal {{ temp }}  
        movf test_verify__temp,w
        movwf master_octal__number
        call master_octal
        ;   call master_octal {{ leds }}  
        movf test_verify__leds,w
        movwf master_octal__number
        call master_octal
        ;   call master_fail {{ read_string , 0x50 }}  
        movlw LOW read_string+1
        movwf master_fail__test_name
        movlw 80
        movwf master_fail__test_number
        call master_fail
        ; if { temp != leds } body end
label456__0end:
        ; if exp=` temp != leds ' empty false
        ; Other expression=`{ temp != leds }' delay=-1
        ; if { temp != leds } end
        ; procedure test_verify end
        retlw 0

        ; procedure test_prompt start
test_prompt:
test_prompt__variables__base equ global__variables__bank0+24
test_prompt__bytes__base equ test_prompt__variables__base+0
test_prompt__bits__base equ test_prompt__variables__base+4
test_prompt__total__bytes equ 4
test_prompt__483byte0 equ test_prompt__bytes__base+3
test_prompt__leds equ test_prompt__bytes__base+0
        ; This procedure will prompt the user to input a paticular pattern :
test_prompt__count equ test_prompt__bytes__base+1
test_prompt__char equ test_prompt__bytes__base+2
        ; Print high order pattern :
        ; `count_down count 4 ...' start
        movlw 4
        movwf test_prompt__count
test_prompt__473_loop:
        ;   char := 0c'.'  
        movlw 46
        movwf test_prompt__char
        ; if { leds @ 3 } start
        ; Alias variable for select leds @ 3
test_prompt__leds__475select0 equ test_prompt__leds+0
test_prompt__leds__475select0__byte equ test_prompt__leds+0
test_prompt__leds__475select0__bit equ 3
        ; expression=`{ leds @ 3 }' exp_delay=0 true_delay=2  false_delay=0 true_size=2 false_size=0
        btfss test_prompt__leds__475select0__byte,test_prompt__leds__475select0__bit
        goto label475__1end
        ; if { leds @ 3 } body start
        ;   char := 0c'*'  
        movlw 42
        movwf test_prompt__char
        ; if { leds @ 3 } body end
label475__1end:
        ; if exp=` leds @ 3 ' empty false
        ; Other expression=`{ leds @ 3 }' delay=-1
        ; if { leds @ 3 } end
        ;   call master_send {{ char }}  
        movf test_prompt__char,w
        movwf master_send__character
        call master_send
        ;   leds := leds &lt;&lt; 1  
        bcf c___byte,c___bit
        rlf test_prompt__leds,f
        decfsz test_prompt__count,f
        goto test_prompt__473_loop
test_prompt__473_done:
        ; `count_down count 4 ...' end
        ;   call master_send {{ 0c':' }}  
        movlw 58
        movwf master_send__character
        call master_send
        ; `while  master_get ## {{ }} = 0xfc  ...' start
test_prompt__483while__continue:
        call master_get
        movf master_get__0return__byte,w
        movwf test_prompt__483byte0
        movlw 252
        subwf test_prompt__483byte0,w
        ; expression=` master_get ## {{ }} = 0xfc ' exp_delay=3 true_delay=2  false_delay=2 true_size=1 false_size=1
        btfsc z___byte,z___bit
        ; Do nothing :
        goto test_prompt__483while__continue
        goto test_prompt__483while__break
        ; if exp=` master_get ## {{ }} = 0xfc ' true goto small true
test_prompt__483while__break:
        ; `while  master_get ## {{ }} = 0xfc  ...' end
        ;   call master_crlf {{ }}  
        call master_crlf
        ; procedure test_prompt 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+28
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__534byte0 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__data
        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 {{ 8 , 0xc2 }}  
        movlw 8
        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__data
        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__data
        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__data
        call slave_send
        ;   call slave_send {{ 0xff }}  
        movlw 255
        movwf slave_send__data
        call slave_send
        ; Read the glitch register :
        ;   call slave_send {{ 0xfe }}  
        movlw 254
        movwf slave_send__data
        call slave_send
        ; if { slave_get {{ }} != 2 } start
        call slave_get
        movf slave_get__0return__byte,w
        movwf common_test__534byte0
        movlw 2
        subwf common_test__534byte0,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 label534__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
label534__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__data
        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 label540__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
label540__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__data
        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__data
        call slave_send
        ; Decrement :
        ;   call slave_send {{ 0xf8 }}  
        movlw 248
        movwf slave_send__data
        call slave_send
        ; Read clock again :
        ;   call slave_send {{ 0xfa }}  
        movlw 250
        movwf slave_send__data
        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 label552__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
label552__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+30
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 label564__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
label564__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+32
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__577_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__577_loop
common_test_id_bytes8__577_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+33
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__591_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__591_loop
common_test_id_string__591_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+34
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__data
        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 following procedures are used to communicate with the master :}

        ; procedure master_crlf start
master_crlf:
master_crlf__variables__base equ global__variables__bank0+35
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_fail start
master_fail:
master_fail__variables__base equ global__variables__bank0+35
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_get start
master_get:
master_get__variables__base equ global__variables__bank0+37
master_get__bytes__base equ master_get__variables__base+0
master_get__bits__base equ master_get__variables__base+1
master_get__total__bytes equ 1
        ;   arguments_none  
master_get__0return__byte equ master_get__bytes__base+0
        ; This procedure will get the next byte or return 0xfc if
        ; no byte is forthcoming .
        ;   return get_byte {{ rx_master_mask }}  
        movlw 8
        movwf get_byte__mask
        call get_byte
        movf get_byte__0return__byte,w
        movwf master_get__0return__byte
        retlw 0
        ; procedure master_get end

        ; procedure master_octal start
master_octal:
master_octal__variables__base equ global__variables__bank0+38
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__651byte0 equ master_octal__bytes__base+1
master_octal__652byte0 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 tx port .
        ; Output the character in octal :
        ;   call master_send {{ {{ number &gt;&gt; 6 }} + 0c'0' }}  
        swapf master_octal__number,w
        movwf master_octal__651byte0
        rrf master_octal__651byte0,f
        rrf master_octal__651byte0,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__652byte0
        rrf master_octal__652byte0,f
        rrf master_octal__652byte0,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 {{ sp }}  
        movlw 32
        movwf master_send__character
        call master_send
        ; procedure master_octal end
        retlw 0

        ; procedure slave_get start
slave_get:
slave_get__variables__base equ global__variables__bank0+40
slave_get__bytes__base equ slave_get__variables__base+0
slave_get__bits__base equ slave_get__variables__base+1
slave_get__total__bytes equ 1
        ;   arguments_none  
slave_get__0return__byte equ slave_get__bytes__base+0
        ; This procedure will get a byte from the slave or return 0xfc
        ; if no byte is forthcoming .
        ;   return get_byte {{ rx_slave_mask }}  
        movlw 1
        movwf get_byte__mask
        call get_byte
        movf get_byte__0return__byte,w
        movwf slave_get__0return__byte
        retlw 0
        ; procedure slave_get end

        ; procedure slave_send start
slave_send:
slave_send__variables__base equ global__variables__bank0+41
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__data equ slave_send__bytes__base+0
        ; This procedure will send one byte of &lt; data &gt; to the slave .
        ;   call send_byte {{ data , tx_slave_mask }}  
        movf slave_send__data,w
        movwf send_byte__char
        movlw 2
        movwf send_byte__mask
        call send_byte
        ; procedure slave_send end
        retlw 0
        ; comment {The last procedures do character sending and receiving :}

        ; procedure get_byte start
get_byte:
get_byte__variables__base equ global__variables__bank0+42
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 :
        ;   count := 0  
        clrf get_byte__count
        ; `while  porta &amp; mask != 0  ...' start
get_byte__690while__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__690while__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 label692__0end
        ; if { count = 0 } body start
        ;   return 0xfc  
        movlw 252
        movwf get_byte__0return__byte
        retlw 0
        ; if { count = 0 } body end
label692__0end:
        ; if exp=` count = 0 ' empty false
        ; Other expression=`{ count = 0 }' delay=-1
        ; if { count = 0 } end
        ;   call delay {{ }}  
        call delay
        goto get_byte__690while__continue
        ; if exp=` porta &amp; mask != 0 ' false goto
        ; Other expression=` porta &amp; mask != 0 ' delay=-1
get_byte__690while__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__705_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 label708__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
label708__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__705_loop
get_byte__705_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+46
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
        ; 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__740_loop:
        ; if { char @ 0 } start
        ; Alias variable for select char @ 0
send_byte__char__741select0 equ send_byte__char+0
send_byte__char__741select0__byte equ send_byte__char+0
send_byte__char__741select0__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__741select0__byte,send_byte__char__741select0__bit
        ; if { char @ 0 } body start
        ;   porta := space  
        movlw 255
        ; 1 instructions found for sharing
        btfss send_byte__char__741select0__byte,send_byte__char__741select0__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__740_loop
send_byte__740_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 master_send start
master_send:
master_send__variables__base equ global__variables__bank0+50
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 output &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 master_string start
master_string:
master_string__variables__base equ global__variables__bank0+51
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
        ; `while  index &lt; message . size  ...' start
master_string__778while__continue:
        clrf pclath___register
        movf master_string__message,w
        call string___fetch
        subwf master_string__index,w
        ; expression=` index &lt; message . size ' exp_delay=4 true_delay=7  false_delay=2 true_size=8 false_size=1
        btfsc c___byte,c___bit
        goto master_string__778while__break
        ;   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
        goto master_string__778while__continue
        ; if exp=` index &lt; message . size ' false goto
        ; Other expression=` index &lt; message . size ' delay=-1
master_string__778while__break:
        ; `while  index &lt; message . size  ...' end
        ;   call master_send {{ sp }}  
        movlw 32
        movwf master_send__character
        call master_send
        ; procedure master_string end
        retlw 0

        ; procedure delay start
        ; optimize 0
delay:
delay__variables__base equ global__variables__bank0+54
delay__bytes__base equ delay__variables__base+0
delay__bits__base equ delay__variables__base+1
delay__total__bytes equ 1
delay__785byte1 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
        ; Delay 1 third of a bit :
        ; 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__785byte1
delay__785delay0:
        decfsz delay__785byte1,f
        goto delay__785delay0
        nop
        ; procedure delay end
        retlw 0
        ; optimize 1

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

        end

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