Loading link script "zpcode.ld"
Resolved forward reference zpLoop to void zpLoop()
Resolved forward reference zpCodeData to zpCodeData
Inlined call call __init

CONTROL FLOW GRAPH SSA

void main()
main: scope:[main]  from __start::@1
  asm { sei  }
  main::i#0 = 0
  to:main::@1
main::@1: scope:[main]  from main main::@2
  main::i#2 = phi( main/main::i#0, main::@2/main::i#1 )
  main::$0 = main::i#2 < $14
  if(main::$0) goto main::@2
  to:main::@3
main::@2: scope:[main]  from main::@1
  main::i#3 = phi( main::@1/main::i#2 )
  main::zpCode[main::i#3] = zpCodeData[main::i#3]
  main::i#1 = ++ main::i#3
  to:main::@1
main::@3: scope:[main]  from main::@1 main::@7
  if(true) goto main::@4
  to:main::@return
main::@4: scope:[main]  from main::@3 main::@4
  main::$1 = *RASTER != $ff
  if(main::$1) goto main::@4
  to:main::@5
main::@5: scope:[main]  from main::@4
  call loop
  to:main::@6
main::@6: scope:[main]  from main::@5
  call zpLoop
  to:main::@7
main::@7: scope:[main]  from main::@6
  *BG_COLOR = 0
  to:main::@3
main::@return: scope:[main]  from main::@3
  return 
  to:@return

void loop()
loop: scope:[loop]  from main::@5
  loop::i#0 = 0
  to:loop::@1
loop::@1: scope:[loop]  from loop loop::@1
  loop::i#2 = phi( loop/loop::i#0, loop::@1/loop::i#1 )
  *BG_COLOR = -- *BG_COLOR
  loop::i#1 = loop::i#2 + rangenext(0,$64)
  loop::$1 = loop::i#1 != rangelast(0,$64)
  if(loop::$1) goto loop::@1
  to:loop::@return
loop::@return: scope:[loop]  from loop::@1
  return 
  to:@return

void zpLoop()
zpLoop: scope:[zpLoop]  from main::@6
  zpLoop::i#0 = 0
  to:zpLoop::@1
zpLoop::@1: scope:[zpLoop]  from zpLoop zpLoop::@1
  zpLoop::i#2 = phi( zpLoop/zpLoop::i#0, zpLoop::@1/zpLoop::i#1 )
  *BG_COLOR = ++ *BG_COLOR
  zpLoop::i#1 = zpLoop::i#2 + rangenext(0,$64)
  zpLoop::$1 = zpLoop::i#1 != rangelast(0,$64)
  if(zpLoop::$1) goto zpLoop::@1
  to:zpLoop::@return
zpLoop::@return: scope:[zpLoop]  from zpLoop::@1
  return 
  to:@return

void __start()
__start: scope:[__start]  from
  to:__start::__init1
__start::__init1: scope:[__start]  from __start
  to:__start::@1
__start::@1: scope:[__start]  from __start::__init1
  call main
  to:__start::@2
__start::@2: scope:[__start]  from __start::@1
  to:__start::@return
__start::@return: scope:[__start]  from __start::@2
  return 
  to:@return

SYMBOL TABLE SSA
__constant char *BG_COLOR = (char *)$d020
__constant char *RASTER = (char *)$d012
void __start()
void loop()
bool loop::$1
char loop::i
char loop::i#0
char loop::i#1
char loop::i#2
void main()
bool main::$0
bool main::$1
char main::i
char main::i#0
char main::i#1
char main::i#2
char main::i#3
__constant char *main::zpCode = (char *)&zpLoop
__constant char zpCodeData[] = kickasm {{ .segmentout [segments="ZpCode"]
 }}
void zpLoop()
bool zpLoop::$1
char zpLoop::i
char zpLoop::i#0
char zpLoop::i#1
char zpLoop::i#2

Adding number conversion cast (unumber) $14 in main::$0 = main::i#2 < $14
Adding number conversion cast (unumber) $ff in main::$1 = *RASTER != $ff
Adding number conversion cast (unumber) 0 in *BG_COLOR = 0
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast *BG_COLOR = (unumber)0
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (char *) 53266
Simplifying constant pointer cast (char *) 53280
Simplifying constant integer cast $14
Simplifying constant integer cast $ff
Simplifying constant integer cast 0
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (char) $14
Finalized unsigned number type (char) $ff
Finalized unsigned number type (char) 0
Successful SSA optimization PassNFinalizeNumberTypeConversions
Alias main::i#2 = main::i#3 
Successful SSA optimization Pass2AliasElimination
Simple Condition main::$0 [4] if(main::i#2<$14) goto main::@2
Simple Condition main::$1 [9] if(*RASTER!=$ff) goto main::@4
Simple Condition loop::$1 [19] if(loop::i#1!=rangelast(0,$64)) goto loop::@1
Simple Condition zpLoop::$1 [26] if(zpLoop::i#1!=rangelast(0,$64)) goto zpLoop::@1
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant main::i#0 = 0
Constant loop::i#0 = 0
Constant zpLoop::i#0 = 0
Successful SSA optimization Pass2ConstantIdentification
if() condition always true - replacing block destination [7] if(true) goto main::@4
Successful SSA optimization Pass2ConstantIfs
Resolved ranged next value [17] loop::i#1 = ++ loop::i#2 to ++
Resolved ranged comparison value [19] if(loop::i#1!=rangelast(0,$64)) goto loop::@1 to $65
Resolved ranged next value [24] zpLoop::i#1 = ++ zpLoop::i#2 to ++
Resolved ranged comparison value [26] if(zpLoop::i#1!=rangelast(0,$64)) goto zpLoop::@1 to $65
Removing unused block main::@return
Successful SSA optimization Pass2EliminateUnusedBlocks
Removing unused procedure __start
Removing unused procedure block __start
Removing unused procedure block __start::__init1
Removing unused procedure block __start::@1
Removing unused procedure block __start::@2
Removing unused procedure block __start::@return
Successful SSA optimization PassNEliminateEmptyStart
Adding number conversion cast (unumber) $65 in [12] if(loop::i#1!=$65) goto loop::@1
Adding number conversion cast (unumber) $65 in [17] if(zpLoop::i#1!=$65) goto zpLoop::@1
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant integer cast $65
Simplifying constant integer cast $65
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (char) $65
Finalized unsigned number type (char) $65
Successful SSA optimization PassNFinalizeNumberTypeConversions
Inlining constant with var siblings main::i#0
Inlining constant with var siblings loop::i#0
Inlining constant with var siblings zpLoop::i#0
Constant inlined main::i#0 = 0
Constant inlined loop::i#0 = 0
Constant inlined zpLoop::i#0 = 0
Successful SSA optimization Pass2ConstantInlining
Added new block during phi lifting loop::@2(between loop::@1 and loop::@1)
Added new block during phi lifting zpLoop::@2(between zpLoop::@1 and zpLoop::@1)
Adding NOP phi() at start of zpLoop
Adding NOP phi() at start of main::@3
Adding NOP phi() at start of main::@5
Adding NOP phi() at start of main::@6
Adding NOP phi() at start of loop
CALL GRAPH
Calls in [main] to loop:13 zpLoop:15 

Created 3 initial phi equivalence classes
Coalesced [6] zpLoop::i#3 = zpLoop::i#1
Coalesced [19] main::i#4 = main::i#1
Coalesced [26] loop::i#3 = loop::i#1
Coalesced down to 3 phi equivalence classes
Culled Empty Block label zpLoop::@2
Culled Empty Block label main::@3
Culled Empty Block label loop::@2
Renumbering block main::@4 to main::@3
Renumbering block main::@5 to main::@4
Renumbering block main::@6 to main::@5
Renumbering block main::@7 to main::@6
Adding NOP phi() at start of zpLoop
Adding NOP phi() at start of main::@4
Adding NOP phi() at start of main::@5
Adding NOP phi() at start of loop

FINAL CONTROL FLOW GRAPH

void zpLoop()
zpLoop: scope:[zpLoop]  from main::@5
  [0] phi()
  to:zpLoop::@1
zpLoop::@1: scope:[zpLoop]  from zpLoop zpLoop::@1
  [1] zpLoop::i#2 = phi( zpLoop/0, zpLoop::@1/zpLoop::i#1 )
  [2] *BG_COLOR = ++ *BG_COLOR
  [3] zpLoop::i#1 = ++ zpLoop::i#2
  [4] if(zpLoop::i#1!=$65) goto zpLoop::@1
  to:zpLoop::@return
zpLoop::@return: scope:[zpLoop]  from zpLoop::@1
  [5] return 
  to:@return

void main()
main: scope:[main]  from
  asm { sei  }
  to:main::@1
main::@1: scope:[main]  from main main::@2
  [7] main::i#2 = phi( main/0, main::@2/main::i#1 )
  [8] if(main::i#2<$14) goto main::@2
  to:main::@3
main::@3: scope:[main]  from main::@1 main::@3 main::@6
  [9] if(*RASTER!=$ff) goto main::@3
  to:main::@4
main::@4: scope:[main]  from main::@3
  [10] phi()
  [11] call loop
  to:main::@5
main::@5: scope:[main]  from main::@4
  [12] phi()
  [13] call zpLoop
  to:main::@6
main::@6: scope:[main]  from main::@5
  [14] *BG_COLOR = 0
  to:main::@3
main::@2: scope:[main]  from main::@1
  [15] main::zpCode[main::i#2] = zpCodeData[main::i#2]
  [16] main::i#1 = ++ main::i#2
  to:main::@1

void loop()
loop: scope:[loop]  from main::@4
  [17] phi()
  to:loop::@1
loop::@1: scope:[loop]  from loop loop::@1
  [18] loop::i#2 = phi( loop/0, loop::@1/loop::i#1 )
  [19] *BG_COLOR = -- *BG_COLOR
  [20] loop::i#1 = ++ loop::i#2
  [21] if(loop::i#1!=$65) goto loop::@1
  to:loop::@return
loop::@return: scope:[loop]  from loop::@1
  [22] return 
  to:@return

null depth in calling loop Loop head: main::@3 tails: main::@6 blocks: main::@6 main::@5 main::@4 main::@3  in scope zpLoop

VARIABLE REGISTER WEIGHTS
void loop()
char loop::i
char loop::i#1 // 15001.5
char loop::i#2 // 10001.0
void main()
char main::i
char main::i#1 // 22.0
char main::i#2 // 18.333333333333332
void zpLoop()
char zpLoop::i
char zpLoop::i#1 // 1501.5
char zpLoop::i#2 // 1001.0

Initial phi equivalence classes
[ zpLoop::i#2 zpLoop::i#1 ]
[ main::i#2 main::i#1 ]
[ loop::i#2 loop::i#1 ]
Complete equivalence classes
[ zpLoop::i#2 zpLoop::i#1 ]
[ main::i#2 main::i#1 ]
[ loop::i#2 loop::i#1 ]
Allocated zp[1]:2 [ loop::i#2 loop::i#1 ]
Allocated zp[1]:3 [ zpLoop::i#2 zpLoop::i#1 ]
Allocated zp[1]:4 [ main::i#2 main::i#1 ]
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [9] if(*RASTER!=$ff) goto main::@3 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [14] *BG_COLOR = 0 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [15] main::zpCode[main::i#2] = zpCodeData[main::i#2] [ main::i#2 ] (  [ main::i#2 ] { }  ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:4 [ main::i#2 main::i#1 ]
Statement [9] if(*RASTER!=$ff) goto main::@3 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [14] *BG_COLOR = 0 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [15] main::zpCode[main::i#2] = zpCodeData[main::i#2] [ main::i#2 ] (  [ main::i#2 ] { }  ) always clobbers reg byte a 
Potential registers zp[1]:3 [ zpLoop::i#2 zpLoop::i#1 ] : zp[1]:3 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:4 [ main::i#2 main::i#1 ] : zp[1]:4 , reg byte x , reg byte y , 
Potential registers zp[1]:2 [ loop::i#2 loop::i#1 ] : zp[1]:2 , reg byte a , reg byte x , reg byte y , 

REGISTER UPLIFT SCOPES
Uplift Scope [loop] 25,002.5: zp[1]:2 [ loop::i#2 loop::i#1 ] 
Uplift Scope [zpLoop] 2,502.5: zp[1]:3 [ zpLoop::i#2 zpLoop::i#1 ] 
Uplift Scope [main] 40.33: zp[1]:4 [ main::i#2 main::i#1 ] 
Uplift Scope [] 

Uplifting [loop] best 4094 combination reg byte x [ loop::i#2 loop::i#1 ] 
Uplifting [zpLoop] best 4004 combination reg byte x [ zpLoop::i#2 zpLoop::i#1 ] 
Uplifting [main] best 3884 combination reg byte x [ main::i#2 main::i#1 ] 
Uplifting [] best 3884 combination 

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// Example showing how to use KickAsm segments to compile meant to be transfered to zeropage before execution.
// The linker-file defines the ZpCode segment to be on zeropage and does not include it directly in the PRG-file (by excluding it from the Program segment).
// Instead the compiled code is added as an array of chars in "normal" memory - and transferred to zeropage at the start of the program
  // Upstart
  .file [name="zpcode.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$0810]
.segmentdef Data [startAfter="Code"]
.segmentdef ZpCode [start=$80]
.segment Basic
:BasicUpstart(main)
.segment Code


  // Global Constants & labels
  .label RASTER = $d012
  .label BG_COLOR = $d020
.segment ZpCode
  // zpLoop
zpLoop: {
    // [1] phi from zpLoop to zpLoop::@1 [phi:zpLoop->zpLoop::@1]
  __b1_from_zpLoop:
    // [1] phi zpLoop::i#2 = 0 [phi:zpLoop->zpLoop::@1#0] -- vbuxx=vbuc1 
    ldx #0
    jmp __b1
    // [1] phi from zpLoop::@1 to zpLoop::@1 [phi:zpLoop::@1->zpLoop::@1]
  __b1_from___b1:
    // [1] phi zpLoop::i#2 = zpLoop::i#1 [phi:zpLoop::@1->zpLoop::@1#0] -- register_copy 
    jmp __b1
    // zpLoop::@1
  __b1:
    // [2] *BG_COLOR = ++ *BG_COLOR -- _deref_pbuc1=_inc__deref_pbuc1 
    inc BG_COLOR
    // [3] zpLoop::i#1 = ++ zpLoop::i#2 -- vbuxx=_inc_vbuxx 
    inx
    // [4] if(zpLoop::i#1!=$65) goto zpLoop::@1 -- vbuxx_neq_vbuc1_then_la1 
    cpx #$65
    bne __b1_from___b1
    jmp __breturn
    // zpLoop::@return
  __breturn:
    // [5] return 
    rts
}
.segment Code
  // main
main: {
    // Transfer ZP-code to zeropage
    .label zpCode = zpLoop
    // asm { sei  }
    sei
    // [7] phi from main to main::@1 [phi:main->main::@1]
  __b1_from_main:
    // [7] phi main::i#2 = 0 [phi:main->main::@1#0] -- vbuxx=vbuc1 
    ldx #0
    jmp __b1
    // main::@1
  __b1:
    // [8] if(main::i#2<$14) goto main::@2 -- vbuxx_lt_vbuc1_then_la1 
    cpx #$14
    bcc __b2
    jmp __b3
    // main::@3
  __b3:
    // [9] if(*RASTER!=$ff) goto main::@3 -- _deref_pbuc1_neq_vbuc2_then_la1 
    lda #$ff
    cmp RASTER
    bne __b3
    // [10] phi from main::@3 to main::@4 [phi:main::@3->main::@4]
  __b4_from___b3:
    jmp __b4
    // main::@4
  __b4:
    // [11] call loop
  // Call code in normal memory
    // [17] phi from main::@4 to loop [phi:main::@4->loop]
  loop_from___b4:
    jsr loop
    // [12] phi from main::@4 to main::@5 [phi:main::@4->main::@5]
  __b5_from___b4:
    jmp __b5
    // main::@5
  __b5:
    // [13] call zpLoop
  // Call code on zeropage
    // [0] phi from main::@5 to zpLoop [phi:main::@5->zpLoop]
  zpLoop_from___b5:
    jsr zpLoop
    jmp __b6
    // main::@6
  __b6:
    // [14] *BG_COLOR = 0 -- _deref_pbuc1=vbuc2 
    lda #0
    sta BG_COLOR
    jmp __b3
    // main::@2
  __b2:
    // [15] main::zpCode[main::i#2] = zpCodeData[main::i#2] -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx 
    lda zpCodeData,x
    sta zpCode,x
    // [16] main::i#1 = ++ main::i#2 -- vbuxx=_inc_vbuxx 
    inx
    // [7] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
  __b1_from___b2:
    // [7] phi main::i#2 = main::i#1 [phi:main::@2->main::@1#0] -- register_copy 
    jmp __b1
}
  // loop
// Code in "normal" memory
loop: {
    // [18] phi from loop to loop::@1 [phi:loop->loop::@1]
  __b1_from_loop:
    // [18] phi loop::i#2 = 0 [phi:loop->loop::@1#0] -- vbuxx=vbuc1 
    ldx #0
    jmp __b1
    // [18] phi from loop::@1 to loop::@1 [phi:loop::@1->loop::@1]
  __b1_from___b1:
    // [18] phi loop::i#2 = loop::i#1 [phi:loop::@1->loop::@1#0] -- register_copy 
    jmp __b1
    // loop::@1
  __b1:
    // [19] *BG_COLOR = -- *BG_COLOR -- _deref_pbuc1=_dec__deref_pbuc1 
    dec BG_COLOR
    // [20] loop::i#1 = ++ loop::i#2 -- vbuxx=_inc_vbuxx 
    inx
    // [21] if(loop::i#1!=$65) goto loop::@1 -- vbuxx_neq_vbuc1_then_la1 
    cpx #$65
    bne __b1_from___b1
    jmp __breturn
    // loop::@return
  __breturn:
    // [22] return 
    rts
}
  // File Data
.segment Data
// Array containing the zeropage code to be transferred to zeropage before execution
zpCodeData:
.segmentout [segments="ZpCode"]


ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1
Removing instruction jmp __breturn
Removing instruction jmp __b1
Removing instruction jmp __b3
Removing instruction jmp __b4
Removing instruction jmp __b5
Removing instruction jmp __b6
Removing instruction jmp __b1
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing label __b1_from___b1 with __b1
Replacing label __b1_from___b1 with __b1
Removing instruction __b1_from___b1:
Removing instruction __b4_from___b3:
Removing instruction __b5_from___b4:
Removing instruction __b1_from___b1:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __b1_from_zpLoop:
Removing instruction __breturn:
Removing instruction __b1_from_main:
Removing instruction __b4:
Removing instruction loop_from___b4:
Removing instruction __b5:
Removing instruction zpLoop_from___b5:
Removing instruction __b6:
Removing instruction __b1_from___b2:
Removing instruction __b1_from_loop:
Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
Removing instruction jmp __b1
Removing instruction jmp __b1
Succesful ASM optimization Pass5NextJumpElimination

FINAL SYMBOL TABLE
__constant char *BG_COLOR = (char *) 53280
__constant char *RASTER = (char *) 53266
void loop()
char loop::i
char loop::i#1 // reg byte x 15001.5
char loop::i#2 // reg byte x 10001.0
void main()
char main::i
char main::i#1 // reg byte x 22.0
char main::i#2 // reg byte x 18.333333333333332
__constant char *main::zpCode = (char *)&zpLoop
__constant char zpCodeData[] = kickasm {{ .segmentout [segments="ZpCode"]
 }}
void zpLoop()
char zpLoop::i
char zpLoop::i#1 // reg byte x 1501.5
char zpLoop::i#2 // reg byte x 1001.0

reg byte x [ zpLoop::i#2 zpLoop::i#1 ]
reg byte x [ main::i#2 main::i#1 ]
reg byte x [ loop::i#2 loop::i#1 ]


FINAL ASSEMBLER
Score: 2771

  // File Comments
// Example showing how to use KickAsm segments to compile meant to be transfered to zeropage before execution.
// The linker-file defines the ZpCode segment to be on zeropage and does not include it directly in the PRG-file (by excluding it from the Program segment).
// Instead the compiled code is added as an array of chars in "normal" memory - and transferred to zeropage at the start of the program
  // Upstart
  .file [name="zpcode.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$0810]
.segmentdef Data [startAfter="Code"]
.segmentdef ZpCode [start=$80]
.segment Basic
:BasicUpstart(main)
.segment Code


  // Global Constants & labels
  .label RASTER = $d012
  .label BG_COLOR = $d020
.segment ZpCode
  // zpLoop
zpLoop: {
    // [1] phi from zpLoop to zpLoop::@1 [phi:zpLoop->zpLoop::@1]
    // [1] phi zpLoop::i#2 = 0 [phi:zpLoop->zpLoop::@1#0] -- vbuxx=vbuc1 
    ldx #0
    // [1] phi from zpLoop::@1 to zpLoop::@1 [phi:zpLoop::@1->zpLoop::@1]
    // [1] phi zpLoop::i#2 = zpLoop::i#1 [phi:zpLoop::@1->zpLoop::@1#0] -- register_copy 
    // zpLoop::@1
  __b1:
    // (*BG_COLOR)++;
    // [2] *BG_COLOR = ++ *BG_COLOR -- _deref_pbuc1=_inc__deref_pbuc1 
    inc BG_COLOR
    // for(char i:0..100)
    // [3] zpLoop::i#1 = ++ zpLoop::i#2 -- vbuxx=_inc_vbuxx 
    inx
    // [4] if(zpLoop::i#1!=$65) goto zpLoop::@1 -- vbuxx_neq_vbuc1_then_la1 
    cpx #$65
    bne __b1
    // zpLoop::@return
    // }
    // [5] return 
    rts
}
.segment Code
  // main
main: {
    // Transfer ZP-code to zeropage
    .label zpCode = zpLoop
    // asm
    // asm { sei  }
    sei
    // [7] phi from main to main::@1 [phi:main->main::@1]
    // [7] phi main::i#2 = 0 [phi:main->main::@1#0] -- vbuxx=vbuc1 
    ldx #0
    // main::@1
  __b1:
    // for(char i=0;i<20;i++)
    // [8] if(main::i#2<$14) goto main::@2 -- vbuxx_lt_vbuc1_then_la1 
    cpx #$14
    bcc __b2
    // main::@3
  __b3:
    // while(*RASTER!=0xff)
    // [9] if(*RASTER!=$ff) goto main::@3 -- _deref_pbuc1_neq_vbuc2_then_la1 
    lda #$ff
    cmp RASTER
    bne __b3
    // [10] phi from main::@3 to main::@4 [phi:main::@3->main::@4]
    // main::@4
    // loop()
    // [11] call loop
  // Call code in normal memory
    // [17] phi from main::@4 to loop [phi:main::@4->loop]
    jsr loop
    // [12] phi from main::@4 to main::@5 [phi:main::@4->main::@5]
    // main::@5
    // zpLoop()
    // [13] call zpLoop
  // Call code on zeropage
    // [0] phi from main::@5 to zpLoop [phi:main::@5->zpLoop]
    jsr zpLoop
    // main::@6
    // *BG_COLOR = 0
    // [14] *BG_COLOR = 0 -- _deref_pbuc1=vbuc2 
    lda #0
    sta BG_COLOR
    jmp __b3
    // main::@2
  __b2:
    // zpCode[i] = zpCodeData[i]
    // [15] main::zpCode[main::i#2] = zpCodeData[main::i#2] -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx 
    lda zpCodeData,x
    sta zpCode,x
    // for(char i=0;i<20;i++)
    // [16] main::i#1 = ++ main::i#2 -- vbuxx=_inc_vbuxx 
    inx
    // [7] phi from main::@2 to main::@1 [phi:main::@2->main::@1]
    // [7] phi main::i#2 = main::i#1 [phi:main::@2->main::@1#0] -- register_copy 
    jmp __b1
}
  // loop
// Code in "normal" memory
loop: {
    // [18] phi from loop to loop::@1 [phi:loop->loop::@1]
    // [18] phi loop::i#2 = 0 [phi:loop->loop::@1#0] -- vbuxx=vbuc1 
    ldx #0
    // [18] phi from loop::@1 to loop::@1 [phi:loop::@1->loop::@1]
    // [18] phi loop::i#2 = loop::i#1 [phi:loop::@1->loop::@1#0] -- register_copy 
    // loop::@1
  __b1:
    // (*BG_COLOR)--;
    // [19] *BG_COLOR = -- *BG_COLOR -- _deref_pbuc1=_dec__deref_pbuc1 
    dec BG_COLOR
    // for(char i:0..100)
    // [20] loop::i#1 = ++ loop::i#2 -- vbuxx=_inc_vbuxx 
    inx
    // [21] if(loop::i#1!=$65) goto loop::@1 -- vbuxx_neq_vbuc1_then_la1 
    cpx #$65
    bne __b1
    // loop::@return
    // }
    // [22] return 
    rts
}
  // File Data
.segment Data
// Array containing the zeropage code to be transferred to zeropage before execution
zpCodeData:
.segmentout [segments="ZpCode"]


