        radix dec
global__variables__bank0 equ 7
global__variables__bank1 equ 48
global__bit__variables__bank0 equ 29
global__bit__variables__bank1 equ 48
indf___register equ 0
pcl___register equ 2
c___byte equ 3
c___bit equ 0
z___byte equ 3
z___bit equ 2
        ; On 12-bit PIC's, RP0 is actually bit 5 in FSR (=4)
rp0___byte equ 4
rp0___bit equ 5
        ; On 12-bit PIC's, RP1 is actually bit 6 in FSR (=4)
rp1___byte equ 4
rp1___bit equ 6
        ; On 12-bit PIC's, PA0 is actually bit 5 in STATUS (=3)
pa0___byte equ 3
pa0___bit equ 5
fsr___register equ 4
        org 0
start:
        ; Use oscillator calibration value already in register W
        movwf 5
        ; Initialize TRIS registers
        movlw 200
        tris 6
        ; Initialize OPTION register
        movlw 192
        option
        ; Switch from code bank 0 to code bank 1 before possible transfer (goto)
        bsf pa0___byte,pa0___bit
        goto main
        ; comment #############################################################################
        ; comment {}
        ; comment {Copyright < c > 2000 - 2001 by Wayne C . Gramlich and Bill Benson}
        ; 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 the code that implements the LED4 RoboBrick . Basically}
        ; comment {it just waits for commands that come in at 2400 baud and responds}
        ; comment {to them . See :}
        ; comment {}
        ; comment {http : / / web . gramlich . net / projects / robobricks / led4 / index . html}
        ; comment {}
        ; comment {for more details .}
        ; comment {}
        ; comment #############################################################################
        ;   processor pic12c509 cp = off wdte = on mclre = off fosc = intrc  
        ; 14=0xe 4095=0xfff
        __config 14
configuration___address equ 4095
        ; comment {Define processor constants :}
        ;   constant clock_rate 4000000  
clock_rate equ 4000000
        ;   constant clocks_per_instruction 4  
clocks_per_instruction equ 4
        ;   constant instruction_rate clock_rate / clocks_per_instruction  
instruction_rate equ 1000000
        ; comment {Define serial communication control constants :}
        ;   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 extra_instructions_per_bit 9  
extra_instructions_per_bit equ 9
        ;   constant extra_instructions_per_delay extra_instructions_per_bit / delays_per_bit  
extra_instructions_per_delay equ 3
        ;   constant delay_instructions instructions_per_delay - extra_instructions_per_delay  
delay_instructions equ 135
        ; comment {Register definitions :}
        ; comment {Status register :}
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
        ; comment {OSCCAL register :}
osccal equ 5
        ; comment {The 509 has 4 bits of OSCCAL and the 509 A has 6 bits .}
        ; comment {constant osccal_lsb 0x10}
        ;   constant osccal_lsb 0x4  
osccal_lsb equ 4
        ; comment {Define pin assignments and directions :}
porta equ 6
led0__byte equ 6
led0__bit equ 0
led1__byte equ 6
led1__bit equ 1
led2__byte equ 6
led2__bit equ 2
serial_in__byte equ 6
serial_in__bit equ 3
led3__byte equ 6
led3__bit equ 4
serial_out__byte equ 6
serial_out__bit equ 5
        ; string_constants Start
        ; Switch from code bank 1 to code bank 0 before possible transfer (label)
        bcf pa0___byte,pa0___bit
string___fetch:
        movwf pcl___register
        ;   id = 1 , 0 , 8 , 0 , 0 , 0 , 0 , 0 , 0r'16' , 5 , 0s'LED4B' , 15 , 0s'Gramlich&Benson'  
id___string equ 0
id:
        addwf pcl___register,f
        ; Length = 46
        retlw 46
        ; 1
        retlw 1
        ; 0
        retlw 0
        ; 8
        retlw 8
        ; 0
        retlw 0
        ; 0
        retlw 0
        ; 0
        retlw 0
        ; 0
        retlw 0
        ; 0
        retlw 0
        ; 0r'16'
        retlw 128 ; random number
        retlw 207 ; random number
        retlw 235 ; random number
        retlw 26 ; random number
        retlw 246 ; random number
        retlw 31 ; random number
        retlw 137 ; random number
        retlw 224 ; random number
        retlw 49 ; random number
        retlw 170 ; random number
        retlw 38 ; random number
        retlw 193 ; random number
        retlw 250 ; random number
        retlw 194 ; random number
        retlw 9 ; random number
        retlw 83 ; random number
        ; 5
        retlw 5
        ; `LED4B'
        retlw 76
        retlw 69
        retlw 68
        retlw 52
        retlw 66
        ; 15
        retlw 15
        ; `Gramlich&Benson'
        retlw 71
        retlw 114
        retlw 97
        retlw 109
        retlw 108
        retlw 105
        retlw 99
        retlw 104
        retlw 38
        retlw 66
        retlw 101
        retlw 110
        retlw 115
        retlw 111
        retlw 110
        ;   rate_to_mask = 0xff , 0x80 , 0x40 , 0x20 , 0x10 , 8 , 4 , 2 , 1  
rate_to_mask___string equ 48
rate_to_mask:
        addwf pcl___register,f
        ; Length = 9
        retlw 9
        ; 0xff
        retlw 255
        ; 0x80
        retlw 128
        ; 0x40
        retlw 64
        ; 0x20
        retlw 32
        ; 0x10
        retlw 16
        ; 8
        retlw 8
        ; 4
        retlw 4
        ; 2
        retlw 2
        ; 1
        retlw 1
        ;   bit_to_mask = 1 , 2 , 4 , 8  
bit_to_mask___string equ 59
bit_to_mask:
        addwf pcl___register,f
        ; Length = 4
        retlw 4
        ; 1
        retlw 1
        ; 2
        retlw 2
        ; 4
        retlw 4
        ; 8
        retlw 8
        ; string__constants End
leds_mask equ global__variables__bank0+0
blink_masks equ global__variables__bank0+1
        ; comment {Note that the 12 - bit PIC ' s only have a 2 - level deep stack .}
        ; comment {The code starts in the main procedure < located at the end of this code >}
        ; comment {The next level of procedure call is either get_byte or send_byte .}
        ; comment {Lastly , the lowest level of procedure call is delay . It all fits ,}
        ; comment {but just barely .}

        ; procedure get_byte start
get_byte:
        ; Procedure must be called with PCLATH set to code bank 0
get_byte__variables__base equ global__variables__bank0+5
get_byte__bytes__base equ get_byte__variables__base+0
get_byte__bits__base equ get_byte__variables__base+3
get_byte__total__bytes equ 3
        ;   arguments_none  
get_byte__0return__byte equ get_byte__bytes__base+0
        ; This procedure will wait for a byte to be received from
        ; serial_in_bit . It calls the delay procedure for all delays .
get_byte__count equ get_byte__bytes__base+1
get_byte__char equ get_byte__bytes__base+2
        ; Why does the delay procedure wait for a third of bit ? Well , it
        ; has to do with the loop immediately below . If we catch the
        ; start bit at the beginning of a 1 / 3 bit time , we will be
        ; sampling data at approximately 1 / 3 of the way into each bit .
        ; Conversely , if we catch the start near the end of a 1 / 3 bit
        ; bit time , we will be sampling data at approximately 2 / 3 of the
        ; way into each bit . So , what this means is that our bit sample
        ; times will be somewhere between 1 / 3 and 2 / 3 of bit < i . e . in
        ; the middle of the bit .
        ; It would be nice to tweak the code to shorter delay times
        ; < 1 / 4 bit , 1 / 5 bite , etc . > but then it gets too hard to get
        ; the bookeeping done in the delay routine . A 12 - bit PIC
        ; running at 4 MHz <= 1 MIPS > , only has 138 instructions available
        ; for the delay routine when at 1 / 3 of bit .
        ; Wait for a start bit :
        ; `while serial_in ...' start
get_byte__103while__continue:
        ; expression=`serial_in' exp_delay=0 true_delay=1  false_delay=2 true_size=2 false_size=1
        btfss serial_in__byte,serial_in__bit
        goto get_byte__103while__break
        ;   call delay {{ }}  
        call delay
        goto get_byte__103while__continue
        ; if exp=`serial_in' false goto
        ; Other expression=`serial_in' delay=-1
get_byte__103while__break:
        ; `while serial_in ...' end
        ; Skip over 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
        ; nop extra_instructions_per_bit - 6
        ; Delay 3 cycles
        nop
        nop
        nop
        ; `count_down count 8 ...' start
        movlw 8
        movwf get_byte__count
get_byte__115_loop:
        ;   call delay {{ }}  
        call delay
        ; 2 cycles :
        ;   char := char >> 1  
        bcf c___byte,c___bit
        rrf get_byte__char,f
        ; 2 cycles :
        ; if { serial_in } start
        ; expression=`{ serial_in }' exp_delay=0 true_delay=1  false_delay=0 true_size=1 false_size=0
        btfsc serial_in__byte,serial_in__bit
        ; if { serial_in } body start
        ;   char @ 7 := 1  
        ; Select char @ 7
get_byte__char__121select0 equ get_byte__char+0
get_byte__char__121select0__byte equ get_byte__char+0
get_byte__char__121select0__bit equ 7
        bsf get_byte__char__121select0__byte,get_byte__char__121select0__bit
        ; if { serial_in } body end
        ; if exp=`serial_in' false skip delay=2
        ; Other expression=`{ serial_in }' delay=2
        ; if { serial_in } end
        ;   call delay {{ }}  
        call delay
        ;   call delay {{ }}  
        call delay
        ; 3 cycles for test and jump at end of loop :
        ; 2 + 2 + 3 = 7
        ; nop extra_instructions_per_bit - 7
        ; Delay 2 cycles
        nop
        nop
        decfsz get_byte__count,f
        goto get_byte__115_loop
get_byte__115_done:
        ; `count_down count 8 ...' end
        ; Skip over 2 / 3 ' s of stop bit :
        ;   call delay {{ }}  
        call delay
        ;   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:
        ; Procedure must be called with PCLATH set to code bank 0
send_byte__variables__base equ global__variables__bank0+8
send_byte__bytes__base equ send_byte__variables__base+0
send_byte__bits__base equ send_byte__variables__base+2
send_byte__total__bytes equ 2
send_byte__char equ send_byte__bytes__base+0
        ; Send < char > to < tx > :
send_byte__count equ send_byte__bytes__base+1
        ; Send the start bit :
        ; 1 cycle :
        ;   serial_out := 0  
        bcf serial_out__byte,serial_out__bit
        ;   call delay {{ }}  
        call delay
        ;   call delay {{ }}  
        call delay
        ;   call delay {{ }}  
        call delay
        ; 2 cycles for loop setup :
        ; 2 + 1 = 3
        ; nop extra_instructions_per_bit - 3
        ; Delay 6 cycles
        nop
        nop
        nop
        nop
        nop
        nop
        ; Send the data :
        ; `count_down count 8 ...' start
        movlw 8
        movwf send_byte__count
send_byte__155_loop:
        ; 4 cycles :
        ;   serial_out := char @ 0  
        ; Alias variable for select char @ 0
send_byte__char__157select0 equ send_byte__char+0
send_byte__char__157select0__byte equ send_byte__char+0
send_byte__char__157select0__bit equ 0
        btfss send_byte__char__157select0__byte,send_byte__char__157select0__bit
        bcf serial_out__byte,serial_out__bit
        btfsc send_byte__char__157select0__byte,send_byte__char__157select0__bit
        bsf serial_out__byte,serial_out__bit
        ; 2 cycles :
        ;   char := char >> 1  
        bcf c___byte,c___bit
        rrf send_byte__char,f
        ;   call delay {{ }}  
        call delay
        ;   call delay {{ }}  
        call delay
        ;   call delay {{ }}  
        call delay
        ; 3 cycles for test and jump at end of loop :
        ; 4 + 2 + 3 = 9 = no NOP ' s needed :
        decfsz send_byte__count,f
        goto send_byte__155_loop
send_byte__155_done:
        ; `count_down count 8 ...' end
        ; Send the stop bit :
        ; nop 1
        ; Delay 1 cycles
        nop
        ;   serial_out := 1  
        bsf serial_out__byte,serial_out__bit
        ;   call delay {{ }}  
        call delay
        ;   call delay {{ }}  
        call delay
        ;   call delay {{ }}  
        call delay
        ; nop extra_instructions_per_bit - 5
        ; Delay 4 cycles
        nop
        nop
        nop
        nop
        ; procedure send_byte end
        retlw 0

        ; procedure delay start
        ; optimize 0
delay:
        ; Procedure must be called with PCLATH set to code bank 0
delay__variables__base equ global__variables__bank0+10
delay__bytes__base equ delay__variables__base+0
delay__bits__base equ delay__variables__base+4
delay__total__bytes equ 4
delay__176byte1 equ delay__bytes__base+3
delay__196byte2 equ delay__bytes__base+3
        ;   arguments_none  
        ;   uniform_delay delay_instructions  
        ; Uniform delay remaining = 131 Accumulated Delay = 0
        ; Uniform delay remaining = 131 Accumulated Delay = 0
        ; This procedure delays 1 / 3 of a bit .
        ; Uniform delay remaining = 131 Accumulated Delay = 0
        ; Uniform delay remaining = 131 Accumulated Delay = 0
delay__blink equ delay__bytes__base+0
        ; Uniform delay remaining = 131 Accumulated Delay = 0
delay__high equ delay__bytes__base+1
        ; Uniform delay remaining = 131 Accumulated Delay = 0
delay__low equ delay__bytes__base+2
        ; Uniform delay remaining = 131 Accumulated Delay = 0
        ; Uniform delay remaining = 131 Accumulated Delay = 0
        ; This procedure is called 7200 times a second . We want to
        ; Uniform delay remaining = 131 Accumulated Delay = 0
        ; slow the fastest blink rate down to something more manageable ,
        ; Uniform delay remaining = 131 Accumulated Delay = 0
        ; like 4 times a second .
        ; Uniform delay remaining = 131 Accumulated Delay = 0
        ; Uniform delay remaining = 131 Accumulated Delay = 0
        ; Kick the dog :
        ; Uniform delay remaining = 131 Accumulated Delay = 0
        ;   watch_dog_reset  
        clrwdt
        ; Uniform delay remaining = 130 Accumulated Delay = 1
        ; Uniform delay remaining = 130 Accumulated Delay = 1
        ; Slow the blink rate down :
        ; Uniform delay remaining = 130 Accumulated Delay = 1
        ;   low := low + 1  
        incf delay__low,f
        ; Uniform delay remaining = 129 Accumulated Delay = 2
        ; if { z } start
        ; expression=`{ z }' exp_delay=0 true_delay=10  false_delay=0 true_size=13 false_size=0
        btfsc z__byte,z__bit
        goto label196__0true
label196__0false:
        ; Delay 9 cycles
        movlw 2
        movwf delay__196byte2
delay__196delay1:
        decfsz delay__196byte2,f
        goto delay__196delay1
        nop
        nop
        goto label196__0end
label196__0true:
        ; if { z } body start
        ; Uniform delay remaining = 129 Accumulated Delay = 0
        ;   high := high + 1  
        incf delay__high,f
        ; Uniform delay remaining = 128 Accumulated Delay = 1
        ; 7200 / 256 ~ = 28 ; 28 / 4 = 7 = > 4 blinks a second for fastest blink rate :
        ; Uniform delay remaining = 128 Accumulated Delay = 1
        ; if { high > 2 } start
        movlw 3
        subwf delay__high,w
        ; expression=`{ high > 2 }' exp_delay=2 true_delay=4  false_delay=0 true_size=4 false_size=0
        btfsc c___byte,c___bit
        goto label199__0true
label199__0false:
        ; Delay 3 cycles
        nop
        nop
        nop
        goto label199__0end
label199__0true:
        ; if { high > 2 } body start
        ; Uniform delay remaining = 128 Accumulated Delay = 0
        ;   high := 0  
        clrf delay__high
        ; Uniform delay remaining = 127 Accumulated Delay = 1
        ;   blink := blink + 1  
        incf delay__blink,f
        ; Uniform delay remaining = 126 Accumulated Delay = 2
        ; Uniform delay remaining = 126 Accumulated Delay = 2
        ; We never let the blink mask go to all zeros because the way
        ; Uniform delay remaining = 126 Accumulated Delay = 2
        ; we indicate that an LED is to stay on alwayas is that we set
        ; Uniform delay remaining = 126 Accumulated Delay = 2
        ; its blink mask to all one ' s . If the blink variable ever goes
        ; Uniform delay remaining = 126 Accumulated Delay = 2
        ; to all zeros , there would be a small glitch for LED ' s that
        ; Uniform delay remaining = 126 Accumulated Delay = 2
        ; are supposed to be always on . Hence we skip over a value of 0 .
        ; Uniform delay remaining = 126 Accumulated Delay = 2
        ; 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
        ; Uniform delay remaining = 126 Accumulated Delay = 0
        ;   blink := blink + 1  
        incf delay__blink,f
        ; Uniform delay remaining = 125 Accumulated Delay = 1
        ; Uniform delay remaining = 125 Accumulated Delay = 1
        ; if { z } body end
        ; if exp=`z' false skip delay=2
        ; Other expression=`{ z }' delay=2
        ; if { z } end
        ; Uniform delay remaining = 124 Accumulated Delay = 4
        ; Uniform delay remaining = 124 Accumulated Delay = 4
        ; if { high > 2 } body end
        ; if exp=` high > 2 ' total delay=9
        ; if exp=` high > 2 ' generic
label199__0end:
        ; Other expression=`{ high > 2 }' delay=9
        ; if { high > 2 } end
        ; Uniform delay remaining = 119 Accumulated Delay = 10
        ; Uniform delay remaining = 119 Accumulated Delay = 10
        ; if { z } body end
        ; if exp=`z' total delay=13
        ; if exp=`z' generic
label196__0end:
        ; Other expression=`{ z }' delay=13
        ; if { z } end
        ; Uniform delay remaining = 116 Accumulated Delay = 15
        ; Uniform delay remaining = 116 Accumulated Delay = 15
        ; if { leds_mask @ 0 } start
        ; Alias variable for select leds_mask @ 0
leds_mask__214select0 equ leds_mask+0
leds_mask__214select0__byte equ leds_mask+0
leds_mask__214select0__bit equ 0
        ; expression=`{ leds_mask @ 0 }' exp_delay=0 true_delay=5  false_delay=0 true_size=5 false_size=0
        btfsc leds_mask__214select0__byte,leds_mask__214select0__bit
        goto label214__1true
label214__1false:
        ; else body start
        ; Uniform delay remaining = 116 Accumulated Delay = 0
        ;   led0 := 1  
        ; 1 instructions found for sharing
        ; Uniform delay remaining = 115 Accumulated Delay = 1
        ; else body end
        ; Delay 4 cycles
        nop
        nop
        nop
        nop
        goto label214__1end
label214__1true:
        ; if { leds_mask @ 0 } body start
        ; Uniform delay remaining = 116 Accumulated Delay = 0
        ; if { blink & blink_masks ~~ {{ 0 }} != 0 } start
        movf blink_masks+0,w
        andwf delay__blink,w
        ; expression=`{ blink & blink_masks ~~ {{ 0 }} != 0 }' exp_delay=2 true_delay=1  false_delay=1 true_size=1 false_size=1
        btfss z___byte,z___bit
        ; if { blink & blink_masks ~~ {{ 0 }} != 0 } body start
        ; Uniform delay remaining = 116 Accumulated Delay = 0
        ;   led0 := 0  
        bcf led0__byte,led0__bit
        ; Uniform delay remaining = 115 Accumulated Delay = 1
        ; Uniform delay remaining = 115 Accumulated Delay = 1
        ; if { blink & blink_masks ~~ {{ 0 }} != 0 } body end
        btfsc z___byte,z___bit
        ; else body start
        ; Uniform delay remaining = 116 Accumulated Delay = 0
        ;   led0 := 1  
        ; 1 instructions found for sharing
        ; Uniform delay remaining = 115 Accumulated Delay = 1
        ; else body end
        ; if exp=` blink & blink_masks ~~ {{ 0 }} != 0 ' single true and false skip delay=6
        ; Other expression=`{ blink & blink_masks ~~ {{ 0 }} != 0 }' delay=6
        ; if { blink & blink_masks ~~ {{ 0 }} != 0 } end
        ; Uniform delay remaining = 110 Accumulated Delay = 6
        ; Uniform delay remaining = 110 Accumulated Delay = 6
        ; if { leds_mask @ 0 } body end
        ; if exp=` leds_mask @ 0 ' total delay=8
        ; if exp=` leds_mask @ 0 ' generic
label214__1end:
        ; Other expression=`{ leds_mask @ 0 }' delay=8
        ; 1 shared instructions follow
        bsf led0__byte,led0__bit
        ; if { leds_mask @ 0 } end
        ; Uniform delay remaining = 107 Accumulated Delay = 24
        ; Uniform delay remaining = 107 Accumulated Delay = 24
        ; if { leds_mask @ 1 } start
        ; Alias variable for select leds_mask @ 1
leds_mask__224select0 equ leds_mask+0
leds_mask__224select0__byte equ leds_mask+0
leds_mask__224select0__bit equ 1
        ; expression=`{ leds_mask @ 1 }' exp_delay=0 true_delay=5  false_delay=0 true_size=5 false_size=0
        btfsc leds_mask__224select0__byte,leds_mask__224select0__bit
        goto label224__1true
label224__1false:
        ; else body start
        ; Uniform delay remaining = 107 Accumulated Delay = 0
        ;   led1 := 1  
        ; 1 instructions found for sharing
        ; Uniform delay remaining = 106 Accumulated Delay = 1
        ; else body end
        ; Delay 4 cycles
        nop
        nop
        nop
        nop
        goto label224__1end
label224__1true:
        ; if { leds_mask @ 1 } body start
        ; Uniform delay remaining = 107 Accumulated Delay = 0
        ; if { blink & blink_masks ~~ {{ 1 }} != 0 } start
        movf blink_masks+1,w
        andwf delay__blink,w
        ; expression=`{ blink & blink_masks ~~ {{ 1 }} != 0 }' exp_delay=2 true_delay=1  false_delay=1 true_size=1 false_size=1
        btfss z___byte,z___bit
        ; if { blink & blink_masks ~~ {{ 1 }} != 0 } body start
        ; Uniform delay remaining = 107 Accumulated Delay = 0
        ;   led1 := 0  
        bcf led1__byte,led1__bit
        ; Uniform delay remaining = 106 Accumulated Delay = 1
        ; Uniform delay remaining = 106 Accumulated Delay = 1
        ; if { blink & blink_masks ~~ {{ 1 }} != 0 } body end
        btfsc z___byte,z___bit
        ; else body start
        ; Uniform delay remaining = 107 Accumulated Delay = 0
        ;   led1 := 1  
        ; 1 instructions found for sharing
        ; Uniform delay remaining = 106 Accumulated Delay = 1
        ; else body end
        ; if exp=` blink & blink_masks ~~ {{ 1 }} != 0 ' single true and false skip delay=6
        ; Other expression=`{ blink & blink_masks ~~ {{ 1 }} != 0 }' delay=6
        ; if { blink & blink_masks ~~ {{ 1 }} != 0 } end
        ; Uniform delay remaining = 101 Accumulated Delay = 6
        ; Uniform delay remaining = 101 Accumulated Delay = 6
        ; if { leds_mask @ 1 } body end
        ; if exp=` leds_mask @ 1 ' total delay=8
        ; if exp=` leds_mask @ 1 ' generic
label224__1end:
        ; Other expression=`{ leds_mask @ 1 }' delay=8
        ; 1 shared instructions follow
        bsf led1__byte,led1__bit
        ; if { leds_mask @ 1 } end
        ; Uniform delay remaining = 98 Accumulated Delay = 33
        ; Uniform delay remaining = 98 Accumulated Delay = 33
        ; if { leds_mask @ 2 } start
        ; Alias variable for select leds_mask @ 2
leds_mask__234select0 equ leds_mask+0
leds_mask__234select0__byte equ leds_mask+0
leds_mask__234select0__bit equ 2
        ; expression=`{ leds_mask @ 2 }' exp_delay=0 true_delay=5  false_delay=0 true_size=5 false_size=0
        btfsc leds_mask__234select0__byte,leds_mask__234select0__bit
        goto label234__1true
label234__1false:
        ; else body start
        ; Uniform delay remaining = 98 Accumulated Delay = 0
        ;   led2 := 1  
        ; 1 instructions found for sharing
        ; Uniform delay remaining = 97 Accumulated Delay = 1
        ; else body end
        ; Delay 4 cycles
        nop
        nop
        nop
        nop
        goto label234__1end
label234__1true:
        ; if { leds_mask @ 2 } body start
        ; Uniform delay remaining = 98 Accumulated Delay = 0
        ; if { blink & blink_masks ~~ {{ 2 }} != 0 } start
        movf blink_masks+2,w
        andwf delay__blink,w
        ; expression=`{ blink & blink_masks ~~ {{ 2 }} != 0 }' exp_delay=2 true_delay=1  false_delay=1 true_size=1 false_size=1
        btfss z___byte,z___bit
        ; if { blink & blink_masks ~~ {{ 2 }} != 0 } body start
        ; Uniform delay remaining = 98 Accumulated Delay = 0
        ;   led2 := 0  
        bcf led2__byte,led2__bit
        ; Uniform delay remaining = 97 Accumulated Delay = 1
        ; Uniform delay remaining = 97 Accumulated Delay = 1
        ; if { blink & blink_masks ~~ {{ 2 }} != 0 } body end
        btfsc z___byte,z___bit
        ; else body start
        ; Uniform delay remaining = 98 Accumulated Delay = 0
        ;   led2 := 1  
        ; 1 instructions found for sharing
        ; Uniform delay remaining = 97 Accumulated Delay = 1
        ; else body end
        ; if exp=` blink & blink_masks ~~ {{ 2 }} != 0 ' single true and false skip delay=6
        ; Other expression=`{ blink & blink_masks ~~ {{ 2 }} != 0 }' delay=6
        ; if { blink & blink_masks ~~ {{ 2 }} != 0 } end
        ; Uniform delay remaining = 92 Accumulated Delay = 6
        ; Uniform delay remaining = 92 Accumulated Delay = 6
        ; if { leds_mask @ 2 } body end
        ; if exp=` leds_mask @ 2 ' total delay=8
        ; if exp=` leds_mask @ 2 ' generic
label234__1end:
        ; Other expression=`{ leds_mask @ 2 }' delay=8
        ; 1 shared instructions follow
        bsf led2__byte,led2__bit
        ; if { leds_mask @ 2 } end
        ; Uniform delay remaining = 89 Accumulated Delay = 42
        ; Uniform delay remaining = 89 Accumulated Delay = 42
        ; if { leds_mask @ 3 } start
        ; Alias variable for select leds_mask @ 3
leds_mask__244select0 equ leds_mask+0
leds_mask__244select0__byte equ leds_mask+0
leds_mask__244select0__bit equ 3
        ; expression=`{ leds_mask @ 3 }' exp_delay=0 true_delay=5  false_delay=0 true_size=5 false_size=0
        btfsc leds_mask__244select0__byte,leds_mask__244select0__bit
        goto label244__1true
label244__1false:
        ; else body start
        ; Uniform delay remaining = 89 Accumulated Delay = 0
        ;   led3 := 1  
        ; 1 instructions found for sharing
        ; Uniform delay remaining = 88 Accumulated Delay = 1
        ; else body end
        ; Delay 4 cycles
        nop
        nop
        nop
        nop
        goto label244__1end
label244__1true:
        ; if { leds_mask @ 3 } body start
        ; Uniform delay remaining = 89 Accumulated Delay = 0
        ; if { blink & blink_masks ~~ {{ 3 }} != 0 } start
        movf blink_masks+3,w
        andwf delay__blink,w
        ; expression=`{ blink & blink_masks ~~ {{ 3 }} != 0 }' exp_delay=2 true_delay=1  false_delay=1 true_size=1 false_size=1
        btfss z___byte,z___bit
        ; if { blink & blink_masks ~~ {{ 3 }} != 0 } body start
        ; Uniform delay remaining = 89 Accumulated Delay = 0
        ;   led3 := 0  
        bcf led3__byte,led3__bit
        ; Uniform delay remaining = 88 Accumulated Delay = 1
        ; Uniform delay remaining = 88 Accumulated Delay = 1
        ; if { blink & blink_masks ~~ {{ 3 }} != 0 } body end
        btfsc z___byte,z___bit
        ; else body start
        ; Uniform delay remaining = 89 Accumulated Delay = 0
        ;   led3 := 1  
        ; 1 instructions found for sharing
        ; Uniform delay remaining = 88 Accumulated Delay = 1
        ; else body end
        ; if exp=` blink & blink_masks ~~ {{ 3 }} != 0 ' single true and false skip delay=6
        ; Other expression=`{ blink & blink_masks ~~ {{ 3 }} != 0 }' delay=6
        ; if { blink & blink_masks ~~ {{ 3 }} != 0 } end
        ; Uniform delay remaining = 83 Accumulated Delay = 6
        ; Uniform delay remaining = 83 Accumulated Delay = 6
        ; if { leds_mask @ 3 } body end
        ; if exp=` leds_mask @ 3 ' total delay=8
        ; if exp=` leds_mask @ 3 ' generic
label244__1end:
        ; Other expression=`{ leds_mask @ 3 }' delay=8
        ; 1 shared instructions follow
        bsf led3__byte,led3__bit
        ; if { leds_mask @ 3 } end
        ; Uniform delay remaining = 80 Accumulated Delay = 51
        ; Uniform delay remaining = 80 Accumulated Delay = 51
        ; Uniform delay remaining = 80 Accumulated Delay = 51
        ; Soak up remaining 80 cycles
        ; Delay 80 cycles
        movlw 26
        movwf delay__176byte1
delay__176delay0:
        decfsz delay__176byte1,f
        goto delay__176delay0
        nop
        ; procedure delay end
        retlw 0
        ; optimize 1
        ;   origin 0x200  
        org 512
        ; comment {The main procedure is loaded with switch statements . On the 12 - bit}
        ; comment {PIC ' s , switch statements have to live in the first 256 bytes of}
        ; comment {each code bank . For this reason , we shove main into code bank 1 .}
        ; comment {If we , try to put main in code bank 0 , it pushes the first bytes}
        ; comment {of several routines out of the first 256 bytes , which is also a}
        ; comment {no - no of the 12 - bit PIC ' s .}

        ; procedure main start
switch__296block_start:
        addwf pcl___register,f
        goto switch__296block297
        goto switch__296block297
        goto switch__296block301
        goto switch__296block312
        goto switch__296block338
        goto switch__296block338
        goto switch__296block338
        goto switch__296block338
switch__296block_end:
        ; switch_check 296 switch__296block_start switch__296block_end
switch__348block_start:
        addwf pcl___register,f
        goto switch__348block349
        goto switch__348block353
        goto switch__348block353
        goto switch__348block353
        goto switch__348block356
        goto switch__348block356
        goto switch__348block356
        goto switch__348block356
switch__348block_end:
        ; switch_check 348 switch__348block_start switch__348block_end
switch__346block_start:
        addwf pcl___register,f
        goto switch__346block347
        goto switch__346block362
        goto switch__346default370
        goto switch__346default370
        goto switch__346default370
        goto switch__346default370
        goto switch__346default370
        goto switch__346default370
switch__346block_end:
        ; switch_check 346 switch__346block_start switch__346block_end
switch__382block_start:
        addwf pcl___register,f
        goto switch__382block383
        goto switch__382block387
        goto switch__382block391
        goto switch__382block395
        goto switch__382block399
        goto switch__382block407
        goto switch__382block411
        goto switch__382block416
switch__382block_end:
        ; switch_check 382 switch__382block_start switch__382block_end
switch__293block_start:
        addwf pcl___register,f
        goto switch__293block294
        goto switch__293block344
        goto switch__293block375
        goto switch__293block378
switch__293block_end:
        ; switch_check 293 switch__293block_start switch__293block_end
main:
        ; Procedure must be called with PCLATH set to code bank 0
main__variables__base equ global__variables__bank0+14
main__bytes__base equ main__variables__base+0
main__bits__base equ main__variables__base+8
main__total__bytes equ 8
main__367byte1 equ main__bytes__base+6
main__278byte0 equ main__bytes__base+6
main__296byte0 equ main__bytes__base+6
main__340byte2 equ main__bytes__base+6
main__340byte3 equ main__bytes__base+6
main__380byte1 equ main__bytes__base+6
main__380byte2 equ main__bytes__base+6
main__346byte0 equ main__bytes__base+6
main__293byte0 equ main__bytes__base+6
main__303byte0 equ main__bytes__base+6
main__358byte0 equ main__bytes__base+6
main__327byte0 equ main__bytes__base+6
main__320byte0 equ main__bytes__base+6
main__314byte0 equ main__bytes__base+6
main__340byte1 equ main__bytes__base+6
main__278byte1 equ main__bytes__base+7
main__358byte1 equ main__bytes__base+7
main__327byte1 equ main__bytes__base+7
main__340byte0 equ main__bytes__base+7
main__367byte0 equ main__bytes__base+7
        ;   arguments_none  
main__command equ main__bytes__base+0
main__glitch equ main__bytes__base+1
main__index equ main__bytes__base+2
main__mask equ main__bytes__base+3
main__rate equ main__bytes__base+4
main__result equ main__bytes__base+5
        ; Initialize blink_masks :
        ; `count_down index 4 ...' start
        movlw 4
        movwf main__index
main__277_loop:
        ;   blink_masks ~~ {{ index - 1 }} := 0xff  
        movlw 255
        movwf main__278byte0
        decf main__index,w
        movwf main__278byte1
        movlw LOW blink_masks
        addwf main__278byte1,
        movwf fsr___register
        ; FSR now points to reg bank 0 (which contains 8[])
        movf main__278byte0,w
        ; FSR must point to reg bank 0 (which contains 8[4]) before using INDF reg
        movwf indf___register
        decfsz main__index,f
        goto main__277_loop
main__277_done:
        ; `count_down index 4 ...' end
        ; Initialize remaining registers :
        ;   serial_out := 1  
        bsf serial_out__byte,serial_out__bit
        ;   glitch := 0  
        clrf main__glitch
        ;   index := 0  
        clrf main__index
        ;   leds_mask := 0  
        clrf leds_mask
        ; Process commands :
        ; loop_forever ... start
main__288loop__forever:
        ; Wait for command :
        ;   command := get_byte {{ }}  
        ; Switch from code bank 1 to code bank 0 before possible transfer (call)
        bcf pa0___byte,pa0___bit
        call get_byte
        movf get_byte__0return__byte,w
        movwf main__command
        ; Dispatch on command :
        ; switch { command >> 6 }
        swapf main__command,w
        movwf main__293byte0
        rrf main__293byte0,f
        rrf main__293byte0,w
        andlw 3
        ; case 0
        ; case 1
        ; case 2
        ; case 3
        ; Switch from code bank 0 to code bank 1 before possible transfer (goto)
        bsf pa0___byte,pa0___bit
        goto switch__293block_start
switch__293block294:
        ; < Command = 00 xx xxxx > :
        ; switch { {{ command >> 3 }} & 7 }
        rrf main__command,w
        movwf main__296byte0
        rrf main__296byte0,f
        rrf main__296byte0,w
        andlw 7
        ; case 0 1
        ; case 2
        ; case 3
        ; case 4 5 6 7
        goto switch__296block_start
switch__296block297:
        ; Write All < Command = 0000 abcd > :
        ;   leds_mask := command  
        movf main__command,w
        movwf leds_mask
        goto switch__296end
switch__296block301:
        ; Command = 0001 0 xxx :
        ;   mask := bit_to_mask ~~ {{ command & 3 }}  
        movlw 3
        andwf main__command,w
        movwf main__303byte0
        incf main__303byte0,w
        ; Switch from code bank 1 to code bank 0 before possible transfer (call)
        bcf pa0___byte,pa0___bit
        call bit_to_mask
        movwf main__mask
        ; if { command @ 2 } start
        ; Alias variable for select command @ 2
main__command__304select0 equ main__command+0
main__command__304select0__byte equ main__command+0
main__command__304select0__bit equ 2
        ; expression=`{ command @ 2 }' exp_delay=0 true_delay=2  false_delay=3 true_size=2 false_size=3
        ; Switch from code bank 0 to code bank 1 before possible transfer (btfss)
        bsf pa0___byte,pa0___bit
        btfss main__command__304select0__byte,main__command__304select0__bit
        goto label304__1false
label304__1true:
        ; if { command @ 2 } body start
        ; Bit set < Command = 0001 01 bb > :
        ;   leds_mask := leds_mask | mask  
        movf main__mask,w
        iorwf leds_mask,f
        ; if { command @ 2 } body end
        goto label304__1end
label304__1false:
        ; else body start
        ; Bit Clear < Command = 0001 00 bb > :
        ;   leds_mask := leds_mask & {{ 0xff ^ mask }}  
        movlw 255
        xorwf main__mask,w
        andwf leds_mask,f
        ; else body end
        ; if exp=` command @ 2 ' generic
label304__1end:
        ; Other expression=`{ command @ 2 }' delay=-1
        ; if { command @ 2 } end
        goto switch__296end
switch__296block312:
        ; Command = 0001 1 xxx :
        ;   mask := bit_to_mask ~~ {{ command & 3 }}  
        movlw 3
        andwf main__command,w
        movwf main__314byte0
        incf main__314byte0,w
        ; Switch from code bank 1 to code bank 0 before possible transfer (call)
        bcf pa0___byte,pa0___bit
        call bit_to_mask
        movwf main__mask
        ; if { command @ 2 } start
        ; Alias variable for select command @ 2
main__command__315select0 equ main__command+0
main__command__315select0__byte equ main__command+0
main__command__315select0__bit equ 2
        ; expression=`{ command @ 2 }' exp_delay=0 true_delay=-1  false_delay=2 true_size=31 false_size=2
        ; Switch from code bank 0 to code bank 1 before possible transfer (btfss)
        bsf pa0___byte,pa0___bit
        btfss main__command__315select0__byte,main__command__315select0__bit
        goto label315__1false
label315__1true:
        ; if { command @ 2 } body start
        ; Bit Read < Command = 0001 11 bb > :
        ; Compute bit rate in < result > :
        ;   result := 0  
        clrf main__result
        ;   mask := blink_masks ~~ {{ command & 3 }}  
        movlw 3
        andwf main__command,w
        movwf main__320byte0
        movlw LOW blink_masks
        addwf main__320byte0,w
        movwf fsr___register
        ; FSR now points to reg bank 0 (which contains 8[4])
        ; FSR must point to reg bank 0 (which contains 8[4]) before using INDF reg
        movf indf___register,w
        movwf main__mask
        ; `while  rate_to_mask ~~ {{ result }} != mask  ...' start
main__321while__continue:
        incf main__result,w
        ; Switch from code bank 1 to code bank 0 before possible transfer (call)
        bcf pa0___byte,pa0___bit
        call rate_to_mask
        subwf main__mask,w
        ; expression=` rate_to_mask ~~ {{ result }} != mask ' exp_delay=3 true_delay=3  false_delay=2 true_size=2 false_size=1
        ; Switch from code bank 0 to code bank 1 before possible transfer (btfsc)
        bsf pa0___byte,pa0___bit
        btfsc z___byte,z___bit
        goto main__321while__break
        ;   result := result + 1  
        incf main__result,f
        goto main__321while__continue
        ; if exp=` rate_to_mask ~~ {{ result }} != mask ' false goto
        ; Other expression=` rate_to_mask ~~ {{ result }} != mask ' delay=-1
main__321while__break:
        ; `while  rate_to_mask ~~ {{ result }} != mask  ...' end
        ; Form the final answer :
        ;   result := result << 1  
        bcf c___byte,c___bit
        rlf main__result,f
        ; if { leds_mask & bit_to_mask ~~ {{ command & 3 }} != 0 } start
        movf leds_mask,w
        movwf main__327byte1
        movlw 3
        andwf main__command,w
        movwf main__327byte0
        incf main__327byte0,w
        ; Switch from code bank 1 to code bank 0 before possible transfer (call)
        bcf pa0___byte,pa0___bit
        call bit_to_mask
        andwf main__327byte1,w
        ; expression=`{ leds_mask & bit_to_mask ~~ {{ command & 3 }} != 0 }' exp_delay=8 true_delay=1  false_delay=0 true_size=1 false_size=0
        ; Switch from code bank 0 to code bank 1 before possible transfer (btfss)
        bsf pa0___byte,pa0___bit
        btfss z___byte,z___bit
        ; if { leds_mask & bit_to_mask ~~ {{ command & 3 }} != 0 } body start
        ;   result := result + 1  
        incf main__result,f
        ; if { leds_mask & bit_to_mask ~~ {{ command & 3 }} != 0 } body end
        ; if exp=` leds_mask & bit_to_mask ~~ {{ command & 3 }} != 0 ' false skip delay=10
        ; Other expression=`{ leds_mask & bit_to_mask ~~ {{ command & 3 }} != 0 }' delay=10
        ; if { leds_mask & bit_to_mask ~~ {{ command & 3 }} != 0 } end
        ; Send it :
        ;   call send_byte {{ result }}  
        movf main__result,w
        movwf send_byte__char
        ; Switch from code bank 1 to code bank 0 before possible transfer (call)
        bcf pa0___byte,pa0___bit
        call send_byte
        ; if { command @ 2 } body end
        ; Switch from code bank 0 to code bank 1 before possible transfer (goto)
        bsf pa0___byte,pa0___bit
        goto label315__1end
label315__1false:
        ; else body start
        ; Bit Toggle < Command = 0001 10 bb > :
        ;   leds_mask := leds_mask ^ mask  
        movf main__mask,w
        xorwf leds_mask,f
        ; else body end
        ; if exp=` command @ 2 ' generic
label315__1end:
        ; Other expression=`{ command @ 2 }' delay=-1
        ; if { command @ 2 } end
        goto switch__296end
switch__296block338:
        ; Blink Rate Set < Command = 001 r rrbb > :
        ;   blink_masks ~~ {{ command & 3 }} := rate_to_mask ~~ {{ {{ command >> 2 }} & 7 }}  
        rrf main__command,w
        movwf main__340byte1
        rrf main__340byte1,w
        andlw 7
        movwf main__340byte2
        incf main__340byte2,w
        ; Switch from code bank 1 to code bank 0 before possible transfer (call)
        bcf pa0___byte,pa0___bit
        call rate_to_mask
        movwf main__340byte0
        movlw 3
        andwf main__command,w
        movwf main__340byte3
        movlw LOW blink_masks
        addwf main__340byte3,
        movwf fsr___register
        ; FSR now points to reg bank 0 (which contains 8[])
        movf main__340byte0,w
        ; FSR must point to reg bank 0 (which contains 8[4]) before using INDF reg
        movwf indf___register
        ; Switch from code bank 0 to code bank 1 before possible transfer (goto)
        bsf pa0___byte,pa0___bit
switch__296end:
        goto switch__293end
switch__293block344:
        ; < Command = 01 xx xxxx > :
        ; switch { {{ command >> 3 }} & 7 }
        rrf main__command,w
        movwf main__346byte0
        rrf main__346byte0,f
        rrf main__346byte0,w
        andlw 7
        ; case 0
        ; case 1
        goto switch__346block_start
switch__346block347:
        ; switch { command & 7 }
        movlw 7
        andwf main__command,w
        ; case 0
        ; case 1 2 3
        ; case 4 5 6 7
        goto switch__348block_start
switch__348block349:
        ; Read all < Command = 0100 0000 > :
        ;   call send_byte {{ leds_mask & 0xf }}  
        movlw 15
        andwf leds_mask,w
        movwf send_byte__char
        ; Switch from code bank 1 to code bank 0 before possible transfer (call)
        bcf pa0___byte,pa0___bit
        call send_byte
        ; Switch from code bank 0 to code bank 1 before possible transfer (goto)
        bsf pa0___byte,pa0___bit
        goto switch__348end
switch__348block353:
        ; Do nothing :
        goto switch__348end
switch__348block356:
        ; Increment LED ' s < Command = 0100 01 bb > :
        ;   leds_mask := {{ leds_mask + bit_to_mask ~~ {{ command & 3 }} }} & 0xf  
        movf leds_mask,w
        movwf main__358byte1
        movlw 3
        andwf main__command,w
        movwf main__358byte0
        incf main__358byte0,w
        ; Switch from code bank 1 to code bank 0 before possible transfer (call)
        bcf pa0___byte,pa0___bit
        call bit_to_mask
        addwf main__358byte1,w
        andlw 15
        movwf leds_mask
        ; Switch from code bank 0 to code bank 1 before possible transfer (goto)
        bsf pa0___byte,pa0___bit
switch__348end:
        goto switch__346end
switch__346block362:
        ; if { command @ 2 } start
        ; Alias variable for select command @ 2
main__command__363select0 equ main__command+0
main__command__363select0__byte equ main__command+0
main__command__363select0__bit equ 2
        ; expression=`{ command @ 2 }' exp_delay=0 true_delay=0  false_delay=10 true_size=0 false_size=10
        btfsc main__command__363select0__byte,main__command__363select0__bit
        goto label363__1end
        ; else body start
        ; Decrement LED ' s < Command = 0100 10 bb > :
        ;   leds_mask := {{ leds_mask - bit_to_mask ~~ {{ command & 3 }} }} & 0xf  
        movf leds_mask,w
        movwf main__367byte1
        movlw 3
        andwf main__command,w
        movwf main__367byte0
        incf main__367byte0,w
        ; Switch from code bank 1 to code bank 0 before possible transfer (call)
        bcf pa0___byte,pa0___bit
        call bit_to_mask
        subwf main__367byte1,w
        andlw 15
        movwf leds_mask
        ; else body end
        ; Switch from code bank 0 to code bank 1 before possible transfer (label)
        bsf pa0___byte,pa0___bit
label363__1end:
        ; if exp=` command @ 2 ' empty true
        ; Other expression=`{ command @ 2 }' delay=-1
        ; if { command @ 2 } end
        goto switch__346end
switch__346default370:
        ; Do nothing :
switch__346end:
        goto switch__293end
switch__293block375:
        ; Do nothing < Command = 10 xx xxx > :
        goto switch__293end
switch__293block378:
        ; < Command = 11 xx xxxx > :
        ; if { {{ command >> 3 }} & 7 = 7 } start
        rrf main__command,w
        movwf main__380byte2
        rrf main__380byte2,f
        rrf main__380byte2,w
        andlw 7
        movwf main__380byte1
        movlw 7
        subwf main__380byte1,w
        ; expression=`{ {{ command >> 3 }} & 7 = 7 }' exp_delay=9 true_delay=38  false_delay=0 true_size=37 false_size=0
        btfss z___byte,z___bit
        goto label380__3end
        ; if { {{ command >> 3 }} & 7 = 7 } body start
        ; Command = 1111 1 xxx :
        ; switch { command & 7 }
        movlw 7
        andwf main__command,w
        ; case 0
        ; case 1
        ; case 2
        ; case 3
        ; case 4
        ; case 5
        ; case 6
        ; case 7
        goto switch__382block_start
switch__382block383:
        ; Clock Decrement < Command = 1111 1000 > :
        ;   osccal := osccal - osccal_lsb  
        movlw 252
        addwf osccal,f
        goto switch__382end
switch__382block387:
        ; Clock Increment < Command = 1111 1001 > :
        ;   osccal := osccal + osccal_lsb  
        movlw 4
        addwf osccal,f
        goto switch__382end
switch__382block391:
        ; Clock Read < Command = 1111 1010 > :
        ;   call send_byte {{ osccal }}  
        movf osccal,w
        movwf send_byte__char
        ; Switch from code bank 1 to code bank 0 before possible transfer (call)
        bcf pa0___byte,pa0___bit
        call send_byte
        ; Switch from code bank 0 to code bank 1 before possible transfer (goto)
        bsf pa0___byte,pa0___bit
        goto switch__382end
switch__382block395:
        ; Clock Pulse < Command = 1111 1011 > :
        ;   call send_byte {{ 0 }}  
        clrf send_byte__char
        ; Switch from code bank 1 to code bank 0 before possible transfer (call)
        bcf pa0___byte,pa0___bit
        call send_byte
        ; Switch from code bank 0 to code bank 1 before possible transfer (goto)
        bsf pa0___byte,pa0___bit
        goto switch__382end
switch__382block399:
        ; ID Next < Command = 1111 1100 > :
        ;   call send_byte {{ id ~~ {{ index }} }}  
        incf main__index,w
        ; Switch from code bank 1 to code bank 0 before possible transfer (call)
        bcf pa0___byte,pa0___bit
        call id
        movwf send_byte__char
        call send_byte
        ;   index := index + 1  
        incf main__index,f
        ; if { index >= id . size } start
        movlw 46
        subwf main__index,w
        ; expression=`{ index >= id . size }' exp_delay=2 true_delay=1  false_delay=0 true_size=1 false_size=0
        ; Switch from code bank 0 to code bank 1 before possible transfer (btfsc)
        bsf pa0___byte,pa0___bit
        btfsc c___byte,c___bit
        ; if { index >= id . size } body start
        ;   index := 0  
        clrf main__index
        ; if { index >= id . size } body end
        ; if exp=` index >= id . size ' false skip delay=4
        ; Other expression=`{ index >= id . size }' delay=4
        ; if { index >= id . size } end
        goto switch__382end
switch__382block407:
        ; ID Reset < Command = 1111 1101 > :
        ;   index := 0  
        clrf main__index
        goto switch__382end
switch__382block411:
        ; Glitch Read < Command = 1111 1110 > :
        ;   call send_byte {{ glitch }}  
        movf main__glitch,w
        movwf send_byte__char
        ; Switch from code bank 1 to code bank 0 before possible transfer (call)
        bcf pa0___byte,pa0___bit
        call send_byte
        ;   glitch := 0  
        clrf main__glitch
        ; Switch from code bank 0 to code bank 1 before possible transfer (goto)
        bsf pa0___byte,pa0___bit
        goto switch__382end
switch__382block416:
        ; Glitch < Command = 1111 1111 > :
        ; if { glitch != 0xff } start
        incf main__glitch,w
        ; expression=`{ glitch != 0xff }' exp_delay=1 true_delay=1  false_delay=0 true_size=1 false_size=0
        btfss z___byte,z___bit
        ; if { glitch != 0xff } body start
        ;   glitch := glitch + 1  
        incf main__glitch,f
        ; if { glitch != 0xff } body end
        ; if exp=` glitch != 0xff ' false skip delay=3
        ; Other expression=`{ glitch != 0xff }' delay=3
        ; if { glitch != 0xff } end
switch__382end:
        ; if { {{ command >> 3 }} & 7 = 7 } body end
label380__3end:
        ; if exp=` {{ command >> 3 }} & 7 = 7 ' empty false
        ; Other expression=`{ {{ command >> 3 }} & 7 = 7 }' delay=-1
        ; if { {{ command >> 3 }} & 7 = 7 } end
switch__293end:
        goto main__288loop__forever
        ; loop_forever ... end
        ; procedure main end

        ; Register bank 0 used 22 bytes of 25 available bytes
        ; Register bank 1 used 0 bytes of 16 available bytes

        end

