        radix dec
global__variables__bank0 equ 8
global__variables__bank1 equ 48
global__variables__bank2 equ 80
global__variables__bank3 equ 112
global__bit__variables__bank0 equ 25
global__bit__variables__bank1 equ 61
global__bit__variables__bank2 equ 80
global__bit__variables__bank3 equ 112
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 255
        tris 6
        movlw 224
        tris 7
        ; Switch from register bank 0 to register bank 1
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
        ; 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 & William T . 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 Shaft2 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 / shaft2 / index . html}
        ; comment {}
        ; comment {for more details .}
        ; comment {}
        ; comment #############################################################################
        ;   processor pic16c505 cp = off wdte = on mclre = off fosc = intrc_no_clock  
        ; 4052=0xfd4 4095=0xfff
        __config 4052
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 :}
tmr0 equ 1
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
osccal equ 5
        ;   constant osccal_unit 4  
osccal_unit equ 4
        ; comment {Define port bit assignments :}
portb equ 6
portc equ 7
in0__byte equ 6
in0__bit equ 0
in1__byte equ 6
in1__bit equ 1
pullups__byte equ 6
pullups__bit equ 2
in2__byte equ 6
in2__bit equ 3
in3__byte equ 6
in3__bit equ 4
led0__byte equ 7
led0__bit equ 0
led1__byte equ 7
led1__bit equ 1
led2__byte equ 7
led2__bit equ 2
led3__byte equ 7
led3__bit equ 3
serial_out__byte equ 7
serial_out__bit equ 4
serial_in__byte equ 7
serial_in__bit equ 5
        ; string_constants Start
        ; Switch from register bank 1 to register bank 0
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        ; 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 , 16 , 1 , 0 , 0 , 0 , 0 , 0r'16' , 7 , 0s'Shaft2B' , 15 , 0s'Gramlich&Benson'  
id___string equ 0
id:
        addwf pcl___register,f
        ; Length = 48
        retlw 48
        ; 1
        retlw 1
        ; 0
        retlw 0
        ; 16
        retlw 16
        ; 1
        retlw 1
        ; 0
        retlw 0
        ; 0
        retlw 0
        ; 0
        retlw 0
        ; 0
        retlw 0
        ; 0r'16'
        retlw 19 ; random number
        retlw 10 ; random number
        retlw 245 ; random number
        retlw 253 ; random number
        retlw 252 ; random number
        retlw 248 ; random number
        retlw 151 ; random number
        retlw 54 ; random number
        retlw 151 ; random number
        retlw 196 ; random number
        retlw 133 ; random number
        retlw 56 ; random number
        retlw 133 ; random number
        retlw 109 ; random number
        retlw 136 ; random number
        retlw 35 ; random number
        ; 7
        retlw 7
        ; `Shaft2B'
        retlw 83
        retlw 104
        retlw 97
        retlw 102
        retlw 116
        retlw 50
        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
        ; string__constants End
        ; comment {Shaft state variables :}
shaft0 equ global__variables__bank0+0
shaft1 equ global__variables__bank0+1
        ; comment {Shaft counters :}
shaft0_high equ global__variables__bank0+2
shaft0_low equ global__variables__bank0+3
shaft1_high equ global__variables__bank0+4
shaft1_low equ global__variables__bank0+5
        ; comment {Shaft low threshold counters :}
shaft0_low_high equ global__variables__bank0+6
shaft0_low_low equ global__variables__bank0+7
shaft1_low_high equ global__variables__bank0+8
shaft1_low_low equ global__variables__bank0+9
        ; comment {Shaft high threshold counters :}
shaft0_high_high equ global__variables__bank0+10
shaft0_high_low equ global__variables__bank0+11
shaft1_high_high equ global__variables__bank0+12
shaft1_high_low equ global__variables__bank0+13
        ; comment {Interrupt and shaft direction bits :}
interrupt_pending equ global__bit__variables__bank0+0
interrupt_pending__byte equ global__bit__variables__bank0+0
interrupt_pending__bit equ 0
interrupt_enable equ global__bit__variables__bank0+0
interrupt_enable__byte equ global__bit__variables__bank0+0
interrupt_enable__bit equ 1
shaft0_direction equ global__bit__variables__bank0+0
shaft0_direction__byte equ global__bit__variables__bank0+0
shaft0_direction__bit equ 2
shaft1_direction equ global__bit__variables__bank0+0
shaft1_direction__byte equ global__bit__variables__bank0+0
shaft1_direction__bit equ 3
        ; comment {For now put all the smaller routines first so that they can live}
        ; comment {within the first 256 bytes of main memory . The PIC12C5xx chips}
        ; comment {can only call routines that are within the first 256 bytes < i . e .}
        ; comment {the first half > of the code page .}
        ;   bank 1  
        ; Default register bank is now 1
receiving equ global__bit__variables__bank1+0
receiving__byte equ global__bit__variables__bank1+0
receiving__bit equ 0

        ; procedure get_byte start
get_byte:
        ; Procedure must be called with RP0, RP1, and IRP set to register bank 1
        ; Procedure must be called with PCLATH set to code bank 0
get_byte__variables__base equ global__variables__bank1+0
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 4
        ;   arguments_none  
get_byte__0return__byte equ get_byte__bytes__base+0
        ; Wait for a character and return it .
        ; The get_byte < > procedure only waits for 9 - 2 / 3 bits . That
        ; way the next call to get_byte < > will sychronize on the start
        ; bit instead of possibly starting a little later .
get_byte__count equ get_byte__bytes__base+1
get_byte__char equ get_byte__bytes__base+2
        ; Wait for start bit :
        ;   receiving := 1  
        bsf receiving__byte,receiving__bit
        ; `while serial_in ...' start
get_byte__119while__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__119while__break
        ;   call delay {{ }}  
        ; Switch from register bank 1 to register bank 0
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        call delay
        ; Switch from register bank 0 to register bank 1
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
        goto get_byte__119while__continue
        ; if exp=`serial_in' false goto
        ; Other expression=`serial_in' delay=-1
get_byte__119while__break:
        ; `while serial_in ...' end
        ; Clear any interrupt being sent :
        ;   serial_out := 1  
        bsf serial_out__byte,serial_out__bit
        ; Skip over start bit :
        ;   call delay {{ }}  
        ; Switch from register bank 1 to register bank 0
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        call delay
        ;   call delay {{ }}  
        call delay
        ;   call delay {{ }}  
        call delay
        ; Sample in the middle third of each data bit :
        ;   char := 0  
        ; Switch from register bank 0 to register bank 1 (which contains get_byte__char)
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
        clrf get_byte__char
        ; `count_down count 8 ...' start
        movlw 8
        movwf get_byte__count
get_byte__133_loop:
        ;   call delay {{ }}  
        ; Switch from register bank 1 to register bank 0
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        call delay
        ;   char := char >> 1  
        bcf c___byte,c___bit
        ; Switch from register bank 0 to register bank 1 (which contains get_byte__char)
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
        rrf get_byte__char,f
        ; 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__137select0 equ get_byte__char+0
get_byte__char__137select0__byte equ get_byte__char+0
get_byte__char__137select0__bit equ 7
        bsf get_byte__char__137select0__byte,get_byte__char__137select0__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 {{ }}  
        ; Switch from register bank 1 to register bank 0
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        call delay
        ;   call delay {{ }}  
        call delay
        ; Switch from register bank 0 to register bank 1 (which contains get_byte__count)
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
        decfsz get_byte__count,f
        goto get_byte__133_loop
get_byte__133_done:
        ; `count_down count 8 ...' end
        ; Skip over 2 / 3 ' s of stop bit :
        ;   call delay {{ }}  
        ; Switch from register bank 1 to register bank 0
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        call delay
        ;   call delay {{ }}  
        call delay
        ;   return char  
        ; Switch from register bank 0 to register bank 1 (which contains get_byte__char)
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
        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 RP0, RP1, and IRP set to register bank 1
        ; Procedure must be called with PCLATH set to code bank 0
send_byte__variables__base equ global__variables__bank1+4
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
        ; < receiving > will be 1 if the last get / put routine was a get .
        ; Before we start transmitting a response back , we want to ensure
        ; that there has been enough time to turn the line line around .
        ; We delay the first 1 / 3 of a bit to pad out the 9 - 2 / 3 bits from
        ; for get_byte to 10 bits . We delay another 1 / 3 of a bit just
        ; for good measure . Technically , the second call to delay < >
        ; is not really needed .
        ; if { receiving } start
        ; expression=`{ receiving }' exp_delay=0 true_delay=-1  false_delay=0 true_size=3 false_size=0
        btfss receiving__byte,receiving__bit
        goto label165__0end
        ; if { receiving } body start
        ;   receiving := 0  
        bcf receiving__byte,receiving__bit
        ;   call delay {{ }}  
        ; Switch from register bank 1 to register bank 0
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        call delay
        ;   call delay {{ }}  
        call delay
        ; if { receiving } body end
        ; Switch from register bank 0 to register bank 1
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
label165__0end:
        ; if exp=`receiving' empty false
        ; Other expression=`{ receiving }' delay=-1
        ; if { receiving } end
        ; Send the start bit :
        ; 1 cycle ;
        ;   serial_out := 0  
        bcf serial_out__byte,serial_out__bit
        ;   call delay {{ }}  
        ; Switch from register bank 1 to register bank 0
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        call delay
        ;   call delay {{ }}  
        call delay
        ;   call delay {{ }}  
        call delay
        ; 2 cycles to set up loop :
        ; 1 + 2 + 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
        ; Switch from register bank 0 to register bank 1 (which contains send_byte__count)
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
        movwf send_byte__count
send_byte__182_loop:
        ; 4 cycles :
        ;   serial_out := char @ 0  
        ; Alias variable for select char @ 0
send_byte__char__184select0 equ send_byte__char+0
send_byte__char__184select0__byte equ send_byte__char+0
send_byte__char__184select0__bit equ 0
        btfss send_byte__char__184select0__byte,send_byte__char__184select0__bit
        bcf serial_out__byte,serial_out__bit
        btfsc send_byte__char__184select0__byte,send_byte__char__184select0__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 {{ }}  
        ; Switch from register bank 1 to register bank 0
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        call delay
        ;   call delay {{ }}  
        call delay
        ;   call delay {{ }}  
        call delay
        ; 3 cycles at end of loop :
        ; 4 + 2 + 3 = 9 = no NOP ' s needed :
        ; Switch from register bank 0 to register bank 1 (which contains send_byte__count)
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
        decfsz send_byte__count,f
        goto send_byte__182_loop
send_byte__182_done:
        ; `count_down count 8 ...' end
        ; Send the stop bit :
        ; nop 1
        ; Delay 1 cycles
        nop
        ; 1 cycle :
        ;   serial_out := 1  
        bsf serial_out__byte,serial_out__bit
        ; 2 cycles call / return :
        ; 2 cycles for argument :
        ; 1 + 2 + 2 = 5
        ;   call delay {{ }}  
        ; Switch from register bank 1 to register bank 0
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        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
        ; Switch from register bank 0 to register bank 1
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
        retlw 0
        ;   bank 0  
        ; Default register bank is now 0

        ; procedure delay start
        ; optimize 0
switch__228block_start:
        addwf pcl___register,f
        goto switch__228block229
        goto switch__228block232
        goto switch__228block240
        goto switch__228block256
switch__228block_end:
        ; switch_check 228 switch__228block_start switch__228block_end
switch__273block_start:
        addwf pcl___register,f
        goto switch__273block274
        goto switch__273block277
        goto switch__273block285
        goto switch__273block301
switch__273block_end:
        ; switch_check 273 switch__273block_start switch__273block_end
delay:
        ; Procedure must be called with RP0, RP1, and IRP set to register bank 0
        ; Procedure must be called with PCLATH set to code bank 0
delay__variables__base equ global__variables__bank0+14
delay__bytes__base equ delay__variables__base+0
delay__bits__base equ delay__variables__base+2
delay__total__bytes equ 3
delay__324byte6 equ delay__bytes__base+1
delay__315byte6 equ delay__bytes__base+1
delay__321byte6 equ delay__bytes__base+1
delay__312byte2 equ delay__bytes__base+1
delay__273byte0 equ delay__bytes__base+1
delay__268byte0 equ delay__bytes__base+1
delay__228byte0 equ delay__bytes__base+1
delay__318byte6 equ delay__bytes__base+1
delay__274byte1 equ delay__bytes__base+1
delay__229byte1 equ delay__bytes__base+1
        ;   arguments_none  
        ;   uniform_delay delay_instructions  
        ; Uniform delay remaining = 131 Accumulated Delay = 0
        ; Uniform delay remaining = 131 Accumulated Delay = 0
        ; This procedure will delay for 1 / 3 of a bit time .
        ; Uniform delay remaining = 131 Accumulated Delay = 0
        ; Uniform delay remaining = 131 Accumulated Delay = 0
delay__temp equ delay__bytes__base+0
        ; Uniform delay remaining = 131 Accumulated Delay = 0
delay__alternate equ delay__bits__base+0
delay__alternate__byte equ delay__bits__base+0
delay__alternate__bit equ 4
        ; 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
        ; Process shaft 0 :
        ; Uniform delay remaining = 130 Accumulated Delay = 1
        ;   temp := portb & 3  
        movlw 3
        andwf portb,w
        movwf delay__temp
        ; Uniform delay remaining = 127 Accumulated Delay = 4
        ; Convert 2 - bit grey code into 2 - bit binary :
        ; Uniform delay remaining = 127 Accumulated Delay = 4
        ; if { temp @ 1 } start
        ; Alias variable for select temp @ 1
delay__temp__225select0 equ delay__temp+0
delay__temp__225select0__byte equ delay__temp+0
delay__temp__225select0__bit equ 1
        ; expression=`{ temp @ 1 }' exp_delay=0 true_delay=2  false_delay=0 true_size=2 false_size=0
        btfsc delay__temp__225select0__byte,delay__temp__225select0__bit
        goto label225__1true
label225__1false:
        ; Delay 1 cycles
        nop
        goto label225__1end
label225__1true:
        ; if { temp @ 1 } body start
        ; Uniform delay remaining = 127 Accumulated Delay = 0
        ;   temp := temp ^ 1  
        movlw 1
        xorwf delay__temp,f
        ; Uniform delay remaining = 125 Accumulated Delay = 2
        ; Uniform delay remaining = 125 Accumulated Delay = 2
        ; if { temp @ 1 } body end
        ; if exp=` temp @ 1 ' total delay=5
        ; if exp=` temp @ 1 ' generic
label225__1end:
        ; Other expression=`{ temp @ 1 }' delay=5
        ; if { temp @ 1 } end
        ; Uniform delay remaining = 122 Accumulated Delay = 9
        ; switch { {{ shaft0 - temp }} & 3 }
        movf shaft0,w
        movwf delay__228byte0
        movf delay__temp,w
        subwf delay__228byte0,w
        andlw 3
        ; case 0
        ; case 1
        ; case 2
        ; case 3
        goto switch__228block_start
switch__228block229:
        ; Uniform delay remaining = 122 Accumulated Delay = 0
        ; Nothing changed ; do nothing :
        ; Uniform delay remaining = 122 Accumulated Delay = 0
        ; Uniform delay remaining = 122 Accumulated Delay = 0
        ; Delay 8 cycles
        movlw 2
        movwf delay__229byte1
delay__229delay0:
        decfsz delay__229byte1,f
        goto delay__229delay0
        nop
        goto switch__228end
switch__228block232:
        ; Uniform delay remaining = 122 Accumulated Delay = 0
        ; Increment :
        ; Uniform delay remaining = 122 Accumulated Delay = 0
        ;   shaft0_direction := 0  
        bcf shaft0_direction__byte,shaft0_direction__bit
        ; Uniform delay remaining = 121 Accumulated Delay = 1
        ;   shaft0_low := shaft0_low + 1  
        incf shaft0_low,f
        ; Uniform delay remaining = 120 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 = 120 Accumulated Delay = 0
        ;   shaft0_high := shaft0_high + 1  
        incf shaft0_high,f
        ; Uniform delay remaining = 119 Accumulated Delay = 1
        ; Uniform delay remaining = 119 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 = 118 Accumulated Delay = 4
        ; Uniform delay remaining = 118 Accumulated Delay = 4
        ; Delay 4 cycles
        nop
        nop
        nop
        nop
        goto switch__228end
switch__228block240:
        ; Uniform delay remaining = 122 Accumulated Delay = 0
        ; Double increment / decrement :
        ; Uniform delay remaining = 122 Accumulated Delay = 0
        ; if { shaft0_direction } start
        ; expression=`{ shaft0_direction }' exp_delay=0 true_delay=4  false_delay=4 true_size=4 false_size=4
        btfss shaft0_direction__byte,shaft0_direction__bit
        goto label242__0false
label242__0true:
        ; if { shaft0_direction } body start
        ; Uniform delay remaining = 122 Accumulated Delay = 0
        ; Double increment :
        ; Uniform delay remaining = 122 Accumulated Delay = 0
        ;   shaft0_low := shaft0_low - 2  
        movlw 254
        addwf shaft0_low,f
        ; Uniform delay remaining = 120 Accumulated Delay = 2
        ; if { ! c } start
        ; expression=`c' exp_delay=0 true_delay=0  false_delay=1 true_size=0 false_size=1
        btfss c__byte,c__bit
        ; if { ! c } body start
        ; Uniform delay remaining = 120 Accumulated Delay = 0
        ;   shaft0_high := shaft0_high - 1  
        decf shaft0_high,f
        ; Uniform delay remaining = 119 Accumulated Delay = 1
        ; Uniform delay remaining = 119 Accumulated Delay = 1
        ; if { ! c } body end
        ; if exp=`c' true skip delay=2
        ; Other expression=`c' delay=2
        ; if { ! c } end
        ; Uniform delay remaining = 118 Accumulated Delay = 4
        ; Uniform delay remaining = 118 Accumulated Delay = 4
        ; if { shaft0_direction } body end
        goto label242__0end
label242__0false:
        ; else body start
        ; Uniform delay remaining = 122 Accumulated Delay = 0
        ; Double decrement :
        ; Uniform delay remaining = 122 Accumulated Delay = 0
        ;   shaft0_low := shaft0_low + 2  
        movlw 2
        addwf shaft0_low,f
        ; Uniform delay remaining = 120 Accumulated Delay = 2
        ; if { c } start
        ; expression=`{ c }' exp_delay=0 true_delay=1  false_delay=0 true_size=1 false_size=0
        btfsc c__byte,c__bit
        ; if { c } body start
        ; Uniform delay remaining = 120 Accumulated Delay = 0
        ;   shaft0_high := shaft0_high + 1  
        incf shaft0_high,f
        ; Uniform delay remaining = 119 Accumulated Delay = 1
        ; Uniform delay remaining = 119 Accumulated Delay = 1
        ; if { c } body end
        ; if exp=`c' false skip delay=2
        ; Other expression=`{ c }' delay=2
        ; if { c } end
        ; Uniform delay remaining = 118 Accumulated Delay = 4
        ; Uniform delay remaining = 118 Accumulated Delay = 4
        ; else body end
        ; Delay 1 cycles
        nop
        ; if exp=`shaft0_direction' total delay=8
        ; if exp=`shaft0_direction' generic
label242__0end:
        ; Other expression=`{ shaft0_direction }' delay=8
        ; if { shaft0_direction } end
        ; Uniform delay remaining = 114 Accumulated Delay = 8
        ; Uniform delay remaining = 114 Accumulated Delay = 8
        goto switch__228end
switch__228block256:
        ; Uniform delay remaining = 122 Accumulated Delay = 0
        ; Decrement :
        ; Uniform delay remaining = 122 Accumulated Delay = 0
        ;   shaft0_direction := 1  
        bsf shaft0_direction__byte,shaft0_direction__bit
        ; Uniform delay remaining = 121 Accumulated Delay = 1
        ; if { shaft0_low = 0 } start
        movf shaft0_low,w
        ; expression=`{ shaft0_low = 0 }' exp_delay=1 true_delay=1  false_delay=0 true_size=1 false_size=0
        btfsc z___byte,z___bit
        ; if { shaft0_low = 0 } body start
        ; Uniform delay remaining = 121 Accumulated Delay = 0
        ;   shaft0_high := shaft0_high - 1  
        decf shaft0_high,f
        ; Uniform delay remaining = 120 Accumulated Delay = 1
        ; Uniform delay remaining = 120 Accumulated Delay = 1
        ; if { shaft0_low = 0 } body end
        ; if exp=` shaft0_low = 0 ' false skip delay=3
        ; Other expression=`{ shaft0_low = 0 }' delay=3
        ; if { shaft0_low = 0 } end
        ; Uniform delay remaining = 118 Accumulated Delay = 4
        ;   shaft0_low := shaft0_low - 1  
        decf shaft0_low,f
        ; Uniform delay remaining = 117 Accumulated Delay = 5
        ; Uniform delay remaining = 117 Accumulated Delay = 5
        ; Delay 3 cycles
        nop
        nop
        nop
        goto switch__228end
switch__228end:
        ; Total switch delay = 20 exp_delay=7 case_delay=10
        ; Uniform delay remaining = 102 Accumulated Delay = 29
        ;   shaft0 := temp  
        movf delay__temp,w
        movwf shaft0
        ; Uniform delay remaining = 100 Accumulated Delay = 31
        ; Uniform delay remaining = 100 Accumulated Delay = 31
        ; Process shaft 1 :
        ; Uniform delay remaining = 100 Accumulated Delay = 31
        ;   temp := {{ portb >> 3 }} & 3  
        rrf portb,w
        movwf delay__268byte0
        rrf delay__268byte0,f
        rrf delay__268byte0,w
        andlw 31
        andlw 3
        movwf delay__temp
        ; Uniform delay remaining = 93 Accumulated Delay = 38
        ; Convert 2 - bit grey code into 2 - bit binary :
        ; Uniform delay remaining = 93 Accumulated Delay = 38
        ; if { temp @ 1 } start
        ; Alias variable for select temp @ 1
delay__temp__270select0 equ delay__temp+0
delay__temp__270select0__byte equ delay__temp+0
delay__temp__270select0__bit equ 1
        ; expression=`{ temp @ 1 }' exp_delay=0 true_delay=2  false_delay=0 true_size=2 false_size=0
        btfsc delay__temp__270select0__byte,delay__temp__270select0__bit
        goto label270__1true
label270__1false:
        ; Delay 1 cycles
        nop
        goto label270__1end
label270__1true:
        ; if { temp @ 1 } body start
        ; Uniform delay remaining = 93 Accumulated Delay = 0
        ;   temp := temp ^ 1  
        movlw 1
        xorwf delay__temp,f
        ; Uniform delay remaining = 91 Accumulated Delay = 2
        ; Uniform delay remaining = 91 Accumulated Delay = 2
        ; if { temp @ 1 } body end
        ; if exp=` temp @ 1 ' total delay=5
        ; if exp=` temp @ 1 ' generic
label270__1end:
        ; Other expression=`{ temp @ 1 }' delay=5
        ; if { temp @ 1 } end
        ; Uniform delay remaining = 88 Accumulated Delay = 43
        ; switch { {{ shaft1 - temp }} & 3 }
        movf shaft1,w
        movwf delay__273byte0
        movf delay__temp,w
        subwf delay__273byte0,w
        andlw 3
        ; case 0
        ; case 1
        ; case 2
        ; case 3
        goto switch__273block_start
switch__273block274:
        ; Uniform delay remaining = 88 Accumulated Delay = 0
        ; Nothing changed ; do nothing :
        ; Uniform delay remaining = 88 Accumulated Delay = 0
        ; Uniform delay remaining = 88 Accumulated Delay = 0
        ; Delay 8 cycles
        movlw 2
        movwf delay__274byte1
delay__274delay0:
        decfsz delay__274byte1,f
        goto delay__274delay0
        nop
        goto switch__273end
switch__273block277:
        ; Uniform delay remaining = 88 Accumulated Delay = 0
        ; Increment :
        ; Uniform delay remaining = 88 Accumulated Delay = 0
        ;   shaft1_direction := 0  
        bcf shaft1_direction__byte,shaft1_direction__bit
        ; Uniform delay remaining = 87 Accumulated Delay = 1
        ;   shaft1_low := shaft1_low + 1  
        incf shaft1_low,f
        ; Uniform delay remaining = 86 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 = 86 Accumulated Delay = 0
        ;   shaft1_high := shaft1_high + 1  
        incf shaft1_high,f
        ; Uniform delay remaining = 85 Accumulated Delay = 1
        ; Uniform delay remaining = 85 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 = 84 Accumulated Delay = 4
        ; Uniform delay remaining = 84 Accumulated Delay = 4
        ; Delay 4 cycles
        nop
        nop
        nop
        nop
        goto switch__273end
switch__273block285:
        ; Uniform delay remaining = 88 Accumulated Delay = 0
        ; Double increment / decrement :
        ; Uniform delay remaining = 88 Accumulated Delay = 0
        ; if { shaft1_direction } start
        ; expression=`{ shaft1_direction }' exp_delay=0 true_delay=4  false_delay=4 true_size=4 false_size=4
        btfss shaft1_direction__byte,shaft1_direction__bit
        goto label287__0false
label287__0true:
        ; if { shaft1_direction } body start
        ; Uniform delay remaining = 88 Accumulated Delay = 0
        ; Double increment :
        ; Uniform delay remaining = 88 Accumulated Delay = 0
        ;   shaft1_low := shaft1_low - 2  
        movlw 254
        addwf shaft1_low,f
        ; Uniform delay remaining = 86 Accumulated Delay = 2
        ; if { ! c } start
        ; expression=`c' exp_delay=0 true_delay=0  false_delay=1 true_size=0 false_size=1
        btfss c__byte,c__bit
        ; if { ! c } body start
        ; Uniform delay remaining = 86 Accumulated Delay = 0
        ;   shaft1_high := shaft1_high - 1  
        decf shaft1_high,f
        ; Uniform delay remaining = 85 Accumulated Delay = 1
        ; Uniform delay remaining = 85 Accumulated Delay = 1
        ; if { ! c } body end
        ; if exp=`c' true skip delay=2
        ; Other expression=`c' delay=2
        ; if { ! c } end
        ; Uniform delay remaining = 84 Accumulated Delay = 4
        ; Uniform delay remaining = 84 Accumulated Delay = 4
        ; if { shaft1_direction } body end
        goto label287__0end
label287__0false:
        ; else body start
        ; Uniform delay remaining = 88 Accumulated Delay = 0
        ; Double decrement :
        ; Uniform delay remaining = 88 Accumulated Delay = 0
        ;   shaft1_low := shaft1_low + 2  
        movlw 2
        addwf shaft1_low,f
        ; Uniform delay remaining = 86 Accumulated Delay = 2
        ; if { c } start
        ; expression=`{ c }' exp_delay=0 true_delay=1  false_delay=0 true_size=1 false_size=0
        btfsc c__byte,c__bit
        ; if { c } body start
        ; Uniform delay remaining = 86 Accumulated Delay = 0
        ;   shaft1_high := shaft1_high + 1  
        incf shaft1_high,f
        ; Uniform delay remaining = 85 Accumulated Delay = 1
        ; Uniform delay remaining = 85 Accumulated Delay = 1
        ; if { c } body end
        ; if exp=`c' false skip delay=2
        ; Other expression=`{ c }' delay=2
        ; if { c } end
        ; Uniform delay remaining = 84 Accumulated Delay = 4
        ; Uniform delay remaining = 84 Accumulated Delay = 4
        ; else body end
        ; Delay 1 cycles
        nop
        ; if exp=`shaft1_direction' total delay=8
        ; if exp=`shaft1_direction' generic
label287__0end:
        ; Other expression=`{ shaft1_direction }' delay=8
        ; if { shaft1_direction } end
        ; Uniform delay remaining = 80 Accumulated Delay = 8
        ; Uniform delay remaining = 80 Accumulated Delay = 8
        goto switch__273end
switch__273block301:
        ; Uniform delay remaining = 88 Accumulated Delay = 0
        ; Decrement :
        ; Uniform delay remaining = 88 Accumulated Delay = 0
        ;   shaft1_direction := 1  
        bsf shaft1_direction__byte,shaft1_direction__bit
        ; Uniform delay remaining = 87 Accumulated Delay = 1
        ; if { shaft1_low = 0 } start
        movf shaft1_low,w
        ; expression=`{ shaft1_low = 0 }' exp_delay=1 true_delay=1  false_delay=0 true_size=1 false_size=0
        btfsc z___byte,z___bit
        ; if { shaft1_low = 0 } body start
        ; Uniform delay remaining = 87 Accumulated Delay = 0
        ;   shaft1_high := shaft1_high - 1  
        decf shaft1_high,f
        ; Uniform delay remaining = 86 Accumulated Delay = 1
        ; Uniform delay remaining = 86 Accumulated Delay = 1
        ; if { shaft1_low = 0 } body end
        ; if exp=` shaft1_low = 0 ' false skip delay=3
        ; Other expression=`{ shaft1_low = 0 }' delay=3
        ; if { shaft1_low = 0 } end
        ; Uniform delay remaining = 84 Accumulated Delay = 4
        ;   shaft1_low := shaft1_low - 1  
        decf shaft1_low,f
        ; Uniform delay remaining = 83 Accumulated Delay = 5
        ; Uniform delay remaining = 83 Accumulated Delay = 5
        ; Delay 3 cycles
        nop
        nop
        nop
        goto switch__273end
switch__273end:
        ; Total switch delay = 20 exp_delay=7 case_delay=10
        ; Uniform delay remaining = 68 Accumulated Delay = 63
        ;   shaft1 := temp  
        movf delay__temp,w
        movwf shaft1
        ; Uniform delay remaining = 66 Accumulated Delay = 65
        ; Uniform delay remaining = 66 Accumulated Delay = 65
        ; if { alternate } start
        ; expression=`{ alternate }' exp_delay=0 true_delay=57  false_delay=26 true_size=85 false_size=30
        btfsc delay__alternate__byte,delay__alternate__bit
        goto label312__0true
label312__0false:
        ; else body start
        ; Uniform delay remaining = 66 Accumulated Delay = 0
        ; Copy the bits over :
        ; Uniform delay remaining = 66 Accumulated Delay = 0
        ;   led0 := in0  
        btfss in0__byte,in0__bit
        bcf led0__byte,led0__bit
        btfsc in0__byte,in0__bit
        bsf led0__byte,led0__bit
        ; Uniform delay remaining = 62 Accumulated Delay = 4
        ;   led1 := in1  
        btfss in1__byte,in1__bit
        bcf led1__byte,led1__bit
        btfsc in1__byte,in1__bit
        bsf led1__byte,led1__bit
        ; Uniform delay remaining = 58 Accumulated Delay = 8
        ;   led2 := in2  
        btfss in2__byte,in2__bit
        bcf led2__byte,led2__bit
        btfsc in2__byte,in2__bit
        bsf led2__byte,led2__bit
        ; Uniform delay remaining = 54 Accumulated Delay = 12
        ;   led3 := in3  
        btfss in3__byte,in3__bit
        bcf led3__byte,led3__bit
        btfsc in3__byte,in3__bit
        bsf led3__byte,led3__bit
        ; Uniform delay remaining = 50 Accumulated Delay = 16
        ; Uniform delay remaining = 50 Accumulated Delay = 16
        ; Perform any interrupt :
        ; Uniform delay remaining = 50 Accumulated Delay = 16
        ;   alternate := 1  
        bsf delay__alternate__byte,delay__alternate__bit
        ; Uniform delay remaining = 49 Accumulated Delay = 17
        ; if { interrupt_pending && interrupt_enable } start
        ; expression=`interrupt_pending' exp_delay=0 true_delay=6  false_delay=5 true_size=8 false_size=1
        btfsc interrupt_pending__byte,interrupt_pending__bit
        goto label336__2true
label336__2false:
        ; Delay 2 cycles
        nop
        nop
        goto and336__0false
label336__2true:
        ; expression=`interrupt_enable' exp_delay=0 true_delay=2  false_delay=0 true_size=2 false_size=0
        btfss interrupt_enable__byte,interrupt_enable__bit
        goto label336__1false
label336__1true:
and336__0true:
        ; if { interrupt_pending && interrupt_enable } body start
        ; Uniform delay remaining = 49 Accumulated Delay = 0
        ;   serial_out := 0  
        bcf serial_out__byte,serial_out__bit
        ; Uniform delay remaining = 48 Accumulated Delay = 1
        ;   interrupt_enable := 0  
        bcf interrupt_enable__byte,interrupt_enable__bit
        ; Uniform delay remaining = 47 Accumulated Delay = 2
        ; Uniform delay remaining = 47 Accumulated Delay = 2
        ; if { interrupt_pending && interrupt_enable } body end
        goto label336__1end
label336__1false:
        ; Delay 3 cycles
        nop
        nop
        nop
        ; if exp=`interrupt_enable' total delay=6
        ; if exp=`interrupt_enable' generic
label336__1end:
        ; Other expression=`interrupt_enable' delay=6
        ; if exp=`interrupt_pending' total delay=9
        ; if exp=`interrupt_pending' generic
label336__2end:
        ; Other expression=`interrupt_pending' delay=9
and336__0false:
and336__0end:
        ; if { interrupt_pending && interrupt_enable } end
        ; Uniform delay remaining = 40 Accumulated Delay = 26
        ; Uniform delay remaining = 40 Accumulated Delay = 26
        ; else body end
        ; Delay 30 cycles
        movlw 9
        movwf delay__312byte2
delay__312delay1:
        decfsz delay__312byte2,f
        goto delay__312delay1
        nop
        nop
        goto label312__0end
label312__0true:
        ; if { alternate } body start
        ; Uniform delay remaining = 66 Accumulated Delay = 0
        ; Now do range checks :
        ; Uniform delay remaining = 66 Accumulated Delay = 0
        ;   alternate := 0  
        bcf delay__alternate__byte,delay__alternate__bit
        ; Uniform delay remaining = 65 Accumulated Delay = 1
        ; if { shaft0_high < shaft0_low_high || {{ shaft0_high = shaft0_low_high && shaft0_low < shaft0_low_low }} } start
        movf shaft0_low_high,w
        subwf shaft0_high,w
        ; expression=`shaft0_high < shaft0_low_high' exp_delay=2 true_delay=3  false_delay=9 true_size=1 false_size=12
        btfsc c___byte,c___bit
        goto label315__4false
label315__4true:
        ; Delay 7 cycles
        movlw 2
        movwf delay__315byte6
delay__315delay5:
        decfsz delay__315byte6,f
        goto delay__315delay5
        goto or315__0true
label315__4false:
        movf shaft0_high,w
        subwf shaft0_low_high,w
        ; expression=`shaft0_high = shaft0_low_high' exp_delay=2 true_delay=4  false_delay=2 true_size=4 false_size=1
        btfsc z___byte,z___bit
        goto label315__3true
label315__3false:
        ; Delay 3 cycles
        nop
        nop
        nop
        goto and315__1false
label315__3true:
        movf shaft0_low_low,w
        subwf shaft0_low,w
        ; expression=`shaft0_low < shaft0_low_low' exp_delay=2 true_delay=1  false_delay=0 true_size=1 false_size=0
        btfss c___byte,c___bit
and315__1true:
or315__0true:
        ; if { shaft0_high < shaft0_low_high || {{ shaft0_high = shaft0_low_high && shaft0_low < shaft0_low_low }} } body start
        ; Uniform delay remaining = 65 Accumulated Delay = 0
        ;   interrupt_pending := 1  
        bsf interrupt_pending__byte,interrupt_pending__bit
        ; Uniform delay remaining = 64 Accumulated Delay = 1
        ; Uniform delay remaining = 64 Accumulated Delay = 1
        ; if { shaft0_high < shaft0_low_high || {{ shaft0_high = shaft0_low_high && shaft0_low < shaft0_low_low }} } body end
        ; if exp=`shaft0_low < shaft0_low_low' false skip delay=4
        ; Other expression=`shaft0_low < shaft0_low_low' delay=4
        ; if exp=`shaft0_high = shaft0_low_high' total delay=9
        ; if exp=`shaft0_high = shaft0_low_high' generic
label315__3end:
        ; Other expression=`shaft0_high = shaft0_low_high' delay=9
and315__1false:
and315__1end:
        ; if exp=`shaft0_high < shaft0_low_high' total delay=14
        ; if exp=`shaft0_high < shaft0_low_high' generic
label315__4end:
        ; Other expression=`shaft0_high < shaft0_low_high' delay=14
or315__0false:
or315__0end:
        ; if { shaft0_high < shaft0_low_high || {{ shaft0_high = shaft0_low_high && shaft0_low < shaft0_low_low }} } end
        ; Uniform delay remaining = 51 Accumulated Delay = 15
        ; if { shaft0_high > shaft0_high_high || {{ shaft0_high = shaft0_high_high && shaft0_low > shaft0_high_low }} } start
        movf shaft0_high,w
        subwf shaft0_high_high,w
        ; expression=`shaft0_high > shaft0_high_high' exp_delay=2 true_delay=3  false_delay=9 true_size=1 false_size=12
        btfsc c___byte,c___bit
        goto label318__4false
label318__4true:
        ; Delay 7 cycles
        movlw 2
        movwf delay__318byte6
delay__318delay5:
        decfsz delay__318byte6,f
        goto delay__318delay5
        goto or318__0true
label318__4false:
        movf shaft0_high,w
        subwf shaft0_high_high,w
        ; expression=`shaft0_high = shaft0_high_high' exp_delay=2 true_delay=4  false_delay=2 true_size=4 false_size=1
        btfsc z___byte,z___bit
        goto label318__3true
label318__3false:
        ; Delay 3 cycles
        nop
        nop
        nop
        goto and318__1false
label318__3true:
        movf shaft0_low,w
        subwf shaft0_high_low,w
        ; expression=`shaft0_low > shaft0_high_low' exp_delay=2 true_delay=1  false_delay=0 true_size=1 false_size=0
        btfss c___byte,c___bit
and318__1true:
or318__0true:
        ; if { shaft0_high > shaft0_high_high || {{ shaft0_high = shaft0_high_high && shaft0_low > shaft0_high_low }} } body start
        ; Uniform delay remaining = 51 Accumulated Delay = 0
        ;   interrupt_pending := 1  
        bsf interrupt_pending__byte,interrupt_pending__bit
        ; Uniform delay remaining = 50 Accumulated Delay = 1
        ; Uniform delay remaining = 50 Accumulated Delay = 1
        ; if { shaft0_high > shaft0_high_high || {{ shaft0_high = shaft0_high_high && shaft0_low > shaft0_high_low }} } body end
        ; if exp=`shaft0_low > shaft0_high_low' false skip delay=4
        ; Other expression=`shaft0_low > shaft0_high_low' delay=4
        ; if exp=`shaft0_high = shaft0_high_high' total delay=9
        ; if exp=`shaft0_high = shaft0_high_high' generic
label318__3end:
        ; Other expression=`shaft0_high = shaft0_high_high' delay=9
and318__1false:
and318__1end:
        ; if exp=`shaft0_high > shaft0_high_high' total delay=14
        ; if exp=`shaft0_high > shaft0_high_high' generic
label318__4end:
        ; Other expression=`shaft0_high > shaft0_high_high' delay=14
or318__0false:
or318__0end:
        ; if { shaft0_high > shaft0_high_high || {{ shaft0_high = shaft0_high_high && shaft0_low > shaft0_high_low }} } end
        ; Uniform delay remaining = 37 Accumulated Delay = 29
        ; if { shaft1_high < shaft1_low_high || {{ shaft1_high = shaft1_low_high && shaft1_low < shaft1_low_low }} } start
        movf shaft1_low_high,w
        subwf shaft1_high,w
        ; expression=`shaft1_high < shaft1_low_high' exp_delay=2 true_delay=3  false_delay=9 true_size=1 false_size=12
        btfsc c___byte,c___bit
        goto label321__4false
label321__4true:
        ; Delay 7 cycles
        movlw 2
        movwf delay__321byte6
delay__321delay5:
        decfsz delay__321byte6,f
        goto delay__321delay5
        goto or321__0true
label321__4false:
        movf shaft1_high,w
        subwf shaft1_low_high,w
        ; expression=`shaft1_high = shaft1_low_high' exp_delay=2 true_delay=4  false_delay=2 true_size=4 false_size=1
        btfsc z___byte,z___bit
        goto label321__3true
label321__3false:
        ; Delay 3 cycles
        nop
        nop
        nop
        goto and321__1false
label321__3true:
        movf shaft1_low_low,w
        subwf shaft1_low,w
        ; expression=`shaft1_low < shaft1_low_low' exp_delay=2 true_delay=1  false_delay=0 true_size=1 false_size=0
        btfss c___byte,c___bit
and321__1true:
or321__0true:
        ; if { shaft1_high < shaft1_low_high || {{ shaft1_high = shaft1_low_high && shaft1_low < shaft1_low_low }} } body start
        ; Uniform delay remaining = 37 Accumulated Delay = 0
        ;   interrupt_pending := 1  
        bsf interrupt_pending__byte,interrupt_pending__bit
        ; Uniform delay remaining = 36 Accumulated Delay = 1
        ; Uniform delay remaining = 36 Accumulated Delay = 1
        ; if { shaft1_high < shaft1_low_high || {{ shaft1_high = shaft1_low_high && shaft1_low < shaft1_low_low }} } body end
        ; if exp=`shaft1_low < shaft1_low_low' false skip delay=4
        ; Other expression=`shaft1_low < shaft1_low_low' delay=4
        ; if exp=`shaft1_high = shaft1_low_high' total delay=9
        ; if exp=`shaft1_high = shaft1_low_high' generic
label321__3end:
        ; Other expression=`shaft1_high = shaft1_low_high' delay=9
and321__1false:
and321__1end:
        ; if exp=`shaft1_high < shaft1_low_high' total delay=14
        ; if exp=`shaft1_high < shaft1_low_high' generic
label321__4end:
        ; Other expression=`shaft1_high < shaft1_low_high' delay=14
or321__0false:
or321__0end:
        ; if { shaft1_high < shaft1_low_high || {{ shaft1_high = shaft1_low_high && shaft1_low < shaft1_low_low }} } end
        ; Uniform delay remaining = 23 Accumulated Delay = 43
        ; if { shaft1_high > shaft1_high_high || {{ shaft1_high = shaft1_high_high && shaft1_low > shaft1_high_low }} } start
        movf shaft1_high,w
        subwf shaft1_high_high,w
        ; expression=`shaft1_high > shaft1_high_high' exp_delay=2 true_delay=3  false_delay=9 true_size=1 false_size=12
        btfsc c___byte,c___bit
        goto label324__4false
label324__4true:
        ; Delay 7 cycles
        movlw 2
        movwf delay__324byte6
delay__324delay5:
        decfsz delay__324byte6,f
        goto delay__324delay5
        goto or324__0true
label324__4false:
        movf shaft1_high,w
        subwf shaft1_high_high,w
        ; expression=`shaft1_high = shaft1_high_high' exp_delay=2 true_delay=4  false_delay=2 true_size=4 false_size=1
        btfsc z___byte,z___bit
        goto label324__3true
label324__3false:
        ; Delay 3 cycles
        nop
        nop
        nop
        goto and324__1false
label324__3true:
        movf shaft1_low,w
        subwf shaft1_high_low,w
        ; expression=`shaft1_low > shaft1_high_low' exp_delay=2 true_delay=1  false_delay=0 true_size=1 false_size=0
        btfss c___byte,c___bit
and324__1true:
or324__0true:
        ; if { shaft1_high > shaft1_high_high || {{ shaft1_high = shaft1_high_high && shaft1_low > shaft1_high_low }} } body start
        ; Uniform delay remaining = 23 Accumulated Delay = 0
        ;   interrupt_pending := 1  
        bsf interrupt_pending__byte,interrupt_pending__bit
        ; Uniform delay remaining = 22 Accumulated Delay = 1
        ; Uniform delay remaining = 22 Accumulated Delay = 1
        ; if { shaft1_high > shaft1_high_high || {{ shaft1_high = shaft1_high_high && shaft1_low > shaft1_high_low }} } body end
        ; if exp=`shaft1_low > shaft1_high_low' false skip delay=4
        ; Other expression=`shaft1_low > shaft1_high_low' delay=4
        ; if exp=`shaft1_high = shaft1_high_high' total delay=9
        ; if exp=`shaft1_high = shaft1_high_high' generic
label324__3end:
        ; Other expression=`shaft1_high = shaft1_high_high' delay=9
and324__1false:
and324__1end:
        ; if exp=`shaft1_high > shaft1_high_high' total delay=14
        ; if exp=`shaft1_high > shaft1_high_high' generic
label324__4end:
        ; Other expression=`shaft1_high > shaft1_high_high' delay=14
or324__0false:
or324__0end:
        ; if { shaft1_high > shaft1_high_high || {{ shaft1_high = shaft1_high_high && shaft1_low > shaft1_high_low }} } end
        ; Uniform delay remaining = 9 Accumulated Delay = 57
        ; Uniform delay remaining = 9 Accumulated Delay = 57
        ; if { alternate } body end
        ; if exp=`alternate' total delay=60
        ; if exp=`alternate' generic
label312__0end:
        ; Other expression=`{ alternate }' delay=60
        ; if { alternate } end
        ; Uniform delay remaining = 6 Accumulated Delay = 125
        ; Uniform delay remaining = 6 Accumulated Delay = 125
        ; Soak up remaining 6 cycles
        ; Delay 6 cycles
        nop
        nop
        nop
        nop
        nop
        nop
        ; procedure delay end
        retlw 0
        ; optimize 1
        ; comment {The main routine can span the 256 byte boundary :}
        ;   origin 0x200  
        org 512
        ;   bank 1  
        ; Default register bank is now 1

        ; procedure main start
switch__395block_start:
        addwf pcl___register,f
        goto switch__395block396
        goto switch__395block401
        goto switch__395block406
        goto switch__395block410
        goto switch__395block414
        goto switch__395block420
        goto switch__395block426
        goto switch__395block430
switch__395block_end:
        ; switch_check 395 switch__395block_start switch__395block_end
switch__438block_start:
        addwf pcl___register,f
        goto switch__438block439
        goto switch__438block446
        goto switch__438block453
        goto switch__438block460
        goto switch__438block467
        goto switch__438block472
        goto switch__438default477
        goto switch__438default477
switch__438block_end:
        ; switch_check 438 switch__438block_start switch__438block_end
switch__484block_start:
        addwf pcl___register,f
        goto switch__484block485
        goto switch__484block491
        goto switch__484block497
        goto switch__484block503
        goto switch__484block509
        goto switch__484block514
        goto switch__484block519
        goto switch__484block524
switch__484block_end:
        ; switch_check 484 switch__484block_start switch__484block_end
switch__392block_start:
        addwf pcl___register,f
        goto switch__392block393
        goto switch__392block436
        goto switch__392block482
        goto switch__392default531
        goto switch__392default531
        goto switch__392default531
        goto switch__392default531
        goto switch__392default531
switch__392block_end:
        ; switch_check 392 switch__392block_start switch__392block_end
switch__559block_start:
        addwf pcl___register,f
        goto switch__559block560
        goto switch__559block560
        goto switch__559block565
        goto switch__559block569
switch__559block_end:
        ; switch_check 559 switch__559block_start switch__559block_end
switch__577block_start:
        addwf pcl___register,f
        goto switch__577block578
        goto switch__577block584
        goto switch__577block590
        goto switch__577block594
        goto switch__577block598
        goto switch__577block609
        goto switch__577block613
        goto switch__577block618
switch__577block_end:
        ; switch_check 577 switch__577block_start switch__577block_end
switch__542block_start:
        addwf pcl___register,f
        goto switch__542end
        goto switch__542end
        goto switch__542end
        goto switch__542end
        goto switch__542end
        goto switch__542block543
        goto switch__542block557
        goto switch__542block575
switch__542block_end:
        ; switch_check 542 switch__542block_start switch__542block_end
switch__389block_start:
        addwf pcl___register,f
        goto switch__389block390
        goto switch__389block536
        goto switch__389block536
        goto switch__389block540
switch__389block_end:
        ; switch_check 389 switch__389block_start switch__389block_end
main:
        ; Procedure must be called with RP0, RP1, and IRP set to register bank 1
        ; Procedure must be called with PCLATH set to code bank 0
main__variables__base equ global__variables__bank1+6
main__bytes__base equ main__variables__base+0
main__bits__base equ main__variables__base+7
main__total__bytes equ 7
main__545byte0 equ main__bytes__base+6
main__392byte0 equ main__bytes__base+6
main__542byte0 equ main__bytes__base+6
main__389byte0 equ main__bytes__base+6
        ;   arguments_none  
main__command equ main__bytes__base+0
main__glitch equ main__bytes__base+1
main__id_index equ main__bytes__base+2
main__high equ main__bytes__base+3
main__index equ main__bytes__base+4
main__result equ main__bytes__base+5
        ; Initialize everything :
        ;   shaft0 := 0  
        clrf shaft0
        ;   shaft0_direction := 0  
        ; Switch from register bank 1 to register bank 0 (which contains shaft0_direction__byte)
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        bcf shaft0_direction__byte,shaft0_direction__bit
        ;   shaft0_high := 0  
        clrf shaft0_high
        ;   shaft0_low := 0  
        clrf shaft0_low
        ;   shaft1 := 0  
        clrf shaft1
        ;   shaft1_high := 0  
        clrf shaft1_high
        ;   shaft1_low := 0  
        clrf shaft1_low
        ;   shaft1_direction := 0  
        bcf shaft1_direction__byte,shaft1_direction__bit
        ;   interrupt_enable := 0  
        bcf interrupt_enable__byte,interrupt_enable__bit
        ;   interrupt_pending := 0  
        bcf interrupt_pending__byte,interrupt_pending__bit
        ;   glitch := 0  
        ; Switch from register bank 0 to register bank 1 (which contains main__glitch)
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
        clrf main__glitch
        ;   id_index := 0  
        clrf main__id_index
        ; Set up pull - ups :
        ;   command := 0xff  
        movlw 255
        movwf main__command
        ; if { pullups } start
        ; expression=`{ pullups }' exp_delay=0 true_delay=1  false_delay=0 true_size=1 false_size=0
        btfsc pullups__byte,pullups__bit
        ; if { pullups } body start
        ;   command @ 6 := 0  
        ; Select command @ 6
main__command__376select0 equ main__command+0
main__command__376select0__byte equ main__command+0
main__command__376select0__bit equ 6
        bcf main__command__376select0__byte,main__command__376select0__bit
        ; if { pullups } body end
        ; if exp=`pullups' false skip delay=2
        ; Other expression=`{ pullups }' delay=2
        ; if { pullups } end
        ; inline assembly statements begin
        movf main__command,w
        option
        ; inline assembly statements end
        ; Loop waiting for commands :
        ; loop_forever ... start
main__384loop__forever:
        ; Get a command byte :
        ;   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__389byte0
        rrf main__389byte0,f
        rrf main__389byte0,w
        andlw 3
        ; case 0
        ; case 1 2
        ; case 3
        ; Switch from code bank 0 to code bank 1 before possible transfer (goto)
        bsf pa0___byte,pa0___bit
        goto switch__389block_start
switch__389block390:
        ; Command = 00 xx xxxx :
        ; switch { {{ command >> 3 }} & 7 }
        rrf main__command,w
        movwf main__392byte0
        rrf main__392byte0,f
        rrf main__392byte0,w
        andlw 7
        ; case 0
        ; case 1
        ; case 2
        goto switch__392block_start
switch__392block393:
        ; Command = 0000 0 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__395block_start
switch__395block396:
        ; Read Shaft 0 < Command = 0000 0000 > :
        ;   call send_byte {{ shaft0_high }}  
        movf shaft0_high,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
        ;   call send_byte {{ shaft0_low }}  
        movf shaft0_low,w
        movwf send_byte__char
        call send_byte
        ; Switch from code bank 0 to code bank 1 before possible transfer (goto)
        bsf pa0___byte,pa0___bit
        goto switch__395end
switch__395block401:
        ; Read Shaft 1 < Command = 0000 0001 > :
        ;   call send_byte {{ shaft1_high }}  
        movf shaft1_high,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
        ;   call send_byte {{ shaft1_low }}  
        movf shaft1_low,w
        movwf send_byte__char
        call send_byte
        ; Switch from code bank 0 to code bank 1 before possible transfer (goto)
        bsf pa0___byte,pa0___bit
        goto switch__395end
switch__395block406:
        ; Read Shaft Low 0 < Command = 0000 0010 > :
        ;   call send_byte {{ shaft0_low }}  
        movf shaft0_low,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__395end
switch__395block410:
        ; Read Shaft Low 1 < Command = 0000 0011 > :
        ;   call send_byte {{ shaft1_low }}  
        movf shaft1_low,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__395end
switch__395block414:
        ; Set Shaft 0 < Command = 0000 0100 > :
        ;   high := 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__high
        ;   shaft0_low := get_byte {{ }}  
        call get_byte
        movf get_byte__0return__byte,w
        movwf shaft0_low
        ;   shaft0_high := high  
        movf main__high,w
        movwf shaft0_high
        ; Switch from code bank 0 to code bank 1 before possible transfer (goto)
        bsf pa0___byte,pa0___bit
        goto switch__395end
switch__395block420:
        ; Set Shaft 1 < Command = 0000 0101 > :
        ;   high := 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__high
        ;   shaft1_low := get_byte {{ }}  
        call get_byte
        movf get_byte__0return__byte,w
        movwf shaft1_low
        ;   shaft1_high := high  
        movf main__high,w
        movwf shaft1_high
        ; Switch from code bank 0 to code bank 1 before possible transfer (goto)
        bsf pa0___byte,pa0___bit
        goto switch__395end
switch__395block426:
        ; Set Shaft Low 0 < Command = 0000 0110 > :
        ;   shaft0_low := 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 shaft0_low
        ; Switch from code bank 0 to code bank 1 before possible transfer (goto)
        bsf pa0___byte,pa0___bit
        goto switch__395end
switch__395block430:
        ; Set Shaft Low 1 < Command = 0000 0111 > :
        ;   shaft1_low := 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 shaft1_low
        ; Switch from code bank 0 to code bank 1 before possible transfer (goto)
        bsf pa0___byte,pa0___bit
switch__395end:
        goto switch__392end
switch__392block436:
        ; Command = 0000 1 xxx :
        ; switch { command & 7 }
        movlw 7
        andwf main__command,w
        ; case 0
        ; case 1
        ; case 2
        ; case 3
        ; case 4
        ; case 5
        goto switch__438block_start
switch__438block439:
        ; Increment Shaft 0 < Command = 0000 1000 > :
        ;   shaft0_low := shaft0_low + 1  
        incf shaft0_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
        ;   shaft0_high := shaft0_high + 1  
        incf shaft0_high,f
        ; if { z } body end
        ; if exp=`z' false skip delay=2
        ; Other expression=`{ z }' delay=2
        ; if { z } end
        goto switch__438end
switch__438block446:
        ; Increment Shaft 1 < Command = 0000 1001 > :
        ;   shaft1_low := shaft1_low + 1  
        incf shaft1_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
        ;   shaft1_high := shaft1_high + 1  
        incf shaft1_high,f
        ; if { z } body end
        ; if exp=`z' false skip delay=2
        ; Other expression=`{ z }' delay=2
        ; if { z } end
        goto switch__438end
switch__438block453:
        ; Decrement Shaft 0 < Command = 0000 1010 > :
        ; if { shaft0_low = 0 } start
        movf shaft0_low,w
        ; expression=`{ shaft0_low = 0 }' exp_delay=1 true_delay=1  false_delay=0 true_size=1 false_size=0
        btfsc z___byte,z___bit
        ; if { shaft0_low = 0 } body start
        ;   shaft0_high := shaft0_high - 1  
        decf shaft0_high,f
        ; if { shaft0_low = 0 } body end
        ; if exp=` shaft0_low = 0 ' false skip delay=3
        ; Other expression=`{ shaft0_low = 0 }' delay=3
        ; if { shaft0_low = 0 } end
        ;   shaft0_low := shaft0_low - 1  
        decf shaft0_low,f
        goto switch__438end
switch__438block460:
        ; Decrement Shaft 1 < Command = 0000 1011 > :
        ; if { shaft1_low = 0 } start
        movf shaft1_low,w
        ; expression=`{ shaft1_low = 0 }' exp_delay=1 true_delay=1  false_delay=0 true_size=1 false_size=0
        btfsc z___byte,z___bit
        ; if { shaft1_low = 0 } body start
        ;   shaft1_high := shaft1_high - 1  
        decf shaft1_high,f
        ; if { shaft1_low = 0 } body end
        ; if exp=` shaft1_low = 0 ' false skip delay=3
        ; Other expression=`{ shaft1_low = 0 }' delay=3
        ; if { shaft1_low = 0 } end
        ;   shaft1_low := shaft1_low - 1  
        decf shaft1_low,f
        goto switch__438end
switch__438block467:
        ; Clear Shaft 0 < Command = 0000 1100 > :
        ;   shaft0_low := 0  
        clrf shaft0_low
        ;   shaft0_high := 0  
        clrf shaft0_high
        goto switch__438end
switch__438block472:
        ; Clear Shaft 1 < Command = 0000 1101 > :
        ;   shaft1_low := 0  
        clrf shaft1_low
        ;   shaft1_high := 0  
        clrf shaft1_high
        goto switch__438end
switch__438default477:
        ; Command = 0000 111 x :
switch__438end:
        goto switch__392end
switch__392block482:
        ; Command = 0001 0 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__484block_start
switch__484block485:
        ; Set High Threshold 0 < Command = 0001 0000 > :
        ;   high := 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__high
        ;   shaft0_high_low := get_byte {{ }}  
        call get_byte
        movf get_byte__0return__byte,w
        ; Switch from register bank 1 to register bank 0 (which contains shaft0_high_low)
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        movwf shaft0_high_low
        ;   shaft0_high_high := high  
        ; Switch from register bank 0 to register bank 1 (which contains main__high)
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
        movf main__high,w
        ; Switch from register bank 1 to register bank 0 (which contains shaft0_high_high)
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        movwf shaft0_high_high
        ; Switch from register bank 0 to register bank 1
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
        ; Switch from code bank 0 to code bank 1 before possible transfer (goto)
        bsf pa0___byte,pa0___bit
        goto switch__484end
switch__484block491:
        ; Set High Threshold 1 < Command = 0001 0001 > :
        ;   high := 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__high
        ;   shaft1_high_low := get_byte {{ }}  
        call get_byte
        movf get_byte__0return__byte,w
        ; Switch from register bank 1 to register bank 0 (which contains shaft1_high_low)
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        movwf shaft1_high_low
        ;   shaft1_high_high := high  
        ; Switch from register bank 0 to register bank 1 (which contains main__high)
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
        movf main__high,w
        ; Switch from register bank 1 to register bank 0 (which contains shaft1_high_high)
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        movwf shaft1_high_high
        ; Switch from register bank 0 to register bank 1
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
        ; Switch from code bank 0 to code bank 1 before possible transfer (goto)
        bsf pa0___byte,pa0___bit
        goto switch__484end
switch__484block497:
        ; Set Low Threshold 0 < Command = 0001 0010 > :
        ;   high := 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__high
        ;   shaft0_low_low := get_byte {{ }}  
        call get_byte
        movf get_byte__0return__byte,w
        movwf shaft0_low_low
        ;   shaft0_low_high := high  
        movf main__high,w
        movwf shaft0_low_high
        ; Switch from code bank 0 to code bank 1 before possible transfer (goto)
        bsf pa0___byte,pa0___bit
        goto switch__484end
switch__484block503:
        ; Set Low Threshold 1 < Command = 0001 0011 > :
        ;   high := 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__high
        ;   shaft1_low_low := get_byte {{ }}  
        call get_byte
        movf get_byte__0return__byte,w
        ; Switch from register bank 1 to register bank 0 (which contains shaft1_low_low)
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        movwf shaft1_low_low
        ;   shaft1_low_high := high  
        ; Switch from register bank 0 to register bank 1 (which contains main__high)
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
        movf main__high,w
        ; Switch from register bank 1 to register bank 0 (which contains shaft1_low_high)
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        movwf shaft1_low_high
        ; Switch from register bank 0 to register bank 1
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
        ; Switch from code bank 0 to code bank 1 before possible transfer (goto)
        bsf pa0___byte,pa0___bit
        goto switch__484end
switch__484block509:
        ; Read High Threshold 0 < Command = 0001 0100 > :
        ;   call send_byte {{ shaft0_high_high }}  
        ; Switch from register bank 1 to register bank 0 (which contains shaft0_high_high)
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        movf shaft0_high_high,w
        ; Switch from register bank 0 to register bank 1 (which contains send_byte__char)
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
        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
        ;   call send_byte {{ shaft0_high_low }}  
        ; Switch from register bank 1 to register bank 0 (which contains shaft0_high_low)
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        movf shaft0_high_low,w
        ; Switch from register bank 0 to register bank 1 (which contains send_byte__char)
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
        movwf send_byte__char
        call send_byte
        ; Switch from code bank 0 to code bank 1 before possible transfer (goto)
        bsf pa0___byte,pa0___bit
        goto switch__484end
switch__484block514:
        ; Read High Threshold 1 < Command = 0001 0101 > :
        ;   call send_byte {{ shaft1_high_high }}  
        ; Switch from register bank 1 to register bank 0 (which contains shaft1_high_high)
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        movf shaft1_high_high,w
        ; Switch from register bank 0 to register bank 1 (which contains send_byte__char)
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
        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
        ;   call send_byte {{ shaft1_high_low }}  
        ; Switch from register bank 1 to register bank 0 (which contains shaft1_high_low)
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        movf shaft1_high_low,w
        ; Switch from register bank 0 to register bank 1 (which contains send_byte__char)
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
        movwf send_byte__char
        call send_byte
        ; Switch from code bank 0 to code bank 1 before possible transfer (goto)
        bsf pa0___byte,pa0___bit
        goto switch__484end
switch__484block519:
        ; Read Low Threshold 0 < Command = 0001 0110 > :
        ;   call send_byte {{ shaft0_low_high }}  
        movf shaft0_low_high,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
        ;   call send_byte {{ shaft0_low_low }}  
        movf shaft0_low_low,w
        movwf send_byte__char
        call send_byte
        ; Switch from code bank 0 to code bank 1 before possible transfer (goto)
        bsf pa0___byte,pa0___bit
        goto switch__484end
switch__484block524:
        ; Read Low Threshold 1 < Command = 0001 0111 > :
        ;   call send_byte {{ shaft1_low_high }}  
        ; Switch from register bank 1 to register bank 0 (which contains shaft1_low_high)
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        movf shaft1_low_high,w
        ; Switch from register bank 0 to register bank 1 (which contains send_byte__char)
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
        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
        ;   call send_byte {{ shaft1_low_low }}  
        ; Switch from register bank 1 to register bank 0 (which contains shaft1_low_low)
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        movf shaft1_low_low,w
        ; Switch from register bank 0 to register bank 1 (which contains send_byte__char)
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
        movwf send_byte__char
        call send_byte
        ; Switch from code bank 0 to code bank 1 before possible transfer (goto)
        bsf pa0___byte,pa0___bit
switch__484end:
        goto switch__392end
switch__392default531:
        ; Command = 001 x xxxx :
switch__392end:
        goto switch__389end
switch__389block536:
        ; Command = 01 xx xxxx or10xx xxxx :
        ; Do nothing :
        goto switch__389end
switch__389block540:
        ; Command = 11 xx xxxx :
        ; switch { {{ command >> 3 }} & 7 }
        rrf main__command,w
        movwf main__542byte0
        rrf main__542byte0,f
        rrf main__542byte0,w
        andlw 7
        ; case 5
        ; case 6
        ; case 7
        goto switch__542block_start
switch__542block543:
        ; Command = 1110 1 xxx :
        ; if { {{ command & 7 }} = 7 } start
        movlw 7
        andwf main__command,w
        movwf main__545byte0
        movlw 7
        subwf main__545byte0,w
        ; expression=`{ {{ command & 7 }} = 7 }' exp_delay=5 true_delay=-1  false_delay=0 true_size=12 false_size=0
        btfss z___byte,z___bit
        goto label545__1end
        ; if { {{ command & 7 }} = 7 } body start
        ; Return Interrupt Bits < Command = 1110 1111 > :
        ;   result := 0  
        clrf main__result
        ; if { interrupt_enable } start
        ; expression=`{ interrupt_enable }' exp_delay=0 true_delay=2  false_delay=0 true_size=2 false_size=0
        ; Switch from register bank 1 to register bank 0 (which contains interrupt_enable__byte)
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        bcf z___byte,z___bit
        btfsc interrupt_enable__byte,interrupt_enable__bit
        bsf z___byte,z___bit
        ; Switch from register bank 0 to register bank 1
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
        btfss z___byte,z___bit
        goto label548__0end
        ; if { interrupt_enable } body start
        ;   result := result | 2  
        movlw 2
        iorwf main__result,f
        ; if { interrupt_enable } body end
label548__0end:
        ; if exp=`interrupt_enable' empty false
        ; Other expression=`{ interrupt_enable }' delay=-1
        ; if { interrupt_enable } end
        ; if { interrupt_pending } start
        ; expression=`{ interrupt_pending }' exp_delay=0 true_delay=2  false_delay=0 true_size=2 false_size=0
        ; Switch from register bank 1 to register bank 0 (which contains interrupt_pending__byte)
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        bcf z___byte,z___bit
        btfsc interrupt_pending__byte,interrupt_pending__bit
        bsf z___byte,z___bit
        ; Switch from register bank 0 to register bank 1
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
        btfss z___byte,z___bit
        goto label551__0end
        ; if { interrupt_pending } body start
        ;   result := result | 1  
        movlw 1
        iorwf main__result,f
        ; if { interrupt_pending } body end
label551__0end:
        ; if exp=`interrupt_pending' empty false
        ; Other expression=`{ interrupt_pending }' delay=-1
        ; if { interrupt_pending } end
        ;   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 & 7 }} = 7 } body end
        ; Switch from code bank 0 to code bank 1 before possible transfer (label)
        bsf pa0___byte,pa0___bit
label545__1end:
        ; if exp=` {{ command & 7 }} = 7 ' empty false
        ; Other expression=`{ {{ command & 7 }} = 7 }' delay=-1
        ; if { {{ command & 7 }} = 7 } end
        goto switch__542end
switch__542block557:
        ; Shared Interrupt commands .
        ; switch { {{ command >> 1 }} & 3 }
        bcf c___byte,c___bit
        rrf main__command,w
        andlw 3
        ; case 0 1
        ; case 2
        ; case 3
        goto switch__559block_start
switch__559block560:
        ; Set Interrupt Bits < Command = 1110 00 ep > :
        ;   interrupt_enable := command @ 1  
        ; Alias variable for select command @ 1
main__command__562select0 equ main__command+0
main__command__562select0__byte equ main__command+0
main__command__562select0__bit equ 1
        ; Switch from register bank 1 to register bank 0 (which contains interrupt_enable__byte)
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        bcf interrupt_enable__byte,interrupt_enable__bit
        ; Switch from register bank 0 to register bank 1 (which contains main__command__562select0__byte)
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
        bcf z___byte,z___bit
        btfsc main__command__562select0__byte,main__command__562select0__bit
        bsf z___byte,z___bit
        ; Switch from register bank 1 to register bank 0 (which contains interrupt_enable__byte)
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        btfsc z___byte,z___bit
        bsf interrupt_enable__byte,interrupt_enable__bit
        ;   interrupt_pending := command @ 0  
        ; Alias variable for select command @ 0
main__command__563select0 equ main__command+0
main__command__563select0__byte equ main__command+0
main__command__563select0__bit equ 0
        bcf interrupt_pending__byte,interrupt_pending__bit
        ; Switch from register bank 0 to register bank 1 (which contains main__command__563select0__byte)
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
        bcf z___byte,z___bit
        btfsc main__command__563select0__byte,main__command__563select0__bit
        bsf z___byte,z___bit
        ; Switch from register bank 1 to register bank 0 (which contains interrupt_pending__byte)
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        btfsc z___byte,z___bit
        bsf interrupt_pending__byte,interrupt_pending__bit
        ; Switch from register bank 0 to register bank 1
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
        goto switch__559end
switch__559block565:
        ; Set Interrupt Pending < Command = 1110 010 p > :
        ;   interrupt_pending := command @ 0  
        ; Alias variable for select command @ 0
main__command__567select0 equ main__command+0
main__command__567select0__byte equ main__command+0
main__command__567select0__bit equ 0
        ; Switch from register bank 1 to register bank 0 (which contains interrupt_pending__byte)
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        bcf interrupt_pending__byte,interrupt_pending__bit
        ; Switch from register bank 0 to register bank 1 (which contains main__command__567select0__byte)
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
        bcf z___byte,z___bit
        btfsc main__command__567select0__byte,main__command__567select0__bit
        bsf z___byte,z___bit
        ; Switch from register bank 1 to register bank 0 (which contains interrupt_pending__byte)
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        btfsc z___byte,z___bit
        bsf interrupt_pending__byte,interrupt_pending__bit
        ; Switch from register bank 0 to register bank 1
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
        goto switch__559end
switch__559block569:
        ; Set Interrupt Enable < Command = 1110 011 e > :
        ;   interrupt_enable := command @ 0  
        ; Alias variable for select command @ 0
main__command__571select0 equ main__command+0
main__command__571select0__byte equ main__command+0
main__command__571select0__bit equ 0
        ; Switch from register bank 1 to register bank 0 (which contains interrupt_enable__byte)
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        bcf interrupt_enable__byte,interrupt_enable__bit
        ; Switch from register bank 0 to register bank 1 (which contains main__command__571select0__byte)
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
        bcf z___byte,z___bit
        btfsc main__command__571select0__byte,main__command__571select0__bit
        bsf z___byte,z___bit
        ; Switch from register bank 1 to register bank 0 (which contains interrupt_enable__byte)
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        btfsc z___byte,z___bit
        bsf interrupt_enable__byte,interrupt_enable__bit
        ; Switch from register bank 0 to register bank 1
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
switch__559end:
        goto switch__542end
switch__542block575:
        ; Shared commands < Command = 1111 1 ccc > :
        ; 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__577block_start
switch__577block578:
        ; Clock Decrement < Command = 1111 1000 > :
        ; if < osccal != 0 > <
        ;   osccal := osccal - osccal_unit  
        movlw 252
        addwf osccal,f
        ; >
        goto switch__577end
switch__577block584:
        ; Clock Increment < Command = 1111 1001 > :
        ; if < osccal + osccal_unit != 0 > <
        ;   osccal := osccal + osccal_unit  
        movlw 4
        addwf osccal,f
        ; >
        goto switch__577end
switch__577block590:
        ; 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__577end
switch__577block594:
        ; 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__577end
switch__577block598:
        ; ID Next < Command = 1111 1100 > :
        ; if { id_index >= id . size } start
        movlw 48
        subwf main__id_index,w
        ; expression=`{ id_index >= id . size }' exp_delay=2 true_delay=1  false_delay=0 true_size=1 false_size=0
        btfsc c___byte,c___bit
        ; if { id_index >= id . size } body start
        ;   id_index := 0  
        clrf main__id_index
        ; if { id_index >= id . size } body end
        ; if exp=` id_index >= id . size ' false skip delay=4
        ; Other expression=`{ id_index >= id . size }' delay=4
        ; if { id_index >= id . size } end
        ;   call send_byte {{ id ~~ {{ id_index }} }}  
        incf main__id_index,w
        ; Switch from register bank 1 to register bank 0
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        ; Switch from code bank 1 to code bank 0 before possible transfer (call)
        bcf pa0___byte,pa0___bit
        call id
        ; Switch from register bank 0 to register bank 1 (which contains send_byte__char)
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
        movwf send_byte__char
        call send_byte
        ;   id_index := id_index + 1  
        incf main__id_index,f
        ; if { id_index >= id . size } start
        movlw 48
        subwf main__id_index,w
        ; expression=`{ id_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 { id_index >= id . size } body start
        ;   id_index := 0  
        clrf main__id_index
        ; if { id_index >= id . size } body end
        ; if exp=` id_index >= id . size ' false skip delay=4
        ; Other expression=`{ id_index >= id . size }' delay=4
        ; if { id_index >= id . size } end
        goto switch__577end
switch__577block609:
        ; ID Reset < Command = 1111 1101 > :
        ;   id_index := 0  
        clrf main__id_index
        goto switch__577end
switch__577block613:
        ; 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__577end
switch__577block618:
        ; 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__577end:
switch__542end:
switch__389end:
        goto main__384loop__forever
        ; loop_forever ... end
        ; procedure main end

        ; Register bank 0 used 17 bytes of 24 available bytes
        ; Register bank 1 used 13 bytes of 16 available bytes
        ; Register bank 2 used 0 bytes of 16 available bytes
        ; Register bank 3 used 0 bytes of 16 available bytes

        end

