Inlined call vicSelectGfxBank::$0 = call toDd00(vicSelectGfxBank::gfx)
Inlined call call __init
Eliminating unused variable with no statement scroll_bit::$5
Eliminating unused variable with no statement scroll_bit::$6

CONTROL FLOW GRAPH SSA

void main()
main: scope:[main]  from __start::@1
  current_chargen#31 = phi( __start::@1/current_chargen#23 )
  nxt#38 = phi( __start::@1/nxt#28 )
  current_bit#32 = phi( __start::@1/current_bit#25 )
  scroll#21 = phi( __start::@1/scroll#17 )
  fillscreen::screen#0 = SCREEN
  fillscreen::fill#0 = $20
  call fillscreen
  to:main::@4
main::@4: scope:[main]  from main
  current_chargen#30 = phi( main/current_chargen#31 )
  nxt#36 = phi( main/nxt#38 )
  current_bit#31 = phi( main/current_bit#32 )
  scroll#20 = phi( main/scroll#21 )
  to:main::@1
main::@1: scope:[main]  from main::@1 main::@4 main::@5
  current_chargen#28 = phi( main::@1/current_chargen#28, main::@4/current_chargen#30, main::@5/current_chargen#0 )
  nxt#33 = phi( main::@1/nxt#33, main::@4/nxt#36, main::@5/nxt#0 )
  current_bit#30 = phi( main::@1/current_bit#30, main::@4/current_bit#31, main::@5/current_bit#0 )
  scroll#19 = phi( main::@1/scroll#19, main::@4/scroll#20, main::@5/scroll#0 )
  main::$1 = *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_RASTER) != $fe
  if(main::$1) goto main::@1
  to:main::@2
main::@2: scope:[main]  from main::@1 main::@2
  current_chargen#24 = phi( main::@1/current_chargen#28, main::@2/current_chargen#24 )
  nxt#29 = phi( main::@1/nxt#33, main::@2/nxt#29 )
  current_bit#26 = phi( main::@1/current_bit#30, main::@2/current_bit#26 )
  scroll#18 = phi( main::@1/scroll#19, main::@2/scroll#18 )
  main::$2 = *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_RASTER) != $ff
  if(main::$2) goto main::@2
  to:main::@3
main::@3: scope:[main]  from main::@2
  current_chargen#17 = phi( main::@2/current_chargen#24 )
  nxt#23 = phi( main::@2/nxt#29 )
  current_bit#19 = phi( main::@2/current_bit#26 )
  scroll#15 = phi( main::@2/scroll#18 )
  *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR) = ++ *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR)
  call scroll_soft
  to:main::@5
main::@5: scope:[main]  from main::@3
  current_chargen#9 = phi( main::@3/current_chargen#3 )
  nxt#12 = phi( main::@3/nxt#3 )
  current_bit#10 = phi( main::@3/current_bit#3 )
  scroll#8 = phi( main::@3/scroll#4 )
  scroll#0 = scroll#8
  current_bit#0 = current_bit#10
  nxt#0 = nxt#12
  current_chargen#0 = current_chargen#9
  *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR) = -- *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR)
  if(true) goto main::@1
  to:main::@return
main::@return: scope:[main]  from main::@5
  current_chargen#10 = phi( main::@5/current_chargen#0 )
  nxt#13 = phi( main::@5/nxt#0 )
  current_bit#11 = phi( main::@5/current_bit#0 )
  scroll#9 = phi( main::@5/scroll#0 )
  scroll#1 = scroll#9
  current_bit#1 = current_bit#11
  nxt#1 = nxt#13
  current_chargen#1 = current_chargen#10
  return 
  to:@return

void scroll_soft()
scroll_soft: scope:[scroll_soft]  from main::@3
  current_chargen#25 = phi( main::@3/current_chargen#17 )
  nxt#30 = phi( main::@3/nxt#23 )
  current_bit#27 = phi( main::@3/current_bit#19 )
  scroll#10 = phi( main::@3/scroll#15 )
  scroll#2 = -- scroll#10
  scroll_soft::$0 = scroll#2 == $ff
  scroll_soft::$1 = ! scroll_soft::$0
  if(scroll_soft::$1) goto scroll_soft::@1
  to:scroll_soft::@2
scroll_soft::@1: scope:[scroll_soft]  from scroll_soft scroll_soft::@3
  current_chargen#19 = phi( scroll_soft/current_chargen#25, scroll_soft::@3/current_chargen#2 )
  nxt#25 = phi( scroll_soft/nxt#30, scroll_soft::@3/nxt#2 )
  current_bit#21 = phi( scroll_soft/current_bit#27, scroll_soft::@3/current_bit#2 )
  scroll#11 = phi( scroll_soft/scroll#2, scroll_soft::@3/scroll#16 )
  *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_CONTROL2) = scroll#11
  to:scroll_soft::@return
scroll_soft::@2: scope:[scroll_soft]  from scroll_soft
  current_chargen#18 = phi( scroll_soft/current_chargen#25 )
  nxt#24 = phi( scroll_soft/nxt#30 )
  current_bit#20 = phi( scroll_soft/current_bit#27 )
  scroll#3 = 7
  call scroll_bit
  to:scroll_soft::@3
scroll_soft::@3: scope:[scroll_soft]  from scroll_soft::@2
  scroll#16 = phi( scroll_soft::@2/scroll#3 )
  current_chargen#11 = phi( scroll_soft::@2/current_chargen#5 )
  nxt#14 = phi( scroll_soft::@2/nxt#5 )
  current_bit#12 = phi( scroll_soft::@2/current_bit#6 )
  current_bit#2 = current_bit#12
  nxt#2 = nxt#14
  current_chargen#2 = current_chargen#11
  to:scroll_soft::@1
scroll_soft::@return: scope:[scroll_soft]  from scroll_soft::@1
  current_chargen#12 = phi( scroll_soft::@1/current_chargen#19 )
  nxt#15 = phi( scroll_soft::@1/nxt#25 )
  current_bit#13 = phi( scroll_soft::@1/current_bit#21 )
  scroll#12 = phi( scroll_soft::@1/scroll#11 )
  scroll#4 = scroll#12
  current_bit#3 = current_bit#13
  nxt#3 = nxt#15
  current_chargen#3 = current_chargen#12
  return 
  to:@return

void scroll_bit()
scroll_bit: scope:[scroll_bit]  from scroll_soft::@2
  current_chargen#29 = phi( scroll_soft::@2/current_chargen#18 )
  nxt#31 = phi( scroll_soft::@2/nxt#24 )
  current_bit#14 = phi( scroll_soft::@2/current_bit#20 )
  scroll_bit::$0 = current_bit#14 / 2
  current_bit#4 = scroll_bit::$0
  scroll_bit::$1 = current_bit#4 == 0
  scroll_bit::$2 = ! scroll_bit::$1
  if(scroll_bit::$2) goto scroll_bit::@1
  to:scroll_bit::@2
scroll_bit::@1: scope:[scroll_bit]  from scroll_bit scroll_bit::@8
  nxt#39 = phi( scroll_bit/nxt#31, scroll_bit::@8/nxt#4 )
  current_bit#28 = phi( scroll_bit/current_bit#4, scroll_bit::@8/current_bit#5 )
  current_chargen#26 = phi( scroll_bit/current_chargen#29, scroll_bit::@8/current_chargen#4 )
  call scroll_hard
  to:scroll_bit::@7
scroll_bit::@7: scope:[scroll_bit]  from scroll_bit::@1
  nxt#37 = phi( scroll_bit::@1/nxt#39 )
  current_bit#23 = phi( scroll_bit::@1/current_bit#28 )
  current_chargen#21 = phi( scroll_bit::@1/current_chargen#26 )
  asm { sei  }
  *PROCPORT = $32
  scroll_bit::$4 = SCREEN + $28
  scroll_bit::sc#0 = scroll_bit::$4 + $27
  scroll_bit::r#0 = 0
  to:scroll_bit::@3
scroll_bit::@2: scope:[scroll_bit]  from scroll_bit
  nxt#26 = phi( scroll_bit/nxt#31 )
  call next_char
  next_char::return#0 = next_char::return#2
  to:scroll_bit::@8
scroll_bit::@8: scope:[scroll_bit]  from scroll_bit::@2
  nxt#16 = phi( scroll_bit::@2/nxt#8 )
  next_char::return#3 = phi( scroll_bit::@2/next_char::return#0 )
  scroll_bit::c#0 = next_char::return#3
  nxt#4 = nxt#16
  scroll_bit::$7 = scroll_bit::c#0 * 8
  scroll_bit::$8 = CHARGEN + scroll_bit::$7
  current_chargen#4 = scroll_bit::$8
  current_bit#5 = $80
  to:scroll_bit::@1
scroll_bit::@3: scope:[scroll_bit]  from scroll_bit::@4 scroll_bit::@7
  nxt#34 = phi( scroll_bit::@4/nxt#32, scroll_bit::@7/nxt#37 )
  scroll_bit::sc#3 = phi( scroll_bit::@4/scroll_bit::sc#1, scroll_bit::@7/scroll_bit::sc#0 )
  current_bit#15 = phi( scroll_bit::@4/current_bit#22, scroll_bit::@7/current_bit#23 )
  scroll_bit::r#2 = phi( scroll_bit::@4/scroll_bit::r#1, scroll_bit::@7/scroll_bit::r#0 )
  current_chargen#13 = phi( scroll_bit::@4/current_chargen#20, scroll_bit::@7/current_chargen#21 )
  scroll_bit::bits#0 = current_chargen#13[scroll_bit::r#2]
  scroll_bit::b#0 = ' '
  scroll_bit::$9 = scroll_bit::bits#0 & current_bit#15
  scroll_bit::$10 = scroll_bit::$9 != 0
  scroll_bit::$11 = ! scroll_bit::$10
  if(scroll_bit::$11) goto scroll_bit::@4
  to:scroll_bit::@5
scroll_bit::@4: scope:[scroll_bit]  from scroll_bit::@3 scroll_bit::@5
  nxt#32 = phi( scroll_bit::@3/nxt#34, scroll_bit::@5/nxt#35 )
  current_bit#22 = phi( scroll_bit::@3/current_bit#15, scroll_bit::@5/current_bit#29 )
  current_chargen#20 = phi( scroll_bit::@3/current_chargen#13, scroll_bit::@5/current_chargen#27 )
  scroll_bit::r#3 = phi( scroll_bit::@3/scroll_bit::r#2, scroll_bit::@5/scroll_bit::r#4 )
  scroll_bit::sc#2 = phi( scroll_bit::@3/scroll_bit::sc#3, scroll_bit::@5/scroll_bit::sc#4 )
  scroll_bit::b#2 = phi( scroll_bit::@3/scroll_bit::b#0, scroll_bit::@5/scroll_bit::b#1 )
  *scroll_bit::sc#2 = scroll_bit::b#2
  scroll_bit::$12 = scroll_bit::sc#2 + $28
  scroll_bit::sc#1 = scroll_bit::$12
  scroll_bit::r#1 = scroll_bit::r#3 + rangenext(0,7)
  scroll_bit::$13 = scroll_bit::r#1 != rangelast(0,7)
  if(scroll_bit::$13) goto scroll_bit::@3
  to:scroll_bit::@6
scroll_bit::@5: scope:[scroll_bit]  from scroll_bit::@3
  nxt#35 = phi( scroll_bit::@3/nxt#34 )
  current_bit#29 = phi( scroll_bit::@3/current_bit#15 )
  current_chargen#27 = phi( scroll_bit::@3/current_chargen#13 )
  scroll_bit::r#4 = phi( scroll_bit::@3/scroll_bit::r#2 )
  scroll_bit::sc#4 = phi( scroll_bit::@3/scroll_bit::sc#3 )
  scroll_bit::b#1 = $80+' '
  to:scroll_bit::@4
scroll_bit::@6: scope:[scroll_bit]  from scroll_bit::@4
  current_chargen#22 = phi( scroll_bit::@4/current_chargen#20 )
  nxt#27 = phi( scroll_bit::@4/nxt#32 )
  current_bit#24 = phi( scroll_bit::@4/current_bit#22 )
  *PROCPORT = $37
  asm { cli  }
  to:scroll_bit::@return
scroll_bit::@return: scope:[scroll_bit]  from scroll_bit::@6
  current_chargen#14 = phi( scroll_bit::@6/current_chargen#22 )
  nxt#17 = phi( scroll_bit::@6/nxt#27 )
  current_bit#16 = phi( scroll_bit::@6/current_bit#24 )
  current_bit#6 = current_bit#16
  nxt#5 = nxt#17
  current_chargen#5 = current_chargen#14
  return 
  to:@return

char next_char()
next_char: scope:[next_char]  from scroll_bit::@2
  nxt#18 = phi( scroll_bit::@2/nxt#26 )
  next_char::c#0 = *nxt#18
  next_char::$0 = next_char::c#0 == 0
  next_char::$1 = ! next_char::$0
  if(next_char::$1) goto next_char::@1
  to:next_char::@2
next_char::@1: scope:[next_char]  from next_char next_char::@2
  next_char::c#2 = phi( next_char/next_char::c#0, next_char::@2/next_char::c#1 )
  nxt#19 = phi( next_char/nxt#18, next_char::@2/nxt#7 )
  nxt#6 = ++ nxt#19
  next_char::return#1 = next_char::c#2
  to:next_char::@return
next_char::@2: scope:[next_char]  from next_char
  nxt#7 = TEXT
  next_char::c#1 = *nxt#7
  to:next_char::@1
next_char::@return: scope:[next_char]  from next_char::@1
  nxt#20 = phi( next_char::@1/nxt#6 )
  next_char::return#4 = phi( next_char::@1/next_char::return#1 )
  next_char::return#2 = next_char::return#4
  nxt#8 = nxt#20
  return 
  to:@return

void scroll_hard()
scroll_hard: scope:[scroll_hard]  from scroll_bit::@1
  scroll_hard::i#0 = 0
  to:scroll_hard::@1
scroll_hard::@1: scope:[scroll_hard]  from scroll_hard scroll_hard::@2
  scroll_hard::i#2 = phi( scroll_hard/scroll_hard::i#0, scroll_hard::@2/scroll_hard::i#1 )
  scroll_hard::$0 = scroll_hard::i#2 != $27
  if(scroll_hard::$0) goto scroll_hard::@2
  to:scroll_hard::@return
scroll_hard::@2: scope:[scroll_hard]  from scroll_hard::@1
  scroll_hard::i#3 = phi( scroll_hard::@1/scroll_hard::i#2 )
  scroll_hard::$1 = SCREEN + $28*0
  scroll_hard::$2 = SCREEN + $28*0
  scroll_hard::$3 = scroll_hard::i#3 + 1
  scroll_hard::$1[scroll_hard::i#3] = scroll_hard::$2[scroll_hard::$3]
  scroll_hard::$4 = SCREEN + $28*1
  scroll_hard::$5 = SCREEN + $28*1
  scroll_hard::$6 = scroll_hard::i#3 + 1
  scroll_hard::$4[scroll_hard::i#3] = scroll_hard::$5[scroll_hard::$6]
  scroll_hard::$7 = SCREEN + $28*2
  scroll_hard::$8 = SCREEN + $28*2
  scroll_hard::$9 = scroll_hard::i#3 + 1
  scroll_hard::$7[scroll_hard::i#3] = scroll_hard::$8[scroll_hard::$9]
  scroll_hard::$10 = SCREEN + $28*3
  scroll_hard::$11 = SCREEN + $28*3
  scroll_hard::$12 = scroll_hard::i#3 + 1
  scroll_hard::$10[scroll_hard::i#3] = scroll_hard::$11[scroll_hard::$12]
  scroll_hard::$13 = SCREEN + $28*4
  scroll_hard::$14 = SCREEN + $28*4
  scroll_hard::$15 = scroll_hard::i#3 + 1
  scroll_hard::$13[scroll_hard::i#3] = scroll_hard::$14[scroll_hard::$15]
  scroll_hard::$16 = SCREEN + $28*5
  scroll_hard::$17 = SCREEN + $28*5
  scroll_hard::$18 = scroll_hard::i#3 + 1
  scroll_hard::$16[scroll_hard::i#3] = scroll_hard::$17[scroll_hard::$18]
  scroll_hard::$19 = SCREEN + $28*6
  scroll_hard::$20 = SCREEN + $28*6
  scroll_hard::$21 = scroll_hard::i#3 + 1
  scroll_hard::$19[scroll_hard::i#3] = scroll_hard::$20[scroll_hard::$21]
  scroll_hard::$22 = SCREEN + $28*7
  scroll_hard::$23 = SCREEN + $28*7
  scroll_hard::$24 = scroll_hard::i#3 + 1
  scroll_hard::$22[scroll_hard::i#3] = scroll_hard::$23[scroll_hard::$24]
  scroll_hard::i#1 = ++ scroll_hard::i#3
  to:scroll_hard::@1
scroll_hard::@return: scope:[scroll_hard]  from scroll_hard::@1
  return 
  to:@return

void fillscreen(char *screen , char fill)
fillscreen: scope:[fillscreen]  from main
  fillscreen::fill#3 = phi( main/fillscreen::fill#0 )
  fillscreen::screen#1 = phi( main/fillscreen::screen#0 )
  fillscreen::cursor#0 = fillscreen::screen#1
  to:fillscreen::@1
fillscreen::@1: scope:[fillscreen]  from fillscreen fillscreen::@2
  fillscreen::fill#2 = phi( fillscreen/fillscreen::fill#3, fillscreen::@2/fillscreen::fill#1 )
  fillscreen::cursor#2 = phi( fillscreen/fillscreen::cursor#0, fillscreen::@2/fillscreen::cursor#1 )
  fillscreen::screen#2 = phi( fillscreen/fillscreen::screen#1, fillscreen::@2/fillscreen::screen#3 )
  fillscreen::$0 = fillscreen::screen#2 + $3e8
  fillscreen::$1 = fillscreen::cursor#2 < fillscreen::$0
  if(fillscreen::$1) goto fillscreen::@2
  to:fillscreen::@return
fillscreen::@2: scope:[fillscreen]  from fillscreen::@1
  fillscreen::screen#3 = phi( fillscreen::@1/fillscreen::screen#2 )
  fillscreen::cursor#3 = phi( fillscreen::@1/fillscreen::cursor#2 )
  fillscreen::fill#1 = phi( fillscreen::@1/fillscreen::fill#2 )
  *fillscreen::cursor#3 = fillscreen::fill#1
  fillscreen::cursor#1 = ++ fillscreen::cursor#3
  to:fillscreen::@1
fillscreen::@return: scope:[fillscreen]  from fillscreen::@1
  return 
  to:@return

void __start()
__start: scope:[__start]  from
  to:__start::__init1
__start::__init1: scope:[__start]  from __start
  scroll#5 = 7
  current_chargen#6 = CHARGEN
  current_bit#7 = 1
  nxt#9 = TEXT
  to:__start::@1
__start::@1: scope:[__start]  from __start::__init1
  current_chargen#23 = phi( __start::__init1/current_chargen#6 )
  nxt#28 = phi( __start::__init1/nxt#9 )
  current_bit#25 = phi( __start::__init1/current_bit#7 )
  scroll#17 = phi( __start::__init1/scroll#5 )
  call main
  to:__start::@2
__start::@2: scope:[__start]  from __start::@1
  current_chargen#15 = phi( __start::@1/current_chargen#1 )
  nxt#21 = phi( __start::@1/nxt#1 )
  current_bit#17 = phi( __start::@1/current_bit#1 )
  scroll#13 = phi( __start::@1/scroll#1 )
  scroll#6 = scroll#13
  current_bit#8 = current_bit#17
  nxt#10 = nxt#21
  current_chargen#7 = current_chargen#15
  to:__start::@return
__start::@return: scope:[__start]  from __start::@2
  nxt#22 = phi( __start::@2/nxt#10 )
  current_bit#18 = phi( __start::@2/current_bit#8 )
  current_chargen#16 = phi( __start::@2/current_chargen#7 )
  scroll#14 = phi( __start::@2/scroll#6 )
  scroll#7 = scroll#14
  current_chargen#8 = current_chargen#16
  current_bit#9 = current_bit#18
  nxt#11 = nxt#22
  return 
  to:@return

SYMBOL TABLE SSA
__constant char * const CHARGEN = (char *)$d000
__constant char OFFSET_STRUCT_MOS6569_VICII_BG_COLOR = $21
__constant char OFFSET_STRUCT_MOS6569_VICII_CONTROL2 = $16
__constant char OFFSET_STRUCT_MOS6569_VICII_RASTER = $12
__constant char * const PROCPORT = (char *)1
__constant char *SCREEN = (char *)$400
__constant char *TEXT = "-= this is rex of camelot testing a scroller created in kickc. kickc is an optimizing c-compiler for 6502 assembler. =-     "
__constant struct MOS6569_VICII * const VICII = (struct MOS6569_VICII *)$d000
void __start()
char current_bit
char current_bit#0
char current_bit#1
char current_bit#10
char current_bit#11
char current_bit#12
char current_bit#13
char current_bit#14
char current_bit#15
char current_bit#16
char current_bit#17
char current_bit#18
char current_bit#19
char current_bit#2
char current_bit#20
char current_bit#21
char current_bit#22
char current_bit#23
char current_bit#24
char current_bit#25
char current_bit#26
char current_bit#27
char current_bit#28
char current_bit#29
char current_bit#3
char current_bit#30
char current_bit#31
char current_bit#32
char current_bit#4
char current_bit#5
char current_bit#6
char current_bit#7
char current_bit#8
char current_bit#9
char *current_chargen
char *current_chargen#0
char *current_chargen#1
char *current_chargen#10
char *current_chargen#11
char *current_chargen#12
char *current_chargen#13
char *current_chargen#14
char *current_chargen#15
char *current_chargen#16
char *current_chargen#17
char *current_chargen#18
char *current_chargen#19
char *current_chargen#2
char *current_chargen#20
char *current_chargen#21
char *current_chargen#22
char *current_chargen#23
char *current_chargen#24
char *current_chargen#25
char *current_chargen#26
char *current_chargen#27
char *current_chargen#28
char *current_chargen#29
char *current_chargen#3
char *current_chargen#30
char *current_chargen#31
char *current_chargen#4
char *current_chargen#5
char *current_chargen#6
char *current_chargen#7
char *current_chargen#8
char *current_chargen#9
void fillscreen(char *screen , char fill)
char *fillscreen::$0
bool fillscreen::$1
char *fillscreen::cursor
char *fillscreen::cursor#0
char *fillscreen::cursor#1
char *fillscreen::cursor#2
char *fillscreen::cursor#3
char fillscreen::fill
char fillscreen::fill#0
char fillscreen::fill#1
char fillscreen::fill#2
char fillscreen::fill#3
char *fillscreen::screen
char *fillscreen::screen#0
char *fillscreen::screen#1
char *fillscreen::screen#2
char *fillscreen::screen#3
void main()
bool main::$1
bool main::$2
char next_char()
bool next_char::$0
bool next_char::$1
char next_char::c
char next_char::c#0
char next_char::c#1
char next_char::c#2
char next_char::return
char next_char::return#0
char next_char::return#1
char next_char::return#2
char next_char::return#3
char next_char::return#4
char *nxt
char *nxt#0
char *nxt#1
char *nxt#10
char *nxt#11
char *nxt#12
char *nxt#13
char *nxt#14
char *nxt#15
char *nxt#16
char *nxt#17
char *nxt#18
char *nxt#19
char *nxt#2
char *nxt#20
char *nxt#21
char *nxt#22
char *nxt#23
char *nxt#24
char *nxt#25
char *nxt#26
char *nxt#27
char *nxt#28
char *nxt#29
char *nxt#3
char *nxt#30
char *nxt#31
char *nxt#32
char *nxt#33
char *nxt#34
char *nxt#35
char *nxt#36
char *nxt#37
char *nxt#38
char *nxt#39
char *nxt#4
char *nxt#5
char *nxt#6
char *nxt#7
char *nxt#8
char *nxt#9
char scroll
char scroll#0
char scroll#1
char scroll#10
char scroll#11
char scroll#12
char scroll#13
char scroll#14
char scroll#15
char scroll#16
char scroll#17
char scroll#18
char scroll#19
char scroll#2
char scroll#20
char scroll#21
char scroll#3
char scroll#4
char scroll#5
char scroll#6
char scroll#7
char scroll#8
char scroll#9
void scroll_bit()
number scroll_bit::$0
bool scroll_bit::$1
bool scroll_bit::$10
bool scroll_bit::$11
char *scroll_bit::$12
bool scroll_bit::$13
bool scroll_bit::$2
char *scroll_bit::$4
number scroll_bit::$7
char *scroll_bit::$8
char scroll_bit::$9
char scroll_bit::b
char scroll_bit::b#0
char scroll_bit::b#1
char scroll_bit::b#2
char scroll_bit::bits
char scroll_bit::bits#0
unsigned int scroll_bit::c
unsigned int scroll_bit::c#0
char scroll_bit::r
char scroll_bit::r#0
char scroll_bit::r#1
char scroll_bit::r#2
char scroll_bit::r#3
char scroll_bit::r#4
char *scroll_bit::sc
char *scroll_bit::sc#0
char *scroll_bit::sc#1
char *scroll_bit::sc#2
char *scroll_bit::sc#3
char *scroll_bit::sc#4
void scroll_hard()
bool scroll_hard::$0
char *scroll_hard::$1
char *scroll_hard::$10
char *scroll_hard::$11
number scroll_hard::$12
char *scroll_hard::$13
char *scroll_hard::$14
number scroll_hard::$15
char *scroll_hard::$16
char *scroll_hard::$17
number scroll_hard::$18
char *scroll_hard::$19
char *scroll_hard::$2
char *scroll_hard::$20
number scroll_hard::$21
char *scroll_hard::$22
char *scroll_hard::$23
number scroll_hard::$24
number scroll_hard::$3
char *scroll_hard::$4
char *scroll_hard::$5
number scroll_hard::$6
char *scroll_hard::$7
char *scroll_hard::$8
number scroll_hard::$9
char scroll_hard::i
char scroll_hard::i#0
char scroll_hard::i#1
char scroll_hard::i#2
char scroll_hard::i#3
void scroll_soft()
bool scroll_soft::$0
bool scroll_soft::$1

Adding number conversion cast (unumber) $20 in fillscreen::fill#0 = $20
Adding number conversion cast (unumber) $fe in main::$1 = *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_RASTER) != $fe
Adding number conversion cast (unumber) $ff in main::$2 = *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_RASTER) != $ff
Adding number conversion cast (unumber) $ff in scroll_soft::$0 = scroll#2 == $ff
Adding number conversion cast (unumber) 7 in scroll#3 = 7
Adding number conversion cast (unumber) 2 in scroll_bit::$0 = current_bit#14 / 2
Adding number conversion cast (unumber) scroll_bit::$0 in scroll_bit::$0 = current_bit#14 / (unumber)2
Adding number conversion cast (unumber) 0 in scroll_bit::$1 = current_bit#4 == 0
Adding number conversion cast (unumber) $32 in *PROCPORT = $32
Adding number conversion cast (unumber) $28 in scroll_bit::$4 = SCREEN + $28
Adding number conversion cast (unumber) $27 in scroll_bit::sc#0 = scroll_bit::$4 + $27
Adding number conversion cast (unumber) 8 in scroll_bit::$7 = scroll_bit::c#0 * 8
Adding number conversion cast (unumber) scroll_bit::$7 in scroll_bit::$7 = scroll_bit::c#0 * (unumber)8
Adding number conversion cast (unumber) $80 in current_bit#5 = $80
Adding number conversion cast (unumber) 0 in scroll_bit::$10 = scroll_bit::$9 != 0
Adding number conversion cast (unumber) $28 in scroll_bit::$12 = scroll_bit::sc#2 + $28
Adding number conversion cast (unumber) $80+' ' in scroll_bit::b#1 = $80+' '
Adding number conversion cast (unumber) $80 in scroll_bit::b#1 = ((unumber)) $80+' '
Adding number conversion cast (unumber) $37 in *PROCPORT = $37
Adding number conversion cast (unumber) 0 in next_char::$0 = next_char::c#0 == 0
Adding number conversion cast (unumber) $27 in scroll_hard::$0 = scroll_hard::i#2 != $27
Adding number conversion cast (unumber) $28*0 in scroll_hard::$1 = SCREEN + $28*0
Adding number conversion cast (unumber) $28*0 in scroll_hard::$2 = SCREEN + $28*0
Adding number conversion cast (unumber) 1 in scroll_hard::$3 = scroll_hard::i#3 + 1
Adding number conversion cast (unumber) scroll_hard::$3 in scroll_hard::$3 = scroll_hard::i#3 + (unumber)1
Adding number conversion cast (unumber) $28*1 in scroll_hard::$4 = SCREEN + $28*1
Adding number conversion cast (unumber) $28*1 in scroll_hard::$5 = SCREEN + $28*1
Adding number conversion cast (unumber) 1 in scroll_hard::$6 = scroll_hard::i#3 + 1
Adding number conversion cast (unumber) scroll_hard::$6 in scroll_hard::$6 = scroll_hard::i#3 + (unumber)1
Adding number conversion cast (unumber) $28*2 in scroll_hard::$7 = SCREEN + $28*2
Adding number conversion cast (unumber) $28*2 in scroll_hard::$8 = SCREEN + $28*2
Adding number conversion cast (unumber) 1 in scroll_hard::$9 = scroll_hard::i#3 + 1
Adding number conversion cast (unumber) scroll_hard::$9 in scroll_hard::$9 = scroll_hard::i#3 + (unumber)1
Adding number conversion cast (unumber) $28*3 in scroll_hard::$10 = SCREEN + $28*3
Adding number conversion cast (unumber) $28*3 in scroll_hard::$11 = SCREEN + $28*3
Adding number conversion cast (unumber) 1 in scroll_hard::$12 = scroll_hard::i#3 + 1
Adding number conversion cast (unumber) scroll_hard::$12 in scroll_hard::$12 = scroll_hard::i#3 + (unumber)1
Adding number conversion cast (unumber) $28*4 in scroll_hard::$13 = SCREEN + $28*4
Adding number conversion cast (unumber) $28*4 in scroll_hard::$14 = SCREEN + $28*4
Adding number conversion cast (unumber) 1 in scroll_hard::$15 = scroll_hard::i#3 + 1
Adding number conversion cast (unumber) scroll_hard::$15 in scroll_hard::$15 = scroll_hard::i#3 + (unumber)1
Adding number conversion cast (unumber) $28*5 in scroll_hard::$16 = SCREEN + $28*5
Adding number conversion cast (unumber) $28*5 in scroll_hard::$17 = SCREEN + $28*5
Adding number conversion cast (unumber) 1 in scroll_hard::$18 = scroll_hard::i#3 + 1
Adding number conversion cast (unumber) scroll_hard::$18 in scroll_hard::$18 = scroll_hard::i#3 + (unumber)1
Adding number conversion cast (unumber) $28*6 in scroll_hard::$19 = SCREEN + $28*6
Adding number conversion cast (unumber) $28*6 in scroll_hard::$20 = SCREEN + $28*6
Adding number conversion cast (unumber) 1 in scroll_hard::$21 = scroll_hard::i#3 + 1
Adding number conversion cast (unumber) scroll_hard::$21 in scroll_hard::$21 = scroll_hard::i#3 + (unumber)1
Adding number conversion cast (unumber) $28*7 in scroll_hard::$22 = SCREEN + $28*7
Adding number conversion cast (unumber) $28*7 in scroll_hard::$23 = SCREEN + $28*7
Adding number conversion cast (unumber) 1 in scroll_hard::$24 = scroll_hard::i#3 + 1
Adding number conversion cast (unumber) scroll_hard::$24 in scroll_hard::$24 = scroll_hard::i#3 + (unumber)1
Adding number conversion cast (unumber) $3e8 in fillscreen::$0 = fillscreen::screen#2 + $3e8
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast fillscreen::fill#0 = (unumber)$20
Inlining cast scroll#3 = (unumber)7
Inlining cast *PROCPORT = (unumber)$32
Inlining cast current_bit#5 = (unumber)$80
Inlining cast scroll_bit::b#1 = (unumber)(unumber)$80+' '
Inlining cast *PROCPORT = (unumber)$37
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (char *) 1
Simplifying constant pointer cast (char *) 53248
Simplifying constant pointer cast (struct MOS6569_VICII *) 53248
Simplifying constant pointer cast (char *) 1024
Simplifying constant integer cast $20
Simplifying constant integer cast $fe
Simplifying constant integer cast $ff
Simplifying constant integer cast $ff
Simplifying constant integer cast 7
Simplifying constant integer cast 2
Simplifying constant integer cast 0
Simplifying constant integer cast $32
Simplifying constant integer cast $28
Simplifying constant integer cast $27
Simplifying constant integer cast 8
Simplifying constant integer cast $80
Simplifying constant integer cast 0
Simplifying constant integer cast $28
Simplifying constant integer cast (unumber)$80+' '
Simplifying constant integer cast $80
Simplifying constant integer cast $37
Simplifying constant integer cast 0
Simplifying constant integer cast $27
Simplifying constant integer cast 1
Simplifying constant integer cast 1
Simplifying constant integer cast 1
Simplifying constant integer cast 1
Simplifying constant integer cast 1
Simplifying constant integer cast 1
Simplifying constant integer cast 1
Simplifying constant integer cast 1
Simplifying constant integer cast $3e8
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (char) $20
Finalized unsigned number type (char) $fe
Finalized unsigned number type (char) $ff
Finalized unsigned number type (char) $ff
Finalized unsigned number type (char) 7
Finalized unsigned number type (char) 2
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) $32
Finalized unsigned number type (char) $28
Finalized unsigned number type (char) $27
Finalized unsigned number type (char) 8
Finalized unsigned number type (char) $80
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) $28
Finalized unsigned number type (char) $80
Finalized unsigned number type (char) $37
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) $27
Finalized unsigned number type (char) 1
Finalized unsigned number type (char) 1
Finalized unsigned number type (char) 1
Finalized unsigned number type (char) 1
Finalized unsigned number type (char) 1
Finalized unsigned number type (char) 1
Finalized unsigned number type (char) 1
Finalized unsigned number type (char) 1
Finalized unsigned number type (unsigned int) $3e8
Successful SSA optimization PassNFinalizeNumberTypeConversions
Inferred type updated to char in scroll_bit::$0 = current_bit#14 / 2
Inferred type updated to unsigned int in scroll_bit::$7 = scroll_bit::c#0 * 8
Inferred type updated to char in scroll_hard::$3 = scroll_hard::i#3 + 1
Inferred type updated to char in scroll_hard::$6 = scroll_hard::i#3 + 1
Inferred type updated to char in scroll_hard::$9 = scroll_hard::i#3 + 1
Inferred type updated to char in scroll_hard::$12 = scroll_hard::i#3 + 1
Inferred type updated to char in scroll_hard::$15 = scroll_hard::i#3 + 1
Inferred type updated to char in scroll_hard::$18 = scroll_hard::i#3 + 1
Inferred type updated to char in scroll_hard::$21 = scroll_hard::i#3 + 1
Inferred type updated to char in scroll_hard::$24 = scroll_hard::i#3 + 1
Inversing boolean not [30] scroll_soft::$1 = scroll#2 != $ff from [29] scroll_soft::$0 = scroll#2 == $ff
Inversing boolean not [51] scroll_bit::$2 = current_bit#4 != 0 from [50] scroll_bit::$1 = current_bit#4 == 0
Inversing boolean not [76] scroll_bit::$11 = scroll_bit::$9 == 0 from [75] scroll_bit::$10 = scroll_bit::$9 != 0
Inversing boolean not [98] next_char::$1 = next_char::c#0 != 0 from [97] next_char::$0 = next_char::c#0 == 0
Successful SSA optimization Pass2UnaryNotSimplification
Alias scroll#20 = scroll#21 
Alias current_bit#31 = current_bit#32 
Alias nxt#36 = nxt#38 
Alias current_chargen#30 = current_chargen#31 
Alias scroll#15 = scroll#18 
Alias current_bit#19 = current_bit#26 
Alias nxt#23 = nxt#29 
Alias current_chargen#17 = current_chargen#24 
Alias scroll#0 = scroll#8 scroll#9 scroll#1 
Alias current_bit#0 = current_bit#10 current_bit#11 current_bit#1 
Alias nxt#0 = nxt#12 nxt#13 nxt#1 
Alias current_chargen#0 = current_chargen#9 current_chargen#10 current_chargen#1 
Alias current_bit#20 = current_bit#27 
Alias nxt#24 = nxt#30 
Alias current_chargen#18 = current_chargen#25 
Alias scroll#16 = scroll#3 
Alias current_bit#12 = current_bit#2 
Alias nxt#14 = nxt#2 
Alias current_chargen#11 = current_chargen#2 
Alias scroll#11 = scroll#12 scroll#4 
Alias current_bit#13 = current_bit#21 current_bit#3 
Alias nxt#15 = nxt#25 nxt#3 
Alias current_chargen#12 = current_chargen#19 current_chargen#3 
Alias current_bit#4 = scroll_bit::$0 
Alias current_chargen#21 = current_chargen#26 
Alias current_bit#23 = current_bit#28 
Alias nxt#37 = nxt#39 
Alias nxt#26 = nxt#31 
Alias next_char::return#0 = next_char::return#3 
Alias nxt#16 = nxt#4 
Alias current_chargen#4 = scroll_bit::$8 
Alias scroll_bit::sc#1 = scroll_bit::$12 
Alias scroll_bit::sc#3 = scroll_bit::sc#4 
Alias scroll_bit::r#2 = scroll_bit::r#4 
Alias current_chargen#13 = current_chargen#27 
Alias current_bit#15 = current_bit#29 
Alias nxt#34 = nxt#35 
Alias current_bit#16 = current_bit#24 current_bit#22 current_bit#6 
Alias nxt#17 = nxt#27 nxt#32 nxt#5 
Alias current_chargen#14 = current_chargen#22 current_chargen#20 current_chargen#5 
Alias next_char::return#1 = next_char::c#2 next_char::return#4 next_char::return#2 
Alias nxt#20 = nxt#6 nxt#8 
Alias scroll_hard::i#2 = scroll_hard::i#3 
Alias fillscreen::cursor#0 = fillscreen::screen#1 
Alias fillscreen::fill#1 = fillscreen::fill#2 
Alias fillscreen::cursor#2 = fillscreen::cursor#3 
Alias fillscreen::screen#2 = fillscreen::screen#3 
Alias scroll#17 = scroll#5 
Alias current_bit#25 = current_bit#7 
Alias nxt#28 = nxt#9 
Alias current_chargen#23 = current_chargen#6 
Alias scroll#13 = scroll#6 scroll#14 scroll#7 
Alias current_bit#17 = current_bit#8 current_bit#18 current_bit#9 
Alias nxt#10 = nxt#21 nxt#22 nxt#11 
Alias current_chargen#15 = current_chargen#7 current_chargen#16 current_chargen#8 
Successful SSA optimization Pass2AliasElimination
Alias scroll_bit::sc#2 = scroll_bit::sc#3 
Alias scroll_bit::r#2 = scroll_bit::r#3 
Alias current_chargen#13 = current_chargen#14 
Alias current_bit#15 = current_bit#16 
Alias nxt#17 = nxt#34 
Successful SSA optimization Pass2AliasElimination
Identical Phi Values scroll#20 scroll#17
Identical Phi Values current_bit#31 current_bit#25
Identical Phi Values nxt#36 nxt#28
Identical Phi Values current_chargen#30 current_chargen#23
Identical Phi Values scroll#15 scroll#19
Identical Phi Values current_bit#19 current_bit#30
Identical Phi Values nxt#23 nxt#33
Identical Phi Values current_chargen#17 current_chargen#28
Identical Phi Values scroll#0 scroll#11
Identical Phi Values current_bit#0 current_bit#13
Identical Phi Values nxt#0 nxt#15
Identical Phi Values current_chargen#0 current_chargen#12
Identical Phi Values scroll#10 scroll#15
Identical Phi Values current_bit#20 current_bit#19
Identical Phi Values nxt#24 nxt#23
Identical Phi Values current_chargen#18 current_chargen#17
Identical Phi Values current_bit#12 current_bit#15
Identical Phi Values nxt#14 nxt#17
Identical Phi Values current_chargen#11 current_chargen#13
Identical Phi Values current_bit#14 current_bit#20
Identical Phi Values nxt#26 nxt#24
Identical Phi Values current_chargen#29 current_chargen#18
Identical Phi Values nxt#16 nxt#20
Identical Phi Values current_chargen#13 current_chargen#21
Identical Phi Values current_bit#15 current_bit#23
Identical Phi Values nxt#17 nxt#37
Identical Phi Values nxt#18 nxt#26
Identical Phi Values fillscreen::cursor#0 fillscreen::screen#0
Identical Phi Values fillscreen::fill#3 fillscreen::fill#0
Identical Phi Values fillscreen::screen#2 fillscreen::cursor#0
Identical Phi Values fillscreen::fill#1 fillscreen::fill#3
Identical Phi Values scroll#13 scroll#0
Identical Phi Values current_bit#17 current_bit#0
Identical Phi Values nxt#10 nxt#0
Identical Phi Values current_chargen#15 current_chargen#0
Successful SSA optimization Pass2IdenticalPhiElimination
Simple Condition main::$1 [6] if(*((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_RASTER)!=$fe) goto main::@1
Simple Condition main::$2 [9] if(*((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_RASTER)!=$ff) goto main::@2
Simple Condition scroll_soft::$1 [19] if(scroll#2!=$ff) goto scroll_soft::@1
Simple Condition scroll_bit::$2 [29] if(current_bit#4!=0) goto scroll_bit::@1
Simple Condition scroll_bit::$11 [49] if(scroll_bit::$9==0) goto scroll_bit::@4
Simple Condition scroll_bit::$13 [55] if(scroll_bit::r#1!=rangelast(0,7)) goto scroll_bit::@3
Simple Condition next_char::$1 [63] if(next_char::c#0!=0) goto next_char::@1
Simple Condition scroll_hard::$0 [72] if(scroll_hard::i#2!=$27) goto scroll_hard::@2
Simple Condition fillscreen::$1 [111] if(fillscreen::cursor#2<fillscreen::$0) goto fillscreen::@2
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant right-side identified [34] scroll_bit::$4 = SCREEN + $28
Constant right-side identified [73] scroll_hard::$1 = SCREEN + (char)$28*0
Constant right-side identified [74] scroll_hard::$2 = SCREEN + (char)$28*0
Constant right-side identified [77] scroll_hard::$4 = SCREEN + (char)$28*1
Constant right-side identified [78] scroll_hard::$5 = SCREEN + (char)$28*1
Constant right-side identified [81] scroll_hard::$7 = SCREEN + (char)$28*2
Constant right-side identified [82] scroll_hard::$8 = SCREEN + (char)$28*2
Constant right-side identified [85] scroll_hard::$10 = SCREEN + (char)$28*3
Constant right-side identified [86] scroll_hard::$11 = SCREEN + (char)$28*3
Constant right-side identified [89] scroll_hard::$13 = SCREEN + (char)$28*4
Constant right-side identified [90] scroll_hard::$14 = SCREEN + (char)$28*4
Constant right-side identified [93] scroll_hard::$16 = SCREEN + (char)$28*5
Constant right-side identified [94] scroll_hard::$17 = SCREEN + (char)$28*5
Constant right-side identified [97] scroll_hard::$19 = SCREEN + (char)$28*6
Constant right-side identified [98] scroll_hard::$20 = SCREEN + (char)$28*6
Constant right-side identified [101] scroll_hard::$22 = SCREEN + (unsigned int)$28*7
Constant right-side identified [102] scroll_hard::$23 = SCREEN + (unsigned int)$28*7
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant fillscreen::screen#0 = SCREEN
Constant fillscreen::fill#0 = $20
Constant scroll#16 = 7
Constant scroll_bit::$4 = SCREEN+$28
Constant scroll_bit::r#0 = 0
Constant current_bit#5 = $80
Constant scroll_bit::b#0 = ' '
Constant scroll_bit::b#1 = $80+' '
Constant nxt#7 = TEXT
Constant scroll_hard::i#0 = 0
Constant scroll_hard::$1 = SCREEN+(char)$28*0
Constant scroll_hard::$2 = SCREEN+(char)$28*0
Constant scroll_hard::$4 = SCREEN+(char)$28*1
Constant scroll_hard::$5 = SCREEN+(char)$28*1
Constant scroll_hard::$7 = SCREEN+(char)$28*2
Constant scroll_hard::$8 = SCREEN+(char)$28*2
Constant scroll_hard::$10 = SCREEN+(char)$28*3
Constant scroll_hard::$11 = SCREEN+(char)$28*3
Constant scroll_hard::$13 = SCREEN+(char)$28*4
Constant scroll_hard::$14 = SCREEN+(char)$28*4
Constant scroll_hard::$16 = SCREEN+(char)$28*5
Constant scroll_hard::$17 = SCREEN+(char)$28*5
Constant scroll_hard::$19 = SCREEN+(char)$28*6
Constant scroll_hard::$20 = SCREEN+(char)$28*6
Constant scroll_hard::$22 = SCREEN+(unsigned int)$28*7
Constant scroll_hard::$23 = SCREEN+(unsigned int)$28*7
Constant scroll#17 = 7
Constant current_chargen#23 = CHARGEN
Constant current_bit#25 = 1
Constant nxt#28 = TEXT
Successful SSA optimization Pass2ConstantIdentification
if() condition always true - replacing block destination [14] if(true) goto main::@1
Successful SSA optimization Pass2ConstantIfs
Resolved ranged next value [53] scroll_bit::r#1 = ++ scroll_bit::r#2 to ++
Resolved ranged comparison value [55] if(scroll_bit::r#1!=rangelast(0,7)) goto scroll_bit::@3 to 8
Simplifying constant evaluating to zero (char)$28*0 in 
Simplifying constant evaluating to zero (char)$28*0 in 
Successful SSA optimization PassNSimplifyConstantZero
Simplifying expression containing zero SCREEN in 
Simplifying expression containing zero SCREEN in 
Successful SSA optimization PassNSimplifyExpressionWithZero
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) 8 in [33] if(scroll_bit::r#1!=8) goto scroll_bit::@3
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant integer cast 8
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (char) 8
Successful SSA optimization PassNFinalizeNumberTypeConversions
Constant right-side identified [19] scroll_bit::sc#0 = scroll_bit::$4 + $27
Constant right-side identified [64] fillscreen::$0 = fillscreen::screen#0 + $3e8
Successful SSA optimization Pass2ConstantRValueConsolidation
Constant scroll_bit::sc#0 = scroll_bit::$4+$27
Constant fillscreen::$0 = fillscreen::screen#0+$3e8
Successful SSA optimization Pass2ConstantIdentification
Rewriting division to use shift [13] current_bit#4 = current_bit#30 / 2
Rewriting multiplication to use shift [22] scroll_bit::$7 = scroll_bit::c#0 * 8
Successful SSA optimization Pass2MultiplyToShiftRewriting
Inlining constant with var siblings scroll_bit::r#0
Inlining constant with var siblings scroll_bit::b#0
Inlining constant with var siblings scroll_bit::b#1
Inlining constant with var siblings scroll_bit::sc#0
Inlining constant with var siblings scroll_hard::i#0
Inlining constant with var siblings scroll#16
Inlining constant with var siblings current_bit#5
Inlining constant with var siblings nxt#7
Inlining constant with var siblings scroll#17
Inlining constant with var siblings current_chargen#23
Inlining constant with var siblings current_bit#25
Inlining constant with var siblings nxt#28
Constant inlined scroll_hard::$4 = SCREEN+(char)$28*1
Constant inlined current_chargen#23 = CHARGEN
Constant inlined scroll_hard::$5 = SCREEN+(char)$28*1
Constant inlined scroll_hard::$2 = SCREEN
Constant inlined scroll_hard::$1 = SCREEN
Constant inlined scroll_hard::$23 = SCREEN+(unsigned int)$28*7
Constant inlined current_bit#25 = 1
Constant inlined scroll_bit::r#0 = 0
Constant inlined fillscreen::screen#0 = SCREEN
Constant inlined current_bit#5 = $80
Constant inlined nxt#7 = TEXT
Constant inlined scroll_hard::$8 = SCREEN+(char)$28*2
Constant inlined scroll_hard::$7 = SCREEN+(char)$28*2
Constant inlined scroll_hard::$20 = SCREEN+(char)$28*6
Constant inlined scroll_hard::$22 = SCREEN+(unsigned int)$28*7
Constant inlined scroll_hard::i#0 = 0
Constant inlined scroll_bit::$4 = SCREEN+$28
Constant inlined scroll_bit::b#0 = ' '
Constant inlined fillscreen::$0 = SCREEN+$3e8
Constant inlined scroll_bit::b#1 = $80+' '
Constant inlined scroll_hard::$13 = SCREEN+(char)$28*4
Constant inlined scroll_hard::$14 = SCREEN+(char)$28*4
Constant inlined scroll_hard::$16 = SCREEN+(char)$28*5
Constant inlined scroll_hard::$17 = SCREEN+(char)$28*5
Constant inlined scroll_hard::$19 = SCREEN+(char)$28*6
Constant inlined nxt#28 = TEXT
Constant inlined scroll#17 = 7
Constant inlined scroll_bit::sc#0 = SCREEN+$28+$27
Constant inlined scroll#16 = 7
Constant inlined scroll_hard::$10 = SCREEN+(char)$28*3
Constant inlined scroll_hard::$11 = SCREEN+(char)$28*3
Successful SSA optimization Pass2ConstantInlining
Consolidated array index constant in assignment (SCREEN+1)[scroll_hard::$3]
Consolidated array index constant in assignment (SCREEN+(char)$28*1+1)[scroll_hard::$6]
Consolidated array index constant in assignment (SCREEN+(char)$28*2+1)[scroll_hard::$9]
Consolidated array index constant in assignment (SCREEN+(char)$28*3+1)[scroll_hard::$12]
Consolidated array index constant in assignment (SCREEN+(char)$28*4+1)[scroll_hard::$15]
Consolidated array index constant in assignment (SCREEN+(char)$28*5+1)[scroll_hard::$18]
Consolidated array index constant in assignment (SCREEN+(char)$28*6+1)[scroll_hard::$21]
Consolidated array index constant in assignment (SCREEN+(unsigned int)$28*7+1)[scroll_hard::$24]
Successful SSA optimization Pass2ConstantAdditionElimination
Alias scroll_hard::i#2 = scroll_hard::$3 scroll_hard::$6 scroll_hard::$9 scroll_hard::$12 scroll_hard::$15 scroll_hard::$18 scroll_hard::$21 scroll_hard::$24 
Successful SSA optimization Pass2AliasElimination
Finalized unsigned number type (char) $28
Finalized unsigned number type (char) 1
Finalized unsigned number type (char) $28
Finalized unsigned number type (char) 1
Finalized unsigned number type (char) $28
Finalized unsigned number type (char) 2
Finalized unsigned number type (char) $28
Finalized unsigned number type (char) 2
Finalized unsigned number type (char) $28
Finalized unsigned number type (char) 3
Finalized unsigned number type (char) $28
Finalized unsigned number type (char) 3
Finalized unsigned number type (char) $28
Finalized unsigned number type (char) 4
Finalized unsigned number type (char) $28
Finalized unsigned number type (char) 4
Finalized unsigned number type (char) $28
Finalized unsigned number type (char) 5
Finalized unsigned number type (char) $28
Finalized unsigned number type (char) 5
Finalized unsigned number type (char) $28
Finalized unsigned number type (char) 6
Finalized unsigned number type (char) $28
Finalized unsigned number type (char) 6
Finalized unsigned number type (char) $28
Finalized unsigned number type (char) 7
Finalized unsigned number type (char) $28
Finalized unsigned number type (char) 7
Successful SSA optimization PassNFinalizeNumberTypeConversions
Simplifying constant integer cast $28*1
Simplifying constant integer cast $28*1
Simplifying constant integer cast $28*2
Simplifying constant integer cast $28*2
Simplifying constant integer cast $28*3
Simplifying constant integer cast $28*3
Simplifying constant integer cast $28*4
Simplifying constant integer cast $28*4
Simplifying constant integer cast $28*5
Simplifying constant integer cast $28*5
Simplifying constant integer cast $28*6
Simplifying constant integer cast $28*6
Successful SSA optimization PassNCastSimplification
Added new block during phi lifting main::@6(between main::@1 and main::@1)
Added new block during phi lifting scroll_soft::@4(between scroll_soft and scroll_soft::@1)
Added new block during phi lifting scroll_bit::@9(between scroll_bit and scroll_bit::@1)
Added new block during phi lifting scroll_bit::@10(between scroll_bit::@4 and scroll_bit::@3)
Added new block during phi lifting next_char::@3(between next_char and next_char::@1)
Adding NOP phi() at start of main
Adding NOP phi() at start of main::@4
Adding NOP phi() at start of fillscreen
Adding NOP phi() at start of scroll_soft::@2
Adding NOP phi() at start of scroll_bit::@2
Adding NOP phi() at start of scroll_bit::@5
Adding NOP phi() at start of scroll_hard
CALL GRAPH
Calls in [main] to fillscreen:1 scroll_soft:7 
Calls in [scroll_soft] to scroll_bit:27 
Calls in [scroll_bit] to next_char:41 scroll_hard:49 

Created 18 initial phi equivalence classes
Coalesced [9] scroll#23 = scroll#11
Coalesced [10] current_bit#34 = current_bit#13
Coalesced [11] nxt#41 = nxt#15
Coalesced [12] current_chargen#33 = current_chargen#12
Coalesced (already) [13] scroll#22 = scroll#19
Coalesced (already) [14] current_bit#33 = current_bit#30
Coalesced (already) [15] nxt#40 = nxt#33
Coalesced (already) [16] current_chargen#32 = current_chargen#28
Coalesced [23] fillscreen::cursor#4 = fillscreen::cursor#1
Coalesced [28] current_bit#36 = current_bit#23
Coalesced [29] nxt#43 = nxt#37
Coalesced [30] current_chargen#35 = current_chargen#21
Coalesced [34] scroll#24 = scroll#2
Coalesced (already) [35] current_bit#35 = current_bit#30
Coalesced (already) [36] nxt#42 = nxt#33
Coalesced (already) [37] current_chargen#34 = current_chargen#28
Coalesced [46] current_chargen#37 = current_chargen#4
Coalesced [47] nxt#45 = nxt#20
Coalesced [65] scroll_bit::r#5 = scroll_bit::r#1
Coalesced [66] scroll_bit::sc#5 = scroll_bit::sc#1
Coalesced (already) [67] current_chargen#36 = current_chargen#28
Coalesced [68] current_bit#37 = current_bit#4
Coalesced (already) [69] nxt#44 = nxt#33
Coalesced [73] next_char::return#6 = next_char::c#1
Coalesced [77] nxt#46 = nxt#33
Coalesced [78] next_char::return#5 = next_char::c#0
Coalesced [92] scroll_hard::i#4 = scroll_hard::i#1
Coalesced down to 10 phi equivalence classes
Culled Empty Block label main::@4
Culled Empty Block label main::@6
Culled Empty Block label scroll_soft::@3
Culled Empty Block label scroll_soft::@4
Culled Empty Block label scroll_bit::@10
Culled Empty Block label scroll_bit::@9
Culled Empty Block label next_char::@3
Renumbering block main::@5 to main::@4
Adding NOP phi() at start of main
Adding NOP phi() at start of fillscreen
Adding NOP phi() at start of scroll_soft::@2
Adding NOP phi() at start of scroll_bit::@2
Adding NOP phi() at start of scroll_bit::@5
Adding NOP phi() at start of scroll_hard

FINAL CONTROL FLOW GRAPH

void main()
main: scope:[main]  from
  [0] phi()
  [1] call fillscreen
  to:main::@1
main::@1: scope:[main]  from main main::@1 main::@4
  [2] current_chargen#28 = phi( main::@1/current_chargen#28, main/CHARGEN, main::@4/current_chargen#12 )
  [2] nxt#33 = phi( main::@1/nxt#33, main/TEXT, main::@4/nxt#15 )
  [2] current_bit#30 = phi( main::@1/current_bit#30, main/1, main::@4/current_bit#13 )
  [2] scroll#19 = phi( main::@1/scroll#19, main/7, main::@4/scroll#11 )
  [3] if(*((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_RASTER)!=$fe) goto main::@1
  to:main::@2
main::@2: scope:[main]  from main::@1 main::@2
  [4] if(*((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_RASTER)!=$ff) goto main::@2
  to:main::@3
main::@3: scope:[main]  from main::@2
  [5] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR) = ++ *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR)
  [6] call scroll_soft
  to:main::@4
main::@4: scope:[main]  from main::@3
  [7] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR) = -- *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR)
  to:main::@1

void fillscreen(char *screen , char fill)
fillscreen: scope:[fillscreen]  from main
  [8] phi()
  to:fillscreen::@1
fillscreen::@1: scope:[fillscreen]  from fillscreen fillscreen::@2
  [9] fillscreen::cursor#2 = phi( fillscreen/SCREEN, fillscreen::@2/fillscreen::cursor#1 )
  [10] if(fillscreen::cursor#2<SCREEN+$3e8) goto fillscreen::@2
  to:fillscreen::@return
fillscreen::@return: scope:[fillscreen]  from fillscreen::@1
  [11] return 
  to:@return
fillscreen::@2: scope:[fillscreen]  from fillscreen::@1
  [12] *fillscreen::cursor#2 = fillscreen::fill#0
  [13] fillscreen::cursor#1 = ++ fillscreen::cursor#2
  to:fillscreen::@1

void scroll_soft()
scroll_soft: scope:[scroll_soft]  from main::@3
  [14] scroll#2 = -- scroll#19
  [15] if(scroll#2!=$ff) goto scroll_soft::@1
  to:scroll_soft::@2
scroll_soft::@2: scope:[scroll_soft]  from scroll_soft
  [16] phi()
  [17] call scroll_bit
  to:scroll_soft::@1
scroll_soft::@1: scope:[scroll_soft]  from scroll_soft scroll_soft::@2
  [18] current_chargen#12 = phi( scroll_soft/current_chargen#28, scroll_soft::@2/current_chargen#21 )
  [18] nxt#15 = phi( scroll_soft/nxt#33, scroll_soft::@2/nxt#37 )
  [18] current_bit#13 = phi( scroll_soft/current_bit#30, scroll_soft::@2/current_bit#23 )
  [18] scroll#11 = phi( scroll_soft/scroll#2, scroll_soft::@2/7 )
  [19] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_CONTROL2) = scroll#11
  to:scroll_soft::@return
scroll_soft::@return: scope:[scroll_soft]  from scroll_soft::@1
  [20] return 
  to:@return

void scroll_bit()
scroll_bit: scope:[scroll_bit]  from scroll_soft::@2
  [21] current_bit#4 = current_bit#30 >> 1
  [22] if(current_bit#4!=0) goto scroll_bit::@1
  to:scroll_bit::@2
scroll_bit::@2: scope:[scroll_bit]  from scroll_bit
  [23] phi()
  [24] call next_char
  [25] next_char::return#0 = next_char::return#1
  to:scroll_bit::@8
scroll_bit::@8: scope:[scroll_bit]  from scroll_bit::@2
  [26] scroll_bit::c#0 = next_char::return#0
  [27] scroll_bit::$7 = scroll_bit::c#0 << 3
  [28] current_chargen#4 = CHARGEN + scroll_bit::$7
  to:scroll_bit::@1
scroll_bit::@1: scope:[scroll_bit]  from scroll_bit scroll_bit::@8
  [29] nxt#37 = phi( scroll_bit/nxt#33, scroll_bit::@8/nxt#20 )
  [29] current_bit#23 = phi( scroll_bit/current_bit#4, scroll_bit::@8/$80 )
  [29] current_chargen#21 = phi( scroll_bit/current_chargen#28, scroll_bit::@8/current_chargen#4 )
  [30] call scroll_hard
  to:scroll_bit::@7
scroll_bit::@7: scope:[scroll_bit]  from scroll_bit::@1
  asm { sei  }
  [32] *PROCPORT = $32
  to:scroll_bit::@3
scroll_bit::@3: scope:[scroll_bit]  from scroll_bit::@4 scroll_bit::@7
  [33] scroll_bit::sc#2 = phi( scroll_bit::@4/scroll_bit::sc#1, scroll_bit::@7/SCREEN+$28+$27 )
  [33] scroll_bit::r#2 = phi( scroll_bit::@4/scroll_bit::r#1, scroll_bit::@7/0 )
  [34] scroll_bit::bits#0 = current_chargen#21[scroll_bit::r#2]
  [35] scroll_bit::$9 = scroll_bit::bits#0 & current_bit#23
  [36] if(scroll_bit::$9==0) goto scroll_bit::@4
  to:scroll_bit::@5
scroll_bit::@5: scope:[scroll_bit]  from scroll_bit::@3
  [37] phi()
  to:scroll_bit::@4
scroll_bit::@4: scope:[scroll_bit]  from scroll_bit::@3 scroll_bit::@5
  [38] scroll_bit::b#2 = phi( scroll_bit::@3/' ', scroll_bit::@5/$80+' ' )
  [39] *scroll_bit::sc#2 = scroll_bit::b#2
  [40] scroll_bit::sc#1 = scroll_bit::sc#2 + $28
  [41] scroll_bit::r#1 = ++ scroll_bit::r#2
  [42] if(scroll_bit::r#1!=8) goto scroll_bit::@3
  to:scroll_bit::@6
scroll_bit::@6: scope:[scroll_bit]  from scroll_bit::@4
  [43] *PROCPORT = $37
  asm { cli  }
  to:scroll_bit::@return
scroll_bit::@return: scope:[scroll_bit]  from scroll_bit::@6
  [45] return 
  to:@return

char next_char()
next_char: scope:[next_char]  from scroll_bit::@2
  [46] next_char::c#0 = *nxt#33
  [47] if(next_char::c#0!=0) goto next_char::@1
  to:next_char::@2
next_char::@2: scope:[next_char]  from next_char
  [48] next_char::c#1 = *TEXT
  to:next_char::@1
next_char::@1: scope:[next_char]  from next_char next_char::@2
  [49] next_char::return#1 = phi( next_char/next_char::c#0, next_char::@2/next_char::c#1 )
  [49] nxt#19 = phi( next_char/nxt#33, next_char::@2/TEXT )
  [50] nxt#20 = ++ nxt#19
  to:next_char::@return
next_char::@return: scope:[next_char]  from next_char::@1
  [51] return 
  to:@return

void scroll_hard()
scroll_hard: scope:[scroll_hard]  from scroll_bit::@1
  [52] phi()
  to:scroll_hard::@1
scroll_hard::@1: scope:[scroll_hard]  from scroll_hard scroll_hard::@2
  [53] scroll_hard::i#2 = phi( scroll_hard/0, scroll_hard::@2/scroll_hard::i#1 )
  [54] if(scroll_hard::i#2!=$27) goto scroll_hard::@2
  to:scroll_hard::@return
scroll_hard::@return: scope:[scroll_hard]  from scroll_hard::@1
  [55] return 
  to:@return
scroll_hard::@2: scope:[scroll_hard]  from scroll_hard::@1
  [56] SCREEN[scroll_hard::i#2] = (SCREEN+1)[scroll_hard::i#2]
  [57] (SCREEN+$28*1)[scroll_hard::i#2] = (SCREEN+$28*1+1)[scroll_hard::i#2]
  [58] (SCREEN+$28*2)[scroll_hard::i#2] = (SCREEN+$28*2+1)[scroll_hard::i#2]
  [59] (SCREEN+$28*3)[scroll_hard::i#2] = (SCREEN+$28*3+1)[scroll_hard::i#2]
  [60] (SCREEN+$28*4)[scroll_hard::i#2] = (SCREEN+$28*4+1)[scroll_hard::i#2]
  [61] (SCREEN+$28*5)[scroll_hard::i#2] = (SCREEN+$28*5+1)[scroll_hard::i#2]
  [62] (SCREEN+$28*6)[scroll_hard::i#2] = (SCREEN+$28*6+1)[scroll_hard::i#2]
  [63] (SCREEN+(unsigned int)$28*7)[scroll_hard::i#2] = (SCREEN+(unsigned int)$28*7+1)[scroll_hard::i#2]
  [64] scroll_hard::i#1 = ++ scroll_hard::i#2
  to:scroll_hard::@1


VARIABLE REGISTER WEIGHTS
char current_bit
char current_bit#13 // 42.599999999999994
char current_bit#23 // 5616.833333333334
char current_bit#30 // 187.85714285714286
char current_bit#4 // 1501.5
char *current_chargen
char *current_chargen#12 // 42.599999999999994
char *current_chargen#21 // 5672.444444444444
char *current_chargen#28 // 146.11111111111111
char *current_chargen#4 // 2002.0
void fillscreen(char *screen , char fill)
char *fillscreen::cursor
char *fillscreen::cursor#1 // 202.0
char *fillscreen::cursor#2 // 134.66666666666666
char fillscreen::fill
char *fillscreen::screen
void main()
char next_char()
char next_char::c
char next_char::c#0 // 15001.5
char next_char::c#1 // 20002.0
char next_char::return
char next_char::return#0 // 2002.0
char next_char::return#1 // 5250.75
char *nxt
char *nxt#15 // 42.599999999999994
char *nxt#19 // 20002.0
char *nxt#20 // 1571.7142857142858
char *nxt#33 // 1776.4166666666665
char *nxt#37 // 116.83333333333334
char scroll
char scroll#11 // 42.599999999999994
char scroll#19 // 78.5
char scroll#2 // 151.5
void scroll_bit()
unsigned int scroll_bit::$7 // 2002.0
char scroll_bit::$9 // 200002.0
char scroll_bit::b
char scroll_bit::b#2 // 100001.0
char scroll_bit::bits
char scroll_bit::bits#0 // 200002.0
unsigned int scroll_bit::c
unsigned int scroll_bit::c#0 // 2002.0
char scroll_bit::r
char scroll_bit::r#1 // 150001.5
char scroll_bit::r#2 // 37500.375
char *scroll_bit::sc
char *scroll_bit::sc#1 // 66667.33333333333
char *scroll_bit::sc#2 // 42857.57142857143
void scroll_hard()
char scroll_hard::i
char scroll_hard::i#1 // 2000002.0
char scroll_hard::i#2 // 1900001.9000000006
void scroll_soft()

Initial phi equivalence classes
[ scroll#19 scroll#11 scroll#2 ]
[ current_bit#30 current_bit#13 current_bit#23 current_bit#4 ]
[ current_chargen#28 current_chargen#12 current_chargen#21 current_chargen#4 ]
[ fillscreen::cursor#2 fillscreen::cursor#1 ]
[ scroll_bit::r#2 scroll_bit::r#1 ]
[ scroll_bit::sc#2 scroll_bit::sc#1 ]
[ scroll_bit::b#2 ]
[ nxt#19 nxt#33 nxt#15 nxt#37 nxt#20 ]
[ next_char::return#1 next_char::c#0 next_char::c#1 ]
[ scroll_hard::i#2 scroll_hard::i#1 ]
Added variable next_char::return#0 to live range equivalence class [ next_char::return#0 ]
Added variable scroll_bit::c#0 to live range equivalence class [ scroll_bit::c#0 ]
Added variable scroll_bit::$7 to live range equivalence class [ scroll_bit::$7 ]
Added variable scroll_bit::bits#0 to live range equivalence class [ scroll_bit::bits#0 ]
Added variable scroll_bit::$9 to live range equivalence class [ scroll_bit::$9 ]
Complete equivalence classes
[ scroll#19 scroll#11 scroll#2 ]
[ current_bit#30 current_bit#13 current_bit#23 current_bit#4 ]
[ current_chargen#28 current_chargen#12 current_chargen#21 current_chargen#4 ]
[ fillscreen::cursor#2 fillscreen::cursor#1 ]
[ scroll_bit::r#2 scroll_bit::r#1 ]
[ scroll_bit::sc#2 scroll_bit::sc#1 ]
[ scroll_bit::b#2 ]
[ nxt#19 nxt#33 nxt#15 nxt#37 nxt#20 ]
[ next_char::return#1 next_char::c#0 next_char::c#1 ]
[ scroll_hard::i#2 scroll_hard::i#1 ]
[ next_char::return#0 ]
[ scroll_bit::c#0 ]
[ scroll_bit::$7 ]
[ scroll_bit::bits#0 ]
[ scroll_bit::$9 ]
Allocated zp[1]:2 [ scroll_hard::i#2 scroll_hard::i#1 ]
Allocated zp[1]:3 [ scroll_bit::bits#0 ]
Allocated zp[1]:4 [ scroll_bit::$9 ]
Allocated zp[1]:5 [ scroll_bit::r#2 scroll_bit::r#1 ]
Allocated zp[2]:6 [ scroll_bit::sc#2 scroll_bit::sc#1 ]
Allocated zp[1]:8 [ scroll_bit::b#2 ]
Allocated zp[1]:9 [ next_char::return#1 next_char::c#0 next_char::c#1 ]
Allocated zp[2]:10 [ nxt#19 nxt#33 nxt#15 nxt#37 nxt#20 ]
Allocated zp[2]:12 [ current_chargen#28 current_chargen#12 current_chargen#21 current_chargen#4 ]
Allocated zp[1]:14 [ current_bit#30 current_bit#13 current_bit#23 current_bit#4 ]
Allocated zp[1]:15 [ next_char::return#0 ]
Allocated zp[2]:16 [ scroll_bit::c#0 ]
Allocated zp[2]:18 [ scroll_bit::$7 ]
Allocated zp[2]:20 [ fillscreen::cursor#2 fillscreen::cursor#1 ]
Allocated zp[1]:22 [ scroll#19 scroll#11 scroll#2 ]
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [3] if(*((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_RASTER)!=$fe) goto main::@1 [ scroll#19 current_bit#30 nxt#33 current_chargen#28 ] (  [ scroll#19 current_bit#30 nxt#33 current_chargen#28 ] { }  ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:22 [ scroll#19 scroll#11 scroll#2 ]
Removing always clobbered register reg byte a as potential for zp[1]:14 [ current_bit#30 current_bit#13 current_bit#23 current_bit#4 ]
Statement [4] if(*((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_RASTER)!=$ff) goto main::@2 [ scroll#19 current_bit#30 nxt#33 current_chargen#28 ] (  [ scroll#19 current_bit#30 nxt#33 current_chargen#28 ] { }  ) always clobbers reg byte a 
Statement [10] if(fillscreen::cursor#2<SCREEN+$3e8) goto fillscreen::@2 [ fillscreen::cursor#2 ] ( fillscreen:1 [ fillscreen::cursor#2 ] { }  ) always clobbers reg byte a 
Statement [12] *fillscreen::cursor#2 = fillscreen::fill#0 [ fillscreen::cursor#2 ] ( fillscreen:1 [ fillscreen::cursor#2 ] { }  ) always clobbers reg byte a reg byte y 
Statement [26] scroll_bit::c#0 = next_char::return#0 [ scroll_bit::c#0 nxt#20 ] ( scroll_soft:6::scroll_bit:17 [ scroll_bit::c#0 nxt#20 ] { }  ) always clobbers reg byte a 
Statement [27] scroll_bit::$7 = scroll_bit::c#0 << 3 [ scroll_bit::$7 nxt#20 ] ( scroll_soft:6::scroll_bit:17 [ scroll_bit::$7 nxt#20 ] { }  ) always clobbers reg byte a 
Statement [28] current_chargen#4 = CHARGEN + scroll_bit::$7 [ current_chargen#4 nxt#20 ] ( scroll_soft:6::scroll_bit:17 [ current_chargen#4 nxt#20 ] { }  ) always clobbers reg byte a 
Statement [32] *PROCPORT = $32 [ current_bit#23 nxt#37 current_chargen#21 ] ( scroll_soft:6::scroll_bit:17 [ current_bit#23 nxt#37 current_chargen#21 ] { }  ) always clobbers reg byte a 
Statement [34] scroll_bit::bits#0 = current_chargen#21[scroll_bit::r#2] [ current_bit#23 nxt#37 current_chargen#21 scroll_bit::r#2 scroll_bit::sc#2 scroll_bit::bits#0 ] ( scroll_soft:6::scroll_bit:17 [ current_bit#23 nxt#37 current_chargen#21 scroll_bit::r#2 scroll_bit::sc#2 scroll_bit::bits#0 ] { }  ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:5 [ scroll_bit::r#2 scroll_bit::r#1 ]
Statement [39] *scroll_bit::sc#2 = scroll_bit::b#2 [ current_bit#23 nxt#37 current_chargen#21 scroll_bit::r#2 scroll_bit::sc#2 ] ( scroll_soft:6::scroll_bit:17 [ current_bit#23 nxt#37 current_chargen#21 scroll_bit::r#2 scroll_bit::sc#2 ] { }  ) always clobbers reg byte y 
Removing always clobbered register reg byte y as potential for zp[1]:14 [ current_bit#30 current_bit#13 current_bit#23 current_bit#4 ]
Removing always clobbered register reg byte y as potential for zp[1]:5 [ scroll_bit::r#2 scroll_bit::r#1 ]
Statement [40] scroll_bit::sc#1 = scroll_bit::sc#2 + $28 [ current_bit#23 nxt#37 current_chargen#21 scroll_bit::r#2 scroll_bit::sc#1 ] ( scroll_soft:6::scroll_bit:17 [ current_bit#23 nxt#37 current_chargen#21 scroll_bit::r#2 scroll_bit::sc#1 ] { }  ) always clobbers reg byte a 
Statement [43] *PROCPORT = $37 [ current_bit#23 nxt#37 current_chargen#21 ] ( scroll_soft:6::scroll_bit:17 [ current_bit#23 nxt#37 current_chargen#21 ] { }  ) always clobbers reg byte a 
Statement [46] next_char::c#0 = *nxt#33 [ nxt#33 next_char::c#0 ] ( scroll_soft:6::scroll_bit:17::next_char:24 [ nxt#33 next_char::c#0 ] { { next_char::return#0 = next_char::return#1 } }  ) always clobbers reg byte a reg byte y 
Statement [56] SCREEN[scroll_hard::i#2] = (SCREEN+1)[scroll_hard::i#2] [ scroll_hard::i#2 ] ( scroll_soft:6::scroll_bit:17::scroll_hard:30 [ current_bit#23 nxt#37 current_chargen#21 scroll_hard::i#2 ] { }  ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:2 [ scroll_hard::i#2 scroll_hard::i#1 ]
Statement [57] (SCREEN+$28*1)[scroll_hard::i#2] = (SCREEN+$28*1+1)[scroll_hard::i#2] [ scroll_hard::i#2 ] ( scroll_soft:6::scroll_bit:17::scroll_hard:30 [ current_bit#23 nxt#37 current_chargen#21 scroll_hard::i#2 ] { }  ) always clobbers reg byte a 
Statement [58] (SCREEN+$28*2)[scroll_hard::i#2] = (SCREEN+$28*2+1)[scroll_hard::i#2] [ scroll_hard::i#2 ] ( scroll_soft:6::scroll_bit:17::scroll_hard:30 [ current_bit#23 nxt#37 current_chargen#21 scroll_hard::i#2 ] { }  ) always clobbers reg byte a 
Statement [59] (SCREEN+$28*3)[scroll_hard::i#2] = (SCREEN+$28*3+1)[scroll_hard::i#2] [ scroll_hard::i#2 ] ( scroll_soft:6::scroll_bit:17::scroll_hard:30 [ current_bit#23 nxt#37 current_chargen#21 scroll_hard::i#2 ] { }  ) always clobbers reg byte a 
Statement [60] (SCREEN+$28*4)[scroll_hard::i#2] = (SCREEN+$28*4+1)[scroll_hard::i#2] [ scroll_hard::i#2 ] ( scroll_soft:6::scroll_bit:17::scroll_hard:30 [ current_bit#23 nxt#37 current_chargen#21 scroll_hard::i#2 ] { }  ) always clobbers reg byte a 
Statement [61] (SCREEN+$28*5)[scroll_hard::i#2] = (SCREEN+$28*5+1)[scroll_hard::i#2] [ scroll_hard::i#2 ] ( scroll_soft:6::scroll_bit:17::scroll_hard:30 [ current_bit#23 nxt#37 current_chargen#21 scroll_hard::i#2 ] { }  ) always clobbers reg byte a 
Statement [62] (SCREEN+$28*6)[scroll_hard::i#2] = (SCREEN+$28*6+1)[scroll_hard::i#2] [ scroll_hard::i#2 ] ( scroll_soft:6::scroll_bit:17::scroll_hard:30 [ current_bit#23 nxt#37 current_chargen#21 scroll_hard::i#2 ] { }  ) always clobbers reg byte a 
Statement [63] (SCREEN+(unsigned int)$28*7)[scroll_hard::i#2] = (SCREEN+(unsigned int)$28*7+1)[scroll_hard::i#2] [ scroll_hard::i#2 ] ( scroll_soft:6::scroll_bit:17::scroll_hard:30 [ current_bit#23 nxt#37 current_chargen#21 scroll_hard::i#2 ] { }  ) always clobbers reg byte a 
Statement [3] if(*((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_RASTER)!=$fe) goto main::@1 [ scroll#19 current_bit#30 nxt#33 current_chargen#28 ] (  [ scroll#19 current_bit#30 nxt#33 current_chargen#28 ] { }  ) always clobbers reg byte a 
Statement [4] if(*((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_RASTER)!=$ff) goto main::@2 [ scroll#19 current_bit#30 nxt#33 current_chargen#28 ] (  [ scroll#19 current_bit#30 nxt#33 current_chargen#28 ] { }  ) always clobbers reg byte a 
Statement [10] if(fillscreen::cursor#2<SCREEN+$3e8) goto fillscreen::@2 [ fillscreen::cursor#2 ] ( fillscreen:1 [ fillscreen::cursor#2 ] { }  ) always clobbers reg byte a 
Statement [12] *fillscreen::cursor#2 = fillscreen::fill#0 [ fillscreen::cursor#2 ] ( fillscreen:1 [ fillscreen::cursor#2 ] { }  ) always clobbers reg byte a reg byte y 
Statement [26] scroll_bit::c#0 = next_char::return#0 [ scroll_bit::c#0 nxt#20 ] ( scroll_soft:6::scroll_bit:17 [ scroll_bit::c#0 nxt#20 ] { }  ) always clobbers reg byte a 
Statement [27] scroll_bit::$7 = scroll_bit::c#0 << 3 [ scroll_bit::$7 nxt#20 ] ( scroll_soft:6::scroll_bit:17 [ scroll_bit::$7 nxt#20 ] { }  ) always clobbers reg byte a 
Statement [28] current_chargen#4 = CHARGEN + scroll_bit::$7 [ current_chargen#4 nxt#20 ] ( scroll_soft:6::scroll_bit:17 [ current_chargen#4 nxt#20 ] { }  ) always clobbers reg byte a 
Statement [32] *PROCPORT = $32 [ current_bit#23 nxt#37 current_chargen#21 ] ( scroll_soft:6::scroll_bit:17 [ current_bit#23 nxt#37 current_chargen#21 ] { }  ) always clobbers reg byte a 
Statement [34] scroll_bit::bits#0 = current_chargen#21[scroll_bit::r#2] [ current_bit#23 nxt#37 current_chargen#21 scroll_bit::r#2 scroll_bit::sc#2 scroll_bit::bits#0 ] ( scroll_soft:6::scroll_bit:17 [ current_bit#23 nxt#37 current_chargen#21 scroll_bit::r#2 scroll_bit::sc#2 scroll_bit::bits#0 ] { }  ) always clobbers reg byte a reg byte y 
Statement [39] *scroll_bit::sc#2 = scroll_bit::b#2 [ current_bit#23 nxt#37 current_chargen#21 scroll_bit::r#2 scroll_bit::sc#2 ] ( scroll_soft:6::scroll_bit:17 [ current_bit#23 nxt#37 current_chargen#21 scroll_bit::r#2 scroll_bit::sc#2 ] { }  ) always clobbers reg byte y 
Statement [40] scroll_bit::sc#1 = scroll_bit::sc#2 + $28 [ current_bit#23 nxt#37 current_chargen#21 scroll_bit::r#2 scroll_bit::sc#1 ] ( scroll_soft:6::scroll_bit:17 [ current_bit#23 nxt#37 current_chargen#21 scroll_bit::r#2 scroll_bit::sc#1 ] { }  ) always clobbers reg byte a 
Statement [43] *PROCPORT = $37 [ current_bit#23 nxt#37 current_chargen#21 ] ( scroll_soft:6::scroll_bit:17 [ current_bit#23 nxt#37 current_chargen#21 ] { }  ) always clobbers reg byte a 
Statement [46] next_char::c#0 = *nxt#33 [ nxt#33 next_char::c#0 ] ( scroll_soft:6::scroll_bit:17::next_char:24 [ nxt#33 next_char::c#0 ] { { next_char::return#0 = next_char::return#1 } }  ) always clobbers reg byte a reg byte y 
Statement [56] SCREEN[scroll_hard::i#2] = (SCREEN+1)[scroll_hard::i#2] [ scroll_hard::i#2 ] ( scroll_soft:6::scroll_bit:17::scroll_hard:30 [ current_bit#23 nxt#37 current_chargen#21 scroll_hard::i#2 ] { }  ) always clobbers reg byte a 
Statement [57] (SCREEN+$28*1)[scroll_hard::i#2] = (SCREEN+$28*1+1)[scroll_hard::i#2] [ scroll_hard::i#2 ] ( scroll_soft:6::scroll_bit:17::scroll_hard:30 [ current_bit#23 nxt#37 current_chargen#21 scroll_hard::i#2 ] { }  ) always clobbers reg byte a 
Statement [58] (SCREEN+$28*2)[scroll_hard::i#2] = (SCREEN+$28*2+1)[scroll_hard::i#2] [ scroll_hard::i#2 ] ( scroll_soft:6::scroll_bit:17::scroll_hard:30 [ current_bit#23 nxt#37 current_chargen#21 scroll_hard::i#2 ] { }  ) always clobbers reg byte a 
Statement [59] (SCREEN+$28*3)[scroll_hard::i#2] = (SCREEN+$28*3+1)[scroll_hard::i#2] [ scroll_hard::i#2 ] ( scroll_soft:6::scroll_bit:17::scroll_hard:30 [ current_bit#23 nxt#37 current_chargen#21 scroll_hard::i#2 ] { }  ) always clobbers reg byte a 
Statement [60] (SCREEN+$28*4)[scroll_hard::i#2] = (SCREEN+$28*4+1)[scroll_hard::i#2] [ scroll_hard::i#2 ] ( scroll_soft:6::scroll_bit:17::scroll_hard:30 [ current_bit#23 nxt#37 current_chargen#21 scroll_hard::i#2 ] { }  ) always clobbers reg byte a 
Statement [61] (SCREEN+$28*5)[scroll_hard::i#2] = (SCREEN+$28*5+1)[scroll_hard::i#2] [ scroll_hard::i#2 ] ( scroll_soft:6::scroll_bit:17::scroll_hard:30 [ current_bit#23 nxt#37 current_chargen#21 scroll_hard::i#2 ] { }  ) always clobbers reg byte a 
Statement [62] (SCREEN+$28*6)[scroll_hard::i#2] = (SCREEN+$28*6+1)[scroll_hard::i#2] [ scroll_hard::i#2 ] ( scroll_soft:6::scroll_bit:17::scroll_hard:30 [ current_bit#23 nxt#37 current_chargen#21 scroll_hard::i#2 ] { }  ) always clobbers reg byte a 
Statement [63] (SCREEN+(unsigned int)$28*7)[scroll_hard::i#2] = (SCREEN+(unsigned int)$28*7+1)[scroll_hard::i#2] [ scroll_hard::i#2 ] ( scroll_soft:6::scroll_bit:17::scroll_hard:30 [ current_bit#23 nxt#37 current_chargen#21 scroll_hard::i#2 ] { }  ) always clobbers reg byte a 
Potential registers zp[1]:22 [ scroll#19 scroll#11 scroll#2 ] : zp[1]:22 , reg byte x , reg byte y , 
Potential registers zp[1]:14 [ current_bit#30 current_bit#13 current_bit#23 current_bit#4 ] : zp[1]:14 , reg byte x , 
Potential registers zp[2]:12 [ current_chargen#28 current_chargen#12 current_chargen#21 current_chargen#4 ] : zp[2]:12 , 
Potential registers zp[2]:20 [ fillscreen::cursor#2 fillscreen::cursor#1 ] : zp[2]:20 , 
Potential registers zp[1]:5 [ scroll_bit::r#2 scroll_bit::r#1 ] : zp[1]:5 , reg byte x , 
Potential registers zp[2]:6 [ scroll_bit::sc#2 scroll_bit::sc#1 ] : zp[2]:6 , 
Potential registers zp[1]:8 [ scroll_bit::b#2 ] : zp[1]:8 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[2]:10 [ nxt#19 nxt#33 nxt#15 nxt#37 nxt#20 ] : zp[2]:10 , 
Potential registers zp[1]:9 [ next_char::return#1 next_char::c#0 next_char::c#1 ] : zp[1]:9 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:2 [ scroll_hard::i#2 scroll_hard::i#1 ] : zp[1]:2 , reg byte x , reg byte y , 
Potential registers zp[1]:15 [ next_char::return#0 ] : zp[1]:15 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[2]:16 [ scroll_bit::c#0 ] : zp[2]:16 , 
Potential registers zp[2]:18 [ scroll_bit::$7 ] : zp[2]:18 , 
Potential registers zp[1]:3 [ scroll_bit::bits#0 ] : zp[1]:3 , reg byte a , reg byte x , reg byte y , 
Potential registers zp[1]:4 [ scroll_bit::$9 ] : zp[1]:4 , reg byte a , reg byte x , reg byte y , 

REGISTER UPLIFT SCOPES
Uplift Scope [scroll_hard] 3,900,003.9: zp[1]:2 [ scroll_hard::i#2 scroll_hard::i#1 ] 
Uplift Scope [scroll_bit] 200,002: zp[1]:3 [ scroll_bit::bits#0 ] 200,002: zp[1]:4 [ scroll_bit::$9 ] 187,501.88: zp[1]:5 [ scroll_bit::r#2 scroll_bit::r#1 ] 109,524.9: zp[2]:6 [ scroll_bit::sc#2 scroll_bit::sc#1 ] 100,001: zp[1]:8 [ scroll_bit::b#2 ] 2,002: zp[2]:16 [ scroll_bit::c#0 ] 2,002: zp[2]:18 [ scroll_bit::$7 ] 
Uplift Scope [next_char] 40,254.25: zp[1]:9 [ next_char::return#1 next_char::c#0 next_char::c#1 ] 2,002: zp[1]:15 [ next_char::return#0 ] 
Uplift Scope [] 23,509.56: zp[2]:10 [ nxt#19 nxt#33 nxt#15 nxt#37 nxt#20 ] 7,863.16: zp[2]:12 [ current_chargen#28 current_chargen#12 current_chargen#21 current_chargen#4 ] 7,348.79: zp[1]:14 [ current_bit#30 current_bit#13 current_bit#23 current_bit#4 ] 272.6: zp[1]:22 [ scroll#19 scroll#11 scroll#2 ] 
Uplift Scope [fillscreen] 336.67: zp[2]:20 [ fillscreen::cursor#2 fillscreen::cursor#1 ] 
Uplift Scope [MOS6526_CIA] 
Uplift Scope [MOS6569_VICII] 
Uplift Scope [MOS6581_SID] 
Uplift Scope [main] 
Uplift Scope [scroll_soft] 

Uplifting [scroll_hard] best 27346 combination reg byte x [ scroll_hard::i#2 scroll_hard::i#1 ] 
Uplifting [scroll_bit] best 24646 combination reg byte a [ scroll_bit::bits#0 ] reg byte a [ scroll_bit::$9 ] reg byte x [ scroll_bit::r#2 scroll_bit::r#1 ] zp[2]:6 [ scroll_bit::sc#2 scroll_bit::sc#1 ] reg byte a [ scroll_bit::b#2 ] zp[2]:16 [ scroll_bit::c#0 ] zp[2]:18 [ scroll_bit::$7 ] 
Limited combination testing to 100 combinations of 128 possible.
Uplifting [next_char] best 24634 combination reg byte x [ next_char::return#1 next_char::c#0 next_char::c#1 ] reg byte a [ next_char::return#0 ] 
Uplifting [] best 24322 combination zp[2]:10 [ nxt#19 nxt#33 nxt#15 nxt#37 nxt#20 ] zp[2]:12 [ current_chargen#28 current_chargen#12 current_chargen#21 current_chargen#4 ] zp[1]:14 [ current_bit#30 current_bit#13 current_bit#23 current_bit#4 ] reg byte x [ scroll#19 scroll#11 scroll#2 ] 
Uplifting [fillscreen] best 24322 combination zp[2]:20 [ fillscreen::cursor#2 fillscreen::cursor#1 ] 
Uplifting [MOS6526_CIA] best 24322 combination 
Uplifting [MOS6569_VICII] best 24322 combination 
Uplifting [MOS6581_SID] best 24322 combination 
Uplifting [main] best 24322 combination 
Uplifting [scroll_soft] best 24322 combination 
Attempting to uplift remaining variables inzp[1]:14 [ current_bit#30 current_bit#13 current_bit#23 current_bit#4 ]
Uplifting [] best 24322 combination zp[1]:14 [ current_bit#30 current_bit#13 current_bit#23 current_bit#4 ] 
Coalescing zero page register [ zp[2]:12 [ current_chargen#28 current_chargen#12 current_chargen#21 current_chargen#4 ] ] with [ zp[2]:18 [ scroll_bit::$7 ] ] - score: 1
Coalescing zero page register [ zp[2]:12 [ current_chargen#28 current_chargen#12 current_chargen#21 current_chargen#4 scroll_bit::$7 ] ] with [ zp[2]:16 [ scroll_bit::c#0 ] ] - score: 1
Coalescing zero page register [ zp[2]:20 [ fillscreen::cursor#2 fillscreen::cursor#1 ] ] with [ zp[2]:12 [ current_chargen#28 current_chargen#12 current_chargen#21 current_chargen#4 scroll_bit::$7 scroll_bit::c#0 ] ]
Allocated (was zp[2]:6) zp[2]:2 [ scroll_bit::sc#2 scroll_bit::sc#1 ]
Allocated (was zp[2]:10) zp[2]:4 [ nxt#19 nxt#33 nxt#15 nxt#37 nxt#20 ]
Allocated (was zp[2]:20) zp[2]:6 [ fillscreen::cursor#2 fillscreen::cursor#1 current_chargen#28 current_chargen#12 current_chargen#21 current_chargen#4 scroll_bit::$7 scroll_bit::c#0 ]
Allocated (was zp[1]:14) zp[1]:8 [ current_bit#30 current_bit#13 current_bit#23 current_bit#4 ]

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
// An 8x8 char letter scroller
/// @file
/// Commodore 64 Registers and Constants
/// @file
/// The MOS 6526 Complex Interface Adapter (CIA)
///
/// http://archive.6502.org/datasheets/mos_6526_cia_recreated.pdf
  // Upstart
  // Commodore 64 PRG executable file
.file [name="scrollbig.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
  // Global Constants & labels
  .const OFFSET_STRUCT_MOS6569_VICII_RASTER = $12
  .const OFFSET_STRUCT_MOS6569_VICII_BG_COLOR = $21
  .const OFFSET_STRUCT_MOS6569_VICII_CONTROL2 = $16
  /// Processor Port Register controlling RAM/ROM configuration and the datasette
  .label PROCPORT = 1
  /// The address of the CHARGEN character set
  .label CHARGEN = $d000
  /// The VIC-II MOS 6567/6569
  .label VICII = $d000
  .label SCREEN = $400
  .label current_bit = 8
  // Scroll the next bit from the current char onto the screen - trigger next char if needed
  .label current_chargen = 6
  .label nxt = 4
.segment Code
  // main
main: {
    // [1] call fillscreen
    // [8] phi from main to fillscreen [phi:main->fillscreen]
  fillscreen_from_main:
    jsr fillscreen
    // [2] phi from main to main::@1 [phi:main->main::@1]
  __b1_from_main:
    // [2] phi current_chargen#28 = CHARGEN [phi:main->main::@1#0] -- pbuz1=pbuc1 
    lda #<CHARGEN
    sta.z current_chargen
    lda #>CHARGEN
    sta.z current_chargen+1
    // [2] phi nxt#33 = TEXT [phi:main->main::@1#1] -- pbuz1=pbuc1 
    lda #<TEXT
    sta.z nxt
    lda #>TEXT
    sta.z nxt+1
    // [2] phi current_bit#30 = 1 [phi:main->main::@1#2] -- vbuz1=vbuc1 
    lda #1
    sta.z current_bit
    // [2] phi scroll#19 = 7 [phi:main->main::@1#3] -- vbuxx=vbuc1 
    ldx #7
    jmp __b1
  // Wait for raster
    // [2] phi from main::@1 main::@4 to main::@1 [phi:main::@1/main::@4->main::@1]
  __b1_from___b1:
  __b1_from___b4:
    // [2] phi current_chargen#28 = current_chargen#28 [phi:main::@1/main::@4->main::@1#0] -- register_copy 
    // [2] phi nxt#33 = nxt#33 [phi:main::@1/main::@4->main::@1#1] -- register_copy 
    // [2] phi current_bit#30 = current_bit#30 [phi:main::@1/main::@4->main::@1#2] -- register_copy 
    // [2] phi scroll#19 = scroll#19 [phi:main::@1/main::@4->main::@1#3] -- register_copy 
    jmp __b1
    // main::@1
  __b1:
    // [3] if(*((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_RASTER)!=$fe) goto main::@1 -- _deref_pbuc1_neq_vbuc2_then_la1 
    lda #$fe
    cmp VICII+OFFSET_STRUCT_MOS6569_VICII_RASTER
    bne __b1_from___b1
    jmp __b2
    // main::@2
  __b2:
    // [4] if(*((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_RASTER)!=$ff) goto main::@2 -- _deref_pbuc1_neq_vbuc2_then_la1 
    lda #$ff
    cmp VICII+OFFSET_STRUCT_MOS6569_VICII_RASTER
    bne __b2
    jmp __b3
    // main::@3
  __b3:
    // [5] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR) = ++ *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR) -- _deref_pbuc1=_inc__deref_pbuc1 
    inc VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR
    // [6] call scroll_soft
    jsr scroll_soft
    jmp __b4
    // main::@4
  __b4:
    // [7] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR) = -- *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR) -- _deref_pbuc1=_dec__deref_pbuc1 
    dec VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR
    jmp __b1_from___b4
}
  // fillscreen
// Fill the screen with one char
// void fillscreen(char *screen, char fill)
fillscreen: {
    .const fill = $20
    .label cursor = 6
    // [9] phi from fillscreen to fillscreen::@1 [phi:fillscreen->fillscreen::@1]
  __b1_from_fillscreen:
    // [9] phi fillscreen::cursor#2 = SCREEN [phi:fillscreen->fillscreen::@1#0] -- pbuz1=pbuc1 
    lda #<SCREEN
    sta.z cursor
    lda #>SCREEN
    sta.z cursor+1
    jmp __b1
    // fillscreen::@1
  __b1:
    // [10] if(fillscreen::cursor#2<SCREEN+$3e8) goto fillscreen::@2 -- pbuz1_lt_pbuc1_then_la1 
    lda.z cursor+1
    cmp #>SCREEN+$3e8
    bcc __b2
    bne !+
    lda.z cursor
    cmp #<SCREEN+$3e8
    bcc __b2
  !:
    jmp __breturn
    // fillscreen::@return
  __breturn:
    // [11] return 
    rts
    // fillscreen::@2
  __b2:
    // [12] *fillscreen::cursor#2 = fillscreen::fill#0 -- _deref_pbuz1=vbuc1 
    lda #fill
    ldy #0
    sta (cursor),y
    // [13] fillscreen::cursor#1 = ++ fillscreen::cursor#2 -- pbuz1=_inc_pbuz1 
    inc.z cursor
    bne !+
    inc.z cursor+1
  !:
    // [9] phi from fillscreen::@2 to fillscreen::@1 [phi:fillscreen::@2->fillscreen::@1]
  __b1_from___b2:
    // [9] phi fillscreen::cursor#2 = fillscreen::cursor#1 [phi:fillscreen::@2->fillscreen::@1#0] -- register_copy 
    jmp __b1
}
  // scroll_soft
scroll_soft: {
    // [14] scroll#2 = -- scroll#19 -- vbuxx=_dec_vbuxx 
    dex
    // [15] if(scroll#2!=$ff) goto scroll_soft::@1 -- vbuxx_neq_vbuc1_then_la1 
    cpx #$ff
    bne __b1_from_scroll_soft
    // [16] phi from scroll_soft to scroll_soft::@2 [phi:scroll_soft->scroll_soft::@2]
  __b2_from_scroll_soft:
    jmp __b2
    // scroll_soft::@2
  __b2:
    // [17] call scroll_bit
    jsr scroll_bit
    // [18] phi from scroll_soft::@2 to scroll_soft::@1 [phi:scroll_soft::@2->scroll_soft::@1]
  __b1_from___b2:
    // [18] phi current_chargen#12 = current_chargen#21 [phi:scroll_soft::@2->scroll_soft::@1#0] -- register_copy 
    // [18] phi nxt#15 = nxt#37 [phi:scroll_soft::@2->scroll_soft::@1#1] -- register_copy 
    // [18] phi current_bit#13 = current_bit#23 [phi:scroll_soft::@2->scroll_soft::@1#2] -- register_copy 
    // [18] phi scroll#11 = 7 [phi:scroll_soft::@2->scroll_soft::@1#3] -- vbuxx=vbuc1 
    ldx #7
    jmp __b1
    // [18] phi from scroll_soft to scroll_soft::@1 [phi:scroll_soft->scroll_soft::@1]
  __b1_from_scroll_soft:
    // [18] phi current_chargen#12 = current_chargen#28 [phi:scroll_soft->scroll_soft::@1#0] -- register_copy 
    // [18] phi nxt#15 = nxt#33 [phi:scroll_soft->scroll_soft::@1#1] -- register_copy 
    // [18] phi current_bit#13 = current_bit#30 [phi:scroll_soft->scroll_soft::@1#2] -- register_copy 
    // [18] phi scroll#11 = scroll#2 [phi:scroll_soft->scroll_soft::@1#3] -- register_copy 
    jmp __b1
    // scroll_soft::@1
  __b1:
    // [19] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_CONTROL2) = scroll#11 -- _deref_pbuc1=vbuxx 
    stx VICII+OFFSET_STRUCT_MOS6569_VICII_CONTROL2
    jmp __breturn
    // scroll_soft::@return
  __breturn:
    // [20] return 
    rts
}
  // scroll_bit
scroll_bit: {
    .label __7 = 6
    .label c = 6
    .label sc = 2
    // [21] current_bit#4 = current_bit#30 >> 1 -- vbuz1=vbuz1_ror_1 
    lsr.z current_bit
    // [22] if(current_bit#4!=0) goto scroll_bit::@1 -- vbuz1_neq_0_then_la1 
    lda.z current_bit
    bne __b1_from_scroll_bit
    // [23] phi from scroll_bit to scroll_bit::@2 [phi:scroll_bit->scroll_bit::@2]
  __b2_from_scroll_bit:
    jmp __b2
    // scroll_bit::@2
  __b2:
    // [24] call next_char
    jsr next_char
    // [25] next_char::return#0 = next_char::return#1 -- vbuaa=vbuxx 
    txa
    jmp __b8
    // scroll_bit::@8
  __b8:
    // [26] scroll_bit::c#0 = next_char::return#0 -- vwuz1=vbuaa 
    sta.z c
    lda #0
    sta.z c+1
    // [27] scroll_bit::$7 = scroll_bit::c#0 << 3 -- vwuz1=vwuz1_rol_3 
    asl.z __7
    rol.z __7+1
    asl.z __7
    rol.z __7+1
    asl.z __7
    rol.z __7+1
    // [28] current_chargen#4 = CHARGEN + scroll_bit::$7 -- pbuz1=pbuc1_plus_vwuz1 
    lda.z current_chargen
    clc
    adc #<CHARGEN
    sta.z current_chargen
    lda.z current_chargen+1
    adc #>CHARGEN
    sta.z current_chargen+1
    // [29] phi from scroll_bit::@8 to scroll_bit::@1 [phi:scroll_bit::@8->scroll_bit::@1]
  __b1_from___b8:
    // [29] phi nxt#37 = nxt#20 [phi:scroll_bit::@8->scroll_bit::@1#0] -- register_copy 
    // [29] phi current_bit#23 = $80 [phi:scroll_bit::@8->scroll_bit::@1#1] -- vbuz1=vbuc1 
    lda #$80
    sta.z current_bit
    // [29] phi current_chargen#21 = current_chargen#4 [phi:scroll_bit::@8->scroll_bit::@1#2] -- register_copy 
    jmp __b1
    // [29] phi from scroll_bit to scroll_bit::@1 [phi:scroll_bit->scroll_bit::@1]
  __b1_from_scroll_bit:
    // [29] phi nxt#37 = nxt#33 [phi:scroll_bit->scroll_bit::@1#0] -- register_copy 
    // [29] phi current_bit#23 = current_bit#4 [phi:scroll_bit->scroll_bit::@1#1] -- register_copy 
    // [29] phi current_chargen#21 = current_chargen#28 [phi:scroll_bit->scroll_bit::@1#2] -- register_copy 
    jmp __b1
    // scroll_bit::@1
  __b1:
    // [30] call scroll_hard
    // [52] phi from scroll_bit::@1 to scroll_hard [phi:scroll_bit::@1->scroll_hard]
  scroll_hard_from___b1:
    jsr scroll_hard
    jmp __b7
    // scroll_bit::@7
  __b7:
    // asm { sei  }
    sei
    // [32] *PROCPORT = $32 -- _deref_pbuc1=vbuc2 
    lda #$32
    sta PROCPORT
    // [33] phi from scroll_bit::@7 to scroll_bit::@3 [phi:scroll_bit::@7->scroll_bit::@3]
  __b3_from___b7:
    // [33] phi scroll_bit::sc#2 = SCREEN+$28+$27 [phi:scroll_bit::@7->scroll_bit::@3#0] -- pbuz1=pbuc1 
    lda #<SCREEN+$28+$27
    sta.z sc
    lda #>SCREEN+$28+$27
    sta.z sc+1
    // [33] phi scroll_bit::r#2 = 0 [phi:scroll_bit::@7->scroll_bit::@3#1] -- vbuxx=vbuc1 
    ldx #0
    jmp __b3
    // [33] phi from scroll_bit::@4 to scroll_bit::@3 [phi:scroll_bit::@4->scroll_bit::@3]
  __b3_from___b4:
    // [33] phi scroll_bit::sc#2 = scroll_bit::sc#1 [phi:scroll_bit::@4->scroll_bit::@3#0] -- register_copy 
    // [33] phi scroll_bit::r#2 = scroll_bit::r#1 [phi:scroll_bit::@4->scroll_bit::@3#1] -- register_copy 
    jmp __b3
    // scroll_bit::@3
  __b3:
    // [34] scroll_bit::bits#0 = current_chargen#21[scroll_bit::r#2] -- vbuaa=pbuz1_derefidx_vbuxx 
    txa
    tay
    lda (current_chargen),y
    // [35] scroll_bit::$9 = scroll_bit::bits#0 & current_bit#23 -- vbuaa=vbuaa_band_vbuz1 
    and.z current_bit
    // [36] if(scroll_bit::$9==0) goto scroll_bit::@4 -- vbuaa_eq_0_then_la1 
    cmp #0
    beq __b4_from___b3
    // [37] phi from scroll_bit::@3 to scroll_bit::@5 [phi:scroll_bit::@3->scroll_bit::@5]
  __b5_from___b3:
    jmp __b5
    // scroll_bit::@5
  __b5:
    // [38] phi from scroll_bit::@5 to scroll_bit::@4 [phi:scroll_bit::@5->scroll_bit::@4]
  __b4_from___b5:
    // [38] phi scroll_bit::b#2 = $80+' ' [phi:scroll_bit::@5->scroll_bit::@4#0] -- vbuaa=vbuc1 
    lda #$80+' '
    jmp __b4
    // [38] phi from scroll_bit::@3 to scroll_bit::@4 [phi:scroll_bit::@3->scroll_bit::@4]
  __b4_from___b3:
    // [38] phi scroll_bit::b#2 = ' ' [phi:scroll_bit::@3->scroll_bit::@4#0] -- vbuaa=vbuc1 
    lda #' '
    jmp __b4
    // scroll_bit::@4
  __b4:
    // [39] *scroll_bit::sc#2 = scroll_bit::b#2 -- _deref_pbuz1=vbuaa 
    ldy #0
    sta (sc),y
    // [40] scroll_bit::sc#1 = scroll_bit::sc#2 + $28 -- pbuz1=pbuz1_plus_vbuc1 
    lda #$28
    clc
    adc.z sc
    sta.z sc
    bcc !+
    inc.z sc+1
  !:
    // [41] scroll_bit::r#1 = ++ scroll_bit::r#2 -- vbuxx=_inc_vbuxx 
    inx
    // [42] if(scroll_bit::r#1!=8) goto scroll_bit::@3 -- vbuxx_neq_vbuc1_then_la1 
    cpx #8
    bne __b3_from___b4
    jmp __b6
    // scroll_bit::@6
  __b6:
    // [43] *PROCPORT = $37 -- _deref_pbuc1=vbuc2 
    lda #$37
    sta PROCPORT
    // asm { cli  }
    cli
    jmp __breturn
    // scroll_bit::@return
  __breturn:
    // [45] return 
    rts
}
  // next_char
// Find the next char of the scroll text
next_char: {
    // [46] next_char::c#0 = *nxt#33 -- vbuxx=_deref_pbuz1 
    ldy #0
    lda (nxt),y
    tax
    // [47] if(next_char::c#0!=0) goto next_char::@1 -- vbuxx_neq_0_then_la1 
    cpx #0
    bne __b1_from_next_char
    jmp __b2
    // next_char::@2
  __b2:
    // [48] next_char::c#1 = *TEXT -- vbuxx=_deref_pbuc1 
    ldx TEXT
    // [49] phi from next_char::@2 to next_char::@1 [phi:next_char::@2->next_char::@1]
  __b1_from___b2:
    // [49] phi next_char::return#1 = next_char::c#1 [phi:next_char::@2->next_char::@1#0] -- register_copy 
    // [49] phi nxt#19 = TEXT [phi:next_char::@2->next_char::@1#1] -- pbuz1=pbuc1 
    lda #<TEXT
    sta.z nxt
    lda #>TEXT
    sta.z nxt+1
    jmp __b1
    // [49] phi from next_char to next_char::@1 [phi:next_char->next_char::@1]
  __b1_from_next_char:
    // [49] phi next_char::return#1 = next_char::c#0 [phi:next_char->next_char::@1#0] -- register_copy 
    // [49] phi nxt#19 = nxt#33 [phi:next_char->next_char::@1#1] -- register_copy 
    jmp __b1
    // next_char::@1
  __b1:
    // [50] nxt#20 = ++ nxt#19 -- pbuz1=_inc_pbuz1 
    inc.z nxt
    bne !+
    inc.z nxt+1
  !:
    jmp __breturn
    // next_char::@return
  __breturn:
    // [51] return 
    rts
}
  // scroll_hard
scroll_hard: {
    // [53] phi from scroll_hard to scroll_hard::@1 [phi:scroll_hard->scroll_hard::@1]
  __b1_from_scroll_hard:
    // [53] phi scroll_hard::i#2 = 0 [phi:scroll_hard->scroll_hard::@1#0] -- vbuxx=vbuc1 
    ldx #0
    jmp __b1
  // Hard scroll
    // scroll_hard::@1
  __b1:
    // [54] if(scroll_hard::i#2!=$27) goto scroll_hard::@2 -- vbuxx_neq_vbuc1_then_la1 
    cpx #$27
    bne __b2
    jmp __breturn
    // scroll_hard::@return
  __breturn:
    // [55] return 
    rts
    // scroll_hard::@2
  __b2:
    // [56] SCREEN[scroll_hard::i#2] = (SCREEN+1)[scroll_hard::i#2] -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx 
    lda SCREEN+1,x
    sta SCREEN,x
    // [57] (SCREEN+$28*1)[scroll_hard::i#2] = (SCREEN+$28*1+1)[scroll_hard::i#2] -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx 
    lda SCREEN+$28*1+1,x
    sta SCREEN+$28*1,x
    // [58] (SCREEN+$28*2)[scroll_hard::i#2] = (SCREEN+$28*2+1)[scroll_hard::i#2] -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx 
    lda SCREEN+$28*2+1,x
    sta SCREEN+$28*2,x
    // [59] (SCREEN+$28*3)[scroll_hard::i#2] = (SCREEN+$28*3+1)[scroll_hard::i#2] -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx 
    lda SCREEN+$28*3+1,x
    sta SCREEN+$28*3,x
    // [60] (SCREEN+$28*4)[scroll_hard::i#2] = (SCREEN+$28*4+1)[scroll_hard::i#2] -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx 
    lda SCREEN+$28*4+1,x
    sta SCREEN+$28*4,x
    // [61] (SCREEN+$28*5)[scroll_hard::i#2] = (SCREEN+$28*5+1)[scroll_hard::i#2] -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx 
    lda SCREEN+$28*5+1,x
    sta SCREEN+$28*5,x
    // [62] (SCREEN+$28*6)[scroll_hard::i#2] = (SCREEN+$28*6+1)[scroll_hard::i#2] -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx 
    lda SCREEN+$28*6+1,x
    sta SCREEN+$28*6,x
    // [63] (SCREEN+(unsigned int)$28*7)[scroll_hard::i#2] = (SCREEN+(unsigned int)$28*7+1)[scroll_hard::i#2] -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx 
    lda SCREEN+$28*7+1,x
    sta SCREEN+$28*7,x
    // [64] scroll_hard::i#1 = ++ scroll_hard::i#2 -- vbuxx=_inc_vbuxx 
    inx
    // [53] phi from scroll_hard::@2 to scroll_hard::@1 [phi:scroll_hard::@2->scroll_hard::@1]
  __b1_from___b2:
    // [53] phi scroll_hard::i#2 = scroll_hard::i#1 [phi:scroll_hard::@2->scroll_hard::@1#0] -- register_copy 
    jmp __b1
}
  // File Data
.segment Data
  TEXT: .text "-= this is rex of camelot testing a scroller created in kickc. kickc is an optimizing c-compiler for 6502 assembler. =-     "
  .byte 0

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1
Removing instruction jmp __b2
Removing instruction jmp __b3
Removing instruction jmp __b4
Removing instruction jmp __b1
Removing instruction jmp __breturn
Removing instruction jmp __b2
Removing instruction jmp __b1
Removing instruction jmp __breturn
Removing instruction jmp __b2
Removing instruction jmp __b8
Removing instruction jmp __b1
Removing instruction jmp __b7
Removing instruction jmp __b3
Removing instruction jmp __b5
Removing instruction jmp __b4
Removing instruction jmp __b6
Removing instruction jmp __breturn
Removing instruction jmp __b2
Removing instruction jmp __b1
Removing instruction jmp __breturn
Removing instruction jmp __b1
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Replacing label __b1_from___b1 with __b1
Replacing label __b1_from___b4 with __b1
Replacing label __b1_from_scroll_soft with __b1
Replacing label __b1_from_scroll_bit with __b1
Replacing label __b3_from___b4 with __b3
Replacing label __b1_from_next_char with __b1
Removing instruction __b1_from___b1:
Removing instruction __b1_from___b4:
Removing instruction __b2_from_scroll_soft:
Removing instruction __b1_from_scroll_soft:
Removing instruction __b2_from_scroll_bit:
Removing instruction __b1_from_scroll_bit:
Removing instruction scroll_hard_from___b1:
Removing instruction __b3_from___b4:
Removing instruction __b5_from___b3:
Removing instruction __b4_from___b5:
Removing instruction __b1_from_next_char:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction fillscreen_from_main:
Removing instruction __b1_from_main:
Removing instruction __b3:
Removing instruction __b4:
Removing instruction __b1_from_fillscreen:
Removing instruction __breturn:
Removing instruction __b1_from___b2:
Removing instruction __b2:
Removing instruction __b1_from___b2:
Removing instruction __breturn:
Removing instruction __b2:
Removing instruction __b8:
Removing instruction __b1_from___b8:
Removing instruction __b7:
Removing instruction __b3_from___b7:
Removing instruction __b5:
Removing instruction __b6:
Removing instruction __breturn:
Removing instruction __b2:
Removing instruction __b1_from___b2:
Removing instruction __breturn:
Removing instruction __b1_from_scroll_hard:
Removing instruction __breturn:
Removing instruction __b1_from___b2:
Succesful ASM optimization Pass5UnusedLabelElimination
Relabelling long label __b4_from___b3 to __b2
Succesful ASM optimization Pass5RelabelLongLabels
Removing instruction jmp __b1
Removing instruction jmp __b1
Removing instruction jmp __b1
Removing instruction jmp __b3
Removing instruction jmp __b1
Succesful ASM optimization Pass5NextJumpElimination

FINAL SYMBOL TABLE
__constant char * const CHARGEN = (char *) 53248
__constant char OFFSET_STRUCT_MOS6569_VICII_BG_COLOR = $21
__constant char OFFSET_STRUCT_MOS6569_VICII_CONTROL2 = $16
__constant char OFFSET_STRUCT_MOS6569_VICII_RASTER = $12
__constant char * const PROCPORT = (char *) 1
__constant char *SCREEN = (char *) 1024
__constant char *TEXT = "-= this is rex of camelot testing a scroller created in kickc. kickc is an optimizing c-compiler for 6502 assembler. =-     "
__constant struct MOS6569_VICII * const VICII = (struct MOS6569_VICII *) 53248
char current_bit
char current_bit#13 // current_bit zp[1]:8 42.599999999999994
char current_bit#23 // current_bit zp[1]:8 5616.833333333334
char current_bit#30 // current_bit zp[1]:8 187.85714285714286
char current_bit#4 // current_bit zp[1]:8 1501.5
char *current_chargen
char *current_chargen#12 // current_chargen zp[2]:6 42.599999999999994
char *current_chargen#21 // current_chargen zp[2]:6 5672.444444444444
char *current_chargen#28 // current_chargen zp[2]:6 146.11111111111111
char *current_chargen#4 // current_chargen zp[2]:6 2002.0
void fillscreen(char *screen , char fill)
char *fillscreen::cursor
char *fillscreen::cursor#1 // cursor zp[2]:6 202.0
char *fillscreen::cursor#2 // cursor zp[2]:6 134.66666666666666
char fillscreen::fill
__constant char fillscreen::fill#0 = $20 // fill
char *fillscreen::screen
void main()
char next_char()
char next_char::c
char next_char::c#0 // reg byte x 15001.5
char next_char::c#1 // reg byte x 20002.0
char next_char::return
char next_char::return#0 // reg byte a 2002.0
char next_char::return#1 // reg byte x 5250.75
char *nxt
char *nxt#15 // nxt zp[2]:4 42.599999999999994
char *nxt#19 // nxt zp[2]:4 20002.0
char *nxt#20 // nxt zp[2]:4 1571.7142857142858
char *nxt#33 // nxt zp[2]:4 1776.4166666666665
char *nxt#37 // nxt zp[2]:4 116.83333333333334
char scroll
char scroll#11 // reg byte x 42.599999999999994
char scroll#19 // reg byte x 78.5
char scroll#2 // reg byte x 151.5
void scroll_bit()
unsigned int scroll_bit::$7 // zp[2]:6 2002.0
char scroll_bit::$9 // reg byte a 200002.0
char scroll_bit::b
char scroll_bit::b#2 // reg byte a 100001.0
char scroll_bit::bits
char scroll_bit::bits#0 // reg byte a 200002.0
unsigned int scroll_bit::c
unsigned int scroll_bit::c#0 // c zp[2]:6 2002.0
char scroll_bit::r
char scroll_bit::r#1 // reg byte x 150001.5
char scroll_bit::r#2 // reg byte x 37500.375
char *scroll_bit::sc
char *scroll_bit::sc#1 // sc zp[2]:2 66667.33333333333
char *scroll_bit::sc#2 // sc zp[2]:2 42857.57142857143
void scroll_hard()
char scroll_hard::i
char scroll_hard::i#1 // reg byte x 2000002.0
char scroll_hard::i#2 // reg byte x 1900001.9000000006
void scroll_soft()

reg byte x [ scroll#19 scroll#11 scroll#2 ]
zp[1]:8 [ current_bit#30 current_bit#13 current_bit#23 current_bit#4 ]
zp[2]:6 [ fillscreen::cursor#2 fillscreen::cursor#1 current_chargen#28 current_chargen#12 current_chargen#21 current_chargen#4 scroll_bit::$7 scroll_bit::c#0 ]
reg byte x [ scroll_bit::r#2 scroll_bit::r#1 ]
zp[2]:2 [ scroll_bit::sc#2 scroll_bit::sc#1 ]
reg byte a [ scroll_bit::b#2 ]
zp[2]:4 [ nxt#19 nxt#33 nxt#15 nxt#37 nxt#20 ]
reg byte x [ next_char::return#1 next_char::c#0 next_char::c#1 ]
reg byte x [ scroll_hard::i#2 scroll_hard::i#1 ]
reg byte a [ next_char::return#0 ]
reg byte a [ scroll_bit::bits#0 ]
reg byte a [ scroll_bit::$9 ]


FINAL ASSEMBLER
Score: 20884

  // File Comments
// An 8x8 char letter scroller
/// @file
/// Commodore 64 Registers and Constants
/// @file
/// The MOS 6526 Complex Interface Adapter (CIA)
///
/// http://archive.6502.org/datasheets/mos_6526_cia_recreated.pdf
  // Upstart
  // Commodore 64 PRG executable file
.file [name="scrollbig.prg", type="prg", segments="Program"]
.segmentdef Program [segments="Basic, Code, Data"]
.segmentdef Basic [start=$0801]
.segmentdef Code [start=$80d]
.segmentdef Data [startAfter="Code"]
.segment Basic
:BasicUpstart(main)
  // Global Constants & labels
  .const OFFSET_STRUCT_MOS6569_VICII_RASTER = $12
  .const OFFSET_STRUCT_MOS6569_VICII_BG_COLOR = $21
  .const OFFSET_STRUCT_MOS6569_VICII_CONTROL2 = $16
  /// Processor Port Register controlling RAM/ROM configuration and the datasette
  .label PROCPORT = 1
  /// The address of the CHARGEN character set
  .label CHARGEN = $d000
  /// The VIC-II MOS 6567/6569
  .label VICII = $d000
  .label SCREEN = $400
  .label current_bit = 8
  // Scroll the next bit from the current char onto the screen - trigger next char if needed
  .label current_chargen = 6
  .label nxt = 4
.segment Code
  // main
main: {
    // fillscreen(SCREEN, $20)
    // [1] call fillscreen
    // [8] phi from main to fillscreen [phi:main->fillscreen]
    jsr fillscreen
    // [2] phi from main to main::@1 [phi:main->main::@1]
    // [2] phi current_chargen#28 = CHARGEN [phi:main->main::@1#0] -- pbuz1=pbuc1 
    lda #<CHARGEN
    sta.z current_chargen
    lda #>CHARGEN
    sta.z current_chargen+1
    // [2] phi nxt#33 = TEXT [phi:main->main::@1#1] -- pbuz1=pbuc1 
    lda #<TEXT
    sta.z nxt
    lda #>TEXT
    sta.z nxt+1
    // [2] phi current_bit#30 = 1 [phi:main->main::@1#2] -- vbuz1=vbuc1 
    lda #1
    sta.z current_bit
    // [2] phi scroll#19 = 7 [phi:main->main::@1#3] -- vbuxx=vbuc1 
    ldx #7
  // Wait for raster
    // [2] phi from main::@1 main::@4 to main::@1 [phi:main::@1/main::@4->main::@1]
    // [2] phi current_chargen#28 = current_chargen#28 [phi:main::@1/main::@4->main::@1#0] -- register_copy 
    // [2] phi nxt#33 = nxt#33 [phi:main::@1/main::@4->main::@1#1] -- register_copy 
    // [2] phi current_bit#30 = current_bit#30 [phi:main::@1/main::@4->main::@1#2] -- register_copy 
    // [2] phi scroll#19 = scroll#19 [phi:main::@1/main::@4->main::@1#3] -- register_copy 
    // main::@1
  __b1:
    // while(VICII->RASTER!=$fe)
    // [3] if(*((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_RASTER)!=$fe) goto main::@1 -- _deref_pbuc1_neq_vbuc2_then_la1 
    lda #$fe
    cmp VICII+OFFSET_STRUCT_MOS6569_VICII_RASTER
    bne __b1
    // main::@2
  __b2:
    // while(VICII->RASTER!=$ff)
    // [4] if(*((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_RASTER)!=$ff) goto main::@2 -- _deref_pbuc1_neq_vbuc2_then_la1 
    lda #$ff
    cmp VICII+OFFSET_STRUCT_MOS6569_VICII_RASTER
    bne __b2
    // main::@3
    // ++VICII->BG_COLOR;
    // [5] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR) = ++ *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR) -- _deref_pbuc1=_inc__deref_pbuc1 
    inc VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR
    // scroll_soft()
    // [6] call scroll_soft
    jsr scroll_soft
    // main::@4
    // --VICII->BG_COLOR;
    // [7] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR) = -- *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR) -- _deref_pbuc1=_dec__deref_pbuc1 
    dec VICII+OFFSET_STRUCT_MOS6569_VICII_BG_COLOR
    jmp __b1
}
  // fillscreen
// Fill the screen with one char
// void fillscreen(char *screen, char fill)
fillscreen: {
    .const fill = $20
    .label cursor = 6
    // [9] phi from fillscreen to fillscreen::@1 [phi:fillscreen->fillscreen::@1]
    // [9] phi fillscreen::cursor#2 = SCREEN [phi:fillscreen->fillscreen::@1#0] -- pbuz1=pbuc1 
    lda #<SCREEN
    sta.z cursor
    lda #>SCREEN
    sta.z cursor+1
    // fillscreen::@1
  __b1:
    // for( char* cursor = screen; cursor < screen+1000; cursor++)
    // [10] if(fillscreen::cursor#2<SCREEN+$3e8) goto fillscreen::@2 -- pbuz1_lt_pbuc1_then_la1 
    lda.z cursor+1
    cmp #>SCREEN+$3e8
    bcc __b2
    bne !+
    lda.z cursor
    cmp #<SCREEN+$3e8
    bcc __b2
  !:
    // fillscreen::@return
    // }
    // [11] return 
    rts
    // fillscreen::@2
  __b2:
    // *cursor = fill
    // [12] *fillscreen::cursor#2 = fillscreen::fill#0 -- _deref_pbuz1=vbuc1 
    lda #fill
    ldy #0
    sta (cursor),y
    // for( char* cursor = screen; cursor < screen+1000; cursor++)
    // [13] fillscreen::cursor#1 = ++ fillscreen::cursor#2 -- pbuz1=_inc_pbuz1 
    inc.z cursor
    bne !+
    inc.z cursor+1
  !:
    // [9] phi from fillscreen::@2 to fillscreen::@1 [phi:fillscreen::@2->fillscreen::@1]
    // [9] phi fillscreen::cursor#2 = fillscreen::cursor#1 [phi:fillscreen::@2->fillscreen::@1#0] -- register_copy 
    jmp __b1
}
  // scroll_soft
scroll_soft: {
    // if(--scroll==$ff)
    // [14] scroll#2 = -- scroll#19 -- vbuxx=_dec_vbuxx 
    dex
    // [15] if(scroll#2!=$ff) goto scroll_soft::@1 -- vbuxx_neq_vbuc1_then_la1 
    cpx #$ff
    bne __b1
    // [16] phi from scroll_soft to scroll_soft::@2 [phi:scroll_soft->scroll_soft::@2]
    // scroll_soft::@2
    // scroll_bit()
    // [17] call scroll_bit
    jsr scroll_bit
    // [18] phi from scroll_soft::@2 to scroll_soft::@1 [phi:scroll_soft::@2->scroll_soft::@1]
    // [18] phi current_chargen#12 = current_chargen#21 [phi:scroll_soft::@2->scroll_soft::@1#0] -- register_copy 
    // [18] phi nxt#15 = nxt#37 [phi:scroll_soft::@2->scroll_soft::@1#1] -- register_copy 
    // [18] phi current_bit#13 = current_bit#23 [phi:scroll_soft::@2->scroll_soft::@1#2] -- register_copy 
    // [18] phi scroll#11 = 7 [phi:scroll_soft::@2->scroll_soft::@1#3] -- vbuxx=vbuc1 
    ldx #7
    // [18] phi from scroll_soft to scroll_soft::@1 [phi:scroll_soft->scroll_soft::@1]
    // [18] phi current_chargen#12 = current_chargen#28 [phi:scroll_soft->scroll_soft::@1#0] -- register_copy 
    // [18] phi nxt#15 = nxt#33 [phi:scroll_soft->scroll_soft::@1#1] -- register_copy 
    // [18] phi current_bit#13 = current_bit#30 [phi:scroll_soft->scroll_soft::@1#2] -- register_copy 
    // [18] phi scroll#11 = scroll#2 [phi:scroll_soft->scroll_soft::@1#3] -- register_copy 
    // scroll_soft::@1
  __b1:
    // VICII->CONTROL2 = scroll
    // [19] *((char *)VICII+OFFSET_STRUCT_MOS6569_VICII_CONTROL2) = scroll#11 -- _deref_pbuc1=vbuxx 
    stx VICII+OFFSET_STRUCT_MOS6569_VICII_CONTROL2
    // scroll_soft::@return
    // }
    // [20] return 
    rts
}
  // scroll_bit
scroll_bit: {
    .label __7 = 6
    .label c = 6
    .label sc = 2
    // current_bit = current_bit/2
    // [21] current_bit#4 = current_bit#30 >> 1 -- vbuz1=vbuz1_ror_1 
    lsr.z current_bit
    // if(current_bit==0)
    // [22] if(current_bit#4!=0) goto scroll_bit::@1 -- vbuz1_neq_0_then_la1 
    lda.z current_bit
    bne __b1
    // [23] phi from scroll_bit to scroll_bit::@2 [phi:scroll_bit->scroll_bit::@2]
    // scroll_bit::@2
    // unsigned int c = next_char()
    // [24] call next_char
    jsr next_char
    // [25] next_char::return#0 = next_char::return#1 -- vbuaa=vbuxx 
    txa
    // scroll_bit::@8
    // [26] scroll_bit::c#0 = next_char::return#0 -- vwuz1=vbuaa 
    sta.z c
    lda #0
    sta.z c+1
    // c*8
    // [27] scroll_bit::$7 = scroll_bit::c#0 << 3 -- vwuz1=vwuz1_rol_3 
    asl.z __7
    rol.z __7+1
    asl.z __7
    rol.z __7+1
    asl.z __7
    rol.z __7+1
    // current_chargen = CHARGEN+c*8
    // [28] current_chargen#4 = CHARGEN + scroll_bit::$7 -- pbuz1=pbuc1_plus_vwuz1 
    lda.z current_chargen
    clc
    adc #<CHARGEN
    sta.z current_chargen
    lda.z current_chargen+1
    adc #>CHARGEN
    sta.z current_chargen+1
    // [29] phi from scroll_bit::@8 to scroll_bit::@1 [phi:scroll_bit::@8->scroll_bit::@1]
    // [29] phi nxt#37 = nxt#20 [phi:scroll_bit::@8->scroll_bit::@1#0] -- register_copy 
    // [29] phi current_bit#23 = $80 [phi:scroll_bit::@8->scroll_bit::@1#1] -- vbuz1=vbuc1 
    lda #$80
    sta.z current_bit
    // [29] phi current_chargen#21 = current_chargen#4 [phi:scroll_bit::@8->scroll_bit::@1#2] -- register_copy 
    // [29] phi from scroll_bit to scroll_bit::@1 [phi:scroll_bit->scroll_bit::@1]
    // [29] phi nxt#37 = nxt#33 [phi:scroll_bit->scroll_bit::@1#0] -- register_copy 
    // [29] phi current_bit#23 = current_bit#4 [phi:scroll_bit->scroll_bit::@1#1] -- register_copy 
    // [29] phi current_chargen#21 = current_chargen#28 [phi:scroll_bit->scroll_bit::@1#2] -- register_copy 
    // scroll_bit::@1
  __b1:
    // scroll_hard()
    // [30] call scroll_hard
    // [52] phi from scroll_bit::@1 to scroll_hard [phi:scroll_bit::@1->scroll_hard]
    jsr scroll_hard
    // scroll_bit::@7
    // asm
    // asm { sei  }
    sei
    // *PROCPORT = $32
    // [32] *PROCPORT = $32 -- _deref_pbuc1=vbuc2 
    lda #$32
    sta PROCPORT
    // [33] phi from scroll_bit::@7 to scroll_bit::@3 [phi:scroll_bit::@7->scroll_bit::@3]
    // [33] phi scroll_bit::sc#2 = SCREEN+$28+$27 [phi:scroll_bit::@7->scroll_bit::@3#0] -- pbuz1=pbuc1 
    lda #<SCREEN+$28+$27
    sta.z sc
    lda #>SCREEN+$28+$27
    sta.z sc+1
    // [33] phi scroll_bit::r#2 = 0 [phi:scroll_bit::@7->scroll_bit::@3#1] -- vbuxx=vbuc1 
    ldx #0
    // [33] phi from scroll_bit::@4 to scroll_bit::@3 [phi:scroll_bit::@4->scroll_bit::@3]
    // [33] phi scroll_bit::sc#2 = scroll_bit::sc#1 [phi:scroll_bit::@4->scroll_bit::@3#0] -- register_copy 
    // [33] phi scroll_bit::r#2 = scroll_bit::r#1 [phi:scroll_bit::@4->scroll_bit::@3#1] -- register_copy 
    // scroll_bit::@3
  __b3:
    // char bits = current_chargen[r]
    // [34] scroll_bit::bits#0 = current_chargen#21[scroll_bit::r#2] -- vbuaa=pbuz1_derefidx_vbuxx 
    txa
    tay
    lda (current_chargen),y
    // bits & current_bit
    // [35] scroll_bit::$9 = scroll_bit::bits#0 & current_bit#23 -- vbuaa=vbuaa_band_vbuz1 
    and.z current_bit
    // if((bits & current_bit) != 0)
    // [36] if(scroll_bit::$9==0) goto scroll_bit::@4 -- vbuaa_eq_0_then_la1 
    cmp #0
    beq __b2
    // [37] phi from scroll_bit::@3 to scroll_bit::@5 [phi:scroll_bit::@3->scroll_bit::@5]
    // scroll_bit::@5
    // [38] phi from scroll_bit::@5 to scroll_bit::@4 [phi:scroll_bit::@5->scroll_bit::@4]
    // [38] phi scroll_bit::b#2 = $80+' ' [phi:scroll_bit::@5->scroll_bit::@4#0] -- vbuaa=vbuc1 
    lda #$80+' '
    jmp __b4
    // [38] phi from scroll_bit::@3 to scroll_bit::@4 [phi:scroll_bit::@3->scroll_bit::@4]
  __b2:
    // [38] phi scroll_bit::b#2 = ' ' [phi:scroll_bit::@3->scroll_bit::@4#0] -- vbuaa=vbuc1 
    lda #' '
    // scroll_bit::@4
  __b4:
    // *sc = b
    // [39] *scroll_bit::sc#2 = scroll_bit::b#2 -- _deref_pbuz1=vbuaa 
    ldy #0
    sta (sc),y
    // sc = sc+40
    // [40] scroll_bit::sc#1 = scroll_bit::sc#2 + $28 -- pbuz1=pbuz1_plus_vbuc1 
    lda #$28
    clc
    adc.z sc
    sta.z sc
    bcc !+
    inc.z sc+1
  !:
    // for(char r:0..7)
    // [41] scroll_bit::r#1 = ++ scroll_bit::r#2 -- vbuxx=_inc_vbuxx 
    inx
    // [42] if(scroll_bit::r#1!=8) goto scroll_bit::@3 -- vbuxx_neq_vbuc1_then_la1 
    cpx #8
    bne __b3
    // scroll_bit::@6
    // *PROCPORT = $37
    // [43] *PROCPORT = $37 -- _deref_pbuc1=vbuc2 
    lda #$37
    sta PROCPORT
    // asm
    // asm { cli  }
    cli
    // scroll_bit::@return
    // }
    // [45] return 
    rts
}
  // next_char
// Find the next char of the scroll text
next_char: {
    // char c = *nxt
    // [46] next_char::c#0 = *nxt#33 -- vbuxx=_deref_pbuz1 
    ldy #0
    lda (nxt),y
    tax
    // if(c==0)
    // [47] if(next_char::c#0!=0) goto next_char::@1 -- vbuxx_neq_0_then_la1 
    cpx #0
    bne __b1
    // next_char::@2
    // c = *nxt
    // [48] next_char::c#1 = *TEXT -- vbuxx=_deref_pbuc1 
    ldx TEXT
    // [49] phi from next_char::@2 to next_char::@1 [phi:next_char::@2->next_char::@1]
    // [49] phi next_char::return#1 = next_char::c#1 [phi:next_char::@2->next_char::@1#0] -- register_copy 
    // [49] phi nxt#19 = TEXT [phi:next_char::@2->next_char::@1#1] -- pbuz1=pbuc1 
    lda #<TEXT
    sta.z nxt
    lda #>TEXT
    sta.z nxt+1
    // [49] phi from next_char to next_char::@1 [phi:next_char->next_char::@1]
    // [49] phi next_char::return#1 = next_char::c#0 [phi:next_char->next_char::@1#0] -- register_copy 
    // [49] phi nxt#19 = nxt#33 [phi:next_char->next_char::@1#1] -- register_copy 
    // next_char::@1
  __b1:
    // nxt++;
    // [50] nxt#20 = ++ nxt#19 -- pbuz1=_inc_pbuz1 
    inc.z nxt
    bne !+
    inc.z nxt+1
  !:
    // next_char::@return
    // }
    // [51] return 
    rts
}
  // scroll_hard
scroll_hard: {
    // [53] phi from scroll_hard to scroll_hard::@1 [phi:scroll_hard->scroll_hard::@1]
    // [53] phi scroll_hard::i#2 = 0 [phi:scroll_hard->scroll_hard::@1#0] -- vbuxx=vbuc1 
    ldx #0
  // Hard scroll
    // scroll_hard::@1
  __b1:
    // for(char i=0;i!=39;i++)
    // [54] if(scroll_hard::i#2!=$27) goto scroll_hard::@2 -- vbuxx_neq_vbuc1_then_la1 
    cpx #$27
    bne __b2
    // scroll_hard::@return
    // }
    // [55] return 
    rts
    // scroll_hard::@2
  __b2:
    // (SCREEN+40*0)[i]=(SCREEN+40*0)[i+1]
    // [56] SCREEN[scroll_hard::i#2] = (SCREEN+1)[scroll_hard::i#2] -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx 
    lda SCREEN+1,x
    sta SCREEN,x
    // (SCREEN+40*1)[i]=(SCREEN+40*1)[i+1]
    // [57] (SCREEN+$28*1)[scroll_hard::i#2] = (SCREEN+$28*1+1)[scroll_hard::i#2] -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx 
    lda SCREEN+$28*1+1,x
    sta SCREEN+$28*1,x
    // (SCREEN+40*2)[i]=(SCREEN+40*2)[i+1]
    // [58] (SCREEN+$28*2)[scroll_hard::i#2] = (SCREEN+$28*2+1)[scroll_hard::i#2] -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx 
    lda SCREEN+$28*2+1,x
    sta SCREEN+$28*2,x
    // (SCREEN+40*3)[i]=(SCREEN+40*3)[i+1]
    // [59] (SCREEN+$28*3)[scroll_hard::i#2] = (SCREEN+$28*3+1)[scroll_hard::i#2] -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx 
    lda SCREEN+$28*3+1,x
    sta SCREEN+$28*3,x
    // (SCREEN+40*4)[i]=(SCREEN+40*4)[i+1]
    // [60] (SCREEN+$28*4)[scroll_hard::i#2] = (SCREEN+$28*4+1)[scroll_hard::i#2] -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx 
    lda SCREEN+$28*4+1,x
    sta SCREEN+$28*4,x
    // (SCREEN+40*5)[i]=(SCREEN+40*5)[i+1]
    // [61] (SCREEN+$28*5)[scroll_hard::i#2] = (SCREEN+$28*5+1)[scroll_hard::i#2] -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx 
    lda SCREEN+$28*5+1,x
    sta SCREEN+$28*5,x
    // (SCREEN+40*6)[i]=(SCREEN+40*6)[i+1]
    // [62] (SCREEN+$28*6)[scroll_hard::i#2] = (SCREEN+$28*6+1)[scroll_hard::i#2] -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx 
    lda SCREEN+$28*6+1,x
    sta SCREEN+$28*6,x
    // (SCREEN+40*7)[i]=(SCREEN+40*7)[i+1]
    // [63] (SCREEN+(unsigned int)$28*7)[scroll_hard::i#2] = (SCREEN+(unsigned int)$28*7+1)[scroll_hard::i#2] -- pbuc1_derefidx_vbuxx=pbuc2_derefidx_vbuxx 
    lda SCREEN+$28*7+1,x
    sta SCREEN+$28*7,x
    // for(char i=0;i!=39;i++)
    // [64] scroll_hard::i#1 = ++ scroll_hard::i#2 -- vbuxx=_inc_vbuxx 
    inx
    // [53] phi from scroll_hard::@2 to scroll_hard::@1 [phi:scroll_hard::@2->scroll_hard::@1]
    // [53] phi scroll_hard::i#2 = scroll_hard::i#1 [phi:scroll_hard::@2->scroll_hard::@1#0] -- register_copy 
    jmp __b1
}
  // File Data
.segment Data
  TEXT: .text "-= this is rex of camelot testing a scroller created in kickc. kickc is an optimizing c-compiler for 6502 assembler. =-     "
  .byte 0

