Inlined call vicSelectGfxBank::$0 = call toDd00(vicSelectGfxBank::gfx)
Inlined call call __init

CONTROL FLOW GRAPH SSA

void main()
main: scope:[main]  from __start::@1
  *DTV_FEATURE = DTV_FEATURE_ENABLE
  *DTV_BLITTER_CONTROL2 = DTV_BLIT_CLEAR_IRQ
  *DTV_BLITTER_SRCA_LO = byte0 SRCA
  *DTV_BLITTER_SRCA_MI = byte1 SRCA
  *DTV_BLITTER_SRCA_HI = 0
  *DTV_BLITTER_SRCA_MOD_LO = 0
  *DTV_BLITTER_SRCA_MOD_HI = 0
  *DTV_BLITTER_SRCA_LIN_LO = byte0 $100
  *DTV_BLITTER_SRCA_LIN_HI = byte1 $100
  *DTV_BLITTER_SRCA_STEP = $10
  *DTV_BLITTER_SRCB_LO = byte0 SRCB
  *DTV_BLITTER_SRCB_MI = byte1 SRCB
  *DTV_BLITTER_SRCB_HI = 0
  *DTV_BLITTER_SRCB_MOD_LO = 0
  *DTV_BLITTER_SRCB_MOD_HI = 0
  *DTV_BLITTER_SRCB_LIN_LO = byte0 $100
  *DTV_BLITTER_SRCB_LIN_HI = byte1 $100
  *DTV_BLITTER_SRCB_STEP = 0
  *DTV_BLITTER_DEST_LO = byte0 SCREEN
  *DTV_BLITTER_DEST_MI = byte1 SCREEN
  *DTV_BLITTER_DEST_HI = 0
  *DTV_BLITTER_DEST_MOD_LO = 0
  *DTV_BLITTER_DEST_MOD_HI = 0
  *DTV_BLITTER_DEST_LIN_LO = byte0 $100
  *DTV_BLITTER_DEST_LIN_HI = byte1 $100
  *DTV_BLITTER_DEST_STEP = $10
  *DTV_BLITTER_LEN_LO = SRCA_LEN
  *DTV_BLITTER_LEN_HI = 0
  *DTV_BLITTER_ALU = DTV_BLIT_ADD
  *DTV_BLITTER_TRANSPARANCY = DTV_BLIT_TRANSPARANCY_NONE
  *DTV_BLITTER_CONTROL = DTV_BLIT_FORCE_START|DTV_BLIT_SRCA_FWD|DTV_BLIT_SRCB_FWD|DTV_BLIT_DEST_FWD
  *DTV_BLITTER_CONTROL2 = DTV_BLIT_DEST_CONT
  main::r#0 = 0
  to:main::@1
main::@1: scope:[main]  from main main::@1 main::@2
  main::r#3 = phi( main/main::r#0, main::@1/main::r#3, main::@2/main::r#1 )
  main::$0 = *DTV_BLITTER_CONTROL2 & DTV_BLIT_STATUS_BUSY
  main::$1 = main::$0 != 0
  if(main::$1) goto main::@1
  to:main::@2
main::@2: scope:[main]  from main::@1
  main::r#2 = phi( main::@1/main::r#3 )
  *DTV_BLITTER_CONTROL = DTV_BLIT_FORCE_START|DTV_BLIT_SRCA_FWD|DTV_BLIT_SRCB_FWD|DTV_BLIT_DEST_FWD
  main::r#1 = main::r#2 + rangenext(0,7)
  main::$2 = main::r#1 != rangelast(0,7)
  if(main::$2) goto main::@1
  to:main::@return
main::@return: scope:[main]  from main::@2
  return 
  to:@return

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

SYMBOL TABLE SSA
__constant char *DTV_BLITTER_ALU = (char *)$d33e
__constant char * const DTV_BLITTER_CONTROL = (char *)$d33a
__constant char * const DTV_BLITTER_CONTROL2 = (char *)$d33f
__constant char * const DTV_BLITTER_DEST_HI = (char *)$d332
__constant char * const DTV_BLITTER_DEST_LIN_HI = (char *)$d336
__constant char * const DTV_BLITTER_DEST_LIN_LO = (char *)$d335
__constant char * const DTV_BLITTER_DEST_LO = (char *)$d330
__constant char * const DTV_BLITTER_DEST_MI = (char *)$d331
__constant char * const DTV_BLITTER_DEST_MOD_HI = (char *)$d334
__constant char * const DTV_BLITTER_DEST_MOD_LO = (char *)$d333
__constant char * const DTV_BLITTER_DEST_STEP = (char *)$d337
__constant char * const DTV_BLITTER_LEN_HI = (char *)$d339
__constant char * const DTV_BLITTER_LEN_LO = (char *)$d338
__constant char * const DTV_BLITTER_SRCA_HI = (char *)$d322
__constant char * const DTV_BLITTER_SRCA_LIN_HI = (char *)$d326
__constant char * const DTV_BLITTER_SRCA_LIN_LO = (char *)$d325
__constant char * const DTV_BLITTER_SRCA_LO = (char *)$d320
__constant char * const DTV_BLITTER_SRCA_MI = (char *)$d321
__constant char * const DTV_BLITTER_SRCA_MOD_HI = (char *)$d324
__constant char * const DTV_BLITTER_SRCA_MOD_LO = (char *)$d323
__constant char * const DTV_BLITTER_SRCA_STEP = (char *)$d327
__constant char * const DTV_BLITTER_SRCB_HI = (char *)$d32a
__constant char * const DTV_BLITTER_SRCB_LIN_HI = (char *)$d32e
__constant char * const DTV_BLITTER_SRCB_LIN_LO = (char *)$d32d
__constant char * const DTV_BLITTER_SRCB_LO = (char *)$d328
__constant char * const DTV_BLITTER_SRCB_MI = (char *)$d329
__constant char * const DTV_BLITTER_SRCB_MOD_HI = (char *)$d32c
__constant char * const DTV_BLITTER_SRCB_MOD_LO = (char *)$d32b
__constant char * const DTV_BLITTER_SRCB_STEP = (char *)$d32f
__constant char * const DTV_BLITTER_TRANSPARANCY = (char *)$d33b
__constant const char DTV_BLIT_ADD = $30
__constant const char DTV_BLIT_CLEAR_IRQ = 1
__constant const char DTV_BLIT_DEST_CONT = 8
__constant const char DTV_BLIT_DEST_FWD = 8
__constant const char DTV_BLIT_FORCE_START = 1
__constant const char DTV_BLIT_SRCA_FWD = 2
__constant const char DTV_BLIT_SRCB_FWD = 4
__constant const char DTV_BLIT_STATUS_BUSY = 1
__constant const char DTV_BLIT_TRANSPARANCY_NONE = 0
__constant char * const DTV_FEATURE = (char *)$d03f
__constant const char DTV_FEATURE_ENABLE = 1
__constant char * const SCREEN = (char *)$400
__constant const char SRCA[] = { 'c', 'a', 'm', 'e', 'l', 'o', 't', '!', ' ' }
__constant const char SRCA_LEN = 9
__constant const char SRCB[] = { $80 }
void __start()
void main()
char main::$0
bool main::$1
bool main::$2
char main::r
char main::r#0
char main::r#1
char main::r#2
char main::r#3

Adding number conversion cast (unumber) 0 in *DTV_BLITTER_SRCA_HI = 0
Adding number conversion cast (unumber) 0 in *DTV_BLITTER_SRCA_MOD_LO = 0
Adding number conversion cast (unumber) 0 in *DTV_BLITTER_SRCA_MOD_HI = 0
Adding number conversion cast (unumber) $10 in *DTV_BLITTER_SRCA_STEP = $10
Adding number conversion cast (unumber) 0 in *DTV_BLITTER_SRCB_HI = 0
Adding number conversion cast (unumber) 0 in *DTV_BLITTER_SRCB_MOD_LO = 0
Adding number conversion cast (unumber) 0 in *DTV_BLITTER_SRCB_MOD_HI = 0
Adding number conversion cast (unumber) 0 in *DTV_BLITTER_SRCB_STEP = 0
Adding number conversion cast (unumber) 0 in *DTV_BLITTER_DEST_HI = 0
Adding number conversion cast (unumber) 0 in *DTV_BLITTER_DEST_MOD_LO = 0
Adding number conversion cast (unumber) 0 in *DTV_BLITTER_DEST_MOD_HI = 0
Adding number conversion cast (unumber) $10 in *DTV_BLITTER_DEST_STEP = $10
Adding number conversion cast (unumber) 0 in *DTV_BLITTER_LEN_HI = 0
Adding number conversion cast (unumber) 0 in main::$1 = main::$0 != 0
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast *DTV_BLITTER_SRCA_HI = (unumber)0
Inlining cast *DTV_BLITTER_SRCA_MOD_LO = (unumber)0
Inlining cast *DTV_BLITTER_SRCA_MOD_HI = (unumber)0
Inlining cast *DTV_BLITTER_SRCA_STEP = (unumber)$10
Inlining cast *DTV_BLITTER_SRCB_HI = (unumber)0
Inlining cast *DTV_BLITTER_SRCB_MOD_LO = (unumber)0
Inlining cast *DTV_BLITTER_SRCB_MOD_HI = (unumber)0
Inlining cast *DTV_BLITTER_SRCB_STEP = (unumber)0
Inlining cast *DTV_BLITTER_DEST_HI = (unumber)0
Inlining cast *DTV_BLITTER_DEST_MOD_LO = (unumber)0
Inlining cast *DTV_BLITTER_DEST_MOD_HI = (unumber)0
Inlining cast *DTV_BLITTER_DEST_STEP = (unumber)$10
Inlining cast *DTV_BLITTER_LEN_HI = (unumber)0
Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (char *) 53311
Simplifying constant pointer cast (char *) 54048
Simplifying constant pointer cast (char *) 54049
Simplifying constant pointer cast (char *) 54050
Simplifying constant pointer cast (char *) 54051
Simplifying constant pointer cast (char *) 54052
Simplifying constant pointer cast (char *) 54053
Simplifying constant pointer cast (char *) 54054
Simplifying constant pointer cast (char *) 54055
Simplifying constant pointer cast (char *) 54056
Simplifying constant pointer cast (char *) 54057
Simplifying constant pointer cast (char *) 54058
Simplifying constant pointer cast (char *) 54059
Simplifying constant pointer cast (char *) 54060
Simplifying constant pointer cast (char *) 54061
Simplifying constant pointer cast (char *) 54062
Simplifying constant pointer cast (char *) 54063
Simplifying constant pointer cast (char *) 54064
Simplifying constant pointer cast (char *) 54065
Simplifying constant pointer cast (char *) 54066
Simplifying constant pointer cast (char *) 54067
Simplifying constant pointer cast (char *) 54068
Simplifying constant pointer cast (char *) 54069
Simplifying constant pointer cast (char *) 54070
Simplifying constant pointer cast (char *) 54071
Simplifying constant pointer cast (char *) 54072
Simplifying constant pointer cast (char *) 54073
Simplifying constant pointer cast (char *) 54074
Simplifying constant pointer cast (char *) 54075
Simplifying constant pointer cast (char *) 54079
Simplifying constant pointer cast (char *) 1024
Simplifying constant pointer cast (char *) 54078
Simplifying constant integer cast 0
Simplifying constant integer cast 0
Simplifying constant integer cast 0
Simplifying constant integer cast $10
Simplifying constant integer cast 0
Simplifying constant integer cast 0
Simplifying constant integer cast 0
Simplifying constant integer cast 0
Simplifying constant integer cast 0
Simplifying constant integer cast 0
Simplifying constant integer cast 0
Simplifying constant integer cast $10
Simplifying constant integer cast 0
Simplifying constant integer cast 0
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) $10
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) $10
Finalized unsigned number type (char) 0
Finalized unsigned number type (char) 0
Successful SSA optimization PassNFinalizeNumberTypeConversions
Alias main::r#2 = main::r#3 
Successful SSA optimization Pass2AliasElimination
Simple Condition main::$1 [36] if(main::$0!=0) goto main::@1
Simple Condition main::$2 [40] if(main::r#1!=rangelast(0,7)) goto main::@1
Successful SSA optimization Pass2ConditionalJumpSimplification
Constant main::r#0 = 0
Successful SSA optimization Pass2ConstantIdentification
Resolved ranged next value [38] main::r#1 = ++ main::r#2 to ++
Resolved ranged comparison value [40] if(main::r#1!=rangelast(0,7)) goto main::@1 to 8
Simplifying constant evaluating to zero byte0 $100 in [7] *DTV_BLITTER_SRCA_LIN_LO = byte0 $100
Simplifying constant evaluating to zero byte0 $100 in [15] *DTV_BLITTER_SRCB_LIN_LO = byte0 $100
Simplifying constant evaluating to zero byte0 SCREEN in [18] *DTV_BLITTER_DEST_LO = byte0 SCREEN
Simplifying constant evaluating to zero byte0 $100 in [23] *DTV_BLITTER_DEST_LIN_LO = byte0 $100
Successful SSA optimization PassNSimplifyConstantZero
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 [37] if(main::r#1!=8) goto main::@1
Successful SSA optimization PassNAddNumberTypeConversions
Simplifying constant integer cast 8
Successful SSA optimization PassNCastSimplification
Finalized unsigned number type (char) 8
Successful SSA optimization PassNFinalizeNumberTypeConversions
Inlining constant with var siblings main::r#0
Constant inlined main::r#0 = 0
Successful SSA optimization Pass2ConstantInlining
Added new block during phi lifting main::@3(between main::@1 and main::@1)
Added new block during phi lifting main::@4(between main::@2 and main::@1)
CALL GRAPH

Created 1 initial phi equivalence classes
Coalesced [39] main::r#5 = main::r#1
Coalesced (already) [40] main::r#4 = main::r#2
Coalesced down to 1 phi equivalence classes
Culled Empty Block label main::@4
Culled Empty Block label main::@3

FINAL CONTROL FLOW GRAPH

void main()
main: scope:[main]  from
  [0] *DTV_FEATURE = DTV_FEATURE_ENABLE
  [1] *DTV_BLITTER_CONTROL2 = DTV_BLIT_CLEAR_IRQ
  [2] *DTV_BLITTER_SRCA_LO = byte0 SRCA
  [3] *DTV_BLITTER_SRCA_MI = byte1 SRCA
  [4] *DTV_BLITTER_SRCA_HI = 0
  [5] *DTV_BLITTER_SRCA_MOD_LO = 0
  [6] *DTV_BLITTER_SRCA_MOD_HI = 0
  [7] *DTV_BLITTER_SRCA_LIN_LO = 0
  [8] *DTV_BLITTER_SRCA_LIN_HI = byte1 $100
  [9] *DTV_BLITTER_SRCA_STEP = $10
  [10] *DTV_BLITTER_SRCB_LO = byte0 SRCB
  [11] *DTV_BLITTER_SRCB_MI = byte1 SRCB
  [12] *DTV_BLITTER_SRCB_HI = 0
  [13] *DTV_BLITTER_SRCB_MOD_LO = 0
  [14] *DTV_BLITTER_SRCB_MOD_HI = 0
  [15] *DTV_BLITTER_SRCB_LIN_LO = 0
  [16] *DTV_BLITTER_SRCB_LIN_HI = byte1 $100
  [17] *DTV_BLITTER_SRCB_STEP = 0
  [18] *DTV_BLITTER_DEST_LO = 0
  [19] *DTV_BLITTER_DEST_MI = byte1 SCREEN
  [20] *DTV_BLITTER_DEST_HI = 0
  [21] *DTV_BLITTER_DEST_MOD_LO = 0
  [22] *DTV_BLITTER_DEST_MOD_HI = 0
  [23] *DTV_BLITTER_DEST_LIN_LO = 0
  [24] *DTV_BLITTER_DEST_LIN_HI = byte1 $100
  [25] *DTV_BLITTER_DEST_STEP = $10
  [26] *DTV_BLITTER_LEN_LO = SRCA_LEN
  [27] *DTV_BLITTER_LEN_HI = 0
  [28] *DTV_BLITTER_ALU = DTV_BLIT_ADD
  [29] *DTV_BLITTER_TRANSPARANCY = DTV_BLIT_TRANSPARANCY_NONE
  [30] *DTV_BLITTER_CONTROL = DTV_BLIT_FORCE_START|DTV_BLIT_SRCA_FWD|DTV_BLIT_SRCB_FWD|DTV_BLIT_DEST_FWD
  [31] *DTV_BLITTER_CONTROL2 = DTV_BLIT_DEST_CONT
  to:main::@1
main::@1: scope:[main]  from main main::@1 main::@2
  [32] main::r#2 = phi( main/0, main::@1/main::r#2, main::@2/main::r#1 )
  [33] main::$0 = *DTV_BLITTER_CONTROL2 & DTV_BLIT_STATUS_BUSY
  [34] if(main::$0!=0) goto main::@1
  to:main::@2
main::@2: scope:[main]  from main::@1
  [35] *DTV_BLITTER_CONTROL = DTV_BLIT_FORCE_START|DTV_BLIT_SRCA_FWD|DTV_BLIT_SRCB_FWD|DTV_BLIT_DEST_FWD
  [36] main::r#1 = ++ main::r#2
  [37] if(main::r#1!=8) goto main::@1
  to:main::@return
main::@return: scope:[main]  from main::@2
  [38] return 
  to:@return


VARIABLE REGISTER WEIGHTS
void main()
char main::$0 // 202.0
char main::r
char main::r#1 // 16.5
char main::r#2 // 56.0

Initial phi equivalence classes
[ main::r#2 main::r#1 ]
Added variable main::$0 to live range equivalence class [ main::$0 ]
Complete equivalence classes
[ main::r#2 main::r#1 ]
[ main::$0 ]
Allocated zp[1]:2 [ main::$0 ]
Allocated zp[1]:3 [ main::r#2 main::r#1 ]
REGISTER UPLIFT POTENTIAL REGISTERS
Statement [0] *DTV_FEATURE = DTV_FEATURE_ENABLE [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [1] *DTV_BLITTER_CONTROL2 = DTV_BLIT_CLEAR_IRQ [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [2] *DTV_BLITTER_SRCA_LO = byte0 SRCA [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [3] *DTV_BLITTER_SRCA_MI = byte1 SRCA [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [4] *DTV_BLITTER_SRCA_HI = 0 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [5] *DTV_BLITTER_SRCA_MOD_LO = 0 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [6] *DTV_BLITTER_SRCA_MOD_HI = 0 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [7] *DTV_BLITTER_SRCA_LIN_LO = 0 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [8] *DTV_BLITTER_SRCA_LIN_HI = byte1 $100 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [9] *DTV_BLITTER_SRCA_STEP = $10 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [10] *DTV_BLITTER_SRCB_LO = byte0 SRCB [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [11] *DTV_BLITTER_SRCB_MI = byte1 SRCB [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [12] *DTV_BLITTER_SRCB_HI = 0 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [13] *DTV_BLITTER_SRCB_MOD_LO = 0 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [14] *DTV_BLITTER_SRCB_MOD_HI = 0 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [15] *DTV_BLITTER_SRCB_LIN_LO = 0 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [16] *DTV_BLITTER_SRCB_LIN_HI = byte1 $100 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [17] *DTV_BLITTER_SRCB_STEP = 0 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [18] *DTV_BLITTER_DEST_LO = 0 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [19] *DTV_BLITTER_DEST_MI = byte1 SCREEN [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [20] *DTV_BLITTER_DEST_HI = 0 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [21] *DTV_BLITTER_DEST_MOD_LO = 0 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [22] *DTV_BLITTER_DEST_MOD_HI = 0 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [23] *DTV_BLITTER_DEST_LIN_LO = 0 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [24] *DTV_BLITTER_DEST_LIN_HI = byte1 $100 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [25] *DTV_BLITTER_DEST_STEP = $10 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [26] *DTV_BLITTER_LEN_LO = SRCA_LEN [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [27] *DTV_BLITTER_LEN_HI = 0 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [28] *DTV_BLITTER_ALU = DTV_BLIT_ADD [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [29] *DTV_BLITTER_TRANSPARANCY = DTV_BLIT_TRANSPARANCY_NONE [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [30] *DTV_BLITTER_CONTROL = DTV_BLIT_FORCE_START|DTV_BLIT_SRCA_FWD|DTV_BLIT_SRCB_FWD|DTV_BLIT_DEST_FWD [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [31] *DTV_BLITTER_CONTROL2 = DTV_BLIT_DEST_CONT [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [33] main::$0 = *DTV_BLITTER_CONTROL2 & DTV_BLIT_STATUS_BUSY [ main::r#2 main::$0 ] (  [ main::r#2 main::$0 ] { }  ) always clobbers reg byte a 
Removing always clobbered register reg byte a as potential for zp[1]:3 [ main::r#2 main::r#1 ]
Statement [35] *DTV_BLITTER_CONTROL = DTV_BLIT_FORCE_START|DTV_BLIT_SRCA_FWD|DTV_BLIT_SRCB_FWD|DTV_BLIT_DEST_FWD [ main::r#2 ] (  [ main::r#2 ] { }  ) always clobbers reg byte a 
Statement [0] *DTV_FEATURE = DTV_FEATURE_ENABLE [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [1] *DTV_BLITTER_CONTROL2 = DTV_BLIT_CLEAR_IRQ [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [2] *DTV_BLITTER_SRCA_LO = byte0 SRCA [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [3] *DTV_BLITTER_SRCA_MI = byte1 SRCA [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [4] *DTV_BLITTER_SRCA_HI = 0 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [5] *DTV_BLITTER_SRCA_MOD_LO = 0 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [6] *DTV_BLITTER_SRCA_MOD_HI = 0 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [7] *DTV_BLITTER_SRCA_LIN_LO = 0 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [8] *DTV_BLITTER_SRCA_LIN_HI = byte1 $100 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [9] *DTV_BLITTER_SRCA_STEP = $10 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [10] *DTV_BLITTER_SRCB_LO = byte0 SRCB [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [11] *DTV_BLITTER_SRCB_MI = byte1 SRCB [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [12] *DTV_BLITTER_SRCB_HI = 0 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [13] *DTV_BLITTER_SRCB_MOD_LO = 0 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [14] *DTV_BLITTER_SRCB_MOD_HI = 0 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [15] *DTV_BLITTER_SRCB_LIN_LO = 0 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [16] *DTV_BLITTER_SRCB_LIN_HI = byte1 $100 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [17] *DTV_BLITTER_SRCB_STEP = 0 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [18] *DTV_BLITTER_DEST_LO = 0 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [19] *DTV_BLITTER_DEST_MI = byte1 SCREEN [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [20] *DTV_BLITTER_DEST_HI = 0 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [21] *DTV_BLITTER_DEST_MOD_LO = 0 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [22] *DTV_BLITTER_DEST_MOD_HI = 0 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [23] *DTV_BLITTER_DEST_LIN_LO = 0 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [24] *DTV_BLITTER_DEST_LIN_HI = byte1 $100 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [25] *DTV_BLITTER_DEST_STEP = $10 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [26] *DTV_BLITTER_LEN_LO = SRCA_LEN [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [27] *DTV_BLITTER_LEN_HI = 0 [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [28] *DTV_BLITTER_ALU = DTV_BLIT_ADD [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [29] *DTV_BLITTER_TRANSPARANCY = DTV_BLIT_TRANSPARANCY_NONE [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [30] *DTV_BLITTER_CONTROL = DTV_BLIT_FORCE_START|DTV_BLIT_SRCA_FWD|DTV_BLIT_SRCB_FWD|DTV_BLIT_DEST_FWD [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [31] *DTV_BLITTER_CONTROL2 = DTV_BLIT_DEST_CONT [ ] (  [ ] { }  ) always clobbers reg byte a 
Statement [33] main::$0 = *DTV_BLITTER_CONTROL2 & DTV_BLIT_STATUS_BUSY [ main::r#2 main::$0 ] (  [ main::r#2 main::$0 ] { }  ) always clobbers reg byte a 
Statement [35] *DTV_BLITTER_CONTROL = DTV_BLIT_FORCE_START|DTV_BLIT_SRCA_FWD|DTV_BLIT_SRCB_FWD|DTV_BLIT_DEST_FWD [ main::r#2 ] (  [ main::r#2 ] { }  ) always clobbers reg byte a 
Potential registers zp[1]:3 [ main::r#2 main::r#1 ] : zp[1]:3 , reg byte x , reg byte y , 
Potential registers zp[1]:2 [ main::$0 ] : zp[1]:2 , reg byte a , reg byte x , reg byte y , 

REGISTER UPLIFT SCOPES
Uplift Scope [main] 202: zp[1]:2 [ main::$0 ] 72.5: zp[1]:3 [ main::r#2 main::r#1 ] 
Uplift Scope [MOS6526_CIA] 
Uplift Scope [MOS6569_VICII] 
Uplift Scope [MOS6581_SID] 
Uplift Scope [] 

Uplifting [main] best 2503 combination reg byte a [ main::$0 ] reg byte x [ main::r#2 main::r#1 ] 
Uplifting [MOS6526_CIA] best 2503 combination 
Uplifting [MOS6569_VICII] best 2503 combination 
Uplifting [MOS6581_SID] best 2503 combination 
Uplifting [] best 2503 combination 

ASSEMBLER BEFORE OPTIMIZATION
  // File Comments
/// @file
/// C64 DTV version 2 Registers and Constants
///
/// Sources
/// (J) https://www.c64-wiki.com/wiki/C64DTV_Programming_Guide
/// (H) http://dtvhacking.cbm8bit.com/dtv_wiki/images/d/d9/Dtv_registers_full.txt
  // Upstart
  // Commodore 64 PRG executable file
.file [name="c64dtv-blittermin.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 DTV_FEATURE_ENABLE = 1
  /// Bit[0] Force Start Strobe when set
  .const DTV_BLIT_FORCE_START = 1
  /// Bit[1] Source A Direction Positive when set
  .const DTV_BLIT_SRCA_FWD = 2
  /// Bit[2] Source B Direction Positive when set
  .const DTV_BLIT_SRCB_FWD = 4
  /// Bit[3] Destination Direction Positive when set
  .const DTV_BLIT_DEST_FWD = 8
  /// No transparancy
  /// Bit[2]==Bit[1]==0: write in any case
  .const DTV_BLIT_TRANSPARANCY_NONE = 0
  .const DTV_BLIT_ADD = $30
  /// Bit[0] Clear Blitter IRQ
  .const DTV_BLIT_CLEAR_IRQ = 1
  /// Bit[3] Destination Continue
  .const DTV_BLIT_DEST_CONT = 8
  /// Bit[0] Busy when set (When reading)
  .const DTV_BLIT_STATUS_BUSY = 1
  .const SRCA_LEN = 9
  /// Feature enables or disables the extra C64 DTV features
  .label DTV_FEATURE = $d03f
  /// Blitter Source A Start
  .label DTV_BLITTER_SRCA_LO = $d320
  .label DTV_BLITTER_SRCA_MI = $d321
  .label DTV_BLITTER_SRCA_HI = $d322
  /// Blitter Source A Modulo
  .label DTV_BLITTER_SRCA_MOD_LO = $d323
  .label DTV_BLITTER_SRCA_MOD_HI = $d324
  /// Blitter Source A Line Length
  .label DTV_BLITTER_SRCA_LIN_LO = $d325
  .label DTV_BLITTER_SRCA_LIN_HI = $d326
  /// Blitter Source A Step ([7:4] integral part, [3:0] fractional part)
  .label DTV_BLITTER_SRCA_STEP = $d327
  /// Blitter Source B Start
  .label DTV_BLITTER_SRCB_LO = $d328
  .label DTV_BLITTER_SRCB_MI = $d329
  .label DTV_BLITTER_SRCB_HI = $d32a
  /// Blitter Source B Modulo
  .label DTV_BLITTER_SRCB_MOD_LO = $d32b
  .label DTV_BLITTER_SRCB_MOD_HI = $d32c
  /// Blitter Source B Line Length
  .label DTV_BLITTER_SRCB_LIN_LO = $d32d
  .label DTV_BLITTER_SRCB_LIN_HI = $d32e
  /// Blitter Source B Step ([7:4] integral part, [3:0] fractional part)
  .label DTV_BLITTER_SRCB_STEP = $d32f
  /// Blitter Destination Start
  .label DTV_BLITTER_DEST_LO = $d330
  .label DTV_BLITTER_DEST_MI = $d331
  .label DTV_BLITTER_DEST_HI = $d332
  /// Blitter Source B Modulo
  .label DTV_BLITTER_DEST_MOD_LO = $d333
  .label DTV_BLITTER_DEST_MOD_HI = $d334
  /// Blitter Source B Line Length
  .label DTV_BLITTER_DEST_LIN_LO = $d335
  .label DTV_BLITTER_DEST_LIN_HI = $d336
  /// Blitter Source B Step ([7:4] integral part, [3:0] fractional part)
  .label DTV_BLITTER_DEST_STEP = $d337
  /// Blitter Blit Length
  .label DTV_BLITTER_LEN_LO = $d338
  .label DTV_BLITTER_LEN_HI = $d339
  /// Blitter Control
  .label DTV_BLITTER_CONTROL = $d33a
  /// Blitter Transparency
  .label DTV_BLITTER_TRANSPARANCY = $d33b
  /// Blitter Control 2
  .label DTV_BLITTER_CONTROL2 = $d33f
  .label SCREEN = $400
  /// Controls the ALU operation
  .label DTV_BLITTER_ALU = $d33e
.segment Code
  // main
main: {
    // [0] *DTV_FEATURE = DTV_FEATURE_ENABLE -- _deref_pbuc1=vbuc2 
    lda #DTV_FEATURE_ENABLE
    sta DTV_FEATURE
    // [1] *DTV_BLITTER_CONTROL2 = DTV_BLIT_CLEAR_IRQ -- _deref_pbuc1=vbuc2 
    // Instruct blitter not to continue previous blit
    lda #DTV_BLIT_CLEAR_IRQ
    sta DTV_BLITTER_CONTROL2
    // [2] *DTV_BLITTER_SRCA_LO = byte0 SRCA -- _deref_pbuc1=vbuc2 
    lda #<SRCA
    sta DTV_BLITTER_SRCA_LO
    // [3] *DTV_BLITTER_SRCA_MI = byte1 SRCA -- _deref_pbuc1=vbuc2 
    lda #>SRCA
    sta DTV_BLITTER_SRCA_MI
    // [4] *DTV_BLITTER_SRCA_HI = 0 -- _deref_pbuc1=vbuc2 
    lda #0
    sta DTV_BLITTER_SRCA_HI
    // [5] *DTV_BLITTER_SRCA_MOD_LO = 0 -- _deref_pbuc1=vbuc2 
    lda #0
    sta DTV_BLITTER_SRCA_MOD_LO
    // [6] *DTV_BLITTER_SRCA_MOD_HI = 0 -- _deref_pbuc1=vbuc2 
    lda #0
    sta DTV_BLITTER_SRCA_MOD_HI
    // [7] *DTV_BLITTER_SRCA_LIN_LO = 0 -- _deref_pbuc1=vbuc2 
    lda #0
    sta DTV_BLITTER_SRCA_LIN_LO
    // [8] *DTV_BLITTER_SRCA_LIN_HI = byte1 $100 -- _deref_pbuc1=vbuc2 
    lda #>$100
    sta DTV_BLITTER_SRCA_LIN_HI
    // [9] *DTV_BLITTER_SRCA_STEP = $10 -- _deref_pbuc1=vbuc2 
    lda #$10
    sta DTV_BLITTER_SRCA_STEP
    // [10] *DTV_BLITTER_SRCB_LO = byte0 SRCB -- _deref_pbuc1=vbuc2 
    // Step 1.0
    lda #<SRCB
    sta DTV_BLITTER_SRCB_LO
    // [11] *DTV_BLITTER_SRCB_MI = byte1 SRCB -- _deref_pbuc1=vbuc2 
    lda #>SRCB
    sta DTV_BLITTER_SRCB_MI
    // [12] *DTV_BLITTER_SRCB_HI = 0 -- _deref_pbuc1=vbuc2 
    lda #0
    sta DTV_BLITTER_SRCB_HI
    // [13] *DTV_BLITTER_SRCB_MOD_LO = 0 -- _deref_pbuc1=vbuc2 
    lda #0
    sta DTV_BLITTER_SRCB_MOD_LO
    // [14] *DTV_BLITTER_SRCB_MOD_HI = 0 -- _deref_pbuc1=vbuc2 
    lda #0
    sta DTV_BLITTER_SRCB_MOD_HI
    // [15] *DTV_BLITTER_SRCB_LIN_LO = 0 -- _deref_pbuc1=vbuc2 
    lda #0
    sta DTV_BLITTER_SRCB_LIN_LO
    // [16] *DTV_BLITTER_SRCB_LIN_HI = byte1 $100 -- _deref_pbuc1=vbuc2 
    lda #>$100
    sta DTV_BLITTER_SRCB_LIN_HI
    // [17] *DTV_BLITTER_SRCB_STEP = 0 -- _deref_pbuc1=vbuc2 
    lda #0
    sta DTV_BLITTER_SRCB_STEP
    // [18] *DTV_BLITTER_DEST_LO = 0 -- _deref_pbuc1=vbuc2 
    // Step 0.0
    lda #0
    sta DTV_BLITTER_DEST_LO
    // [19] *DTV_BLITTER_DEST_MI = byte1 SCREEN -- _deref_pbuc1=vbuc2 
    lda #>SCREEN
    sta DTV_BLITTER_DEST_MI
    // [20] *DTV_BLITTER_DEST_HI = 0 -- _deref_pbuc1=vbuc2 
    lda #0
    sta DTV_BLITTER_DEST_HI
    // [21] *DTV_BLITTER_DEST_MOD_LO = 0 -- _deref_pbuc1=vbuc2 
    lda #0
    sta DTV_BLITTER_DEST_MOD_LO
    // [22] *DTV_BLITTER_DEST_MOD_HI = 0 -- _deref_pbuc1=vbuc2 
    lda #0
    sta DTV_BLITTER_DEST_MOD_HI
    // [23] *DTV_BLITTER_DEST_LIN_LO = 0 -- _deref_pbuc1=vbuc2 
    lda #0
    sta DTV_BLITTER_DEST_LIN_LO
    // [24] *DTV_BLITTER_DEST_LIN_HI = byte1 $100 -- _deref_pbuc1=vbuc2 
    lda #>$100
    sta DTV_BLITTER_DEST_LIN_HI
    // [25] *DTV_BLITTER_DEST_STEP = $10 -- _deref_pbuc1=vbuc2 
    lda #$10
    sta DTV_BLITTER_DEST_STEP
    // [26] *DTV_BLITTER_LEN_LO = SRCA_LEN -- _deref_pbuc1=vbuc2 
    // Step 1.0
    lda #SRCA_LEN
    sta DTV_BLITTER_LEN_LO
    // [27] *DTV_BLITTER_LEN_HI = 0 -- _deref_pbuc1=vbuc2 
    lda #0
    sta DTV_BLITTER_LEN_HI
    // [28] *DTV_BLITTER_ALU = DTV_BLIT_ADD -- _deref_pbuc1=vbuc2 
    lda #DTV_BLIT_ADD
    sta DTV_BLITTER_ALU
    // [29] *DTV_BLITTER_TRANSPARANCY = DTV_BLIT_TRANSPARANCY_NONE -- _deref_pbuc1=vbuc2 
    lda #DTV_BLIT_TRANSPARANCY_NONE
    sta DTV_BLITTER_TRANSPARANCY
    // [30] *DTV_BLITTER_CONTROL = DTV_BLIT_FORCE_START|DTV_BLIT_SRCA_FWD|DTV_BLIT_SRCB_FWD|DTV_BLIT_DEST_FWD -- _deref_pbuc1=vbuc2 
    // Start blitter
    lda #DTV_BLIT_FORCE_START|DTV_BLIT_SRCA_FWD|DTV_BLIT_SRCB_FWD|DTV_BLIT_DEST_FWD
    sta DTV_BLITTER_CONTROL
    // [31] *DTV_BLITTER_CONTROL2 = DTV_BLIT_DEST_CONT -- _deref_pbuc1=vbuc2 
    // Instruct blitter to continue at DEST and restart SRC A/B
    lda #DTV_BLIT_DEST_CONT
    sta DTV_BLITTER_CONTROL2
    // [32] phi from main to main::@1 [phi:main->main::@1]
  __b1_from_main:
    // [32] phi main::r#2 = 0 [phi:main->main::@1#0] -- vbuxx=vbuc1 
    ldx #0
    jmp __b1
  // wait til blitter is ready
    // [32] phi from main::@1 main::@2 to main::@1 [phi:main::@1/main::@2->main::@1]
  __b1_from___b1:
  __b1_from___b2:
    // [32] phi main::r#2 = main::r#2 [phi:main::@1/main::@2->main::@1#0] -- register_copy 
    jmp __b1
    // main::@1
  __b1:
    // [33] main::$0 = *DTV_BLITTER_CONTROL2 & DTV_BLIT_STATUS_BUSY -- vbuaa=_deref_pbuc1_band_vbuc2 
    lda #DTV_BLIT_STATUS_BUSY
    and DTV_BLITTER_CONTROL2
    // [34] if(main::$0!=0) goto main::@1 -- vbuaa_neq_0_then_la1 
    cmp #0
    bne __b1_from___b1
    jmp __b2
    // main::@2
  __b2:
    // [35] *DTV_BLITTER_CONTROL = DTV_BLIT_FORCE_START|DTV_BLIT_SRCA_FWD|DTV_BLIT_SRCB_FWD|DTV_BLIT_DEST_FWD -- _deref_pbuc1=vbuc2 
    // restart
    lda #DTV_BLIT_FORCE_START|DTV_BLIT_SRCA_FWD|DTV_BLIT_SRCB_FWD|DTV_BLIT_DEST_FWD
    sta DTV_BLITTER_CONTROL
    // [36] main::r#1 = ++ main::r#2 -- vbuxx=_inc_vbuxx 
    inx
    // [37] if(main::r#1!=8) goto main::@1 -- vbuxx_neq_vbuc1_then_la1 
    cpx #8
    bne __b1_from___b2
    jmp __breturn
    // main::@return
  __breturn:
    // [38] return 
    rts
}
  // File Data
.segment Data
  SRCA: .byte 'c', 'a', 'm', 'e', 'l', 'o', 't', '!', ' '
  SRCB: .byte $80

ASSEMBLER OPTIMIZATIONS
Removing instruction jmp __b1
Removing instruction jmp __b2
Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination
Removing instruction lda #0
Removing instruction lda #0
Removing instruction lda #0
Removing instruction lda #0
Removing instruction lda #0
Removing instruction lda #0
Removing instruction lda #0
Removing instruction lda #0
Removing instruction lda #0
Removing instruction lda #0
Succesful ASM optimization Pass5UnnecesaryLoadElimination
Replacing label __b1_from___b1 with __b1
Replacing label __b1_from___b2 with __b1
Removing instruction __b1_from___b1:
Removing instruction __b1_from___b2:
Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __b1_from_main:
Removing instruction __b2:
Removing instruction __breturn:
Succesful ASM optimization Pass5UnusedLabelElimination
Removing instruction jmp __b1
Succesful ASM optimization Pass5NextJumpElimination

FINAL SYMBOL TABLE
__constant char *DTV_BLITTER_ALU = (char *) 54078
__constant char * const DTV_BLITTER_CONTROL = (char *) 54074
__constant char * const DTV_BLITTER_CONTROL2 = (char *) 54079
__constant char * const DTV_BLITTER_DEST_HI = (char *) 54066
__constant char * const DTV_BLITTER_DEST_LIN_HI = (char *) 54070
__constant char * const DTV_BLITTER_DEST_LIN_LO = (char *) 54069
__constant char * const DTV_BLITTER_DEST_LO = (char *) 54064
__constant char * const DTV_BLITTER_DEST_MI = (char *) 54065
__constant char * const DTV_BLITTER_DEST_MOD_HI = (char *) 54068
__constant char * const DTV_BLITTER_DEST_MOD_LO = (char *) 54067
__constant char * const DTV_BLITTER_DEST_STEP = (char *) 54071
__constant char * const DTV_BLITTER_LEN_HI = (char *) 54073
__constant char * const DTV_BLITTER_LEN_LO = (char *) 54072
__constant char * const DTV_BLITTER_SRCA_HI = (char *) 54050
__constant char * const DTV_BLITTER_SRCA_LIN_HI = (char *) 54054
__constant char * const DTV_BLITTER_SRCA_LIN_LO = (char *) 54053
__constant char * const DTV_BLITTER_SRCA_LO = (char *) 54048
__constant char * const DTV_BLITTER_SRCA_MI = (char *) 54049
__constant char * const DTV_BLITTER_SRCA_MOD_HI = (char *) 54052
__constant char * const DTV_BLITTER_SRCA_MOD_LO = (char *) 54051
__constant char * const DTV_BLITTER_SRCA_STEP = (char *) 54055
__constant char * const DTV_BLITTER_SRCB_HI = (char *) 54058
__constant char * const DTV_BLITTER_SRCB_LIN_HI = (char *) 54062
__constant char * const DTV_BLITTER_SRCB_LIN_LO = (char *) 54061
__constant char * const DTV_BLITTER_SRCB_LO = (char *) 54056
__constant char * const DTV_BLITTER_SRCB_MI = (char *) 54057
__constant char * const DTV_BLITTER_SRCB_MOD_HI = (char *) 54060
__constant char * const DTV_BLITTER_SRCB_MOD_LO = (char *) 54059
__constant char * const DTV_BLITTER_SRCB_STEP = (char *) 54063
__constant char * const DTV_BLITTER_TRANSPARANCY = (char *) 54075
__constant const char DTV_BLIT_ADD = $30
__constant const char DTV_BLIT_CLEAR_IRQ = 1
__constant const char DTV_BLIT_DEST_CONT = 8
__constant const char DTV_BLIT_DEST_FWD = 8
__constant const char DTV_BLIT_FORCE_START = 1
__constant const char DTV_BLIT_SRCA_FWD = 2
__constant const char DTV_BLIT_SRCB_FWD = 4
__constant const char DTV_BLIT_STATUS_BUSY = 1
__constant const char DTV_BLIT_TRANSPARANCY_NONE = 0
__constant char * const DTV_FEATURE = (char *) 53311
__constant const char DTV_FEATURE_ENABLE = 1
__constant char * const SCREEN = (char *) 1024
__constant const char SRCA[] = { 'c', 'a', 'm', 'e', 'l', 'o', 't', '!', ' ' }
__constant const char SRCA_LEN = 9
__constant const char SRCB[] = { $80 }
void main()
char main::$0 // reg byte a 202.0
char main::r
char main::r#1 // reg byte x 16.5
char main::r#2 // reg byte x 56.0

reg byte x [ main::r#2 main::r#1 ]
reg byte a [ main::$0 ]


FINAL ASSEMBLER
Score: 1553

  // File Comments
/// @file
/// C64 DTV version 2 Registers and Constants
///
/// Sources
/// (J) https://www.c64-wiki.com/wiki/C64DTV_Programming_Guide
/// (H) http://dtvhacking.cbm8bit.com/dtv_wiki/images/d/d9/Dtv_registers_full.txt
  // Upstart
  // Commodore 64 PRG executable file
.file [name="c64dtv-blittermin.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 DTV_FEATURE_ENABLE = 1
  /// Bit[0] Force Start Strobe when set
  .const DTV_BLIT_FORCE_START = 1
  /// Bit[1] Source A Direction Positive when set
  .const DTV_BLIT_SRCA_FWD = 2
  /// Bit[2] Source B Direction Positive when set
  .const DTV_BLIT_SRCB_FWD = 4
  /// Bit[3] Destination Direction Positive when set
  .const DTV_BLIT_DEST_FWD = 8
  /// No transparancy
  /// Bit[2]==Bit[1]==0: write in any case
  .const DTV_BLIT_TRANSPARANCY_NONE = 0
  .const DTV_BLIT_ADD = $30
  /// Bit[0] Clear Blitter IRQ
  .const DTV_BLIT_CLEAR_IRQ = 1
  /// Bit[3] Destination Continue
  .const DTV_BLIT_DEST_CONT = 8
  /// Bit[0] Busy when set (When reading)
  .const DTV_BLIT_STATUS_BUSY = 1
  .const SRCA_LEN = 9
  /// Feature enables or disables the extra C64 DTV features
  .label DTV_FEATURE = $d03f
  /// Blitter Source A Start
  .label DTV_BLITTER_SRCA_LO = $d320
  .label DTV_BLITTER_SRCA_MI = $d321
  .label DTV_BLITTER_SRCA_HI = $d322
  /// Blitter Source A Modulo
  .label DTV_BLITTER_SRCA_MOD_LO = $d323
  .label DTV_BLITTER_SRCA_MOD_HI = $d324
  /// Blitter Source A Line Length
  .label DTV_BLITTER_SRCA_LIN_LO = $d325
  .label DTV_BLITTER_SRCA_LIN_HI = $d326
  /// Blitter Source A Step ([7:4] integral part, [3:0] fractional part)
  .label DTV_BLITTER_SRCA_STEP = $d327
  /// Blitter Source B Start
  .label DTV_BLITTER_SRCB_LO = $d328
  .label DTV_BLITTER_SRCB_MI = $d329
  .label DTV_BLITTER_SRCB_HI = $d32a
  /// Blitter Source B Modulo
  .label DTV_BLITTER_SRCB_MOD_LO = $d32b
  .label DTV_BLITTER_SRCB_MOD_HI = $d32c
  /// Blitter Source B Line Length
  .label DTV_BLITTER_SRCB_LIN_LO = $d32d
  .label DTV_BLITTER_SRCB_LIN_HI = $d32e
  /// Blitter Source B Step ([7:4] integral part, [3:0] fractional part)
  .label DTV_BLITTER_SRCB_STEP = $d32f
  /// Blitter Destination Start
  .label DTV_BLITTER_DEST_LO = $d330
  .label DTV_BLITTER_DEST_MI = $d331
  .label DTV_BLITTER_DEST_HI = $d332
  /// Blitter Source B Modulo
  .label DTV_BLITTER_DEST_MOD_LO = $d333
  .label DTV_BLITTER_DEST_MOD_HI = $d334
  /// Blitter Source B Line Length
  .label DTV_BLITTER_DEST_LIN_LO = $d335
  .label DTV_BLITTER_DEST_LIN_HI = $d336
  /// Blitter Source B Step ([7:4] integral part, [3:0] fractional part)
  .label DTV_BLITTER_DEST_STEP = $d337
  /// Blitter Blit Length
  .label DTV_BLITTER_LEN_LO = $d338
  .label DTV_BLITTER_LEN_HI = $d339
  /// Blitter Control
  .label DTV_BLITTER_CONTROL = $d33a
  /// Blitter Transparency
  .label DTV_BLITTER_TRANSPARANCY = $d33b
  /// Blitter Control 2
  .label DTV_BLITTER_CONTROL2 = $d33f
  .label SCREEN = $400
  /// Controls the ALU operation
  .label DTV_BLITTER_ALU = $d33e
.segment Code
  // main
main: {
    // *DTV_FEATURE = DTV_FEATURE_ENABLE
    // [0] *DTV_FEATURE = DTV_FEATURE_ENABLE -- _deref_pbuc1=vbuc2 
    lda #DTV_FEATURE_ENABLE
    sta DTV_FEATURE
    // *DTV_BLITTER_CONTROL2 = DTV_BLIT_CLEAR_IRQ
    // [1] *DTV_BLITTER_CONTROL2 = DTV_BLIT_CLEAR_IRQ -- _deref_pbuc1=vbuc2 
    // Instruct blitter not to continue previous blit
    lda #DTV_BLIT_CLEAR_IRQ
    sta DTV_BLITTER_CONTROL2
    // *DTV_BLITTER_SRCA_LO = BYTE0(SRCA)
    // [2] *DTV_BLITTER_SRCA_LO = byte0 SRCA -- _deref_pbuc1=vbuc2 
    lda #<SRCA
    sta DTV_BLITTER_SRCA_LO
    // *DTV_BLITTER_SRCA_MI = BYTE1(SRCA)
    // [3] *DTV_BLITTER_SRCA_MI = byte1 SRCA -- _deref_pbuc1=vbuc2 
    lda #>SRCA
    sta DTV_BLITTER_SRCA_MI
    // *DTV_BLITTER_SRCA_HI = 0
    // [4] *DTV_BLITTER_SRCA_HI = 0 -- _deref_pbuc1=vbuc2 
    lda #0
    sta DTV_BLITTER_SRCA_HI
    // *DTV_BLITTER_SRCA_MOD_LO = 0
    // [5] *DTV_BLITTER_SRCA_MOD_LO = 0 -- _deref_pbuc1=vbuc2 
    sta DTV_BLITTER_SRCA_MOD_LO
    // *DTV_BLITTER_SRCA_MOD_HI = 0
    // [6] *DTV_BLITTER_SRCA_MOD_HI = 0 -- _deref_pbuc1=vbuc2 
    sta DTV_BLITTER_SRCA_MOD_HI
    // *DTV_BLITTER_SRCA_LIN_LO = BYTE0($100uw)
    // [7] *DTV_BLITTER_SRCA_LIN_LO = 0 -- _deref_pbuc1=vbuc2 
    sta DTV_BLITTER_SRCA_LIN_LO
    // *DTV_BLITTER_SRCA_LIN_HI = BYTE1($100uw)
    // [8] *DTV_BLITTER_SRCA_LIN_HI = byte1 $100 -- _deref_pbuc1=vbuc2 
    lda #>$100
    sta DTV_BLITTER_SRCA_LIN_HI
    // *DTV_BLITTER_SRCA_STEP = $10
    // [9] *DTV_BLITTER_SRCA_STEP = $10 -- _deref_pbuc1=vbuc2 
    lda #$10
    sta DTV_BLITTER_SRCA_STEP
    // *DTV_BLITTER_SRCB_LO = BYTE0(SRCB)
    // [10] *DTV_BLITTER_SRCB_LO = byte0 SRCB -- _deref_pbuc1=vbuc2 
    // Step 1.0
    lda #<SRCB
    sta DTV_BLITTER_SRCB_LO
    // *DTV_BLITTER_SRCB_MI = BYTE1(SRCB)
    // [11] *DTV_BLITTER_SRCB_MI = byte1 SRCB -- _deref_pbuc1=vbuc2 
    lda #>SRCB
    sta DTV_BLITTER_SRCB_MI
    // *DTV_BLITTER_SRCB_HI = 0
    // [12] *DTV_BLITTER_SRCB_HI = 0 -- _deref_pbuc1=vbuc2 
    lda #0
    sta DTV_BLITTER_SRCB_HI
    // *DTV_BLITTER_SRCB_MOD_LO = 0
    // [13] *DTV_BLITTER_SRCB_MOD_LO = 0 -- _deref_pbuc1=vbuc2 
    sta DTV_BLITTER_SRCB_MOD_LO
    // *DTV_BLITTER_SRCB_MOD_HI = 0
    // [14] *DTV_BLITTER_SRCB_MOD_HI = 0 -- _deref_pbuc1=vbuc2 
    sta DTV_BLITTER_SRCB_MOD_HI
    // *DTV_BLITTER_SRCB_LIN_LO = BYTE0($100uw)
    // [15] *DTV_BLITTER_SRCB_LIN_LO = 0 -- _deref_pbuc1=vbuc2 
    sta DTV_BLITTER_SRCB_LIN_LO
    // *DTV_BLITTER_SRCB_LIN_HI = BYTE1($100uw)
    // [16] *DTV_BLITTER_SRCB_LIN_HI = byte1 $100 -- _deref_pbuc1=vbuc2 
    lda #>$100
    sta DTV_BLITTER_SRCB_LIN_HI
    // *DTV_BLITTER_SRCB_STEP = $00
    // [17] *DTV_BLITTER_SRCB_STEP = 0 -- _deref_pbuc1=vbuc2 
    lda #0
    sta DTV_BLITTER_SRCB_STEP
    // *DTV_BLITTER_DEST_LO = BYTE0(SCREEN)
    // [18] *DTV_BLITTER_DEST_LO = 0 -- _deref_pbuc1=vbuc2 
    // Step 0.0
    sta DTV_BLITTER_DEST_LO
    // *DTV_BLITTER_DEST_MI = BYTE1(SCREEN)
    // [19] *DTV_BLITTER_DEST_MI = byte1 SCREEN -- _deref_pbuc1=vbuc2 
    lda #>SCREEN
    sta DTV_BLITTER_DEST_MI
    // *DTV_BLITTER_DEST_HI = 0
    // [20] *DTV_BLITTER_DEST_HI = 0 -- _deref_pbuc1=vbuc2 
    lda #0
    sta DTV_BLITTER_DEST_HI
    // *DTV_BLITTER_DEST_MOD_LO = 0
    // [21] *DTV_BLITTER_DEST_MOD_LO = 0 -- _deref_pbuc1=vbuc2 
    sta DTV_BLITTER_DEST_MOD_LO
    // *DTV_BLITTER_DEST_MOD_HI = 0
    // [22] *DTV_BLITTER_DEST_MOD_HI = 0 -- _deref_pbuc1=vbuc2 
    sta DTV_BLITTER_DEST_MOD_HI
    // *DTV_BLITTER_DEST_LIN_LO = BYTE0($100uw)
    // [23] *DTV_BLITTER_DEST_LIN_LO = 0 -- _deref_pbuc1=vbuc2 
    sta DTV_BLITTER_DEST_LIN_LO
    // *DTV_BLITTER_DEST_LIN_HI = BYTE1($100uw)
    // [24] *DTV_BLITTER_DEST_LIN_HI = byte1 $100 -- _deref_pbuc1=vbuc2 
    lda #>$100
    sta DTV_BLITTER_DEST_LIN_HI
    // *DTV_BLITTER_DEST_STEP = $10
    // [25] *DTV_BLITTER_DEST_STEP = $10 -- _deref_pbuc1=vbuc2 
    lda #$10
    sta DTV_BLITTER_DEST_STEP
    // *DTV_BLITTER_LEN_LO = SRCA_LEN
    // [26] *DTV_BLITTER_LEN_LO = SRCA_LEN -- _deref_pbuc1=vbuc2 
    // Step 1.0
    lda #SRCA_LEN
    sta DTV_BLITTER_LEN_LO
    // *DTV_BLITTER_LEN_HI = 0
    // [27] *DTV_BLITTER_LEN_HI = 0 -- _deref_pbuc1=vbuc2 
    lda #0
    sta DTV_BLITTER_LEN_HI
    // *DTV_BLITTER_ALU = DTV_BLIT_ADD
    // [28] *DTV_BLITTER_ALU = DTV_BLIT_ADD -- _deref_pbuc1=vbuc2 
    lda #DTV_BLIT_ADD
    sta DTV_BLITTER_ALU
    // *DTV_BLITTER_TRANSPARANCY = DTV_BLIT_TRANSPARANCY_NONE
    // [29] *DTV_BLITTER_TRANSPARANCY = DTV_BLIT_TRANSPARANCY_NONE -- _deref_pbuc1=vbuc2 
    lda #DTV_BLIT_TRANSPARANCY_NONE
    sta DTV_BLITTER_TRANSPARANCY
    // *DTV_BLITTER_CONTROL = DTV_BLIT_FORCE_START | DTV_BLIT_SRCA_FWD | DTV_BLIT_SRCB_FWD| DTV_BLIT_DEST_FWD
    // [30] *DTV_BLITTER_CONTROL = DTV_BLIT_FORCE_START|DTV_BLIT_SRCA_FWD|DTV_BLIT_SRCB_FWD|DTV_BLIT_DEST_FWD -- _deref_pbuc1=vbuc2 
    // Start blitter
    lda #DTV_BLIT_FORCE_START|DTV_BLIT_SRCA_FWD|DTV_BLIT_SRCB_FWD|DTV_BLIT_DEST_FWD
    sta DTV_BLITTER_CONTROL
    // *DTV_BLITTER_CONTROL2 = DTV_BLIT_DEST_CONT
    // [31] *DTV_BLITTER_CONTROL2 = DTV_BLIT_DEST_CONT -- _deref_pbuc1=vbuc2 
    // Instruct blitter to continue at DEST and restart SRC A/B
    lda #DTV_BLIT_DEST_CONT
    sta DTV_BLITTER_CONTROL2
    // [32] phi from main to main::@1 [phi:main->main::@1]
    // [32] phi main::r#2 = 0 [phi:main->main::@1#0] -- vbuxx=vbuc1 
    ldx #0
  // wait til blitter is ready
    // [32] phi from main::@1 main::@2 to main::@1 [phi:main::@1/main::@2->main::@1]
    // [32] phi main::r#2 = main::r#2 [phi:main::@1/main::@2->main::@1#0] -- register_copy 
    // main::@1
  __b1:
    // *DTV_BLITTER_CONTROL2 & DTV_BLIT_STATUS_BUSY
    // [33] main::$0 = *DTV_BLITTER_CONTROL2 & DTV_BLIT_STATUS_BUSY -- vbuaa=_deref_pbuc1_band_vbuc2 
    lda #DTV_BLIT_STATUS_BUSY
    and DTV_BLITTER_CONTROL2
    // while((*DTV_BLITTER_CONTROL2 & DTV_BLIT_STATUS_BUSY)!=0)
    // [34] if(main::$0!=0) goto main::@1 -- vbuaa_neq_0_then_la1 
    cmp #0
    bne __b1
    // main::@2
    // *DTV_BLITTER_CONTROL = DTV_BLIT_FORCE_START | DTV_BLIT_SRCA_FWD | DTV_BLIT_SRCB_FWD| DTV_BLIT_DEST_FWD
    // [35] *DTV_BLITTER_CONTROL = DTV_BLIT_FORCE_START|DTV_BLIT_SRCA_FWD|DTV_BLIT_SRCB_FWD|DTV_BLIT_DEST_FWD -- _deref_pbuc1=vbuc2 
    // restart
    lda #DTV_BLIT_FORCE_START|DTV_BLIT_SRCA_FWD|DTV_BLIT_SRCB_FWD|DTV_BLIT_DEST_FWD
    sta DTV_BLITTER_CONTROL
    // for( byte r: 0..7 )
    // [36] main::r#1 = ++ main::r#2 -- vbuxx=_inc_vbuxx 
    inx
    // [37] if(main::r#1!=8) goto main::@1 -- vbuxx_neq_vbuc1_then_la1 
    cpx #8
    bne __b1
    // main::@return
    // }
    // [38] return 
    rts
}
  // File Data
.segment Data
  SRCA: .byte 'c', 'a', 'm', 'e', 'l', 'o', 't', '!', ' '
  SRCB: .byte $80

