From 8898dfb255d94e489577aa5540854c9141cee84a Mon Sep 17 00:00:00 2001 From: jespergravgaard Date: Thu, 3 Jan 2019 18:54:59 +0100 Subject: [PATCH] Added missing fragment for Scan/Desire. --- .../fragment/pbuc1_derefidx_vwuz1=vbuaa.asm | 10 + .../dk/camelot64/kickc/test/TestPrograms.java | 5 + src/test/kc/scan-desire-problem.kc | 66 + src/test/ref/scan-desire-problem.asm | 270 ++ src/test/ref/scan-desire-problem.cfg | 137 + src/test/ref/scan-desire-problem.log | 3572 +++++++++++++++++ src/test/ref/scan-desire-problem.sym | 296 ++ 7 files changed, 4356 insertions(+) create mode 100644 src/main/fragment/pbuc1_derefidx_vwuz1=vbuaa.asm create mode 100644 src/test/kc/scan-desire-problem.kc create mode 100644 src/test/ref/scan-desire-problem.asm create mode 100644 src/test/ref/scan-desire-problem.cfg create mode 100644 src/test/ref/scan-desire-problem.log create mode 100644 src/test/ref/scan-desire-problem.sym diff --git a/src/main/fragment/pbuc1_derefidx_vwuz1=vbuaa.asm b/src/main/fragment/pbuc1_derefidx_vwuz1=vbuaa.asm new file mode 100644 index 000000000..6ac417147 --- /dev/null +++ b/src/main/fragment/pbuc1_derefidx_vwuz1=vbuaa.asm @@ -0,0 +1,10 @@ +sta !v+ +1 +lda #<{c1} +clc +adc {z1} +sta !a+ +1 +lda #>{c1} +adc {z1}+1 +sta !a+ +2 +!v: lda #0 +!a: sta {c1} diff --git a/src/test/java/dk/camelot64/kickc/test/TestPrograms.java b/src/test/java/dk/camelot64/kickc/test/TestPrograms.java index 99910d2aa..e9e4b8b25 100644 --- a/src/test/java/dk/camelot64/kickc/test/TestPrograms.java +++ b/src/test/java/dk/camelot64/kickc/test/TestPrograms.java @@ -54,6 +54,11 @@ public class TestPrograms { compileAndCompare("examples/tetris/tetris"); } + @Test + public void testScanDesireProblem() throws IOException, URISyntaxException { + compileAndCompare("scan-desire-problem"); + } + @Test public void testClobberAProblem() throws IOException, URISyntaxException { compileAndCompare("clobber-a-problem"); diff --git a/src/test/kc/scan-desire-problem.kc b/src/test/kc/scan-desire-problem.kc new file mode 100644 index 000000000..377f15808 --- /dev/null +++ b/src/test/kc/scan-desire-problem.kc @@ -0,0 +1,66 @@ +// Illustrates a problem with a missing fragment - pbuc1_derefidx_vwuz1=vbuz2 +import "c64.kc" +import "keyboard.kc" +import "memory.kc" +import "multiply.kc" + +const byte* screen = $400; +const byte* charset = $2000; +const byte* tileset = $2800; +const byte* colors = $d800; +const byte* level_address = $3000; + +void main() { + init(); + for (byte x = 0; x < 16; x++ ){ + for (byte y = 0; y < 9; y++) { + byte z = x+y; + byte tile = level_address[z]; + draw_block(tile,x,y,YELLOW); + } + } + do { + } while(true); +} + +void init() { + init_sprites(); + fill(screen,1000,0); + fill(colors,1000,BLACK); + *D018 = toD018(screen, charset); + asm { + lda #$5b // as there are more than 256 rasterlines, the topmost bit of $d011 serves as + sta $d011 // the 8th bit for the rasterline we want our irq to be triggered. + } + *BORDERCOL = BLACK; + *BGCOL1 = BLACK; + *BGCOL2 = RED; + *BGCOL3 = BLUE; + *BGCOL4 = GREEN; +} + +void init_sprites() { + *SPRITES_ENABLE = %00000001; // one sprite enabled + *SPRITES_EXPAND_X = 0; + *SPRITES_EXPAND_Y = 0; + *SPRITES_XMSB = 0; + *SPRITES_COLS = WHITE; + *SPRITES_MC = 0; +} + +void draw_block(byte tileno, byte x, byte y, byte color) { + tileno = tileno << 2; + word x1 = x << 1; + y = y << 1; + word z = mul8u(y,40); + z = z + x1; + byte drawtile = tileset[tileno]; + screen[z] = drawtile; + colors[z] = YELLOW; + screen[z+1] = 1; + colors[z+1] = YELLOW; + screen[z+40] = 2; + colors[z+40] = YELLOW; + screen[z+41] = 3; + colors[z+41] = YELLOW; +} \ No newline at end of file diff --git a/src/test/ref/scan-desire-problem.asm b/src/test/ref/scan-desire-problem.asm new file mode 100644 index 000000000..a1c31898e --- /dev/null +++ b/src/test/ref/scan-desire-problem.asm @@ -0,0 +1,270 @@ +.pc = $801 "Basic" +:BasicUpstart(main) +.pc = $80d "Program" + .label SPRITES_XMSB = $d010 + .label SPRITES_ENABLE = $d015 + .label SPRITES_EXPAND_Y = $d017 + .label SPRITES_MC = $d01c + .label SPRITES_EXPAND_X = $d01d + .label BORDERCOL = $d020 + .label BGCOL1 = $d021 + .label BGCOL2 = $d022 + .label BGCOL3 = $d023 + .label BGCOL4 = $d024 + .label SPRITES_COLS = $d027 + .label D018 = $d018 + .const BLACK = 0 + .const WHITE = 1 + .const RED = 2 + .const GREEN = 5 + .const BLUE = 6 + .const YELLOW = 7 + .label screen = $400 + .label charset = $2000 + .label tileset = $2800 + .label colors = $d800 + .label level_address = $3000 +main: { + .label y = 3 + .label x = 2 + jsr init + lda #0 + sta x + b1: + lda #0 + sta y + b2: + lda x + clc + adc y + tay + lda level_address,y + ldy x + ldx y + jsr draw_block + inc y + lda y + cmp #9 + bcc b2 + inc x + lda x + cmp #$10 + bcc b1 + b3: + jmp b3 +} +draw_block: { + .label tileno = 8 + .label x1 = 9 + .label z = 4 + .label z_1 = 9 + asl + asl + sta tileno + tya + asl + sta x1 + lda #0 + sta x1+1 + txa + asl + tax + jsr mul8u + lda z_1 + clc + adc z + sta z_1 + lda z_1+1 + adc z+1 + sta z_1+1 + ldy tileno + lda tileset,y + sta !v++1 + lda #screen + adc z_1+1 + sta !a++2 + !v: + lda #0 + !a: + sta screen + lda #colors + adc z_1+1 + sta !++2 + lda #YELLOW + !: + sta colors + lda #screen+1 + adc z_1+1 + sta !++2 + lda #1 + !: + sta screen+1 + lda #colors+1 + adc z_1+1 + sta !++2 + lda #YELLOW + !: + sta colors+1 + lda #screen+$28 + adc z_1+1 + sta !++2 + lda #2 + !: + sta screen+$28 + lda #colors+$28 + adc z_1+1 + sta !++2 + lda #YELLOW + !: + sta colors+$28 + lda #screen+$29 + adc z_1+1 + sta !++2 + lda #3 + !: + sta screen+$29 + lda #colors+$29 + adc z_1+1 + sta !++2 + lda #YELLOW + !: + sta colors+$29 + rts +} +mul8u: { + .const b = $28 + .label mb = 6 + .label res = 4 + .label return = 4 + lda #b + sta mb+1 + lda #<0 + sta res + sta res+1 + b1: + cpx #0 + bne b2 + rts + b2: + txa + and #1 + cmp #0 + beq b4 + lda res + clc + adc mb + sta res + lda res+1 + adc mb+1 + sta res+1 + b4: + txa + lsr + tax + asl mb + rol mb+1 + jmp b1 +} +init: { + .const toD0181_return = (>(screen&$3fff)<<2)|(>charset)>>2&$f + jsr init_sprites + ldx #0 + lda #screen + sta fill.addr+1 + jsr fill + ldx #BLACK + lda #colors + sta fill.addr+1 + jsr fill + lda #toD0181_return + sta D018 + lda #$5b + sta $d011 + lda #BLACK + sta BORDERCOL + sta BGCOL1 + lda #RED + sta BGCOL2 + lda #BLUE + sta BGCOL3 + lda #GREEN + sta BGCOL4 + rts +} +fill: { + .label end = 6 + .label addr = 4 + lda addr + clc + adc #<$3e8 + sta end + lda addr+1 + adc #>$3e8 + sta end+1 + b1: + txa + ldy #0 + sta (addr),y + inc addr + bne !+ + inc addr+1 + !: + lda addr+1 + cmp end+1 + bne b1 + lda addr + cmp end + bne b1 + rts +} +init_sprites: { + lda #1 + sta SPRITES_ENABLE + lda #0 + sta SPRITES_EXPAND_X + sta SPRITES_EXPAND_Y + sta SPRITES_XMSB + lda #WHITE + sta SPRITES_COLS + lda #0 + sta SPRITES_MC + rts +} diff --git a/src/test/ref/scan-desire-problem.cfg b/src/test/ref/scan-desire-problem.cfg new file mode 100644 index 000000000..b28709eef --- /dev/null +++ b/src/test/ref/scan-desire-problem.cfg @@ -0,0 +1,137 @@ +@begin: scope:[] from + [0] phi() + to:@21 +@21: scope:[] from @begin + [1] phi() + [2] call main + to:@end +@end: scope:[] from @21 + [3] phi() +main: scope:[main] from @21 + [4] phi() + [5] call init + to:main::@1 +main::@1: scope:[main] from main main::@4 + [6] (byte) main::x#4 ← phi( main::@4/(byte) main::x#1 main/(byte/signed byte/word/signed word/dword/signed dword) 0 ) + to:main::@2 +main::@2: scope:[main] from main::@1 main::@8 + [7] (byte) main::y#2 ← phi( main::@1/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@8/(byte) main::y#1 ) + [8] (byte) main::z#0 ← (byte) main::x#4 + (byte) main::y#2 + [9] (byte) main::tile#0 ← *((const byte*) level_address#0 + (byte) main::z#0) + [10] (byte) draw_block::tileno#0 ← (byte) main::tile#0 + [11] (byte) draw_block::x#0 ← (byte) main::x#4 + [12] (byte) draw_block::y#0 ← (byte) main::y#2 + [13] call draw_block + to:main::@8 +main::@8: scope:[main] from main::@2 + [14] (byte) main::y#1 ← ++ (byte) main::y#2 + [15] if((byte) main::y#1<(byte/signed byte/word/signed word/dword/signed dword) 9) goto main::@2 + to:main::@4 +main::@4: scope:[main] from main::@8 + [16] (byte) main::x#1 ← ++ (byte) main::x#4 + [17] if((byte) main::x#1<(byte/signed byte/word/signed word/dword/signed dword) 16) goto main::@1 + to:main::@3 +main::@3: scope:[main] from main::@3 main::@4 + [18] phi() + to:main::@3 +draw_block: scope:[draw_block] from main::@2 + [19] (byte) draw_block::tileno#1 ← (byte) draw_block::tileno#0 << (byte/signed byte/word/signed word/dword/signed dword) 2 + [20] (byte~) draw_block::$1 ← (byte) draw_block::x#0 << (byte/signed byte/word/signed word/dword/signed dword) 1 + [21] (word) draw_block::x1#0 ← ((word)) (byte~) draw_block::$1 + [22] (byte) draw_block::y#1 ← (byte) draw_block::y#0 << (byte/signed byte/word/signed word/dword/signed dword) 1 + [23] (byte) mul8u::a#1 ← (byte) draw_block::y#1 + [24] call mul8u + [25] (word) mul8u::return#2 ← (word) mul8u::res#2 + to:draw_block::@1 +draw_block::@1: scope:[draw_block] from draw_block + [26] (word) draw_block::z#0 ← (word) mul8u::return#2 + [27] (word) draw_block::z#1 ← (word) draw_block::z#0 + (word) draw_block::x1#0 + [28] (byte) draw_block::drawtile#0 ← *((const byte*) tileset#0 + (byte) draw_block::tileno#1) + [29] *((const byte*) screen#0 + (word) draw_block::z#1) ← (byte) draw_block::drawtile#0 + [30] *((const byte*) colors#0 + (word) draw_block::z#1) ← (const byte) YELLOW#0 + [31] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (word) draw_block::z#1) ← (byte/signed byte/word/signed word/dword/signed dword) 1 + [32] *((const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (word) draw_block::z#1) ← (const byte) YELLOW#0 + [33] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 40 + (word) draw_block::z#1) ← (byte/signed byte/word/signed word/dword/signed dword) 2 + [34] *((const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) 40 + (word) draw_block::z#1) ← (const byte) YELLOW#0 + [35] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 41 + (word) draw_block::z#1) ← (byte/signed byte/word/signed word/dword/signed dword) 3 + [36] *((const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) 41 + (word) draw_block::z#1) ← (const byte) YELLOW#0 + to:draw_block::@return +draw_block::@return: scope:[draw_block] from draw_block::@1 + [37] return + to:@return +mul8u: scope:[mul8u] from draw_block + [38] phi() + to:mul8u::@1 +mul8u::@1: scope:[mul8u] from mul8u mul8u::@4 + [39] (word) mul8u::mb#2 ← phi( mul8u/((word))(const byte) mul8u::b#0 mul8u::@4/(word) mul8u::mb#1 ) + [39] (word) mul8u::res#2 ← phi( mul8u/(byte/signed byte/word/signed word/dword/signed dword) 0 mul8u::@4/(word) mul8u::res#6 ) + [39] (byte) mul8u::a#2 ← phi( mul8u/(byte) mul8u::a#1 mul8u::@4/(byte) mul8u::a#0 ) + [40] if((byte) mul8u::a#2!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto mul8u::@2 + to:mul8u::@return +mul8u::@return: scope:[mul8u] from mul8u::@1 + [41] return + to:@return +mul8u::@2: scope:[mul8u] from mul8u::@1 + [42] (byte~) mul8u::$1 ← (byte) mul8u::a#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 + [43] if((byte~) mul8u::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto mul8u::@4 + to:mul8u::@7 +mul8u::@7: scope:[mul8u] from mul8u::@2 + [44] (word) mul8u::res#1 ← (word) mul8u::res#2 + (word) mul8u::mb#2 + to:mul8u::@4 +mul8u::@4: scope:[mul8u] from mul8u::@2 mul8u::@7 + [45] (word) mul8u::res#6 ← phi( mul8u::@2/(word) mul8u::res#2 mul8u::@7/(word) mul8u::res#1 ) + [46] (byte) mul8u::a#0 ← (byte) mul8u::a#2 >> (byte/signed byte/word/signed word/dword/signed dword) 1 + [47] (word) mul8u::mb#1 ← (word) mul8u::mb#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 + to:mul8u::@1 +init: scope:[init] from main + [48] phi() + [49] call init_sprites + to:init::@2 +init::@2: scope:[init] from init + [50] phi() + [51] call fill + to:init::@3 +init::@3: scope:[init] from init::@2 + [52] phi() + [53] call fill + to:init::toD0181 +init::toD0181: scope:[init] from init::@3 + [54] phi() + to:init::@1 +init::@1: scope:[init] from init::toD0181 + [55] *((const byte*) D018#0) ← (const byte) init::toD0181_return#0 + asm { lda#$5b sta$d011 } + [57] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 + [58] *((const byte*) BGCOL1#0) ← (const byte) BLACK#0 + [59] *((const byte*) BGCOL2#0) ← (const byte) RED#0 + [60] *((const byte*) BGCOL3#0) ← (const byte) BLUE#0 + [61] *((const byte*) BGCOL4#0) ← (const byte) GREEN#0 + to:init::@return +init::@return: scope:[init] from init::@1 + [62] return + to:@return +fill: scope:[fill] from init::@2 init::@3 + [63] (byte) fill::val#3 ← phi( init::@2/(byte/signed byte/word/signed word/dword/signed dword) 0 init::@3/(const byte) BLACK#0 ) + [63] (byte*) fill::addr#0 ← phi( init::@2/(const byte*) screen#0 init::@3/(const byte*) colors#0 ) + [64] (byte*) fill::end#0 ← (byte*) fill::addr#0 + (word/signed word/dword/signed dword) 1000 + to:fill::@1 +fill::@1: scope:[fill] from fill fill::@1 + [65] (byte*) fill::addr#2 ← phi( fill/(byte*) fill::addr#0 fill::@1/(byte*) fill::addr#1 ) + [66] *((byte*) fill::addr#2) ← (byte) fill::val#3 + [67] (byte*) fill::addr#1 ← ++ (byte*) fill::addr#2 + [68] if((byte*) fill::addr#1!=(byte*) fill::end#0) goto fill::@1 + to:fill::@return +fill::@return: scope:[fill] from fill::@1 + [69] return + to:@return +init_sprites: scope:[init_sprites] from init + [70] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 1 + [71] *((const byte*) SPRITES_EXPAND_X#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 + [72] *((const byte*) SPRITES_EXPAND_Y#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 + [73] *((const byte*) SPRITES_XMSB#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 + [74] *((const byte*) SPRITES_COLS#0) ← (const byte) WHITE#0 + [75] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 + to:init_sprites::@return +init_sprites::@return: scope:[init_sprites] from init_sprites + [76] return + to:@return diff --git a/src/test/ref/scan-desire-problem.log b/src/test/ref/scan-desire-problem.log new file mode 100644 index 000000000..ecda84fd3 --- /dev/null +++ b/src/test/ref/scan-desire-problem.log @@ -0,0 +1,3572 @@ +Inlined call (byte~) vicSelectGfxBank::$0 ← call toDd00 (byte*) vicSelectGfxBank::gfx +Inlined call (byte~) init::$3 ← call toD018 (byte*) screen (byte*) charset + +CONTROL FLOW GRAPH SSA +@begin: scope:[] from + (byte*) PROCPORT_DDR#0 ← ((byte*)) (byte/signed byte/word/signed word/dword/signed dword) 0 + (byte) PROCPORT_DDR_MEMORY_MASK#0 ← (byte/signed byte/word/signed word/dword/signed dword) 7 + (byte*) PROCPORT#0 ← ((byte*)) (byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) PROCPORT_RAM_ALL#0 ← (byte/signed byte/word/signed word/dword/signed dword) 48 + (byte) PROCPORT_RAM_IO#0 ← (byte/signed byte/word/signed word/dword/signed dword) 53 + (byte) PROCPORT_RAM_CHARROM#0 ← (byte/signed byte/word/signed word/dword/signed dword) 49 + (byte) PROCPORT_KERNEL_IO#0 ← (byte/signed byte/word/signed word/dword/signed dword) 54 + (byte) PROCPORT_BASIC_KERNEL_IO#0 ← (byte/signed byte/word/signed word/dword/signed dword) 55 + (byte*) CHARGEN#0 ← ((byte*)) (word/dword/signed dword) 53248 + (word) SPRITE_PTRS#0 ← (word/signed word/dword/signed dword) 1016 + (byte*) SPRITES_XPOS#0 ← ((byte*)) (word/dword/signed dword) 53248 + (byte*) SPRITES_YPOS#0 ← ((byte*)) (word/dword/signed dword) 53249 + (byte*) SPRITES_XMSB#0 ← ((byte*)) (word/dword/signed dword) 53264 + (byte*) RASTER#0 ← ((byte*)) (word/dword/signed dword) 53266 + (byte*) SPRITES_ENABLE#0 ← ((byte*)) (word/dword/signed dword) 53269 + (byte*) SPRITES_EXPAND_Y#0 ← ((byte*)) (word/dword/signed dword) 53271 + (byte*) SPRITES_PRIORITY#0 ← ((byte*)) (word/dword/signed dword) 53275 + (byte*) SPRITES_MC#0 ← ((byte*)) (word/dword/signed dword) 53276 + (byte*) SPRITES_EXPAND_X#0 ← ((byte*)) (word/dword/signed dword) 53277 + (byte*) BORDERCOL#0 ← ((byte*)) (word/dword/signed dword) 53280 + (byte*) BGCOL#0 ← ((byte*)) (word/dword/signed dword) 53281 + (byte*) BGCOL1#0 ← ((byte*)) (word/dword/signed dword) 53281 + (byte*) BGCOL2#0 ← ((byte*)) (word/dword/signed dword) 53282 + (byte*) BGCOL3#0 ← ((byte*)) (word/dword/signed dword) 53283 + (byte*) BGCOL4#0 ← ((byte*)) (word/dword/signed dword) 53284 + (byte*) SPRITES_MC1#0 ← ((byte*)) (word/dword/signed dword) 53285 + (byte*) SPRITES_MC2#0 ← ((byte*)) (word/dword/signed dword) 53286 + (byte*) SPRITES_COLS#0 ← ((byte*)) (word/dword/signed dword) 53287 + (byte*) VIC_CONTROL#0 ← ((byte*)) (word/dword/signed dword) 53265 + (byte*) D011#0 ← ((byte*)) (word/dword/signed dword) 53265 + (byte) VIC_RST8#0 ← (byte/word/signed word/dword/signed dword) 128 + (byte) VIC_ECM#0 ← (byte/signed byte/word/signed word/dword/signed dword) 64 + (byte) VIC_BMM#0 ← (byte/signed byte/word/signed word/dword/signed dword) 32 + (byte) VIC_DEN#0 ← (byte/signed byte/word/signed word/dword/signed dword) 16 + (byte) VIC_RSEL#0 ← (byte/signed byte/word/signed word/dword/signed dword) 8 + (byte*) VIC_CONTROL2#0 ← ((byte*)) (word/dword/signed dword) 53270 + (byte*) D016#0 ← ((byte*)) (word/dword/signed dword) 53270 + (byte) VIC_MCM#0 ← (byte/signed byte/word/signed word/dword/signed dword) 16 + (byte) VIC_CSEL#0 ← (byte/signed byte/word/signed word/dword/signed dword) 8 + (byte*) D018#0 ← ((byte*)) (word/dword/signed dword) 53272 + (byte*) VIC_MEMORY#0 ← ((byte*)) (word/dword/signed dword) 53272 + (byte*) LIGHTPEN_X#0 ← ((byte*)) (word/dword/signed dword) 53267 + (byte*) LIGHTPEN_Y#0 ← ((byte*)) (word/dword/signed dword) 53268 + (byte*) IRQ_STATUS#0 ← ((byte*)) (word/dword/signed dword) 53273 + (byte*) IRQ_ENABLE#0 ← ((byte*)) (word/dword/signed dword) 53274 + (byte) IRQ_RASTER#0 ← (byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) IRQ_COLLISION_BG#0 ← (byte/signed byte/word/signed word/dword/signed dword) 2 + (byte) IRQ_COLLISION_SPRITE#0 ← (byte/signed byte/word/signed word/dword/signed dword) 4 + (byte) IRQ_LIGHTPEN#0 ← (byte/signed byte/word/signed word/dword/signed dword) 8 + (byte*) COLS#0 ← ((byte*)) (word/dword/signed dword) 55296 + (byte*) CIA1_PORT_A#0 ← ((byte*)) (word/dword/signed dword) 56320 + (byte*) CIA1_PORT_B#0 ← ((byte*)) (word/dword/signed dword) 56321 + (byte*) CIA1_PORT_A_DDR#0 ← ((byte*)) (word/dword/signed dword) 56322 + (byte*) CIA1_PORT_B_DDR#0 ← ((byte*)) (word/dword/signed dword) 56323 + (byte*) CIA1_INTERRUPT#0 ← ((byte*)) (word/dword/signed dword) 56333 + (byte) CIA_INTERRUPT_CLEAR#0 ← (byte/signed byte/word/signed word/dword/signed dword) 127 + (byte*) CIA2_PORT_A#0 ← ((byte*)) (word/dword/signed dword) 56576 + (byte*) CIA2_PORT_B#0 ← ((byte*)) (word/dword/signed dword) 56577 + (byte*) CIA2_PORT_A_DDR#0 ← ((byte*)) (word/dword/signed dword) 56578 + (byte*) CIA2_PORT_B_DDR#0 ← ((byte*)) (word/dword/signed dword) 56579 + (byte*) CIA2_INTERRUPT#0 ← ((byte*)) (word/dword/signed dword) 56589 + (void()**) KERNEL_IRQ#0 ← ((void()**)) (word/signed word/dword/signed dword) 788 + (void()**) HARDWARE_IRQ#0 ← ((void()**)) (word/dword/signed dword) 65534 + (byte) BLACK#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 + (byte) WHITE#0 ← (byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) RED#0 ← (byte/signed byte/word/signed word/dword/signed dword) 2 + (byte) CYAN#0 ← (byte/signed byte/word/signed word/dword/signed dword) 3 + (byte) PURPLE#0 ← (byte/signed byte/word/signed word/dword/signed dword) 4 + (byte) GREEN#0 ← (byte/signed byte/word/signed word/dword/signed dword) 5 + (byte) BLUE#0 ← (byte/signed byte/word/signed word/dword/signed dword) 6 + (byte) YELLOW#0 ← (byte/signed byte/word/signed word/dword/signed dword) 7 + (byte) ORANGE#0 ← (byte/signed byte/word/signed word/dword/signed dword) 8 + (byte) BROWN#0 ← (byte/signed byte/word/signed word/dword/signed dword) 9 + (byte) PINK#0 ← (byte/signed byte/word/signed word/dword/signed dword) 10 + (byte) DARK_GREY#0 ← (byte/signed byte/word/signed word/dword/signed dword) 11 + (byte) GREY#0 ← (byte/signed byte/word/signed word/dword/signed dword) 12 + (byte) LIGHT_GREEN#0 ← (byte/signed byte/word/signed word/dword/signed dword) 13 + (byte) LIGHT_BLUE#0 ← (byte/signed byte/word/signed word/dword/signed dword) 14 + (byte) LIGHT_GREY#0 ← (byte/signed byte/word/signed word/dword/signed dword) 15 + to:@4 +@4: scope:[] from @begin + (byte) KEY_DEL#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 + (byte) KEY_RETURN#0 ← (byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) KEY_CRSR_RIGHT#0 ← (byte/signed byte/word/signed word/dword/signed dword) 2 + (byte) KEY_F7#0 ← (byte/signed byte/word/signed word/dword/signed dword) 3 + (byte) KEY_F1#0 ← (byte/signed byte/word/signed word/dword/signed dword) 4 + (byte) KEY_F3#0 ← (byte/signed byte/word/signed word/dword/signed dword) 5 + (byte) KEY_F5#0 ← (byte/signed byte/word/signed word/dword/signed dword) 6 + (byte) KEY_CRSR_DOWN#0 ← (byte/signed byte/word/signed word/dword/signed dword) 7 + (byte) KEY_3#0 ← (byte/signed byte/word/signed word/dword/signed dword) 8 + (byte) KEY_W#0 ← (byte/signed byte/word/signed word/dword/signed dword) 9 + (byte) KEY_A#0 ← (byte/signed byte/word/signed word/dword/signed dword) 10 + (byte) KEY_4#0 ← (byte/signed byte/word/signed word/dword/signed dword) 11 + (byte) KEY_Z#0 ← (byte/signed byte/word/signed word/dword/signed dword) 12 + (byte) KEY_S#0 ← (byte/signed byte/word/signed word/dword/signed dword) 13 + (byte) KEY_E#0 ← (byte/signed byte/word/signed word/dword/signed dword) 14 + (byte) KEY_LSHIFT#0 ← (byte/signed byte/word/signed word/dword/signed dword) 15 + (byte) KEY_5#0 ← (byte/signed byte/word/signed word/dword/signed dword) 16 + (byte) KEY_R#0 ← (byte/signed byte/word/signed word/dword/signed dword) 17 + (byte) KEY_D#0 ← (byte/signed byte/word/signed word/dword/signed dword) 18 + (byte) KEY_6#0 ← (byte/signed byte/word/signed word/dword/signed dword) 19 + (byte) KEY_C#0 ← (byte/signed byte/word/signed word/dword/signed dword) 20 + (byte) KEY_F#0 ← (byte/signed byte/word/signed word/dword/signed dword) 21 + (byte) KEY_T#0 ← (byte/signed byte/word/signed word/dword/signed dword) 22 + (byte) KEY_X#0 ← (byte/signed byte/word/signed word/dword/signed dword) 23 + (byte) KEY_7#0 ← (byte/signed byte/word/signed word/dword/signed dword) 24 + (byte) KEY_Y#0 ← (byte/signed byte/word/signed word/dword/signed dword) 25 + (byte) KEY_G#0 ← (byte/signed byte/word/signed word/dword/signed dword) 26 + (byte) KEY_8#0 ← (byte/signed byte/word/signed word/dword/signed dword) 27 + (byte) KEY_B#0 ← (byte/signed byte/word/signed word/dword/signed dword) 28 + (byte) KEY_H#0 ← (byte/signed byte/word/signed word/dword/signed dword) 29 + (byte) KEY_U#0 ← (byte/signed byte/word/signed word/dword/signed dword) 30 + (byte) KEY_V#0 ← (byte/signed byte/word/signed word/dword/signed dword) 31 + (byte) KEY_9#0 ← (byte/signed byte/word/signed word/dword/signed dword) 32 + (byte) KEY_I#0 ← (byte/signed byte/word/signed word/dword/signed dword) 33 + (byte) KEY_J#0 ← (byte/signed byte/word/signed word/dword/signed dword) 34 + (byte) KEY_0#0 ← (byte/signed byte/word/signed word/dword/signed dword) 35 + (byte) KEY_M#0 ← (byte/signed byte/word/signed word/dword/signed dword) 36 + (byte) KEY_K#0 ← (byte/signed byte/word/signed word/dword/signed dword) 37 + (byte) KEY_O#0 ← (byte/signed byte/word/signed word/dword/signed dword) 38 + (byte) KEY_N#0 ← (byte/signed byte/word/signed word/dword/signed dword) 39 + (byte) KEY_PLUS#0 ← (byte/signed byte/word/signed word/dword/signed dword) 40 + (byte) KEY_P#0 ← (byte/signed byte/word/signed word/dword/signed dword) 41 + (byte) KEY_L#0 ← (byte/signed byte/word/signed word/dword/signed dword) 42 + (byte) KEY_MINUS#0 ← (byte/signed byte/word/signed word/dword/signed dword) 43 + (byte) KEY_DOT#0 ← (byte/signed byte/word/signed word/dword/signed dword) 44 + (byte) KEY_COLON#0 ← (byte/signed byte/word/signed word/dword/signed dword) 45 + (byte) KEY_AT#0 ← (byte/signed byte/word/signed word/dword/signed dword) 46 + (byte) KEY_COMMA#0 ← (byte/signed byte/word/signed word/dword/signed dword) 47 + (byte) KEY_POUND#0 ← (byte/signed byte/word/signed word/dword/signed dword) 48 + (byte) KEY_ASTERISK#0 ← (byte/signed byte/word/signed word/dword/signed dword) 49 + (byte) KEY_SEMICOLON#0 ← (byte/signed byte/word/signed word/dword/signed dword) 50 + (byte) KEY_HOME#0 ← (byte/signed byte/word/signed word/dword/signed dword) 51 + (byte) KEY_RSHIFT#0 ← (byte/signed byte/word/signed word/dword/signed dword) 52 + (byte) KEY_EQUALS#0 ← (byte/signed byte/word/signed word/dword/signed dword) 53 + (byte) KEY_ARROW_UP#0 ← (byte/signed byte/word/signed word/dword/signed dword) 54 + (byte) KEY_SLASH#0 ← (byte/signed byte/word/signed word/dword/signed dword) 55 + (byte) KEY_1#0 ← (byte/signed byte/word/signed word/dword/signed dword) 56 + (byte) KEY_ARROW_LEFT#0 ← (byte/signed byte/word/signed word/dword/signed dword) 57 + (byte) KEY_CTRL#0 ← (byte/signed byte/word/signed word/dword/signed dword) 58 + (byte) KEY_2#0 ← (byte/signed byte/word/signed word/dword/signed dword) 59 + (byte) KEY_SPACE#0 ← (byte/signed byte/word/signed word/dword/signed dword) 60 + (byte) KEY_COMMODORE#0 ← (byte/signed byte/word/signed word/dword/signed dword) 61 + (byte) KEY_Q#0 ← (byte/signed byte/word/signed word/dword/signed dword) 62 + (byte) KEY_RUNSTOP#0 ← (byte/signed byte/word/signed word/dword/signed dword) 63 + (byte[]) keyboard_char_keycodes#0 ← { (byte) KEY_AT#0, (byte) KEY_A#0, (byte) KEY_B#0, (byte) KEY_C#0, (byte) KEY_D#0, (byte) KEY_E#0, (byte) KEY_F#0, (byte) KEY_G#0, (byte) KEY_H#0, (byte) KEY_I#0, (byte) KEY_J#0, (byte) KEY_K#0, (byte) KEY_L#0, (byte) KEY_M#0, (byte) KEY_N#0, (byte) KEY_O#0, (byte) KEY_P#0, (byte) KEY_Q#0, (byte) KEY_R#0, (byte) KEY_S#0, (byte) KEY_T#0, (byte) KEY_U#0, (byte) KEY_V#0, (byte) KEY_W#0, (byte) KEY_X#0, (byte) KEY_Y#0, (byte) KEY_Z#0, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte) KEY_POUND#0, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte) KEY_ARROW_UP#0, (byte) KEY_ARROW_LEFT#0, (byte) KEY_SPACE#0, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte) KEY_ASTERISK#0, (byte) KEY_PLUS#0, (byte) KEY_COMMA#0, (byte) KEY_MINUS#0, (byte) KEY_DOT#0, (byte) KEY_SLASH#0, (byte) KEY_0#0, (byte) KEY_1#0, (byte) KEY_2#0, (byte) KEY_3#0, (byte) KEY_4#0, (byte) KEY_5#0, (byte) KEY_6#0, (byte) KEY_7#0, (byte) KEY_8#0, (byte) KEY_9#0, (byte) KEY_COLON#0, (byte) KEY_SEMICOLON#0, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte) KEY_EQUALS#0, (byte/signed byte/word/signed word/dword/signed dword) 63, (byte/signed byte/word/signed word/dword/signed dword) 63 } + (byte[8]) keyboard_matrix_row_bitmask#0 ← { (byte/word/signed word/dword/signed dword) 254, (byte/word/signed word/dword/signed dword) 253, (byte/word/signed word/dword/signed dword) 251, (byte/word/signed word/dword/signed dword) 247, (byte/word/signed word/dword/signed dword) 239, (byte/word/signed word/dword/signed dword) 223, (byte/word/signed word/dword/signed dword) 191, (byte/signed byte/word/signed word/dword/signed dword) 127 } + (byte[8]) keyboard_matrix_col_bitmask#0 ← { (byte/signed byte/word/signed word/dword/signed dword) 1, (byte/signed byte/word/signed word/dword/signed dword) 2, (byte/signed byte/word/signed word/dword/signed dword) 4, (byte/signed byte/word/signed word/dword/signed dword) 8, (byte/signed byte/word/signed word/dword/signed dword) 16, (byte/signed byte/word/signed word/dword/signed dword) 32, (byte/signed byte/word/signed word/dword/signed dword) 64, (byte/word/signed word/dword/signed dword) 128 } + to:@8 +@8: scope:[] from @4 + (byte[8]) keyboard_events#0 ← { fill( 8, 0) } + (byte) keyboard_events_size#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 + (byte) keyboard_modifiers#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 + (byte) KEY_MODIFIER_LSHIFT#0 ← (byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) KEY_MODIFIER_RSHIFT#0 ← (byte/signed byte/word/signed word/dword/signed dword) 2 + (byte) KEY_MODIFIER_CTRL#0 ← (byte/signed byte/word/signed word/dword/signed dword) 4 + (byte) KEY_MODIFIER_COMMODORE#0 ← (byte/signed byte/word/signed word/dword/signed dword) 8 + (byte~) $0 ← (byte) KEY_MODIFIER_LSHIFT#0 | (byte) KEY_MODIFIER_RSHIFT#0 + (byte) KEY_MODIFIER_SHIFT#0 ← (byte~) $0 + (byte[8]) keyboard_scan_values#0 ← { fill( 8, 0) } + to:@17 +fill: scope:[fill] from init::@2 init::@3 + (byte) fill::val#3 ← phi( init::@2/(byte) fill::val#0 init::@3/(byte) fill::val#1 ) + (word) fill::size#2 ← phi( init::@2/(word) fill::size#0 init::@3/(word) fill::size#1 ) + (byte*) fill::start#2 ← phi( init::@2/(byte*) fill::start#0 init::@3/(byte*) fill::start#1 ) + (byte*~) fill::$0 ← (byte*) fill::start#2 + (word) fill::size#2 + (byte*) fill::end#0 ← (byte*~) fill::$0 + (byte*) fill::addr#0 ← (byte*) fill::start#2 + to:fill::@1 +fill::@1: scope:[fill] from fill fill::@1 + (byte*) fill::end#1 ← phi( fill/(byte*) fill::end#0 fill::@1/(byte*) fill::end#1 ) + (byte*) fill::addr#2 ← phi( fill/(byte*) fill::addr#0 fill::@1/(byte*) fill::addr#1 ) + (byte) fill::val#2 ← phi( fill/(byte) fill::val#3 fill::@1/(byte) fill::val#2 ) + *((byte*) fill::addr#2) ← (byte) fill::val#2 + (byte*) fill::addr#1 ← ++ (byte*) fill::addr#2 + (bool~) fill::$1 ← (byte*) fill::addr#1 != (byte*) fill::end#1 + if((bool~) fill::$1) goto fill::@1 + to:fill::@return +fill::@return: scope:[fill] from fill::@1 + return + to:@return +mul8u: scope:[mul8u] from draw_block + (byte) mul8u::a#5 ← phi( draw_block/(byte) mul8u::a#1 ) + (byte) mul8u::b#1 ← phi( draw_block/(byte) mul8u::b#0 ) + (word) mul8u::res#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 + (word) mul8u::mb#0 ← ((word)) (byte) mul8u::b#1 + to:mul8u::@1 +mul8u::@1: scope:[mul8u] from mul8u mul8u::@4 + (word) mul8u::mb#5 ← phi( mul8u/(word) mul8u::mb#0 mul8u::@4/(word) mul8u::mb#1 ) + (word) mul8u::res#4 ← phi( mul8u/(word) mul8u::res#0 mul8u::@4/(word) mul8u::res#6 ) + (byte) mul8u::a#2 ← phi( mul8u/(byte) mul8u::a#5 mul8u::@4/(byte) mul8u::a#0 ) + (bool~) mul8u::$0 ← (byte) mul8u::a#2 != (byte/signed byte/word/signed word/dword/signed dword) 0 + if((bool~) mul8u::$0) goto mul8u::@2 + to:mul8u::@3 +mul8u::@2: scope:[mul8u] from mul8u::@1 + (word) mul8u::res#5 ← phi( mul8u::@1/(word) mul8u::res#4 ) + (word) mul8u::mb#4 ← phi( mul8u::@1/(word) mul8u::mb#5 ) + (byte) mul8u::a#3 ← phi( mul8u::@1/(byte) mul8u::a#2 ) + (byte~) mul8u::$1 ← (byte) mul8u::a#3 & (byte/signed byte/word/signed word/dword/signed dword) 1 + (bool~) mul8u::$2 ← (byte~) mul8u::$1 != (byte/signed byte/word/signed word/dword/signed dword) 0 + (bool~) mul8u::$3 ← ! (bool~) mul8u::$2 + if((bool~) mul8u::$3) goto mul8u::@4 + to:mul8u::@7 +mul8u::@3: scope:[mul8u] from mul8u::@1 + (word) mul8u::res#2 ← phi( mul8u::@1/(word) mul8u::res#4 ) + (word) mul8u::return#0 ← (word) mul8u::res#2 + to:mul8u::@return +mul8u::@4: scope:[mul8u] from mul8u::@2 mul8u::@7 + (word) mul8u::res#6 ← phi( mul8u::@2/(word) mul8u::res#5 mul8u::@7/(word) mul8u::res#1 ) + (word) mul8u::mb#2 ← phi( mul8u::@2/(word) mul8u::mb#4 mul8u::@7/(word) mul8u::mb#3 ) + (byte) mul8u::a#4 ← phi( mul8u::@2/(byte) mul8u::a#3 mul8u::@7/(byte) mul8u::a#6 ) + (byte~) mul8u::$5 ← (byte) mul8u::a#4 >> (byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) mul8u::a#0 ← (byte~) mul8u::$5 + (word~) mul8u::$6 ← (word) mul8u::mb#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 + (word) mul8u::mb#1 ← (word~) mul8u::$6 + to:mul8u::@1 +mul8u::@7: scope:[mul8u] from mul8u::@2 + (byte) mul8u::a#6 ← phi( mul8u::@2/(byte) mul8u::a#3 ) + (word) mul8u::mb#3 ← phi( mul8u::@2/(word) mul8u::mb#4 ) + (word) mul8u::res#3 ← phi( mul8u::@2/(word) mul8u::res#5 ) + (word~) mul8u::$4 ← (word) mul8u::res#3 + (word) mul8u::mb#3 + (word) mul8u::res#1 ← (word~) mul8u::$4 + to:mul8u::@4 +mul8u::@return: scope:[mul8u] from mul8u::@3 + (word) mul8u::return#3 ← phi( mul8u::@3/(word) mul8u::return#0 ) + (word) mul8u::return#1 ← (word) mul8u::return#3 + return + to:@return +@17: scope:[] from @8 + (byte*) screen#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024 + (byte*) charset#0 ← ((byte*)) (word/signed word/dword/signed dword) 8192 + (byte*) tileset#0 ← ((byte*)) (word/signed word/dword/signed dword) 10240 + (byte*) colors#0 ← ((byte*)) (word/dword/signed dword) 55296 + (byte*) level_address#0 ← ((byte*)) (word/signed word/dword/signed dword) 12288 + to:@21 +main: scope:[main] from @21 + call init + to:main::@7 +main::@7: scope:[main] from main + (byte) main::x#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 + to:main::@1 +main::@1: scope:[main] from main::@4 main::@7 + (byte) main::x#4 ← phi( main::@4/(byte) main::x#1 main::@7/(byte) main::x#0 ) + (byte) main::y#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 + to:main::@2 +main::@2: scope:[main] from main::@1 main::@8 + (byte) main::y#2 ← phi( main::@1/(byte) main::y#0 main::@8/(byte) main::y#1 ) + (byte) main::x#2 ← phi( main::@1/(byte) main::x#4 main::@8/(byte) main::x#5 ) + (byte~) main::$1 ← (byte) main::x#2 + (byte) main::y#2 + (byte) main::z#0 ← (byte~) main::$1 + (byte) main::tile#0 ← *((byte*) level_address#0 + (byte) main::z#0) + (byte) draw_block::tileno#0 ← (byte) main::tile#0 + (byte) draw_block::x#0 ← (byte) main::x#2 + (byte) draw_block::y#0 ← (byte) main::y#2 + (byte) draw_block::color#0 ← (byte) YELLOW#0 + call draw_block + to:main::@8 +main::@8: scope:[main] from main::@2 + (byte) main::x#5 ← phi( main::@2/(byte) main::x#2 ) + (byte) main::y#3 ← phi( main::@2/(byte) main::y#2 ) + (byte) main::y#1 ← ++ (byte) main::y#3 + (bool~) main::$3 ← (byte) main::y#1 < (byte/signed byte/word/signed word/dword/signed dword) 9 + if((bool~) main::$3) goto main::@2 + to:main::@4 +main::@4: scope:[main] from main::@8 + (byte) main::x#3 ← phi( main::@8/(byte) main::x#5 ) + (byte) main::x#1 ← ++ (byte) main::x#3 + (bool~) main::$4 ← (byte) main::x#1 < (byte/signed byte/word/signed word/dword/signed dword) 16 + if((bool~) main::$4) goto main::@1 + to:main::@3 +main::@3: scope:[main] from main::@3 main::@4 + if(true) goto main::@3 + to:main::@return +main::@return: scope:[main] from main::@3 + return + to:@return +init: scope:[init] from main + call init_sprites + to:init::@2 +init::@2: scope:[init] from init + (byte*) fill::start#0 ← (byte*) screen#0 + (word) fill::size#0 ← (word/signed word/dword/signed dword) 1000 + (byte) fill::val#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 + call fill + to:init::@3 +init::@3: scope:[init] from init::@2 + (byte*) fill::start#1 ← (byte*) colors#0 + (word) fill::size#1 ← (word/signed word/dword/signed dword) 1000 + (byte) fill::val#1 ← (byte) BLACK#0 + call fill + to:init::@4 +init::@4: scope:[init] from init::@3 + (byte*) init::toD0181_screen#0 ← (byte*) screen#0 + (byte*) init::toD0181_gfx#0 ← (byte*) charset#0 + to:init::toD0181 +init::toD0181: scope:[init] from init::@4 + (byte*) init::toD0181_gfx#1 ← phi( init::@4/(byte*) init::toD0181_gfx#0 ) + (byte*) init::toD0181_screen#1 ← phi( init::@4/(byte*) init::toD0181_screen#0 ) + (word) init::toD0181_$0#0 ← ((word)) (byte*) init::toD0181_screen#1 + (word) init::toD0181_$1#0 ← (word) init::toD0181_$0#0 & (word/signed word/dword/signed dword) 16383 + (word) init::toD0181_$2#0 ← (word) init::toD0181_$1#0 << (byte/signed byte/word/signed word/dword/signed dword) 2 + (byte) init::toD0181_$3#0 ← > (word) init::toD0181_$2#0 + (word) init::toD0181_$4#0 ← ((word)) (byte*) init::toD0181_gfx#1 + (byte) init::toD0181_$5#0 ← > (word) init::toD0181_$4#0 + (byte) init::toD0181_$6#0 ← (byte) init::toD0181_$5#0 >> (byte/signed byte/word/signed word/dword/signed dword) 2 + (byte) init::toD0181_$7#0 ← (byte) init::toD0181_$6#0 & (byte/signed byte/word/signed word/dword/signed dword) 15 + (byte) init::toD0181_$8#0 ← (byte) init::toD0181_$3#0 | (byte) init::toD0181_$7#0 + (byte) init::toD0181_return#0 ← (byte) init::toD0181_$8#0 + to:init::toD0181_@return +init::toD0181_@return: scope:[init] from init::toD0181 + (byte) init::toD0181_return#2 ← phi( init::toD0181/(byte) init::toD0181_return#0 ) + (byte) init::toD0181_return#1 ← (byte) init::toD0181_return#2 + to:init::@1 +init::@1: scope:[init] from init::toD0181_@return + (byte) init::toD0181_return#3 ← phi( init::toD0181_@return/(byte) init::toD0181_return#1 ) + (byte~) init::$3 ← (byte) init::toD0181_return#3 + *((byte*) D018#0) ← (byte~) init::$3 + asm { lda#$5b sta$d011 } + *((byte*) BORDERCOL#0) ← (byte) BLACK#0 + *((byte*) BGCOL1#0) ← (byte) BLACK#0 + *((byte*) BGCOL2#0) ← (byte) RED#0 + *((byte*) BGCOL3#0) ← (byte) BLUE#0 + *((byte*) BGCOL4#0) ← (byte) GREEN#0 + to:init::@return +init::@return: scope:[init] from init::@1 + return + to:@return +init_sprites: scope:[init_sprites] from init + *((byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 1 + *((byte*) SPRITES_EXPAND_X#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 + *((byte*) SPRITES_EXPAND_Y#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 + *((byte*) SPRITES_XMSB#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 + *((byte*) SPRITES_COLS#0) ← (byte) WHITE#0 + *((byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 + to:init_sprites::@return +init_sprites::@return: scope:[init_sprites] from init_sprites + return + to:@return +draw_block: scope:[draw_block] from main::@2 + (byte) draw_block::y#2 ← phi( main::@2/(byte) draw_block::y#0 ) + (byte) draw_block::x#1 ← phi( main::@2/(byte) draw_block::x#0 ) + (byte) draw_block::tileno#2 ← phi( main::@2/(byte) draw_block::tileno#0 ) + (byte~) draw_block::$0 ← (byte) draw_block::tileno#2 << (byte/signed byte/word/signed word/dword/signed dword) 2 + (byte) draw_block::tileno#1 ← (byte~) draw_block::$0 + (byte~) draw_block::$1 ← (byte) draw_block::x#1 << (byte/signed byte/word/signed word/dword/signed dword) 1 + (word) draw_block::x1#0 ← ((word)) (byte~) draw_block::$1 + (byte~) draw_block::$2 ← (byte) draw_block::y#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) draw_block::y#1 ← (byte~) draw_block::$2 + (byte) mul8u::a#1 ← (byte) draw_block::y#1 + (byte) mul8u::b#0 ← (byte/signed byte/word/signed word/dword/signed dword) 40 + call mul8u + (word) mul8u::return#2 ← (word) mul8u::return#1 + to:draw_block::@1 +draw_block::@1: scope:[draw_block] from draw_block + (byte) draw_block::tileno#3 ← phi( draw_block/(byte) draw_block::tileno#1 ) + (word) draw_block::x1#1 ← phi( draw_block/(word) draw_block::x1#0 ) + (word) mul8u::return#4 ← phi( draw_block/(word) mul8u::return#2 ) + (word~) draw_block::$3 ← (word) mul8u::return#4 + (word) draw_block::z#0 ← (word~) draw_block::$3 + (word~) draw_block::$4 ← (word) draw_block::z#0 + (word) draw_block::x1#1 + (word) draw_block::z#1 ← (word~) draw_block::$4 + (byte) draw_block::drawtile#0 ← *((byte*) tileset#0 + (byte) draw_block::tileno#3) + *((byte*) screen#0 + (word) draw_block::z#1) ← (byte) draw_block::drawtile#0 + *((byte*) colors#0 + (word) draw_block::z#1) ← (byte) YELLOW#0 + (word/signed dword/dword~) draw_block::$5 ← (word) draw_block::z#1 + (byte/signed byte/word/signed word/dword/signed dword) 1 + *((byte*) screen#0 + (word/signed dword/dword~) draw_block::$5) ← (byte/signed byte/word/signed word/dword/signed dword) 1 + (word/signed dword/dword~) draw_block::$6 ← (word) draw_block::z#1 + (byte/signed byte/word/signed word/dword/signed dword) 1 + *((byte*) colors#0 + (word/signed dword/dword~) draw_block::$6) ← (byte) YELLOW#0 + (word/signed dword/dword~) draw_block::$7 ← (word) draw_block::z#1 + (byte/signed byte/word/signed word/dword/signed dword) 40 + *((byte*) screen#0 + (word/signed dword/dword~) draw_block::$7) ← (byte/signed byte/word/signed word/dword/signed dword) 2 + (word/signed dword/dword~) draw_block::$8 ← (word) draw_block::z#1 + (byte/signed byte/word/signed word/dword/signed dword) 40 + *((byte*) colors#0 + (word/signed dword/dword~) draw_block::$8) ← (byte) YELLOW#0 + (word/signed dword/dword~) draw_block::$9 ← (word) draw_block::z#1 + (byte/signed byte/word/signed word/dword/signed dword) 41 + *((byte*) screen#0 + (word/signed dword/dword~) draw_block::$9) ← (byte/signed byte/word/signed word/dword/signed dword) 3 + (word/signed dword/dword~) draw_block::$10 ← (word) draw_block::z#1 + (byte/signed byte/word/signed word/dword/signed dword) 41 + *((byte*) colors#0 + (word/signed dword/dword~) draw_block::$10) ← (byte) YELLOW#0 + to:draw_block::@return +draw_block::@return: scope:[draw_block] from draw_block::@1 + return + to:@return +@21: scope:[] from @17 + call main + to:@22 +@22: scope:[] from @21 + to:@end +@end: scope:[] from @22 + +SYMBOL TABLE SSA +(byte~) $0 +(label) @17 +(label) @21 +(label) @22 +(label) @4 +(label) @8 +(label) @begin +(label) @end +(byte*) BGCOL +(byte*) BGCOL#0 +(byte*) BGCOL1 +(byte*) BGCOL1#0 +(byte*) BGCOL2 +(byte*) BGCOL2#0 +(byte*) BGCOL3 +(byte*) BGCOL3#0 +(byte*) BGCOL4 +(byte*) BGCOL4#0 +(byte) BLACK +(byte) BLACK#0 +(byte) BLUE +(byte) BLUE#0 +(byte*) BORDERCOL +(byte*) BORDERCOL#0 +(byte) BROWN +(byte) BROWN#0 +(byte*) CHARGEN +(byte*) CHARGEN#0 +(byte*) CIA1_INTERRUPT +(byte*) CIA1_INTERRUPT#0 +(byte*) CIA1_PORT_A +(byte*) CIA1_PORT_A#0 +(byte*) CIA1_PORT_A_DDR +(byte*) CIA1_PORT_A_DDR#0 +(byte*) CIA1_PORT_B +(byte*) CIA1_PORT_B#0 +(byte*) CIA1_PORT_B_DDR +(byte*) CIA1_PORT_B_DDR#0 +(byte*) CIA2_INTERRUPT +(byte*) CIA2_INTERRUPT#0 +(byte*) CIA2_PORT_A +(byte*) CIA2_PORT_A#0 +(byte*) CIA2_PORT_A_DDR +(byte*) CIA2_PORT_A_DDR#0 +(byte*) CIA2_PORT_B +(byte*) CIA2_PORT_B#0 +(byte*) CIA2_PORT_B_DDR +(byte*) CIA2_PORT_B_DDR#0 +(byte) CIA_INTERRUPT_CLEAR +(byte) CIA_INTERRUPT_CLEAR#0 +(byte*) COLS +(byte*) COLS#0 +(byte) CYAN +(byte) CYAN#0 +(byte*) D011 +(byte*) D011#0 +(byte*) D016 +(byte*) D016#0 +(byte*) D018 +(byte*) D018#0 +(byte) DARK_GREY +(byte) DARK_GREY#0 +(byte) GREEN +(byte) GREEN#0 +(byte) GREY +(byte) GREY#0 +(void()**) HARDWARE_IRQ +(void()**) HARDWARE_IRQ#0 +(byte) IRQ_COLLISION_BG +(byte) IRQ_COLLISION_BG#0 +(byte) IRQ_COLLISION_SPRITE +(byte) IRQ_COLLISION_SPRITE#0 +(byte*) IRQ_ENABLE +(byte*) IRQ_ENABLE#0 +(byte) IRQ_LIGHTPEN +(byte) IRQ_LIGHTPEN#0 +(byte) IRQ_RASTER +(byte) IRQ_RASTER#0 +(byte*) IRQ_STATUS +(byte*) IRQ_STATUS#0 +(void()**) KERNEL_IRQ +(void()**) KERNEL_IRQ#0 +(byte) KEY_0 +(byte) KEY_0#0 +(byte) KEY_1 +(byte) KEY_1#0 +(byte) KEY_2 +(byte) KEY_2#0 +(byte) KEY_3 +(byte) KEY_3#0 +(byte) KEY_4 +(byte) KEY_4#0 +(byte) KEY_5 +(byte) KEY_5#0 +(byte) KEY_6 +(byte) KEY_6#0 +(byte) KEY_7 +(byte) KEY_7#0 +(byte) KEY_8 +(byte) KEY_8#0 +(byte) KEY_9 +(byte) KEY_9#0 +(byte) KEY_A +(byte) KEY_A#0 +(byte) KEY_ARROW_LEFT +(byte) KEY_ARROW_LEFT#0 +(byte) KEY_ARROW_UP +(byte) KEY_ARROW_UP#0 +(byte) KEY_ASTERISK +(byte) KEY_ASTERISK#0 +(byte) KEY_AT +(byte) KEY_AT#0 +(byte) KEY_B +(byte) KEY_B#0 +(byte) KEY_C +(byte) KEY_C#0 +(byte) KEY_COLON +(byte) KEY_COLON#0 +(byte) KEY_COMMA +(byte) KEY_COMMA#0 +(byte) KEY_COMMODORE +(byte) KEY_COMMODORE#0 +(byte) KEY_CRSR_DOWN +(byte) KEY_CRSR_DOWN#0 +(byte) KEY_CRSR_RIGHT +(byte) KEY_CRSR_RIGHT#0 +(byte) KEY_CTRL +(byte) KEY_CTRL#0 +(byte) KEY_D +(byte) KEY_D#0 +(byte) KEY_DEL +(byte) KEY_DEL#0 +(byte) KEY_DOT +(byte) KEY_DOT#0 +(byte) KEY_E +(byte) KEY_E#0 +(byte) KEY_EQUALS +(byte) KEY_EQUALS#0 +(byte) KEY_F +(byte) KEY_F#0 +(byte) KEY_F1 +(byte) KEY_F1#0 +(byte) KEY_F3 +(byte) KEY_F3#0 +(byte) KEY_F5 +(byte) KEY_F5#0 +(byte) KEY_F7 +(byte) KEY_F7#0 +(byte) KEY_G +(byte) KEY_G#0 +(byte) KEY_H +(byte) KEY_H#0 +(byte) KEY_HOME +(byte) KEY_HOME#0 +(byte) KEY_I +(byte) KEY_I#0 +(byte) KEY_J +(byte) KEY_J#0 +(byte) KEY_K +(byte) KEY_K#0 +(byte) KEY_L +(byte) KEY_L#0 +(byte) KEY_LSHIFT +(byte) KEY_LSHIFT#0 +(byte) KEY_M +(byte) KEY_M#0 +(byte) KEY_MINUS +(byte) KEY_MINUS#0 +(byte) KEY_MODIFIER_COMMODORE +(byte) KEY_MODIFIER_COMMODORE#0 +(byte) KEY_MODIFIER_CTRL +(byte) KEY_MODIFIER_CTRL#0 +(byte) KEY_MODIFIER_LSHIFT +(byte) KEY_MODIFIER_LSHIFT#0 +(byte) KEY_MODIFIER_RSHIFT +(byte) KEY_MODIFIER_RSHIFT#0 +(byte) KEY_MODIFIER_SHIFT +(byte) KEY_MODIFIER_SHIFT#0 +(byte) KEY_N +(byte) KEY_N#0 +(byte) KEY_O +(byte) KEY_O#0 +(byte) KEY_P +(byte) KEY_P#0 +(byte) KEY_PLUS +(byte) KEY_PLUS#0 +(byte) KEY_POUND +(byte) KEY_POUND#0 +(byte) KEY_Q +(byte) KEY_Q#0 +(byte) KEY_R +(byte) KEY_R#0 +(byte) KEY_RETURN +(byte) KEY_RETURN#0 +(byte) KEY_RSHIFT +(byte) KEY_RSHIFT#0 +(byte) KEY_RUNSTOP +(byte) KEY_RUNSTOP#0 +(byte) KEY_S +(byte) KEY_S#0 +(byte) KEY_SEMICOLON +(byte) KEY_SEMICOLON#0 +(byte) KEY_SLASH +(byte) KEY_SLASH#0 +(byte) KEY_SPACE +(byte) KEY_SPACE#0 +(byte) KEY_T +(byte) KEY_T#0 +(byte) KEY_U +(byte) KEY_U#0 +(byte) KEY_V +(byte) KEY_V#0 +(byte) KEY_W +(byte) KEY_W#0 +(byte) KEY_X +(byte) KEY_X#0 +(byte) KEY_Y +(byte) KEY_Y#0 +(byte) KEY_Z +(byte) KEY_Z#0 +(byte*) LIGHTPEN_X +(byte*) LIGHTPEN_X#0 +(byte*) LIGHTPEN_Y +(byte*) LIGHTPEN_Y#0 +(byte) LIGHT_BLUE +(byte) LIGHT_BLUE#0 +(byte) LIGHT_GREEN +(byte) LIGHT_GREEN#0 +(byte) LIGHT_GREY +(byte) LIGHT_GREY#0 +(byte) ORANGE +(byte) ORANGE#0 +(byte) PINK +(byte) PINK#0 +(byte*) PROCPORT +(byte*) PROCPORT#0 +(byte) PROCPORT_BASIC_KERNEL_IO +(byte) PROCPORT_BASIC_KERNEL_IO#0 +(byte*) PROCPORT_DDR +(byte*) PROCPORT_DDR#0 +(byte) PROCPORT_DDR_MEMORY_MASK +(byte) PROCPORT_DDR_MEMORY_MASK#0 +(byte) PROCPORT_KERNEL_IO +(byte) PROCPORT_KERNEL_IO#0 +(byte) PROCPORT_RAM_ALL +(byte) PROCPORT_RAM_ALL#0 +(byte) PROCPORT_RAM_CHARROM +(byte) PROCPORT_RAM_CHARROM#0 +(byte) PROCPORT_RAM_IO +(byte) PROCPORT_RAM_IO#0 +(byte) PURPLE +(byte) PURPLE#0 +(byte*) RASTER +(byte*) RASTER#0 +(byte) RED +(byte) RED#0 +(byte*) SPRITES_COLS +(byte*) SPRITES_COLS#0 +(byte*) SPRITES_ENABLE +(byte*) SPRITES_ENABLE#0 +(byte*) SPRITES_EXPAND_X +(byte*) SPRITES_EXPAND_X#0 +(byte*) SPRITES_EXPAND_Y +(byte*) SPRITES_EXPAND_Y#0 +(byte*) SPRITES_MC +(byte*) SPRITES_MC#0 +(byte*) SPRITES_MC1 +(byte*) SPRITES_MC1#0 +(byte*) SPRITES_MC2 +(byte*) SPRITES_MC2#0 +(byte*) SPRITES_PRIORITY +(byte*) SPRITES_PRIORITY#0 +(byte*) SPRITES_XMSB +(byte*) SPRITES_XMSB#0 +(byte*) SPRITES_XPOS +(byte*) SPRITES_XPOS#0 +(byte*) SPRITES_YPOS +(byte*) SPRITES_YPOS#0 +(word) SPRITE_PTRS +(word) SPRITE_PTRS#0 +(byte) VIC_BMM +(byte) VIC_BMM#0 +(byte*) VIC_CONTROL +(byte*) VIC_CONTROL#0 +(byte*) VIC_CONTROL2 +(byte*) VIC_CONTROL2#0 +(byte) VIC_CSEL +(byte) VIC_CSEL#0 +(byte) VIC_DEN +(byte) VIC_DEN#0 +(byte) VIC_ECM +(byte) VIC_ECM#0 +(byte) VIC_MCM +(byte) VIC_MCM#0 +(byte*) VIC_MEMORY +(byte*) VIC_MEMORY#0 +(byte) VIC_RSEL +(byte) VIC_RSEL#0 +(byte) VIC_RST8 +(byte) VIC_RST8#0 +(byte) WHITE +(byte) WHITE#0 +(byte) YELLOW +(byte) YELLOW#0 +(byte*) charset +(byte*) charset#0 +(byte*) colors +(byte*) colors#0 +(void()) draw_block((byte) draw_block::tileno , (byte) draw_block::x , (byte) draw_block::y , (byte) draw_block::color) +(byte~) draw_block::$0 +(byte~) draw_block::$1 +(word/signed dword/dword~) draw_block::$10 +(byte~) draw_block::$2 +(word~) draw_block::$3 +(word~) draw_block::$4 +(word/signed dword/dword~) draw_block::$5 +(word/signed dword/dword~) draw_block::$6 +(word/signed dword/dword~) draw_block::$7 +(word/signed dword/dword~) draw_block::$8 +(word/signed dword/dword~) draw_block::$9 +(label) draw_block::@1 +(label) draw_block::@return +(byte) draw_block::color +(byte) draw_block::color#0 +(byte) draw_block::drawtile +(byte) draw_block::drawtile#0 +(byte) draw_block::tileno +(byte) draw_block::tileno#0 +(byte) draw_block::tileno#1 +(byte) draw_block::tileno#2 +(byte) draw_block::tileno#3 +(byte) draw_block::x +(byte) draw_block::x#0 +(byte) draw_block::x#1 +(word) draw_block::x1 +(word) draw_block::x1#0 +(word) draw_block::x1#1 +(byte) draw_block::y +(byte) draw_block::y#0 +(byte) draw_block::y#1 +(byte) draw_block::y#2 +(word) draw_block::z +(word) draw_block::z#0 +(word) draw_block::z#1 +(void()) fill((byte*) fill::start , (word) fill::size , (byte) fill::val) +(byte*~) fill::$0 +(bool~) fill::$1 +(label) fill::@1 +(label) fill::@return +(byte*) fill::addr +(byte*) fill::addr#0 +(byte*) fill::addr#1 +(byte*) fill::addr#2 +(byte*) fill::end +(byte*) fill::end#0 +(byte*) fill::end#1 +(word) fill::size +(word) fill::size#0 +(word) fill::size#1 +(word) fill::size#2 +(byte*) fill::start +(byte*) fill::start#0 +(byte*) fill::start#1 +(byte*) fill::start#2 +(byte) fill::val +(byte) fill::val#0 +(byte) fill::val#1 +(byte) fill::val#2 +(byte) fill::val#3 +(void()) init() +(byte~) init::$3 +(label) init::@1 +(label) init::@2 +(label) init::@3 +(label) init::@4 +(label) init::@return +(label) init::toD0181 +(word~) init::toD0181_$0 +(word) init::toD0181_$0#0 +(word~) init::toD0181_$1 +(word) init::toD0181_$1#0 +(word~) init::toD0181_$2 +(word) init::toD0181_$2#0 +(byte~) init::toD0181_$3 +(byte) init::toD0181_$3#0 +(word~) init::toD0181_$4 +(word) init::toD0181_$4#0 +(byte~) init::toD0181_$5 +(byte) init::toD0181_$5#0 +(byte~) init::toD0181_$6 +(byte) init::toD0181_$6#0 +(byte~) init::toD0181_$7 +(byte) init::toD0181_$7#0 +(byte~) init::toD0181_$8 +(byte) init::toD0181_$8#0 +(label) init::toD0181_@return +(byte*) init::toD0181_gfx +(byte*) init::toD0181_gfx#0 +(byte*) init::toD0181_gfx#1 +(byte) init::toD0181_return +(byte) init::toD0181_return#0 +(byte) init::toD0181_return#1 +(byte) init::toD0181_return#2 +(byte) init::toD0181_return#3 +(byte*) init::toD0181_screen +(byte*) init::toD0181_screen#0 +(byte*) init::toD0181_screen#1 +(void()) init_sprites() +(label) init_sprites::@return +(byte[]) keyboard_char_keycodes +(byte[]) keyboard_char_keycodes#0 +(byte[8]) keyboard_events +(byte[8]) keyboard_events#0 +(byte) keyboard_events_size +(byte) keyboard_events_size#0 +(byte[8]) keyboard_matrix_col_bitmask +(byte[8]) keyboard_matrix_col_bitmask#0 +(byte[8]) keyboard_matrix_row_bitmask +(byte[8]) keyboard_matrix_row_bitmask#0 +(byte) keyboard_modifiers +(byte) keyboard_modifiers#0 +(byte[8]) keyboard_scan_values +(byte[8]) keyboard_scan_values#0 +(byte*) level_address +(byte*) level_address#0 +(void()) main() +(byte~) main::$1 +(bool~) main::$3 +(bool~) main::$4 +(label) main::@1 +(label) main::@2 +(label) main::@3 +(label) main::@4 +(label) main::@7 +(label) main::@8 +(label) main::@return +(byte) main::tile +(byte) main::tile#0 +(byte) main::x +(byte) main::x#0 +(byte) main::x#1 +(byte) main::x#2 +(byte) main::x#3 +(byte) main::x#4 +(byte) main::x#5 +(byte) main::y +(byte) main::y#0 +(byte) main::y#1 +(byte) main::y#2 +(byte) main::y#3 +(byte) main::z +(byte) main::z#0 +(word()) mul8u((byte) mul8u::a , (byte) mul8u::b) +(bool~) mul8u::$0 +(byte~) mul8u::$1 +(bool~) mul8u::$2 +(bool~) mul8u::$3 +(word~) mul8u::$4 +(byte~) mul8u::$5 +(word~) mul8u::$6 +(label) mul8u::@1 +(label) mul8u::@2 +(label) mul8u::@3 +(label) mul8u::@4 +(label) mul8u::@7 +(label) mul8u::@return +(byte) mul8u::a +(byte) mul8u::a#0 +(byte) mul8u::a#1 +(byte) mul8u::a#2 +(byte) mul8u::a#3 +(byte) mul8u::a#4 +(byte) mul8u::a#5 +(byte) mul8u::a#6 +(byte) mul8u::b +(byte) mul8u::b#0 +(byte) mul8u::b#1 +(word) mul8u::mb +(word) mul8u::mb#0 +(word) mul8u::mb#1 +(word) mul8u::mb#2 +(word) mul8u::mb#3 +(word) mul8u::mb#4 +(word) mul8u::mb#5 +(word) mul8u::res +(word) mul8u::res#0 +(word) mul8u::res#1 +(word) mul8u::res#2 +(word) mul8u::res#3 +(word) mul8u::res#4 +(word) mul8u::res#5 +(word) mul8u::res#6 +(word) mul8u::return +(word) mul8u::return#0 +(word) mul8u::return#1 +(word) mul8u::return#2 +(word) mul8u::return#3 +(word) mul8u::return#4 +(byte*) screen +(byte*) screen#0 +(byte*) tileset +(byte*) tileset#0 + +Culled Empty Block (label) @22 +Successful SSA optimization Pass2CullEmptyBlocks +Inversing boolean not (bool~) mul8u::$3 ← (byte~) mul8u::$1 == (byte/signed byte/word/signed word/dword/signed dword) 0 from (bool~) mul8u::$2 ← (byte~) mul8u::$1 != (byte/signed byte/word/signed word/dword/signed dword) 0 +Successful SSA optimization Pass2UnaryNotSimplification +Alias (byte) KEY_MODIFIER_SHIFT#0 = (byte~) $0 +Alias (byte*) fill::end#0 = (byte*~) fill::$0 +Alias (byte*) fill::addr#0 = (byte*) fill::start#2 +Alias (byte) mul8u::a#2 = (byte) mul8u::a#3 (byte) mul8u::a#6 +Alias (word) mul8u::mb#3 = (word) mul8u::mb#4 (word) mul8u::mb#5 +Alias (word) mul8u::res#2 = (word) mul8u::res#5 (word) mul8u::res#4 (word) mul8u::return#0 (word) mul8u::res#3 (word) mul8u::return#3 (word) mul8u::return#1 +Alias (byte) mul8u::a#0 = (byte~) mul8u::$5 +Alias (word) mul8u::mb#1 = (word~) mul8u::$6 +Alias (word) mul8u::res#1 = (word~) mul8u::$4 +Alias (byte) main::z#0 = (byte~) main::$1 +Alias (byte) main::y#2 = (byte) main::y#3 +Alias (byte) main::x#2 = (byte) main::x#5 (byte) main::x#3 +Alias (byte*) init::toD0181_screen#0 = (byte*) init::toD0181_screen#1 +Alias (byte*) init::toD0181_gfx#0 = (byte*) init::toD0181_gfx#1 +Alias (byte) init::toD0181_return#0 = (byte) init::toD0181_$8#0 (byte) init::toD0181_return#2 (byte) init::toD0181_return#1 (byte) init::toD0181_return#3 (byte~) init::$3 +Alias (byte) draw_block::tileno#1 = (byte~) draw_block::$0 (byte) draw_block::tileno#3 +Alias (byte) draw_block::y#1 = (byte~) draw_block::$2 +Alias (word) mul8u::return#2 = (word) mul8u::return#4 +Alias (word) draw_block::x1#0 = (word) draw_block::x1#1 +Alias (word) draw_block::z#0 = (word~) draw_block::$3 +Alias (word) draw_block::z#1 = (word~) draw_block::$4 +Successful SSA optimization Pass2AliasElimination +Alias (byte) mul8u::a#2 = (byte) mul8u::a#4 +Alias (word) mul8u::mb#2 = (word) mul8u::mb#3 +Successful SSA optimization Pass2AliasElimination +Self Phi Eliminated (byte) fill::val#2 +Self Phi Eliminated (byte*) fill::end#1 +Self Phi Eliminated (byte) main::x#2 +Successful SSA optimization Pass2SelfPhiElimination +Redundant Phi (byte) fill::val#2 (byte) fill::val#3 +Redundant Phi (byte*) fill::end#1 (byte*) fill::end#0 +Redundant Phi (byte) mul8u::b#1 (byte) mul8u::b#0 +Redundant Phi (byte) mul8u::a#5 (byte) mul8u::a#1 +Redundant Phi (byte) main::x#2 (byte) main::x#4 +Redundant Phi (byte) draw_block::tileno#2 (byte) draw_block::tileno#0 +Redundant Phi (byte) draw_block::x#1 (byte) draw_block::x#0 +Redundant Phi (byte) draw_block::y#2 (byte) draw_block::y#0 +Successful SSA optimization Pass2RedundantPhiElimination +Simple Condition (bool~) fill::$1 if((byte*) fill::addr#1!=(byte*) fill::end#0) goto fill::@1 +Simple Condition (bool~) mul8u::$0 if((byte) mul8u::a#2!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto mul8u::@2 +Simple Condition (bool~) mul8u::$3 if((byte~) mul8u::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto mul8u::@4 +Simple Condition (bool~) main::$3 if((byte) main::y#1<(byte/signed byte/word/signed word/dword/signed dword) 9) goto main::@2 +Simple Condition (bool~) main::$4 if((byte) main::x#1<(byte/signed byte/word/signed word/dword/signed dword) 16) goto main::@1 +Successful SSA optimization Pass2ConditionalJumpSimplification +Constant (const byte*) PROCPORT_DDR#0 = ((byte*))0 +Constant (const byte) PROCPORT_DDR_MEMORY_MASK#0 = 7 +Constant (const byte*) PROCPORT#0 = ((byte*))1 +Constant (const byte) PROCPORT_RAM_ALL#0 = 48 +Constant (const byte) PROCPORT_RAM_IO#0 = 53 +Constant (const byte) PROCPORT_RAM_CHARROM#0 = 49 +Constant (const byte) PROCPORT_KERNEL_IO#0 = 54 +Constant (const byte) PROCPORT_BASIC_KERNEL_IO#0 = 55 +Constant (const byte*) CHARGEN#0 = ((byte*))53248 +Constant (const word) SPRITE_PTRS#0 = 1016 +Constant (const byte*) SPRITES_XPOS#0 = ((byte*))53248 +Constant (const byte*) SPRITES_YPOS#0 = ((byte*))53249 +Constant (const byte*) SPRITES_XMSB#0 = ((byte*))53264 +Constant (const byte*) RASTER#0 = ((byte*))53266 +Constant (const byte*) SPRITES_ENABLE#0 = ((byte*))53269 +Constant (const byte*) SPRITES_EXPAND_Y#0 = ((byte*))53271 +Constant (const byte*) SPRITES_PRIORITY#0 = ((byte*))53275 +Constant (const byte*) SPRITES_MC#0 = ((byte*))53276 +Constant (const byte*) SPRITES_EXPAND_X#0 = ((byte*))53277 +Constant (const byte*) BORDERCOL#0 = ((byte*))53280 +Constant (const byte*) BGCOL#0 = ((byte*))53281 +Constant (const byte*) BGCOL1#0 = ((byte*))53281 +Constant (const byte*) BGCOL2#0 = ((byte*))53282 +Constant (const byte*) BGCOL3#0 = ((byte*))53283 +Constant (const byte*) BGCOL4#0 = ((byte*))53284 +Constant (const byte*) SPRITES_MC1#0 = ((byte*))53285 +Constant (const byte*) SPRITES_MC2#0 = ((byte*))53286 +Constant (const byte*) SPRITES_COLS#0 = ((byte*))53287 +Constant (const byte*) VIC_CONTROL#0 = ((byte*))53265 +Constant (const byte*) D011#0 = ((byte*))53265 +Constant (const byte) VIC_RST8#0 = 128 +Constant (const byte) VIC_ECM#0 = 64 +Constant (const byte) VIC_BMM#0 = 32 +Constant (const byte) VIC_DEN#0 = 16 +Constant (const byte) VIC_RSEL#0 = 8 +Constant (const byte*) VIC_CONTROL2#0 = ((byte*))53270 +Constant (const byte*) D016#0 = ((byte*))53270 +Constant (const byte) VIC_MCM#0 = 16 +Constant (const byte) VIC_CSEL#0 = 8 +Constant (const byte*) D018#0 = ((byte*))53272 +Constant (const byte*) VIC_MEMORY#0 = ((byte*))53272 +Constant (const byte*) LIGHTPEN_X#0 = ((byte*))53267 +Constant (const byte*) LIGHTPEN_Y#0 = ((byte*))53268 +Constant (const byte*) IRQ_STATUS#0 = ((byte*))53273 +Constant (const byte*) IRQ_ENABLE#0 = ((byte*))53274 +Constant (const byte) IRQ_RASTER#0 = 1 +Constant (const byte) IRQ_COLLISION_BG#0 = 2 +Constant (const byte) IRQ_COLLISION_SPRITE#0 = 4 +Constant (const byte) IRQ_LIGHTPEN#0 = 8 +Constant (const byte*) COLS#0 = ((byte*))55296 +Constant (const byte*) CIA1_PORT_A#0 = ((byte*))56320 +Constant (const byte*) CIA1_PORT_B#0 = ((byte*))56321 +Constant (const byte*) CIA1_PORT_A_DDR#0 = ((byte*))56322 +Constant (const byte*) CIA1_PORT_B_DDR#0 = ((byte*))56323 +Constant (const byte*) CIA1_INTERRUPT#0 = ((byte*))56333 +Constant (const byte) CIA_INTERRUPT_CLEAR#0 = 127 +Constant (const byte*) CIA2_PORT_A#0 = ((byte*))56576 +Constant (const byte*) CIA2_PORT_B#0 = ((byte*))56577 +Constant (const byte*) CIA2_PORT_A_DDR#0 = ((byte*))56578 +Constant (const byte*) CIA2_PORT_B_DDR#0 = ((byte*))56579 +Constant (const byte*) CIA2_INTERRUPT#0 = ((byte*))56589 +Constant (const void()**) KERNEL_IRQ#0 = ((void()**))788 +Constant (const void()**) HARDWARE_IRQ#0 = ((void()**))65534 +Constant (const byte) BLACK#0 = 0 +Constant (const byte) WHITE#0 = 1 +Constant (const byte) RED#0 = 2 +Constant (const byte) CYAN#0 = 3 +Constant (const byte) PURPLE#0 = 4 +Constant (const byte) GREEN#0 = 5 +Constant (const byte) BLUE#0 = 6 +Constant (const byte) YELLOW#0 = 7 +Constant (const byte) ORANGE#0 = 8 +Constant (const byte) BROWN#0 = 9 +Constant (const byte) PINK#0 = 10 +Constant (const byte) DARK_GREY#0 = 11 +Constant (const byte) GREY#0 = 12 +Constant (const byte) LIGHT_GREEN#0 = 13 +Constant (const byte) LIGHT_BLUE#0 = 14 +Constant (const byte) LIGHT_GREY#0 = 15 +Constant (const byte) KEY_DEL#0 = 0 +Constant (const byte) KEY_RETURN#0 = 1 +Constant (const byte) KEY_CRSR_RIGHT#0 = 2 +Constant (const byte) KEY_F7#0 = 3 +Constant (const byte) KEY_F1#0 = 4 +Constant (const byte) KEY_F3#0 = 5 +Constant (const byte) KEY_F5#0 = 6 +Constant (const byte) KEY_CRSR_DOWN#0 = 7 +Constant (const byte) KEY_3#0 = 8 +Constant (const byte) KEY_W#0 = 9 +Constant (const byte) KEY_A#0 = 10 +Constant (const byte) KEY_4#0 = 11 +Constant (const byte) KEY_Z#0 = 12 +Constant (const byte) KEY_S#0 = 13 +Constant (const byte) KEY_E#0 = 14 +Constant (const byte) KEY_LSHIFT#0 = 15 +Constant (const byte) KEY_5#0 = 16 +Constant (const byte) KEY_R#0 = 17 +Constant (const byte) KEY_D#0 = 18 +Constant (const byte) KEY_6#0 = 19 +Constant (const byte) KEY_C#0 = 20 +Constant (const byte) KEY_F#0 = 21 +Constant (const byte) KEY_T#0 = 22 +Constant (const byte) KEY_X#0 = 23 +Constant (const byte) KEY_7#0 = 24 +Constant (const byte) KEY_Y#0 = 25 +Constant (const byte) KEY_G#0 = 26 +Constant (const byte) KEY_8#0 = 27 +Constant (const byte) KEY_B#0 = 28 +Constant (const byte) KEY_H#0 = 29 +Constant (const byte) KEY_U#0 = 30 +Constant (const byte) KEY_V#0 = 31 +Constant (const byte) KEY_9#0 = 32 +Constant (const byte) KEY_I#0 = 33 +Constant (const byte) KEY_J#0 = 34 +Constant (const byte) KEY_0#0 = 35 +Constant (const byte) KEY_M#0 = 36 +Constant (const byte) KEY_K#0 = 37 +Constant (const byte) KEY_O#0 = 38 +Constant (const byte) KEY_N#0 = 39 +Constant (const byte) KEY_PLUS#0 = 40 +Constant (const byte) KEY_P#0 = 41 +Constant (const byte) KEY_L#0 = 42 +Constant (const byte) KEY_MINUS#0 = 43 +Constant (const byte) KEY_DOT#0 = 44 +Constant (const byte) KEY_COLON#0 = 45 +Constant (const byte) KEY_AT#0 = 46 +Constant (const byte) KEY_COMMA#0 = 47 +Constant (const byte) KEY_POUND#0 = 48 +Constant (const byte) KEY_ASTERISK#0 = 49 +Constant (const byte) KEY_SEMICOLON#0 = 50 +Constant (const byte) KEY_HOME#0 = 51 +Constant (const byte) KEY_RSHIFT#0 = 52 +Constant (const byte) KEY_EQUALS#0 = 53 +Constant (const byte) KEY_ARROW_UP#0 = 54 +Constant (const byte) KEY_SLASH#0 = 55 +Constant (const byte) KEY_1#0 = 56 +Constant (const byte) KEY_ARROW_LEFT#0 = 57 +Constant (const byte) KEY_CTRL#0 = 58 +Constant (const byte) KEY_2#0 = 59 +Constant (const byte) KEY_SPACE#0 = 60 +Constant (const byte) KEY_COMMODORE#0 = 61 +Constant (const byte) KEY_Q#0 = 62 +Constant (const byte) KEY_RUNSTOP#0 = 63 +Constant (const byte[8]) keyboard_matrix_row_bitmask#0 = { 254, 253, 251, 247, 239, 223, 191, 127 } +Constant (const byte[8]) keyboard_matrix_col_bitmask#0 = { 1, 2, 4, 8, 16, 32, 64, 128 } +Constant (const byte[8]) keyboard_events#0 = { fill( 8, 0) } +Constant (const byte) keyboard_events_size#0 = 0 +Constant (const byte) keyboard_modifiers#0 = 0 +Constant (const byte) KEY_MODIFIER_LSHIFT#0 = 1 +Constant (const byte) KEY_MODIFIER_RSHIFT#0 = 2 +Constant (const byte) KEY_MODIFIER_CTRL#0 = 4 +Constant (const byte) KEY_MODIFIER_COMMODORE#0 = 8 +Constant (const byte[8]) keyboard_scan_values#0 = { fill( 8, 0) } +Constant (const word) mul8u::res#0 = 0 +Constant (const byte*) screen#0 = ((byte*))1024 +Constant (const byte*) charset#0 = ((byte*))8192 +Constant (const byte*) tileset#0 = ((byte*))10240 +Constant (const byte*) colors#0 = ((byte*))55296 +Constant (const byte*) level_address#0 = ((byte*))12288 +Constant (const byte) main::x#0 = 0 +Constant (const byte) main::y#0 = 0 +Constant (const word) fill::size#0 = 1000 +Constant (const byte) fill::val#0 = 0 +Constant (const word) fill::size#1 = 1000 +Constant (const byte) mul8u::b#0 = 40 +Successful SSA optimization Pass2ConstantIdentification +Constant (const byte[]) keyboard_char_keycodes#0 = { KEY_AT#0, KEY_A#0, KEY_B#0, KEY_C#0, KEY_D#0, KEY_E#0, KEY_F#0, KEY_G#0, KEY_H#0, KEY_I#0, KEY_J#0, KEY_K#0, KEY_L#0, KEY_M#0, KEY_N#0, KEY_O#0, KEY_P#0, KEY_Q#0, KEY_R#0, KEY_S#0, KEY_T#0, KEY_U#0, KEY_V#0, KEY_W#0, KEY_X#0, KEY_Y#0, KEY_Z#0, 63, KEY_POUND#0, 63, KEY_ARROW_UP#0, KEY_ARROW_LEFT#0, KEY_SPACE#0, 63, 63, 63, 63, 63, 63, 63, 63, 63, KEY_ASTERISK#0, KEY_PLUS#0, KEY_COMMA#0, KEY_MINUS#0, KEY_DOT#0, KEY_SLASH#0, KEY_0#0, KEY_1#0, KEY_2#0, KEY_3#0, KEY_4#0, KEY_5#0, KEY_6#0, KEY_7#0, KEY_8#0, KEY_9#0, KEY_COLON#0, KEY_SEMICOLON#0, 63, KEY_EQUALS#0, 63, 63 } +Constant (const byte) KEY_MODIFIER_SHIFT#0 = KEY_MODIFIER_LSHIFT#0|KEY_MODIFIER_RSHIFT#0 +Constant (const word) mul8u::mb#0 = ((word))mul8u::b#0 +Constant (const byte) draw_block::color#0 = YELLOW#0 +Constant (const byte*) fill::start#0 = screen#0 +Constant (const byte*) fill::start#1 = colors#0 +Constant (const byte) fill::val#1 = BLACK#0 +Constant (const byte*) init::toD0181_screen#0 = screen#0 +Constant (const byte*) init::toD0181_gfx#0 = charset#0 +Successful SSA optimization Pass2ConstantIdentification +Constant (const word) init::toD0181_$0#0 = ((word))init::toD0181_screen#0 +Constant (const word) init::toD0181_$4#0 = ((word))init::toD0181_gfx#0 +Successful SSA optimization Pass2ConstantIdentification +Constant (const word) init::toD0181_$1#0 = init::toD0181_$0#0&16383 +Constant (const byte) init::toD0181_$5#0 = >init::toD0181_$4#0 +Successful SSA optimization Pass2ConstantIdentification +Constant (const word) init::toD0181_$2#0 = init::toD0181_$1#0<<2 +Constant (const byte) init::toD0181_$6#0 = init::toD0181_$5#0>>2 +Successful SSA optimization Pass2ConstantIdentification +Constant (const byte) init::toD0181_$3#0 = >init::toD0181_$2#0 +Constant (const byte) init::toD0181_$7#0 = init::toD0181_$6#0&15 +Successful SSA optimization Pass2ConstantIdentification +Constant (const byte) init::toD0181_return#0 = init::toD0181_$3#0|init::toD0181_$7#0 +Successful SSA optimization Pass2ConstantIdentification +Consolidated array index constant in assignment *(screen#0+1 + draw_block::$5) +Consolidated array index constant in assignment *(colors#0+1 + draw_block::$6) +Consolidated array index constant in assignment *(screen#0+40 + draw_block::$7) +Consolidated array index constant in assignment *(colors#0+40 + draw_block::$8) +Consolidated array index constant in assignment *(screen#0+41 + draw_block::$9) +Consolidated array index constant in assignment *(colors#0+41 + draw_block::$10) +Successful SSA optimization Pass2ConstantAdditionElimination +if() condition always true - replacing block destination if(true) goto main::@3 +Successful SSA optimization Pass2ConstantIfs +Inferred type updated to word in (word/signed dword/dword~) draw_block::$5 ← (word) draw_block::z#1 +Inferred type updated to word in (word/signed dword/dword~) draw_block::$6 ← (word) draw_block::z#1 +Inferred type updated to word in (word/signed dword/dword~) draw_block::$7 ← (word) draw_block::z#1 +Inferred type updated to word in (word/signed dword/dword~) draw_block::$8 ← (word) draw_block::z#1 +Inferred type updated to word in (word/signed dword/dword~) draw_block::$9 ← (word) draw_block::z#1 +Inferred type updated to word in (word/signed dword/dword~) draw_block::$10 ← (word) draw_block::z#1 +Successful SSA optimization PassNEliminateUnusedVars +Successful SSA optimization PassNEliminateUnusedVars +Removing unused block main::@return +Successful SSA optimization Pass2EliminateUnusedBlocks +Culled Empty Block (label) @4 +Culled Empty Block (label) @8 +Culled Empty Block (label) mul8u::@3 +Culled Empty Block (label) @17 +Culled Empty Block (label) main::@7 +Culled Empty Block (label) init::@4 +Culled Empty Block (label) init::toD0181_@return +Successful SSA optimization Pass2CullEmptyBlocks +Alias (word) draw_block::z#1 = (word~) draw_block::$5 (word~) draw_block::$6 (word~) draw_block::$7 (word~) draw_block::$8 (word~) draw_block::$9 (word~) draw_block::$10 +Successful SSA optimization Pass2AliasElimination +Inlining constant with var siblings (const word) fill::size#0 +Inlining constant with var siblings (const byte) fill::val#0 +Inlining constant with var siblings (const word) fill::size#1 +Inlining constant with var siblings (const byte) fill::val#1 +Inlining constant with var siblings (const word) mul8u::res#0 +Inlining constant with var siblings (const word) mul8u::mb#0 +Inlining constant with var siblings (const byte) main::x#0 +Inlining constant with var siblings (const byte) main::y#0 +Constant inlined init::toD0181_gfx#0 = (const byte*) charset#0 +Constant inlined fill::val#0 = (byte/signed byte/word/signed word/dword/signed dword) 0 +Constant inlined init::toD0181_$0#0 = ((word))(const byte*) screen#0 +Constant inlined mul8u::mb#0 = ((word))(const byte) mul8u::b#0 +Constant inlined init::toD0181_$2#0 = ((word))(const byte*) screen#0&(word/signed word/dword/signed dword) 16383<<(byte/signed byte/word/signed word/dword/signed dword) 2 +Constant inlined init::toD0181_$1#0 = ((word))(const byte*) screen#0&(word/signed word/dword/signed dword) 16383 +Constant inlined fill::val#1 = (const byte) BLACK#0 +Constant inlined init::toD0181_$4#0 = ((word))(const byte*) charset#0 +Constant inlined init::toD0181_$3#0 = >((word))(const byte*) screen#0&(word/signed word/dword/signed dword) 16383<<(byte/signed byte/word/signed word/dword/signed dword) 2 +Constant inlined fill::size#1 = (word/signed word/dword/signed dword) 1000 +Constant inlined init::toD0181_$6#0 = >((word))(const byte*) charset#0>>(byte/signed byte/word/signed word/dword/signed dword) 2 +Constant inlined fill::size#0 = (word/signed word/dword/signed dword) 1000 +Constant inlined main::x#0 = (byte/signed byte/word/signed word/dword/signed dword) 0 +Constant inlined init::toD0181_$5#0 = >((word))(const byte*) charset#0 +Constant inlined main::y#0 = (byte/signed byte/word/signed word/dword/signed dword) 0 +Constant inlined init::toD0181_$7#0 = >((word))(const byte*) charset#0>>(byte/signed byte/word/signed word/dword/signed dword) 2&(byte/signed byte/word/signed word/dword/signed dword) 15 +Constant inlined mul8u::res#0 = (byte/signed byte/word/signed word/dword/signed dword) 0 +Constant inlined fill::start#1 = (const byte*) colors#0 +Constant inlined fill::start#0 = (const byte*) screen#0 +Constant inlined init::toD0181_screen#0 = (const byte*) screen#0 +Successful SSA optimization Pass2ConstantInlining +Identical Phi Values (word) fill::size#2 (word/signed word/dword/signed dword) 1000 +Successful SSA optimization Pass2IdenticalPhiElimination +Added new block during phi lifting main::@9(between main::@4 and main::@1) +Added new block during phi lifting main::@10(between main::@8 and main::@2) +Added new block during phi lifting mul8u::@10(between mul8u::@2 and mul8u::@4) +Added new block during phi lifting fill::@3(between fill::@1 and fill::@1) +Adding NOP phi() at start of @begin +Adding NOP phi() at start of @21 +Adding NOP phi() at start of @end +Adding NOP phi() at start of main +Adding NOP phi() at start of main::@3 +Adding NOP phi() at start of init +Adding NOP phi() at start of init::@2 +Adding NOP phi() at start of init::@3 +Adding NOP phi() at start of init::toD0181 +CALL GRAPH +Calls in [] to main:2 +Calls in [main] to init:5 draw_block:13 +Calls in [draw_block] to mul8u:26 +Calls in [init] to init_sprites:56 fill:58 fill:60 + +Created 9 initial phi equivalence classes +Coalesced [19] main::x#6 ← main::x#1 +Coalesced [20] main::y#4 ← main::y#1 +Coalesced [40] mul8u::a#7 ← mul8u::a#1 +Coalesced [47] mul8u::res#9 ← mul8u::res#1 +Coalesced [51] mul8u::a#8 ← mul8u::a#0 +Coalesced [52] mul8u::res#7 ← mul8u::res#6 +Coalesced [53] mul8u::mb#6 ← mul8u::mb#1 +Coalesced (already) [54] mul8u::res#8 ← mul8u::res#2 +Coalesced [72] fill::addr#3 ← fill::addr#0 +Coalesced [78] fill::addr#4 ← fill::addr#1 +Coalesced down to 7 phi equivalence classes +Culled Empty Block (label) main::@9 +Culled Empty Block (label) main::@10 +Culled Empty Block (label) mul8u::@10 +Culled Empty Block (label) fill::@3 +Adding NOP phi() at start of @begin +Adding NOP phi() at start of @21 +Adding NOP phi() at start of @end +Adding NOP phi() at start of main +Adding NOP phi() at start of main::@3 +Adding NOP phi() at start of mul8u +Adding NOP phi() at start of init +Adding NOP phi() at start of init::@2 +Adding NOP phi() at start of init::@3 +Adding NOP phi() at start of init::toD0181 + +FINAL CONTROL FLOW GRAPH +@begin: scope:[] from + [0] phi() + to:@21 +@21: scope:[] from @begin + [1] phi() + [2] call main + to:@end +@end: scope:[] from @21 + [3] phi() +main: scope:[main] from @21 + [4] phi() + [5] call init + to:main::@1 +main::@1: scope:[main] from main main::@4 + [6] (byte) main::x#4 ← phi( main::@4/(byte) main::x#1 main/(byte/signed byte/word/signed word/dword/signed dword) 0 ) + to:main::@2 +main::@2: scope:[main] from main::@1 main::@8 + [7] (byte) main::y#2 ← phi( main::@1/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@8/(byte) main::y#1 ) + [8] (byte) main::z#0 ← (byte) main::x#4 + (byte) main::y#2 + [9] (byte) main::tile#0 ← *((const byte*) level_address#0 + (byte) main::z#0) + [10] (byte) draw_block::tileno#0 ← (byte) main::tile#0 + [11] (byte) draw_block::x#0 ← (byte) main::x#4 + [12] (byte) draw_block::y#0 ← (byte) main::y#2 + [13] call draw_block + to:main::@8 +main::@8: scope:[main] from main::@2 + [14] (byte) main::y#1 ← ++ (byte) main::y#2 + [15] if((byte) main::y#1<(byte/signed byte/word/signed word/dword/signed dword) 9) goto main::@2 + to:main::@4 +main::@4: scope:[main] from main::@8 + [16] (byte) main::x#1 ← ++ (byte) main::x#4 + [17] if((byte) main::x#1<(byte/signed byte/word/signed word/dword/signed dword) 16) goto main::@1 + to:main::@3 +main::@3: scope:[main] from main::@3 main::@4 + [18] phi() + to:main::@3 +draw_block: scope:[draw_block] from main::@2 + [19] (byte) draw_block::tileno#1 ← (byte) draw_block::tileno#0 << (byte/signed byte/word/signed word/dword/signed dword) 2 + [20] (byte~) draw_block::$1 ← (byte) draw_block::x#0 << (byte/signed byte/word/signed word/dword/signed dword) 1 + [21] (word) draw_block::x1#0 ← ((word)) (byte~) draw_block::$1 + [22] (byte) draw_block::y#1 ← (byte) draw_block::y#0 << (byte/signed byte/word/signed word/dword/signed dword) 1 + [23] (byte) mul8u::a#1 ← (byte) draw_block::y#1 + [24] call mul8u + [25] (word) mul8u::return#2 ← (word) mul8u::res#2 + to:draw_block::@1 +draw_block::@1: scope:[draw_block] from draw_block + [26] (word) draw_block::z#0 ← (word) mul8u::return#2 + [27] (word) draw_block::z#1 ← (word) draw_block::z#0 + (word) draw_block::x1#0 + [28] (byte) draw_block::drawtile#0 ← *((const byte*) tileset#0 + (byte) draw_block::tileno#1) + [29] *((const byte*) screen#0 + (word) draw_block::z#1) ← (byte) draw_block::drawtile#0 + [30] *((const byte*) colors#0 + (word) draw_block::z#1) ← (const byte) YELLOW#0 + [31] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (word) draw_block::z#1) ← (byte/signed byte/word/signed word/dword/signed dword) 1 + [32] *((const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (word) draw_block::z#1) ← (const byte) YELLOW#0 + [33] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 40 + (word) draw_block::z#1) ← (byte/signed byte/word/signed word/dword/signed dword) 2 + [34] *((const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) 40 + (word) draw_block::z#1) ← (const byte) YELLOW#0 + [35] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 41 + (word) draw_block::z#1) ← (byte/signed byte/word/signed word/dword/signed dword) 3 + [36] *((const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) 41 + (word) draw_block::z#1) ← (const byte) YELLOW#0 + to:draw_block::@return +draw_block::@return: scope:[draw_block] from draw_block::@1 + [37] return + to:@return +mul8u: scope:[mul8u] from draw_block + [38] phi() + to:mul8u::@1 +mul8u::@1: scope:[mul8u] from mul8u mul8u::@4 + [39] (word) mul8u::mb#2 ← phi( mul8u/((word))(const byte) mul8u::b#0 mul8u::@4/(word) mul8u::mb#1 ) + [39] (word) mul8u::res#2 ← phi( mul8u/(byte/signed byte/word/signed word/dword/signed dword) 0 mul8u::@4/(word) mul8u::res#6 ) + [39] (byte) mul8u::a#2 ← phi( mul8u/(byte) mul8u::a#1 mul8u::@4/(byte) mul8u::a#0 ) + [40] if((byte) mul8u::a#2!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto mul8u::@2 + to:mul8u::@return +mul8u::@return: scope:[mul8u] from mul8u::@1 + [41] return + to:@return +mul8u::@2: scope:[mul8u] from mul8u::@1 + [42] (byte~) mul8u::$1 ← (byte) mul8u::a#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 + [43] if((byte~) mul8u::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto mul8u::@4 + to:mul8u::@7 +mul8u::@7: scope:[mul8u] from mul8u::@2 + [44] (word) mul8u::res#1 ← (word) mul8u::res#2 + (word) mul8u::mb#2 + to:mul8u::@4 +mul8u::@4: scope:[mul8u] from mul8u::@2 mul8u::@7 + [45] (word) mul8u::res#6 ← phi( mul8u::@2/(word) mul8u::res#2 mul8u::@7/(word) mul8u::res#1 ) + [46] (byte) mul8u::a#0 ← (byte) mul8u::a#2 >> (byte/signed byte/word/signed word/dword/signed dword) 1 + [47] (word) mul8u::mb#1 ← (word) mul8u::mb#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 + to:mul8u::@1 +init: scope:[init] from main + [48] phi() + [49] call init_sprites + to:init::@2 +init::@2: scope:[init] from init + [50] phi() + [51] call fill + to:init::@3 +init::@3: scope:[init] from init::@2 + [52] phi() + [53] call fill + to:init::toD0181 +init::toD0181: scope:[init] from init::@3 + [54] phi() + to:init::@1 +init::@1: scope:[init] from init::toD0181 + [55] *((const byte*) D018#0) ← (const byte) init::toD0181_return#0 + asm { lda#$5b sta$d011 } + [57] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 + [58] *((const byte*) BGCOL1#0) ← (const byte) BLACK#0 + [59] *((const byte*) BGCOL2#0) ← (const byte) RED#0 + [60] *((const byte*) BGCOL3#0) ← (const byte) BLUE#0 + [61] *((const byte*) BGCOL4#0) ← (const byte) GREEN#0 + to:init::@return +init::@return: scope:[init] from init::@1 + [62] return + to:@return +fill: scope:[fill] from init::@2 init::@3 + [63] (byte) fill::val#3 ← phi( init::@2/(byte/signed byte/word/signed word/dword/signed dword) 0 init::@3/(const byte) BLACK#0 ) + [63] (byte*) fill::addr#0 ← phi( init::@2/(const byte*) screen#0 init::@3/(const byte*) colors#0 ) + [64] (byte*) fill::end#0 ← (byte*) fill::addr#0 + (word/signed word/dword/signed dword) 1000 + to:fill::@1 +fill::@1: scope:[fill] from fill fill::@1 + [65] (byte*) fill::addr#2 ← phi( fill/(byte*) fill::addr#0 fill::@1/(byte*) fill::addr#1 ) + [66] *((byte*) fill::addr#2) ← (byte) fill::val#3 + [67] (byte*) fill::addr#1 ← ++ (byte*) fill::addr#2 + [68] if((byte*) fill::addr#1!=(byte*) fill::end#0) goto fill::@1 + to:fill::@return +fill::@return: scope:[fill] from fill::@1 + [69] return + to:@return +init_sprites: scope:[init_sprites] from init + [70] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 1 + [71] *((const byte*) SPRITES_EXPAND_X#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 + [72] *((const byte*) SPRITES_EXPAND_Y#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 + [73] *((const byte*) SPRITES_XMSB#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 + [74] *((const byte*) SPRITES_COLS#0) ← (const byte) WHITE#0 + [75] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 + to:init_sprites::@return +init_sprites::@return: scope:[init_sprites] from init_sprites + [76] return + to:@return + + +VARIABLE REGISTER WEIGHTS +(byte*) BGCOL +(byte*) BGCOL1 +(byte*) BGCOL2 +(byte*) BGCOL3 +(byte*) BGCOL4 +(byte) BLACK +(byte) BLUE +(byte*) BORDERCOL +(byte) BROWN +(byte*) CHARGEN +(byte*) CIA1_INTERRUPT +(byte*) CIA1_PORT_A +(byte*) CIA1_PORT_A_DDR +(byte*) CIA1_PORT_B +(byte*) CIA1_PORT_B_DDR +(byte*) CIA2_INTERRUPT +(byte*) CIA2_PORT_A +(byte*) CIA2_PORT_A_DDR +(byte*) CIA2_PORT_B +(byte*) CIA2_PORT_B_DDR +(byte) CIA_INTERRUPT_CLEAR +(byte*) COLS +(byte) CYAN +(byte*) D011 +(byte*) D016 +(byte*) D018 +(byte) DARK_GREY +(byte) GREEN +(byte) GREY +(void()**) HARDWARE_IRQ +(byte) IRQ_COLLISION_BG +(byte) IRQ_COLLISION_SPRITE +(byte*) IRQ_ENABLE +(byte) IRQ_LIGHTPEN +(byte) IRQ_RASTER +(byte*) IRQ_STATUS +(void()**) KERNEL_IRQ +(byte) KEY_0 +(byte) KEY_1 +(byte) KEY_2 +(byte) KEY_3 +(byte) KEY_4 +(byte) KEY_5 +(byte) KEY_6 +(byte) KEY_7 +(byte) KEY_8 +(byte) KEY_9 +(byte) KEY_A +(byte) KEY_ARROW_LEFT +(byte) KEY_ARROW_UP +(byte) KEY_ASTERISK +(byte) KEY_AT +(byte) KEY_B +(byte) KEY_C +(byte) KEY_COLON +(byte) KEY_COMMA +(byte) KEY_COMMODORE +(byte) KEY_CRSR_DOWN +(byte) KEY_CRSR_RIGHT +(byte) KEY_CTRL +(byte) KEY_D +(byte) KEY_DEL +(byte) KEY_DOT +(byte) KEY_E +(byte) KEY_EQUALS +(byte) KEY_F +(byte) KEY_F1 +(byte) KEY_F3 +(byte) KEY_F5 +(byte) KEY_F7 +(byte) KEY_G +(byte) KEY_H +(byte) KEY_HOME +(byte) KEY_I +(byte) KEY_J +(byte) KEY_K +(byte) KEY_L +(byte) KEY_LSHIFT +(byte) KEY_M +(byte) KEY_MINUS +(byte) KEY_MODIFIER_COMMODORE +(byte) KEY_MODIFIER_CTRL +(byte) KEY_MODIFIER_LSHIFT +(byte) KEY_MODIFIER_RSHIFT +(byte) KEY_MODIFIER_SHIFT +(byte) KEY_N +(byte) KEY_O +(byte) KEY_P +(byte) KEY_PLUS +(byte) KEY_POUND +(byte) KEY_Q +(byte) KEY_R +(byte) KEY_RETURN +(byte) KEY_RSHIFT +(byte) KEY_RUNSTOP +(byte) KEY_S +(byte) KEY_SEMICOLON +(byte) KEY_SLASH +(byte) KEY_SPACE +(byte) KEY_T +(byte) KEY_U +(byte) KEY_V +(byte) KEY_W +(byte) KEY_X +(byte) KEY_Y +(byte) KEY_Z +(byte*) LIGHTPEN_X +(byte*) LIGHTPEN_Y +(byte) LIGHT_BLUE +(byte) LIGHT_GREEN +(byte) LIGHT_GREY +(byte) ORANGE +(byte) PINK +(byte*) PROCPORT +(byte) PROCPORT_BASIC_KERNEL_IO +(byte*) PROCPORT_DDR +(byte) PROCPORT_DDR_MEMORY_MASK +(byte) PROCPORT_KERNEL_IO +(byte) PROCPORT_RAM_ALL +(byte) PROCPORT_RAM_CHARROM +(byte) PROCPORT_RAM_IO +(byte) PURPLE +(byte*) RASTER +(byte) RED +(byte*) SPRITES_COLS +(byte*) SPRITES_ENABLE +(byte*) SPRITES_EXPAND_X +(byte*) SPRITES_EXPAND_Y +(byte*) SPRITES_MC +(byte*) SPRITES_MC1 +(byte*) SPRITES_MC2 +(byte*) SPRITES_PRIORITY +(byte*) SPRITES_XMSB +(byte*) SPRITES_XPOS +(byte*) SPRITES_YPOS +(word) SPRITE_PTRS +(byte) VIC_BMM +(byte*) VIC_CONTROL +(byte*) VIC_CONTROL2 +(byte) VIC_CSEL +(byte) VIC_DEN +(byte) VIC_ECM +(byte) VIC_MCM +(byte*) VIC_MEMORY +(byte) VIC_RSEL +(byte) VIC_RST8 +(byte) WHITE +(byte) YELLOW +(byte*) charset +(byte*) colors +(void()) draw_block((byte) draw_block::tileno , (byte) draw_block::x , (byte) draw_block::y , (byte) draw_block::color) +(byte~) draw_block::$1 4.0 +(byte) draw_block::color +(byte) draw_block::drawtile +(byte) draw_block::drawtile#0 4.0 +(byte) draw_block::tileno +(byte) draw_block::tileno#0 34.33333333333333 +(byte) draw_block::tileno#1 0.4444444444444444 +(byte) draw_block::x +(byte) draw_block::x#0 34.33333333333333 +(word) draw_block::x1 +(word) draw_block::x1#0 0.6666666666666666 +(byte) draw_block::y +(byte) draw_block::y#0 25.75 +(byte) draw_block::y#1 4.0 +(word) draw_block::z +(word) draw_block::z#0 4.0 +(word) draw_block::z#1 2.0000000000000004 +(void()) fill((byte*) fill::start , (word) fill::size , (byte) fill::val) +(byte*) fill::addr +(byte*) fill::addr#0 2.0 +(byte*) fill::addr#1 16.5 +(byte*) fill::addr#2 17.5 +(byte*) fill::end +(byte*) fill::end#0 2.6 +(word) fill::size +(byte*) fill::start +(byte) fill::val +(byte) fill::val#3 1.8333333333333333 +(void()) init() +(word~) init::toD0181_$0 +(word~) init::toD0181_$1 +(word~) init::toD0181_$2 +(byte~) init::toD0181_$3 +(word~) init::toD0181_$4 +(byte~) init::toD0181_$5 +(byte~) init::toD0181_$6 +(byte~) init::toD0181_$7 +(byte~) init::toD0181_$8 +(byte*) init::toD0181_gfx +(byte) init::toD0181_return +(byte*) init::toD0181_screen +(void()) init_sprites() +(byte[]) keyboard_char_keycodes +(byte[8]) keyboard_events +(byte) keyboard_events_size +(byte[8]) keyboard_matrix_col_bitmask +(byte[8]) keyboard_matrix_row_bitmask +(byte) keyboard_modifiers +(byte[8]) keyboard_scan_values +(byte*) level_address +(void()) main() +(byte) main::tile +(byte) main::tile#0 202.0 +(byte) main::x +(byte) main::x#1 16.5 +(byte) main::x#4 22.4 +(byte) main::y +(byte) main::y#1 151.5 +(byte) main::y#2 57.714285714285715 +(byte) main::z +(byte) main::z#0 202.0 +(word()) mul8u((byte) mul8u::a , (byte) mul8u::b) +(byte~) mul8u::$1 2002.0 +(byte) mul8u::a +(byte) mul8u::a#0 1001.0 +(byte) mul8u::a#1 2.0 +(byte) mul8u::a#2 667.6666666666667 +(byte) mul8u::b +(word) mul8u::mb +(word) mul8u::mb#1 2002.0 +(word) mul8u::mb#2 429.0 +(word) mul8u::res +(word) mul8u::res#1 2002.0 +(word) mul8u::res#2 500.83333333333337 +(word) mul8u::res#6 1001.0 +(word) mul8u::return +(word) mul8u::return#2 4.0 +(byte*) screen +(byte*) tileset + +Initial phi equivalence classes +[ main::x#4 main::x#1 ] +[ main::y#2 main::y#1 ] +[ mul8u::a#2 mul8u::a#1 mul8u::a#0 ] +[ mul8u::res#2 mul8u::res#6 mul8u::res#1 ] +[ mul8u::mb#2 mul8u::mb#1 ] +[ fill::val#3 ] +[ fill::addr#2 fill::addr#0 fill::addr#1 ] +Added variable main::z#0 to zero page equivalence class [ main::z#0 ] +Added variable main::tile#0 to zero page equivalence class [ main::tile#0 ] +Added variable draw_block::tileno#0 to zero page equivalence class [ draw_block::tileno#0 ] +Added variable draw_block::x#0 to zero page equivalence class [ draw_block::x#0 ] +Added variable draw_block::y#0 to zero page equivalence class [ draw_block::y#0 ] +Added variable draw_block::tileno#1 to zero page equivalence class [ draw_block::tileno#1 ] +Added variable draw_block::$1 to zero page equivalence class [ draw_block::$1 ] +Added variable draw_block::x1#0 to zero page equivalence class [ draw_block::x1#0 ] +Added variable draw_block::y#1 to zero page equivalence class [ draw_block::y#1 ] +Added variable mul8u::return#2 to zero page equivalence class [ mul8u::return#2 ] +Added variable draw_block::z#0 to zero page equivalence class [ draw_block::z#0 ] +Added variable draw_block::z#1 to zero page equivalence class [ draw_block::z#1 ] +Added variable draw_block::drawtile#0 to zero page equivalence class [ draw_block::drawtile#0 ] +Added variable mul8u::$1 to zero page equivalence class [ mul8u::$1 ] +Added variable fill::end#0 to zero page equivalence class [ fill::end#0 ] +Complete equivalence classes +[ main::x#4 main::x#1 ] +[ main::y#2 main::y#1 ] +[ mul8u::a#2 mul8u::a#1 mul8u::a#0 ] +[ mul8u::res#2 mul8u::res#6 mul8u::res#1 ] +[ mul8u::mb#2 mul8u::mb#1 ] +[ fill::val#3 ] +[ fill::addr#2 fill::addr#0 fill::addr#1 ] +[ main::z#0 ] +[ main::tile#0 ] +[ draw_block::tileno#0 ] +[ draw_block::x#0 ] +[ draw_block::y#0 ] +[ draw_block::tileno#1 ] +[ draw_block::$1 ] +[ draw_block::x1#0 ] +[ draw_block::y#1 ] +[ mul8u::return#2 ] +[ draw_block::z#0 ] +[ draw_block::z#1 ] +[ draw_block::drawtile#0 ] +[ mul8u::$1 ] +[ fill::end#0 ] +Allocated zp ZP_BYTE:2 [ main::x#4 main::x#1 ] +Allocated zp ZP_BYTE:3 [ main::y#2 main::y#1 ] +Allocated zp ZP_BYTE:4 [ mul8u::a#2 mul8u::a#1 mul8u::a#0 ] +Allocated zp ZP_WORD:5 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 ] +Allocated zp ZP_WORD:7 [ mul8u::mb#2 mul8u::mb#1 ] +Allocated zp ZP_BYTE:9 [ fill::val#3 ] +Allocated zp ZP_WORD:10 [ fill::addr#2 fill::addr#0 fill::addr#1 ] +Allocated zp ZP_BYTE:12 [ main::z#0 ] +Allocated zp ZP_BYTE:13 [ main::tile#0 ] +Allocated zp ZP_BYTE:14 [ draw_block::tileno#0 ] +Allocated zp ZP_BYTE:15 [ draw_block::x#0 ] +Allocated zp ZP_BYTE:16 [ draw_block::y#0 ] +Allocated zp ZP_BYTE:17 [ draw_block::tileno#1 ] +Allocated zp ZP_BYTE:18 [ draw_block::$1 ] +Allocated zp ZP_WORD:19 [ draw_block::x1#0 ] +Allocated zp ZP_BYTE:21 [ draw_block::y#1 ] +Allocated zp ZP_WORD:22 [ mul8u::return#2 ] +Allocated zp ZP_WORD:24 [ draw_block::z#0 ] +Allocated zp ZP_WORD:26 [ draw_block::z#1 ] +Allocated zp ZP_BYTE:28 [ draw_block::drawtile#0 ] +Allocated zp ZP_BYTE:29 [ mul8u::$1 ] +Allocated zp ZP_WORD:30 [ fill::end#0 ] + +INITIAL ASM +//SEG0 Basic Upstart +.pc = $801 "Basic" +:BasicUpstart(bbegin) +.pc = $80d "Program" +//SEG1 Global Constants & labels + .label SPRITES_XMSB = $d010 + .label SPRITES_ENABLE = $d015 + .label SPRITES_EXPAND_Y = $d017 + .label SPRITES_MC = $d01c + .label SPRITES_EXPAND_X = $d01d + .label BORDERCOL = $d020 + .label BGCOL1 = $d021 + .label BGCOL2 = $d022 + .label BGCOL3 = $d023 + .label BGCOL4 = $d024 + .label SPRITES_COLS = $d027 + .label D018 = $d018 + .const BLACK = 0 + .const WHITE = 1 + .const RED = 2 + .const GREEN = 5 + .const BLUE = 6 + .const YELLOW = 7 + .label screen = $400 + .label charset = $2000 + .label tileset = $2800 + .label colors = $d800 + .label level_address = $3000 +//SEG2 @begin +bbegin: +//SEG3 [1] phi from @begin to @21 [phi:@begin->@21] +b21_from_bbegin: + jmp b21 +//SEG4 @21 +b21: +//SEG5 [2] call main +//SEG6 [4] phi from @21 to main [phi:@21->main] +main_from_b21: + jsr main +//SEG7 [3] phi from @21 to @end [phi:@21->@end] +bend_from_b21: + jmp bend +//SEG8 @end +bend: +//SEG9 main +main: { + .label z = $c + .label tile = $d + .label y = 3 + .label x = 2 + //SEG10 [5] call init + //SEG11 [48] phi from main to init [phi:main->init] + init_from_main: + jsr init + //SEG12 [6] phi from main to main::@1 [phi:main->main::@1] + b1_from_main: + //SEG13 [6] phi (byte) main::x#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1 + lda #0 + sta x + jmp b1 + //SEG14 [6] phi from main::@4 to main::@1 [phi:main::@4->main::@1] + b1_from_b4: + //SEG15 [6] phi (byte) main::x#4 = (byte) main::x#1 [phi:main::@4->main::@1#0] -- register_copy + jmp b1 + //SEG16 main::@1 + b1: + //SEG17 [7] phi from main::@1 to main::@2 [phi:main::@1->main::@2] + b2_from_b1: + //SEG18 [7] phi (byte) main::y#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@1->main::@2#0] -- vbuz1=vbuc1 + lda #0 + sta y + jmp b2 + //SEG19 [7] phi from main::@8 to main::@2 [phi:main::@8->main::@2] + b2_from_b8: + //SEG20 [7] phi (byte) main::y#2 = (byte) main::y#1 [phi:main::@8->main::@2#0] -- register_copy + jmp b2 + //SEG21 main::@2 + b2: + //SEG22 [8] (byte) main::z#0 ← (byte) main::x#4 + (byte) main::y#2 -- vbuz1=vbuz2_plus_vbuz3 + lda x + clc + adc y + sta z + //SEG23 [9] (byte) main::tile#0 ← *((const byte*) level_address#0 + (byte) main::z#0) -- vbuz1=pbuc1_derefidx_vbuz2 + ldy z + lda level_address,y + sta tile + //SEG24 [10] (byte) draw_block::tileno#0 ← (byte) main::tile#0 -- vbuz1=vbuz2 + lda tile + sta draw_block.tileno + //SEG25 [11] (byte) draw_block::x#0 ← (byte) main::x#4 -- vbuz1=vbuz2 + lda x + sta draw_block.x + //SEG26 [12] (byte) draw_block::y#0 ← (byte) main::y#2 -- vbuz1=vbuz2 + lda y + sta draw_block.y + //SEG27 [13] call draw_block + jsr draw_block + jmp b8 + //SEG28 main::@8 + b8: + //SEG29 [14] (byte) main::y#1 ← ++ (byte) main::y#2 -- vbuz1=_inc_vbuz1 + inc y + //SEG30 [15] if((byte) main::y#1<(byte/signed byte/word/signed word/dword/signed dword) 9) goto main::@2 -- vbuz1_lt_vbuc1_then_la1 + lda y + cmp #9 + bcc b2_from_b8 + jmp b4 + //SEG31 main::@4 + b4: + //SEG32 [16] (byte) main::x#1 ← ++ (byte) main::x#4 -- vbuz1=_inc_vbuz1 + inc x + //SEG33 [17] if((byte) main::x#1<(byte/signed byte/word/signed word/dword/signed dword) 16) goto main::@1 -- vbuz1_lt_vbuc1_then_la1 + lda x + cmp #$10 + bcc b1_from_b4 + //SEG34 [18] phi from main::@3 main::@4 to main::@3 [phi:main::@3/main::@4->main::@3] + b3_from_b3: + b3_from_b4: + jmp b3 + //SEG35 main::@3 + b3: + jmp b3_from_b3 +} +//SEG36 draw_block +draw_block: { + .label _1 = $12 + .label tileno = $e + .label x = $f + .label y = $10 + .label tileno_1 = $11 + .label x1 = $13 + .label y_1 = $15 + .label z = $18 + .label z_1 = $1a + .label drawtile = $1c + //SEG37 [19] (byte) draw_block::tileno#1 ← (byte) draw_block::tileno#0 << (byte/signed byte/word/signed word/dword/signed dword) 2 -- vbuz1=vbuz2_rol_2 + lda tileno + asl + asl + sta tileno_1 + //SEG38 [20] (byte~) draw_block::$1 ← (byte) draw_block::x#0 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz2_rol_1 + lda x + asl + sta _1 + //SEG39 [21] (word) draw_block::x1#0 ← ((word)) (byte~) draw_block::$1 -- vwuz1=_word_vbuz2 + lda _1 + sta x1 + lda #0 + sta x1+1 + //SEG40 [22] (byte) draw_block::y#1 ← (byte) draw_block::y#0 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz2_rol_1 + lda y + asl + sta y_1 + //SEG41 [23] (byte) mul8u::a#1 ← (byte) draw_block::y#1 -- vbuz1=vbuz2 + lda y_1 + sta mul8u.a + //SEG42 [24] call mul8u + //SEG43 [38] phi from draw_block to mul8u [phi:draw_block->mul8u] + mul8u_from_draw_block: + jsr mul8u + //SEG44 [25] (word) mul8u::return#2 ← (word) mul8u::res#2 -- vwuz1=vwuz2 + lda mul8u.res + sta mul8u.return + lda mul8u.res+1 + sta mul8u.return+1 + jmp b1 + //SEG45 draw_block::@1 + b1: + //SEG46 [26] (word) draw_block::z#0 ← (word) mul8u::return#2 -- vwuz1=vwuz2 + lda mul8u.return + sta z + lda mul8u.return+1 + sta z+1 + //SEG47 [27] (word) draw_block::z#1 ← (word) draw_block::z#0 + (word) draw_block::x1#0 -- vwuz1=vwuz2_plus_vwuz3 + lda z + clc + adc x1 + sta z_1 + lda z+1 + adc x1+1 + sta z_1+1 + //SEG48 [28] (byte) draw_block::drawtile#0 ← *((const byte*) tileset#0 + (byte) draw_block::tileno#1) -- vbuz1=pbuc1_derefidx_vbuz2 + ldy tileno_1 + lda tileset,y + sta drawtile + //SEG49 [29] *((const byte*) screen#0 + (word) draw_block::z#1) ← (byte) draw_block::drawtile#0 -- pbuc1_derefidx_vwuz1=vbuz2 + lda drawtile + sta !v++1 + lda #screen + adc z_1+1 + sta !a++2 + !v: + lda #0 + !a: + sta screen + //SEG50 [30] *((const byte*) colors#0 + (word) draw_block::z#1) ← (const byte) YELLOW#0 -- pbuc1_derefidx_vwuz1=vbuc2 + lda #colors + adc z_1+1 + sta !++2 + lda #YELLOW + !: + sta colors + //SEG51 [31] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (word) draw_block::z#1) ← (byte/signed byte/word/signed word/dword/signed dword) 1 -- pbuc1_derefidx_vwuz1=vbuc2 + lda #screen+1 + adc z_1+1 + sta !++2 + lda #1 + !: + sta screen+1 + //SEG52 [32] *((const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (word) draw_block::z#1) ← (const byte) YELLOW#0 -- pbuc1_derefidx_vwuz1=vbuc2 + lda #colors+1 + adc z_1+1 + sta !++2 + lda #YELLOW + !: + sta colors+1 + //SEG53 [33] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 40 + (word) draw_block::z#1) ← (byte/signed byte/word/signed word/dword/signed dword) 2 -- pbuc1_derefidx_vwuz1=vbuc2 + lda #screen+$28 + adc z_1+1 + sta !++2 + lda #2 + !: + sta screen+$28 + //SEG54 [34] *((const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) 40 + (word) draw_block::z#1) ← (const byte) YELLOW#0 -- pbuc1_derefidx_vwuz1=vbuc2 + lda #colors+$28 + adc z_1+1 + sta !++2 + lda #YELLOW + !: + sta colors+$28 + //SEG55 [35] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 41 + (word) draw_block::z#1) ← (byte/signed byte/word/signed word/dword/signed dword) 3 -- pbuc1_derefidx_vwuz1=vbuc2 + lda #screen+$29 + adc z_1+1 + sta !++2 + lda #3 + !: + sta screen+$29 + //SEG56 [36] *((const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) 41 + (word) draw_block::z#1) ← (const byte) YELLOW#0 -- pbuc1_derefidx_vwuz1=vbuc2 + lda #colors+$29 + adc z_1+1 + sta !++2 + lda #YELLOW + !: + sta colors+$29 + jmp breturn + //SEG57 draw_block::@return + breturn: + //SEG58 [37] return + rts +} +//SEG59 mul8u +mul8u: { + .const b = $28 + .label _1 = $1d + .label a = 4 + .label mb = 7 + .label res = 5 + .label return = $16 + //SEG60 [39] phi from mul8u to mul8u::@1 [phi:mul8u->mul8u::@1] + b1_from_mul8u: + //SEG61 [39] phi (word) mul8u::mb#2 = ((word))(const byte) mul8u::b#0 [phi:mul8u->mul8u::@1#0] -- vwuz1=vbuc1 + lda #b + sta mb+1 + //SEG62 [39] phi (word) mul8u::res#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:mul8u->mul8u::@1#1] -- vwuz1=vbuc1 + lda #<0 + sta res + lda #>0 + sta res+1 + //SEG63 [39] phi (byte) mul8u::a#2 = (byte) mul8u::a#1 [phi:mul8u->mul8u::@1#2] -- register_copy + jmp b1 + //SEG64 mul8u::@1 + b1: + //SEG65 [40] if((byte) mul8u::a#2!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto mul8u::@2 -- vbuz1_neq_0_then_la1 + lda a + cmp #0 + bne b2 + jmp breturn + //SEG66 mul8u::@return + breturn: + //SEG67 [41] return + rts + //SEG68 mul8u::@2 + b2: + //SEG69 [42] (byte~) mul8u::$1 ← (byte) mul8u::a#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz2_band_vbuc1 + lda #1 + and a + sta _1 + //SEG70 [43] if((byte~) mul8u::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto mul8u::@4 -- vbuz1_eq_0_then_la1 + lda _1 + cmp #0 + beq b4_from_b2 + jmp b7 + //SEG71 mul8u::@7 + b7: + //SEG72 [44] (word) mul8u::res#1 ← (word) mul8u::res#2 + (word) mul8u::mb#2 -- vwuz1=vwuz1_plus_vwuz2 + lda res + clc + adc mb + sta res + lda res+1 + adc mb+1 + sta res+1 + //SEG73 [45] phi from mul8u::@2 mul8u::@7 to mul8u::@4 [phi:mul8u::@2/mul8u::@7->mul8u::@4] + b4_from_b2: + b4_from_b7: + //SEG74 [45] phi (word) mul8u::res#6 = (word) mul8u::res#2 [phi:mul8u::@2/mul8u::@7->mul8u::@4#0] -- register_copy + jmp b4 + //SEG75 mul8u::@4 + b4: + //SEG76 [46] (byte) mul8u::a#0 ← (byte) mul8u::a#2 >> (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz1_ror_1 + lsr a + //SEG77 [47] (word) mul8u::mb#1 ← (word) mul8u::mb#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vwuz1=vwuz1_rol_1 + asl mb + rol mb+1 + //SEG78 [39] phi from mul8u::@4 to mul8u::@1 [phi:mul8u::@4->mul8u::@1] + b1_from_b4: + //SEG79 [39] phi (word) mul8u::mb#2 = (word) mul8u::mb#1 [phi:mul8u::@4->mul8u::@1#0] -- register_copy + //SEG80 [39] phi (word) mul8u::res#2 = (word) mul8u::res#6 [phi:mul8u::@4->mul8u::@1#1] -- register_copy + //SEG81 [39] phi (byte) mul8u::a#2 = (byte) mul8u::a#0 [phi:mul8u::@4->mul8u::@1#2] -- register_copy + jmp b1 +} +//SEG82 init +init: { + .const toD0181_return = (>(screen&$3fff)<<2)|(>charset)>>2&$f + //SEG83 [49] call init_sprites + jsr init_sprites + //SEG84 [50] phi from init to init::@2 [phi:init->init::@2] + b2_from_init: + jmp b2 + //SEG85 init::@2 + b2: + //SEG86 [51] call fill + //SEG87 [63] phi from init::@2 to fill [phi:init::@2->fill] + fill_from_b2: + //SEG88 [63] phi (byte) fill::val#3 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:init::@2->fill#0] -- vbuz1=vbuc1 + lda #0 + sta fill.val + //SEG89 [63] phi (byte*) fill::addr#0 = (const byte*) screen#0 [phi:init::@2->fill#1] -- pbuz1=pbuc1 + lda #screen + sta fill.addr+1 + jsr fill + //SEG90 [52] phi from init::@2 to init::@3 [phi:init::@2->init::@3] + b3_from_b2: + jmp b3 + //SEG91 init::@3 + b3: + //SEG92 [53] call fill + //SEG93 [63] phi from init::@3 to fill [phi:init::@3->fill] + fill_from_b3: + //SEG94 [63] phi (byte) fill::val#3 = (const byte) BLACK#0 [phi:init::@3->fill#0] -- vbuz1=vbuc1 + lda #BLACK + sta fill.val + //SEG95 [63] phi (byte*) fill::addr#0 = (const byte*) colors#0 [phi:init::@3->fill#1] -- pbuz1=pbuc1 + lda #colors + sta fill.addr+1 + jsr fill + //SEG96 [54] phi from init::@3 to init::toD0181 [phi:init::@3->init::toD0181] + toD0181_from_b3: + jmp toD0181 + //SEG97 init::toD0181 + toD0181: + jmp b1 + //SEG98 init::@1 + b1: + //SEG99 [55] *((const byte*) D018#0) ← (const byte) init::toD0181_return#0 -- _deref_pbuc1=vbuc2 + lda #toD0181_return + sta D018 + //SEG100 asm { lda#$5b sta$d011 } + lda #$5b + sta $d011 + //SEG101 [57] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 + lda #BLACK + sta BORDERCOL + //SEG102 [58] *((const byte*) BGCOL1#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 + lda #BLACK + sta BGCOL1 + //SEG103 [59] *((const byte*) BGCOL2#0) ← (const byte) RED#0 -- _deref_pbuc1=vbuc2 + lda #RED + sta BGCOL2 + //SEG104 [60] *((const byte*) BGCOL3#0) ← (const byte) BLUE#0 -- _deref_pbuc1=vbuc2 + lda #BLUE + sta BGCOL3 + //SEG105 [61] *((const byte*) BGCOL4#0) ← (const byte) GREEN#0 -- _deref_pbuc1=vbuc2 + lda #GREEN + sta BGCOL4 + jmp breturn + //SEG106 init::@return + breturn: + //SEG107 [62] return + rts +} +//SEG108 fill +fill: { + .label end = $1e + .label addr = $a + .label val = 9 + //SEG109 [64] (byte*) fill::end#0 ← (byte*) fill::addr#0 + (word/signed word/dword/signed dword) 1000 -- pbuz1=pbuz2_plus_vwuc1 + lda addr + clc + adc #<$3e8 + sta end + lda addr+1 + adc #>$3e8 + sta end+1 + //SEG110 [65] phi from fill fill::@1 to fill::@1 [phi:fill/fill::@1->fill::@1] + b1_from_fill: + b1_from_b1: + //SEG111 [65] phi (byte*) fill::addr#2 = (byte*) fill::addr#0 [phi:fill/fill::@1->fill::@1#0] -- register_copy + jmp b1 + //SEG112 fill::@1 + b1: + //SEG113 [66] *((byte*) fill::addr#2) ← (byte) fill::val#3 -- _deref_pbuz1=vbuz2 + lda val + ldy #0 + sta (addr),y + //SEG114 [67] (byte*) fill::addr#1 ← ++ (byte*) fill::addr#2 -- pbuz1=_inc_pbuz1 + inc addr + bne !+ + inc addr+1 + !: + //SEG115 [68] if((byte*) fill::addr#1!=(byte*) fill::end#0) goto fill::@1 -- pbuz1_neq_pbuz2_then_la1 + lda addr+1 + cmp end+1 + bne b1_from_b1 + lda addr + cmp end + bne b1_from_b1 + jmp breturn + //SEG116 fill::@return + breturn: + //SEG117 [69] return + rts +} +//SEG118 init_sprites +init_sprites: { + //SEG119 [70] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 1 -- _deref_pbuc1=vbuc2 + lda #1 + sta SPRITES_ENABLE + //SEG120 [71] *((const byte*) SPRITES_EXPAND_X#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 + lda #0 + sta SPRITES_EXPAND_X + //SEG121 [72] *((const byte*) SPRITES_EXPAND_Y#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 + lda #0 + sta SPRITES_EXPAND_Y + //SEG122 [73] *((const byte*) SPRITES_XMSB#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 + lda #0 + sta SPRITES_XMSB + //SEG123 [74] *((const byte*) SPRITES_COLS#0) ← (const byte) WHITE#0 -- _deref_pbuc1=vbuc2 + lda #WHITE + sta SPRITES_COLS + //SEG124 [75] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 + lda #0 + sta SPRITES_MC + jmp breturn + //SEG125 init_sprites::@return + breturn: + //SEG126 [76] return + rts +} + +REGISTER UPLIFT POTENTIAL REGISTERS +Statement [8] (byte) main::z#0 ← (byte) main::x#4 + (byte) main::y#2 [ main::x#4 main::y#2 main::z#0 ] ( main:2 [ main::x#4 main::y#2 main::z#0 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:2 [ main::x#4 main::x#1 ] +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:3 [ main::y#2 main::y#1 ] +Statement [19] (byte) draw_block::tileno#1 ← (byte) draw_block::tileno#0 << (byte/signed byte/word/signed word/dword/signed dword) 2 [ draw_block::x#0 draw_block::y#0 draw_block::tileno#1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::x#0 draw_block::y#0 draw_block::tileno#1 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:15 [ draw_block::x#0 ] +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:16 [ draw_block::y#0 ] +Statement [20] (byte~) draw_block::$1 ← (byte) draw_block::x#0 << (byte/signed byte/word/signed word/dword/signed dword) 1 [ draw_block::y#0 draw_block::tileno#1 draw_block::$1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::y#0 draw_block::tileno#1 draw_block::$1 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:17 [ draw_block::tileno#1 ] +Statement [21] (word) draw_block::x1#0 ← ((word)) (byte~) draw_block::$1 [ draw_block::y#0 draw_block::tileno#1 draw_block::x1#0 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::y#0 draw_block::tileno#1 draw_block::x1#0 ] ) always clobbers reg byte a +Statement [22] (byte) draw_block::y#1 ← (byte) draw_block::y#0 << (byte/signed byte/word/signed word/dword/signed dword) 1 [ draw_block::tileno#1 draw_block::x1#0 draw_block::y#1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::tileno#1 draw_block::x1#0 draw_block::y#1 ] ) always clobbers reg byte a +Statement [25] (word) mul8u::return#2 ← (word) mul8u::res#2 [ draw_block::tileno#1 draw_block::x1#0 mul8u::return#2 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::tileno#1 draw_block::x1#0 mul8u::return#2 ] ) always clobbers reg byte a +Statement [26] (word) draw_block::z#0 ← (word) mul8u::return#2 [ draw_block::tileno#1 draw_block::x1#0 draw_block::z#0 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::tileno#1 draw_block::x1#0 draw_block::z#0 ] ) always clobbers reg byte a +Statement [27] (word) draw_block::z#1 ← (word) draw_block::z#0 + (word) draw_block::x1#0 [ draw_block::tileno#1 draw_block::z#1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::tileno#1 draw_block::z#1 ] ) always clobbers reg byte a +Statement [29] *((const byte*) screen#0 + (word) draw_block::z#1) ← (byte) draw_block::drawtile#0 [ draw_block::z#1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 ] ) always clobbers reg byte a +Statement [30] *((const byte*) colors#0 + (word) draw_block::z#1) ← (const byte) YELLOW#0 [ draw_block::z#1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 ] ) always clobbers reg byte a +Statement [31] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (word) draw_block::z#1) ← (byte/signed byte/word/signed word/dword/signed dword) 1 [ draw_block::z#1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 ] ) always clobbers reg byte a +Statement [32] *((const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (word) draw_block::z#1) ← (const byte) YELLOW#0 [ draw_block::z#1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 ] ) always clobbers reg byte a +Statement [33] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 40 + (word) draw_block::z#1) ← (byte/signed byte/word/signed word/dword/signed dword) 2 [ draw_block::z#1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 ] ) always clobbers reg byte a +Statement [34] *((const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) 40 + (word) draw_block::z#1) ← (const byte) YELLOW#0 [ draw_block::z#1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 ] ) always clobbers reg byte a +Statement [35] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 41 + (word) draw_block::z#1) ← (byte/signed byte/word/signed word/dword/signed dword) 3 [ draw_block::z#1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 ] ) always clobbers reg byte a +Statement [36] *((const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) 41 + (word) draw_block::z#1) ← (const byte) YELLOW#0 [ ] ( main:2::draw_block:13 [ main::x#4 main::y#2 ] ) always clobbers reg byte a +Statement [42] (byte~) mul8u::$1 ← (byte) mul8u::a#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ mul8u::res#2 mul8u::a#2 mul8u::mb#2 mul8u::$1 ] ( main:2::draw_block:13::mul8u:24 [ main::x#4 main::y#2 draw_block::tileno#1 draw_block::x1#0 mul8u::res#2 mul8u::a#2 mul8u::mb#2 mul8u::$1 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:4 [ mul8u::a#2 mul8u::a#1 mul8u::a#0 ] +Statement [44] (word) mul8u::res#1 ← (word) mul8u::res#2 + (word) mul8u::mb#2 [ mul8u::a#2 mul8u::mb#2 mul8u::res#1 ] ( main:2::draw_block:13::mul8u:24 [ main::x#4 main::y#2 draw_block::tileno#1 draw_block::x1#0 mul8u::a#2 mul8u::mb#2 mul8u::res#1 ] ) always clobbers reg byte a +Statement [55] *((const byte*) D018#0) ← (const byte) init::toD0181_return#0 [ ] ( main:2::init:5 [ ] ) always clobbers reg byte a +Statement asm { lda#$5b sta$d011 } always clobbers reg byte a +Statement [57] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 [ ] ( main:2::init:5 [ ] ) always clobbers reg byte a +Statement [58] *((const byte*) BGCOL1#0) ← (const byte) BLACK#0 [ ] ( main:2::init:5 [ ] ) always clobbers reg byte a +Statement [59] *((const byte*) BGCOL2#0) ← (const byte) RED#0 [ ] ( main:2::init:5 [ ] ) always clobbers reg byte a +Statement [60] *((const byte*) BGCOL3#0) ← (const byte) BLUE#0 [ ] ( main:2::init:5 [ ] ) always clobbers reg byte a +Statement [61] *((const byte*) BGCOL4#0) ← (const byte) GREEN#0 [ ] ( main:2::init:5 [ ] ) always clobbers reg byte a +Statement [64] (byte*) fill::end#0 ← (byte*) fill::addr#0 + (word/signed word/dword/signed dword) 1000 [ fill::addr#0 fill::val#3 fill::end#0 ] ( main:2::init:5::fill:51 [ fill::addr#0 fill::val#3 fill::end#0 ] main:2::init:5::fill:53 [ fill::addr#0 fill::val#3 fill::end#0 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:9 [ fill::val#3 ] +Statement [66] *((byte*) fill::addr#2) ← (byte) fill::val#3 [ fill::val#3 fill::end#0 fill::addr#2 ] ( main:2::init:5::fill:51 [ fill::val#3 fill::end#0 fill::addr#2 ] main:2::init:5::fill:53 [ fill::val#3 fill::end#0 fill::addr#2 ] ) always clobbers reg byte a reg byte y +Removing always clobbered register reg byte y as potential for zp ZP_BYTE:9 [ fill::val#3 ] +Statement [68] if((byte*) fill::addr#1!=(byte*) fill::end#0) goto fill::@1 [ fill::val#3 fill::end#0 fill::addr#1 ] ( main:2::init:5::fill:51 [ fill::val#3 fill::end#0 fill::addr#1 ] main:2::init:5::fill:53 [ fill::val#3 fill::end#0 fill::addr#1 ] ) always clobbers reg byte a +Statement [70] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 1 [ ] ( main:2::init:5::init_sprites:49 [ ] ) always clobbers reg byte a +Statement [71] *((const byte*) SPRITES_EXPAND_X#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:2::init:5::init_sprites:49 [ ] ) always clobbers reg byte a +Statement [72] *((const byte*) SPRITES_EXPAND_Y#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:2::init:5::init_sprites:49 [ ] ) always clobbers reg byte a +Statement [73] *((const byte*) SPRITES_XMSB#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:2::init:5::init_sprites:49 [ ] ) always clobbers reg byte a +Statement [74] *((const byte*) SPRITES_COLS#0) ← (const byte) WHITE#0 [ ] ( main:2::init:5::init_sprites:49 [ ] ) always clobbers reg byte a +Statement [75] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:2::init:5::init_sprites:49 [ ] ) always clobbers reg byte a +Statement [8] (byte) main::z#0 ← (byte) main::x#4 + (byte) main::y#2 [ main::x#4 main::y#2 main::z#0 ] ( main:2 [ main::x#4 main::y#2 main::z#0 ] ) always clobbers reg byte a +Statement [19] (byte) draw_block::tileno#1 ← (byte) draw_block::tileno#0 << (byte/signed byte/word/signed word/dword/signed dword) 2 [ draw_block::x#0 draw_block::y#0 draw_block::tileno#1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::x#0 draw_block::y#0 draw_block::tileno#1 ] ) always clobbers reg byte a +Statement [20] (byte~) draw_block::$1 ← (byte) draw_block::x#0 << (byte/signed byte/word/signed word/dword/signed dword) 1 [ draw_block::y#0 draw_block::tileno#1 draw_block::$1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::y#0 draw_block::tileno#1 draw_block::$1 ] ) always clobbers reg byte a +Statement [21] (word) draw_block::x1#0 ← ((word)) (byte~) draw_block::$1 [ draw_block::y#0 draw_block::tileno#1 draw_block::x1#0 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::y#0 draw_block::tileno#1 draw_block::x1#0 ] ) always clobbers reg byte a +Statement [22] (byte) draw_block::y#1 ← (byte) draw_block::y#0 << (byte/signed byte/word/signed word/dword/signed dword) 1 [ draw_block::tileno#1 draw_block::x1#0 draw_block::y#1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::tileno#1 draw_block::x1#0 draw_block::y#1 ] ) always clobbers reg byte a +Statement [25] (word) mul8u::return#2 ← (word) mul8u::res#2 [ draw_block::tileno#1 draw_block::x1#0 mul8u::return#2 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::tileno#1 draw_block::x1#0 mul8u::return#2 ] ) always clobbers reg byte a +Statement [26] (word) draw_block::z#0 ← (word) mul8u::return#2 [ draw_block::tileno#1 draw_block::x1#0 draw_block::z#0 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::tileno#1 draw_block::x1#0 draw_block::z#0 ] ) always clobbers reg byte a +Statement [27] (word) draw_block::z#1 ← (word) draw_block::z#0 + (word) draw_block::x1#0 [ draw_block::tileno#1 draw_block::z#1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::tileno#1 draw_block::z#1 ] ) always clobbers reg byte a +Statement [29] *((const byte*) screen#0 + (word) draw_block::z#1) ← (byte) draw_block::drawtile#0 [ draw_block::z#1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 ] ) always clobbers reg byte a +Statement [30] *((const byte*) colors#0 + (word) draw_block::z#1) ← (const byte) YELLOW#0 [ draw_block::z#1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 ] ) always clobbers reg byte a +Statement [31] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (word) draw_block::z#1) ← (byte/signed byte/word/signed word/dword/signed dword) 1 [ draw_block::z#1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 ] ) always clobbers reg byte a +Statement [32] *((const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (word) draw_block::z#1) ← (const byte) YELLOW#0 [ draw_block::z#1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 ] ) always clobbers reg byte a +Statement [33] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 40 + (word) draw_block::z#1) ← (byte/signed byte/word/signed word/dword/signed dword) 2 [ draw_block::z#1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 ] ) always clobbers reg byte a +Statement [34] *((const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) 40 + (word) draw_block::z#1) ← (const byte) YELLOW#0 [ draw_block::z#1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 ] ) always clobbers reg byte a +Statement [35] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 41 + (word) draw_block::z#1) ← (byte/signed byte/word/signed word/dword/signed dword) 3 [ draw_block::z#1 ] ( main:2::draw_block:13 [ main::x#4 main::y#2 draw_block::z#1 ] ) always clobbers reg byte a +Statement [36] *((const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) 41 + (word) draw_block::z#1) ← (const byte) YELLOW#0 [ ] ( main:2::draw_block:13 [ main::x#4 main::y#2 ] ) always clobbers reg byte a +Statement [42] (byte~) mul8u::$1 ← (byte) mul8u::a#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 [ mul8u::res#2 mul8u::a#2 mul8u::mb#2 mul8u::$1 ] ( main:2::draw_block:13::mul8u:24 [ main::x#4 main::y#2 draw_block::tileno#1 draw_block::x1#0 mul8u::res#2 mul8u::a#2 mul8u::mb#2 mul8u::$1 ] ) always clobbers reg byte a +Statement [44] (word) mul8u::res#1 ← (word) mul8u::res#2 + (word) mul8u::mb#2 [ mul8u::a#2 mul8u::mb#2 mul8u::res#1 ] ( main:2::draw_block:13::mul8u:24 [ main::x#4 main::y#2 draw_block::tileno#1 draw_block::x1#0 mul8u::a#2 mul8u::mb#2 mul8u::res#1 ] ) always clobbers reg byte a +Statement [55] *((const byte*) D018#0) ← (const byte) init::toD0181_return#0 [ ] ( main:2::init:5 [ ] ) always clobbers reg byte a +Statement asm { lda#$5b sta$d011 } always clobbers reg byte a +Statement [57] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 [ ] ( main:2::init:5 [ ] ) always clobbers reg byte a +Statement [58] *((const byte*) BGCOL1#0) ← (const byte) BLACK#0 [ ] ( main:2::init:5 [ ] ) always clobbers reg byte a +Statement [59] *((const byte*) BGCOL2#0) ← (const byte) RED#0 [ ] ( main:2::init:5 [ ] ) always clobbers reg byte a +Statement [60] *((const byte*) BGCOL3#0) ← (const byte) BLUE#0 [ ] ( main:2::init:5 [ ] ) always clobbers reg byte a +Statement [61] *((const byte*) BGCOL4#0) ← (const byte) GREEN#0 [ ] ( main:2::init:5 [ ] ) always clobbers reg byte a +Statement [64] (byte*) fill::end#0 ← (byte*) fill::addr#0 + (word/signed word/dword/signed dword) 1000 [ fill::addr#0 fill::val#3 fill::end#0 ] ( main:2::init:5::fill:51 [ fill::addr#0 fill::val#3 fill::end#0 ] main:2::init:5::fill:53 [ fill::addr#0 fill::val#3 fill::end#0 ] ) always clobbers reg byte a +Statement [66] *((byte*) fill::addr#2) ← (byte) fill::val#3 [ fill::val#3 fill::end#0 fill::addr#2 ] ( main:2::init:5::fill:51 [ fill::val#3 fill::end#0 fill::addr#2 ] main:2::init:5::fill:53 [ fill::val#3 fill::end#0 fill::addr#2 ] ) always clobbers reg byte a reg byte y +Statement [68] if((byte*) fill::addr#1!=(byte*) fill::end#0) goto fill::@1 [ fill::val#3 fill::end#0 fill::addr#1 ] ( main:2::init:5::fill:51 [ fill::val#3 fill::end#0 fill::addr#1 ] main:2::init:5::fill:53 [ fill::val#3 fill::end#0 fill::addr#1 ] ) always clobbers reg byte a +Statement [70] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 1 [ ] ( main:2::init:5::init_sprites:49 [ ] ) always clobbers reg byte a +Statement [71] *((const byte*) SPRITES_EXPAND_X#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:2::init:5::init_sprites:49 [ ] ) always clobbers reg byte a +Statement [72] *((const byte*) SPRITES_EXPAND_Y#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:2::init:5::init_sprites:49 [ ] ) always clobbers reg byte a +Statement [73] *((const byte*) SPRITES_XMSB#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:2::init:5::init_sprites:49 [ ] ) always clobbers reg byte a +Statement [74] *((const byte*) SPRITES_COLS#0) ← (const byte) WHITE#0 [ ] ( main:2::init:5::init_sprites:49 [ ] ) always clobbers reg byte a +Statement [75] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:2::init:5::init_sprites:49 [ ] ) always clobbers reg byte a +Potential registers zp ZP_BYTE:2 [ main::x#4 main::x#1 ] : zp ZP_BYTE:2 , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:3 [ main::y#2 main::y#1 ] : zp ZP_BYTE:3 , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:4 [ mul8u::a#2 mul8u::a#1 mul8u::a#0 ] : zp ZP_BYTE:4 , reg byte x , reg byte y , +Potential registers zp ZP_WORD:5 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 ] : zp ZP_WORD:5 , +Potential registers zp ZP_WORD:7 [ mul8u::mb#2 mul8u::mb#1 ] : zp ZP_WORD:7 , +Potential registers zp ZP_BYTE:9 [ fill::val#3 ] : zp ZP_BYTE:9 , reg byte x , +Potential registers zp ZP_WORD:10 [ fill::addr#2 fill::addr#0 fill::addr#1 ] : zp ZP_WORD:10 , +Potential registers zp ZP_BYTE:12 [ main::z#0 ] : zp ZP_BYTE:12 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:13 [ main::tile#0 ] : zp ZP_BYTE:13 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:14 [ draw_block::tileno#0 ] : zp ZP_BYTE:14 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:15 [ draw_block::x#0 ] : zp ZP_BYTE:15 , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:16 [ draw_block::y#0 ] : zp ZP_BYTE:16 , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:17 [ draw_block::tileno#1 ] : zp ZP_BYTE:17 , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:18 [ draw_block::$1 ] : zp ZP_BYTE:18 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_WORD:19 [ draw_block::x1#0 ] : zp ZP_WORD:19 , +Potential registers zp ZP_BYTE:21 [ draw_block::y#1 ] : zp ZP_BYTE:21 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_WORD:22 [ mul8u::return#2 ] : zp ZP_WORD:22 , +Potential registers zp ZP_WORD:24 [ draw_block::z#0 ] : zp ZP_WORD:24 , +Potential registers zp ZP_WORD:26 [ draw_block::z#1 ] : zp ZP_WORD:26 , +Potential registers zp ZP_BYTE:28 [ draw_block::drawtile#0 ] : zp ZP_BYTE:28 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:29 [ mul8u::$1 ] : zp ZP_BYTE:29 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_WORD:30 [ fill::end#0 ] : zp ZP_WORD:30 , + +REGISTER UPLIFT SCOPES +Uplift Scope [mul8u] 3,503.83: zp ZP_WORD:5 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 ] 2,431: zp ZP_WORD:7 [ mul8u::mb#2 mul8u::mb#1 ] 2,002: zp ZP_BYTE:29 [ mul8u::$1 ] 1,670.67: zp ZP_BYTE:4 [ mul8u::a#2 mul8u::a#1 mul8u::a#0 ] 4: zp ZP_WORD:22 [ mul8u::return#2 ] +Uplift Scope [main] 209.21: zp ZP_BYTE:3 [ main::y#2 main::y#1 ] 202: zp ZP_BYTE:12 [ main::z#0 ] 202: zp ZP_BYTE:13 [ main::tile#0 ] 38.9: zp ZP_BYTE:2 [ main::x#4 main::x#1 ] +Uplift Scope [draw_block] 34.33: zp ZP_BYTE:14 [ draw_block::tileno#0 ] 34.33: zp ZP_BYTE:15 [ draw_block::x#0 ] 25.75: zp ZP_BYTE:16 [ draw_block::y#0 ] 4: zp ZP_BYTE:18 [ draw_block::$1 ] 4: zp ZP_BYTE:21 [ draw_block::y#1 ] 4: zp ZP_WORD:24 [ draw_block::z#0 ] 4: zp ZP_BYTE:28 [ draw_block::drawtile#0 ] 2: zp ZP_WORD:26 [ draw_block::z#1 ] 0.67: zp ZP_WORD:19 [ draw_block::x1#0 ] 0.44: zp ZP_BYTE:17 [ draw_block::tileno#1 ] +Uplift Scope [fill] 36: zp ZP_WORD:10 [ fill::addr#2 fill::addr#0 fill::addr#1 ] 2.6: zp ZP_WORD:30 [ fill::end#0 ] 1.83: zp ZP_BYTE:9 [ fill::val#3 ] +Uplift Scope [init] +Uplift Scope [init_sprites] +Uplift Scope [] + +Uplifting [mul8u] best 92818 combination zp ZP_WORD:5 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 ] zp ZP_WORD:7 [ mul8u::mb#2 mul8u::mb#1 ] reg byte a [ mul8u::$1 ] reg byte x [ mul8u::a#2 mul8u::a#1 mul8u::a#0 ] zp ZP_WORD:22 [ mul8u::return#2 ] +Uplifting [main] best 91818 combination zp ZP_BYTE:3 [ main::y#2 main::y#1 ] reg byte a [ main::z#0 ] reg byte a [ main::tile#0 ] zp ZP_BYTE:2 [ main::x#4 main::x#1 ] +Limited combination testing to 100 combinations of 144 possible. +Uplifting [draw_block] best 90907 combination reg byte a [ draw_block::tileno#0 ] reg byte y [ draw_block::x#0 ] reg byte x [ draw_block::y#0 ] reg byte a [ draw_block::$1 ] zp ZP_BYTE:21 [ draw_block::y#1 ] zp ZP_WORD:24 [ draw_block::z#0 ] zp ZP_BYTE:28 [ draw_block::drawtile#0 ] zp ZP_WORD:26 [ draw_block::z#1 ] zp ZP_WORD:19 [ draw_block::x1#0 ] zp ZP_BYTE:17 [ draw_block::tileno#1 ] +Limited combination testing to 100 combinations of 6912 possible. +Uplifting [fill] best 90891 combination zp ZP_WORD:10 [ fill::addr#2 fill::addr#0 fill::addr#1 ] zp ZP_WORD:30 [ fill::end#0 ] reg byte x [ fill::val#3 ] +Uplifting [init] best 90891 combination +Uplifting [init_sprites] best 90891 combination +Uplifting [] best 90891 combination +Attempting to uplift remaining variables inzp ZP_BYTE:3 [ main::y#2 main::y#1 ] +Uplifting [main] best 90891 combination zp ZP_BYTE:3 [ main::y#2 main::y#1 ] +Attempting to uplift remaining variables inzp ZP_BYTE:2 [ main::x#4 main::x#1 ] +Uplifting [main] best 90891 combination zp ZP_BYTE:2 [ main::x#4 main::x#1 ] +Attempting to uplift remaining variables inzp ZP_BYTE:21 [ draw_block::y#1 ] +Uplifting [draw_block] best 90887 combination reg byte a [ draw_block::y#1 ] +Attempting to uplift remaining variables inzp ZP_BYTE:28 [ draw_block::drawtile#0 ] +Uplifting [draw_block] best 90881 combination reg byte a [ draw_block::drawtile#0 ] +Attempting to uplift remaining variables inzp ZP_BYTE:17 [ draw_block::tileno#1 ] +Uplifting [draw_block] best 90881 combination zp ZP_BYTE:17 [ draw_block::tileno#1 ] +Coalescing zero page register with common assignment [ zp ZP_WORD:5 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 ] ] with [ zp ZP_WORD:22 [ mul8u::return#2 ] ] - score: 1 +Coalescing zero page register with common assignment [ zp ZP_WORD:19 [ draw_block::x1#0 ] ] with [ zp ZP_WORD:26 [ draw_block::z#1 ] ] - score: 1 +Coalescing zero page register with common assignment [ zp ZP_WORD:5 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 mul8u::return#2 ] ] with [ zp ZP_WORD:24 [ draw_block::z#0 ] ] - score: 1 +Coalescing zero page register [ zp ZP_WORD:5 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 mul8u::return#2 draw_block::z#0 ] ] with [ zp ZP_WORD:10 [ fill::addr#2 fill::addr#0 fill::addr#1 ] ] +Coalescing zero page register [ zp ZP_WORD:7 [ mul8u::mb#2 mul8u::mb#1 ] ] with [ zp ZP_WORD:30 [ fill::end#0 ] ] +Allocated (was zp ZP_WORD:5) zp ZP_WORD:4 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 mul8u::return#2 draw_block::z#0 fill::addr#2 fill::addr#0 fill::addr#1 ] +Allocated (was zp ZP_WORD:7) zp ZP_WORD:6 [ mul8u::mb#2 mul8u::mb#1 fill::end#0 ] +Allocated (was zp ZP_BYTE:17) zp ZP_BYTE:8 [ draw_block::tileno#1 ] +Allocated (was zp ZP_WORD:19) zp ZP_WORD:9 [ draw_block::x1#0 draw_block::z#1 ] + +ASSEMBLER BEFORE OPTIMIZATION +//SEG0 Basic Upstart +.pc = $801 "Basic" +:BasicUpstart(bbegin) +.pc = $80d "Program" +//SEG1 Global Constants & labels + .label SPRITES_XMSB = $d010 + .label SPRITES_ENABLE = $d015 + .label SPRITES_EXPAND_Y = $d017 + .label SPRITES_MC = $d01c + .label SPRITES_EXPAND_X = $d01d + .label BORDERCOL = $d020 + .label BGCOL1 = $d021 + .label BGCOL2 = $d022 + .label BGCOL3 = $d023 + .label BGCOL4 = $d024 + .label SPRITES_COLS = $d027 + .label D018 = $d018 + .const BLACK = 0 + .const WHITE = 1 + .const RED = 2 + .const GREEN = 5 + .const BLUE = 6 + .const YELLOW = 7 + .label screen = $400 + .label charset = $2000 + .label tileset = $2800 + .label colors = $d800 + .label level_address = $3000 +//SEG2 @begin +bbegin: +//SEG3 [1] phi from @begin to @21 [phi:@begin->@21] +b21_from_bbegin: + jmp b21 +//SEG4 @21 +b21: +//SEG5 [2] call main +//SEG6 [4] phi from @21 to main [phi:@21->main] +main_from_b21: + jsr main +//SEG7 [3] phi from @21 to @end [phi:@21->@end] +bend_from_b21: + jmp bend +//SEG8 @end +bend: +//SEG9 main +main: { + .label y = 3 + .label x = 2 + //SEG10 [5] call init + //SEG11 [48] phi from main to init [phi:main->init] + init_from_main: + jsr init + //SEG12 [6] phi from main to main::@1 [phi:main->main::@1] + b1_from_main: + //SEG13 [6] phi (byte) main::x#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1 + lda #0 + sta x + jmp b1 + //SEG14 [6] phi from main::@4 to main::@1 [phi:main::@4->main::@1] + b1_from_b4: + //SEG15 [6] phi (byte) main::x#4 = (byte) main::x#1 [phi:main::@4->main::@1#0] -- register_copy + jmp b1 + //SEG16 main::@1 + b1: + //SEG17 [7] phi from main::@1 to main::@2 [phi:main::@1->main::@2] + b2_from_b1: + //SEG18 [7] phi (byte) main::y#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@1->main::@2#0] -- vbuz1=vbuc1 + lda #0 + sta y + jmp b2 + //SEG19 [7] phi from main::@8 to main::@2 [phi:main::@8->main::@2] + b2_from_b8: + //SEG20 [7] phi (byte) main::y#2 = (byte) main::y#1 [phi:main::@8->main::@2#0] -- register_copy + jmp b2 + //SEG21 main::@2 + b2: + //SEG22 [8] (byte) main::z#0 ← (byte) main::x#4 + (byte) main::y#2 -- vbuaa=vbuz1_plus_vbuz2 + lda x + clc + adc y + //SEG23 [9] (byte) main::tile#0 ← *((const byte*) level_address#0 + (byte) main::z#0) -- vbuaa=pbuc1_derefidx_vbuaa + tay + lda level_address,y + //SEG24 [10] (byte) draw_block::tileno#0 ← (byte) main::tile#0 + // (byte) draw_block::tileno#0 = (byte) main::tile#0 // register copy reg byte a + //SEG25 [11] (byte) draw_block::x#0 ← (byte) main::x#4 -- vbuyy=vbuz1 + ldy x + //SEG26 [12] (byte) draw_block::y#0 ← (byte) main::y#2 -- vbuxx=vbuz1 + ldx y + //SEG27 [13] call draw_block + jsr draw_block + jmp b8 + //SEG28 main::@8 + b8: + //SEG29 [14] (byte) main::y#1 ← ++ (byte) main::y#2 -- vbuz1=_inc_vbuz1 + inc y + //SEG30 [15] if((byte) main::y#1<(byte/signed byte/word/signed word/dword/signed dword) 9) goto main::@2 -- vbuz1_lt_vbuc1_then_la1 + lda y + cmp #9 + bcc b2_from_b8 + jmp b4 + //SEG31 main::@4 + b4: + //SEG32 [16] (byte) main::x#1 ← ++ (byte) main::x#4 -- vbuz1=_inc_vbuz1 + inc x + //SEG33 [17] if((byte) main::x#1<(byte/signed byte/word/signed word/dword/signed dword) 16) goto main::@1 -- vbuz1_lt_vbuc1_then_la1 + lda x + cmp #$10 + bcc b1_from_b4 + //SEG34 [18] phi from main::@3 main::@4 to main::@3 [phi:main::@3/main::@4->main::@3] + b3_from_b3: + b3_from_b4: + jmp b3 + //SEG35 main::@3 + b3: + jmp b3_from_b3 +} +//SEG36 draw_block +draw_block: { + .label tileno = 8 + .label x1 = 9 + .label z = 4 + .label z_1 = 9 + //SEG37 [19] (byte) draw_block::tileno#1 ← (byte) draw_block::tileno#0 << (byte/signed byte/word/signed word/dword/signed dword) 2 -- vbuz1=vbuaa_rol_2 + asl + asl + sta tileno + //SEG38 [20] (byte~) draw_block::$1 ← (byte) draw_block::x#0 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuaa=vbuyy_rol_1 + tya + asl + //SEG39 [21] (word) draw_block::x1#0 ← ((word)) (byte~) draw_block::$1 -- vwuz1=_word_vbuaa + sta x1 + lda #0 + sta x1+1 + //SEG40 [22] (byte) draw_block::y#1 ← (byte) draw_block::y#0 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuaa=vbuxx_rol_1 + txa + asl + //SEG41 [23] (byte) mul8u::a#1 ← (byte) draw_block::y#1 -- vbuxx=vbuaa + tax + //SEG42 [24] call mul8u + //SEG43 [38] phi from draw_block to mul8u [phi:draw_block->mul8u] + mul8u_from_draw_block: + jsr mul8u + //SEG44 [25] (word) mul8u::return#2 ← (word) mul8u::res#2 + // (word) mul8u::return#2 = (word) mul8u::res#2 // register copy zp ZP_WORD:4 + jmp b1 + //SEG45 draw_block::@1 + b1: + //SEG46 [26] (word) draw_block::z#0 ← (word) mul8u::return#2 + // (word) draw_block::z#0 = (word) mul8u::return#2 // register copy zp ZP_WORD:4 + //SEG47 [27] (word) draw_block::z#1 ← (word) draw_block::z#0 + (word) draw_block::x1#0 -- vwuz1=vwuz2_plus_vwuz1 + lda z_1 + clc + adc z + sta z_1 + lda z_1+1 + adc z+1 + sta z_1+1 + //SEG48 [28] (byte) draw_block::drawtile#0 ← *((const byte*) tileset#0 + (byte) draw_block::tileno#1) -- vbuaa=pbuc1_derefidx_vbuz1 + ldy tileno + lda tileset,y + //SEG49 [29] *((const byte*) screen#0 + (word) draw_block::z#1) ← (byte) draw_block::drawtile#0 -- pbuc1_derefidx_vwuz1=vbuaa + sta !v++1 + lda #screen + adc z_1+1 + sta !a++2 + !v: + lda #0 + !a: + sta screen + //SEG50 [30] *((const byte*) colors#0 + (word) draw_block::z#1) ← (const byte) YELLOW#0 -- pbuc1_derefidx_vwuz1=vbuc2 + lda #colors + adc z_1+1 + sta !++2 + lda #YELLOW + !: + sta colors + //SEG51 [31] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (word) draw_block::z#1) ← (byte/signed byte/word/signed word/dword/signed dword) 1 -- pbuc1_derefidx_vwuz1=vbuc2 + lda #screen+1 + adc z_1+1 + sta !++2 + lda #1 + !: + sta screen+1 + //SEG52 [32] *((const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (word) draw_block::z#1) ← (const byte) YELLOW#0 -- pbuc1_derefidx_vwuz1=vbuc2 + lda #colors+1 + adc z_1+1 + sta !++2 + lda #YELLOW + !: + sta colors+1 + //SEG53 [33] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 40 + (word) draw_block::z#1) ← (byte/signed byte/word/signed word/dword/signed dword) 2 -- pbuc1_derefidx_vwuz1=vbuc2 + lda #screen+$28 + adc z_1+1 + sta !++2 + lda #2 + !: + sta screen+$28 + //SEG54 [34] *((const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) 40 + (word) draw_block::z#1) ← (const byte) YELLOW#0 -- pbuc1_derefidx_vwuz1=vbuc2 + lda #colors+$28 + adc z_1+1 + sta !++2 + lda #YELLOW + !: + sta colors+$28 + //SEG55 [35] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 41 + (word) draw_block::z#1) ← (byte/signed byte/word/signed word/dword/signed dword) 3 -- pbuc1_derefidx_vwuz1=vbuc2 + lda #screen+$29 + adc z_1+1 + sta !++2 + lda #3 + !: + sta screen+$29 + //SEG56 [36] *((const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) 41 + (word) draw_block::z#1) ← (const byte) YELLOW#0 -- pbuc1_derefidx_vwuz1=vbuc2 + lda #colors+$29 + adc z_1+1 + sta !++2 + lda #YELLOW + !: + sta colors+$29 + jmp breturn + //SEG57 draw_block::@return + breturn: + //SEG58 [37] return + rts +} +//SEG59 mul8u +mul8u: { + .const b = $28 + .label mb = 6 + .label res = 4 + .label return = 4 + //SEG60 [39] phi from mul8u to mul8u::@1 [phi:mul8u->mul8u::@1] + b1_from_mul8u: + //SEG61 [39] phi (word) mul8u::mb#2 = ((word))(const byte) mul8u::b#0 [phi:mul8u->mul8u::@1#0] -- vwuz1=vbuc1 + lda #b + sta mb+1 + //SEG62 [39] phi (word) mul8u::res#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:mul8u->mul8u::@1#1] -- vwuz1=vbuc1 + lda #<0 + sta res + lda #>0 + sta res+1 + //SEG63 [39] phi (byte) mul8u::a#2 = (byte) mul8u::a#1 [phi:mul8u->mul8u::@1#2] -- register_copy + jmp b1 + //SEG64 mul8u::@1 + b1: + //SEG65 [40] if((byte) mul8u::a#2!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto mul8u::@2 -- vbuxx_neq_0_then_la1 + cpx #0 + bne b2 + jmp breturn + //SEG66 mul8u::@return + breturn: + //SEG67 [41] return + rts + //SEG68 mul8u::@2 + b2: + //SEG69 [42] (byte~) mul8u::$1 ← (byte) mul8u::a#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuaa=vbuxx_band_vbuc1 + txa + and #1 + //SEG70 [43] if((byte~) mul8u::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto mul8u::@4 -- vbuaa_eq_0_then_la1 + cmp #0 + beq b4_from_b2 + jmp b7 + //SEG71 mul8u::@7 + b7: + //SEG72 [44] (word) mul8u::res#1 ← (word) mul8u::res#2 + (word) mul8u::mb#2 -- vwuz1=vwuz1_plus_vwuz2 + lda res + clc + adc mb + sta res + lda res+1 + adc mb+1 + sta res+1 + //SEG73 [45] phi from mul8u::@2 mul8u::@7 to mul8u::@4 [phi:mul8u::@2/mul8u::@7->mul8u::@4] + b4_from_b2: + b4_from_b7: + //SEG74 [45] phi (word) mul8u::res#6 = (word) mul8u::res#2 [phi:mul8u::@2/mul8u::@7->mul8u::@4#0] -- register_copy + jmp b4 + //SEG75 mul8u::@4 + b4: + //SEG76 [46] (byte) mul8u::a#0 ← (byte) mul8u::a#2 >> (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuxx=vbuxx_ror_1 + txa + lsr + tax + //SEG77 [47] (word) mul8u::mb#1 ← (word) mul8u::mb#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vwuz1=vwuz1_rol_1 + asl mb + rol mb+1 + //SEG78 [39] phi from mul8u::@4 to mul8u::@1 [phi:mul8u::@4->mul8u::@1] + b1_from_b4: + //SEG79 [39] phi (word) mul8u::mb#2 = (word) mul8u::mb#1 [phi:mul8u::@4->mul8u::@1#0] -- register_copy + //SEG80 [39] phi (word) mul8u::res#2 = (word) mul8u::res#6 [phi:mul8u::@4->mul8u::@1#1] -- register_copy + //SEG81 [39] phi (byte) mul8u::a#2 = (byte) mul8u::a#0 [phi:mul8u::@4->mul8u::@1#2] -- register_copy + jmp b1 +} +//SEG82 init +init: { + .const toD0181_return = (>(screen&$3fff)<<2)|(>charset)>>2&$f + //SEG83 [49] call init_sprites + jsr init_sprites + //SEG84 [50] phi from init to init::@2 [phi:init->init::@2] + b2_from_init: + jmp b2 + //SEG85 init::@2 + b2: + //SEG86 [51] call fill + //SEG87 [63] phi from init::@2 to fill [phi:init::@2->fill] + fill_from_b2: + //SEG88 [63] phi (byte) fill::val#3 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:init::@2->fill#0] -- vbuxx=vbuc1 + ldx #0 + //SEG89 [63] phi (byte*) fill::addr#0 = (const byte*) screen#0 [phi:init::@2->fill#1] -- pbuz1=pbuc1 + lda #screen + sta fill.addr+1 + jsr fill + //SEG90 [52] phi from init::@2 to init::@3 [phi:init::@2->init::@3] + b3_from_b2: + jmp b3 + //SEG91 init::@3 + b3: + //SEG92 [53] call fill + //SEG93 [63] phi from init::@3 to fill [phi:init::@3->fill] + fill_from_b3: + //SEG94 [63] phi (byte) fill::val#3 = (const byte) BLACK#0 [phi:init::@3->fill#0] -- vbuxx=vbuc1 + ldx #BLACK + //SEG95 [63] phi (byte*) fill::addr#0 = (const byte*) colors#0 [phi:init::@3->fill#1] -- pbuz1=pbuc1 + lda #colors + sta fill.addr+1 + jsr fill + //SEG96 [54] phi from init::@3 to init::toD0181 [phi:init::@3->init::toD0181] + toD0181_from_b3: + jmp toD0181 + //SEG97 init::toD0181 + toD0181: + jmp b1 + //SEG98 init::@1 + b1: + //SEG99 [55] *((const byte*) D018#0) ← (const byte) init::toD0181_return#0 -- _deref_pbuc1=vbuc2 + lda #toD0181_return + sta D018 + //SEG100 asm { lda#$5b sta$d011 } + lda #$5b + sta $d011 + //SEG101 [57] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 + lda #BLACK + sta BORDERCOL + //SEG102 [58] *((const byte*) BGCOL1#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 + lda #BLACK + sta BGCOL1 + //SEG103 [59] *((const byte*) BGCOL2#0) ← (const byte) RED#0 -- _deref_pbuc1=vbuc2 + lda #RED + sta BGCOL2 + //SEG104 [60] *((const byte*) BGCOL3#0) ← (const byte) BLUE#0 -- _deref_pbuc1=vbuc2 + lda #BLUE + sta BGCOL3 + //SEG105 [61] *((const byte*) BGCOL4#0) ← (const byte) GREEN#0 -- _deref_pbuc1=vbuc2 + lda #GREEN + sta BGCOL4 + jmp breturn + //SEG106 init::@return + breturn: + //SEG107 [62] return + rts +} +//SEG108 fill +fill: { + .label end = 6 + .label addr = 4 + //SEG109 [64] (byte*) fill::end#0 ← (byte*) fill::addr#0 + (word/signed word/dword/signed dword) 1000 -- pbuz1=pbuz2_plus_vwuc1 + lda addr + clc + adc #<$3e8 + sta end + lda addr+1 + adc #>$3e8 + sta end+1 + //SEG110 [65] phi from fill fill::@1 to fill::@1 [phi:fill/fill::@1->fill::@1] + b1_from_fill: + b1_from_b1: + //SEG111 [65] phi (byte*) fill::addr#2 = (byte*) fill::addr#0 [phi:fill/fill::@1->fill::@1#0] -- register_copy + jmp b1 + //SEG112 fill::@1 + b1: + //SEG113 [66] *((byte*) fill::addr#2) ← (byte) fill::val#3 -- _deref_pbuz1=vbuxx + txa + ldy #0 + sta (addr),y + //SEG114 [67] (byte*) fill::addr#1 ← ++ (byte*) fill::addr#2 -- pbuz1=_inc_pbuz1 + inc addr + bne !+ + inc addr+1 + !: + //SEG115 [68] if((byte*) fill::addr#1!=(byte*) fill::end#0) goto fill::@1 -- pbuz1_neq_pbuz2_then_la1 + lda addr+1 + cmp end+1 + bne b1_from_b1 + lda addr + cmp end + bne b1_from_b1 + jmp breturn + //SEG116 fill::@return + breturn: + //SEG117 [69] return + rts +} +//SEG118 init_sprites +init_sprites: { + //SEG119 [70] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 1 -- _deref_pbuc1=vbuc2 + lda #1 + sta SPRITES_ENABLE + //SEG120 [71] *((const byte*) SPRITES_EXPAND_X#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 + lda #0 + sta SPRITES_EXPAND_X + //SEG121 [72] *((const byte*) SPRITES_EXPAND_Y#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 + lda #0 + sta SPRITES_EXPAND_Y + //SEG122 [73] *((const byte*) SPRITES_XMSB#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 + lda #0 + sta SPRITES_XMSB + //SEG123 [74] *((const byte*) SPRITES_COLS#0) ← (const byte) WHITE#0 -- _deref_pbuc1=vbuc2 + lda #WHITE + sta SPRITES_COLS + //SEG124 [75] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 + lda #0 + sta SPRITES_MC + jmp breturn + //SEG125 init_sprites::@return + breturn: + //SEG126 [76] return + rts +} + +ASSEMBLER OPTIMIZATIONS +Removing instruction jmp b21 +Removing instruction jmp bend +Removing instruction jmp b1 +Removing instruction jmp b2 +Removing instruction jmp b8 +Removing instruction jmp b4 +Removing instruction jmp b3 +Removing instruction jmp b1 +Removing instruction jmp breturn +Removing instruction jmp b1 +Removing instruction jmp breturn +Removing instruction jmp b7 +Removing instruction jmp b4 +Removing instruction jmp b2 +Removing instruction jmp b3 +Removing instruction jmp toD0181 +Removing instruction jmp b1 +Removing instruction jmp breturn +Removing instruction jmp b1 +Removing instruction jmp breturn +Removing instruction jmp breturn +Succesful ASM optimization Pass5NextJumpElimination +Removing instruction lda #>0 +Removing instruction lda #BLACK +Removing instruction lda #0 +Removing instruction lda #0 +Succesful ASM optimization Pass5UnnecesaryLoadElimination +Replacing label b2_from_b8 with b2 +Replacing label b1_from_b4 with b1 +Replacing label b3_from_b3 with b3 +Replacing label b4_from_b2 with b4 +Replacing label b1_from_b1 with b1 +Replacing label b1_from_b1 with b1 +Removing instruction b21_from_bbegin: +Removing instruction b21: +Removing instruction main_from_b21: +Removing instruction bend_from_b21: +Removing instruction b1_from_b4: +Removing instruction b2_from_b1: +Removing instruction b2_from_b8: +Removing instruction b3_from_b3: +Removing instruction b3_from_b4: +Removing instruction b4_from_b2: +Removing instruction b4_from_b7: +Removing instruction b2_from_init: +Removing instruction fill_from_b2: +Removing instruction b3_from_b2: +Removing instruction fill_from_b3: +Removing instruction toD0181_from_b3: +Removing instruction toD0181: +Removing instruction b1_from_fill: +Removing instruction b1_from_b1: +Succesful ASM optimization Pass5RedundantLabelElimination +Removing instruction bend: +Removing instruction init_from_main: +Removing instruction b1_from_main: +Removing instruction b8: +Removing instruction b4: +Removing instruction mul8u_from_draw_block: +Removing instruction b1: +Removing instruction breturn: +Removing instruction b1_from_mul8u: +Removing instruction breturn: +Removing instruction b7: +Removing instruction b1_from_b4: +Removing instruction b2: +Removing instruction b3: +Removing instruction b1: +Removing instruction breturn: +Removing instruction breturn: +Removing instruction breturn: +Succesful ASM optimization Pass5UnusedLabelElimination +Updating BasicUpstart to call main directly +Removing instruction jsr main +Succesful ASM optimization Pass5SkipBegin +Removing instruction jmp b1 +Removing instruction jmp b2 +Succesful ASM optimization Pass5NextJumpElimination +Removing instruction bbegin: +Succesful ASM optimization Pass5UnusedLabelElimination + +FINAL SYMBOL TABLE +(label) @21 +(label) @begin +(label) @end +(byte*) BGCOL +(byte*) BGCOL1 +(const byte*) BGCOL1#0 BGCOL1 = ((byte*))(word/dword/signed dword) 53281 +(byte*) BGCOL2 +(const byte*) BGCOL2#0 BGCOL2 = ((byte*))(word/dword/signed dword) 53282 +(byte*) BGCOL3 +(const byte*) BGCOL3#0 BGCOL3 = ((byte*))(word/dword/signed dword) 53283 +(byte*) BGCOL4 +(const byte*) BGCOL4#0 BGCOL4 = ((byte*))(word/dword/signed dword) 53284 +(byte) BLACK +(const byte) BLACK#0 BLACK = (byte/signed byte/word/signed word/dword/signed dword) 0 +(byte) BLUE +(const byte) BLUE#0 BLUE = (byte/signed byte/word/signed word/dword/signed dword) 6 +(byte*) BORDERCOL +(const byte*) BORDERCOL#0 BORDERCOL = ((byte*))(word/dword/signed dword) 53280 +(byte) BROWN +(byte*) CHARGEN +(byte*) CIA1_INTERRUPT +(byte*) CIA1_PORT_A +(byte*) CIA1_PORT_A_DDR +(byte*) CIA1_PORT_B +(byte*) CIA1_PORT_B_DDR +(byte*) CIA2_INTERRUPT +(byte*) CIA2_PORT_A +(byte*) CIA2_PORT_A_DDR +(byte*) CIA2_PORT_B +(byte*) CIA2_PORT_B_DDR +(byte) CIA_INTERRUPT_CLEAR +(byte*) COLS +(byte) CYAN +(byte*) D011 +(byte*) D016 +(byte*) D018 +(const byte*) D018#0 D018 = ((byte*))(word/dword/signed dword) 53272 +(byte) DARK_GREY +(byte) GREEN +(const byte) GREEN#0 GREEN = (byte/signed byte/word/signed word/dword/signed dword) 5 +(byte) GREY +(void()**) HARDWARE_IRQ +(byte) IRQ_COLLISION_BG +(byte) IRQ_COLLISION_SPRITE +(byte*) IRQ_ENABLE +(byte) IRQ_LIGHTPEN +(byte) IRQ_RASTER +(byte*) IRQ_STATUS +(void()**) KERNEL_IRQ +(byte) KEY_0 +(byte) KEY_1 +(byte) KEY_2 +(byte) KEY_3 +(byte) KEY_4 +(byte) KEY_5 +(byte) KEY_6 +(byte) KEY_7 +(byte) KEY_8 +(byte) KEY_9 +(byte) KEY_A +(byte) KEY_ARROW_LEFT +(byte) KEY_ARROW_UP +(byte) KEY_ASTERISK +(byte) KEY_AT +(byte) KEY_B +(byte) KEY_C +(byte) KEY_COLON +(byte) KEY_COMMA +(byte) KEY_COMMODORE +(byte) KEY_CRSR_DOWN +(byte) KEY_CRSR_RIGHT +(byte) KEY_CTRL +(byte) KEY_D +(byte) KEY_DEL +(byte) KEY_DOT +(byte) KEY_E +(byte) KEY_EQUALS +(byte) KEY_F +(byte) KEY_F1 +(byte) KEY_F3 +(byte) KEY_F5 +(byte) KEY_F7 +(byte) KEY_G +(byte) KEY_H +(byte) KEY_HOME +(byte) KEY_I +(byte) KEY_J +(byte) KEY_K +(byte) KEY_L +(byte) KEY_LSHIFT +(byte) KEY_M +(byte) KEY_MINUS +(byte) KEY_MODIFIER_COMMODORE +(byte) KEY_MODIFIER_CTRL +(byte) KEY_MODIFIER_LSHIFT +(byte) KEY_MODIFIER_RSHIFT +(byte) KEY_MODIFIER_SHIFT +(byte) KEY_N +(byte) KEY_O +(byte) KEY_P +(byte) KEY_PLUS +(byte) KEY_POUND +(byte) KEY_Q +(byte) KEY_R +(byte) KEY_RETURN +(byte) KEY_RSHIFT +(byte) KEY_RUNSTOP +(byte) KEY_S +(byte) KEY_SEMICOLON +(byte) KEY_SLASH +(byte) KEY_SPACE +(byte) KEY_T +(byte) KEY_U +(byte) KEY_V +(byte) KEY_W +(byte) KEY_X +(byte) KEY_Y +(byte) KEY_Z +(byte*) LIGHTPEN_X +(byte*) LIGHTPEN_Y +(byte) LIGHT_BLUE +(byte) LIGHT_GREEN +(byte) LIGHT_GREY +(byte) ORANGE +(byte) PINK +(byte*) PROCPORT +(byte) PROCPORT_BASIC_KERNEL_IO +(byte*) PROCPORT_DDR +(byte) PROCPORT_DDR_MEMORY_MASK +(byte) PROCPORT_KERNEL_IO +(byte) PROCPORT_RAM_ALL +(byte) PROCPORT_RAM_CHARROM +(byte) PROCPORT_RAM_IO +(byte) PURPLE +(byte*) RASTER +(byte) RED +(const byte) RED#0 RED = (byte/signed byte/word/signed word/dword/signed dword) 2 +(byte*) SPRITES_COLS +(const byte*) SPRITES_COLS#0 SPRITES_COLS = ((byte*))(word/dword/signed dword) 53287 +(byte*) SPRITES_ENABLE +(const byte*) SPRITES_ENABLE#0 SPRITES_ENABLE = ((byte*))(word/dword/signed dword) 53269 +(byte*) SPRITES_EXPAND_X +(const byte*) SPRITES_EXPAND_X#0 SPRITES_EXPAND_X = ((byte*))(word/dword/signed dword) 53277 +(byte*) SPRITES_EXPAND_Y +(const byte*) SPRITES_EXPAND_Y#0 SPRITES_EXPAND_Y = ((byte*))(word/dword/signed dword) 53271 +(byte*) SPRITES_MC +(const byte*) SPRITES_MC#0 SPRITES_MC = ((byte*))(word/dword/signed dword) 53276 +(byte*) SPRITES_MC1 +(byte*) SPRITES_MC2 +(byte*) SPRITES_PRIORITY +(byte*) SPRITES_XMSB +(const byte*) SPRITES_XMSB#0 SPRITES_XMSB = ((byte*))(word/dword/signed dword) 53264 +(byte*) SPRITES_XPOS +(byte*) SPRITES_YPOS +(word) SPRITE_PTRS +(byte) VIC_BMM +(byte*) VIC_CONTROL +(byte*) VIC_CONTROL2 +(byte) VIC_CSEL +(byte) VIC_DEN +(byte) VIC_ECM +(byte) VIC_MCM +(byte*) VIC_MEMORY +(byte) VIC_RSEL +(byte) VIC_RST8 +(byte) WHITE +(const byte) WHITE#0 WHITE = (byte/signed byte/word/signed word/dword/signed dword) 1 +(byte) YELLOW +(const byte) YELLOW#0 YELLOW = (byte/signed byte/word/signed word/dword/signed dword) 7 +(byte*) charset +(const byte*) charset#0 charset = ((byte*))(word/signed word/dword/signed dword) 8192 +(byte*) colors +(const byte*) colors#0 colors = ((byte*))(word/dword/signed dword) 55296 +(void()) draw_block((byte) draw_block::tileno , (byte) draw_block::x , (byte) draw_block::y , (byte) draw_block::color) +(byte~) draw_block::$1 reg byte a 4.0 +(label) draw_block::@1 +(label) draw_block::@return +(byte) draw_block::color +(byte) draw_block::drawtile +(byte) draw_block::drawtile#0 reg byte a 4.0 +(byte) draw_block::tileno +(byte) draw_block::tileno#0 reg byte a 34.33333333333333 +(byte) draw_block::tileno#1 tileno zp ZP_BYTE:8 0.4444444444444444 +(byte) draw_block::x +(byte) draw_block::x#0 reg byte y 34.33333333333333 +(word) draw_block::x1 +(word) draw_block::x1#0 x1 zp ZP_WORD:9 0.6666666666666666 +(byte) draw_block::y +(byte) draw_block::y#0 reg byte x 25.75 +(byte) draw_block::y#1 reg byte a 4.0 +(word) draw_block::z +(word) draw_block::z#0 z zp ZP_WORD:4 4.0 +(word) draw_block::z#1 z#1 zp ZP_WORD:9 2.0000000000000004 +(void()) fill((byte*) fill::start , (word) fill::size , (byte) fill::val) +(label) fill::@1 +(label) fill::@return +(byte*) fill::addr +(byte*) fill::addr#0 addr zp ZP_WORD:4 2.0 +(byte*) fill::addr#1 addr zp ZP_WORD:4 16.5 +(byte*) fill::addr#2 addr zp ZP_WORD:4 17.5 +(byte*) fill::end +(byte*) fill::end#0 end zp ZP_WORD:6 2.6 +(word) fill::size +(byte*) fill::start +(byte) fill::val +(byte) fill::val#3 reg byte x 1.8333333333333333 +(void()) init() +(label) init::@1 +(label) init::@2 +(label) init::@3 +(label) init::@return +(label) init::toD0181 +(word~) init::toD0181_$0 +(word~) init::toD0181_$1 +(word~) init::toD0181_$2 +(byte~) init::toD0181_$3 +(word~) init::toD0181_$4 +(byte~) init::toD0181_$5 +(byte~) init::toD0181_$6 +(byte~) init::toD0181_$7 +(byte~) init::toD0181_$8 +(byte*) init::toD0181_gfx +(byte) init::toD0181_return +(const byte) init::toD0181_return#0 toD0181_return = >((word))(const byte*) screen#0&(word/signed word/dword/signed dword) 16383<<(byte/signed byte/word/signed word/dword/signed dword) 2|>((word))(const byte*) charset#0>>(byte/signed byte/word/signed word/dword/signed dword) 2&(byte/signed byte/word/signed word/dword/signed dword) 15 +(byte*) init::toD0181_screen +(void()) init_sprites() +(label) init_sprites::@return +(byte[]) keyboard_char_keycodes +(byte[8]) keyboard_events +(byte) keyboard_events_size +(byte[8]) keyboard_matrix_col_bitmask +(byte[8]) keyboard_matrix_row_bitmask +(byte) keyboard_modifiers +(byte[8]) keyboard_scan_values +(byte*) level_address +(const byte*) level_address#0 level_address = ((byte*))(word/signed word/dword/signed dword) 12288 +(void()) main() +(label) main::@1 +(label) main::@2 +(label) main::@3 +(label) main::@4 +(label) main::@8 +(byte) main::tile +(byte) main::tile#0 reg byte a 202.0 +(byte) main::x +(byte) main::x#1 x zp ZP_BYTE:2 16.5 +(byte) main::x#4 x zp ZP_BYTE:2 22.4 +(byte) main::y +(byte) main::y#1 y zp ZP_BYTE:3 151.5 +(byte) main::y#2 y zp ZP_BYTE:3 57.714285714285715 +(byte) main::z +(byte) main::z#0 reg byte a 202.0 +(word()) mul8u((byte) mul8u::a , (byte) mul8u::b) +(byte~) mul8u::$1 reg byte a 2002.0 +(label) mul8u::@1 +(label) mul8u::@2 +(label) mul8u::@4 +(label) mul8u::@7 +(label) mul8u::@return +(byte) mul8u::a +(byte) mul8u::a#0 reg byte x 1001.0 +(byte) mul8u::a#1 reg byte x 2.0 +(byte) mul8u::a#2 reg byte x 667.6666666666667 +(byte) mul8u::b +(const byte) mul8u::b#0 b = (byte/signed byte/word/signed word/dword/signed dword) 40 +(word) mul8u::mb +(word) mul8u::mb#1 mb zp ZP_WORD:6 2002.0 +(word) mul8u::mb#2 mb zp ZP_WORD:6 429.0 +(word) mul8u::res +(word) mul8u::res#1 res zp ZP_WORD:4 2002.0 +(word) mul8u::res#2 res zp ZP_WORD:4 500.83333333333337 +(word) mul8u::res#6 res zp ZP_WORD:4 1001.0 +(word) mul8u::return +(word) mul8u::return#2 return zp ZP_WORD:4 4.0 +(byte*) screen +(const byte*) screen#0 screen = ((byte*))(word/signed word/dword/signed dword) 1024 +(byte*) tileset +(const byte*) tileset#0 tileset = ((byte*))(word/signed word/dword/signed dword) 10240 + +zp ZP_BYTE:2 [ main::x#4 main::x#1 ] +zp ZP_BYTE:3 [ main::y#2 main::y#1 ] +reg byte x [ mul8u::a#2 mul8u::a#1 mul8u::a#0 ] +zp ZP_WORD:4 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 mul8u::return#2 draw_block::z#0 fill::addr#2 fill::addr#0 fill::addr#1 ] +zp ZP_WORD:6 [ mul8u::mb#2 mul8u::mb#1 fill::end#0 ] +reg byte x [ fill::val#3 ] +reg byte a [ main::z#0 ] +reg byte a [ main::tile#0 ] +reg byte a [ draw_block::tileno#0 ] +reg byte y [ draw_block::x#0 ] +reg byte x [ draw_block::y#0 ] +zp ZP_BYTE:8 [ draw_block::tileno#1 ] +reg byte a [ draw_block::$1 ] +zp ZP_WORD:9 [ draw_block::x1#0 draw_block::z#1 ] +reg byte a [ draw_block::y#1 ] +reg byte a [ draw_block::drawtile#0 ] +reg byte a [ mul8u::$1 ] + + +FINAL ASSEMBLER +Score: 75438 + +//SEG0 Basic Upstart +.pc = $801 "Basic" +:BasicUpstart(main) +.pc = $80d "Program" +//SEG1 Global Constants & labels + .label SPRITES_XMSB = $d010 + .label SPRITES_ENABLE = $d015 + .label SPRITES_EXPAND_Y = $d017 + .label SPRITES_MC = $d01c + .label SPRITES_EXPAND_X = $d01d + .label BORDERCOL = $d020 + .label BGCOL1 = $d021 + .label BGCOL2 = $d022 + .label BGCOL3 = $d023 + .label BGCOL4 = $d024 + .label SPRITES_COLS = $d027 + .label D018 = $d018 + .const BLACK = 0 + .const WHITE = 1 + .const RED = 2 + .const GREEN = 5 + .const BLUE = 6 + .const YELLOW = 7 + .label screen = $400 + .label charset = $2000 + .label tileset = $2800 + .label colors = $d800 + .label level_address = $3000 +//SEG2 @begin +//SEG3 [1] phi from @begin to @21 [phi:@begin->@21] +//SEG4 @21 +//SEG5 [2] call main +//SEG6 [4] phi from @21 to main [phi:@21->main] +//SEG7 [3] phi from @21 to @end [phi:@21->@end] +//SEG8 @end +//SEG9 main +main: { + .label y = 3 + .label x = 2 + //SEG10 [5] call init + //SEG11 [48] phi from main to init [phi:main->init] + jsr init + //SEG12 [6] phi from main to main::@1 [phi:main->main::@1] + //SEG13 [6] phi (byte) main::x#4 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1 + lda #0 + sta x + //SEG14 [6] phi from main::@4 to main::@1 [phi:main::@4->main::@1] + //SEG15 [6] phi (byte) main::x#4 = (byte) main::x#1 [phi:main::@4->main::@1#0] -- register_copy + //SEG16 main::@1 + b1: + //SEG17 [7] phi from main::@1 to main::@2 [phi:main::@1->main::@2] + //SEG18 [7] phi (byte) main::y#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main::@1->main::@2#0] -- vbuz1=vbuc1 + lda #0 + sta y + //SEG19 [7] phi from main::@8 to main::@2 [phi:main::@8->main::@2] + //SEG20 [7] phi (byte) main::y#2 = (byte) main::y#1 [phi:main::@8->main::@2#0] -- register_copy + //SEG21 main::@2 + b2: + //SEG22 [8] (byte) main::z#0 ← (byte) main::x#4 + (byte) main::y#2 -- vbuaa=vbuz1_plus_vbuz2 + lda x + clc + adc y + //SEG23 [9] (byte) main::tile#0 ← *((const byte*) level_address#0 + (byte) main::z#0) -- vbuaa=pbuc1_derefidx_vbuaa + tay + lda level_address,y + //SEG24 [10] (byte) draw_block::tileno#0 ← (byte) main::tile#0 + // (byte) draw_block::tileno#0 = (byte) main::tile#0 // register copy reg byte a + //SEG25 [11] (byte) draw_block::x#0 ← (byte) main::x#4 -- vbuyy=vbuz1 + ldy x + //SEG26 [12] (byte) draw_block::y#0 ← (byte) main::y#2 -- vbuxx=vbuz1 + ldx y + //SEG27 [13] call draw_block + jsr draw_block + //SEG28 main::@8 + //SEG29 [14] (byte) main::y#1 ← ++ (byte) main::y#2 -- vbuz1=_inc_vbuz1 + inc y + //SEG30 [15] if((byte) main::y#1<(byte/signed byte/word/signed word/dword/signed dword) 9) goto main::@2 -- vbuz1_lt_vbuc1_then_la1 + lda y + cmp #9 + bcc b2 + //SEG31 main::@4 + //SEG32 [16] (byte) main::x#1 ← ++ (byte) main::x#4 -- vbuz1=_inc_vbuz1 + inc x + //SEG33 [17] if((byte) main::x#1<(byte/signed byte/word/signed word/dword/signed dword) 16) goto main::@1 -- vbuz1_lt_vbuc1_then_la1 + lda x + cmp #$10 + bcc b1 + //SEG34 [18] phi from main::@3 main::@4 to main::@3 [phi:main::@3/main::@4->main::@3] + //SEG35 main::@3 + b3: + jmp b3 +} +//SEG36 draw_block +draw_block: { + .label tileno = 8 + .label x1 = 9 + .label z = 4 + .label z_1 = 9 + //SEG37 [19] (byte) draw_block::tileno#1 ← (byte) draw_block::tileno#0 << (byte/signed byte/word/signed word/dword/signed dword) 2 -- vbuz1=vbuaa_rol_2 + asl + asl + sta tileno + //SEG38 [20] (byte~) draw_block::$1 ← (byte) draw_block::x#0 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuaa=vbuyy_rol_1 + tya + asl + //SEG39 [21] (word) draw_block::x1#0 ← ((word)) (byte~) draw_block::$1 -- vwuz1=_word_vbuaa + sta x1 + lda #0 + sta x1+1 + //SEG40 [22] (byte) draw_block::y#1 ← (byte) draw_block::y#0 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuaa=vbuxx_rol_1 + txa + asl + //SEG41 [23] (byte) mul8u::a#1 ← (byte) draw_block::y#1 -- vbuxx=vbuaa + tax + //SEG42 [24] call mul8u + //SEG43 [38] phi from draw_block to mul8u [phi:draw_block->mul8u] + jsr mul8u + //SEG44 [25] (word) mul8u::return#2 ← (word) mul8u::res#2 + // (word) mul8u::return#2 = (word) mul8u::res#2 // register copy zp ZP_WORD:4 + //SEG45 draw_block::@1 + //SEG46 [26] (word) draw_block::z#0 ← (word) mul8u::return#2 + // (word) draw_block::z#0 = (word) mul8u::return#2 // register copy zp ZP_WORD:4 + //SEG47 [27] (word) draw_block::z#1 ← (word) draw_block::z#0 + (word) draw_block::x1#0 -- vwuz1=vwuz2_plus_vwuz1 + lda z_1 + clc + adc z + sta z_1 + lda z_1+1 + adc z+1 + sta z_1+1 + //SEG48 [28] (byte) draw_block::drawtile#0 ← *((const byte*) tileset#0 + (byte) draw_block::tileno#1) -- vbuaa=pbuc1_derefidx_vbuz1 + ldy tileno + lda tileset,y + //SEG49 [29] *((const byte*) screen#0 + (word) draw_block::z#1) ← (byte) draw_block::drawtile#0 -- pbuc1_derefidx_vwuz1=vbuaa + sta !v++1 + lda #screen + adc z_1+1 + sta !a++2 + !v: + lda #0 + !a: + sta screen + //SEG50 [30] *((const byte*) colors#0 + (word) draw_block::z#1) ← (const byte) YELLOW#0 -- pbuc1_derefidx_vwuz1=vbuc2 + lda #colors + adc z_1+1 + sta !++2 + lda #YELLOW + !: + sta colors + //SEG51 [31] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (word) draw_block::z#1) ← (byte/signed byte/word/signed word/dword/signed dword) 1 -- pbuc1_derefidx_vwuz1=vbuc2 + lda #screen+1 + adc z_1+1 + sta !++2 + lda #1 + !: + sta screen+1 + //SEG52 [32] *((const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) 1 + (word) draw_block::z#1) ← (const byte) YELLOW#0 -- pbuc1_derefidx_vwuz1=vbuc2 + lda #colors+1 + adc z_1+1 + sta !++2 + lda #YELLOW + !: + sta colors+1 + //SEG53 [33] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 40 + (word) draw_block::z#1) ← (byte/signed byte/word/signed word/dword/signed dword) 2 -- pbuc1_derefidx_vwuz1=vbuc2 + lda #screen+$28 + adc z_1+1 + sta !++2 + lda #2 + !: + sta screen+$28 + //SEG54 [34] *((const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) 40 + (word) draw_block::z#1) ← (const byte) YELLOW#0 -- pbuc1_derefidx_vwuz1=vbuc2 + lda #colors+$28 + adc z_1+1 + sta !++2 + lda #YELLOW + !: + sta colors+$28 + //SEG55 [35] *((const byte*) screen#0+(byte/signed byte/word/signed word/dword/signed dword) 41 + (word) draw_block::z#1) ← (byte/signed byte/word/signed word/dword/signed dword) 3 -- pbuc1_derefidx_vwuz1=vbuc2 + lda #screen+$29 + adc z_1+1 + sta !++2 + lda #3 + !: + sta screen+$29 + //SEG56 [36] *((const byte*) colors#0+(byte/signed byte/word/signed word/dword/signed dword) 41 + (word) draw_block::z#1) ← (const byte) YELLOW#0 -- pbuc1_derefidx_vwuz1=vbuc2 + lda #colors+$29 + adc z_1+1 + sta !++2 + lda #YELLOW + !: + sta colors+$29 + //SEG57 draw_block::@return + //SEG58 [37] return + rts +} +//SEG59 mul8u +mul8u: { + .const b = $28 + .label mb = 6 + .label res = 4 + .label return = 4 + //SEG60 [39] phi from mul8u to mul8u::@1 [phi:mul8u->mul8u::@1] + //SEG61 [39] phi (word) mul8u::mb#2 = ((word))(const byte) mul8u::b#0 [phi:mul8u->mul8u::@1#0] -- vwuz1=vbuc1 + lda #b + sta mb+1 + //SEG62 [39] phi (word) mul8u::res#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:mul8u->mul8u::@1#1] -- vwuz1=vbuc1 + lda #<0 + sta res + sta res+1 + //SEG63 [39] phi (byte) mul8u::a#2 = (byte) mul8u::a#1 [phi:mul8u->mul8u::@1#2] -- register_copy + //SEG64 mul8u::@1 + b1: + //SEG65 [40] if((byte) mul8u::a#2!=(byte/signed byte/word/signed word/dword/signed dword) 0) goto mul8u::@2 -- vbuxx_neq_0_then_la1 + cpx #0 + bne b2 + //SEG66 mul8u::@return + //SEG67 [41] return + rts + //SEG68 mul8u::@2 + b2: + //SEG69 [42] (byte~) mul8u::$1 ← (byte) mul8u::a#2 & (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuaa=vbuxx_band_vbuc1 + txa + and #1 + //SEG70 [43] if((byte~) mul8u::$1==(byte/signed byte/word/signed word/dword/signed dword) 0) goto mul8u::@4 -- vbuaa_eq_0_then_la1 + cmp #0 + beq b4 + //SEG71 mul8u::@7 + //SEG72 [44] (word) mul8u::res#1 ← (word) mul8u::res#2 + (word) mul8u::mb#2 -- vwuz1=vwuz1_plus_vwuz2 + lda res + clc + adc mb + sta res + lda res+1 + adc mb+1 + sta res+1 + //SEG73 [45] phi from mul8u::@2 mul8u::@7 to mul8u::@4 [phi:mul8u::@2/mul8u::@7->mul8u::@4] + //SEG74 [45] phi (word) mul8u::res#6 = (word) mul8u::res#2 [phi:mul8u::@2/mul8u::@7->mul8u::@4#0] -- register_copy + //SEG75 mul8u::@4 + b4: + //SEG76 [46] (byte) mul8u::a#0 ← (byte) mul8u::a#2 >> (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuxx=vbuxx_ror_1 + txa + lsr + tax + //SEG77 [47] (word) mul8u::mb#1 ← (word) mul8u::mb#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vwuz1=vwuz1_rol_1 + asl mb + rol mb+1 + //SEG78 [39] phi from mul8u::@4 to mul8u::@1 [phi:mul8u::@4->mul8u::@1] + //SEG79 [39] phi (word) mul8u::mb#2 = (word) mul8u::mb#1 [phi:mul8u::@4->mul8u::@1#0] -- register_copy + //SEG80 [39] phi (word) mul8u::res#2 = (word) mul8u::res#6 [phi:mul8u::@4->mul8u::@1#1] -- register_copy + //SEG81 [39] phi (byte) mul8u::a#2 = (byte) mul8u::a#0 [phi:mul8u::@4->mul8u::@1#2] -- register_copy + jmp b1 +} +//SEG82 init +init: { + .const toD0181_return = (>(screen&$3fff)<<2)|(>charset)>>2&$f + //SEG83 [49] call init_sprites + jsr init_sprites + //SEG84 [50] phi from init to init::@2 [phi:init->init::@2] + //SEG85 init::@2 + //SEG86 [51] call fill + //SEG87 [63] phi from init::@2 to fill [phi:init::@2->fill] + //SEG88 [63] phi (byte) fill::val#3 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:init::@2->fill#0] -- vbuxx=vbuc1 + ldx #0 + //SEG89 [63] phi (byte*) fill::addr#0 = (const byte*) screen#0 [phi:init::@2->fill#1] -- pbuz1=pbuc1 + lda #screen + sta fill.addr+1 + jsr fill + //SEG90 [52] phi from init::@2 to init::@3 [phi:init::@2->init::@3] + //SEG91 init::@3 + //SEG92 [53] call fill + //SEG93 [63] phi from init::@3 to fill [phi:init::@3->fill] + //SEG94 [63] phi (byte) fill::val#3 = (const byte) BLACK#0 [phi:init::@3->fill#0] -- vbuxx=vbuc1 + ldx #BLACK + //SEG95 [63] phi (byte*) fill::addr#0 = (const byte*) colors#0 [phi:init::@3->fill#1] -- pbuz1=pbuc1 + lda #colors + sta fill.addr+1 + jsr fill + //SEG96 [54] phi from init::@3 to init::toD0181 [phi:init::@3->init::toD0181] + //SEG97 init::toD0181 + //SEG98 init::@1 + //SEG99 [55] *((const byte*) D018#0) ← (const byte) init::toD0181_return#0 -- _deref_pbuc1=vbuc2 + lda #toD0181_return + sta D018 + //SEG100 asm { lda#$5b sta$d011 } + lda #$5b + sta $d011 + //SEG101 [57] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 + lda #BLACK + sta BORDERCOL + //SEG102 [58] *((const byte*) BGCOL1#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 + sta BGCOL1 + //SEG103 [59] *((const byte*) BGCOL2#0) ← (const byte) RED#0 -- _deref_pbuc1=vbuc2 + lda #RED + sta BGCOL2 + //SEG104 [60] *((const byte*) BGCOL3#0) ← (const byte) BLUE#0 -- _deref_pbuc1=vbuc2 + lda #BLUE + sta BGCOL3 + //SEG105 [61] *((const byte*) BGCOL4#0) ← (const byte) GREEN#0 -- _deref_pbuc1=vbuc2 + lda #GREEN + sta BGCOL4 + //SEG106 init::@return + //SEG107 [62] return + rts +} +//SEG108 fill +fill: { + .label end = 6 + .label addr = 4 + //SEG109 [64] (byte*) fill::end#0 ← (byte*) fill::addr#0 + (word/signed word/dword/signed dword) 1000 -- pbuz1=pbuz2_plus_vwuc1 + lda addr + clc + adc #<$3e8 + sta end + lda addr+1 + adc #>$3e8 + sta end+1 + //SEG110 [65] phi from fill fill::@1 to fill::@1 [phi:fill/fill::@1->fill::@1] + //SEG111 [65] phi (byte*) fill::addr#2 = (byte*) fill::addr#0 [phi:fill/fill::@1->fill::@1#0] -- register_copy + //SEG112 fill::@1 + b1: + //SEG113 [66] *((byte*) fill::addr#2) ← (byte) fill::val#3 -- _deref_pbuz1=vbuxx + txa + ldy #0 + sta (addr),y + //SEG114 [67] (byte*) fill::addr#1 ← ++ (byte*) fill::addr#2 -- pbuz1=_inc_pbuz1 + inc addr + bne !+ + inc addr+1 + !: + //SEG115 [68] if((byte*) fill::addr#1!=(byte*) fill::end#0) goto fill::@1 -- pbuz1_neq_pbuz2_then_la1 + lda addr+1 + cmp end+1 + bne b1 + lda addr + cmp end + bne b1 + //SEG116 fill::@return + //SEG117 [69] return + rts +} +//SEG118 init_sprites +init_sprites: { + //SEG119 [70] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 1 -- _deref_pbuc1=vbuc2 + lda #1 + sta SPRITES_ENABLE + //SEG120 [71] *((const byte*) SPRITES_EXPAND_X#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 + lda #0 + sta SPRITES_EXPAND_X + //SEG121 [72] *((const byte*) SPRITES_EXPAND_Y#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 + sta SPRITES_EXPAND_Y + //SEG122 [73] *((const byte*) SPRITES_XMSB#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 + sta SPRITES_XMSB + //SEG123 [74] *((const byte*) SPRITES_COLS#0) ← (const byte) WHITE#0 -- _deref_pbuc1=vbuc2 + lda #WHITE + sta SPRITES_COLS + //SEG124 [75] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 + lda #0 + sta SPRITES_MC + //SEG125 init_sprites::@return + //SEG126 [76] return + rts +} + diff --git a/src/test/ref/scan-desire-problem.sym b/src/test/ref/scan-desire-problem.sym new file mode 100644 index 000000000..a11fa0d19 --- /dev/null +++ b/src/test/ref/scan-desire-problem.sym @@ -0,0 +1,296 @@ +(label) @21 +(label) @begin +(label) @end +(byte*) BGCOL +(byte*) BGCOL1 +(const byte*) BGCOL1#0 BGCOL1 = ((byte*))(word/dword/signed dword) 53281 +(byte*) BGCOL2 +(const byte*) BGCOL2#0 BGCOL2 = ((byte*))(word/dword/signed dword) 53282 +(byte*) BGCOL3 +(const byte*) BGCOL3#0 BGCOL3 = ((byte*))(word/dword/signed dword) 53283 +(byte*) BGCOL4 +(const byte*) BGCOL4#0 BGCOL4 = ((byte*))(word/dword/signed dword) 53284 +(byte) BLACK +(const byte) BLACK#0 BLACK = (byte/signed byte/word/signed word/dword/signed dword) 0 +(byte) BLUE +(const byte) BLUE#0 BLUE = (byte/signed byte/word/signed word/dword/signed dword) 6 +(byte*) BORDERCOL +(const byte*) BORDERCOL#0 BORDERCOL = ((byte*))(word/dword/signed dword) 53280 +(byte) BROWN +(byte*) CHARGEN +(byte*) CIA1_INTERRUPT +(byte*) CIA1_PORT_A +(byte*) CIA1_PORT_A_DDR +(byte*) CIA1_PORT_B +(byte*) CIA1_PORT_B_DDR +(byte*) CIA2_INTERRUPT +(byte*) CIA2_PORT_A +(byte*) CIA2_PORT_A_DDR +(byte*) CIA2_PORT_B +(byte*) CIA2_PORT_B_DDR +(byte) CIA_INTERRUPT_CLEAR +(byte*) COLS +(byte) CYAN +(byte*) D011 +(byte*) D016 +(byte*) D018 +(const byte*) D018#0 D018 = ((byte*))(word/dword/signed dword) 53272 +(byte) DARK_GREY +(byte) GREEN +(const byte) GREEN#0 GREEN = (byte/signed byte/word/signed word/dword/signed dword) 5 +(byte) GREY +(void()**) HARDWARE_IRQ +(byte) IRQ_COLLISION_BG +(byte) IRQ_COLLISION_SPRITE +(byte*) IRQ_ENABLE +(byte) IRQ_LIGHTPEN +(byte) IRQ_RASTER +(byte*) IRQ_STATUS +(void()**) KERNEL_IRQ +(byte) KEY_0 +(byte) KEY_1 +(byte) KEY_2 +(byte) KEY_3 +(byte) KEY_4 +(byte) KEY_5 +(byte) KEY_6 +(byte) KEY_7 +(byte) KEY_8 +(byte) KEY_9 +(byte) KEY_A +(byte) KEY_ARROW_LEFT +(byte) KEY_ARROW_UP +(byte) KEY_ASTERISK +(byte) KEY_AT +(byte) KEY_B +(byte) KEY_C +(byte) KEY_COLON +(byte) KEY_COMMA +(byte) KEY_COMMODORE +(byte) KEY_CRSR_DOWN +(byte) KEY_CRSR_RIGHT +(byte) KEY_CTRL +(byte) KEY_D +(byte) KEY_DEL +(byte) KEY_DOT +(byte) KEY_E +(byte) KEY_EQUALS +(byte) KEY_F +(byte) KEY_F1 +(byte) KEY_F3 +(byte) KEY_F5 +(byte) KEY_F7 +(byte) KEY_G +(byte) KEY_H +(byte) KEY_HOME +(byte) KEY_I +(byte) KEY_J +(byte) KEY_K +(byte) KEY_L +(byte) KEY_LSHIFT +(byte) KEY_M +(byte) KEY_MINUS +(byte) KEY_MODIFIER_COMMODORE +(byte) KEY_MODIFIER_CTRL +(byte) KEY_MODIFIER_LSHIFT +(byte) KEY_MODIFIER_RSHIFT +(byte) KEY_MODIFIER_SHIFT +(byte) KEY_N +(byte) KEY_O +(byte) KEY_P +(byte) KEY_PLUS +(byte) KEY_POUND +(byte) KEY_Q +(byte) KEY_R +(byte) KEY_RETURN +(byte) KEY_RSHIFT +(byte) KEY_RUNSTOP +(byte) KEY_S +(byte) KEY_SEMICOLON +(byte) KEY_SLASH +(byte) KEY_SPACE +(byte) KEY_T +(byte) KEY_U +(byte) KEY_V +(byte) KEY_W +(byte) KEY_X +(byte) KEY_Y +(byte) KEY_Z +(byte*) LIGHTPEN_X +(byte*) LIGHTPEN_Y +(byte) LIGHT_BLUE +(byte) LIGHT_GREEN +(byte) LIGHT_GREY +(byte) ORANGE +(byte) PINK +(byte*) PROCPORT +(byte) PROCPORT_BASIC_KERNEL_IO +(byte*) PROCPORT_DDR +(byte) PROCPORT_DDR_MEMORY_MASK +(byte) PROCPORT_KERNEL_IO +(byte) PROCPORT_RAM_ALL +(byte) PROCPORT_RAM_CHARROM +(byte) PROCPORT_RAM_IO +(byte) PURPLE +(byte*) RASTER +(byte) RED +(const byte) RED#0 RED = (byte/signed byte/word/signed word/dword/signed dword) 2 +(byte*) SPRITES_COLS +(const byte*) SPRITES_COLS#0 SPRITES_COLS = ((byte*))(word/dword/signed dword) 53287 +(byte*) SPRITES_ENABLE +(const byte*) SPRITES_ENABLE#0 SPRITES_ENABLE = ((byte*))(word/dword/signed dword) 53269 +(byte*) SPRITES_EXPAND_X +(const byte*) SPRITES_EXPAND_X#0 SPRITES_EXPAND_X = ((byte*))(word/dword/signed dword) 53277 +(byte*) SPRITES_EXPAND_Y +(const byte*) SPRITES_EXPAND_Y#0 SPRITES_EXPAND_Y = ((byte*))(word/dword/signed dword) 53271 +(byte*) SPRITES_MC +(const byte*) SPRITES_MC#0 SPRITES_MC = ((byte*))(word/dword/signed dword) 53276 +(byte*) SPRITES_MC1 +(byte*) SPRITES_MC2 +(byte*) SPRITES_PRIORITY +(byte*) SPRITES_XMSB +(const byte*) SPRITES_XMSB#0 SPRITES_XMSB = ((byte*))(word/dword/signed dword) 53264 +(byte*) SPRITES_XPOS +(byte*) SPRITES_YPOS +(word) SPRITE_PTRS +(byte) VIC_BMM +(byte*) VIC_CONTROL +(byte*) VIC_CONTROL2 +(byte) VIC_CSEL +(byte) VIC_DEN +(byte) VIC_ECM +(byte) VIC_MCM +(byte*) VIC_MEMORY +(byte) VIC_RSEL +(byte) VIC_RST8 +(byte) WHITE +(const byte) WHITE#0 WHITE = (byte/signed byte/word/signed word/dword/signed dword) 1 +(byte) YELLOW +(const byte) YELLOW#0 YELLOW = (byte/signed byte/word/signed word/dword/signed dword) 7 +(byte*) charset +(const byte*) charset#0 charset = ((byte*))(word/signed word/dword/signed dword) 8192 +(byte*) colors +(const byte*) colors#0 colors = ((byte*))(word/dword/signed dword) 55296 +(void()) draw_block((byte) draw_block::tileno , (byte) draw_block::x , (byte) draw_block::y , (byte) draw_block::color) +(byte~) draw_block::$1 reg byte a 4.0 +(label) draw_block::@1 +(label) draw_block::@return +(byte) draw_block::color +(byte) draw_block::drawtile +(byte) draw_block::drawtile#0 reg byte a 4.0 +(byte) draw_block::tileno +(byte) draw_block::tileno#0 reg byte a 34.33333333333333 +(byte) draw_block::tileno#1 tileno zp ZP_BYTE:8 0.4444444444444444 +(byte) draw_block::x +(byte) draw_block::x#0 reg byte y 34.33333333333333 +(word) draw_block::x1 +(word) draw_block::x1#0 x1 zp ZP_WORD:9 0.6666666666666666 +(byte) draw_block::y +(byte) draw_block::y#0 reg byte x 25.75 +(byte) draw_block::y#1 reg byte a 4.0 +(word) draw_block::z +(word) draw_block::z#0 z zp ZP_WORD:4 4.0 +(word) draw_block::z#1 z#1 zp ZP_WORD:9 2.0000000000000004 +(void()) fill((byte*) fill::start , (word) fill::size , (byte) fill::val) +(label) fill::@1 +(label) fill::@return +(byte*) fill::addr +(byte*) fill::addr#0 addr zp ZP_WORD:4 2.0 +(byte*) fill::addr#1 addr zp ZP_WORD:4 16.5 +(byte*) fill::addr#2 addr zp ZP_WORD:4 17.5 +(byte*) fill::end +(byte*) fill::end#0 end zp ZP_WORD:6 2.6 +(word) fill::size +(byte*) fill::start +(byte) fill::val +(byte) fill::val#3 reg byte x 1.8333333333333333 +(void()) init() +(label) init::@1 +(label) init::@2 +(label) init::@3 +(label) init::@return +(label) init::toD0181 +(word~) init::toD0181_$0 +(word~) init::toD0181_$1 +(word~) init::toD0181_$2 +(byte~) init::toD0181_$3 +(word~) init::toD0181_$4 +(byte~) init::toD0181_$5 +(byte~) init::toD0181_$6 +(byte~) init::toD0181_$7 +(byte~) init::toD0181_$8 +(byte*) init::toD0181_gfx +(byte) init::toD0181_return +(const byte) init::toD0181_return#0 toD0181_return = >((word))(const byte*) screen#0&(word/signed word/dword/signed dword) 16383<<(byte/signed byte/word/signed word/dword/signed dword) 2|>((word))(const byte*) charset#0>>(byte/signed byte/word/signed word/dword/signed dword) 2&(byte/signed byte/word/signed word/dword/signed dword) 15 +(byte*) init::toD0181_screen +(void()) init_sprites() +(label) init_sprites::@return +(byte[]) keyboard_char_keycodes +(byte[8]) keyboard_events +(byte) keyboard_events_size +(byte[8]) keyboard_matrix_col_bitmask +(byte[8]) keyboard_matrix_row_bitmask +(byte) keyboard_modifiers +(byte[8]) keyboard_scan_values +(byte*) level_address +(const byte*) level_address#0 level_address = ((byte*))(word/signed word/dword/signed dword) 12288 +(void()) main() +(label) main::@1 +(label) main::@2 +(label) main::@3 +(label) main::@4 +(label) main::@8 +(byte) main::tile +(byte) main::tile#0 reg byte a 202.0 +(byte) main::x +(byte) main::x#1 x zp ZP_BYTE:2 16.5 +(byte) main::x#4 x zp ZP_BYTE:2 22.4 +(byte) main::y +(byte) main::y#1 y zp ZP_BYTE:3 151.5 +(byte) main::y#2 y zp ZP_BYTE:3 57.714285714285715 +(byte) main::z +(byte) main::z#0 reg byte a 202.0 +(word()) mul8u((byte) mul8u::a , (byte) mul8u::b) +(byte~) mul8u::$1 reg byte a 2002.0 +(label) mul8u::@1 +(label) mul8u::@2 +(label) mul8u::@4 +(label) mul8u::@7 +(label) mul8u::@return +(byte) mul8u::a +(byte) mul8u::a#0 reg byte x 1001.0 +(byte) mul8u::a#1 reg byte x 2.0 +(byte) mul8u::a#2 reg byte x 667.6666666666667 +(byte) mul8u::b +(const byte) mul8u::b#0 b = (byte/signed byte/word/signed word/dword/signed dword) 40 +(word) mul8u::mb +(word) mul8u::mb#1 mb zp ZP_WORD:6 2002.0 +(word) mul8u::mb#2 mb zp ZP_WORD:6 429.0 +(word) mul8u::res +(word) mul8u::res#1 res zp ZP_WORD:4 2002.0 +(word) mul8u::res#2 res zp ZP_WORD:4 500.83333333333337 +(word) mul8u::res#6 res zp ZP_WORD:4 1001.0 +(word) mul8u::return +(word) mul8u::return#2 return zp ZP_WORD:4 4.0 +(byte*) screen +(const byte*) screen#0 screen = ((byte*))(word/signed word/dword/signed dword) 1024 +(byte*) tileset +(const byte*) tileset#0 tileset = ((byte*))(word/signed word/dword/signed dword) 10240 + +zp ZP_BYTE:2 [ main::x#4 main::x#1 ] +zp ZP_BYTE:3 [ main::y#2 main::y#1 ] +reg byte x [ mul8u::a#2 mul8u::a#1 mul8u::a#0 ] +zp ZP_WORD:4 [ mul8u::res#2 mul8u::res#6 mul8u::res#1 mul8u::return#2 draw_block::z#0 fill::addr#2 fill::addr#0 fill::addr#1 ] +zp ZP_WORD:6 [ mul8u::mb#2 mul8u::mb#1 fill::end#0 ] +reg byte x [ fill::val#3 ] +reg byte a [ main::z#0 ] +reg byte a [ main::tile#0 ] +reg byte a [ draw_block::tileno#0 ] +reg byte y [ draw_block::x#0 ] +reg byte x [ draw_block::y#0 ] +zp ZP_BYTE:8 [ draw_block::tileno#1 ] +reg byte a [ draw_block::$1 ] +zp ZP_WORD:9 [ draw_block::x1#0 draw_block::z#1 ] +reg byte a [ draw_block::y#1 ] +reg byte a [ draw_block::drawtile#0 ] +reg byte a [ mul8u::$1 ]