        radix dec
global__variables__bank0 equ 7
global__variables__bank1 equ 48
global__bit__variables__bank0 equ 32
global__bit__variables__bank1 equ 55
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 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 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 Stepper1 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 / stepper1 / index . html}
        ; comment {}
        ; comment {for more details .}
        ; comment {}
        ; comment {* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
        ;   processor pic12c509 cp = off wdte = off mclre = off fosc = intrc  
        ; 10=0xa 4095=0xfff
        __config 10
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
        ; comment {Stepper bit numbers :}
        ;   constant stepper0_bit 0  
stepper0_bit equ 0
        ;   constant stepper1_bit 1  
stepper1_bit equ 1
        ;   constant stepper2_bit 2  
stepper2_bit equ 2
        ; comment {Note : on the 8 - pin PIC ' s , GPIO3 is input only :}
        ;   constant serial_in_bit 3  
serial_in_bit equ 3
        ;   constant stepper3_bit 4  
stepper3_bit equ 4
        ;   constant serial_out_bit 5  
serial_out_bit equ 5
        ; comment {Servo bit masks :}
        ;   constant stepper0_mask {{ 1 << stepper0_bit }}  
stepper0_mask equ 1
        ;   constant stepper1_mask {{ 1 << stepper1_bit }}  
stepper1_mask equ 2
        ;   constant stepper2_mask {{ 1 << stepper2_bit }}  
stepper2_mask equ 4
        ;   constant stepper3_mask {{ 1 << stepper3_bit }}  
stepper3_mask equ 16
        ;   constant serial_in_mask {{ 1 << serial_in_bit }}  
serial_in_mask equ 8
        ;   constant serial_out_mask {{ 1 << serial_out_bit }}  
serial_out_mask equ 32
        ; 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 .}
        ;   constant osccal_lsb 0x10  
osccal_lsb equ 16
        ; comment {constant osccal_lsb 0x4}
        ; comment {Define port bit assignments}
porta equ 6
stepper0__byte equ 6
stepper0__bit equ 0
stepper1__byte equ 6
stepper1__bit equ 1
stepper2__byte equ 6
stepper2__bit equ 2
stepper3__byte equ 6
stepper3__bit equ 4
serial_in__byte equ 6
serial_in__bit equ 3
serial_out__byte equ 6
serial_out__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 , 15 , 0 , 0 , 0 , 0 , 0 , 0r'16' , 9 , 0s'Stepper1A' , 15 , 0s'Gramlich&Benson'  
id___string equ 0
id:
        addwf pcl___register,f
        ; Length = 50
        retlw 50
        ; 1
        retlw 1
        ; 0
        retlw 0
        ; 15
        retlw 15
        ; 0
        retlw 0
        ; 0
        retlw 0
        ; 0
        retlw 0
        ; 0
        retlw 0
        ; 0
        retlw 0
        ; 0r'16'
        retlw 174 ; random number
        retlw 103 ; random number
        retlw 194 ; random number
        retlw 56 ; random number
        retlw 248 ; random number
        retlw 131 ; random number
        retlw 216 ; random number
        retlw 104 ; random number
        retlw 252 ; random number
        retlw 194 ; random number
        retlw 129 ; random number
        retlw 100 ; random number
        retlw 86 ; random number
        retlw 42 ; random number
        retlw 82 ; random number
        retlw 164 ; random number
        ; 9
        retlw 9
        ; `Stepper1A'
        retlw 83
        retlw 116
        retlw 101
        retlw 112
        retlw 112
        retlw 101
        retlw 114
        retlw 49
        retlw 65
        ; 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
        ;   waves = 0x10 , 4 , 2 , 1 , 0x14 , 6 , 3 , 0x11 , 0x10 , 0x14 , 4 , 6 , 2 , 3 , 1 , 0x11  
waves___string equ 52
waves:
        addwf pcl___register,f
        ; Length = 16
        retlw 16
        ; 0x10
        retlw 16
        ; 4
        retlw 4
        ; 2
        retlw 2
        ; 1
        retlw 1
        ; 0x14
        retlw 20
        ; 6
        retlw 6
        ; 3
        retlw 3
        ; 0x11
        retlw 17
        ; 0x10
        retlw 16
        ; 0x14
        retlw 20
        ; 4
        retlw 4
        ; 6
        retlw 6
        ; 2
        retlw 2
        ; 3
        retlw 3
        ; 1
        retlw 1
        ; 0x11
        retlw 17
        ; string__constants End
        ; 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 called is delay . It all fits ,}
        ; comment {but just barely .}
        ;   bank 0  
        ; Default register bank is now 0
        ; comment {Define global values that are read and written by main procedure}
        ; comment {and read by delay procedure . See comment in front of delay}
        ; comment {procedure that talks about global register accessibility .}
        ; comment {Note that servos = 4 , so we are defining 9 registers below .}
adjust_low equ global__variables__bank0+0
adjust_high equ global__variables__bank0+1
current_low equ global__variables__bank0+2
current_high equ global__variables__bank0+3
desired_low equ global__variables__bank0+4
desired_high equ global__variables__bank0+5
middle_high equ global__variables__bank0+6
middle_low equ global__variables__bank0+7
slow_rate equ global__variables__bank0+8
fast_rate equ global__variables__bank0+9
ramp_rate equ global__variables__bank0+10
ramp_amount equ global__variables__bank0+11
complement equ global__variables__bank0+12
power_down equ global__bit__variables__bank0+0
power_down__byte equ global__bit__variables__bank0+0
power_down__bit equ 0
wave_table equ global__variables__bank0+13
wave_mask equ global__variables__bank0+14
wave_offset equ global__variables__bank0+15
interrupt_pending equ global__bit__variables__bank0+0
interrupt_pending__byte equ global__bit__variables__bank0+0
interrupt_pending__bit equ 1
interrupt_enable equ global__bit__variables__bank0+0
interrupt_enable__byte equ global__bit__variables__bank0+0
interrupt_enable__bit equ 2
        ; comment {We are really tight on data registers . Push data registers}
        ; comment {into register bank 1 for every procedure execept delay to}
        ; comment {spread the register bank load .}
        ;   bank 0  
        ; Default register bank is now 0

        ; procedure get_byte start
get_byte:
        ; 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
get_byte__variables__base equ global__variables__bank0+16
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
        ; 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__146while__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__146while__break
        ;   call delay {{ }}  
        call delay
        goto get_byte__146while__continue
        ; if exp=`serial_in' false goto
        ; Other expression=`serial_in' delay=-1
get_byte__146while__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
        ; `count_down count 8 ...' start
        movlw 8
        movwf get_byte__count
get_byte__157_loop:
        ;   call delay {{ }}  
        call delay
        ;   char := char >> 1  
        bcf c___byte,c___bit
        rrf get_byte__char,f
        ; if { serial_in } start
        ; expression=`{ serial_in }' exp_delay=0 true_delay=2  false_delay=0 true_size=2 false_size=0
        btfss serial_in__byte,serial_in__bit
        goto label160__0end
        ; if { serial_in } body start
        ;   char := char | 0x80  
        movlw 128
        iorwf get_byte__char,f
        ; if { serial_in } body end
label160__0end:
        ; if exp=`serial_in' empty false
        ; Other expression=`{ serial_in }' delay=-1
        ; if { serial_in } end
        ;   call delay {{ }}  
        call delay
        ;   call delay {{ }}  
        call delay
        decfsz get_byte__count,f
        goto get_byte__157_loop
get_byte__157_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 RP0, RP1, and IRP set to register bank 0
        ; Procedure must be called with PCLATH set to code bank 0
send_byte__variables__base equ global__variables__bank0+20
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_byte__count equ send_byte__bytes__base+1
        ; This procedure will send byte to serial_out_bit .
        ; send the start bit :
        ;   serial_out := 0  
        bcf serial_out__byte,serial_out__bit
        ;   call delay {{ }}  
        call delay
        ;   call delay {{ }}  
        call delay
        ;   call delay {{ }}  
        call delay
        ; send the data :
        ; `count_down count 8 ...' start
        movlw 8
        movwf send_byte__count
send_byte__188_loop:
        ;   serial_out := char @ 0  
        ; Alias variable for select char @ 0
send_byte__char__189select0 equ send_byte__char+0
send_byte__char__189select0__byte equ send_byte__char+0
send_byte__char__189select0__bit equ 0
        btfss send_byte__char__189select0__byte,send_byte__char__189select0__bit
        bcf serial_out__byte,serial_out__bit
        btfsc send_byte__char__189select0__byte,send_byte__char__189select0__bit
        bsf serial_out__byte,serial_out__bit
        ;   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
        decfsz send_byte__count,f
        goto send_byte__188_loop
send_byte__188_done:
        ; `count_down count 8 ...' end
        ; send stop bit
        ;   serial_out := 1  
        bsf serial_out__byte,serial_out__bit
        ;   call delay {{ }}  
        call delay
        ;   call delay {{ }}  
        call delay
        ;   call delay {{ }}  
        call delay
        ; procedure send_byte end
        retlw 0
        ; comment {In order for the uniform delay stuff to work , the delay routine must have}
        ; comment {all of its local variables in register bank 0 * AND * all of the global}
        ; comment {variables it accesses in register bank 0 . That way , the uCL peep - hole}
        ; comment {optimizer never attempts to stuff in any instructions to patch up}
        ; comment {register bank accessibility . Any tweaking by the peep - hole optimizer}
        ; comment {messes up the uniform delay instruction counting .}
        ;   bank 0  
        ; Default register bank is now 0

        ; procedure delay start
        ; optimize 0
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+22
delay__bytes__base equ delay__variables__base+0
delay__bits__base equ delay__variables__base+3
delay__total__bytes equ 3
delay__226byte2 equ delay__bytes__base+1
delay__223byte1 equ delay__bytes__base+1
delay__223byte2 equ delay__bytes__base+1
delay__212byte1 equ delay__bytes__base+1
delay__223byte3 equ delay__bytes__base+2
        ;   arguments_none  
        ;   uniform_delay instructions_per_delay  
        ; Uniform delay remaining = 134 Accumulated Delay = 0
        ; Uniform delay remaining = 134 Accumulated Delay = 0
        ; This procedure will delay for a third of bit at 2400 baud .
        ; Uniform delay remaining = 134 Accumulated Delay = 0
        ; It is responsible for keeping the servo pulses going on
        ; Uniform delay remaining = 134 Accumulated Delay = 0
        ; a regular basis .
        ; Uniform delay remaining = 134 Accumulated Delay = 0
        ; Uniform delay remaining = 134 Accumulated Delay = 0
delay__counter equ delay__bytes__base+0
        ; Uniform delay remaining = 134 Accumulated Delay = 0
        ; Uniform delay remaining = 134 Accumulated Delay = 0
        ;   porta := porta & serial_out_mask | {{ waves ~~ {{ current_low & wave_mask + wave_offset }} ^ complement }}  
        movlw 32
        andwf porta,w
        movwf delay__223byte3
        movf current_low,w
        andwf wave_mask,w
        addwf wave_offset,w
        movwf delay__223byte2
        incf delay__223byte2,w
        call waves
        movwf delay__223byte1
        movf complement,w
        xorwf delay__223byte1,w
        iorwf delay__223byte3,w
        movwf porta
        ; Uniform delay remaining = 120 Accumulated Delay = 14
        ; Uniform delay remaining = 120 Accumulated Delay = 14
        ;   counter := counter - 1  
        decf delay__counter,f
        ; Uniform delay remaining = 119 Accumulated Delay = 15
        ; if { z } start
        ; expression=`{ z }' exp_delay=0 true_delay=8  false_delay=0 true_size=8 false_size=0
        btfsc z__byte,z__bit
        goto label226__0true
label226__0false:
        ; Delay 7 cycles
        movlw 2
        movwf delay__226byte2
delay__226delay1:
        decfsz delay__226byte2,f
        goto delay__226delay1
        goto label226__0end
label226__0true:
        ; if { z } body start
        ; Uniform delay remaining = 119 Accumulated Delay = 0
        ; Adjust the position :
        ; Uniform delay remaining = 119 Accumulated Delay = 0
        ;   counter := ramp_rate  
        movf ramp_rate,w
        movwf delay__counter
        ; Uniform delay remaining = 117 Accumulated Delay = 2
        ;   current_high := current_high + adjust_high  
        movf adjust_high,w
        addwf current_high,f
        ; Uniform delay remaining = 115 Accumulated Delay = 4
        ;   current_low := current_low + adjust_low  
        movf adjust_low,w
        addwf current_low,f
        ; Uniform delay remaining = 113 Accumulated Delay = 6
        ; 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 = 113 Accumulated Delay = 0
        ;   current_high := current_high + 1  
        incf current_high,f
        ; Uniform delay remaining = 112 Accumulated Delay = 1
        ; Uniform delay remaining = 112 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 = 111 Accumulated Delay = 8
        ; Uniform delay remaining = 111 Accumulated Delay = 8
        ; if { z } body end
        ; if exp=`z' total delay=11
        ; if exp=`z' generic
label226__0end:
        ; Other expression=`{ z }' delay=11
        ; if { z } end
        ; Uniform delay remaining = 108 Accumulated Delay = 26
        ; Uniform delay remaining = 108 Accumulated Delay = 26
        ; Soak up remaining 108 cycles
        ; Delay 108 cycles
        movlw 35
        movwf delay__212byte1
delay__212delay0:
        decfsz delay__212byte1,f
        goto delay__212delay0
        nop
        nop
        ; procedure delay end
        retlw 0
        ; optimize 1
        ;   bank 1  
        ; Default register bank is now 1

        ; procedure end_point_update start
end_point_update:
        ; 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
end_point_update__variables__base equ global__variables__bank1+0
end_point_update__bytes__base equ end_point_update__variables__base+0
end_point_update__bits__base equ end_point_update__variables__base+1
end_point_update__total__bytes equ 2
end_point_update__268byte0 equ end_point_update__bytes__base+0
end_point_update__264byte0 equ end_point_update__bytes__base+0
end_point_update__269byte0 equ end_point_update__bytes__base+0
end_point_update__263byte0 equ end_point_update__bytes__base+0
        ;   arguments_none  
        ; This procedure will figure out all of magic constants needed
        ; when the end - points are adjusted .
end_point_update__direction equ end_point_update__bits__base+0
end_point_update__direction__byte equ end_point_update__bits__base+0
end_point_update__direction__bit equ 0
        ; if { desired_high > current_high } start
        movf desired_high,w
        subwf current_high,w
        ; expression=`{ desired_high > current_high }' exp_delay=2 true_delay=1  false_delay=-1 true_size=1 false_size=14
        btfss c___byte,c___bit
        goto label248__0true
label248__0false:
        movf current_high,w
        subwf desired_high,w
        ; expression=`{ desired_high < current_high }' exp_delay=2 true_delay=1  false_delay=-1 true_size=1 false_size=8
        btfss c___byte,c___bit
        goto label250__0true
label250__0false:
        movf desired_low,w
        subwf current_low,w
        ; expression=`{ desired_low > current_low }' exp_delay=2 true_delay=0  false_delay=3 true_size=0 false_size=3
        btfss c___byte,c___bit
        goto label252__0end
        movf desired_low,w
        subwf current_low,w
        ; expression=`{ desired_low > current_low }' exp_delay=2 true_delay=1  false_delay=0 true_size=1 false_size=0
        btfss c___byte,c___bit
        ; else_if { desired_low > current_low } body start
        ;   direction := 1  
        ; 1 instructions found for sharing
        ; if exp=` desired_low > current_low ' false skip delay=4
        ; Other expression=`{ desired_low > current_low }' delay=4
label252__0end:
        ; if exp=` desired_low > current_low ' empty true
        ; Other expression=`{ desired_low > current_low }' delay=-1
        ; 1 shared instructions follow
        bsf end_point_update__direction__byte,end_point_update__direction__bit
        goto label250__0end
label250__0true:
        ; else_if { desired_high < current_high } body start
        ;   direction := 0  
        bcf end_point_update__direction__byte,end_point_update__direction__bit
        ; else_if { desired_high < current_high } body end
        ; if exp=` desired_high < current_high ' generic
label250__0end:
        ; Other expression=`{ desired_high < current_high }' delay=-1
        goto label248__0end
label248__0true:
        ; if { desired_high > current_high } body start
        ;   direction := 1  
        bsf end_point_update__direction__byte,end_point_update__direction__bit
        ; if { desired_high > current_high } body end
        ; if exp=` desired_high > current_high ' generic
label248__0end:
        ; Other expression=`{ desired_high > current_high }' delay=-1
        ; if { desired_high > current_high } end
        ; if { direction } start
        ; expression=`{ direction }' exp_delay=0 true_delay=12  false_delay=13 true_size=12 false_size=13
        btfss end_point_update__direction__byte,end_point_update__direction__bit
        goto label260__0false
label260__0true:
        ; if { direction } body start
        ;   adjust_high := 0  
        clrf adjust_high
        ;   adjust_low := 1  
        movlw 1
        movwf adjust_low
        ;   middle_high := desired_high - current_high  
        movf desired_high,w
        movwf end_point_update__263byte0
        movf current_high,w
        subwf end_point_update__263byte0,w
        movwf middle_high
        ;   middle_low := desired_low - current_low  
        movf desired_low,w
        movwf end_point_update__264byte0
        movf current_low,w
        subwf end_point_update__264byte0,w
        ; 1 instructions found for sharing
        goto label260__0end
label260__0false:
        ; else body start
        ;   adjust_high := 0xff  
        movlw 255
        movwf adjust_high
        ;   adjust_low := adjust_high  
        movwf adjust_low
        ;   middle_high := current_high - desired_high  
        movf current_high,w
        movwf end_point_update__268byte0
        movf desired_high,w
        subwf end_point_update__268byte0,w
        movwf middle_high
        ;   middle_low := current_low - desired_low  
        movf current_low,w
        movwf end_point_update__269byte0
        movf desired_low,w
        subwf end_point_update__269byte0,w
        ; 1 instructions found for sharing
        ; if exp=`direction' generic
label260__0end:
        ; Other expression=`{ direction }' delay=-1
        ; 1 shared instructions follow
        movwf middle_low
        ; if { direction } end
        ; 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
        ;   middle_high := middle_high + 1  
        incf middle_high,f
        ; if { ! c } body end
        ; if exp=`c' true skip delay=2
        ; Other expression=`c' delay=2
        ; if { ! c } end
        ; Divide middle by 2 :
        ; inline assembly statements begin
        bcf c___byte,c___bit
        rrf middle_high,f
        rrf middle_low,f
        ; inline assembly statements end
        ; procedure end_point_update end
        retlw 0

        ; procedure reset start
reset:
        ; 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
reset__variables__base equ global__variables__bank1+2
reset__bytes__base equ reset__variables__base+0
reset__bits__base equ reset__variables__base+0
reset__total__bytes equ 0
        ;   arguments_none  
        ;   current_low := 0  
        clrf current_low
        ;   current_high := 0  
        clrf current_high
        ;   desired_low := 0  
        clrf desired_low
        ;   desired_high := 0  
        clrf desired_high
        ;   slow_rate := 255  
        movlw 255
        movwf slow_rate
        ;   fast_rate := 255  
        movlw 255
        ; Switch from register bank 1 to register bank 0 (which contains fast_rate)
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        movwf fast_rate
        ;   ramp_rate := 1  
        movlw 1
        movwf ramp_rate
        ;   ramp_amount := 1  
        movlw 1
        movwf ramp_amount
        ;   complement := 0  
        clrf complement
        ;   wave_table := 0  
        clrf wave_table
        ;   interrupt_pending := 0  
        bcf interrupt_pending__byte,interrupt_pending__bit
        ;   interrupt_enable := 0  
        bcf interrupt_enable__byte,interrupt_enable__bit
        ; procedure reset end
        ; Switch from register bank 0 to register bank 1
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
        retlw 0
        ; 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 other routines out of the first 256 bytes , which is also}
        ; comment {a no - no of the 12 - bit PIC ' s .}
        ;   origin 0x200  
        org 512
        ;   bank 1  
        ; Default register bank is now 1

        ; procedure main start
switch__353block_start:
        addwf pcl___register,f
        goto switch__353block354
        goto switch__353block359
        goto switch__353block364
        goto switch__353block369
        goto switch__353block374
        goto switch__353block378
        goto switch__353block382
        goto switch__353block386
switch__353block_end:
        ; switch_check 353 switch__353block_start switch__353block_end
switch__394block_start:
        addwf pcl___register,f
        goto switch__394block395
        goto switch__394block399
        goto switch__394block403
        goto switch__394block407
        goto switch__394block411
        goto switch__394block415
        goto switch__394block419
        goto switch__394block423
switch__394block_end:
        ; switch_check 394 switch__394block_start switch__394block_end
switch__440block_start:
        addwf pcl___register,f
        goto switch__440block441
        goto switch__440block446
        goto switch__440block451
        goto switch__440block451
switch__440block_end:
        ; switch_check 440 switch__440block_start switch__440block_end
switch__436block_start:
        addwf pcl___register,f
        goto switch__436block437
        goto switch__436block437
        goto switch__436block437
        goto switch__436block437
        goto switch__436block458
        goto switch__436block458
        goto switch__436block462
        goto switch__436block470
switch__436block_end:
        ; switch_check 436 switch__436block_start switch__436block_end
switch__478block_start:
        addwf pcl___register,f
        goto switch__478block479
        goto switch__478block486
        goto switch__478block493
        goto switch__478block498
        goto switch__478block503
        goto switch__478block507
        goto switch__478block511
        goto switch__478block515
switch__478block_end:
        ; switch_check 478 switch__478block_start switch__478block_end
switch__349block_start:
        addwf pcl___register,f
        goto switch__349block350
        goto switch__349block392
        goto switch__349block430
        goto switch__349block430
        goto switch__349block434
        goto switch__349block476
        goto switch__349default525
        goto switch__349default525
switch__349block_end:
        ; switch_check 349 switch__349block_start switch__349block_end
switch__535block_start:
        addwf pcl___register,f
        goto switch__535block536
        goto switch__535block536
        goto switch__535block536
        goto switch__535block536
        goto switch__535block536
        goto switch__535block536
        goto switch__535block536
        goto switch__535block540
switch__535block_end:
        ; switch_check 535 switch__535block_start switch__535block_end
switch__556block_start:
        addwf pcl___register,f
        goto switch__556block557
        goto switch__556block557
        goto switch__556block562
        goto switch__556block566
switch__556block_end:
        ; switch_check 556 switch__556block_start switch__556block_end
switch__574block_start:
        addwf pcl___register,f
        goto switch__574block575
        goto switch__574block579
        goto switch__574block583
        goto switch__574block587
        goto switch__574block591
        goto switch__574block599
        goto switch__574block603
        goto switch__574block608
switch__574block_end:
        ; switch_check 574 switch__574block_start switch__574block_end
switch__532block_start:
        addwf pcl___register,f
        goto switch__532end
        goto switch__532end
        goto switch__532end
        goto switch__532end
        goto switch__532end
        goto switch__532block533
        goto switch__532block554
        goto switch__532block572
switch__532block_end:
        ; switch_check 532 switch__532block_start switch__532block_end
switch__329block_start:
        addwf pcl___register,f
        goto switch__329block330
        goto switch__329block347
        goto switch__329end
        goto switch__329block530
switch__329block_end:
        ; switch_check 329 switch__329block_start switch__329block_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+2
main__bytes__base equ main__variables__base+0
main__bits__base equ main__variables__base+5
main__total__bytes equ 5
main__532byte0 equ main__bytes__base+4
main__432byte1 equ main__bytes__base+4
main__329byte0 equ main__bytes__base+4
main__505byte1 equ main__bytes__base+4
main__349byte0 equ main__bytes__base+4
        ;   arguments_none  
main__command equ main__bytes__base+0
main__temp equ main__bytes__base+1
main__glitch equ main__bytes__base+2
main__index equ main__bytes__base+3
        ;   call reset {{ }}  
        ; Switch from code bank 1 to code bank 0 before possible transfer (call)
        bcf pa0___byte,pa0___bit
        call reset
        ;   glitch := 0  
        clrf main__glitch
        ;   index := 0  
        clrf main__index
        ; Loop around waiting for a command :
        ; loop_forever ... start
        ; Switch from code bank 0 to code bank 1 before possible transfer (label)
        bsf pa0___byte,pa0___bit
main__324loop__forever:
        ; Wait for a command byte :
        ;   command := get_byte {{ }}  
        ; 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 get_byte
        movf get_byte__0return__byte,w
        ; Switch from register bank 0 to register bank 1 (which contains main__command)
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
        movwf main__command
        ; Dispatch on the command :
        ; switch { command >> 6 }
        swapf main__command,w
        movwf main__329byte0
        rrf main__329byte0,f
        rrf main__329byte0,w
        andlw 3
        ; case 0
        ; case 1
        ; case 3
        ; Switch from code bank 0 to code bank 1 before possible transfer (goto)
        bsf pa0___byte,pa0___bit
        goto switch__329block_start
switch__329block330:
        ; Command = 01 xx xxxx :
        ; if { command @ 5 } start
        ; Alias variable for select command @ 5
main__command__332select0 equ main__command+0
main__command__332select0__byte equ main__command+0
main__command__332select0__bit equ 5
        ; expression=`{ command @ 5 }' exp_delay=0 true_delay=4  false_delay=3 true_size=4 false_size=3
        btfsc main__command__332select0__byte,main__command__332select0__bit
        goto label332__1true
label332__1false:
        ; else body start
        ; Increment Desired < Command = 000 i iiii > :
        ;   desired_low := desired_low + 1  
        incf desired_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
        ;   desired_high := desired_high + 1  
        incf desired_high,f
        ; if { z } body end
        ; if exp=`z' false skip delay=2
        ; Other expression=`{ z }' delay=2
        ; if { z } end
        ; else body end
        goto label332__1end
label332__1true:
        ; if { command @ 5 } body start
        ; Decrement Desired < Command = 001 d dddd > :
        ;   desired_low := desired_low - 1  
        decf desired_low,f
        ; if { desired_low = 0xff } start
        incf desired_low,w
        ; expression=`{ desired_low = 0xff }' exp_delay=1 true_delay=1  false_delay=0 true_size=1 false_size=0
        btfsc z___byte,z___bit
        ; if { desired_low = 0xff } body start
        ;   desired_high := desired_high - 1  
        decf desired_high,f
        ; if { desired_low = 0xff } body end
        ; if exp=` desired_low = 0xff ' false skip delay=3
        ; Other expression=`{ desired_low = 0xff }' delay=3
        ; if { desired_low = 0xff } end
        ; if { command @ 5 } body end
        ; if exp=` command @ 5 ' generic
label332__1end:
        ; Other expression=`{ command @ 5 }' delay=-1
        ; if { command @ 5 } end
        ;   call end_point_update {{ }}  
        ; Switch from code bank 1 to code bank 0 before possible transfer (call)
        bcf pa0___byte,pa0___bit
        call end_point_update
        ; Switch from code bank 0 to code bank 1 before possible transfer (goto)
        bsf pa0___byte,pa0___bit
        goto switch__329end
switch__329block347:
        ; Command = 01 xx xxxx :
        ; switch { {{ command >> 3 }} & 7 }
        rrf main__command,w
        movwf main__349byte0
        rrf main__349byte0,f
        rrf main__349byte0,w
        andlw 7
        ; case 0
        ; case 1
        ; case 2 3
        ; case 4
        ; case 5
        goto switch__349block_start
switch__349block350:
        ; Command = 0100 0 xxx :
        ;   temp := get_byte {{ }}  
        ; 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 get_byte
        movf get_byte__0return__byte,w
        ; Switch from register bank 0 to register bank 1 (which contains main__temp)
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
        movwf main__temp
        ; 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
        ; Switch from code bank 0 to code bank 1 before possible transfer (goto)
        bsf pa0___byte,pa0___bit
        goto switch__353block_start
switch__353block354:
        ; Set Desired High < Command = 0100 0000 > :
        ;   desired_high := temp  
        movf main__temp,w
        movwf desired_high
        ;   call end_point_update {{ }}  
        ; Switch from code bank 1 to code bank 0 before possible transfer (call)
        bcf pa0___byte,pa0___bit
        call end_point_update
        ; Switch from code bank 0 to code bank 1 before possible transfer (goto)
        bsf pa0___byte,pa0___bit
        goto switch__353end
switch__353block359:
        ; Set Desired Low < Command = 0100 0001 > :
        ;   desired_low := temp  
        movf main__temp,w
        movwf desired_low
        ;   call end_point_update {{ }}  
        ; Switch from code bank 1 to code bank 0 before possible transfer (call)
        bcf pa0___byte,pa0___bit
        call end_point_update
        ; Switch from code bank 0 to code bank 1 before possible transfer (goto)
        bsf pa0___byte,pa0___bit
        goto switch__353end
switch__353block364:
        ; Set Current High < Command = 0100 0010 > :
        ;   current_high := temp  
        movf main__temp,w
        movwf current_high
        ;   call end_point_update {{ }}  
        ; Switch from code bank 1 to code bank 0 before possible transfer (call)
        bcf pa0___byte,pa0___bit
        call end_point_update
        ; Switch from code bank 0 to code bank 1 before possible transfer (goto)
        bsf pa0___byte,pa0___bit
        goto switch__353end
switch__353block369:
        ; Set Current Low < Command = 0100 0011 > :
        ;   current_low := temp  
        movf main__temp,w
        movwf current_low
        ;   call end_point_update {{ }}  
        ; Switch from code bank 1 to code bank 0 before possible transfer (call)
        bcf pa0___byte,pa0___bit
        call end_point_update
        ; Switch from code bank 0 to code bank 1 before possible transfer (goto)
        bsf pa0___byte,pa0___bit
        goto switch__353end
switch__353block374:
        ; Set Slow Rate < Command = 0100 0100 > :
        ;   slow_rate := temp  
        movf main__temp,w
        movwf slow_rate
        goto switch__353end
switch__353block378:
        ; Set Fast Rate < Command = 0100 0101 > :
        ;   fast_rate := temp  
        movf main__temp,w
        ; Switch from register bank 1 to register bank 0 (which contains fast_rate)
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        movwf fast_rate
        ; Switch from register bank 0 to register bank 1
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
        goto switch__353end
switch__353block382:
        ; Set Ramp Rate < Command = 0100 0110 > :
        ;   ramp_rate := temp  
        movf main__temp,w
        ; Switch from register bank 1 to register bank 0 (which contains ramp_rate)
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        movwf ramp_rate
        ; Switch from register bank 0 to register bank 1
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
        goto switch__353end
switch__353block386:
        ; Set Ramp Amount < Command = 0100 0111 > :
        ;   ramp_amount := temp  
        movf main__temp,w
        ; Switch from register bank 1 to register bank 0 (which contains ramp_amount)
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        movwf ramp_amount
        ; Switch from register bank 0 to register bank 1
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
switch__353end:
        goto switch__349end
switch__349block392:
        ; Command = 0100 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__394block_start
switch__394block395:
        ; Read Desired High < Command = 0100 1000 > :
        ;   temp := desired_high  
        movf desired_high,w
        movwf main__temp
        goto switch__394end
switch__394block399:
        ; Read Desired Low < Command = 0100 1001 > :
        ;   temp := desired_low  
        movf desired_low,w
        movwf main__temp
        goto switch__394end
switch__394block403:
        ; Read Current High < Command = 0100 1010 > :
        ;   temp := current_high  
        movf current_high,w
        movwf main__temp
        goto switch__394end
switch__394block407:
        ; Read Current Low < Command = 0100 1011 > :
        ;   temp := current_low  
        movf current_low,w
        movwf main__temp
        goto switch__394end
switch__394block411:
        ; Read Slow Rate < Command = 0100 1100 > :
        ;   temp := slow_rate  
        movf slow_rate,w
        movwf main__temp
        goto switch__394end
switch__394block415:
        ; Read Fast Rate < Command = 0100 1101 > :
        ;   temp := fast_rate  
        ; Switch from register bank 1 to register bank 0 (which contains fast_rate)
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        movf fast_rate,w
        ; Switch from register bank 0 to register bank 1 (which contains main__temp)
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
        movwf main__temp
        goto switch__394end
switch__394block419:
        ; Read Ramp Rate < Command = 0100 1110 > :
        ;   temp := ramp_rate  
        ; Switch from register bank 1 to register bank 0 (which contains ramp_rate)
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        movf ramp_rate,w
        ; Switch from register bank 0 to register bank 1 (which contains main__temp)
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
        movwf main__temp
        goto switch__394end
switch__394block423:
        ; Read Ramp Amount < Command = 0100 1111 > :
        ;   temp := ramp_amount  
        ; Switch from register bank 1 to register bank 0 (which contains ramp_amount)
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        movf ramp_amount,w
        ; Switch from register bank 0 to register bank 1 (which contains main__temp)
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
        movwf main__temp
switch__394end:
        ;   call send_byte {{ temp }}  
        movf main__temp,w
        ; Switch from register bank 1 to register bank 0 (which contains send_byte__char)
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        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 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__349end
switch__349block430:
        ; Set Complement Mask < Command = 0101 cccc > :
        ;   complement := {{ command << 1 }} & 0x10 | command & 7  
        bcf c___byte,c___bit
        rlf main__command,w
        andlw 16
        movwf main__432byte1
        movlw 7
        andwf main__command,w
        iorwf main__432byte1,w
        ; Switch from register bank 1 to register bank 0 (which contains complement)
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        movwf complement
        ; Switch from register bank 0 to register bank 1
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
        goto switch__349end
switch__349block434:
        ; Command = 0110 0 xxx :
        ; switch { command & 7 }
        movlw 7
        andwf main__command,w
        ; case 0 1 2 3
        ; case 4 5
        ; case 6
        ; case 7
        goto switch__436block_start
switch__436block437:
        ; Set Wave Table < Command = 0110 00 ww > :
        ;   wave_table := command & 3  
        movlw 3
        andwf main__command,w
        ; Switch from register bank 1 to register bank 0 (which contains wave_table)
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        movwf wave_table
        ; switch { wave_table }
        ; case 0
        ; case 1
        ; case 2 3
        ; Switch from register bank 0 to register bank 1
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
        goto switch__440block_start
switch__440block441:
        ; Wave Drive :
        ;   wave_mask := 3  
        movlw 3
        ; Switch from register bank 1 to register bank 0 (which contains wave_mask)
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        movwf wave_mask
        ;   wave_offset := 0  
        clrf wave_offset
        ; Switch from register bank 0 to register bank 1
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
        goto switch__440end
switch__440block446:
        ; Two Phase :
        ;   wave_mask := 3  
        movlw 3
        ; Switch from register bank 1 to register bank 0 (which contains wave_mask)
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        movwf wave_mask
        ;   wave_offset := 4  
        movlw 4
        movwf wave_offset
        ; Switch from register bank 0 to register bank 1
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
        goto switch__440end
switch__440block451:
        ; Two Phase :
        ;   wave_mask := 7  
        movlw 7
        ; Switch from register bank 1 to register bank 0 (which contains wave_mask)
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        movwf wave_mask
        ;   wave_offset := 8  
        movlw 8
        movwf wave_offset
        ; Switch from register bank 0 to register bank 1
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
switch__440end:
        goto switch__436end
switch__436block458:
        ; Set Power Down Bit < Command = 0110 010 p > :
        ;   power_down := command @ 0  
        ; Alias variable for select command @ 0
main__command__460select0 equ main__command+0
main__command__460select0__byte equ main__command+0
main__command__460select0__bit equ 0
        bcf power_down__byte,power_down__bit
        btfsc main__command__460select0__byte,main__command__460select0__bit
        bsf power_down__byte,power_down__bit
        goto switch__436end
switch__436block462:
        ; Read Power Down Bit < Command = 0110 0110 > :
        ;   temp := 0  
        clrf main__temp
        ; if { power_down } start
        ; expression=`{ power_down }' exp_delay=0 true_delay=1  false_delay=0 true_size=1 false_size=0
        btfsc power_down__byte,power_down__bit
        ; if { power_down } body start
        ;   temp := temp + 1  
        incf main__temp,f
        ; if { power_down } body end
        ; if exp=`power_down' false skip delay=2
        ; Other expression=`{ power_down }' delay=2
        ; if { power_down } end
        ;   call send_byte {{ temp }}  
        movf main__temp,w
        ; Switch from register bank 1 to register bank 0 (which contains send_byte__char)
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        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 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__436end
switch__436block470:
        ; Read Wave Table < Command = 0110 0111 > :
        ;   call send_byte {{ wave_table }}  
        ; Switch from register bank 1 to register bank 0 (which contains wave_table)
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        movf wave_table,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 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
switch__436end:
        goto switch__349end
switch__349block476:
        ; Command = 0110 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__478block_start
switch__478block479:
        ; Set Desired < Command = 0110 1000 > :
        ;   temp := get_byte {{ }}  
        ; 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 get_byte
        movf get_byte__0return__byte,w
        ; Switch from register bank 0 to register bank 1 (which contains main__temp)
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
        movwf main__temp
        ;   desired_low := get_byte {{ }}  
        ; Switch from register bank 1 to register bank 0
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        call get_byte
        movf get_byte__0return__byte,w
        movwf desired_low
        ;   desired_high := temp  
        ; Switch from register bank 0 to register bank 1 (which contains main__temp)
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
        movf main__temp,w
        movwf desired_high
        ;   call end_point_update {{ }}  
        call end_point_update
        ; Switch from code bank 0 to code bank 1 before possible transfer (goto)
        bsf pa0___byte,pa0___bit
        goto switch__478end
switch__478block486:
        ; Set Current < Command = 0110 1001 > :
        ;   temp := get_byte {{ }}  
        ; 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 get_byte
        movf get_byte__0return__byte,w
        ; Switch from register bank 0 to register bank 1 (which contains main__temp)
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
        movwf main__temp
        ;   current_low := get_byte {{ }}  
        ; Switch from register bank 1 to register bank 0
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        call get_byte
        movf get_byte__0return__byte,w
        movwf current_low
        ;   current_high := temp  
        ; Switch from register bank 0 to register bank 1 (which contains main__temp)
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
        movf main__temp,w
        movwf current_high
        ;   call end_point_update {{ }}  
        call end_point_update
        ; Switch from code bank 0 to code bank 1 before possible transfer (goto)
        bsf pa0___byte,pa0___bit
        goto switch__478end
switch__478block493:
        ; Read Desired < Command = 0110 1010 > :
        ;   call send_byte {{ desired_low }}  
        movf desired_low,w
        ; Switch from register bank 1 to register bank 0 (which contains send_byte__char)
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        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 {{ desired_high }}  
        movf desired_high,w
        movwf send_byte__char
        call send_byte
        ; 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__478end
switch__478block498:
        ; Read Current < Command = 0110 1011 > :
        ;   call send_byte {{ current_low }}  
        movf current_low,w
        ; Switch from register bank 1 to register bank 0 (which contains send_byte__char)
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        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 {{ current_high }}  
        movf current_high,w
        movwf send_byte__char
        call send_byte
        ; 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__478end
switch__478block503:
        ; Read Complement Mask < Command = 0110 1100 > :
        ;   call send_byte {{ {{ complement >> 1 }} & 8 | complement & 7 }}  
        bcf c___byte,c___bit
        ; Switch from register bank 1 to register bank 0 (which contains complement)
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        rrf complement,w
        andlw 8
        ; Switch from register bank 0 to register bank 1 (which contains main__505byte1)
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
        movwf main__505byte1
        movlw 7
        ; Switch from register bank 1 to register bank 0 (which contains complement)
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        andwf complement,w
        ; Switch from register bank 0 to register bank 1 (which contains main__505byte1)
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
        iorwf main__505byte1,w
        ; Switch from register bank 1 to register bank 0 (which contains send_byte__char)
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        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 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__478end
switch__478block507:
        ; Reset < Command = 0110 1101 > :
        ;   call reset {{ }}  
        ; Switch from code bank 1 to code bank 0 before possible transfer (call)
        bcf pa0___byte,pa0___bit
        call reset
        ; Switch from code bank 0 to code bank 1 before possible transfer (goto)
        bsf pa0___byte,pa0___bit
        goto switch__478end
switch__478block511:
        ; Stop < Command = 0110 1110 > :
        ; Code to quickly stop goes here :
        goto switch__478end
switch__478block515:
        ; Clear < Command = 0110 1111 > :
        ;   current_high := 0  
        clrf current_high
        ;   current_low := 0  
        clrf current_low
        ;   desired_high := 0  
        clrf desired_high
        ;   desired_low := 0  
        clrf desired_low
        ;   call end_point_update {{ }}  
        ; Switch from code bank 1 to code bank 0 before possible transfer (call)
        bcf pa0___byte,pa0___bit
        call end_point_update
        ; Switch from code bank 0 to code bank 1 before possible transfer (goto)
        bsf pa0___byte,pa0___bit
switch__478end:
        goto switch__349end
switch__349default525:
        ; Do nothing :
switch__349end:
        goto switch__329end
switch__329block530:
        ; Command = 11 xx xxxx :
        ; switch { {{ command >> 3 }} & 7 }
        rrf main__command,w
        movwf main__532byte0
        rrf main__532byte0,f
        rrf main__532byte0,w
        andlw 7
        ; case 5
        ; case 6
        ; case 7
        goto switch__532block_start
switch__532block533:
        ; Command = 1110 1 xxx :
        ; switch { command & 7 }
        movlw 7
        andwf main__command,w
        ; case 0 1 2 3 4 5 6
        ; case 7
        goto switch__535block_start
switch__535block536:
        ; Command = 1110 10 xx , 1110 110 x , or 1110 1110 :
        ; Do nothing :
        goto switch__535end
switch__535block540:
        ; Read Interrupt Bits < Command = 1110 1111 > :
        ; if { interrupt_enable } start
        ; expression=`{ interrupt_enable }' exp_delay=0 true_delay=2  false_delay=1 true_size=2 false_size=1
        btfsc interrupt_enable__byte,interrupt_enable__bit
        goto label542__0true
label542__0false:
        ; else body start
        ;   temp := 0  
        clrf main__temp
        ; else body end
        goto label542__0end
label542__0true:
        ; if { interrupt_enable } body start
        ;   temp := 2  
        movlw 2
        movwf main__temp
        ; if { interrupt_enable } body end
        ; if exp=`interrupt_enable' generic
label542__0end:
        ; Other expression=`{ interrupt_enable }' delay=-1
        ; if { interrupt_enable } end
        ; if { interrupt_pending } start
        ; expression=`{ interrupt_pending }' exp_delay=0 true_delay=1  false_delay=0 true_size=1 false_size=0
        btfsc interrupt_pending__byte,interrupt_pending__bit
        ; if { interrupt_pending } body start
        ;   temp := temp + 1  
        incf main__temp,f
        ; if { interrupt_pending } body end
        ; if exp=`interrupt_pending' false skip delay=2
        ; Other expression=`{ interrupt_pending }' delay=2
        ; if { interrupt_pending } end
        ;   call send_byte {{ temp }}  
        movf main__temp,w
        ; Switch from register bank 1 to register bank 0 (which contains send_byte__char)
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        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 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
switch__535end:
        goto switch__532end
switch__532block554:
        ; Set Interrupt Bits < Command = 1111 0 xxx > :
        ; switch { {{ command >> 1 }} & 3 }
        bcf c___byte,c___bit
        rrf main__command,w
        andlw 3
        ; case 0 1
        ; case 2
        ; case 3
        goto switch__556block_start
switch__556block557:
        ; Set Interrupt Bits < Command = 1111 00 ep > :
        ;   interrupt_enable := command @ 1  
        ; Alias variable for select command @ 1
main__command__559select0 equ main__command+0
main__command__559select0__byte equ main__command+0
main__command__559select0__bit equ 1
        bcf interrupt_enable__byte,interrupt_enable__bit
        btfsc main__command__559select0__byte,main__command__559select0__bit
        bsf interrupt_enable__byte,interrupt_enable__bit
        ;   interrupt_pending := command @ 0  
        ; Alias variable for select command @ 0
main__command__560select0 equ main__command+0
main__command__560select0__byte equ main__command+0
main__command__560select0__bit equ 0
        bcf interrupt_pending__byte,interrupt_pending__bit
        btfsc main__command__560select0__byte,main__command__560select0__bit
        bsf interrupt_pending__byte,interrupt_pending__bit
        goto switch__556end
switch__556block562:
        ; Set Interrupt Pending < Command = 1111 010 p > :
        ;   interrupt_pending := command @ 0  
        ; Alias variable for select command @ 0
main__command__564select0 equ main__command+0
main__command__564select0__byte equ main__command+0
main__command__564select0__bit equ 0
        bcf interrupt_pending__byte,interrupt_pending__bit
        btfsc main__command__564select0__byte,main__command__564select0__bit
        bsf interrupt_pending__byte,interrupt_pending__bit
        goto switch__556end
switch__556block566:
        ; Set Interrupt Enable < Command = 1111 010 e > :
        ;   interrupt_enable := command @ 0  
        ; Alias variable for select command @ 0
main__command__568select0 equ main__command+0
main__command__568select0__byte equ main__command+0
main__command__568select0__bit equ 0
        bcf interrupt_enable__byte,interrupt_enable__bit
        btfsc main__command__568select0__byte,main__command__568select0__bit
        bsf interrupt_enable__byte,interrupt_enable__bit
switch__556end:
        goto switch__532end
switch__532block572:
        ; Shared commands < 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__574block_start
switch__574block575:
        ; Clock Decrement < Command = 1111 1000 > :
        ;   osccal := osccal - osccal_lsb  
        movlw 240
        addwf osccal,f
        goto switch__574end
switch__574block579:
        ; Clock Increment < Command = 1111 1001 > :
        ;   osccal := osccal + osccal_lsb  
        movlw 16
        addwf osccal,f
        goto switch__574end
switch__574block583:
        ; Clock Read < Command = 1111 1010 > :
        ;   call send_byte {{ osccal }}  
        movf osccal,w
        ; Switch from register bank 1 to register bank 0 (which contains send_byte__char)
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        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 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__574end
switch__574block587:
        ; Clock Pulse < Command = 1111 1011 > :
        ;   call send_byte {{ 0 }}  
        ; Switch from register bank 1 to register bank 0 (which contains send_byte__char)
        bcf rp0___byte,rp0___bit
        ; Register bank is now 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 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__574end
switch__574block591:
        ; ID Next < Command = 1111 1100 > :
        ;   call send_byte {{ id ~~ {{ index }} }}  
        incf main__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
        movwf send_byte__char
        call send_byte
        ;   index := index + 1  
        ; Switch from register bank 0 to register bank 1 (which contains main__index)
        bsf rp0___byte,rp0___bit
        ; Register bank is now 1
        incf main__index,f
        ; if { index >= id . size } start
        movlw 50
        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__574end
switch__574block599:
        ; ID Reset < Command = 1111 1101 > :
        ;   index := 0  
        clrf main__index
        goto switch__574end
switch__574block603:
        ; Glitch Read < Command = 1111 1110 > :
        ;   call send_byte {{ glitch }}  
        movf main__glitch,w
        ; Switch from register bank 1 to register bank 0 (which contains send_byte__char)
        bcf rp0___byte,rp0___bit
        ; Register bank is now 0
        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  
        ; 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
        ; Switch from code bank 0 to code bank 1 before possible transfer (goto)
        bsf pa0___byte,pa0___bit
        goto switch__574end
switch__574block608:
        ; 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__574end:
switch__532end:
switch__329end:
        goto main__324loop__forever
        ; loop_forever ... end
        ; procedure main end

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

        end

