diff --git a/src/test/java/dk/camelot64/kickc/test/TestPrograms.java b/src/test/java/dk/camelot64/kickc/test/TestPrograms.java index 308d50ad8..8fe19db8f 100644 --- a/src/test/java/dk/camelot64/kickc/test/TestPrograms.java +++ b/src/test/java/dk/camelot64/kickc/test/TestPrograms.java @@ -44,6 +44,17 @@ public class TestPrograms { AsmFragmentTemplateUsages.logUsages(log, false, false, false, false, false, false); } + @Test + public void testInterruptVolatileReuseProblem() throws IOException, URISyntaxException { + compileAndCompare("interrupt-volatile-reuse-problem"); + } + + + @Test + public void testInitVolatiles() throws IOException, URISyntaxException { + compileAndCompare("init-volatiles"); + } + @Test public void testInterruptVolatileWrite() throws IOException, URISyntaxException { compileAndCompare("test-interrupt-volatile-write"); diff --git a/src/test/kc/examples/tetris/test-sprites.kc b/src/test/kc/examples/tetris/test-sprites.kc index d2134be2d..aeccd7499 100644 --- a/src/test/kc/examples/tetris/test-sprites.kc +++ b/src/test/kc/examples/tetris/test-sprites.kc @@ -1,12 +1,21 @@ import "c64" -byte* PLAYFIELD_SPRITES = $2000; -byte* PLAYFIELD_CHARSET = $1000; -byte* PLAYFIELD_SCREEN = $0400; +// Address of the sprites covering the playfield +const byte* PLAYFIELD_SPRITES = $2000; +// Address for the charset +const byte* PLAYFIELD_CHARSET = $1000; +// Address of the screen +const byte* PLAYFIELD_SCREEN = $0400; + +// Screen Sprite pointers +const byte* PLAYFIELD_SPRITE_PTRS = (PLAYFIELD_SCREEN+SPRITE_PTRS); void main() { init_sprites(); init_irq(); + while(true) { + (*PLAYFIELD_SCREEN)++; + } } // Setup the sprites @@ -15,33 +24,34 @@ void init_sprites() { *D018 = toD018(PLAYFIELD_SCREEN, PLAYFIELD_CHARSET); *SPRITES_ENABLE = %00001111; *SPRITES_EXPAND_X = *SPRITES_EXPAND_Y = *SPRITES_MC = 0; - byte* sprites_ptr = PLAYFIELD_SCREEN+SPRITE_PTRS; - byte xpos = 24+14*8; - byte ypos = 50; - byte ptr = toSpritePtr(PLAYFIELD_SPRITES); for(byte s:0..3) { byte s2 = s<<1; SPRITES_XPOS[s2] = xpos; - SPRITES_YPOS[s2] = ypos; SPRITES_COLS[s] = BLACK; - sprites_ptr[s] = ptr; xpos = xpos+24; - ptr++; } } -// The line of the first IRQ - $30 is 2 lines before the start of the screen -const byte IRQ_RASTER_FIRST = $30; +// The line of the first IRQ - 48 is 2 lines before the start of the screen +const byte IRQ_RASTER_FIRST = 48; // The raster line of the next IRQ volatile byte irq_raster_next = IRQ_RASTER_FIRST; -// Counting the 10 IRQs -volatile byte irq_cnt = 0; // Y-pos of the sprites on the next IRQ volatile byte irq_sprite_ypos = 50; +// Y-pos of the sprites on the next IRQ +volatile byte irq_sprite_ptr = toSpritePtr(PLAYFIELD_SPRITES); +// Counting the 10 IRQs +volatile byte irq_cnt = 0; // Setup the IRQ void init_irq() { + // Stup the first IRQ position + irq_raster_next = IRQ_RASTER_FIRST; + irq_sprite_ypos = 50; + irq_sprite_ptr = toSpritePtr(PLAYFIELD_SPRITES); + irq_cnt = 0; + asm { sei } // Disable CIA 1 Timer IRQ *CIA1_INTERRUPT = CIA_INTERRUPT_CLEAR; @@ -60,7 +70,7 @@ void init_irq() { // Repeats 10 timers every 21 lines from line IRQ_RASTER_FIRST interrupt(kernel_min) void irq() { - *BORDERCOL = *BGCOL = WHITE; + *BORDERCOL = DARK_GREY; // Place the sprites SPRITES_YPOS[0] = irq_sprite_ypos; @@ -68,14 +78,27 @@ interrupt(kernel_min) void irq() { SPRITES_YPOS[4] = irq_sprite_ypos; SPRITES_YPOS[6] = irq_sprite_ypos; + // Wait for the y-position before changing sprite pointers + do { + } while(*RASTER!=irq_sprite_ypos); + + byte ptr = irq_sprite_ptr; + PLAYFIELD_SPRITE_PTRS[0] = ptr++; + PLAYFIELD_SPRITE_PTRS[1] = ptr; + PLAYFIELD_SPRITE_PTRS[2] = ptr++; + PLAYFIELD_SPRITE_PTRS[3] = ptr; + // Find next raster line / sprite positions if(++irq_cnt==10) { irq_cnt = 0; irq_raster_next = IRQ_RASTER_FIRST; irq_sprite_ypos = 50; + irq_sprite_ptr = toSpritePtr(PLAYFIELD_SPRITES); + } else { irq_raster_next += 21; - irq_sprite_ypos += 21; + irq_sprite_ypos += 21; + irq_sprite_ptr += 3; } // Acknowledge the IRQ and setup the next one @@ -83,7 +106,6 @@ interrupt(kernel_min) void irq() { *IRQ_STATUS = IRQ_RASTER; *BORDERCOL = BLACK; - *BGCOL = BLUE; } diff --git a/src/test/kc/init-volatiles.kc b/src/test/kc/init-volatiles.kc new file mode 100644 index 000000000..eedb0df0c --- /dev/null +++ b/src/test/kc/init-volatiles.kc @@ -0,0 +1,10 @@ +// Illustrates a problem where volatiles with initializers are initialized outside the main()-routine +volatile byte x = 12; +void main() { + while(++x<50) { + } + x = 0; +} + + + diff --git a/src/test/kc/interrupt-volatile-reuse-problem.kc b/src/test/kc/interrupt-volatile-reuse-problem.kc new file mode 100644 index 000000000..8a034c5f4 --- /dev/null +++ b/src/test/kc/interrupt-volatile-reuse-problem.kc @@ -0,0 +1,28 @@ +// Illustrates problem where volatiles reuse ZP addresses of other variables - and reuses the same address for multiple volatiles +const void()** KERNEL_IRQ = $0314; +const byte* BORDERCOL = $d021; +const byte* BGCOL = $d020; +volatile byte col1 = 0; +volatile byte col2 = 8; +void main() { + byte* SCREEN=$400; + byte qwe = 32; + byte asd = 0; + byte row = 12; + for(byte x:0..10) { + SCREEN[x] = ++row; + ++qwe; + asd += qwe; + } + SCREEN[0] = qwe; + SCREEN[1] = asd; + *KERNEL_IRQ = &irq; +} + +interrupt(kernel_min) void irq() { + asm { + lda $dc0d + } + *BGCOL = col1++; + *BORDERCOL = col2++; +} diff --git a/src/test/ref/examples/tetris/test-sprites.asm b/src/test/ref/examples/tetris/test-sprites.asm index e6fee941a..b1f967000 100644 --- a/src/test/ref/examples/tetris/test-sprites.asm +++ b/src/test/ref/examples/tetris/test-sprites.asm @@ -10,7 +10,6 @@ .label SPRITES_MC = $d01c .label SPRITES_EXPAND_X = $d01d .label BORDERCOL = $d020 - .label BGCOL = $d021 .label SPRITES_COLS = $d027 .label VIC_CONTROL = $d011 .label D018 = $d018 @@ -23,28 +22,43 @@ .label CIA2_PORT_A_DDR = $dd02 .label KERNEL_IRQ = $314 .const BLACK = 0 - .const WHITE = 1 - .const BLUE = 6 + .const DARK_GREY = $b .label PLAYFIELD_SPRITES = $2000 .label PLAYFIELD_CHARSET = $1000 .label PLAYFIELD_SCREEN = $400 .const IRQ_RASTER_FIRST = $30 + .label PLAYFIELD_SPRITE_PTRS = PLAYFIELD_SCREEN+SPRITE_PTRS + .const toSpritePtr1_return = PLAYFIELD_SPRITES>>6 .label irq_raster_next = 2 - .label irq_cnt = 2 .label irq_sprite_ypos = 2 + .label irq_sprite_ptr = 2 + .label irq_cnt = 2 lda #IRQ_RASTER_FIRST sta irq_raster_next - lda #0 - sta irq_cnt lda #$32 sta irq_sprite_ypos + lda #toSpritePtr1_return + sta irq_sprite_ptr + lda #0 + sta irq_cnt jsr main main: { jsr init_sprites jsr init_irq - rts + b2: + inc PLAYFIELD_SCREEN + jmp b2 } init_irq: { + .const toSpritePtr2_return = PLAYFIELD_SPRITES>>6 + lda #IRQ_RASTER_FIRST + sta irq_raster_next + lda #$32 + sta irq_sprite_ypos + lda #toSpritePtr2_return + sta irq_sprite_ptr + lda #0 + sta irq_cnt sei lda #CIA_INTERRUPT_CLEAR sta CIA1_INTERRUPT @@ -63,13 +77,9 @@ init_irq: { rts } init_sprites: { - .const ypos = $32 - .label sprites_ptr = PLAYFIELD_SCREEN+SPRITE_PTRS - .const toSpritePtr1_return = PLAYFIELD_SPRITES>>6 .const vicSelectGfxBank1_toDd001_return = 3^(>PLAYFIELD_SCREEN)>>6 .const toD0181_return = (>(PLAYFIELD_SCREEN&$3fff)<<2)|(>PLAYFIELD_CHARSET)>>2&$f .label xpos = 2 - .label ptr = 3 lda #3 sta CIA2_PORT_A_DDR lda #vicSelectGfxBank1_toDd001_return @@ -82,36 +92,29 @@ init_sprites: { sta SPRITES_MC sta SPRITES_EXPAND_Y sta SPRITES_EXPAND_X - lda #toSpritePtr1_return - sta ptr lda #$18+$e*8 sta xpos - ldy #0 + ldx #0 b1: - tya + txa asl - tax + tay lda xpos - sta SPRITES_XPOS,x - lda #ypos - sta SPRITES_YPOS,x + sta SPRITES_XPOS,y lda #BLACK - sta SPRITES_COLS,y - lda ptr - sta sprites_ptr,y + sta SPRITES_COLS,x lda #$18 clc adc xpos sta xpos - inc ptr - iny - cpy #4 + inx + cpx #4 bne b1 rts } irq: { - lda #WHITE - sta BGCOL + .const toSpritePtr2_return = PLAYFIELD_SPRITES>>6 + lda #DARK_GREY sta BORDERCOL lda irq_sprite_ypos sta SPRITES_YPOS @@ -121,10 +124,21 @@ irq: { sta SPRITES_YPOS+4 lda irq_sprite_ypos sta SPRITES_YPOS+6 + b1: + lda RASTER + cmp irq_sprite_ypos + bne b1 + ldx irq_sprite_ptr + stx PLAYFIELD_SPRITE_PTRS + inx + stx PLAYFIELD_SPRITE_PTRS+1 + stx PLAYFIELD_SPRITE_PTRS+2 + inx + stx PLAYFIELD_SPRITE_PTRS+3 inc irq_cnt lda irq_cnt cmp #$a - beq b1 + beq b2 lda #$15 clc adc irq_raster_next @@ -133,24 +147,28 @@ irq: { clc adc irq_sprite_ypos sta irq_sprite_ypos - b2: + lda #3 + clc + adc irq_sprite_ptr + sta irq_sprite_ptr + b3: lda irq_raster_next sta RASTER lda #IRQ_RASTER sta IRQ_STATUS lda #BLACK sta BORDERCOL - lda #BLUE - sta BGCOL jmp $ea81 - b1: + b2: lda #0 sta irq_cnt lda #IRQ_RASTER_FIRST sta irq_raster_next lda #$32 sta irq_sprite_ypos - jmp b2 + lda #toSpritePtr2_return + sta irq_sprite_ptr + jmp b3 } .pc = PLAYFIELD_SPRITES "Inline" .var sprites = LoadPicture("nes-playfield.png", List().add($010101, $000000)) diff --git a/src/test/ref/examples/tetris/test-sprites.cfg b/src/test/ref/examples/tetris/test-sprites.cfg index 6777f8e66..54ea244db 100644 --- a/src/test/ref/examples/tetris/test-sprites.cfg +++ b/src/test/ref/examples/tetris/test-sprites.cfg @@ -2,11 +2,17 @@ [0] phi() to:@6 @6: scope:[] from @begin - [1] (byte) irq_raster_next#0 ← (const byte) IRQ_RASTER_FIRST#0 - [2] (byte) irq_cnt#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 - [3] (byte) irq_sprite_ypos#0 ← (byte/signed byte/word/signed word/dword/signed dword) 50 + [1] (byte) irq_raster_next#2 ← (const byte) IRQ_RASTER_FIRST#0 + [2] (byte) irq_sprite_ypos#2 ← (byte/signed byte/word/signed word/dword/signed dword) 50 + to:toSpritePtr1 +toSpritePtr1: scope:[] from @6 + [3] phi() + to:@9 +@9: scope:[] from toSpritePtr1 + [4] (byte) irq_sprite_ptr#2 ← (const byte) toSpritePtr1_return#0 + [5] (byte) irq_cnt#19 ← (byte/signed byte/word/signed word/dword/signed dword) 0 to:@8 -@8: scope:[] from @6 +@8: scope:[] from @9 kickasm(location (const byte*) PLAYFIELD_SPRITES#0) {{ .var sprites = LoadPicture("nes-playfield.png", List().add($010101, $000000)) .for(var sy=0;sy<10;sy++) { .for(var sx=0;sx<3;sx++) { @@ -19,101 +25,120 @@ } } }} - [5] call main + [7] call main to:@end @end: scope:[] from @8 - [6] phi() + [8] phi() main: scope:[main] from @8 - [7] phi() - [8] call init_sprites - to:main::@1 -main::@1: scope:[main] from main [9] phi() - [10] call init_irq - to:main::@return -main::@return: scope:[main] from main::@1 - [11] return - to:@return -init_irq: scope:[init_irq] from main::@1 + [10] call init_sprites + to:main::@7 +main::@7: scope:[main] from main + [11] phi() + [12] call init_irq + to:main::@2 +main::@2: scope:[main] from main::@2 main::@7 + [13] *((const byte*) PLAYFIELD_SCREEN#0) ← ++ *((const byte*) PLAYFIELD_SCREEN#0) + to:main::@2 +init_irq: scope:[init_irq] from main::@7 + [14] (byte) irq_raster_next#11 ← (const byte) IRQ_RASTER_FIRST#0 + [15] (byte) irq_sprite_ypos#11 ← (byte/signed byte/word/signed word/dword/signed dword) 50 + to:init_irq::toSpritePtr2 +init_irq::toSpritePtr2: scope:[init_irq] from init_irq + [16] phi() + to:init_irq::@1 +init_irq::@1: scope:[init_irq] from init_irq::toSpritePtr2 + [17] (byte) irq_sprite_ptr#3 ← (const byte) init_irq::toSpritePtr2_return#0 + [18] (byte) irq_cnt#11 ← (byte/signed byte/word/signed word/dword/signed dword) 0 asm { sei } - [13] *((const byte*) CIA1_INTERRUPT#0) ← (const byte) CIA_INTERRUPT_CLEAR#0 - [14] *((const byte*) VIC_CONTROL#0) ← *((const byte*) VIC_CONTROL#0) & (byte/signed byte/word/signed word/dword/signed dword) 127 - [15] *((const byte*) RASTER#0) ← (const byte) IRQ_RASTER_FIRST#0 - [16] *((const byte*) IRQ_ENABLE#0) ← (const byte) IRQ_RASTER#0 - [17] *((const void()**) KERNEL_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq() + [20] *((const byte*) CIA1_INTERRUPT#0) ← (const byte) CIA_INTERRUPT_CLEAR#0 + [21] *((const byte*) VIC_CONTROL#0) ← *((const byte*) VIC_CONTROL#0) & (byte/signed byte/word/signed word/dword/signed dword) 127 + [22] *((const byte*) RASTER#0) ← (const byte) IRQ_RASTER_FIRST#0 + [23] *((const byte*) IRQ_ENABLE#0) ← (const byte) IRQ_RASTER#0 + [24] *((const void()**) KERNEL_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq() asm { cli } to:init_irq::@return -init_irq::@return: scope:[init_irq] from init_irq - [19] return +init_irq::@return: scope:[init_irq] from init_irq::@1 + [26] return to:@return init_sprites: scope:[init_sprites] from main - [20] phi() + [27] phi() to:init_sprites::vicSelectGfxBank1 init_sprites::vicSelectGfxBank1: scope:[init_sprites] from init_sprites - [21] *((const byte*) CIA2_PORT_A_DDR#0) ← (byte/signed byte/word/signed word/dword/signed dword) 3 + [28] *((const byte*) CIA2_PORT_A_DDR#0) ← (byte/signed byte/word/signed word/dword/signed dword) 3 to:init_sprites::vicSelectGfxBank1_toDd001 init_sprites::vicSelectGfxBank1_toDd001: scope:[init_sprites] from init_sprites::vicSelectGfxBank1 - [22] phi() + [29] phi() to:init_sprites::vicSelectGfxBank1_@1 init_sprites::vicSelectGfxBank1_@1: scope:[init_sprites] from init_sprites::vicSelectGfxBank1_toDd001 - [23] *((const byte*) CIA2_PORT_A#0) ← (const byte) init_sprites::vicSelectGfxBank1_toDd001_return#0 + [30] *((const byte*) CIA2_PORT_A#0) ← (const byte) init_sprites::vicSelectGfxBank1_toDd001_return#0 to:init_sprites::toD0181 init_sprites::toD0181: scope:[init_sprites] from init_sprites::vicSelectGfxBank1_@1 - [24] phi() + [31] phi() to:init_sprites::@4 init_sprites::@4: scope:[init_sprites] from init_sprites::toD0181 - [25] *((const byte*) D018#0) ← (const byte) init_sprites::toD0181_return#0 - [26] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 15 - [27] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 - [28] *((const byte*) SPRITES_EXPAND_Y#0) ← *((const byte*) SPRITES_MC#0) - [29] *((const byte*) SPRITES_EXPAND_X#0) ← *((const byte*) SPRITES_EXPAND_Y#0) - to:init_sprites::toSpritePtr1 -init_sprites::toSpritePtr1: scope:[init_sprites] from init_sprites::@4 - [30] phi() + [32] *((const byte*) D018#0) ← (const byte) init_sprites::toD0181_return#0 + [33] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 15 + [34] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 + [35] *((const byte*) SPRITES_EXPAND_Y#0) ← *((const byte*) SPRITES_MC#0) + [36] *((const byte*) SPRITES_EXPAND_X#0) ← *((const byte*) SPRITES_EXPAND_Y#0) to:init_sprites::@1 -init_sprites::@1: scope:[init_sprites] from init_sprites::@1 init_sprites::toSpritePtr1 - [31] (byte) init_sprites::ptr#2 ← phi( init_sprites::@1/(byte) init_sprites::ptr#1 init_sprites::toSpritePtr1/(const byte) init_sprites::toSpritePtr1_return#0 ) - [31] (byte) init_sprites::xpos#2 ← phi( init_sprites::@1/(byte) init_sprites::xpos#1 init_sprites::toSpritePtr1/(byte/signed byte/word/signed word/dword/signed dword) 24+(byte/signed byte/word/signed word/dword/signed dword) 14*(byte/signed byte/word/signed word/dword/signed dword) 8 ) - [31] (byte) init_sprites::s#2 ← phi( init_sprites::@1/(byte) init_sprites::s#1 init_sprites::toSpritePtr1/(byte/signed byte/word/signed word/dword/signed dword) 0 ) - [32] (byte) init_sprites::s2#0 ← (byte) init_sprites::s#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 - [33] *((const byte*) SPRITES_XPOS#0 + (byte) init_sprites::s2#0) ← (byte) init_sprites::xpos#2 - [34] *((const byte*) SPRITES_YPOS#0 + (byte) init_sprites::s2#0) ← (const byte) init_sprites::ypos#0 - [35] *((const byte*) SPRITES_COLS#0 + (byte) init_sprites::s#2) ← (const byte) BLACK#0 - [36] *((const byte*) init_sprites::sprites_ptr#0 + (byte) init_sprites::s#2) ← (byte) init_sprites::ptr#2 - [37] (byte) init_sprites::xpos#1 ← (byte) init_sprites::xpos#2 + (byte/signed byte/word/signed word/dword/signed dword) 24 - [38] (byte) init_sprites::ptr#1 ← ++ (byte) init_sprites::ptr#2 - [39] (byte) init_sprites::s#1 ← ++ (byte) init_sprites::s#2 - [40] if((byte) init_sprites::s#1!=(byte/signed byte/word/signed word/dword/signed dword) 4) goto init_sprites::@1 +init_sprites::@1: scope:[init_sprites] from init_sprites::@1 init_sprites::@4 + [37] (byte) init_sprites::xpos#2 ← phi( init_sprites::@1/(byte) init_sprites::xpos#1 init_sprites::@4/(byte/signed byte/word/signed word/dword/signed dword) 24+(byte/signed byte/word/signed word/dword/signed dword) 14*(byte/signed byte/word/signed word/dword/signed dword) 8 ) + [37] (byte) init_sprites::s#2 ← phi( init_sprites::@1/(byte) init_sprites::s#1 init_sprites::@4/(byte/signed byte/word/signed word/dword/signed dword) 0 ) + [38] (byte) init_sprites::s2#0 ← (byte) init_sprites::s#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 + [39] *((const byte*) SPRITES_XPOS#0 + (byte) init_sprites::s2#0) ← (byte) init_sprites::xpos#2 + [40] *((const byte*) SPRITES_COLS#0 + (byte) init_sprites::s#2) ← (const byte) BLACK#0 + [41] (byte) init_sprites::xpos#1 ← (byte) init_sprites::xpos#2 + (byte/signed byte/word/signed word/dword/signed dword) 24 + [42] (byte) init_sprites::s#1 ← ++ (byte) init_sprites::s#2 + [43] if((byte) init_sprites::s#1!=(byte/signed byte/word/signed word/dword/signed dword) 4) goto init_sprites::@1 to:init_sprites::@return init_sprites::@return: scope:[init_sprites] from init_sprites::@1 - [41] return + [44] return to:@return irq: scope:[irq] from - [42] *((const byte*) BGCOL#0) ← (const byte) WHITE#0 - [43] *((const byte*) BORDERCOL#0) ← *((const byte*) BGCOL#0) - [44] *((const byte*) SPRITES_YPOS#0) ← (byte) irq_sprite_ypos#0 - [45] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq_sprite_ypos#0 - [46] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 4) ← (byte) irq_sprite_ypos#0 - [47] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 6) ← (byte) irq_sprite_ypos#0 - [48] (byte) irq_cnt#1 ← ++ (byte) irq_cnt#0 - [49] if((byte) irq_cnt#1==(byte/signed byte/word/signed word/dword/signed dword) 10) goto irq::@1 + [45] *((const byte*) BORDERCOL#0) ← (const byte) DARK_GREY#0 + [46] *((const byte*) SPRITES_YPOS#0) ← (byte) irq_sprite_ypos#2 + [47] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq_sprite_ypos#2 + [48] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 4) ← (byte) irq_sprite_ypos#2 + [49] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 6) ← (byte) irq_sprite_ypos#2 + to:irq::@1 +irq::@1: scope:[irq] from irq irq::@1 + [50] if(*((const byte*) RASTER#0)!=(byte) irq_sprite_ypos#2) goto irq::@1 + to:irq::@4 +irq::@4: scope:[irq] from irq::@1 + [51] (byte) irq::ptr#0 ← (byte) irq_sprite_ptr#2 + [52] *((const byte*) PLAYFIELD_SPRITE_PTRS#0) ← (byte) irq::ptr#0 + [53] (byte) irq::ptr#1 ← ++ (byte) irq::ptr#0 + [54] *((const byte*) PLAYFIELD_SPRITE_PTRS#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) irq::ptr#1 + [55] *((const byte*) PLAYFIELD_SPRITE_PTRS#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq::ptr#1 + [56] (byte) irq::ptr#2 ← ++ (byte) irq::ptr#1 + [57] *((const byte*) PLAYFIELD_SPRITE_PTRS#0+(byte/signed byte/word/signed word/dword/signed dword) 3) ← (byte) irq::ptr#2 + [58] (byte) irq_cnt#23 ← ++ (byte) irq_cnt#19 + [59] if((byte) irq_cnt#23==(byte/signed byte/word/signed word/dword/signed dword) 10) goto irq::@2 + to:irq::@5 +irq::@5: scope:[irq] from irq::@4 + [60] (byte) irq_raster_next#6 ← (byte) irq_raster_next#2 + (byte/signed byte/word/signed word/dword/signed dword) 21 + [61] (byte) irq_sprite_ypos#6 ← (byte) irq_sprite_ypos#2 + (byte/signed byte/word/signed word/dword/signed dword) 21 + [62] (byte) irq_sprite_ptr#6 ← (byte) irq_sprite_ptr#2 + (byte/signed byte/word/signed word/dword/signed dword) 3 to:irq::@3 -irq::@3: scope:[irq] from irq - [50] (byte) irq_raster_next#2 ← (byte) irq_raster_next#0 + (byte/signed byte/word/signed word/dword/signed dword) 21 - [51] (byte) irq_sprite_ypos#2 ← (byte) irq_sprite_ypos#0 + (byte/signed byte/word/signed word/dword/signed dword) 21 - to:irq::@2 -irq::@2: scope:[irq] from irq::@1 irq::@3 - [52] (byte) irq_raster_next#3 ← phi( irq::@1/(byte) irq_raster_next#1 irq::@3/(byte) irq_raster_next#2 ) - [53] *((const byte*) RASTER#0) ← (byte) irq_raster_next#3 - [54] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0 - [55] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 - [56] *((const byte*) BGCOL#0) ← (const byte) BLUE#0 +irq::@3: scope:[irq] from irq::@5 irq::@7 + [63] (byte) irq_raster_next#13 ← phi( irq::@5/(byte) irq_raster_next#6 irq::@7/(byte) irq_raster_next#20 ) + [64] *((const byte*) RASTER#0) ← (byte) irq_raster_next#13 + [65] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0 + [66] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 to:irq::@return -irq::@return: scope:[irq] from irq::@2 - [57] return +irq::@return: scope:[irq] from irq::@3 + [67] return to:@return -irq::@1: scope:[irq] from irq - [58] (byte) irq_cnt#2 ← (byte/signed byte/word/signed word/dword/signed dword) 0 - [59] (byte) irq_raster_next#1 ← (const byte) IRQ_RASTER_FIRST#0 - [60] (byte) irq_sprite_ypos#1 ← (byte/signed byte/word/signed word/dword/signed dword) 50 - to:irq::@2 +irq::@2: scope:[irq] from irq::@4 + [68] (byte) irq_cnt#24 ← (byte/signed byte/word/signed word/dword/signed dword) 0 + [69] (byte) irq_raster_next#20 ← (const byte) IRQ_RASTER_FIRST#0 + [70] (byte) irq_sprite_ypos#26 ← (byte/signed byte/word/signed word/dword/signed dword) 50 + to:irq::toSpritePtr2 +irq::toSpritePtr2: scope:[irq] from irq::@2 + [71] phi() + to:irq::@7 +irq::@7: scope:[irq] from irq::toSpritePtr2 + [72] (byte) irq_sprite_ptr#5 ← (const byte) irq::toSpritePtr2_return#0 + to:irq::@3 diff --git a/src/test/ref/examples/tetris/test-sprites.log b/src/test/ref/examples/tetris/test-sprites.log index 1de689b36..1db9f13ce 100644 --- a/src/test/ref/examples/tetris/test-sprites.log +++ b/src/test/ref/examples/tetris/test-sprites.log @@ -2,7 +2,9 @@ Resolved forward reference irq to interrupt(KERNEL_MIN)(void()) irq() Inlined call (byte~) vicSelectGfxBank::$0 ← call toDd00 (byte*) vicSelectGfxBank::gfx Inlined call call vicSelectGfxBank (byte*) PLAYFIELD_SCREEN Inlined call (byte~) init_sprites::$1 ← call toD018 (byte*) PLAYFIELD_SCREEN (byte*) PLAYFIELD_CHARSET -Inlined call (byte~) init_sprites::$5 ← call toSpritePtr (byte*) PLAYFIELD_SPRITES +Inlined call (byte~) $1 ← call toSpritePtr (byte*) PLAYFIELD_SPRITES +Inlined call (byte~) init_irq::$0 ← call toSpritePtr (byte*) PLAYFIELD_SPRITES +Inlined call (byte~) irq::$2 ← call toSpritePtr (byte*) PLAYFIELD_SPRITES CONTROL FLOW GRAPH SSA @begin: scope:[] from @@ -90,39 +92,67 @@ CONTROL FLOW GRAPH SSA (byte*) PLAYFIELD_SPRITES#0 ← ((byte*)) (word/signed word/dword/signed dword) 8192 (byte*) PLAYFIELD_CHARSET#0 ← ((byte*)) (word/signed word/dword/signed dword) 4096 (byte*) PLAYFIELD_SCREEN#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024 + (byte*~) $0 ← (byte*) PLAYFIELD_SCREEN#0 + (word) SPRITE_PTRS#0 + (byte*) PLAYFIELD_SPRITE_PTRS#0 ← (byte*~) $0 to:@6 main: scope:[main] from @8 - (byte*) PLAYFIELD_SPRITES#12 ← phi( @8/(byte*) PLAYFIELD_SPRITES#2 ) - (byte*) PLAYFIELD_CHARSET#7 ← phi( @8/(byte*) PLAYFIELD_CHARSET#8 ) - (byte*) PLAYFIELD_SCREEN#4 ← phi( @8/(byte*) PLAYFIELD_SCREEN#7 ) + (byte) irq_cnt#20 ← phi( @8/(byte) irq_cnt#19 ) + (byte) irq_sprite_ptr#21 ← phi( @8/(byte) irq_sprite_ptr#20 ) + (byte) irq_sprite_ypos#23 ← phi( @8/(byte) irq_sprite_ypos#20 ) + (byte) irq_raster_next#22 ← phi( @8/(byte) irq_raster_next#21 ) call init_sprites - to:main::@1 -main::@1: scope:[main] from main + to:main::@7 +main::@7: scope:[main] from main + (byte) irq_cnt#15 ← phi( main/(byte) irq_cnt#20 ) + (byte) irq_sprite_ptr#16 ← phi( main/(byte) irq_sprite_ptr#21 ) + (byte) irq_sprite_ypos#17 ← phi( main/(byte) irq_sprite_ypos#23 ) + (byte) irq_raster_next#16 ← phi( main/(byte) irq_raster_next#22 ) call init_irq - to:main::@2 -main::@2: scope:[main] from main::@1 + to:main::@8 +main::@8: scope:[main] from main::@7 + (byte) irq_cnt#9 ← phi( main::@7/(byte) irq_cnt#4 ) + (byte) irq_sprite_ptr#9 ← phi( main::@7/(byte) irq_sprite_ptr#4 ) + (byte) irq_sprite_ypos#9 ← phi( main::@7/(byte) irq_sprite_ypos#4 ) + (byte) irq_raster_next#9 ← phi( main::@7/(byte) irq_raster_next#4 ) + (byte) irq_raster_next#0 ← (byte) irq_raster_next#9 + (byte) irq_sprite_ypos#0 ← (byte) irq_sprite_ypos#9 + (byte) irq_sprite_ptr#0 ← (byte) irq_sprite_ptr#9 + (byte) irq_cnt#0 ← (byte) irq_cnt#9 + to:main::@1 +main::@1: scope:[main] from main::@2 main::@8 + (byte) irq_cnt#16 ← phi( main::@2/(byte) irq_cnt#21 main::@8/(byte) irq_cnt#0 ) + (byte) irq_sprite_ptr#17 ← phi( main::@2/(byte) irq_sprite_ptr#22 main::@8/(byte) irq_sprite_ptr#0 ) + (byte) irq_sprite_ypos#18 ← phi( main::@2/(byte) irq_sprite_ypos#24 main::@8/(byte) irq_sprite_ypos#0 ) + (byte) irq_raster_next#17 ← phi( main::@2/(byte) irq_raster_next#23 main::@8/(byte) irq_raster_next#0 ) + if(true) goto main::@2 to:main::@return -main::@return: scope:[main] from main::@2 +main::@2: scope:[main] from main::@1 + (byte) irq_cnt#21 ← phi( main::@1/(byte) irq_cnt#16 ) + (byte) irq_sprite_ptr#22 ← phi( main::@1/(byte) irq_sprite_ptr#17 ) + (byte) irq_sprite_ypos#24 ← phi( main::@1/(byte) irq_sprite_ypos#18 ) + (byte) irq_raster_next#23 ← phi( main::@1/(byte) irq_raster_next#17 ) + *((byte*) PLAYFIELD_SCREEN#0) ← ++ *((byte*) PLAYFIELD_SCREEN#0) + to:main::@1 +main::@return: scope:[main] from main::@1 + (byte) irq_cnt#10 ← phi( main::@1/(byte) irq_cnt#16 ) + (byte) irq_sprite_ptr#10 ← phi( main::@1/(byte) irq_sprite_ptr#17 ) + (byte) irq_sprite_ypos#10 ← phi( main::@1/(byte) irq_sprite_ypos#18 ) + (byte) irq_raster_next#10 ← phi( main::@1/(byte) irq_raster_next#17 ) + (byte) irq_raster_next#1 ← (byte) irq_raster_next#10 + (byte) irq_sprite_ypos#1 ← (byte) irq_sprite_ypos#10 + (byte) irq_sprite_ptr#1 ← (byte) irq_sprite_ptr#10 + (byte) irq_cnt#1 ← (byte) irq_cnt#10 return to:@return init_sprites: scope:[init_sprites] from main - (byte*) PLAYFIELD_SPRITES#11 ← phi( main/(byte*) PLAYFIELD_SPRITES#12 ) - (byte*) PLAYFIELD_CHARSET#6 ← phi( main/(byte*) PLAYFIELD_CHARSET#7 ) - (byte*) PLAYFIELD_SCREEN#1 ← phi( main/(byte*) PLAYFIELD_SCREEN#4 ) - (byte*) init_sprites::vicSelectGfxBank1_gfx#0 ← (byte*) PLAYFIELD_SCREEN#1 + (byte*) init_sprites::vicSelectGfxBank1_gfx#0 ← (byte*) PLAYFIELD_SCREEN#0 to:init_sprites::vicSelectGfxBank1 init_sprites::vicSelectGfxBank1: scope:[init_sprites] from init_sprites - (byte*) PLAYFIELD_SPRITES#10 ← phi( init_sprites/(byte*) PLAYFIELD_SPRITES#11 ) - (byte*) PLAYFIELD_CHARSET#5 ← phi( init_sprites/(byte*) PLAYFIELD_CHARSET#6 ) - (byte*) PLAYFIELD_SCREEN#12 ← phi( init_sprites/(byte*) PLAYFIELD_SCREEN#1 ) (byte*) init_sprites::vicSelectGfxBank1_gfx#1 ← phi( init_sprites/(byte*) init_sprites::vicSelectGfxBank1_gfx#0 ) *((byte*) CIA2_PORT_A_DDR#0) ← (byte/signed byte/word/signed word/dword/signed dword) 3 (byte*) init_sprites::vicSelectGfxBank1_toDd001_gfx#0 ← (byte*) init_sprites::vicSelectGfxBank1_gfx#1 to:init_sprites::vicSelectGfxBank1_toDd001 init_sprites::vicSelectGfxBank1_toDd001: scope:[init_sprites] from init_sprites::vicSelectGfxBank1 - (byte*) PLAYFIELD_SPRITES#9 ← phi( init_sprites::vicSelectGfxBank1/(byte*) PLAYFIELD_SPRITES#10 ) - (byte*) PLAYFIELD_CHARSET#4 ← phi( init_sprites::vicSelectGfxBank1/(byte*) PLAYFIELD_CHARSET#5 ) - (byte*) PLAYFIELD_SCREEN#10 ← phi( init_sprites::vicSelectGfxBank1/(byte*) PLAYFIELD_SCREEN#12 ) (byte*) init_sprites::vicSelectGfxBank1_toDd001_gfx#1 ← phi( init_sprites::vicSelectGfxBank1/(byte*) init_sprites::vicSelectGfxBank1_toDd001_gfx#0 ) (word) init_sprites::vicSelectGfxBank1_toDd001_$0#0 ← ((word)) (byte*) init_sprites::vicSelectGfxBank1_toDd001_gfx#1 (byte) init_sprites::vicSelectGfxBank1_toDd001_$1#0 ← > (word) init_sprites::vicSelectGfxBank1_toDd001_$0#0 @@ -131,30 +161,19 @@ init_sprites::vicSelectGfxBank1_toDd001: scope:[init_sprites] from init_sprites (byte) init_sprites::vicSelectGfxBank1_toDd001_return#0 ← (byte/word/dword) init_sprites::vicSelectGfxBank1_toDd001_$3#0 to:init_sprites::vicSelectGfxBank1_toDd001_@return init_sprites::vicSelectGfxBank1_toDd001_@return: scope:[init_sprites] from init_sprites::vicSelectGfxBank1_toDd001 - (byte*) PLAYFIELD_SPRITES#8 ← phi( init_sprites::vicSelectGfxBank1_toDd001/(byte*) PLAYFIELD_SPRITES#9 ) - (byte*) PLAYFIELD_CHARSET#3 ← phi( init_sprites::vicSelectGfxBank1_toDd001/(byte*) PLAYFIELD_CHARSET#4 ) - (byte*) PLAYFIELD_SCREEN#8 ← phi( init_sprites::vicSelectGfxBank1_toDd001/(byte*) PLAYFIELD_SCREEN#10 ) (byte) init_sprites::vicSelectGfxBank1_toDd001_return#2 ← phi( init_sprites::vicSelectGfxBank1_toDd001/(byte) init_sprites::vicSelectGfxBank1_toDd001_return#0 ) (byte) init_sprites::vicSelectGfxBank1_toDd001_return#1 ← (byte) init_sprites::vicSelectGfxBank1_toDd001_return#2 to:init_sprites::vicSelectGfxBank1_@1 init_sprites::vicSelectGfxBank1_@1: scope:[init_sprites] from init_sprites::vicSelectGfxBank1_toDd001_@return - (byte*) PLAYFIELD_SPRITES#7 ← phi( init_sprites::vicSelectGfxBank1_toDd001_@return/(byte*) PLAYFIELD_SPRITES#8 ) - (byte*) PLAYFIELD_CHARSET#2 ← phi( init_sprites::vicSelectGfxBank1_toDd001_@return/(byte*) PLAYFIELD_CHARSET#3 ) - (byte*) PLAYFIELD_SCREEN#5 ← phi( init_sprites::vicSelectGfxBank1_toDd001_@return/(byte*) PLAYFIELD_SCREEN#8 ) (byte) init_sprites::vicSelectGfxBank1_toDd001_return#3 ← phi( init_sprites::vicSelectGfxBank1_toDd001_@return/(byte) init_sprites::vicSelectGfxBank1_toDd001_return#1 ) (byte) init_sprites::vicSelectGfxBank1_$0#0 ← (byte) init_sprites::vicSelectGfxBank1_toDd001_return#3 *((byte*) CIA2_PORT_A#0) ← (byte) init_sprites::vicSelectGfxBank1_$0#0 to:init_sprites::@3 init_sprites::@3: scope:[init_sprites] from init_sprites::vicSelectGfxBank1_@1 - (byte*) PLAYFIELD_SPRITES#6 ← phi( init_sprites::vicSelectGfxBank1_@1/(byte*) PLAYFIELD_SPRITES#7 ) - (byte*) PLAYFIELD_CHARSET#1 ← phi( init_sprites::vicSelectGfxBank1_@1/(byte*) PLAYFIELD_CHARSET#2 ) - (byte*) PLAYFIELD_SCREEN#2 ← phi( init_sprites::vicSelectGfxBank1_@1/(byte*) PLAYFIELD_SCREEN#5 ) - (byte*) init_sprites::toD0181_screen#0 ← (byte*) PLAYFIELD_SCREEN#2 - (byte*) init_sprites::toD0181_gfx#0 ← (byte*) PLAYFIELD_CHARSET#1 + (byte*) init_sprites::toD0181_screen#0 ← (byte*) PLAYFIELD_SCREEN#0 + (byte*) init_sprites::toD0181_gfx#0 ← (byte*) PLAYFIELD_CHARSET#0 to:init_sprites::toD0181 init_sprites::toD0181: scope:[init_sprites] from init_sprites::@3 - (byte*) PLAYFIELD_SPRITES#5 ← phi( init_sprites::@3/(byte*) PLAYFIELD_SPRITES#6 ) - (byte*) PLAYFIELD_SCREEN#9 ← phi( init_sprites::@3/(byte*) PLAYFIELD_SCREEN#2 ) (byte*) init_sprites::toD0181_gfx#1 ← phi( init_sprites::@3/(byte*) init_sprites::toD0181_gfx#0 ) (byte*) init_sprites::toD0181_screen#1 ← phi( init_sprites::@3/(byte*) init_sprites::toD0181_screen#0 ) (word) init_sprites::toD0181_$0#0 ← ((word)) (byte*) init_sprites::toD0181_screen#1 @@ -169,14 +188,10 @@ init_sprites::toD0181: scope:[init_sprites] from init_sprites::@3 (byte) init_sprites::toD0181_return#0 ← (byte) init_sprites::toD0181_$8#0 to:init_sprites::toD0181_@return init_sprites::toD0181_@return: scope:[init_sprites] from init_sprites::toD0181 - (byte*) PLAYFIELD_SPRITES#3 ← phi( init_sprites::toD0181/(byte*) PLAYFIELD_SPRITES#5 ) - (byte*) PLAYFIELD_SCREEN#6 ← phi( init_sprites::toD0181/(byte*) PLAYFIELD_SCREEN#9 ) (byte) init_sprites::toD0181_return#2 ← phi( init_sprites::toD0181/(byte) init_sprites::toD0181_return#0 ) (byte) init_sprites::toD0181_return#1 ← (byte) init_sprites::toD0181_return#2 to:init_sprites::@4 init_sprites::@4: scope:[init_sprites] from init_sprites::toD0181_@return - (byte*) PLAYFIELD_SPRITES#1 ← phi( init_sprites::toD0181_@return/(byte*) PLAYFIELD_SPRITES#3 ) - (byte*) PLAYFIELD_SCREEN#3 ← phi( init_sprites::toD0181_@return/(byte*) PLAYFIELD_SCREEN#6 ) (byte) init_sprites::toD0181_return#3 ← phi( init_sprites::toD0181_@return/(byte) init_sprites::toD0181_return#1 ) (byte~) init_sprites::$1 ← (byte) init_sprites::toD0181_return#3 *((byte*) D018#0) ← (byte~) init_sprites::$1 @@ -184,136 +199,204 @@ init_sprites::@4: scope:[init_sprites] from init_sprites::toD0181_@return *((byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 *((byte*) SPRITES_EXPAND_Y#0) ← *((byte*) SPRITES_MC#0) *((byte*) SPRITES_EXPAND_X#0) ← *((byte*) SPRITES_EXPAND_Y#0) - (byte*~) init_sprites::$2 ← (byte*) PLAYFIELD_SCREEN#3 + (word) SPRITE_PTRS#0 - (byte*) init_sprites::sprites_ptr#0 ← (byte*~) init_sprites::$2 - (byte/signed byte/word/signed word/dword/signed dword~) init_sprites::$3 ← (byte/signed byte/word/signed word/dword/signed dword) 14 * (byte/signed byte/word/signed word/dword/signed dword) 8 - (byte/signed word/word/dword/signed dword/signed byte~) init_sprites::$4 ← (byte/signed byte/word/signed word/dword/signed dword) 24 + (byte/signed byte/word/signed word/dword/signed dword~) init_sprites::$3 - (byte) init_sprites::xpos#0 ← (byte/signed word/word/dword/signed dword/signed byte~) init_sprites::$4 - (byte) init_sprites::ypos#0 ← (byte/signed byte/word/signed word/dword/signed dword) 50 - (byte*) init_sprites::toSpritePtr1_sprite#0 ← (byte*) PLAYFIELD_SPRITES#1 - to:init_sprites::toSpritePtr1 -init_sprites::toSpritePtr1: scope:[init_sprites] from init_sprites::@4 - (byte*) init_sprites::sprites_ptr#4 ← phi( init_sprites::@4/(byte*) init_sprites::sprites_ptr#0 ) - (byte) init_sprites::ypos#4 ← phi( init_sprites::@4/(byte) init_sprites::ypos#0 ) - (byte) init_sprites::xpos#5 ← phi( init_sprites::@4/(byte) init_sprites::xpos#0 ) - (byte*) init_sprites::toSpritePtr1_sprite#1 ← phi( init_sprites::@4/(byte*) init_sprites::toSpritePtr1_sprite#0 ) - (word) init_sprites::toSpritePtr1_$0#0 ← ((word)) (byte*) init_sprites::toSpritePtr1_sprite#1 - (word) init_sprites::toSpritePtr1_$1#0 ← (word) init_sprites::toSpritePtr1_$0#0 >> (byte/signed byte/word/signed word/dword/signed dword) 6 - (byte) init_sprites::toSpritePtr1_$2#0 ← ((byte)) (word) init_sprites::toSpritePtr1_$1#0 - (byte) init_sprites::toSpritePtr1_return#0 ← (byte) init_sprites::toSpritePtr1_$2#0 - to:init_sprites::toSpritePtr1_@return -init_sprites::toSpritePtr1_@return: scope:[init_sprites] from init_sprites::toSpritePtr1 - (byte*) init_sprites::sprites_ptr#3 ← phi( init_sprites::toSpritePtr1/(byte*) init_sprites::sprites_ptr#4 ) - (byte) init_sprites::ypos#3 ← phi( init_sprites::toSpritePtr1/(byte) init_sprites::ypos#4 ) - (byte) init_sprites::xpos#4 ← phi( init_sprites::toSpritePtr1/(byte) init_sprites::xpos#5 ) - (byte) init_sprites::toSpritePtr1_return#2 ← phi( init_sprites::toSpritePtr1/(byte) init_sprites::toSpritePtr1_return#0 ) - (byte) init_sprites::toSpritePtr1_return#1 ← (byte) init_sprites::toSpritePtr1_return#2 - to:init_sprites::@5 -init_sprites::@5: scope:[init_sprites] from init_sprites::toSpritePtr1_@return - (byte*) init_sprites::sprites_ptr#2 ← phi( init_sprites::toSpritePtr1_@return/(byte*) init_sprites::sprites_ptr#3 ) - (byte) init_sprites::ypos#2 ← phi( init_sprites::toSpritePtr1_@return/(byte) init_sprites::ypos#3 ) - (byte) init_sprites::xpos#3 ← phi( init_sprites::toSpritePtr1_@return/(byte) init_sprites::xpos#4 ) - (byte) init_sprites::toSpritePtr1_return#3 ← phi( init_sprites::toSpritePtr1_@return/(byte) init_sprites::toSpritePtr1_return#1 ) - (byte~) init_sprites::$5 ← (byte) init_sprites::toSpritePtr1_return#3 - (byte) init_sprites::ptr#0 ← (byte~) init_sprites::$5 + (byte/signed byte/word/signed word/dword/signed dword~) init_sprites::$2 ← (byte/signed byte/word/signed word/dword/signed dword) 14 * (byte/signed byte/word/signed word/dword/signed dword) 8 + (byte/signed word/word/dword/signed dword/signed byte~) init_sprites::$3 ← (byte/signed byte/word/signed word/dword/signed dword) 24 + (byte/signed byte/word/signed word/dword/signed dword~) init_sprites::$2 + (byte) init_sprites::xpos#0 ← (byte/signed word/word/dword/signed dword/signed byte~) init_sprites::$3 (byte) init_sprites::s#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 to:init_sprites::@1 -init_sprites::@1: scope:[init_sprites] from init_sprites::@1 init_sprites::@5 - (byte*) init_sprites::sprites_ptr#1 ← phi( init_sprites::@1/(byte*) init_sprites::sprites_ptr#1 init_sprites::@5/(byte*) init_sprites::sprites_ptr#2 ) - (byte) init_sprites::ptr#2 ← phi( init_sprites::@1/(byte) init_sprites::ptr#1 init_sprites::@5/(byte) init_sprites::ptr#0 ) - (byte) init_sprites::ypos#1 ← phi( init_sprites::@1/(byte) init_sprites::ypos#1 init_sprites::@5/(byte) init_sprites::ypos#2 ) - (byte) init_sprites::xpos#2 ← phi( init_sprites::@1/(byte) init_sprites::xpos#1 init_sprites::@5/(byte) init_sprites::xpos#3 ) - (byte) init_sprites::s#2 ← phi( init_sprites::@1/(byte) init_sprites::s#1 init_sprites::@5/(byte) init_sprites::s#0 ) - (byte~) init_sprites::$6 ← (byte) init_sprites::s#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 - (byte) init_sprites::s2#0 ← (byte~) init_sprites::$6 +init_sprites::@1: scope:[init_sprites] from init_sprites::@1 init_sprites::@4 + (byte) init_sprites::xpos#2 ← phi( init_sprites::@1/(byte) init_sprites::xpos#1 init_sprites::@4/(byte) init_sprites::xpos#0 ) + (byte) init_sprites::s#2 ← phi( init_sprites::@1/(byte) init_sprites::s#1 init_sprites::@4/(byte) init_sprites::s#0 ) + (byte~) init_sprites::$4 ← (byte) init_sprites::s#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 + (byte) init_sprites::s2#0 ← (byte~) init_sprites::$4 *((byte*) SPRITES_XPOS#0 + (byte) init_sprites::s2#0) ← (byte) init_sprites::xpos#2 - *((byte*) SPRITES_YPOS#0 + (byte) init_sprites::s2#0) ← (byte) init_sprites::ypos#1 *((byte*) SPRITES_COLS#0 + (byte) init_sprites::s#2) ← (byte) BLACK#0 - *((byte*) init_sprites::sprites_ptr#1 + (byte) init_sprites::s#2) ← (byte) init_sprites::ptr#2 - (byte/signed word/word/dword/signed dword~) init_sprites::$7 ← (byte) init_sprites::xpos#2 + (byte/signed byte/word/signed word/dword/signed dword) 24 - (byte) init_sprites::xpos#1 ← (byte/signed word/word/dword/signed dword~) init_sprites::$7 - (byte) init_sprites::ptr#1 ← ++ (byte) init_sprites::ptr#2 + (byte/signed word/word/dword/signed dword~) init_sprites::$5 ← (byte) init_sprites::xpos#2 + (byte/signed byte/word/signed word/dword/signed dword) 24 + (byte) init_sprites::xpos#1 ← (byte/signed word/word/dword/signed dword~) init_sprites::$5 (byte) init_sprites::s#1 ← (byte) init_sprites::s#2 + rangenext(0,3) - (bool~) init_sprites::$8 ← (byte) init_sprites::s#1 != rangelast(0,3) - if((bool~) init_sprites::$8) goto init_sprites::@1 + (bool~) init_sprites::$6 ← (byte) init_sprites::s#1 != rangelast(0,3) + if((bool~) init_sprites::$6) goto init_sprites::@1 to:init_sprites::@return init_sprites::@return: scope:[init_sprites] from init_sprites::@1 return to:@return @6: scope:[] from @4 - (byte*) PLAYFIELD_CHARSET#9 ← phi( @4/(byte*) PLAYFIELD_CHARSET#0 ) - (byte*) PLAYFIELD_SCREEN#11 ← phi( @4/(byte*) PLAYFIELD_SCREEN#0 ) - (byte*) PLAYFIELD_SPRITES#4 ← phi( @4/(byte*) PLAYFIELD_SPRITES#0 ) (byte) IRQ_RASTER_FIRST#0 ← (byte/signed byte/word/signed word/dword/signed dword) 48 - (byte) irq_raster_next#0 ← (byte) IRQ_RASTER_FIRST#0 - (byte) irq_cnt#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 - (byte) irq_sprite_ypos#0 ← (byte/signed byte/word/signed word/dword/signed dword) 50 + (byte) irq_raster_next#2 ← (byte) IRQ_RASTER_FIRST#0 + (byte) irq_sprite_ypos#2 ← (byte/signed byte/word/signed word/dword/signed dword) 50 + (byte*) toSpritePtr1_sprite#0 ← (byte*) PLAYFIELD_SPRITES#0 + to:toSpritePtr1 +toSpritePtr1: scope:[] from @6 + (byte) irq_raster_next#32 ← phi( @6/(byte) irq_raster_next#2 ) + (byte) irq_sprite_ypos#31 ← phi( @6/(byte) irq_sprite_ypos#2 ) + (byte*) toSpritePtr1_sprite#1 ← phi( @6/(byte*) toSpritePtr1_sprite#0 ) + (word) toSpritePtr1_$0#0 ← ((word)) (byte*) toSpritePtr1_sprite#1 + (word) toSpritePtr1_$1#0 ← (word) toSpritePtr1_$0#0 >> (byte/signed byte/word/signed word/dword/signed dword) 6 + (byte) toSpritePtr1_$2#0 ← ((byte)) (word) toSpritePtr1_$1#0 + (byte) toSpritePtr1_return#0 ← (byte) toSpritePtr1_$2#0 + to:toSpritePtr1_@return +toSpritePtr1_@return: scope:[] from toSpritePtr1 + (byte) irq_raster_next#28 ← phi( toSpritePtr1/(byte) irq_raster_next#32 ) + (byte) irq_sprite_ypos#28 ← phi( toSpritePtr1/(byte) irq_sprite_ypos#31 ) + (byte) toSpritePtr1_return#2 ← phi( toSpritePtr1/(byte) toSpritePtr1_return#0 ) + (byte) toSpritePtr1_return#1 ← (byte) toSpritePtr1_return#2 + to:@9 +@9: scope:[] from toSpritePtr1_@return + (byte) irq_raster_next#27 ← phi( toSpritePtr1_@return/(byte) irq_raster_next#28 ) + (byte) irq_sprite_ypos#27 ← phi( toSpritePtr1_@return/(byte) irq_sprite_ypos#28 ) + (byte) toSpritePtr1_return#3 ← phi( toSpritePtr1_@return/(byte) toSpritePtr1_return#1 ) + (byte~) $1 ← (byte) toSpritePtr1_return#3 + (byte) irq_sprite_ptr#2 ← (byte~) $1 + (byte) irq_cnt#2 ← (byte/signed byte/word/signed word/dword/signed dword) 0 to:@8 -init_irq: scope:[init_irq] from main::@1 +init_irq: scope:[init_irq] from main::@7 + (byte) irq_raster_next#3 ← (byte) IRQ_RASTER_FIRST#0 + (byte) irq_sprite_ypos#3 ← (byte/signed byte/word/signed word/dword/signed dword) 50 + (byte*) init_irq::toSpritePtr2_sprite#0 ← (byte*) PLAYFIELD_SPRITES#0 + to:init_irq::toSpritePtr2 +init_irq::toSpritePtr2: scope:[init_irq] from init_irq + (byte) irq_sprite_ypos#29 ← phi( init_irq/(byte) irq_sprite_ypos#3 ) + (byte) irq_raster_next#29 ← phi( init_irq/(byte) irq_raster_next#3 ) + (byte*) init_irq::toSpritePtr2_sprite#1 ← phi( init_irq/(byte*) init_irq::toSpritePtr2_sprite#0 ) + (word) init_irq::toSpritePtr2_$0#0 ← ((word)) (byte*) init_irq::toSpritePtr2_sprite#1 + (word) init_irq::toSpritePtr2_$1#0 ← (word) init_irq::toSpritePtr2_$0#0 >> (byte/signed byte/word/signed word/dword/signed dword) 6 + (byte) init_irq::toSpritePtr2_$2#0 ← ((byte)) (word) init_irq::toSpritePtr2_$1#0 + (byte) init_irq::toSpritePtr2_return#0 ← (byte) init_irq::toSpritePtr2_$2#0 + to:init_irq::toSpritePtr2_@return +init_irq::toSpritePtr2_@return: scope:[init_irq] from init_irq::toSpritePtr2 + (byte) irq_sprite_ypos#25 ← phi( init_irq::toSpritePtr2/(byte) irq_sprite_ypos#29 ) + (byte) irq_raster_next#24 ← phi( init_irq::toSpritePtr2/(byte) irq_raster_next#29 ) + (byte) init_irq::toSpritePtr2_return#2 ← phi( init_irq::toSpritePtr2/(byte) init_irq::toSpritePtr2_return#0 ) + (byte) init_irq::toSpritePtr2_return#1 ← (byte) init_irq::toSpritePtr2_return#2 + to:init_irq::@1 +init_irq::@1: scope:[init_irq] from init_irq::toSpritePtr2_@return + (byte) irq_sprite_ypos#19 ← phi( init_irq::toSpritePtr2_@return/(byte) irq_sprite_ypos#25 ) + (byte) irq_raster_next#18 ← phi( init_irq::toSpritePtr2_@return/(byte) irq_raster_next#24 ) + (byte) init_irq::toSpritePtr2_return#3 ← phi( init_irq::toSpritePtr2_@return/(byte) init_irq::toSpritePtr2_return#1 ) + (byte~) init_irq::$0 ← (byte) init_irq::toSpritePtr2_return#3 + (byte) irq_sprite_ptr#3 ← (byte~) init_irq::$0 + (byte) irq_cnt#3 ← (byte/signed byte/word/signed word/dword/signed dword) 0 asm { sei } *((byte*) CIA1_INTERRUPT#0) ← (byte) CIA_INTERRUPT_CLEAR#0 *((byte*) VIC_CONTROL#0) ← *((byte*) VIC_CONTROL#0) & (byte/signed byte/word/signed word/dword/signed dword) 127 *((byte*) RASTER#0) ← (byte) IRQ_RASTER_FIRST#0 *((byte*) IRQ_ENABLE#0) ← (byte) IRQ_RASTER#0 - (void()*~) init_irq::$0 ← & interrupt(KERNEL_MIN)(void()) irq() - *((void()**) KERNEL_IRQ#0) ← (void()*~) init_irq::$0 + (void()*~) init_irq::$1 ← & interrupt(KERNEL_MIN)(void()) irq() + *((void()**) KERNEL_IRQ#0) ← (void()*~) init_irq::$1 asm { cli } to:init_irq::@return -init_irq::@return: scope:[init_irq] from init_irq +init_irq::@return: scope:[init_irq] from init_irq::@1 + (byte) irq_cnt#11 ← phi( init_irq::@1/(byte) irq_cnt#3 ) + (byte) irq_sprite_ptr#11 ← phi( init_irq::@1/(byte) irq_sprite_ptr#3 ) + (byte) irq_sprite_ypos#11 ← phi( init_irq::@1/(byte) irq_sprite_ypos#19 ) + (byte) irq_raster_next#11 ← phi( init_irq::@1/(byte) irq_raster_next#18 ) + (byte) irq_raster_next#4 ← (byte) irq_raster_next#11 + (byte) irq_sprite_ypos#4 ← (byte) irq_sprite_ypos#11 + (byte) irq_sprite_ptr#4 ← (byte) irq_sprite_ptr#11 + (byte) irq_cnt#4 ← (byte) irq_cnt#11 return to:@return irq: scope:[irq] from - (byte) irq_raster_next#7 ← phi( @8/(byte) irq_raster_next#8 ) - (byte) irq_cnt#4 ← phi( @8/(byte) irq_cnt#6 ) - (byte) irq_sprite_ypos#4 ← phi( @8/(byte) irq_sprite_ypos#7 ) - *((byte*) BGCOL#0) ← (byte) WHITE#0 - *((byte*) BORDERCOL#0) ← *((byte*) BGCOL#0) - *((byte*) SPRITES_YPOS#0 + (byte/signed byte/word/signed word/dword/signed dword) 0) ← (byte) irq_sprite_ypos#4 - *((byte*) SPRITES_YPOS#0 + (byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq_sprite_ypos#4 - *((byte*) SPRITES_YPOS#0 + (byte/signed byte/word/signed word/dword/signed dword) 4) ← (byte) irq_sprite_ypos#4 - *((byte*) SPRITES_YPOS#0 + (byte/signed byte/word/signed word/dword/signed dword) 6) ← (byte) irq_sprite_ypos#4 - (byte) irq_cnt#1 ← ++ (byte) irq_cnt#4 - (bool~) irq::$0 ← (byte) irq_cnt#1 == (byte/signed byte/word/signed word/dword/signed dword) 10 + (byte) irq_raster_next#30 ← phi( @8/(byte) irq_raster_next#21 ) + (byte) irq_cnt#22 ← phi( @8/(byte) irq_cnt#19 ) + (byte) irq_sprite_ptr#23 ← phi( @8/(byte) irq_sprite_ptr#20 ) + (byte) irq_sprite_ypos#12 ← phi( @8/(byte) irq_sprite_ypos#20 ) + *((byte*) BORDERCOL#0) ← (byte) DARK_GREY#0 + *((byte*) SPRITES_YPOS#0 + (byte/signed byte/word/signed word/dword/signed dword) 0) ← (byte) irq_sprite_ypos#12 + *((byte*) SPRITES_YPOS#0 + (byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq_sprite_ypos#12 + *((byte*) SPRITES_YPOS#0 + (byte/signed byte/word/signed word/dword/signed dword) 4) ← (byte) irq_sprite_ypos#12 + *((byte*) SPRITES_YPOS#0 + (byte/signed byte/word/signed word/dword/signed dword) 6) ← (byte) irq_sprite_ypos#12 + to:irq::@1 +irq::@1: scope:[irq] from irq irq::@1 + (byte) irq_raster_next#25 ← phi( irq/(byte) irq_raster_next#30 irq::@1/(byte) irq_raster_next#25 ) + (byte) irq_cnt#17 ← phi( irq/(byte) irq_cnt#22 irq::@1/(byte) irq_cnt#17 ) + (byte) irq_sprite_ptr#18 ← phi( irq/(byte) irq_sprite_ptr#23 irq::@1/(byte) irq_sprite_ptr#18 ) + (byte) irq_sprite_ypos#13 ← phi( irq/(byte) irq_sprite_ypos#12 irq::@1/(byte) irq_sprite_ypos#13 ) + (bool~) irq::$0 ← *((byte*) RASTER#0) != (byte) irq_sprite_ypos#13 if((bool~) irq::$0) goto irq::@1 + to:irq::@4 +irq::@4: scope:[irq] from irq::@1 + (byte) irq_sprite_ypos#21 ← phi( irq::@1/(byte) irq_sprite_ypos#13 ) + (byte) irq_raster_next#19 ← phi( irq::@1/(byte) irq_raster_next#25 ) + (byte) irq_cnt#12 ← phi( irq::@1/(byte) irq_cnt#17 ) + (byte) irq_sprite_ptr#12 ← phi( irq::@1/(byte) irq_sprite_ptr#18 ) + (byte) irq::ptr#0 ← (byte) irq_sprite_ptr#12 + *((byte*) PLAYFIELD_SPRITE_PTRS#0 + (byte/signed byte/word/signed word/dword/signed dword) 0) ← (byte) irq::ptr#0 + (byte) irq::ptr#1 ← ++ (byte) irq::ptr#0 + *((byte*) PLAYFIELD_SPRITE_PTRS#0 + (byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) irq::ptr#1 + *((byte*) PLAYFIELD_SPRITE_PTRS#0 + (byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq::ptr#1 + (byte) irq::ptr#2 ← ++ (byte) irq::ptr#1 + *((byte*) PLAYFIELD_SPRITE_PTRS#0 + (byte/signed byte/word/signed word/dword/signed dword) 3) ← (byte) irq::ptr#2 + (byte) irq_cnt#5 ← ++ (byte) irq_cnt#12 + (bool~) irq::$1 ← (byte) irq_cnt#5 == (byte/signed byte/word/signed word/dword/signed dword) 10 + if((bool~) irq::$1) goto irq::@2 + to:irq::@5 +irq::@2: scope:[irq] from irq::@4 + (byte) irq_cnt#6 ← (byte/signed byte/word/signed word/dword/signed dword) 0 + (byte) irq_raster_next#5 ← (byte) IRQ_RASTER_FIRST#0 + (byte) irq_sprite_ypos#5 ← (byte/signed byte/word/signed word/dword/signed dword) 50 + (byte*) irq::toSpritePtr2_sprite#0 ← (byte*) PLAYFIELD_SPRITES#0 + to:irq::toSpritePtr2 +irq::toSpritePtr2: scope:[irq] from irq::@2 + (byte) irq_sprite_ypos#32 ← phi( irq::@2/(byte) irq_sprite_ypos#5 ) + (byte) irq_cnt#26 ← phi( irq::@2/(byte) irq_cnt#6 ) + (byte) irq_raster_next#31 ← phi( irq::@2/(byte) irq_raster_next#5 ) + (byte*) irq::toSpritePtr2_sprite#1 ← phi( irq::@2/(byte*) irq::toSpritePtr2_sprite#0 ) + (word) irq::toSpritePtr2_$0#0 ← ((word)) (byte*) irq::toSpritePtr2_sprite#1 + (word) irq::toSpritePtr2_$1#0 ← (word) irq::toSpritePtr2_$0#0 >> (byte/signed byte/word/signed word/dword/signed dword) 6 + (byte) irq::toSpritePtr2_$2#0 ← ((byte)) (word) irq::toSpritePtr2_$1#0 + (byte) irq::toSpritePtr2_return#0 ← (byte) irq::toSpritePtr2_$2#0 + to:irq::toSpritePtr2_@return +irq::toSpritePtr2_@return: scope:[irq] from irq::toSpritePtr2 + (byte) irq_sprite_ypos#30 ← phi( irq::toSpritePtr2/(byte) irq_sprite_ypos#32 ) + (byte) irq_cnt#25 ← phi( irq::toSpritePtr2/(byte) irq_cnt#26 ) + (byte) irq_raster_next#26 ← phi( irq::toSpritePtr2/(byte) irq_raster_next#31 ) + (byte) irq::toSpritePtr2_return#2 ← phi( irq::toSpritePtr2/(byte) irq::toSpritePtr2_return#0 ) + (byte) irq::toSpritePtr2_return#1 ← (byte) irq::toSpritePtr2_return#2 + to:irq::@7 +irq::@7: scope:[irq] from irq::toSpritePtr2_@return + (byte) irq_sprite_ypos#26 ← phi( irq::toSpritePtr2_@return/(byte) irq_sprite_ypos#30 ) + (byte) irq_cnt#24 ← phi( irq::toSpritePtr2_@return/(byte) irq_cnt#25 ) + (byte) irq_raster_next#20 ← phi( irq::toSpritePtr2_@return/(byte) irq_raster_next#26 ) + (byte) irq::toSpritePtr2_return#3 ← phi( irq::toSpritePtr2_@return/(byte) irq::toSpritePtr2_return#1 ) + (byte~) irq::$2 ← (byte) irq::toSpritePtr2_return#3 + (byte) irq_sprite_ptr#5 ← (byte~) irq::$2 to:irq::@3 -irq::@1: scope:[irq] from irq - (byte) irq_cnt#2 ← (byte/signed byte/word/signed word/dword/signed dword) 0 - (byte) irq_raster_next#1 ← (byte) IRQ_RASTER_FIRST#0 - (byte) irq_sprite_ypos#1 ← (byte/signed byte/word/signed word/dword/signed dword) 50 - to:irq::@2 -irq::@3: scope:[irq] from irq - (byte) irq_cnt#8 ← phi( irq/(byte) irq_cnt#1 ) - (byte) irq_sprite_ypos#5 ← phi( irq/(byte) irq_sprite_ypos#4 ) - (byte) irq_raster_next#4 ← phi( irq/(byte) irq_raster_next#7 ) - (byte) irq_raster_next#2 ← (byte) irq_raster_next#4 + (byte/signed byte/word/signed word/dword/signed dword) 21 - (byte) irq_sprite_ypos#2 ← (byte) irq_sprite_ypos#5 + (byte/signed byte/word/signed word/dword/signed dword) 21 - to:irq::@2 -irq::@2: scope:[irq] from irq::@1 irq::@3 - (byte) irq_sprite_ypos#8 ← phi( irq::@1/(byte) irq_sprite_ypos#1 irq::@3/(byte) irq_sprite_ypos#2 ) - (byte) irq_cnt#7 ← phi( irq::@1/(byte) irq_cnt#2 irq::@3/(byte) irq_cnt#8 ) - (byte) irq_raster_next#5 ← phi( irq::@1/(byte) irq_raster_next#1 irq::@3/(byte) irq_raster_next#2 ) - *((byte*) RASTER#0) ← (byte) irq_raster_next#5 +irq::@5: scope:[irq] from irq::@4 + (byte) irq_cnt#23 ← phi( irq::@4/(byte) irq_cnt#5 ) + (byte) irq_sprite_ptr#13 ← phi( irq::@4/(byte) irq_sprite_ptr#12 ) + (byte) irq_sprite_ypos#14 ← phi( irq::@4/(byte) irq_sprite_ypos#21 ) + (byte) irq_raster_next#12 ← phi( irq::@4/(byte) irq_raster_next#19 ) + (byte) irq_raster_next#6 ← (byte) irq_raster_next#12 + (byte/signed byte/word/signed word/dword/signed dword) 21 + (byte) irq_sprite_ypos#6 ← (byte) irq_sprite_ypos#14 + (byte/signed byte/word/signed word/dword/signed dword) 21 + (byte) irq_sprite_ptr#6 ← (byte) irq_sprite_ptr#13 + (byte/signed byte/word/signed word/dword/signed dword) 3 + to:irq::@3 +irq::@3: scope:[irq] from irq::@5 irq::@7 + (byte) irq_sprite_ptr#19 ← phi( irq::@5/(byte) irq_sprite_ptr#6 irq::@7/(byte) irq_sprite_ptr#5 ) + (byte) irq_sprite_ypos#22 ← phi( irq::@5/(byte) irq_sprite_ypos#6 irq::@7/(byte) irq_sprite_ypos#26 ) + (byte) irq_cnt#18 ← phi( irq::@5/(byte) irq_cnt#23 irq::@7/(byte) irq_cnt#24 ) + (byte) irq_raster_next#13 ← phi( irq::@5/(byte) irq_raster_next#6 irq::@7/(byte) irq_raster_next#20 ) + *((byte*) RASTER#0) ← (byte) irq_raster_next#13 *((byte*) IRQ_STATUS#0) ← (byte) IRQ_RASTER#0 *((byte*) BORDERCOL#0) ← (byte) BLACK#0 - *((byte*) BGCOL#0) ← (byte) BLUE#0 to:irq::@return -irq::@return: scope:[irq] from irq::@2 - (byte) irq_sprite_ypos#6 ← phi( irq::@2/(byte) irq_sprite_ypos#8 ) - (byte) irq_raster_next#6 ← phi( irq::@2/(byte) irq_raster_next#5 ) - (byte) irq_cnt#5 ← phi( irq::@2/(byte) irq_cnt#7 ) - (byte) irq_cnt#3 ← (byte) irq_cnt#5 - (byte) irq_raster_next#3 ← (byte) irq_raster_next#6 - (byte) irq_sprite_ypos#3 ← (byte) irq_sprite_ypos#6 +irq::@return: scope:[irq] from irq::@3 + (byte) irq_sprite_ptr#14 ← phi( irq::@3/(byte) irq_sprite_ptr#19 ) + (byte) irq_sprite_ypos#15 ← phi( irq::@3/(byte) irq_sprite_ypos#22 ) + (byte) irq_raster_next#14 ← phi( irq::@3/(byte) irq_raster_next#13 ) + (byte) irq_cnt#13 ← phi( irq::@3/(byte) irq_cnt#18 ) + (byte) irq_cnt#7 ← (byte) irq_cnt#13 + (byte) irq_raster_next#7 ← (byte) irq_raster_next#14 + (byte) irq_sprite_ypos#7 ← (byte) irq_sprite_ypos#15 + (byte) irq_sprite_ptr#7 ← (byte) irq_sprite_ptr#14 return to:@return -@8: scope:[] from @6 - (byte*) PLAYFIELD_CHARSET#8 ← phi( @6/(byte*) PLAYFIELD_CHARSET#9 ) - (byte) irq_raster_next#8 ← phi( @6/(byte) irq_raster_next#0 ) - (byte*) PLAYFIELD_SCREEN#7 ← phi( @6/(byte*) PLAYFIELD_SCREEN#11 ) - (byte) irq_cnt#6 ← phi( @6/(byte) irq_cnt#0 ) - (byte) irq_sprite_ypos#7 ← phi( @6/(byte) irq_sprite_ypos#0 ) - (byte*) PLAYFIELD_SPRITES#2 ← phi( @6/(byte*) PLAYFIELD_SPRITES#4 ) - kickasm(location (byte*) PLAYFIELD_SPRITES#2) {{ .var sprites = LoadPicture("nes-playfield.png", List().add($010101, $000000)) +@8: scope:[] from @9 + (byte) irq_cnt#19 ← phi( @9/(byte) irq_cnt#2 ) + (byte) irq_sprite_ptr#20 ← phi( @9/(byte) irq_sprite_ptr#2 ) + (byte) irq_raster_next#21 ← phi( @9/(byte) irq_raster_next#27 ) + (byte) irq_sprite_ypos#20 ← phi( @9/(byte) irq_sprite_ypos#27 ) + kickasm(location (byte*) PLAYFIELD_SPRITES#0) {{ .var sprites = LoadPicture("nes-playfield.png", List().add($010101, $000000)) .for(var sy=0;sy<10;sy++) { .for(var sx=0;sx<3;sx++) { .for (var y=0;y<21; y++) { @@ -326,12 +409,23 @@ irq::@return: scope:[irq] from irq::@2 } }} call main - to:@9 -@9: scope:[] from @8 + to:@10 +@10: scope:[] from @8 + (byte) irq_cnt#14 ← phi( @8/(byte) irq_cnt#1 ) + (byte) irq_sprite_ptr#15 ← phi( @8/(byte) irq_sprite_ptr#1 ) + (byte) irq_sprite_ypos#16 ← phi( @8/(byte) irq_sprite_ypos#1 ) + (byte) irq_raster_next#15 ← phi( @8/(byte) irq_raster_next#1 ) + (byte) irq_raster_next#8 ← (byte) irq_raster_next#15 + (byte) irq_sprite_ypos#8 ← (byte) irq_sprite_ypos#16 + (byte) irq_sprite_ptr#8 ← (byte) irq_sprite_ptr#15 + (byte) irq_cnt#8 ← (byte) irq_cnt#14 to:@end -@end: scope:[] from @9 +@end: scope:[] from @10 SYMBOL TABLE SSA +(byte*~) $0 +(byte~) $1 +(label) @10 (label) @4 (label) @6 (label) @8 @@ -430,43 +524,12 @@ SYMBOL TABLE SSA (byte) PINK#0 (byte*) PLAYFIELD_CHARSET (byte*) PLAYFIELD_CHARSET#0 -(byte*) PLAYFIELD_CHARSET#1 -(byte*) PLAYFIELD_CHARSET#2 -(byte*) PLAYFIELD_CHARSET#3 -(byte*) PLAYFIELD_CHARSET#4 -(byte*) PLAYFIELD_CHARSET#5 -(byte*) PLAYFIELD_CHARSET#6 -(byte*) PLAYFIELD_CHARSET#7 -(byte*) PLAYFIELD_CHARSET#8 -(byte*) PLAYFIELD_CHARSET#9 (byte*) PLAYFIELD_SCREEN (byte*) PLAYFIELD_SCREEN#0 -(byte*) PLAYFIELD_SCREEN#1 -(byte*) PLAYFIELD_SCREEN#10 -(byte*) PLAYFIELD_SCREEN#11 -(byte*) PLAYFIELD_SCREEN#12 -(byte*) PLAYFIELD_SCREEN#2 -(byte*) PLAYFIELD_SCREEN#3 -(byte*) PLAYFIELD_SCREEN#4 -(byte*) PLAYFIELD_SCREEN#5 -(byte*) PLAYFIELD_SCREEN#6 -(byte*) PLAYFIELD_SCREEN#7 -(byte*) PLAYFIELD_SCREEN#8 -(byte*) PLAYFIELD_SCREEN#9 (byte*) PLAYFIELD_SPRITES (byte*) PLAYFIELD_SPRITES#0 -(byte*) PLAYFIELD_SPRITES#1 -(byte*) PLAYFIELD_SPRITES#10 -(byte*) PLAYFIELD_SPRITES#11 -(byte*) PLAYFIELD_SPRITES#12 -(byte*) PLAYFIELD_SPRITES#2 -(byte*) PLAYFIELD_SPRITES#3 -(byte*) PLAYFIELD_SPRITES#4 -(byte*) PLAYFIELD_SPRITES#5 -(byte*) PLAYFIELD_SPRITES#6 -(byte*) PLAYFIELD_SPRITES#7 -(byte*) PLAYFIELD_SPRITES#8 -(byte*) PLAYFIELD_SPRITES#9 +(byte*) PLAYFIELD_SPRITE_PTRS +(byte*) PLAYFIELD_SPRITE_PTRS#0 (byte*) PROCPORT (byte*) PROCPORT#0 (byte) PROCPORT_BASIC_KERNEL_IO @@ -538,38 +601,43 @@ SYMBOL TABLE SSA (byte) YELLOW (byte) YELLOW#0 (void()) init_irq() -(void()*~) init_irq::$0 +(byte~) init_irq::$0 +(void()*~) init_irq::$1 +(label) init_irq::@1 (label) init_irq::@return +(label) init_irq::toSpritePtr2 +(word~) init_irq::toSpritePtr2_$0 +(word) init_irq::toSpritePtr2_$0#0 +(word~) init_irq::toSpritePtr2_$1 +(word) init_irq::toSpritePtr2_$1#0 +(byte~) init_irq::toSpritePtr2_$2 +(byte) init_irq::toSpritePtr2_$2#0 +(label) init_irq::toSpritePtr2_@return +(byte) init_irq::toSpritePtr2_return +(byte) init_irq::toSpritePtr2_return#0 +(byte) init_irq::toSpritePtr2_return#1 +(byte) init_irq::toSpritePtr2_return#2 +(byte) init_irq::toSpritePtr2_return#3 +(byte*) init_irq::toSpritePtr2_sprite +(byte*) init_irq::toSpritePtr2_sprite#0 +(byte*) init_irq::toSpritePtr2_sprite#1 (void()) init_sprites() (byte~) init_sprites::$1 -(byte*~) init_sprites::$2 -(byte/signed byte/word/signed word/dword/signed dword~) init_sprites::$3 -(byte/signed word/word/dword/signed dword/signed byte~) init_sprites::$4 -(byte~) init_sprites::$5 -(byte~) init_sprites::$6 -(byte/signed word/word/dword/signed dword~) init_sprites::$7 -(bool~) init_sprites::$8 +(byte/signed byte/word/signed word/dword/signed dword~) init_sprites::$2 +(byte/signed word/word/dword/signed dword/signed byte~) init_sprites::$3 +(byte~) init_sprites::$4 +(byte/signed word/word/dword/signed dword~) init_sprites::$5 +(bool~) init_sprites::$6 (label) init_sprites::@1 (label) init_sprites::@3 (label) init_sprites::@4 -(label) init_sprites::@5 (label) init_sprites::@return -(byte) init_sprites::ptr -(byte) init_sprites::ptr#0 -(byte) init_sprites::ptr#1 -(byte) init_sprites::ptr#2 (byte) init_sprites::s (byte) init_sprites::s#0 (byte) init_sprites::s#1 (byte) init_sprites::s#2 (byte) init_sprites::s2 (byte) init_sprites::s2#0 -(byte*) init_sprites::sprites_ptr -(byte*) init_sprites::sprites_ptr#0 -(byte*) init_sprites::sprites_ptr#1 -(byte*) init_sprites::sprites_ptr#2 -(byte*) init_sprites::sprites_ptr#3 -(byte*) init_sprites::sprites_ptr#4 (label) init_sprites::toD0181 (word~) init_sprites::toD0181_$0 (word) init_sprites::toD0181_$0#0 @@ -601,22 +669,6 @@ SYMBOL TABLE SSA (byte*) init_sprites::toD0181_screen (byte*) init_sprites::toD0181_screen#0 (byte*) init_sprites::toD0181_screen#1 -(label) init_sprites::toSpritePtr1 -(word~) init_sprites::toSpritePtr1_$0 -(word) init_sprites::toSpritePtr1_$0#0 -(word~) init_sprites::toSpritePtr1_$1 -(word) init_sprites::toSpritePtr1_$1#0 -(byte~) init_sprites::toSpritePtr1_$2 -(byte) init_sprites::toSpritePtr1_$2#0 -(label) init_sprites::toSpritePtr1_@return -(byte) init_sprites::toSpritePtr1_return -(byte) init_sprites::toSpritePtr1_return#0 -(byte) init_sprites::toSpritePtr1_return#1 -(byte) init_sprites::toSpritePtr1_return#2 -(byte) init_sprites::toSpritePtr1_return#3 -(byte*) init_sprites::toSpritePtr1_sprite -(byte*) init_sprites::toSpritePtr1_sprite#0 -(byte*) init_sprites::toSpritePtr1_sprite#1 (label) init_sprites::vicSelectGfxBank1 (byte~) init_sprites::vicSelectGfxBank1_$0 (byte) init_sprites::vicSelectGfxBank1_$0#0 @@ -646,106 +698,284 @@ SYMBOL TABLE SSA (byte) init_sprites::xpos#0 (byte) init_sprites::xpos#1 (byte) init_sprites::xpos#2 -(byte) init_sprites::xpos#3 -(byte) init_sprites::xpos#4 -(byte) init_sprites::xpos#5 -(byte) init_sprites::ypos -(byte) init_sprites::ypos#0 -(byte) init_sprites::ypos#1 -(byte) init_sprites::ypos#2 -(byte) init_sprites::ypos#3 -(byte) init_sprites::ypos#4 interrupt(KERNEL_MIN)(void()) irq() (bool~) irq::$0 +(bool~) irq::$1 +(byte~) irq::$2 (label) irq::@1 (label) irq::@2 (label) irq::@3 +(label) irq::@4 +(label) irq::@5 +(label) irq::@7 (label) irq::@return +(byte) irq::ptr +(byte) irq::ptr#0 +(byte) irq::ptr#1 +(byte) irq::ptr#2 +(label) irq::toSpritePtr2 +(word~) irq::toSpritePtr2_$0 +(word) irq::toSpritePtr2_$0#0 +(word~) irq::toSpritePtr2_$1 +(word) irq::toSpritePtr2_$1#0 +(byte~) irq::toSpritePtr2_$2 +(byte) irq::toSpritePtr2_$2#0 +(label) irq::toSpritePtr2_@return +(byte) irq::toSpritePtr2_return +(byte) irq::toSpritePtr2_return#0 +(byte) irq::toSpritePtr2_return#1 +(byte) irq::toSpritePtr2_return#2 +(byte) irq::toSpritePtr2_return#3 +(byte*) irq::toSpritePtr2_sprite +(byte*) irq::toSpritePtr2_sprite#0 +(byte*) irq::toSpritePtr2_sprite#1 (byte) irq_cnt (byte) irq_cnt#0 (byte) irq_cnt#1 +(byte) irq_cnt#10 +(byte) irq_cnt#11 +(byte) irq_cnt#12 +(byte) irq_cnt#13 +(byte) irq_cnt#14 +(byte) irq_cnt#15 +(byte) irq_cnt#16 +(byte) irq_cnt#17 +(byte) irq_cnt#18 +(byte) irq_cnt#19 (byte) irq_cnt#2 +(byte) irq_cnt#20 +(byte) irq_cnt#21 +(byte) irq_cnt#22 +(byte) irq_cnt#23 +(byte) irq_cnt#24 +(byte) irq_cnt#25 +(byte) irq_cnt#26 (byte) irq_cnt#3 (byte) irq_cnt#4 (byte) irq_cnt#5 (byte) irq_cnt#6 (byte) irq_cnt#7 (byte) irq_cnt#8 +(byte) irq_cnt#9 (byte) irq_raster_next (byte) irq_raster_next#0 (byte) irq_raster_next#1 +(byte) irq_raster_next#10 +(byte) irq_raster_next#11 +(byte) irq_raster_next#12 +(byte) irq_raster_next#13 +(byte) irq_raster_next#14 +(byte) irq_raster_next#15 +(byte) irq_raster_next#16 +(byte) irq_raster_next#17 +(byte) irq_raster_next#18 +(byte) irq_raster_next#19 (byte) irq_raster_next#2 +(byte) irq_raster_next#20 +(byte) irq_raster_next#21 +(byte) irq_raster_next#22 +(byte) irq_raster_next#23 +(byte) irq_raster_next#24 +(byte) irq_raster_next#25 +(byte) irq_raster_next#26 +(byte) irq_raster_next#27 +(byte) irq_raster_next#28 +(byte) irq_raster_next#29 (byte) irq_raster_next#3 +(byte) irq_raster_next#30 +(byte) irq_raster_next#31 +(byte) irq_raster_next#32 (byte) irq_raster_next#4 (byte) irq_raster_next#5 (byte) irq_raster_next#6 (byte) irq_raster_next#7 (byte) irq_raster_next#8 +(byte) irq_raster_next#9 +(byte) irq_sprite_ptr +(byte) irq_sprite_ptr#0 +(byte) irq_sprite_ptr#1 +(byte) irq_sprite_ptr#10 +(byte) irq_sprite_ptr#11 +(byte) irq_sprite_ptr#12 +(byte) irq_sprite_ptr#13 +(byte) irq_sprite_ptr#14 +(byte) irq_sprite_ptr#15 +(byte) irq_sprite_ptr#16 +(byte) irq_sprite_ptr#17 +(byte) irq_sprite_ptr#18 +(byte) irq_sprite_ptr#19 +(byte) irq_sprite_ptr#2 +(byte) irq_sprite_ptr#20 +(byte) irq_sprite_ptr#21 +(byte) irq_sprite_ptr#22 +(byte) irq_sprite_ptr#23 +(byte) irq_sprite_ptr#3 +(byte) irq_sprite_ptr#4 +(byte) irq_sprite_ptr#5 +(byte) irq_sprite_ptr#6 +(byte) irq_sprite_ptr#7 +(byte) irq_sprite_ptr#8 +(byte) irq_sprite_ptr#9 (byte) irq_sprite_ypos (byte) irq_sprite_ypos#0 (byte) irq_sprite_ypos#1 +(byte) irq_sprite_ypos#10 +(byte) irq_sprite_ypos#11 +(byte) irq_sprite_ypos#12 +(byte) irq_sprite_ypos#13 +(byte) irq_sprite_ypos#14 +(byte) irq_sprite_ypos#15 +(byte) irq_sprite_ypos#16 +(byte) irq_sprite_ypos#17 +(byte) irq_sprite_ypos#18 +(byte) irq_sprite_ypos#19 (byte) irq_sprite_ypos#2 +(byte) irq_sprite_ypos#20 +(byte) irq_sprite_ypos#21 +(byte) irq_sprite_ypos#22 +(byte) irq_sprite_ypos#23 +(byte) irq_sprite_ypos#24 +(byte) irq_sprite_ypos#25 +(byte) irq_sprite_ypos#26 +(byte) irq_sprite_ypos#27 +(byte) irq_sprite_ypos#28 +(byte) irq_sprite_ypos#29 (byte) irq_sprite_ypos#3 +(byte) irq_sprite_ypos#30 +(byte) irq_sprite_ypos#31 +(byte) irq_sprite_ypos#32 (byte) irq_sprite_ypos#4 (byte) irq_sprite_ypos#5 (byte) irq_sprite_ypos#6 (byte) irq_sprite_ypos#7 (byte) irq_sprite_ypos#8 +(byte) irq_sprite_ypos#9 (void()) main() (label) main::@1 (label) main::@2 +(label) main::@7 +(label) main::@8 (label) main::@return +(label) toSpritePtr1 +(word~) toSpritePtr1_$0 +(word) toSpritePtr1_$0#0 +(word~) toSpritePtr1_$1 +(word) toSpritePtr1_$1#0 +(byte~) toSpritePtr1_$2 +(byte) toSpritePtr1_$2#0 +(label) toSpritePtr1_@return +(byte) toSpritePtr1_return +(byte) toSpritePtr1_return#0 +(byte) toSpritePtr1_return#1 +(byte) toSpritePtr1_return#2 +(byte) toSpritePtr1_return#3 +(byte*) toSpritePtr1_sprite +(byte*) toSpritePtr1_sprite#0 +(byte*) toSpritePtr1_sprite#1 -Culled Empty Block (label) main::@2 -Culled Empty Block (label) @9 -Successful SSA optimization Pass2CullEmptyBlocks -Alias candidate removed (volatile)(byte) IRQ_RASTER_FIRST#0 = (byte) irq_raster_next#0 (byte) irq_raster_next#8 +Alias candidate removed (volatile)(byte) IRQ_RASTER_FIRST#0 = (byte) irq_raster_next#2 (byte) irq_raster_next#32 (byte) irq_raster_next#28 (byte) irq_raster_next#27 (byte) irq_raster_next#21 +Alias candidate removed (volatile)(byte) toSpritePtr1_return#0 = (byte) toSpritePtr1_$2#0 (byte) toSpritePtr1_return#2 (byte) toSpritePtr1_return#1 (byte) toSpritePtr1_return#3 (byte~) $1 (byte) irq_sprite_ptr#2 (byte) irq_sprite_ptr#20 +Alias candidate removed (volatile)(byte) init_irq::toSpritePtr2_return#0 = (byte) init_irq::toSpritePtr2_$2#0 (byte) init_irq::toSpritePtr2_return#2 (byte) init_irq::toSpritePtr2_return#1 (byte) init_irq::toSpritePtr2_return#3 (byte~) init_irq::$0 (byte) irq_sprite_ptr#3 (byte) irq_sprite_ptr#11 (byte) irq_sprite_ptr#4 +Alias candidate removed (volatile)(byte) irq::toSpritePtr2_return#0 = (byte) irq::toSpritePtr2_$2#0 (byte) irq::toSpritePtr2_return#2 (byte) irq::toSpritePtr2_return#1 (byte) irq::toSpritePtr2_return#3 (byte~) irq::$2 (byte) irq_sprite_ptr#5 +Alias (byte*) PLAYFIELD_SPRITE_PTRS#0 = (byte*~) $0 +Alias (byte) irq_raster_next#16 = (byte) irq_raster_next#22 +Alias (byte) irq_sprite_ypos#17 = (byte) irq_sprite_ypos#23 +Alias (byte) irq_sprite_ptr#16 = (byte) irq_sprite_ptr#21 +Alias (byte) irq_cnt#15 = (byte) irq_cnt#20 +Alias (byte) irq_raster_next#0 = (byte) irq_raster_next#9 +Alias (byte) irq_sprite_ypos#0 = (byte) irq_sprite_ypos#9 +Alias (byte) irq_sprite_ptr#0 = (byte) irq_sprite_ptr#9 +Alias (byte) irq_cnt#0 = (byte) irq_cnt#9 +Alias (byte) irq_raster_next#1 = (byte) irq_raster_next#23 (byte) irq_raster_next#17 (byte) irq_raster_next#10 +Alias (byte) irq_sprite_ypos#1 = (byte) irq_sprite_ypos#24 (byte) irq_sprite_ypos#18 (byte) irq_sprite_ypos#10 +Alias (byte) irq_sprite_ptr#1 = (byte) irq_sprite_ptr#22 (byte) irq_sprite_ptr#17 (byte) irq_sprite_ptr#10 +Alias (byte) irq_cnt#1 = (byte) irq_cnt#21 (byte) irq_cnt#16 (byte) irq_cnt#10 Alias (byte*) init_sprites::vicSelectGfxBank1_gfx#0 = (byte*) init_sprites::vicSelectGfxBank1_gfx#1 (byte*) init_sprites::vicSelectGfxBank1_toDd001_gfx#0 (byte*) init_sprites::vicSelectGfxBank1_toDd001_gfx#1 -Alias (byte*) PLAYFIELD_SCREEN#1 = (byte*) PLAYFIELD_SCREEN#12 (byte*) PLAYFIELD_SCREEN#10 (byte*) PLAYFIELD_SCREEN#8 (byte*) PLAYFIELD_SCREEN#5 (byte*) PLAYFIELD_SCREEN#2 (byte*) PLAYFIELD_SCREEN#9 (byte*) PLAYFIELD_SCREEN#6 (byte*) PLAYFIELD_SCREEN#3 -Alias (byte*) PLAYFIELD_CHARSET#1 = (byte*) PLAYFIELD_CHARSET#5 (byte*) PLAYFIELD_CHARSET#6 (byte*) PLAYFIELD_CHARSET#4 (byte*) PLAYFIELD_CHARSET#3 (byte*) PLAYFIELD_CHARSET#2 -Alias (byte*) PLAYFIELD_SPRITES#1 = (byte*) PLAYFIELD_SPRITES#10 (byte*) PLAYFIELD_SPRITES#11 (byte*) PLAYFIELD_SPRITES#9 (byte*) PLAYFIELD_SPRITES#8 (byte*) PLAYFIELD_SPRITES#7 (byte*) PLAYFIELD_SPRITES#6 (byte*) PLAYFIELD_SPRITES#5 (byte*) PLAYFIELD_SPRITES#3 Alias (byte) init_sprites::vicSelectGfxBank1_toDd001_return#0 = (byte/word/dword) init_sprites::vicSelectGfxBank1_toDd001_$3#0 (byte) init_sprites::vicSelectGfxBank1_toDd001_return#2 (byte) init_sprites::vicSelectGfxBank1_toDd001_return#1 (byte) init_sprites::vicSelectGfxBank1_toDd001_return#3 (byte) init_sprites::vicSelectGfxBank1_$0#0 Alias (byte*) init_sprites::toD0181_screen#0 = (byte*) init_sprites::toD0181_screen#1 Alias (byte*) init_sprites::toD0181_gfx#0 = (byte*) init_sprites::toD0181_gfx#1 Alias (byte) init_sprites::toD0181_return#0 = (byte) init_sprites::toD0181_$8#0 (byte) init_sprites::toD0181_return#2 (byte) init_sprites::toD0181_return#1 (byte) init_sprites::toD0181_return#3 (byte~) init_sprites::$1 -Alias (byte*) init_sprites::sprites_ptr#0 = (byte*~) init_sprites::$2 (byte*) init_sprites::sprites_ptr#4 (byte*) init_sprites::sprites_ptr#3 (byte*) init_sprites::sprites_ptr#2 -Alias (byte) init_sprites::xpos#0 = (byte/signed word/word/dword/signed dword/signed byte~) init_sprites::$4 (byte) init_sprites::xpos#5 (byte) init_sprites::xpos#4 (byte) init_sprites::xpos#3 -Alias (byte*) init_sprites::toSpritePtr1_sprite#0 = (byte*) init_sprites::toSpritePtr1_sprite#1 -Alias (byte) init_sprites::ypos#0 = (byte) init_sprites::ypos#4 (byte) init_sprites::ypos#3 (byte) init_sprites::ypos#2 -Alias (byte) init_sprites::toSpritePtr1_return#0 = (byte) init_sprites::toSpritePtr1_$2#0 (byte) init_sprites::toSpritePtr1_return#2 (byte) init_sprites::toSpritePtr1_return#1 (byte) init_sprites::toSpritePtr1_return#3 (byte~) init_sprites::$5 (byte) init_sprites::ptr#0 -Alias (byte) init_sprites::s2#0 = (byte~) init_sprites::$6 -Alias (byte) init_sprites::xpos#1 = (byte/signed word/word/dword/signed dword~) init_sprites::$7 -Alias (byte*) PLAYFIELD_SPRITES#0 = (byte*) PLAYFIELD_SPRITES#4 (byte*) PLAYFIELD_SPRITES#2 -Alias (byte*) PLAYFIELD_SCREEN#0 = (byte*) PLAYFIELD_SCREEN#11 (byte*) PLAYFIELD_SCREEN#7 -Alias (byte*) PLAYFIELD_CHARSET#0 = (byte*) PLAYFIELD_CHARSET#9 (byte*) PLAYFIELD_CHARSET#8 -Alias (byte) irq_raster_next#4 = (byte) irq_raster_next#7 -Alias (byte) irq_sprite_ypos#4 = (byte) irq_sprite_ypos#5 -Alias (byte) irq_cnt#1 = (byte) irq_cnt#8 -Alias (byte) irq_cnt#3 = (byte) irq_cnt#5 (byte) irq_cnt#7 -Alias (byte) irq_raster_next#3 = (byte) irq_raster_next#6 (byte) irq_raster_next#5 -Alias (byte) irq_sprite_ypos#3 = (byte) irq_sprite_ypos#6 (byte) irq_sprite_ypos#8 -Alias (byte) irq_sprite_ypos#0 = (byte) irq_sprite_ypos#7 -Alias (byte) irq_cnt#0 = (byte) irq_cnt#6 +Alias (byte) init_sprites::xpos#0 = (byte/signed word/word/dword/signed dword/signed byte~) init_sprites::$3 +Alias (byte) init_sprites::s2#0 = (byte~) init_sprites::$4 +Alias (byte) init_sprites::xpos#1 = (byte/signed word/word/dword/signed dword~) init_sprites::$5 +Alias (byte*) PLAYFIELD_SPRITES#0 = (byte*) toSpritePtr1_sprite#0 (byte*) toSpritePtr1_sprite#1 +Alias (byte) irq_sprite_ypos#2 = (byte) irq_sprite_ypos#31 (byte) irq_sprite_ypos#28 (byte) irq_sprite_ypos#27 (byte) irq_sprite_ypos#20 +Alias (byte*) init_irq::toSpritePtr2_sprite#0 = (byte*) init_irq::toSpritePtr2_sprite#1 +Alias (byte) irq_raster_next#11 = (byte) irq_raster_next#29 (byte) irq_raster_next#3 (byte) irq_raster_next#24 (byte) irq_raster_next#18 (byte) irq_raster_next#4 +Alias (byte) irq_sprite_ypos#11 = (byte) irq_sprite_ypos#29 (byte) irq_sprite_ypos#3 (byte) irq_sprite_ypos#25 (byte) irq_sprite_ypos#19 (byte) irq_sprite_ypos#4 +Alias (byte) irq_cnt#11 = (byte) irq_cnt#3 (byte) irq_cnt#4 +Alias (byte) irq_sprite_ptr#12 = (byte) irq_sprite_ptr#18 (byte) irq_sprite_ptr#13 +Alias (byte) irq_cnt#12 = (byte) irq_cnt#17 +Alias (byte) irq_raster_next#12 = (byte) irq_raster_next#19 (byte) irq_raster_next#25 +Alias (byte) irq_sprite_ypos#13 = (byte) irq_sprite_ypos#21 (byte) irq_sprite_ypos#14 +Alias (byte*) irq::toSpritePtr2_sprite#0 = (byte*) irq::toSpritePtr2_sprite#1 +Alias (byte) irq_raster_next#20 = (byte) irq_raster_next#31 (byte) irq_raster_next#5 (byte) irq_raster_next#26 +Alias (byte) irq_cnt#24 = (byte) irq_cnt#26 (byte) irq_cnt#6 (byte) irq_cnt#25 +Alias (byte) irq_sprite_ypos#26 = (byte) irq_sprite_ypos#32 (byte) irq_sprite_ypos#5 (byte) irq_sprite_ypos#30 +Alias (byte) irq_cnt#23 = (byte) irq_cnt#5 +Alias (byte) irq_cnt#13 = (byte) irq_cnt#18 (byte) irq_cnt#7 +Alias (byte) irq_raster_next#13 = (byte) irq_raster_next#14 (byte) irq_raster_next#7 +Alias (byte) irq_sprite_ypos#15 = (byte) irq_sprite_ypos#22 (byte) irq_sprite_ypos#7 +Alias (byte) irq_sprite_ptr#14 = (byte) irq_sprite_ptr#19 (byte) irq_sprite_ptr#7 +Alias (byte) irq_cnt#19 = (byte) irq_cnt#2 +Alias (byte) irq_raster_next#15 = (byte) irq_raster_next#8 +Alias (byte) irq_sprite_ypos#16 = (byte) irq_sprite_ypos#8 +Alias (byte) irq_sprite_ptr#15 = (byte) irq_sprite_ptr#8 +Alias (byte) irq_cnt#14 = (byte) irq_cnt#8 Successful SSA optimization Pass2AliasElimination -Alias candidate removed (volatile)(byte) IRQ_RASTER_FIRST#0 = (byte) irq_raster_next#0 (byte) irq_raster_next#8 -Self Phi Eliminated (byte) init_sprites::ypos#1 -Self Phi Eliminated (byte*) init_sprites::sprites_ptr#1 +Alias candidate removed (volatile)(byte) IRQ_RASTER_FIRST#0 = (byte) irq_raster_next#2 (byte) irq_raster_next#32 (byte) irq_raster_next#28 (byte) irq_raster_next#27 (byte) irq_raster_next#21 +Alias candidate removed (volatile)(byte) toSpritePtr1_return#0 = (byte) toSpritePtr1_$2#0 (byte) toSpritePtr1_return#2 (byte) toSpritePtr1_return#1 (byte) toSpritePtr1_return#3 (byte~) $1 (byte) irq_sprite_ptr#2 (byte) irq_sprite_ptr#20 +Alias candidate removed (volatile)(byte) init_irq::toSpritePtr2_return#0 = (byte) init_irq::toSpritePtr2_$2#0 (byte) init_irq::toSpritePtr2_return#2 (byte) init_irq::toSpritePtr2_return#1 (byte) init_irq::toSpritePtr2_return#3 (byte~) init_irq::$0 (byte) irq_sprite_ptr#3 (byte) irq_sprite_ptr#11 (byte) irq_sprite_ptr#4 +Alias candidate removed (volatile)(byte) irq::toSpritePtr2_return#0 = (byte) irq::toSpritePtr2_$2#0 (byte) irq::toSpritePtr2_return#2 (byte) irq::toSpritePtr2_return#1 (byte) irq::toSpritePtr2_return#3 (byte~) irq::$2 (byte) irq_sprite_ptr#5 +Self Phi Eliminated (byte) irq_raster_next#1 +Self Phi Eliminated (byte) irq_sprite_ypos#1 +Self Phi Eliminated (byte) irq_sprite_ptr#1 +Self Phi Eliminated (byte) irq_cnt#1 +Self Phi Eliminated (byte) irq_sprite_ypos#13 +Self Phi Eliminated (byte) irq_sprite_ptr#12 +Self Phi Eliminated (byte) irq_cnt#12 +Self Phi Eliminated (byte) irq_raster_next#12 Successful SSA optimization Pass2SelfPhiElimination -Redundant Phi (byte*) PLAYFIELD_SCREEN#4 (byte*) PLAYFIELD_SCREEN#0 -Redundant Phi (byte*) PLAYFIELD_CHARSET#7 (byte*) PLAYFIELD_CHARSET#0 -Redundant Phi (byte*) PLAYFIELD_SPRITES#12 (byte*) PLAYFIELD_SPRITES#0 -Redundant Phi (byte*) PLAYFIELD_SCREEN#1 (byte*) PLAYFIELD_SCREEN#4 -Redundant Phi (byte*) PLAYFIELD_CHARSET#1 (byte*) PLAYFIELD_CHARSET#7 -Redundant Phi (byte*) PLAYFIELD_SPRITES#1 (byte*) PLAYFIELD_SPRITES#12 -Redundant Phi (byte) init_sprites::ypos#1 (byte) init_sprites::ypos#0 -Redundant Phi (byte*) init_sprites::sprites_ptr#1 (byte*) init_sprites::sprites_ptr#0 -Redundant Phi (byte) irq_sprite_ypos#4 (byte) irq_sprite_ypos#0 -Redundant Phi (byte) irq_cnt#4 (byte) irq_cnt#0 -Redundant Phi (byte) irq_raster_next#4 (byte) irq_raster_next#8 -Redundant Phi (byte) irq_raster_next#8 (byte) irq_raster_next#0 +Redundant Phi (byte) irq_raster_next#16 (byte) irq_raster_next#21 +Redundant Phi (byte) irq_sprite_ypos#17 (byte) irq_sprite_ypos#2 +Redundant Phi (byte) irq_sprite_ptr#16 (byte) irq_sprite_ptr#20 +Redundant Phi (byte) irq_cnt#15 (byte) irq_cnt#19 +Redundant Phi (byte) irq_raster_next#0 (byte) irq_raster_next#11 +Redundant Phi (byte) irq_sprite_ypos#0 (byte) irq_sprite_ypos#11 +Redundant Phi (byte) irq_sprite_ptr#0 (byte) irq_sprite_ptr#4 +Redundant Phi (byte) irq_cnt#0 (byte) irq_cnt#11 +Redundant Phi (byte) irq_raster_next#1 (byte) irq_raster_next#0 +Redundant Phi (byte) irq_sprite_ypos#1 (byte) irq_sprite_ypos#0 +Redundant Phi (byte) irq_sprite_ptr#1 (byte) irq_sprite_ptr#0 +Redundant Phi (byte) irq_cnt#1 (byte) irq_cnt#0 +Redundant Phi (byte) irq_raster_next#32 (byte) irq_raster_next#2 +Redundant Phi (byte) toSpritePtr1_return#2 (byte) toSpritePtr1_return#0 +Redundant Phi (byte) irq_raster_next#28 (byte) irq_raster_next#32 +Redundant Phi (byte) toSpritePtr1_return#3 (byte) toSpritePtr1_return#1 +Redundant Phi (byte) irq_raster_next#27 (byte) irq_raster_next#28 +Redundant Phi (byte) init_irq::toSpritePtr2_return#2 (byte) init_irq::toSpritePtr2_return#0 +Redundant Phi (byte) init_irq::toSpritePtr2_return#3 (byte) init_irq::toSpritePtr2_return#1 +Redundant Phi (byte) irq_sprite_ptr#11 (byte) irq_sprite_ptr#3 +Redundant Phi (byte) irq_sprite_ypos#12 (byte) irq_sprite_ypos#2 +Redundant Phi (byte) irq_sprite_ptr#23 (byte) irq_sprite_ptr#20 +Redundant Phi (byte) irq_cnt#22 (byte) irq_cnt#19 +Redundant Phi (byte) irq_raster_next#30 (byte) irq_raster_next#21 +Redundant Phi (byte) irq_sprite_ypos#13 (byte) irq_sprite_ypos#12 +Redundant Phi (byte) irq_sprite_ptr#12 (byte) irq_sprite_ptr#23 +Redundant Phi (byte) irq_cnt#12 (byte) irq_cnt#22 +Redundant Phi (byte) irq_raster_next#12 (byte) irq_raster_next#30 +Redundant Phi (byte) irq::toSpritePtr2_return#2 (byte) irq::toSpritePtr2_return#0 +Redundant Phi (byte) irq::toSpritePtr2_return#3 (byte) irq::toSpritePtr2_return#1 +Redundant Phi (byte) irq_raster_next#21 (byte) irq_raster_next#27 +Redundant Phi (byte) irq_sprite_ptr#20 (byte) irq_sprite_ptr#2 +Redundant Phi (byte) irq_raster_next#15 (byte) irq_raster_next#1 +Redundant Phi (byte) irq_sprite_ypos#16 (byte) irq_sprite_ypos#1 +Redundant Phi (byte) irq_sprite_ptr#15 (byte) irq_sprite_ptr#1 +Redundant Phi (byte) irq_cnt#14 (byte) irq_cnt#1 Successful SSA optimization Pass2RedundantPhiElimination -Simple Condition (bool~) init_sprites::$8 if((byte) init_sprites::s#1!=rangelast(0,3)) goto init_sprites::@1 -Simple Condition (bool~) irq::$0 if((byte) irq_cnt#1==(byte/signed byte/word/signed word/dword/signed dword) 10) goto irq::@1 +Simple Condition (bool~) init_sprites::$6 if((byte) init_sprites::s#1!=rangelast(0,3)) goto init_sprites::@1 +Simple Condition (bool~) irq::$0 if(*((byte*) RASTER#0)!=(byte) irq_sprite_ypos#2) goto irq::@1 +Simple Condition (bool~) irq::$1 if((byte) irq_cnt#23==(byte/signed byte/word/signed word/dword/signed dword) 10) goto irq::@2 Successful SSA optimization Pass2ConditionalJumpSimplification Constant (const byte*) PROCPORT_DDR#0 = ((byte*))0 Constant (const byte) PROCPORT_DDR_MEMORY_MASK#0 = 7 @@ -829,120 +1059,177 @@ Constant (const byte) LIGHT_GREY#0 = 15 Constant (const byte*) PLAYFIELD_SPRITES#0 = ((byte*))8192 Constant (const byte*) PLAYFIELD_CHARSET#0 = ((byte*))4096 Constant (const byte*) PLAYFIELD_SCREEN#0 = ((byte*))1024 -Constant (const byte/signed byte/word/signed word/dword/signed dword) init_sprites::$3 = 14*8 -Constant (const byte) init_sprites::ypos#0 = 50 +Constant (const byte/signed byte/word/signed word/dword/signed dword) init_sprites::$2 = 14*8 Constant (const byte) init_sprites::s#0 = 0 Constant (const byte) IRQ_RASTER_FIRST#0 = 48 -Constant (const void()*) init_irq::$0 = &irq +Constant (const void()*) init_irq::$1 = &irq Successful SSA optimization Pass2ConstantIdentification +Constant (const byte*) PLAYFIELD_SPRITE_PTRS#0 = PLAYFIELD_SCREEN#0+SPRITE_PTRS#0 Constant (const byte*) init_sprites::vicSelectGfxBank1_gfx#0 = PLAYFIELD_SCREEN#0 Constant (const byte*) init_sprites::toD0181_screen#0 = PLAYFIELD_SCREEN#0 Constant (const byte*) init_sprites::toD0181_gfx#0 = PLAYFIELD_CHARSET#0 -Constant (const byte*) init_sprites::sprites_ptr#0 = PLAYFIELD_SCREEN#0+SPRITE_PTRS#0 -Constant (const byte) init_sprites::xpos#0 = 24+init_sprites::$3 -Constant (const byte*) init_sprites::toSpritePtr1_sprite#0 = PLAYFIELD_SPRITES#0 +Constant (const byte) init_sprites::xpos#0 = 24+init_sprites::$2 +Constant (const word) toSpritePtr1_$0#0 = ((word))PLAYFIELD_SPRITES#0 +Constant (const byte*) init_irq::toSpritePtr2_sprite#0 = PLAYFIELD_SPRITES#0 +Constant (const byte*) irq::toSpritePtr2_sprite#0 = PLAYFIELD_SPRITES#0 Successful SSA optimization Pass2ConstantIdentification Constant (const word) init_sprites::vicSelectGfxBank1_toDd001_$0#0 = ((word))init_sprites::vicSelectGfxBank1_gfx#0 Constant (const word) init_sprites::toD0181_$0#0 = ((word))init_sprites::toD0181_screen#0 Constant (const word) init_sprites::toD0181_$4#0 = ((word))init_sprites::toD0181_gfx#0 -Constant (const word) init_sprites::toSpritePtr1_$0#0 = ((word))init_sprites::toSpritePtr1_sprite#0 +Constant (const word) toSpritePtr1_$1#0 = toSpritePtr1_$0#0>>6 +Constant (const word) init_irq::toSpritePtr2_$0#0 = ((word))init_irq::toSpritePtr2_sprite#0 +Constant (const word) irq::toSpritePtr2_$0#0 = ((word))irq::toSpritePtr2_sprite#0 Successful SSA optimization Pass2ConstantIdentification Constant (const byte) init_sprites::vicSelectGfxBank1_toDd001_$1#0 = >init_sprites::vicSelectGfxBank1_toDd001_$0#0 Constant (const word) init_sprites::toD0181_$1#0 = init_sprites::toD0181_$0#0&16383 Constant (const byte) init_sprites::toD0181_$5#0 = >init_sprites::toD0181_$4#0 -Constant (const word) init_sprites::toSpritePtr1_$1#0 = init_sprites::toSpritePtr1_$0#0>>6 +Constant (const byte) toSpritePtr1_$2#0 = ((byte))toSpritePtr1_$1#0 +Constant (const word) init_irq::toSpritePtr2_$1#0 = init_irq::toSpritePtr2_$0#0>>6 +Constant (const word) irq::toSpritePtr2_$1#0 = irq::toSpritePtr2_$0#0>>6 Successful SSA optimization Pass2ConstantIdentification Constant (const byte) init_sprites::vicSelectGfxBank1_toDd001_$2#0 = init_sprites::vicSelectGfxBank1_toDd001_$1#0>>6 Constant (const word) init_sprites::toD0181_$2#0 = init_sprites::toD0181_$1#0<<2 Constant (const byte) init_sprites::toD0181_$6#0 = init_sprites::toD0181_$5#0>>2 -Constant (const byte) init_sprites::toSpritePtr1_return#0 = ((byte))init_sprites::toSpritePtr1_$1#0 +Constant (const byte) toSpritePtr1_return#0 = toSpritePtr1_$2#0 +Constant (const byte) init_irq::toSpritePtr2_$2#0 = ((byte))init_irq::toSpritePtr2_$1#0 +Constant (const byte) irq::toSpritePtr2_$2#0 = ((byte))irq::toSpritePtr2_$1#0 Successful SSA optimization Pass2ConstantIdentification Constant (const byte) init_sprites::vicSelectGfxBank1_toDd001_return#0 = 3^init_sprites::vicSelectGfxBank1_toDd001_$2#0 Constant (const byte) init_sprites::toD0181_$3#0 = >init_sprites::toD0181_$2#0 Constant (const byte) init_sprites::toD0181_$7#0 = init_sprites::toD0181_$6#0&15 +Constant (const byte) toSpritePtr1_return#1 = toSpritePtr1_return#0 +Constant (const byte) init_irq::toSpritePtr2_return#0 = init_irq::toSpritePtr2_$2#0 +Constant (const byte) irq::toSpritePtr2_return#0 = irq::toSpritePtr2_$2#0 Successful SSA optimization Pass2ConstantIdentification Constant (const byte) init_sprites::toD0181_return#0 = init_sprites::toD0181_$3#0|init_sprites::toD0181_$7#0 +Constant (const byte) $1 = toSpritePtr1_return#1 +Constant (const byte) init_irq::toSpritePtr2_return#1 = init_irq::toSpritePtr2_return#0 +Constant (const byte) irq::toSpritePtr2_return#1 = irq::toSpritePtr2_return#0 +Successful SSA optimization Pass2ConstantIdentification +Constant (const byte) init_irq::$0 = init_irq::toSpritePtr2_return#1 +Constant (const byte) irq::$2 = irq::toSpritePtr2_return#1 Successful SSA optimization Pass2ConstantIdentification Consolidated array index constant in *(SPRITES_YPOS#0+0) Consolidated array index constant in *(SPRITES_YPOS#0+2) Consolidated array index constant in *(SPRITES_YPOS#0+4) Consolidated array index constant in *(SPRITES_YPOS#0+6) +Consolidated array index constant in *(PLAYFIELD_SPRITE_PTRS#0+0) +Consolidated array index constant in *(PLAYFIELD_SPRITE_PTRS#0+1) +Consolidated array index constant in *(PLAYFIELD_SPRITE_PTRS#0+2) +Consolidated array index constant in *(PLAYFIELD_SPRITE_PTRS#0+3) Successful SSA optimization Pass2ConstantAdditionElimination +if() condition always true - replacing block destination if(true) goto main::@2 +Successful SSA optimization Pass2ConstantIfs Successful SSA optimization PassNEliminateUnusedVars +Removing unused block main::@return +Successful SSA optimization Pass2EliminateUnusedBlocks Resolved ranged next value init_sprites::s#1 ← ++ init_sprites::s#2 to ++ Resolved ranged comparison value if(init_sprites::s#1!=rangelast(0,3)) goto init_sprites::@1 to (byte/signed byte/word/signed word/dword/signed dword) 4 Culled Empty Block (label) @4 +Culled Empty Block (label) main::@8 +Culled Empty Block (label) main::@1 Culled Empty Block (label) init_sprites::vicSelectGfxBank1_toDd001_@return Culled Empty Block (label) init_sprites::@3 Culled Empty Block (label) init_sprites::toD0181_@return -Culled Empty Block (label) init_sprites::toSpritePtr1_@return -Culled Empty Block (label) init_sprites::@5 +Culled Empty Block (label) toSpritePtr1_@return +Culled Empty Block (label) init_irq::toSpritePtr2_@return +Culled Empty Block (label) irq::toSpritePtr2_@return +Culled Empty Block (label) @10 Successful SSA optimization Pass2CullEmptyBlocks +Alias (byte) irq_sprite_ptr#3 = (byte) irq_sprite_ptr#4 +Successful SSA optimization Pass2AliasElimination Inlining constant with var siblings (const byte) init_sprites::s#0 Inlining constant with var siblings (const byte) init_sprites::xpos#0 -Constant inlined init_sprites::s#0 = (byte/signed byte/word/signed word/dword/signed dword) 0 -Constant inlined init_sprites::toD0181_gfx#0 = (const byte*) PLAYFIELD_CHARSET#0 -Constant inlined init_sprites::$3 = (byte/signed byte/word/signed word/dword/signed dword) 14*(byte/signed byte/word/signed word/dword/signed dword) 8 -Constant inlined init_sprites::vicSelectGfxBank1_toDd001_$1#0 = >((word))(const byte*) PLAYFIELD_SCREEN#0 +Inlining constant with different constant siblings (const byte) init_irq::toSpritePtr2_return#1 +Inlining constant with different constant siblings (const byte) irq::toSpritePtr2_return#1 +Inlining constant with different constant siblings (const byte) toSpritePtr1_return#1 +Constant inlined init_sprites::$2 = (byte/signed byte/word/signed word/dword/signed dword) 14*(byte/signed byte/word/signed word/dword/signed dword) 8 Constant inlined init_sprites::toD0181_$7#0 = >((word))(const byte*) PLAYFIELD_CHARSET#0>>(byte/signed byte/word/signed word/dword/signed dword) 2&(byte/signed byte/word/signed word/dword/signed dword) 15 -Constant inlined init_sprites::vicSelectGfxBank1_toDd001_$0#0 = ((word))(const byte*) PLAYFIELD_SCREEN#0 Constant inlined init_sprites::toD0181_$6#0 = >((word))(const byte*) PLAYFIELD_CHARSET#0>>(byte/signed byte/word/signed word/dword/signed dword) 2 Constant inlined init_sprites::toD0181_$5#0 = >((word))(const byte*) PLAYFIELD_CHARSET#0 Constant inlined init_sprites::toD0181_$4#0 = ((word))(const byte*) PLAYFIELD_CHARSET#0 -Constant inlined init_sprites::vicSelectGfxBank1_toDd001_$2#0 = >((word))(const byte*) PLAYFIELD_SCREEN#0>>(byte/signed byte/word/signed word/dword/signed dword) 6 Constant inlined init_sprites::toD0181_$2#0 = ((word))(const byte*) PLAYFIELD_SCREEN#0&(word/signed word/dword/signed dword) 16383<<(byte/signed byte/word/signed word/dword/signed dword) 2 Constant inlined init_sprites::toD0181_$3#0 = >((word))(const byte*) PLAYFIELD_SCREEN#0&(word/signed word/dword/signed dword) 16383<<(byte/signed byte/word/signed word/dword/signed dword) 2 Constant inlined init_sprites::toD0181_$0#0 = ((word))(const byte*) PLAYFIELD_SCREEN#0 Constant inlined init_sprites::toD0181_$1#0 = ((word))(const byte*) PLAYFIELD_SCREEN#0&(word/signed word/dword/signed dword) 16383 -Constant inlined init_sprites::toD0181_screen#0 = (const byte*) PLAYFIELD_SCREEN#0 -Constant inlined init_sprites::toSpritePtr1_$1#0 = ((word))(const byte*) PLAYFIELD_SPRITES#0>>(byte/signed byte/word/signed word/dword/signed dword) 6 -Constant inlined init_sprites::toSpritePtr1_sprite#0 = (const byte*) PLAYFIELD_SPRITES#0 -Constant inlined init_sprites::toSpritePtr1_$0#0 = ((word))(const byte*) PLAYFIELD_SPRITES#0 +Constant inlined $1 = (const byte) toSpritePtr1_return#0 +Constant inlined init_irq::toSpritePtr2_sprite#0 = (const byte*) PLAYFIELD_SPRITES#0 Constant inlined init_sprites::xpos#0 = (byte/signed byte/word/signed word/dword/signed dword) 24+(byte/signed byte/word/signed word/dword/signed dword) 14*(byte/signed byte/word/signed word/dword/signed dword) 8 -Constant inlined init_irq::$0 = &interrupt(KERNEL_MIN)(void()) irq() +Constant inlined init_irq::$0 = (const byte) init_irq::toSpritePtr2_return#0 +Constant inlined irq::toSpritePtr2_sprite#0 = (const byte*) PLAYFIELD_SPRITES#0 +Constant inlined irq::toSpritePtr2_return#1 = (const byte) irq::toSpritePtr2_return#0 +Constant inlined init_irq::$1 = &interrupt(KERNEL_MIN)(void()) irq() Constant inlined init_sprites::vicSelectGfxBank1_gfx#0 = (const byte*) PLAYFIELD_SCREEN#0 +Constant inlined init_sprites::s#0 = (byte/signed byte/word/signed word/dword/signed dword) 0 +Constant inlined init_irq::toSpritePtr2_$2#0 = (const byte) init_irq::toSpritePtr2_return#0 +Constant inlined init_sprites::toD0181_gfx#0 = (const byte*) PLAYFIELD_CHARSET#0 +Constant inlined init_irq::toSpritePtr2_$1#0 = ((word))(const byte*) PLAYFIELD_SPRITES#0>>(byte/signed byte/word/signed word/dword/signed dword) 6 +Constant inlined init_sprites::vicSelectGfxBank1_toDd001_$1#0 = >((word))(const byte*) PLAYFIELD_SCREEN#0 +Constant inlined init_sprites::vicSelectGfxBank1_toDd001_$0#0 = ((word))(const byte*) PLAYFIELD_SCREEN#0 +Constant inlined init_irq::toSpritePtr2_$0#0 = ((word))(const byte*) PLAYFIELD_SPRITES#0 +Constant inlined init_irq::toSpritePtr2_return#1 = (const byte) init_irq::toSpritePtr2_return#0 +Constant inlined init_sprites::vicSelectGfxBank1_toDd001_$2#0 = >((word))(const byte*) PLAYFIELD_SCREEN#0>>(byte/signed byte/word/signed word/dword/signed dword) 6 +Constant inlined init_sprites::toD0181_screen#0 = (const byte*) PLAYFIELD_SCREEN#0 +Constant inlined toSpritePtr1_$1#0 = ((word))(const byte*) PLAYFIELD_SPRITES#0>>(byte/signed byte/word/signed word/dword/signed dword) 6 +Constant inlined toSpritePtr1_$2#0 = (const byte) toSpritePtr1_return#0 +Constant inlined toSpritePtr1_$0#0 = ((word))(const byte*) PLAYFIELD_SPRITES#0 +Constant inlined toSpritePtr1_return#1 = (const byte) toSpritePtr1_return#0 +Constant inlined irq::toSpritePtr2_$1#0 = ((word))(const byte*) PLAYFIELD_SPRITES#0>>(byte/signed byte/word/signed word/dword/signed dword) 6 +Constant inlined irq::$2 = (const byte) irq::toSpritePtr2_return#0 +Constant inlined irq::toSpritePtr2_$0#0 = ((word))(const byte*) PLAYFIELD_SPRITES#0 +Constant inlined irq::toSpritePtr2_$2#0 = (const byte) irq::toSpritePtr2_return#0 Successful SSA optimization Pass2ConstantInlining Simplifying constant plus zero SPRITES_YPOS#0+0 -Added new block during phi lifting init_sprites::@6(between init_sprites::@1 and init_sprites::@1) +Simplifying constant plus zero PLAYFIELD_SPRITE_PTRS#0+0 +Added new block during phi lifting init_sprites::@5(between init_sprites::@1 and init_sprites::@1) Adding NOP phi() at start of @begin +Adding NOP phi() at start of toSpritePtr1 Adding NOP phi() at start of @end Adding NOP phi() at start of main -Adding NOP phi() at start of main::@1 +Adding NOP phi() at start of main::@7 +Adding NOP phi() at start of init_irq::toSpritePtr2 Adding NOP phi() at start of init_sprites Adding NOP phi() at start of init_sprites::vicSelectGfxBank1_toDd001 Adding NOP phi() at start of init_sprites::toD0181 -Adding NOP phi() at start of init_sprites::toSpritePtr1 +Adding NOP phi() at start of irq::toSpritePtr2 CALL GRAPH -Calls in [] to main:5 -Calls in [main] to init_sprites:8 init_irq:10 +Calls in [] to main:7 +Calls in [main] to init_sprites:10 init_irq:12 -Created 4 initial phi equivalence classes -Coalesced [42] init_sprites::s#3 ← init_sprites::s#1 -Coalesced [43] init_sprites::xpos#6 ← init_sprites::xpos#1 -Coalesced [44] init_sprites::ptr#3 ← init_sprites::ptr#1 -Coalesced [55] irq_raster_next#10 ← irq_raster_next#2 -Coalesced [65] irq_raster_next#9 ← irq_raster_next#1 -Coalesced down to 4 phi equivalence classes -Culled Empty Block (label) init_sprites::@6 +Created 3 initial phi equivalence classes +Coalesced [45] init_sprites::s#3 ← init_sprites::s#1 +Coalesced [46] init_sprites::xpos#3 ← init_sprites::xpos#1 +Coalesced [65] irq_raster_next#33 ← irq_raster_next#6 +Coalesced [76] irq_raster_next#34 ← irq_raster_next#20 +Coalesced down to 3 phi equivalence classes +Culled Empty Block (label) init_sprites::@5 Adding NOP phi() at start of @begin +Adding NOP phi() at start of toSpritePtr1 Adding NOP phi() at start of @end Adding NOP phi() at start of main -Adding NOP phi() at start of main::@1 +Adding NOP phi() at start of main::@7 +Adding NOP phi() at start of init_irq::toSpritePtr2 Adding NOP phi() at start of init_sprites Adding NOP phi() at start of init_sprites::vicSelectGfxBank1_toDd001 Adding NOP phi() at start of init_sprites::toD0181 -Adding NOP phi() at start of init_sprites::toSpritePtr1 +Adding NOP phi() at start of irq::toSpritePtr2 FINAL CONTROL FLOW GRAPH @begin: scope:[] from [0] phi() to:@6 @6: scope:[] from @begin - [1] (byte) irq_raster_next#0 ← (const byte) IRQ_RASTER_FIRST#0 - [2] (byte) irq_cnt#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 - [3] (byte) irq_sprite_ypos#0 ← (byte/signed byte/word/signed word/dword/signed dword) 50 + [1] (byte) irq_raster_next#2 ← (const byte) IRQ_RASTER_FIRST#0 + [2] (byte) irq_sprite_ypos#2 ← (byte/signed byte/word/signed word/dword/signed dword) 50 + to:toSpritePtr1 +toSpritePtr1: scope:[] from @6 + [3] phi() + to:@9 +@9: scope:[] from toSpritePtr1 + [4] (byte) irq_sprite_ptr#2 ← (const byte) toSpritePtr1_return#0 + [5] (byte) irq_cnt#19 ← (byte/signed byte/word/signed word/dword/signed dword) 0 to:@8 -@8: scope:[] from @6 +@8: scope:[] from @9 kickasm(location (const byte*) PLAYFIELD_SPRITES#0) {{ .var sprites = LoadPicture("nes-playfield.png", List().add($010101, $000000)) .for(var sy=0;sy<10;sy++) { .for(var sx=0;sx<3;sx++) { @@ -955,104 +1242,123 @@ FINAL CONTROL FLOW GRAPH } } }} - [5] call main + [7] call main to:@end @end: scope:[] from @8 - [6] phi() + [8] phi() main: scope:[main] from @8 - [7] phi() - [8] call init_sprites - to:main::@1 -main::@1: scope:[main] from main [9] phi() - [10] call init_irq - to:main::@return -main::@return: scope:[main] from main::@1 - [11] return - to:@return -init_irq: scope:[init_irq] from main::@1 + [10] call init_sprites + to:main::@7 +main::@7: scope:[main] from main + [11] phi() + [12] call init_irq + to:main::@2 +main::@2: scope:[main] from main::@2 main::@7 + [13] *((const byte*) PLAYFIELD_SCREEN#0) ← ++ *((const byte*) PLAYFIELD_SCREEN#0) + to:main::@2 +init_irq: scope:[init_irq] from main::@7 + [14] (byte) irq_raster_next#11 ← (const byte) IRQ_RASTER_FIRST#0 + [15] (byte) irq_sprite_ypos#11 ← (byte/signed byte/word/signed word/dword/signed dword) 50 + to:init_irq::toSpritePtr2 +init_irq::toSpritePtr2: scope:[init_irq] from init_irq + [16] phi() + to:init_irq::@1 +init_irq::@1: scope:[init_irq] from init_irq::toSpritePtr2 + [17] (byte) irq_sprite_ptr#3 ← (const byte) init_irq::toSpritePtr2_return#0 + [18] (byte) irq_cnt#11 ← (byte/signed byte/word/signed word/dword/signed dword) 0 asm { sei } - [13] *((const byte*) CIA1_INTERRUPT#0) ← (const byte) CIA_INTERRUPT_CLEAR#0 - [14] *((const byte*) VIC_CONTROL#0) ← *((const byte*) VIC_CONTROL#0) & (byte/signed byte/word/signed word/dword/signed dword) 127 - [15] *((const byte*) RASTER#0) ← (const byte) IRQ_RASTER_FIRST#0 - [16] *((const byte*) IRQ_ENABLE#0) ← (const byte) IRQ_RASTER#0 - [17] *((const void()**) KERNEL_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq() + [20] *((const byte*) CIA1_INTERRUPT#0) ← (const byte) CIA_INTERRUPT_CLEAR#0 + [21] *((const byte*) VIC_CONTROL#0) ← *((const byte*) VIC_CONTROL#0) & (byte/signed byte/word/signed word/dword/signed dword) 127 + [22] *((const byte*) RASTER#0) ← (const byte) IRQ_RASTER_FIRST#0 + [23] *((const byte*) IRQ_ENABLE#0) ← (const byte) IRQ_RASTER#0 + [24] *((const void()**) KERNEL_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq() asm { cli } to:init_irq::@return -init_irq::@return: scope:[init_irq] from init_irq - [19] return +init_irq::@return: scope:[init_irq] from init_irq::@1 + [26] return to:@return init_sprites: scope:[init_sprites] from main - [20] phi() + [27] phi() to:init_sprites::vicSelectGfxBank1 init_sprites::vicSelectGfxBank1: scope:[init_sprites] from init_sprites - [21] *((const byte*) CIA2_PORT_A_DDR#0) ← (byte/signed byte/word/signed word/dword/signed dword) 3 + [28] *((const byte*) CIA2_PORT_A_DDR#0) ← (byte/signed byte/word/signed word/dword/signed dword) 3 to:init_sprites::vicSelectGfxBank1_toDd001 init_sprites::vicSelectGfxBank1_toDd001: scope:[init_sprites] from init_sprites::vicSelectGfxBank1 - [22] phi() + [29] phi() to:init_sprites::vicSelectGfxBank1_@1 init_sprites::vicSelectGfxBank1_@1: scope:[init_sprites] from init_sprites::vicSelectGfxBank1_toDd001 - [23] *((const byte*) CIA2_PORT_A#0) ← (const byte) init_sprites::vicSelectGfxBank1_toDd001_return#0 + [30] *((const byte*) CIA2_PORT_A#0) ← (const byte) init_sprites::vicSelectGfxBank1_toDd001_return#0 to:init_sprites::toD0181 init_sprites::toD0181: scope:[init_sprites] from init_sprites::vicSelectGfxBank1_@1 - [24] phi() + [31] phi() to:init_sprites::@4 init_sprites::@4: scope:[init_sprites] from init_sprites::toD0181 - [25] *((const byte*) D018#0) ← (const byte) init_sprites::toD0181_return#0 - [26] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 15 - [27] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 - [28] *((const byte*) SPRITES_EXPAND_Y#0) ← *((const byte*) SPRITES_MC#0) - [29] *((const byte*) SPRITES_EXPAND_X#0) ← *((const byte*) SPRITES_EXPAND_Y#0) - to:init_sprites::toSpritePtr1 -init_sprites::toSpritePtr1: scope:[init_sprites] from init_sprites::@4 - [30] phi() + [32] *((const byte*) D018#0) ← (const byte) init_sprites::toD0181_return#0 + [33] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 15 + [34] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 + [35] *((const byte*) SPRITES_EXPAND_Y#0) ← *((const byte*) SPRITES_MC#0) + [36] *((const byte*) SPRITES_EXPAND_X#0) ← *((const byte*) SPRITES_EXPAND_Y#0) to:init_sprites::@1 -init_sprites::@1: scope:[init_sprites] from init_sprites::@1 init_sprites::toSpritePtr1 - [31] (byte) init_sprites::ptr#2 ← phi( init_sprites::@1/(byte) init_sprites::ptr#1 init_sprites::toSpritePtr1/(const byte) init_sprites::toSpritePtr1_return#0 ) - [31] (byte) init_sprites::xpos#2 ← phi( init_sprites::@1/(byte) init_sprites::xpos#1 init_sprites::toSpritePtr1/(byte/signed byte/word/signed word/dword/signed dword) 24+(byte/signed byte/word/signed word/dword/signed dword) 14*(byte/signed byte/word/signed word/dword/signed dword) 8 ) - [31] (byte) init_sprites::s#2 ← phi( init_sprites::@1/(byte) init_sprites::s#1 init_sprites::toSpritePtr1/(byte/signed byte/word/signed word/dword/signed dword) 0 ) - [32] (byte) init_sprites::s2#0 ← (byte) init_sprites::s#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 - [33] *((const byte*) SPRITES_XPOS#0 + (byte) init_sprites::s2#0) ← (byte) init_sprites::xpos#2 - [34] *((const byte*) SPRITES_YPOS#0 + (byte) init_sprites::s2#0) ← (const byte) init_sprites::ypos#0 - [35] *((const byte*) SPRITES_COLS#0 + (byte) init_sprites::s#2) ← (const byte) BLACK#0 - [36] *((const byte*) init_sprites::sprites_ptr#0 + (byte) init_sprites::s#2) ← (byte) init_sprites::ptr#2 - [37] (byte) init_sprites::xpos#1 ← (byte) init_sprites::xpos#2 + (byte/signed byte/word/signed word/dword/signed dword) 24 - [38] (byte) init_sprites::ptr#1 ← ++ (byte) init_sprites::ptr#2 - [39] (byte) init_sprites::s#1 ← ++ (byte) init_sprites::s#2 - [40] if((byte) init_sprites::s#1!=(byte/signed byte/word/signed word/dword/signed dword) 4) goto init_sprites::@1 +init_sprites::@1: scope:[init_sprites] from init_sprites::@1 init_sprites::@4 + [37] (byte) init_sprites::xpos#2 ← phi( init_sprites::@1/(byte) init_sprites::xpos#1 init_sprites::@4/(byte/signed byte/word/signed word/dword/signed dword) 24+(byte/signed byte/word/signed word/dword/signed dword) 14*(byte/signed byte/word/signed word/dword/signed dword) 8 ) + [37] (byte) init_sprites::s#2 ← phi( init_sprites::@1/(byte) init_sprites::s#1 init_sprites::@4/(byte/signed byte/word/signed word/dword/signed dword) 0 ) + [38] (byte) init_sprites::s2#0 ← (byte) init_sprites::s#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 + [39] *((const byte*) SPRITES_XPOS#0 + (byte) init_sprites::s2#0) ← (byte) init_sprites::xpos#2 + [40] *((const byte*) SPRITES_COLS#0 + (byte) init_sprites::s#2) ← (const byte) BLACK#0 + [41] (byte) init_sprites::xpos#1 ← (byte) init_sprites::xpos#2 + (byte/signed byte/word/signed word/dword/signed dword) 24 + [42] (byte) init_sprites::s#1 ← ++ (byte) init_sprites::s#2 + [43] if((byte) init_sprites::s#1!=(byte/signed byte/word/signed word/dword/signed dword) 4) goto init_sprites::@1 to:init_sprites::@return init_sprites::@return: scope:[init_sprites] from init_sprites::@1 - [41] return + [44] return to:@return irq: scope:[irq] from - [42] *((const byte*) BGCOL#0) ← (const byte) WHITE#0 - [43] *((const byte*) BORDERCOL#0) ← *((const byte*) BGCOL#0) - [44] *((const byte*) SPRITES_YPOS#0) ← (byte) irq_sprite_ypos#0 - [45] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq_sprite_ypos#0 - [46] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 4) ← (byte) irq_sprite_ypos#0 - [47] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 6) ← (byte) irq_sprite_ypos#0 - [48] (byte) irq_cnt#1 ← ++ (byte) irq_cnt#0 - [49] if((byte) irq_cnt#1==(byte/signed byte/word/signed word/dword/signed dword) 10) goto irq::@1 + [45] *((const byte*) BORDERCOL#0) ← (const byte) DARK_GREY#0 + [46] *((const byte*) SPRITES_YPOS#0) ← (byte) irq_sprite_ypos#2 + [47] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq_sprite_ypos#2 + [48] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 4) ← (byte) irq_sprite_ypos#2 + [49] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 6) ← (byte) irq_sprite_ypos#2 + to:irq::@1 +irq::@1: scope:[irq] from irq irq::@1 + [50] if(*((const byte*) RASTER#0)!=(byte) irq_sprite_ypos#2) goto irq::@1 + to:irq::@4 +irq::@4: scope:[irq] from irq::@1 + [51] (byte) irq::ptr#0 ← (byte) irq_sprite_ptr#2 + [52] *((const byte*) PLAYFIELD_SPRITE_PTRS#0) ← (byte) irq::ptr#0 + [53] (byte) irq::ptr#1 ← ++ (byte) irq::ptr#0 + [54] *((const byte*) PLAYFIELD_SPRITE_PTRS#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) irq::ptr#1 + [55] *((const byte*) PLAYFIELD_SPRITE_PTRS#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq::ptr#1 + [56] (byte) irq::ptr#2 ← ++ (byte) irq::ptr#1 + [57] *((const byte*) PLAYFIELD_SPRITE_PTRS#0+(byte/signed byte/word/signed word/dword/signed dword) 3) ← (byte) irq::ptr#2 + [58] (byte) irq_cnt#23 ← ++ (byte) irq_cnt#19 + [59] if((byte) irq_cnt#23==(byte/signed byte/word/signed word/dword/signed dword) 10) goto irq::@2 + to:irq::@5 +irq::@5: scope:[irq] from irq::@4 + [60] (byte) irq_raster_next#6 ← (byte) irq_raster_next#2 + (byte/signed byte/word/signed word/dword/signed dword) 21 + [61] (byte) irq_sprite_ypos#6 ← (byte) irq_sprite_ypos#2 + (byte/signed byte/word/signed word/dword/signed dword) 21 + [62] (byte) irq_sprite_ptr#6 ← (byte) irq_sprite_ptr#2 + (byte/signed byte/word/signed word/dword/signed dword) 3 to:irq::@3 -irq::@3: scope:[irq] from irq - [50] (byte) irq_raster_next#2 ← (byte) irq_raster_next#0 + (byte/signed byte/word/signed word/dword/signed dword) 21 - [51] (byte) irq_sprite_ypos#2 ← (byte) irq_sprite_ypos#0 + (byte/signed byte/word/signed word/dword/signed dword) 21 - to:irq::@2 -irq::@2: scope:[irq] from irq::@1 irq::@3 - [52] (byte) irq_raster_next#3 ← phi( irq::@1/(byte) irq_raster_next#1 irq::@3/(byte) irq_raster_next#2 ) - [53] *((const byte*) RASTER#0) ← (byte) irq_raster_next#3 - [54] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0 - [55] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 - [56] *((const byte*) BGCOL#0) ← (const byte) BLUE#0 +irq::@3: scope:[irq] from irq::@5 irq::@7 + [63] (byte) irq_raster_next#13 ← phi( irq::@5/(byte) irq_raster_next#6 irq::@7/(byte) irq_raster_next#20 ) + [64] *((const byte*) RASTER#0) ← (byte) irq_raster_next#13 + [65] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0 + [66] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 to:irq::@return -irq::@return: scope:[irq] from irq::@2 - [57] return +irq::@return: scope:[irq] from irq::@3 + [67] return to:@return -irq::@1: scope:[irq] from irq - [58] (byte) irq_cnt#2 ← (byte/signed byte/word/signed word/dword/signed dword) 0 - [59] (byte) irq_raster_next#1 ← (const byte) IRQ_RASTER_FIRST#0 - [60] (byte) irq_sprite_ypos#1 ← (byte/signed byte/word/signed word/dword/signed dword) 50 - to:irq::@2 +irq::@2: scope:[irq] from irq::@4 + [68] (byte) irq_cnt#24 ← (byte/signed byte/word/signed word/dword/signed dword) 0 + [69] (byte) irq_raster_next#20 ← (const byte) IRQ_RASTER_FIRST#0 + [70] (byte) irq_sprite_ypos#26 ← (byte/signed byte/word/signed word/dword/signed dword) 50 + to:irq::toSpritePtr2 +irq::toSpritePtr2: scope:[irq] from irq::@2 + [71] phi() + to:irq::@7 +irq::@7: scope:[irq] from irq::toSpritePtr2 + [72] (byte) irq_sprite_ptr#5 ← (const byte) irq::toSpritePtr2_return#0 + to:irq::@3 VARIABLE REGISTER WEIGHTS @@ -1104,6 +1410,7 @@ VARIABLE REGISTER WEIGHTS (byte*) PLAYFIELD_CHARSET (byte*) PLAYFIELD_SCREEN (byte*) PLAYFIELD_SPRITES +(byte*) PLAYFIELD_SPRITE_PTRS (byte*) PROCPORT (byte) PROCPORT_BASIC_KERNEL_IO (byte*) PROCPORT_DDR @@ -1140,16 +1447,17 @@ VARIABLE REGISTER WEIGHTS (byte) WHITE (byte) YELLOW (void()) init_irq() +(word~) init_irq::toSpritePtr2_$0 +(word~) init_irq::toSpritePtr2_$1 +(byte~) init_irq::toSpritePtr2_$2 +(byte) init_irq::toSpritePtr2_return +(byte*) init_irq::toSpritePtr2_sprite (void()) init_sprites() -(byte) init_sprites::ptr -(byte) init_sprites::ptr#1 7.333333333333333 -(byte) init_sprites::ptr#2 4.714285714285714 (byte) init_sprites::s (byte) init_sprites::s#1 16.5 -(byte) init_sprites::s#2 6.875 +(byte) init_sprites::s#2 8.8 (byte) init_sprites::s2 -(byte) init_sprites::s2#0 16.5 -(byte*) init_sprites::sprites_ptr +(byte) init_sprites::s2#0 22.0 (word~) init_sprites::toD0181_$0 (word~) init_sprites::toD0181_$1 (word~) init_sprites::toD0181_$2 @@ -1162,11 +1470,6 @@ VARIABLE REGISTER WEIGHTS (byte*) init_sprites::toD0181_gfx (byte) init_sprites::toD0181_return (byte*) init_sprites::toD0181_screen -(word~) init_sprites::toSpritePtr1_$0 -(word~) init_sprites::toSpritePtr1_$1 -(byte~) init_sprites::toSpritePtr1_$2 -(byte) init_sprites::toSpritePtr1_return -(byte*) init_sprites::toSpritePtr1_sprite (byte~) init_sprites::vicSelectGfxBank1_$0 (byte*) init_sprites::vicSelectGfxBank1_gfx (word~) init_sprites::vicSelectGfxBank1_toDd001_$0 @@ -1176,63 +1479,111 @@ VARIABLE REGISTER WEIGHTS (byte*) init_sprites::vicSelectGfxBank1_toDd001_gfx (byte) init_sprites::vicSelectGfxBank1_toDd001_return (byte) init_sprites::xpos -(byte) init_sprites::xpos#1 5.5 -(byte) init_sprites::xpos#2 5.5 -(byte) init_sprites::ypos +(byte) init_sprites::xpos#1 7.333333333333333 +(byte) init_sprites::xpos#2 8.25 interrupt(KERNEL_MIN)(void()) irq() +(byte) irq::ptr +(byte) irq::ptr#0 3.0 +(byte) irq::ptr#1 2.6666666666666665 +(byte) irq::ptr#2 4.0 +(word~) irq::toSpritePtr2_$0 +(word~) irq::toSpritePtr2_$1 +(byte~) irq::toSpritePtr2_$2 +(byte) irq::toSpritePtr2_return +(byte*) irq::toSpritePtr2_sprite (byte) irq_cnt -(byte) irq_cnt#0 0.6666666666666666 -(byte) irq_cnt#1 4.0 -(byte) irq_cnt#2 20.0 +(byte) irq_cnt#11 20.0 +(byte) irq_cnt#19 0.3076923076923077 +(byte) irq_cnt#23 4.0 +(byte) irq_cnt#24 20.0 (byte) irq_raster_next -(byte) irq_raster_next#0 0.5 -(byte) irq_raster_next#1 2.0 -(byte) irq_raster_next#2 2.0 -(byte) irq_raster_next#3 6.0 +(byte) irq_raster_next#11 20.0 +(byte) irq_raster_next#13 6.0 +(byte) irq_raster_next#2 0.26666666666666666 +(byte) irq_raster_next#20 1.0 +(byte) irq_raster_next#6 1.3333333333333333 +(byte) irq_sprite_ptr +(byte) irq_sprite_ptr#2 0.3529411764705882 +(byte) irq_sprite_ptr#3 20.0 +(byte) irq_sprite_ptr#5 20.0 +(byte) irq_sprite_ptr#6 20.0 (byte) irq_sprite_ypos -(byte) irq_sprite_ypos#0 1.3333333333333335 -(byte) irq_sprite_ypos#1 20.0 -(byte) irq_sprite_ypos#2 20.0 +(byte) irq_sprite_ypos#11 20.0 +(byte) irq_sprite_ypos#2 1.4375 +(byte) irq_sprite_ypos#26 20.0 +(byte) irq_sprite_ypos#6 20.0 (void()) main() +(word~) toSpritePtr1_$0 +(word~) toSpritePtr1_$1 +(byte~) toSpritePtr1_$2 +(byte) toSpritePtr1_return +(byte*) toSpritePtr1_sprite Initial phi equivalence classes [ init_sprites::s#2 init_sprites::s#1 ] [ init_sprites::xpos#2 init_sprites::xpos#1 ] -[ init_sprites::ptr#2 init_sprites::ptr#1 ] -[ irq_raster_next#3 irq_raster_next#1 irq_raster_next#2 ] -Added variable irq_raster_next#0 to zero page equivalence class [ irq_raster_next#0 ] -Added variable irq_cnt#0 to zero page equivalence class [ irq_cnt#0 ] -Added variable irq_sprite_ypos#0 to zero page equivalence class [ irq_sprite_ypos#0 ] -Added variable init_sprites::s2#0 to zero page equivalence class [ init_sprites::s2#0 ] -Added variable irq_cnt#1 to zero page equivalence class [ irq_cnt#1 ] +[ irq_raster_next#13 irq_raster_next#6 irq_raster_next#20 ] +Added variable irq_raster_next#2 to zero page equivalence class [ irq_raster_next#2 ] Added variable irq_sprite_ypos#2 to zero page equivalence class [ irq_sprite_ypos#2 ] -Added variable irq_cnt#2 to zero page equivalence class [ irq_cnt#2 ] -Added variable irq_sprite_ypos#1 to zero page equivalence class [ irq_sprite_ypos#1 ] +Added variable irq_sprite_ptr#2 to zero page equivalence class [ irq_sprite_ptr#2 ] +Added variable irq_cnt#19 to zero page equivalence class [ irq_cnt#19 ] +Added variable irq_raster_next#11 to zero page equivalence class [ irq_raster_next#11 ] +Added variable irq_sprite_ypos#11 to zero page equivalence class [ irq_sprite_ypos#11 ] +Added variable irq_sprite_ptr#3 to zero page equivalence class [ irq_sprite_ptr#3 ] +Added variable irq_cnt#11 to zero page equivalence class [ irq_cnt#11 ] +Added variable init_sprites::s2#0 to zero page equivalence class [ init_sprites::s2#0 ] +Added variable irq::ptr#0 to zero page equivalence class [ irq::ptr#0 ] +Added variable irq::ptr#1 to zero page equivalence class [ irq::ptr#1 ] +Added variable irq::ptr#2 to zero page equivalence class [ irq::ptr#2 ] +Added variable irq_cnt#23 to zero page equivalence class [ irq_cnt#23 ] +Added variable irq_sprite_ypos#6 to zero page equivalence class [ irq_sprite_ypos#6 ] +Added variable irq_sprite_ptr#6 to zero page equivalence class [ irq_sprite_ptr#6 ] +Added variable irq_cnt#24 to zero page equivalence class [ irq_cnt#24 ] +Added variable irq_sprite_ypos#26 to zero page equivalence class [ irq_sprite_ypos#26 ] +Added variable irq_sprite_ptr#5 to zero page equivalence class [ irq_sprite_ptr#5 ] Complete equivalence classes [ init_sprites::s#2 init_sprites::s#1 ] [ init_sprites::xpos#2 init_sprites::xpos#1 ] -[ init_sprites::ptr#2 init_sprites::ptr#1 ] -[ irq_raster_next#3 irq_raster_next#1 irq_raster_next#2 ] -[ irq_raster_next#0 ] -[ irq_cnt#0 ] -[ irq_sprite_ypos#0 ] -[ init_sprites::s2#0 ] -[ irq_cnt#1 ] +[ irq_raster_next#13 irq_raster_next#6 irq_raster_next#20 ] +[ irq_raster_next#2 ] [ irq_sprite_ypos#2 ] -[ irq_cnt#2 ] -[ irq_sprite_ypos#1 ] +[ irq_sprite_ptr#2 ] +[ irq_cnt#19 ] +[ irq_raster_next#11 ] +[ irq_sprite_ypos#11 ] +[ irq_sprite_ptr#3 ] +[ irq_cnt#11 ] +[ init_sprites::s2#0 ] +[ irq::ptr#0 ] +[ irq::ptr#1 ] +[ irq::ptr#2 ] +[ irq_cnt#23 ] +[ irq_sprite_ypos#6 ] +[ irq_sprite_ptr#6 ] +[ irq_cnt#24 ] +[ irq_sprite_ypos#26 ] +[ irq_sprite_ptr#5 ] Allocated zp ZP_BYTE:2 [ init_sprites::s#2 init_sprites::s#1 ] Allocated zp ZP_BYTE:3 [ init_sprites::xpos#2 init_sprites::xpos#1 ] -Allocated zp ZP_BYTE:4 [ init_sprites::ptr#2 init_sprites::ptr#1 ] -Allocated zp ZP_BYTE:5 [ irq_raster_next#3 irq_raster_next#1 irq_raster_next#2 ] -Allocated zp ZP_BYTE:6 [ irq_raster_next#0 ] -Allocated zp ZP_BYTE:7 [ irq_cnt#0 ] -Allocated zp ZP_BYTE:8 [ irq_sprite_ypos#0 ] -Allocated zp ZP_BYTE:9 [ init_sprites::s2#0 ] -Allocated zp ZP_BYTE:10 [ irq_cnt#1 ] -Allocated zp ZP_BYTE:11 [ irq_sprite_ypos#2 ] -Allocated zp ZP_BYTE:12 [ irq_cnt#2 ] -Allocated zp ZP_BYTE:13 [ irq_sprite_ypos#1 ] +Allocated zp ZP_BYTE:4 [ irq_raster_next#13 irq_raster_next#6 irq_raster_next#20 ] +Allocated zp ZP_BYTE:5 [ irq_raster_next#2 ] +Allocated zp ZP_BYTE:6 [ irq_sprite_ypos#2 ] +Allocated zp ZP_BYTE:7 [ irq_sprite_ptr#2 ] +Allocated zp ZP_BYTE:8 [ irq_cnt#19 ] +Allocated zp ZP_BYTE:9 [ irq_raster_next#11 ] +Allocated zp ZP_BYTE:10 [ irq_sprite_ypos#11 ] +Allocated zp ZP_BYTE:11 [ irq_sprite_ptr#3 ] +Allocated zp ZP_BYTE:12 [ irq_cnt#11 ] +Allocated zp ZP_BYTE:13 [ init_sprites::s2#0 ] +Allocated zp ZP_BYTE:14 [ irq::ptr#0 ] +Allocated zp ZP_BYTE:15 [ irq::ptr#1 ] +Allocated zp ZP_BYTE:16 [ irq::ptr#2 ] +Allocated zp ZP_BYTE:17 [ irq_cnt#23 ] +Allocated zp ZP_BYTE:18 [ irq_sprite_ypos#6 ] +Allocated zp ZP_BYTE:19 [ irq_sprite_ptr#6 ] +Allocated zp ZP_BYTE:20 [ irq_cnt#24 ] +Allocated zp ZP_BYTE:21 [ irq_sprite_ypos#26 ] +Allocated zp ZP_BYTE:22 [ irq_sprite_ptr#5 ] INITIAL ASM //SEG0 Basic Upstart @@ -1249,7 +1600,6 @@ INITIAL ASM .label SPRITES_MC = $d01c .label SPRITES_EXPAND_X = $d01d .label BORDERCOL = $d020 - .label BGCOL = $d021 .label SPRITES_COLS = $d027 .label VIC_CONTROL = $d011 .label D018 = $d018 @@ -1262,291 +1612,356 @@ INITIAL ASM .label CIA2_PORT_A_DDR = $dd02 .label KERNEL_IRQ = $314 .const BLACK = 0 - .const WHITE = 1 - .const BLUE = 6 + .const DARK_GREY = $b .label PLAYFIELD_SPRITES = $2000 .label PLAYFIELD_CHARSET = $1000 .label PLAYFIELD_SCREEN = $400 .const IRQ_RASTER_FIRST = $30 - .label irq_raster_next = 6 - .label irq_cnt = 7 - .label irq_sprite_ypos = 8 - .label irq_cnt_1 = $a - .label irq_cnt_2 = $c - .label irq_raster_next_1 = 5 - .label irq_sprite_ypos_1 = $d - .label irq_raster_next_2 = 5 - .label irq_sprite_ypos_2 = $b - .label irq_raster_next_3 = 5 + .label PLAYFIELD_SPRITE_PTRS = PLAYFIELD_SCREEN+SPRITE_PTRS + .const toSpritePtr1_return = PLAYFIELD_SPRITES>>6 + .label irq_raster_next = 5 + .label irq_sprite_ypos = 6 + .label irq_sprite_ptr = 7 + .label irq_sprite_ptr_3 = $b + .label irq_sprite_ptr_5 = $16 + .label irq_raster_next_6 = 4 + .label irq_sprite_ypos_6 = $12 + .label irq_sprite_ptr_6 = $13 + .label irq_raster_next_11 = 9 + .label irq_sprite_ypos_11 = $a + .label irq_cnt = $c + .label irq_raster_next_13 = 4 + .label irq_raster_next_20 = 4 + .label irq_cnt_19 = 8 + .label irq_cnt_23 = $11 + .label irq_cnt_24 = $14 + .label irq_sprite_ypos_26 = $15 //SEG2 @begin bbegin: jmp b6 //SEG3 @6 b6: -//SEG4 [1] (byte) irq_raster_next#0 ← (const byte) IRQ_RASTER_FIRST#0 -- vbuz1=vbuc1 +//SEG4 [1] (byte) irq_raster_next#2 ← (const byte) IRQ_RASTER_FIRST#0 -- vbuz1=vbuc1 lda #IRQ_RASTER_FIRST sta irq_raster_next -//SEG5 [2] (byte) irq_cnt#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 - lda #0 - sta irq_cnt -//SEG6 [3] (byte) irq_sprite_ypos#0 ← (byte/signed byte/word/signed word/dword/signed dword) 50 -- vbuz1=vbuc1 +//SEG5 [2] (byte) irq_sprite_ypos#2 ← (byte/signed byte/word/signed word/dword/signed dword) 50 -- vbuz1=vbuc1 lda #$32 sta irq_sprite_ypos +//SEG6 [3] phi from @6 to toSpritePtr1 [phi:@6->toSpritePtr1] +toSpritePtr1_from_b6: + jmp toSpritePtr1 +//SEG7 toSpritePtr1 +toSpritePtr1: + jmp b9 +//SEG8 @9 +b9: +//SEG9 [4] (byte) irq_sprite_ptr#2 ← (const byte) toSpritePtr1_return#0 -- vbuz1=vbuc1 + lda #toSpritePtr1_return + sta irq_sprite_ptr +//SEG10 [5] (byte) irq_cnt#19 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 + lda #0 + sta irq_cnt_19 jmp b8 -//SEG7 @8 +//SEG11 @8 b8: -//SEG8 kickasm(location (const byte*) PLAYFIELD_SPRITES#0) {{ .var sprites = LoadPicture("nes-playfield.png", List().add($010101, $000000)) .for(var sy=0;sy<10;sy++) { .for(var sx=0;sx<3;sx++) { .for (var y=0;y<21; y++) { .for (var c=0; c<3; c++) { .byte sprites.getSinglecolorByte(sx*3+c,sy*21+y) } } .byte 0 } } }} -//SEG9 [5] call main -//SEG10 [7] phi from @8 to main [phi:@8->main] +//SEG12 kickasm(location (const byte*) PLAYFIELD_SPRITES#0) {{ .var sprites = LoadPicture("nes-playfield.png", List().add($010101, $000000)) .for(var sy=0;sy<10;sy++) { .for(var sx=0;sx<3;sx++) { .for (var y=0;y<21; y++) { .for (var c=0; c<3; c++) { .byte sprites.getSinglecolorByte(sx*3+c,sy*21+y) } } .byte 0 } } }} +//SEG13 [7] call main +//SEG14 [9] phi from @8 to main [phi:@8->main] main_from_b8: jsr main -//SEG11 [6] phi from @8 to @end [phi:@8->@end] +//SEG15 [8] phi from @8 to @end [phi:@8->@end] bend_from_b8: jmp bend -//SEG12 @end +//SEG16 @end bend: -//SEG13 main +//SEG17 main main: { - //SEG14 [8] call init_sprites - //SEG15 [20] phi from main to init_sprites [phi:main->init_sprites] + //SEG18 [10] call init_sprites + //SEG19 [27] phi from main to init_sprites [phi:main->init_sprites] init_sprites_from_main: jsr init_sprites - //SEG16 [9] phi from main to main::@1 [phi:main->main::@1] - b1_from_main: - jmp b1 - //SEG17 main::@1 - b1: - //SEG18 [10] call init_irq + //SEG20 [11] phi from main to main::@7 [phi:main->main::@7] + b7_from_main: + jmp b7 + //SEG21 main::@7 + b7: + //SEG22 [12] call init_irq jsr init_irq - jmp breturn - //SEG19 main::@return - breturn: - //SEG20 [11] return - rts + jmp b2 + //SEG23 main::@2 + b2: + //SEG24 [13] *((const byte*) PLAYFIELD_SCREEN#0) ← ++ *((const byte*) PLAYFIELD_SCREEN#0) -- _deref_pbuc1=_inc__deref_pbuc1 + inc PLAYFIELD_SCREEN + jmp b2 } -//SEG21 init_irq +//SEG25 init_irq init_irq: { - //SEG22 asm { sei } + .const toSpritePtr2_return = PLAYFIELD_SPRITES>>6 + //SEG26 [14] (byte) irq_raster_next#11 ← (const byte) IRQ_RASTER_FIRST#0 -- vbuz1=vbuc1 + lda #IRQ_RASTER_FIRST + sta irq_raster_next_11 + //SEG27 [15] (byte) irq_sprite_ypos#11 ← (byte/signed byte/word/signed word/dword/signed dword) 50 -- vbuz1=vbuc1 + lda #$32 + sta irq_sprite_ypos_11 + //SEG28 [16] phi from init_irq to init_irq::toSpritePtr2 [phi:init_irq->init_irq::toSpritePtr2] + toSpritePtr2_from_init_irq: + jmp toSpritePtr2 + //SEG29 init_irq::toSpritePtr2 + toSpritePtr2: + jmp b1 + //SEG30 init_irq::@1 + b1: + //SEG31 [17] (byte) irq_sprite_ptr#3 ← (const byte) init_irq::toSpritePtr2_return#0 -- vbuz1=vbuc1 + lda #toSpritePtr2_return + sta irq_sprite_ptr_3 + //SEG32 [18] (byte) irq_cnt#11 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 + lda #0 + sta irq_cnt + //SEG33 asm { sei } sei - //SEG23 [13] *((const byte*) CIA1_INTERRUPT#0) ← (const byte) CIA_INTERRUPT_CLEAR#0 -- _deref_pbuc1=vbuc2 + //SEG34 [20] *((const byte*) CIA1_INTERRUPT#0) ← (const byte) CIA_INTERRUPT_CLEAR#0 -- _deref_pbuc1=vbuc2 lda #CIA_INTERRUPT_CLEAR sta CIA1_INTERRUPT - //SEG24 [14] *((const byte*) VIC_CONTROL#0) ← *((const byte*) VIC_CONTROL#0) & (byte/signed byte/word/signed word/dword/signed dword) 127 -- _deref_pbuc1=_deref_pbuc1_band_vbuc2 + //SEG35 [21] *((const byte*) VIC_CONTROL#0) ← *((const byte*) VIC_CONTROL#0) & (byte/signed byte/word/signed word/dword/signed dword) 127 -- _deref_pbuc1=_deref_pbuc1_band_vbuc2 lda VIC_CONTROL and #$7f sta VIC_CONTROL - //SEG25 [15] *((const byte*) RASTER#0) ← (const byte) IRQ_RASTER_FIRST#0 -- _deref_pbuc1=vbuc2 + //SEG36 [22] *((const byte*) RASTER#0) ← (const byte) IRQ_RASTER_FIRST#0 -- _deref_pbuc1=vbuc2 lda #IRQ_RASTER_FIRST sta RASTER - //SEG26 [16] *((const byte*) IRQ_ENABLE#0) ← (const byte) IRQ_RASTER#0 -- _deref_pbuc1=vbuc2 + //SEG37 [23] *((const byte*) IRQ_ENABLE#0) ← (const byte) IRQ_RASTER#0 -- _deref_pbuc1=vbuc2 lda #IRQ_RASTER sta IRQ_ENABLE - //SEG27 [17] *((const void()**) KERNEL_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq() -- _deref_pptc1=pprc2 + //SEG38 [24] *((const void()**) KERNEL_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq() -- _deref_pptc1=pprc2 lda #irq sta KERNEL_IRQ+1 - //SEG28 asm { cli } + //SEG39 asm { cli } cli jmp breturn - //SEG29 init_irq::@return + //SEG40 init_irq::@return breturn: - //SEG30 [19] return + //SEG41 [26] return rts } -//SEG31 init_sprites +//SEG42 init_sprites init_sprites: { - .const ypos = $32 - .label sprites_ptr = PLAYFIELD_SCREEN+SPRITE_PTRS - .const toSpritePtr1_return = PLAYFIELD_SPRITES>>6 .const vicSelectGfxBank1_toDd001_return = 3^(>PLAYFIELD_SCREEN)>>6 .const toD0181_return = (>(PLAYFIELD_SCREEN&$3fff)<<2)|(>PLAYFIELD_CHARSET)>>2&$f - .label s2 = 9 + .label s2 = $d .label xpos = 3 - .label ptr = 4 .label s = 2 jmp vicSelectGfxBank1 - //SEG32 init_sprites::vicSelectGfxBank1 + //SEG43 init_sprites::vicSelectGfxBank1 vicSelectGfxBank1: - //SEG33 [21] *((const byte*) CIA2_PORT_A_DDR#0) ← (byte/signed byte/word/signed word/dword/signed dword) 3 -- _deref_pbuc1=vbuc2 + //SEG44 [28] *((const byte*) CIA2_PORT_A_DDR#0) ← (byte/signed byte/word/signed word/dword/signed dword) 3 -- _deref_pbuc1=vbuc2 lda #3 sta CIA2_PORT_A_DDR - //SEG34 [22] phi from init_sprites::vicSelectGfxBank1 to init_sprites::vicSelectGfxBank1_toDd001 [phi:init_sprites::vicSelectGfxBank1->init_sprites::vicSelectGfxBank1_toDd001] + //SEG45 [29] phi from init_sprites::vicSelectGfxBank1 to init_sprites::vicSelectGfxBank1_toDd001 [phi:init_sprites::vicSelectGfxBank1->init_sprites::vicSelectGfxBank1_toDd001] vicSelectGfxBank1_toDd001_from_vicSelectGfxBank1: jmp vicSelectGfxBank1_toDd001 - //SEG35 init_sprites::vicSelectGfxBank1_toDd001 + //SEG46 init_sprites::vicSelectGfxBank1_toDd001 vicSelectGfxBank1_toDd001: jmp vicSelectGfxBank1_b1 - //SEG36 init_sprites::vicSelectGfxBank1_@1 + //SEG47 init_sprites::vicSelectGfxBank1_@1 vicSelectGfxBank1_b1: - //SEG37 [23] *((const byte*) CIA2_PORT_A#0) ← (const byte) init_sprites::vicSelectGfxBank1_toDd001_return#0 -- _deref_pbuc1=vbuc2 + //SEG48 [30] *((const byte*) CIA2_PORT_A#0) ← (const byte) init_sprites::vicSelectGfxBank1_toDd001_return#0 -- _deref_pbuc1=vbuc2 lda #vicSelectGfxBank1_toDd001_return sta CIA2_PORT_A - //SEG38 [24] phi from init_sprites::vicSelectGfxBank1_@1 to init_sprites::toD0181 [phi:init_sprites::vicSelectGfxBank1_@1->init_sprites::toD0181] + //SEG49 [31] phi from init_sprites::vicSelectGfxBank1_@1 to init_sprites::toD0181 [phi:init_sprites::vicSelectGfxBank1_@1->init_sprites::toD0181] toD0181_from_vicSelectGfxBank1_b1: jmp toD0181 - //SEG39 init_sprites::toD0181 + //SEG50 init_sprites::toD0181 toD0181: jmp b4 - //SEG40 init_sprites::@4 + //SEG51 init_sprites::@4 b4: - //SEG41 [25] *((const byte*) D018#0) ← (const byte) init_sprites::toD0181_return#0 -- _deref_pbuc1=vbuc2 + //SEG52 [32] *((const byte*) D018#0) ← (const byte) init_sprites::toD0181_return#0 -- _deref_pbuc1=vbuc2 lda #toD0181_return sta D018 - //SEG42 [26] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 15 -- _deref_pbuc1=vbuc2 + //SEG53 [33] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 15 -- _deref_pbuc1=vbuc2 lda #$f sta SPRITES_ENABLE - //SEG43 [27] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 + //SEG54 [34] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 lda #0 sta SPRITES_MC - //SEG44 [28] *((const byte*) SPRITES_EXPAND_Y#0) ← *((const byte*) SPRITES_MC#0) -- _deref_pbuc1=_deref_pbuc2 + //SEG55 [35] *((const byte*) SPRITES_EXPAND_Y#0) ← *((const byte*) SPRITES_MC#0) -- _deref_pbuc1=_deref_pbuc2 lda SPRITES_MC sta SPRITES_EXPAND_Y - //SEG45 [29] *((const byte*) SPRITES_EXPAND_X#0) ← *((const byte*) SPRITES_EXPAND_Y#0) -- _deref_pbuc1=_deref_pbuc2 + //SEG56 [36] *((const byte*) SPRITES_EXPAND_X#0) ← *((const byte*) SPRITES_EXPAND_Y#0) -- _deref_pbuc1=_deref_pbuc2 lda SPRITES_EXPAND_Y sta SPRITES_EXPAND_X - //SEG46 [30] phi from init_sprites::@4 to init_sprites::toSpritePtr1 [phi:init_sprites::@4->init_sprites::toSpritePtr1] - toSpritePtr1_from_b4: - jmp toSpritePtr1 - //SEG47 init_sprites::toSpritePtr1 - toSpritePtr1: - //SEG48 [31] phi from init_sprites::toSpritePtr1 to init_sprites::@1 [phi:init_sprites::toSpritePtr1->init_sprites::@1] - b1_from_toSpritePtr1: - //SEG49 [31] phi (byte) init_sprites::ptr#2 = (const byte) init_sprites::toSpritePtr1_return#0 [phi:init_sprites::toSpritePtr1->init_sprites::@1#0] -- vbuz1=vbuc1 - lda #toSpritePtr1_return - sta ptr - //SEG50 [31] phi (byte) init_sprites::xpos#2 = (byte/signed byte/word/signed word/dword/signed dword) 24+(byte/signed byte/word/signed word/dword/signed dword) 14*(byte/signed byte/word/signed word/dword/signed dword) 8 [phi:init_sprites::toSpritePtr1->init_sprites::@1#1] -- vbuz1=vbuc1 + //SEG57 [37] phi from init_sprites::@4 to init_sprites::@1 [phi:init_sprites::@4->init_sprites::@1] + b1_from_b4: + //SEG58 [37] phi (byte) init_sprites::xpos#2 = (byte/signed byte/word/signed word/dword/signed dword) 24+(byte/signed byte/word/signed word/dword/signed dword) 14*(byte/signed byte/word/signed word/dword/signed dword) 8 [phi:init_sprites::@4->init_sprites::@1#0] -- vbuz1=vbuc1 lda #$18+$e*8 sta xpos - //SEG51 [31] phi (byte) init_sprites::s#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:init_sprites::toSpritePtr1->init_sprites::@1#2] -- vbuz1=vbuc1 + //SEG59 [37] phi (byte) init_sprites::s#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:init_sprites::@4->init_sprites::@1#1] -- vbuz1=vbuc1 lda #0 sta s jmp b1 - //SEG52 [31] phi from init_sprites::@1 to init_sprites::@1 [phi:init_sprites::@1->init_sprites::@1] + //SEG60 [37] phi from init_sprites::@1 to init_sprites::@1 [phi:init_sprites::@1->init_sprites::@1] b1_from_b1: - //SEG53 [31] phi (byte) init_sprites::ptr#2 = (byte) init_sprites::ptr#1 [phi:init_sprites::@1->init_sprites::@1#0] -- register_copy - //SEG54 [31] phi (byte) init_sprites::xpos#2 = (byte) init_sprites::xpos#1 [phi:init_sprites::@1->init_sprites::@1#1] -- register_copy - //SEG55 [31] phi (byte) init_sprites::s#2 = (byte) init_sprites::s#1 [phi:init_sprites::@1->init_sprites::@1#2] -- register_copy + //SEG61 [37] phi (byte) init_sprites::xpos#2 = (byte) init_sprites::xpos#1 [phi:init_sprites::@1->init_sprites::@1#0] -- register_copy + //SEG62 [37] phi (byte) init_sprites::s#2 = (byte) init_sprites::s#1 [phi:init_sprites::@1->init_sprites::@1#1] -- register_copy jmp b1 - //SEG56 init_sprites::@1 + //SEG63 init_sprites::@1 b1: - //SEG57 [32] (byte) init_sprites::s2#0 ← (byte) init_sprites::s#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz2_rol_1 + //SEG64 [38] (byte) init_sprites::s2#0 ← (byte) init_sprites::s#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuz1=vbuz2_rol_1 lda s asl sta s2 - //SEG58 [33] *((const byte*) SPRITES_XPOS#0 + (byte) init_sprites::s2#0) ← (byte) init_sprites::xpos#2 -- pbuc1_derefidx_vbuz1=vbuz2 + //SEG65 [39] *((const byte*) SPRITES_XPOS#0 + (byte) init_sprites::s2#0) ← (byte) init_sprites::xpos#2 -- pbuc1_derefidx_vbuz1=vbuz2 lda xpos ldy s2 sta SPRITES_XPOS,y - //SEG59 [34] *((const byte*) SPRITES_YPOS#0 + (byte) init_sprites::s2#0) ← (const byte) init_sprites::ypos#0 -- pbuc1_derefidx_vbuz1=vbuc2 - ldy s2 - lda #ypos - sta SPRITES_YPOS,y - //SEG60 [35] *((const byte*) SPRITES_COLS#0 + (byte) init_sprites::s#2) ← (const byte) BLACK#0 -- pbuc1_derefidx_vbuz1=vbuc2 + //SEG66 [40] *((const byte*) SPRITES_COLS#0 + (byte) init_sprites::s#2) ← (const byte) BLACK#0 -- pbuc1_derefidx_vbuz1=vbuc2 ldy s lda #BLACK sta SPRITES_COLS,y - //SEG61 [36] *((const byte*) init_sprites::sprites_ptr#0 + (byte) init_sprites::s#2) ← (byte) init_sprites::ptr#2 -- pbuc1_derefidx_vbuz1=vbuz2 - lda ptr - ldy s - sta sprites_ptr,y - //SEG62 [37] (byte) init_sprites::xpos#1 ← (byte) init_sprites::xpos#2 + (byte/signed byte/word/signed word/dword/signed dword) 24 -- vbuz1=vbuz1_plus_vbuc1 + //SEG67 [41] (byte) init_sprites::xpos#1 ← (byte) init_sprites::xpos#2 + (byte/signed byte/word/signed word/dword/signed dword) 24 -- vbuz1=vbuz1_plus_vbuc1 lda #$18 clc adc xpos sta xpos - //SEG63 [38] (byte) init_sprites::ptr#1 ← ++ (byte) init_sprites::ptr#2 -- vbuz1=_inc_vbuz1 - inc ptr - //SEG64 [39] (byte) init_sprites::s#1 ← ++ (byte) init_sprites::s#2 -- vbuz1=_inc_vbuz1 + //SEG68 [42] (byte) init_sprites::s#1 ← ++ (byte) init_sprites::s#2 -- vbuz1=_inc_vbuz1 inc s - //SEG65 [40] if((byte) init_sprites::s#1!=(byte/signed byte/word/signed word/dword/signed dword) 4) goto init_sprites::@1 -- vbuz1_neq_vbuc1_then_la1 + //SEG69 [43] if((byte) init_sprites::s#1!=(byte/signed byte/word/signed word/dword/signed dword) 4) goto init_sprites::@1 -- vbuz1_neq_vbuc1_then_la1 lda s cmp #4 bne b1_from_b1 jmp breturn - //SEG66 init_sprites::@return + //SEG70 init_sprites::@return breturn: - //SEG67 [41] return + //SEG71 [44] return rts } -//SEG68 irq +//SEG72 irq irq: { - //SEG69 entry interrupt(KERNEL_MIN) - //SEG70 [42] *((const byte*) BGCOL#0) ← (const byte) WHITE#0 -- _deref_pbuc1=vbuc2 - lda #WHITE - sta BGCOL - //SEG71 [43] *((const byte*) BORDERCOL#0) ← *((const byte*) BGCOL#0) -- _deref_pbuc1=_deref_pbuc2 - lda BGCOL + .const toSpritePtr2_return = PLAYFIELD_SPRITES>>6 + .label ptr = $e + .label ptr_1 = $f + .label ptr_2 = $10 + //SEG73 entry interrupt(KERNEL_MIN) + //SEG74 [45] *((const byte*) BORDERCOL#0) ← (const byte) DARK_GREY#0 -- _deref_pbuc1=vbuc2 + lda #DARK_GREY sta BORDERCOL - //SEG72 [44] *((const byte*) SPRITES_YPOS#0) ← (byte) irq_sprite_ypos#0 -- _deref_pbuc1=vbuz1 + //SEG75 [46] *((const byte*) SPRITES_YPOS#0) ← (byte) irq_sprite_ypos#2 -- _deref_pbuc1=vbuz1 lda irq_sprite_ypos sta SPRITES_YPOS - //SEG73 [45] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq_sprite_ypos#0 -- _deref_pbuc1=vbuz1 + //SEG76 [47] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq_sprite_ypos#2 -- _deref_pbuc1=vbuz1 lda irq_sprite_ypos sta SPRITES_YPOS+2 - //SEG74 [46] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 4) ← (byte) irq_sprite_ypos#0 -- _deref_pbuc1=vbuz1 + //SEG77 [48] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 4) ← (byte) irq_sprite_ypos#2 -- _deref_pbuc1=vbuz1 lda irq_sprite_ypos sta SPRITES_YPOS+4 - //SEG75 [47] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 6) ← (byte) irq_sprite_ypos#0 -- _deref_pbuc1=vbuz1 + //SEG78 [49] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 6) ← (byte) irq_sprite_ypos#2 -- _deref_pbuc1=vbuz1 lda irq_sprite_ypos sta SPRITES_YPOS+6 - //SEG76 [48] (byte) irq_cnt#1 ← ++ (byte) irq_cnt#0 -- vbuz1=_inc_vbuz2 - ldy irq_cnt + jmp b1 + //SEG79 irq::@1 + b1: + //SEG80 [50] if(*((const byte*) RASTER#0)!=(byte) irq_sprite_ypos#2) goto irq::@1 -- _deref_pbuc1_neq_vbuz1_then_la1 + lda RASTER + cmp irq_sprite_ypos + bne b1 + jmp b4 + //SEG81 irq::@4 + b4: + //SEG82 [51] (byte) irq::ptr#0 ← (byte) irq_sprite_ptr#2 -- vbuz1=vbuz2 + lda irq_sprite_ptr + sta ptr + //SEG83 [52] *((const byte*) PLAYFIELD_SPRITE_PTRS#0) ← (byte) irq::ptr#0 -- _deref_pbuc1=vbuz1 + lda ptr + sta PLAYFIELD_SPRITE_PTRS + //SEG84 [53] (byte) irq::ptr#1 ← ++ (byte) irq::ptr#0 -- vbuz1=_inc_vbuz2 + ldy ptr iny - sty irq_cnt_1 - //SEG77 [49] if((byte) irq_cnt#1==(byte/signed byte/word/signed word/dword/signed dword) 10) goto irq::@1 -- vbuz1_eq_vbuc1_then_la1 - lda irq_cnt_1 + sty ptr_1 + //SEG85 [54] *((const byte*) PLAYFIELD_SPRITE_PTRS#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) irq::ptr#1 -- _deref_pbuc1=vbuz1 + lda ptr_1 + sta PLAYFIELD_SPRITE_PTRS+1 + //SEG86 [55] *((const byte*) PLAYFIELD_SPRITE_PTRS#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq::ptr#1 -- _deref_pbuc1=vbuz1 + lda ptr_1 + sta PLAYFIELD_SPRITE_PTRS+2 + //SEG87 [56] (byte) irq::ptr#2 ← ++ (byte) irq::ptr#1 -- vbuz1=_inc_vbuz2 + ldy ptr_1 + iny + sty ptr_2 + //SEG88 [57] *((const byte*) PLAYFIELD_SPRITE_PTRS#0+(byte/signed byte/word/signed word/dword/signed dword) 3) ← (byte) irq::ptr#2 -- _deref_pbuc1=vbuz1 + lda ptr_2 + sta PLAYFIELD_SPRITE_PTRS+3 + //SEG89 [58] (byte) irq_cnt#23 ← ++ (byte) irq_cnt#19 -- vbuz1=_inc_vbuz2 + ldy irq_cnt_19 + iny + sty irq_cnt_23 + //SEG90 [59] if((byte) irq_cnt#23==(byte/signed byte/word/signed word/dword/signed dword) 10) goto irq::@2 -- vbuz1_eq_vbuc1_then_la1 + lda irq_cnt_23 cmp #$a - beq b1 - jmp b3 - //SEG78 irq::@3 - b3: - //SEG79 [50] (byte) irq_raster_next#2 ← (byte) irq_raster_next#0 + (byte/signed byte/word/signed word/dword/signed dword) 21 -- vbuz1=vbuz2_plus_vbuc1 + beq b2 + jmp b5 + //SEG91 irq::@5 + b5: + //SEG92 [60] (byte) irq_raster_next#6 ← (byte) irq_raster_next#2 + (byte/signed byte/word/signed word/dword/signed dword) 21 -- vbuz1=vbuz2_plus_vbuc1 lda #$15 clc adc irq_raster_next - sta irq_raster_next_2 - //SEG80 [51] (byte) irq_sprite_ypos#2 ← (byte) irq_sprite_ypos#0 + (byte/signed byte/word/signed word/dword/signed dword) 21 -- vbuz1=vbuz2_plus_vbuc1 + sta irq_raster_next_6 + //SEG93 [61] (byte) irq_sprite_ypos#6 ← (byte) irq_sprite_ypos#2 + (byte/signed byte/word/signed word/dword/signed dword) 21 -- vbuz1=vbuz2_plus_vbuc1 lda #$15 clc adc irq_sprite_ypos - sta irq_sprite_ypos_2 - //SEG81 [52] phi from irq::@1 irq::@3 to irq::@2 [phi:irq::@1/irq::@3->irq::@2] - b2_from_b1: - b2_from_b3: - //SEG82 [52] phi (byte) irq_raster_next#3 = (byte) irq_raster_next#1 [phi:irq::@1/irq::@3->irq::@2#0] -- register_copy - jmp b2 - //SEG83 irq::@2 - b2: - //SEG84 [53] *((const byte*) RASTER#0) ← (byte) irq_raster_next#3 -- _deref_pbuc1=vbuz1 - lda irq_raster_next_3 + sta irq_sprite_ypos_6 + //SEG94 [62] (byte) irq_sprite_ptr#6 ← (byte) irq_sprite_ptr#2 + (byte/signed byte/word/signed word/dword/signed dword) 3 -- vbuz1=vbuz2_plus_vbuc1 + lda #3 + clc + adc irq_sprite_ptr + sta irq_sprite_ptr_6 + //SEG95 [63] phi from irq::@5 irq::@7 to irq::@3 [phi:irq::@5/irq::@7->irq::@3] + b3_from_b5: + b3_from_b7: + //SEG96 [63] phi (byte) irq_raster_next#13 = (byte) irq_raster_next#6 [phi:irq::@5/irq::@7->irq::@3#0] -- register_copy + jmp b3 + //SEG97 irq::@3 + b3: + //SEG98 [64] *((const byte*) RASTER#0) ← (byte) irq_raster_next#13 -- _deref_pbuc1=vbuz1 + lda irq_raster_next_13 sta RASTER - //SEG85 [54] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0 -- _deref_pbuc1=vbuc2 + //SEG99 [65] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0 -- _deref_pbuc1=vbuc2 lda #IRQ_RASTER sta IRQ_STATUS - //SEG86 [55] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 + //SEG100 [66] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 lda #BLACK sta BORDERCOL - //SEG87 [56] *((const byte*) BGCOL#0) ← (const byte) BLUE#0 -- _deref_pbuc1=vbuc2 - lda #BLUE - sta BGCOL jmp breturn - //SEG88 irq::@return + //SEG101 irq::@return breturn: - //SEG89 [57] return - exit interrupt(KERNEL_MIN) + //SEG102 [67] return - exit interrupt(KERNEL_MIN) jmp $ea81 - //SEG90 irq::@1 - b1: - //SEG91 [58] (byte) irq_cnt#2 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 + //SEG103 irq::@2 + b2: + //SEG104 [68] (byte) irq_cnt#24 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 lda #0 - sta irq_cnt_2 - //SEG92 [59] (byte) irq_raster_next#1 ← (const byte) IRQ_RASTER_FIRST#0 -- vbuz1=vbuc1 + sta irq_cnt_24 + //SEG105 [69] (byte) irq_raster_next#20 ← (const byte) IRQ_RASTER_FIRST#0 -- vbuz1=vbuc1 lda #IRQ_RASTER_FIRST - sta irq_raster_next_1 - //SEG93 [60] (byte) irq_sprite_ypos#1 ← (byte/signed byte/word/signed word/dword/signed dword) 50 -- vbuz1=vbuc1 + sta irq_raster_next_20 + //SEG106 [70] (byte) irq_sprite_ypos#26 ← (byte/signed byte/word/signed word/dword/signed dword) 50 -- vbuz1=vbuc1 lda #$32 - sta irq_sprite_ypos_1 - jmp b2_from_b1 + sta irq_sprite_ypos_26 + //SEG107 [71] phi from irq::@2 to irq::toSpritePtr2 [phi:irq::@2->irq::toSpritePtr2] + toSpritePtr2_from_b2: + jmp toSpritePtr2 + //SEG108 irq::toSpritePtr2 + toSpritePtr2: + jmp b7 + //SEG109 irq::@7 + b7: + //SEG110 [72] (byte) irq_sprite_ptr#5 ← (const byte) irq::toSpritePtr2_return#0 -- vbuz1=vbuc1 + lda #toSpritePtr2_return + sta irq_sprite_ptr_5 + jmp b3_from_b7 } .pc = PLAYFIELD_SPRITES "Inline" .var sprites = LoadPicture("nes-playfield.png", List().add($010101, $000000)) @@ -1563,141 +1978,174 @@ irq: { REGISTER UPLIFT POTENTIAL REGISTERS -Statement [1] (byte) irq_raster_next#0 ← (const byte) IRQ_RASTER_FIRST#0 [ ] ( ) always clobbers reg byte a -Statement [2] (byte) irq_cnt#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( ) always clobbers reg byte a -Statement [3] (byte) irq_sprite_ypos#0 ← (byte/signed byte/word/signed word/dword/signed dword) 50 [ ] ( ) always clobbers reg byte a -Statement [13] *((const byte*) CIA1_INTERRUPT#0) ← (const byte) CIA_INTERRUPT_CLEAR#0 [ ] ( main:5::init_irq:10 [ ] ) always clobbers reg byte a -Statement [14] *((const byte*) VIC_CONTROL#0) ← *((const byte*) VIC_CONTROL#0) & (byte/signed byte/word/signed word/dword/signed dword) 127 [ ] ( main:5::init_irq:10 [ ] ) always clobbers reg byte a -Statement [15] *((const byte*) RASTER#0) ← (const byte) IRQ_RASTER_FIRST#0 [ ] ( main:5::init_irq:10 [ ] ) always clobbers reg byte a -Statement [16] *((const byte*) IRQ_ENABLE#0) ← (const byte) IRQ_RASTER#0 [ ] ( main:5::init_irq:10 [ ] ) always clobbers reg byte a -Statement [17] *((const void()**) KERNEL_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq() [ ] ( main:5::init_irq:10 [ ] ) always clobbers reg byte a -Statement [21] *((const byte*) CIA2_PORT_A_DDR#0) ← (byte/signed byte/word/signed word/dword/signed dword) 3 [ ] ( main:5::init_sprites:8 [ ] ) always clobbers reg byte a -Statement [23] *((const byte*) CIA2_PORT_A#0) ← (const byte) init_sprites::vicSelectGfxBank1_toDd001_return#0 [ ] ( main:5::init_sprites:8 [ ] ) always clobbers reg byte a -Statement [25] *((const byte*) D018#0) ← (const byte) init_sprites::toD0181_return#0 [ ] ( main:5::init_sprites:8 [ ] ) always clobbers reg byte a -Statement [26] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 15 [ ] ( main:5::init_sprites:8 [ ] ) always clobbers reg byte a -Statement [27] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:5::init_sprites:8 [ ] ) always clobbers reg byte a -Statement [28] *((const byte*) SPRITES_EXPAND_Y#0) ← *((const byte*) SPRITES_MC#0) [ ] ( main:5::init_sprites:8 [ ] ) always clobbers reg byte a -Statement [29] *((const byte*) SPRITES_EXPAND_X#0) ← *((const byte*) SPRITES_EXPAND_Y#0) [ ] ( main:5::init_sprites:8 [ ] ) always clobbers reg byte a -Statement [32] (byte) init_sprites::s2#0 ← (byte) init_sprites::s#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 [ init_sprites::s#2 init_sprites::xpos#2 init_sprites::ptr#2 init_sprites::s2#0 ] ( main:5::init_sprites:8 [ init_sprites::s#2 init_sprites::xpos#2 init_sprites::ptr#2 init_sprites::s2#0 ] ) always clobbers reg byte a +Statement [1] (byte) irq_raster_next#2 ← (const byte) IRQ_RASTER_FIRST#0 [ ] ( ) always clobbers reg byte a +Statement [2] (byte) irq_sprite_ypos#2 ← (byte/signed byte/word/signed word/dword/signed dword) 50 [ ] ( ) always clobbers reg byte a +Statement [4] (byte) irq_sprite_ptr#2 ← (const byte) toSpritePtr1_return#0 [ ] ( ) always clobbers reg byte a +Statement [5] (byte) irq_cnt#19 ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( ) always clobbers reg byte a +Statement [14] (byte) irq_raster_next#11 ← (const byte) IRQ_RASTER_FIRST#0 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a +Statement [15] (byte) irq_sprite_ypos#11 ← (byte/signed byte/word/signed word/dword/signed dword) 50 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a +Statement [17] (byte) irq_sprite_ptr#3 ← (const byte) init_irq::toSpritePtr2_return#0 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a +Statement [18] (byte) irq_cnt#11 ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a +Statement [20] *((const byte*) CIA1_INTERRUPT#0) ← (const byte) CIA_INTERRUPT_CLEAR#0 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a +Statement [21] *((const byte*) VIC_CONTROL#0) ← *((const byte*) VIC_CONTROL#0) & (byte/signed byte/word/signed word/dword/signed dword) 127 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a +Statement [22] *((const byte*) RASTER#0) ← (const byte) IRQ_RASTER_FIRST#0 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a +Statement [23] *((const byte*) IRQ_ENABLE#0) ← (const byte) IRQ_RASTER#0 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a +Statement [24] *((const void()**) KERNEL_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq() [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a +Statement [28] *((const byte*) CIA2_PORT_A_DDR#0) ← (byte/signed byte/word/signed word/dword/signed dword) 3 [ ] ( main:7::init_sprites:10 [ ] ) always clobbers reg byte a +Statement [30] *((const byte*) CIA2_PORT_A#0) ← (const byte) init_sprites::vicSelectGfxBank1_toDd001_return#0 [ ] ( main:7::init_sprites:10 [ ] ) always clobbers reg byte a +Statement [32] *((const byte*) D018#0) ← (const byte) init_sprites::toD0181_return#0 [ ] ( main:7::init_sprites:10 [ ] ) always clobbers reg byte a +Statement [33] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 15 [ ] ( main:7::init_sprites:10 [ ] ) always clobbers reg byte a +Statement [34] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:7::init_sprites:10 [ ] ) always clobbers reg byte a +Statement [35] *((const byte*) SPRITES_EXPAND_Y#0) ← *((const byte*) SPRITES_MC#0) [ ] ( main:7::init_sprites:10 [ ] ) always clobbers reg byte a +Statement [36] *((const byte*) SPRITES_EXPAND_X#0) ← *((const byte*) SPRITES_EXPAND_Y#0) [ ] ( main:7::init_sprites:10 [ ] ) always clobbers reg byte a +Statement [38] (byte) init_sprites::s2#0 ← (byte) init_sprites::s#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 [ init_sprites::s#2 init_sprites::xpos#2 init_sprites::s2#0 ] ( main:7::init_sprites:10 [ init_sprites::s#2 init_sprites::xpos#2 init_sprites::s2#0 ] ) always clobbers reg byte a Removing always clobbered register reg byte a as potential for zp ZP_BYTE:2 [ init_sprites::s#2 init_sprites::s#1 ] Removing always clobbered register reg byte a as potential for zp ZP_BYTE:3 [ init_sprites::xpos#2 init_sprites::xpos#1 ] -Removing always clobbered register reg byte a as potential for zp ZP_BYTE:4 [ init_sprites::ptr#2 init_sprites::ptr#1 ] -Statement [33] *((const byte*) SPRITES_XPOS#0 + (byte) init_sprites::s2#0) ← (byte) init_sprites::xpos#2 [ init_sprites::s#2 init_sprites::xpos#2 init_sprites::ptr#2 init_sprites::s2#0 ] ( main:5::init_sprites:8 [ init_sprites::s#2 init_sprites::xpos#2 init_sprites::ptr#2 init_sprites::s2#0 ] ) always clobbers reg byte a -Removing always clobbered register reg byte a as potential for zp ZP_BYTE:9 [ init_sprites::s2#0 ] -Statement [34] *((const byte*) SPRITES_YPOS#0 + (byte) init_sprites::s2#0) ← (const byte) init_sprites::ypos#0 [ init_sprites::s#2 init_sprites::xpos#2 init_sprites::ptr#2 ] ( main:5::init_sprites:8 [ init_sprites::s#2 init_sprites::xpos#2 init_sprites::ptr#2 ] ) always clobbers reg byte a -Statement [35] *((const byte*) SPRITES_COLS#0 + (byte) init_sprites::s#2) ← (const byte) BLACK#0 [ init_sprites::s#2 init_sprites::xpos#2 init_sprites::ptr#2 ] ( main:5::init_sprites:8 [ init_sprites::s#2 init_sprites::xpos#2 init_sprites::ptr#2 ] ) always clobbers reg byte a -Statement [36] *((const byte*) init_sprites::sprites_ptr#0 + (byte) init_sprites::s#2) ← (byte) init_sprites::ptr#2 [ init_sprites::s#2 init_sprites::xpos#2 init_sprites::ptr#2 ] ( main:5::init_sprites:8 [ init_sprites::s#2 init_sprites::xpos#2 init_sprites::ptr#2 ] ) always clobbers reg byte a -Statement [37] (byte) init_sprites::xpos#1 ← (byte) init_sprites::xpos#2 + (byte/signed byte/word/signed word/dword/signed dword) 24 [ init_sprites::s#2 init_sprites::ptr#2 init_sprites::xpos#1 ] ( main:5::init_sprites:8 [ init_sprites::s#2 init_sprites::ptr#2 init_sprites::xpos#1 ] ) always clobbers reg byte a -Statement [42] *((const byte*) BGCOL#0) ← (const byte) WHITE#0 [ irq_raster_next#0 irq_cnt#0 irq_sprite_ypos#0 ] ( ) always clobbers reg byte a -Statement [43] *((const byte*) BORDERCOL#0) ← *((const byte*) BGCOL#0) [ irq_raster_next#0 irq_cnt#0 irq_sprite_ypos#0 ] ( ) always clobbers reg byte a -Statement [44] *((const byte*) SPRITES_YPOS#0) ← (byte) irq_sprite_ypos#0 [ irq_raster_next#0 irq_cnt#0 irq_sprite_ypos#0 ] ( ) always clobbers reg byte a -Statement [45] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq_sprite_ypos#0 [ irq_raster_next#0 irq_cnt#0 irq_sprite_ypos#0 ] ( ) always clobbers reg byte a -Statement [46] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 4) ← (byte) irq_sprite_ypos#0 [ irq_raster_next#0 irq_cnt#0 irq_sprite_ypos#0 ] ( ) always clobbers reg byte a -Statement [47] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 6) ← (byte) irq_sprite_ypos#0 [ irq_raster_next#0 irq_cnt#0 irq_sprite_ypos#0 ] ( ) always clobbers reg byte a -Statement [48] (byte) irq_cnt#1 ← ++ (byte) irq_cnt#0 [ irq_raster_next#0 irq_sprite_ypos#0 irq_cnt#1 ] ( ) always clobbers reg byte y -Statement [49] if((byte) irq_cnt#1==(byte/signed byte/word/signed word/dword/signed dword) 10) goto irq::@1 [ irq_raster_next#0 irq_sprite_ypos#0 ] ( ) always clobbers reg byte a -Statement [50] (byte) irq_raster_next#2 ← (byte) irq_raster_next#0 + (byte/signed byte/word/signed word/dword/signed dword) 21 [ irq_sprite_ypos#0 irq_raster_next#2 ] ( ) always clobbers reg byte a -Statement [51] (byte) irq_sprite_ypos#2 ← (byte) irq_sprite_ypos#0 + (byte/signed byte/word/signed word/dword/signed dword) 21 [ irq_raster_next#2 ] ( ) always clobbers reg byte a -Statement [53] *((const byte*) RASTER#0) ← (byte) irq_raster_next#3 [ ] ( ) always clobbers reg byte a -Statement [54] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0 [ ] ( ) always clobbers reg byte a -Statement [55] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 [ ] ( ) always clobbers reg byte a -Statement [56] *((const byte*) BGCOL#0) ← (const byte) BLUE#0 [ ] ( ) always clobbers reg byte a -Statement [58] (byte) irq_cnt#2 ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( ) always clobbers reg byte a -Statement [59] (byte) irq_raster_next#1 ← (const byte) IRQ_RASTER_FIRST#0 [ irq_raster_next#1 ] ( ) always clobbers reg byte a -Statement [60] (byte) irq_sprite_ypos#1 ← (byte/signed byte/word/signed word/dword/signed dword) 50 [ irq_raster_next#1 ] ( ) always clobbers reg byte a -Statement [1] (byte) irq_raster_next#0 ← (const byte) IRQ_RASTER_FIRST#0 [ ] ( ) always clobbers reg byte a -Statement [2] (byte) irq_cnt#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( ) always clobbers reg byte a -Statement [3] (byte) irq_sprite_ypos#0 ← (byte/signed byte/word/signed word/dword/signed dword) 50 [ ] ( ) always clobbers reg byte a -Statement [13] *((const byte*) CIA1_INTERRUPT#0) ← (const byte) CIA_INTERRUPT_CLEAR#0 [ ] ( main:5::init_irq:10 [ ] ) always clobbers reg byte a -Statement [14] *((const byte*) VIC_CONTROL#0) ← *((const byte*) VIC_CONTROL#0) & (byte/signed byte/word/signed word/dword/signed dword) 127 [ ] ( main:5::init_irq:10 [ ] ) always clobbers reg byte a -Statement [15] *((const byte*) RASTER#0) ← (const byte) IRQ_RASTER_FIRST#0 [ ] ( main:5::init_irq:10 [ ] ) always clobbers reg byte a -Statement [16] *((const byte*) IRQ_ENABLE#0) ← (const byte) IRQ_RASTER#0 [ ] ( main:5::init_irq:10 [ ] ) always clobbers reg byte a -Statement [17] *((const void()**) KERNEL_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq() [ ] ( main:5::init_irq:10 [ ] ) always clobbers reg byte a -Statement [21] *((const byte*) CIA2_PORT_A_DDR#0) ← (byte/signed byte/word/signed word/dword/signed dword) 3 [ ] ( main:5::init_sprites:8 [ ] ) always clobbers reg byte a -Statement [23] *((const byte*) CIA2_PORT_A#0) ← (const byte) init_sprites::vicSelectGfxBank1_toDd001_return#0 [ ] ( main:5::init_sprites:8 [ ] ) always clobbers reg byte a -Statement [25] *((const byte*) D018#0) ← (const byte) init_sprites::toD0181_return#0 [ ] ( main:5::init_sprites:8 [ ] ) always clobbers reg byte a -Statement [26] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 15 [ ] ( main:5::init_sprites:8 [ ] ) always clobbers reg byte a -Statement [27] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:5::init_sprites:8 [ ] ) always clobbers reg byte a -Statement [28] *((const byte*) SPRITES_EXPAND_Y#0) ← *((const byte*) SPRITES_MC#0) [ ] ( main:5::init_sprites:8 [ ] ) always clobbers reg byte a -Statement [29] *((const byte*) SPRITES_EXPAND_X#0) ← *((const byte*) SPRITES_EXPAND_Y#0) [ ] ( main:5::init_sprites:8 [ ] ) always clobbers reg byte a -Statement [32] (byte) init_sprites::s2#0 ← (byte) init_sprites::s#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 [ init_sprites::s#2 init_sprites::xpos#2 init_sprites::ptr#2 init_sprites::s2#0 ] ( main:5::init_sprites:8 [ init_sprites::s#2 init_sprites::xpos#2 init_sprites::ptr#2 init_sprites::s2#0 ] ) always clobbers reg byte a -Statement [33] *((const byte*) SPRITES_XPOS#0 + (byte) init_sprites::s2#0) ← (byte) init_sprites::xpos#2 [ init_sprites::s#2 init_sprites::xpos#2 init_sprites::ptr#2 init_sprites::s2#0 ] ( main:5::init_sprites:8 [ init_sprites::s#2 init_sprites::xpos#2 init_sprites::ptr#2 init_sprites::s2#0 ] ) always clobbers reg byte a -Statement [34] *((const byte*) SPRITES_YPOS#0 + (byte) init_sprites::s2#0) ← (const byte) init_sprites::ypos#0 [ init_sprites::s#2 init_sprites::xpos#2 init_sprites::ptr#2 ] ( main:5::init_sprites:8 [ init_sprites::s#2 init_sprites::xpos#2 init_sprites::ptr#2 ] ) always clobbers reg byte a -Statement [35] *((const byte*) SPRITES_COLS#0 + (byte) init_sprites::s#2) ← (const byte) BLACK#0 [ init_sprites::s#2 init_sprites::xpos#2 init_sprites::ptr#2 ] ( main:5::init_sprites:8 [ init_sprites::s#2 init_sprites::xpos#2 init_sprites::ptr#2 ] ) always clobbers reg byte a -Statement [36] *((const byte*) init_sprites::sprites_ptr#0 + (byte) init_sprites::s#2) ← (byte) init_sprites::ptr#2 [ init_sprites::s#2 init_sprites::xpos#2 init_sprites::ptr#2 ] ( main:5::init_sprites:8 [ init_sprites::s#2 init_sprites::xpos#2 init_sprites::ptr#2 ] ) always clobbers reg byte a -Statement [37] (byte) init_sprites::xpos#1 ← (byte) init_sprites::xpos#2 + (byte/signed byte/word/signed word/dword/signed dword) 24 [ init_sprites::s#2 init_sprites::ptr#2 init_sprites::xpos#1 ] ( main:5::init_sprites:8 [ init_sprites::s#2 init_sprites::ptr#2 init_sprites::xpos#1 ] ) always clobbers reg byte a -Statement [42] *((const byte*) BGCOL#0) ← (const byte) WHITE#0 [ irq_raster_next#0 irq_cnt#0 irq_sprite_ypos#0 ] ( ) always clobbers reg byte a -Statement [43] *((const byte*) BORDERCOL#0) ← *((const byte*) BGCOL#0) [ irq_raster_next#0 irq_cnt#0 irq_sprite_ypos#0 ] ( ) always clobbers reg byte a -Statement [44] *((const byte*) SPRITES_YPOS#0) ← (byte) irq_sprite_ypos#0 [ irq_raster_next#0 irq_cnt#0 irq_sprite_ypos#0 ] ( ) always clobbers reg byte a -Statement [45] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq_sprite_ypos#0 [ irq_raster_next#0 irq_cnt#0 irq_sprite_ypos#0 ] ( ) always clobbers reg byte a -Statement [46] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 4) ← (byte) irq_sprite_ypos#0 [ irq_raster_next#0 irq_cnt#0 irq_sprite_ypos#0 ] ( ) always clobbers reg byte a -Statement [47] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 6) ← (byte) irq_sprite_ypos#0 [ irq_raster_next#0 irq_cnt#0 irq_sprite_ypos#0 ] ( ) always clobbers reg byte a -Statement [48] (byte) irq_cnt#1 ← ++ (byte) irq_cnt#0 [ irq_raster_next#0 irq_sprite_ypos#0 irq_cnt#1 ] ( ) always clobbers reg byte y -Statement [49] if((byte) irq_cnt#1==(byte/signed byte/word/signed word/dword/signed dword) 10) goto irq::@1 [ irq_raster_next#0 irq_sprite_ypos#0 ] ( ) always clobbers reg byte a -Statement [50] (byte) irq_raster_next#2 ← (byte) irq_raster_next#0 + (byte/signed byte/word/signed word/dword/signed dword) 21 [ irq_sprite_ypos#0 irq_raster_next#2 ] ( ) always clobbers reg byte a -Statement [51] (byte) irq_sprite_ypos#2 ← (byte) irq_sprite_ypos#0 + (byte/signed byte/word/signed word/dword/signed dword) 21 [ irq_raster_next#2 ] ( ) always clobbers reg byte a -Statement [53] *((const byte*) RASTER#0) ← (byte) irq_raster_next#3 [ ] ( ) always clobbers reg byte a -Statement [54] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0 [ ] ( ) always clobbers reg byte a -Statement [55] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 [ ] ( ) always clobbers reg byte a -Statement [56] *((const byte*) BGCOL#0) ← (const byte) BLUE#0 [ ] ( ) always clobbers reg byte a -Statement [58] (byte) irq_cnt#2 ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( ) always clobbers reg byte a -Statement [59] (byte) irq_raster_next#1 ← (const byte) IRQ_RASTER_FIRST#0 [ irq_raster_next#1 ] ( ) always clobbers reg byte a -Statement [60] (byte) irq_sprite_ypos#1 ← (byte/signed byte/word/signed word/dword/signed dword) 50 [ irq_raster_next#1 ] ( ) always clobbers reg byte a +Statement [39] *((const byte*) SPRITES_XPOS#0 + (byte) init_sprites::s2#0) ← (byte) init_sprites::xpos#2 [ init_sprites::s#2 init_sprites::xpos#2 ] ( main:7::init_sprites:10 [ init_sprites::s#2 init_sprites::xpos#2 ] ) always clobbers reg byte a +Statement [40] *((const byte*) SPRITES_COLS#0 + (byte) init_sprites::s#2) ← (const byte) BLACK#0 [ init_sprites::s#2 init_sprites::xpos#2 ] ( main:7::init_sprites:10 [ init_sprites::s#2 init_sprites::xpos#2 ] ) always clobbers reg byte a +Statement [41] (byte) init_sprites::xpos#1 ← (byte) init_sprites::xpos#2 + (byte/signed byte/word/signed word/dword/signed dword) 24 [ init_sprites::s#2 init_sprites::xpos#1 ] ( main:7::init_sprites:10 [ init_sprites::s#2 init_sprites::xpos#1 ] ) always clobbers reg byte a +Statement [45] *((const byte*) BORDERCOL#0) ← (const byte) DARK_GREY#0 [ irq_raster_next#2 irq_sprite_ypos#2 irq_sprite_ptr#2 irq_cnt#19 ] ( ) always clobbers reg byte a +Statement [46] *((const byte*) SPRITES_YPOS#0) ← (byte) irq_sprite_ypos#2 [ irq_raster_next#2 irq_sprite_ypos#2 irq_sprite_ptr#2 irq_cnt#19 ] ( ) always clobbers reg byte a +Statement [47] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq_sprite_ypos#2 [ irq_raster_next#2 irq_sprite_ypos#2 irq_sprite_ptr#2 irq_cnt#19 ] ( ) always clobbers reg byte a +Statement [48] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 4) ← (byte) irq_sprite_ypos#2 [ irq_raster_next#2 irq_sprite_ypos#2 irq_sprite_ptr#2 irq_cnt#19 ] ( ) always clobbers reg byte a +Statement [49] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 6) ← (byte) irq_sprite_ypos#2 [ irq_raster_next#2 irq_sprite_ypos#2 irq_sprite_ptr#2 irq_cnt#19 ] ( ) always clobbers reg byte a +Statement [50] if(*((const byte*) RASTER#0)!=(byte) irq_sprite_ypos#2) goto irq::@1 [ irq_raster_next#2 irq_sprite_ypos#2 irq_sprite_ptr#2 irq_cnt#19 ] ( ) always clobbers reg byte a +Statement [58] (byte) irq_cnt#23 ← ++ (byte) irq_cnt#19 [ irq_raster_next#2 irq_sprite_ypos#2 irq_sprite_ptr#2 irq_cnt#23 ] ( ) always clobbers reg byte y +Statement [59] if((byte) irq_cnt#23==(byte/signed byte/word/signed word/dword/signed dword) 10) goto irq::@2 [ irq_raster_next#2 irq_sprite_ypos#2 irq_sprite_ptr#2 ] ( ) always clobbers reg byte a +Statement [60] (byte) irq_raster_next#6 ← (byte) irq_raster_next#2 + (byte/signed byte/word/signed word/dword/signed dword) 21 [ irq_sprite_ypos#2 irq_sprite_ptr#2 irq_raster_next#6 ] ( ) always clobbers reg byte a +Statement [61] (byte) irq_sprite_ypos#6 ← (byte) irq_sprite_ypos#2 + (byte/signed byte/word/signed word/dword/signed dword) 21 [ irq_sprite_ptr#2 irq_raster_next#6 ] ( ) always clobbers reg byte a +Statement [62] (byte) irq_sprite_ptr#6 ← (byte) irq_sprite_ptr#2 + (byte/signed byte/word/signed word/dword/signed dword) 3 [ irq_raster_next#6 ] ( ) always clobbers reg byte a +Statement [64] *((const byte*) RASTER#0) ← (byte) irq_raster_next#13 [ ] ( ) always clobbers reg byte a +Statement [65] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0 [ ] ( ) always clobbers reg byte a +Statement [66] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 [ ] ( ) always clobbers reg byte a +Statement [68] (byte) irq_cnt#24 ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( ) always clobbers reg byte a +Statement [69] (byte) irq_raster_next#20 ← (const byte) IRQ_RASTER_FIRST#0 [ irq_raster_next#20 ] ( ) always clobbers reg byte a +Statement [70] (byte) irq_sprite_ypos#26 ← (byte/signed byte/word/signed word/dword/signed dword) 50 [ irq_raster_next#20 ] ( ) always clobbers reg byte a +Statement [72] (byte) irq_sprite_ptr#5 ← (const byte) irq::toSpritePtr2_return#0 [ irq_raster_next#20 ] ( ) always clobbers reg byte a +Statement [1] (byte) irq_raster_next#2 ← (const byte) IRQ_RASTER_FIRST#0 [ ] ( ) always clobbers reg byte a +Statement [2] (byte) irq_sprite_ypos#2 ← (byte/signed byte/word/signed word/dword/signed dword) 50 [ ] ( ) always clobbers reg byte a +Statement [4] (byte) irq_sprite_ptr#2 ← (const byte) toSpritePtr1_return#0 [ ] ( ) always clobbers reg byte a +Statement [5] (byte) irq_cnt#19 ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( ) always clobbers reg byte a +Statement [14] (byte) irq_raster_next#11 ← (const byte) IRQ_RASTER_FIRST#0 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a +Statement [15] (byte) irq_sprite_ypos#11 ← (byte/signed byte/word/signed word/dword/signed dword) 50 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a +Statement [17] (byte) irq_sprite_ptr#3 ← (const byte) init_irq::toSpritePtr2_return#0 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a +Statement [18] (byte) irq_cnt#11 ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a +Statement [20] *((const byte*) CIA1_INTERRUPT#0) ← (const byte) CIA_INTERRUPT_CLEAR#0 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a +Statement [21] *((const byte*) VIC_CONTROL#0) ← *((const byte*) VIC_CONTROL#0) & (byte/signed byte/word/signed word/dword/signed dword) 127 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a +Statement [22] *((const byte*) RASTER#0) ← (const byte) IRQ_RASTER_FIRST#0 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a +Statement [23] *((const byte*) IRQ_ENABLE#0) ← (const byte) IRQ_RASTER#0 [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a +Statement [24] *((const void()**) KERNEL_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq() [ ] ( main:7::init_irq:12 [ ] ) always clobbers reg byte a +Statement [28] *((const byte*) CIA2_PORT_A_DDR#0) ← (byte/signed byte/word/signed word/dword/signed dword) 3 [ ] ( main:7::init_sprites:10 [ ] ) always clobbers reg byte a +Statement [30] *((const byte*) CIA2_PORT_A#0) ← (const byte) init_sprites::vicSelectGfxBank1_toDd001_return#0 [ ] ( main:7::init_sprites:10 [ ] ) always clobbers reg byte a +Statement [32] *((const byte*) D018#0) ← (const byte) init_sprites::toD0181_return#0 [ ] ( main:7::init_sprites:10 [ ] ) always clobbers reg byte a +Statement [33] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 15 [ ] ( main:7::init_sprites:10 [ ] ) always clobbers reg byte a +Statement [34] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:7::init_sprites:10 [ ] ) always clobbers reg byte a +Statement [35] *((const byte*) SPRITES_EXPAND_Y#0) ← *((const byte*) SPRITES_MC#0) [ ] ( main:7::init_sprites:10 [ ] ) always clobbers reg byte a +Statement [36] *((const byte*) SPRITES_EXPAND_X#0) ← *((const byte*) SPRITES_EXPAND_Y#0) [ ] ( main:7::init_sprites:10 [ ] ) always clobbers reg byte a +Statement [38] (byte) init_sprites::s2#0 ← (byte) init_sprites::s#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 [ init_sprites::s#2 init_sprites::xpos#2 init_sprites::s2#0 ] ( main:7::init_sprites:10 [ init_sprites::s#2 init_sprites::xpos#2 init_sprites::s2#0 ] ) always clobbers reg byte a +Statement [39] *((const byte*) SPRITES_XPOS#0 + (byte) init_sprites::s2#0) ← (byte) init_sprites::xpos#2 [ init_sprites::s#2 init_sprites::xpos#2 ] ( main:7::init_sprites:10 [ init_sprites::s#2 init_sprites::xpos#2 ] ) always clobbers reg byte a +Statement [40] *((const byte*) SPRITES_COLS#0 + (byte) init_sprites::s#2) ← (const byte) BLACK#0 [ init_sprites::s#2 init_sprites::xpos#2 ] ( main:7::init_sprites:10 [ init_sprites::s#2 init_sprites::xpos#2 ] ) always clobbers reg byte a +Statement [41] (byte) init_sprites::xpos#1 ← (byte) init_sprites::xpos#2 + (byte/signed byte/word/signed word/dword/signed dword) 24 [ init_sprites::s#2 init_sprites::xpos#1 ] ( main:7::init_sprites:10 [ init_sprites::s#2 init_sprites::xpos#1 ] ) always clobbers reg byte a +Statement [45] *((const byte*) BORDERCOL#0) ← (const byte) DARK_GREY#0 [ irq_raster_next#2 irq_sprite_ypos#2 irq_sprite_ptr#2 irq_cnt#19 ] ( ) always clobbers reg byte a +Statement [46] *((const byte*) SPRITES_YPOS#0) ← (byte) irq_sprite_ypos#2 [ irq_raster_next#2 irq_sprite_ypos#2 irq_sprite_ptr#2 irq_cnt#19 ] ( ) always clobbers reg byte a +Statement [47] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq_sprite_ypos#2 [ irq_raster_next#2 irq_sprite_ypos#2 irq_sprite_ptr#2 irq_cnt#19 ] ( ) always clobbers reg byte a +Statement [48] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 4) ← (byte) irq_sprite_ypos#2 [ irq_raster_next#2 irq_sprite_ypos#2 irq_sprite_ptr#2 irq_cnt#19 ] ( ) always clobbers reg byte a +Statement [49] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 6) ← (byte) irq_sprite_ypos#2 [ irq_raster_next#2 irq_sprite_ypos#2 irq_sprite_ptr#2 irq_cnt#19 ] ( ) always clobbers reg byte a +Statement [50] if(*((const byte*) RASTER#0)!=(byte) irq_sprite_ypos#2) goto irq::@1 [ irq_raster_next#2 irq_sprite_ypos#2 irq_sprite_ptr#2 irq_cnt#19 ] ( ) always clobbers reg byte a +Statement [58] (byte) irq_cnt#23 ← ++ (byte) irq_cnt#19 [ irq_raster_next#2 irq_sprite_ypos#2 irq_sprite_ptr#2 irq_cnt#23 ] ( ) always clobbers reg byte y +Statement [59] if((byte) irq_cnt#23==(byte/signed byte/word/signed word/dword/signed dword) 10) goto irq::@2 [ irq_raster_next#2 irq_sprite_ypos#2 irq_sprite_ptr#2 ] ( ) always clobbers reg byte a +Statement [60] (byte) irq_raster_next#6 ← (byte) irq_raster_next#2 + (byte/signed byte/word/signed word/dword/signed dword) 21 [ irq_sprite_ypos#2 irq_sprite_ptr#2 irq_raster_next#6 ] ( ) always clobbers reg byte a +Statement [61] (byte) irq_sprite_ypos#6 ← (byte) irq_sprite_ypos#2 + (byte/signed byte/word/signed word/dword/signed dword) 21 [ irq_sprite_ptr#2 irq_raster_next#6 ] ( ) always clobbers reg byte a +Statement [62] (byte) irq_sprite_ptr#6 ← (byte) irq_sprite_ptr#2 + (byte/signed byte/word/signed word/dword/signed dword) 3 [ irq_raster_next#6 ] ( ) always clobbers reg byte a +Statement [64] *((const byte*) RASTER#0) ← (byte) irq_raster_next#13 [ ] ( ) always clobbers reg byte a +Statement [65] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0 [ ] ( ) always clobbers reg byte a +Statement [66] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 [ ] ( ) always clobbers reg byte a +Statement [68] (byte) irq_cnt#24 ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( ) always clobbers reg byte a +Statement [69] (byte) irq_raster_next#20 ← (const byte) IRQ_RASTER_FIRST#0 [ irq_raster_next#20 ] ( ) always clobbers reg byte a +Statement [70] (byte) irq_sprite_ypos#26 ← (byte/signed byte/word/signed word/dword/signed dword) 50 [ irq_raster_next#20 ] ( ) always clobbers reg byte a +Statement [72] (byte) irq_sprite_ptr#5 ← (const byte) irq::toSpritePtr2_return#0 [ irq_raster_next#20 ] ( ) always clobbers reg byte a Potential registers zp ZP_BYTE:2 [ init_sprites::s#2 init_sprites::s#1 ] : zp ZP_BYTE:2 , reg byte x , reg byte y , Potential registers zp ZP_BYTE:3 [ init_sprites::xpos#2 init_sprites::xpos#1 ] : zp ZP_BYTE:3 , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:4 [ init_sprites::ptr#2 init_sprites::ptr#1 ] : zp ZP_BYTE:4 , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:5 [ irq_raster_next#3 irq_raster_next#1 irq_raster_next#2 ] : zp ZP_BYTE:5 , -Potential registers zp ZP_BYTE:6 [ irq_raster_next#0 ] : zp ZP_BYTE:6 , -Potential registers zp ZP_BYTE:7 [ irq_cnt#0 ] : zp ZP_BYTE:7 , -Potential registers zp ZP_BYTE:8 [ irq_sprite_ypos#0 ] : zp ZP_BYTE:8 , -Potential registers zp ZP_BYTE:9 [ init_sprites::s2#0 ] : zp ZP_BYTE:9 , reg byte x , reg byte y , -Potential registers zp ZP_BYTE:10 [ irq_cnt#1 ] : zp ZP_BYTE:10 , -Potential registers zp ZP_BYTE:11 [ irq_sprite_ypos#2 ] : zp ZP_BYTE:11 , -Potential registers zp ZP_BYTE:12 [ irq_cnt#2 ] : zp ZP_BYTE:12 , -Potential registers zp ZP_BYTE:13 [ irq_sprite_ypos#1 ] : zp ZP_BYTE:13 , +Potential registers zp ZP_BYTE:4 [ irq_raster_next#13 irq_raster_next#6 irq_raster_next#20 ] : zp ZP_BYTE:4 , +Potential registers zp ZP_BYTE:5 [ irq_raster_next#2 ] : zp ZP_BYTE:5 , +Potential registers zp ZP_BYTE:6 [ irq_sprite_ypos#2 ] : zp ZP_BYTE:6 , +Potential registers zp ZP_BYTE:7 [ irq_sprite_ptr#2 ] : zp ZP_BYTE:7 , +Potential registers zp ZP_BYTE:8 [ irq_cnt#19 ] : zp ZP_BYTE:8 , +Potential registers zp ZP_BYTE:9 [ irq_raster_next#11 ] : zp ZP_BYTE:9 , +Potential registers zp ZP_BYTE:10 [ irq_sprite_ypos#11 ] : zp ZP_BYTE:10 , +Potential registers zp ZP_BYTE:11 [ irq_sprite_ptr#3 ] : zp ZP_BYTE:11 , +Potential registers zp ZP_BYTE:12 [ irq_cnt#11 ] : zp ZP_BYTE:12 , +Potential registers zp ZP_BYTE:13 [ init_sprites::s2#0 ] : zp ZP_BYTE:13 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:14 [ irq::ptr#0 ] : zp ZP_BYTE:14 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:15 [ irq::ptr#1 ] : zp ZP_BYTE:15 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:16 [ irq::ptr#2 ] : zp ZP_BYTE:16 , reg byte a , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:17 [ irq_cnt#23 ] : zp ZP_BYTE:17 , +Potential registers zp ZP_BYTE:18 [ irq_sprite_ypos#6 ] : zp ZP_BYTE:18 , +Potential registers zp ZP_BYTE:19 [ irq_sprite_ptr#6 ] : zp ZP_BYTE:19 , +Potential registers zp ZP_BYTE:20 [ irq_cnt#24 ] : zp ZP_BYTE:20 , +Potential registers zp ZP_BYTE:21 [ irq_sprite_ypos#26 ] : zp ZP_BYTE:21 , +Potential registers zp ZP_BYTE:22 [ irq_sprite_ptr#5 ] : zp ZP_BYTE:22 , REGISTER UPLIFT SCOPES -Uplift Scope [] 20: zp ZP_BYTE:11 [ irq_sprite_ypos#2 ] 20: zp ZP_BYTE:12 [ irq_cnt#2 ] 20: zp ZP_BYTE:13 [ irq_sprite_ypos#1 ] 10: zp ZP_BYTE:5 [ irq_raster_next#3 irq_raster_next#1 irq_raster_next#2 ] 4: zp ZP_BYTE:10 [ irq_cnt#1 ] 1.33: zp ZP_BYTE:8 [ irq_sprite_ypos#0 ] 0.67: zp ZP_BYTE:7 [ irq_cnt#0 ] 0.5: zp ZP_BYTE:6 [ irq_raster_next#0 ] -Uplift Scope [init_sprites] 23.38: zp ZP_BYTE:2 [ init_sprites::s#2 init_sprites::s#1 ] 16.5: zp ZP_BYTE:9 [ init_sprites::s2#0 ] 12.05: zp ZP_BYTE:4 [ init_sprites::ptr#2 init_sprites::ptr#1 ] 11: zp ZP_BYTE:3 [ init_sprites::xpos#2 init_sprites::xpos#1 ] +Uplift Scope [] 20: zp ZP_BYTE:9 [ irq_raster_next#11 ] 20: zp ZP_BYTE:10 [ irq_sprite_ypos#11 ] 20: zp ZP_BYTE:11 [ irq_sprite_ptr#3 ] 20: zp ZP_BYTE:12 [ irq_cnt#11 ] 20: zp ZP_BYTE:18 [ irq_sprite_ypos#6 ] 20: zp ZP_BYTE:19 [ irq_sprite_ptr#6 ] 20: zp ZP_BYTE:20 [ irq_cnt#24 ] 20: zp ZP_BYTE:21 [ irq_sprite_ypos#26 ] 20: zp ZP_BYTE:22 [ irq_sprite_ptr#5 ] 8.33: zp ZP_BYTE:4 [ irq_raster_next#13 irq_raster_next#6 irq_raster_next#20 ] 4: zp ZP_BYTE:17 [ irq_cnt#23 ] 1.44: zp ZP_BYTE:6 [ irq_sprite_ypos#2 ] 0.35: zp ZP_BYTE:7 [ irq_sprite_ptr#2 ] 0.31: zp ZP_BYTE:8 [ irq_cnt#19 ] 0.27: zp ZP_BYTE:5 [ irq_raster_next#2 ] +Uplift Scope [init_sprites] 25.3: zp ZP_BYTE:2 [ init_sprites::s#2 init_sprites::s#1 ] 22: zp ZP_BYTE:13 [ init_sprites::s2#0 ] 15.58: zp ZP_BYTE:3 [ init_sprites::xpos#2 init_sprites::xpos#1 ] +Uplift Scope [irq] 4: zp ZP_BYTE:16 [ irq::ptr#2 ] 3: zp ZP_BYTE:14 [ irq::ptr#0 ] 2.67: zp ZP_BYTE:15 [ irq::ptr#1 ] Uplift Scope [main] Uplift Scope [init_irq] -Uplift Scope [irq] -Uplifting [] best 1688 combination zp ZP_BYTE:11 [ irq_sprite_ypos#2 ] zp ZP_BYTE:12 [ irq_cnt#2 ] zp ZP_BYTE:13 [ irq_sprite_ypos#1 ] zp ZP_BYTE:5 [ irq_raster_next#3 irq_raster_next#1 irq_raster_next#2 ] zp ZP_BYTE:10 [ irq_cnt#1 ] zp ZP_BYTE:8 [ irq_sprite_ypos#0 ] zp ZP_BYTE:7 [ irq_cnt#0 ] zp ZP_BYTE:6 [ irq_raster_next#0 ] -Uplifting [init_sprites] best 1458 combination reg byte y [ init_sprites::s#2 init_sprites::s#1 ] reg byte x [ init_sprites::s2#0 ] zp ZP_BYTE:4 [ init_sprites::ptr#2 init_sprites::ptr#1 ] zp ZP_BYTE:3 [ init_sprites::xpos#2 init_sprites::xpos#1 ] -Uplifting [main] best 1458 combination -Uplifting [init_irq] best 1458 combination -Uplifting [irq] best 1458 combination -Attempting to uplift remaining variables inzp ZP_BYTE:11 [ irq_sprite_ypos#2 ] -Uplifting [] best 1458 combination zp ZP_BYTE:11 [ irq_sprite_ypos#2 ] -Attempting to uplift remaining variables inzp ZP_BYTE:12 [ irq_cnt#2 ] -Uplifting [] best 1458 combination zp ZP_BYTE:12 [ irq_cnt#2 ] -Attempting to uplift remaining variables inzp ZP_BYTE:13 [ irq_sprite_ypos#1 ] -Uplifting [] best 1458 combination zp ZP_BYTE:13 [ irq_sprite_ypos#1 ] -Attempting to uplift remaining variables inzp ZP_BYTE:4 [ init_sprites::ptr#2 init_sprites::ptr#1 ] -Uplifting [init_sprites] best 1458 combination zp ZP_BYTE:4 [ init_sprites::ptr#2 init_sprites::ptr#1 ] +Uplifting [] best 1762 combination zp ZP_BYTE:9 [ irq_raster_next#11 ] zp ZP_BYTE:10 [ irq_sprite_ypos#11 ] zp ZP_BYTE:11 [ irq_sprite_ptr#3 ] zp ZP_BYTE:12 [ irq_cnt#11 ] zp ZP_BYTE:18 [ irq_sprite_ypos#6 ] zp ZP_BYTE:19 [ irq_sprite_ptr#6 ] zp ZP_BYTE:20 [ irq_cnt#24 ] zp ZP_BYTE:21 [ irq_sprite_ypos#26 ] zp ZP_BYTE:22 [ irq_sprite_ptr#5 ] zp ZP_BYTE:4 [ irq_raster_next#13 irq_raster_next#6 irq_raster_next#20 ] zp ZP_BYTE:17 [ irq_cnt#23 ] zp ZP_BYTE:6 [ irq_sprite_ypos#2 ] zp ZP_BYTE:7 [ irq_sprite_ptr#2 ] zp ZP_BYTE:8 [ irq_cnt#19 ] zp ZP_BYTE:5 [ irq_raster_next#2 ] +Uplifting [init_sprites] best 1592 combination reg byte x [ init_sprites::s#2 init_sprites::s#1 ] reg byte a [ init_sprites::s2#0 ] zp ZP_BYTE:3 [ init_sprites::xpos#2 init_sprites::xpos#1 ] +Uplifting [irq] best 1565 combination reg byte x [ irq::ptr#2 ] reg byte x [ irq::ptr#0 ] reg byte x [ irq::ptr#1 ] +Uplifting [main] best 1565 combination +Uplifting [init_irq] best 1565 combination +Attempting to uplift remaining variables inzp ZP_BYTE:9 [ irq_raster_next#11 ] +Uplifting [] best 1565 combination zp ZP_BYTE:9 [ irq_raster_next#11 ] +Attempting to uplift remaining variables inzp ZP_BYTE:10 [ irq_sprite_ypos#11 ] +Uplifting [] best 1565 combination zp ZP_BYTE:10 [ irq_sprite_ypos#11 ] +Attempting to uplift remaining variables inzp ZP_BYTE:11 [ irq_sprite_ptr#3 ] +Uplifting [] best 1565 combination zp ZP_BYTE:11 [ irq_sprite_ptr#3 ] +Attempting to uplift remaining variables inzp ZP_BYTE:12 [ irq_cnt#11 ] +Uplifting [] best 1565 combination zp ZP_BYTE:12 [ irq_cnt#11 ] +Attempting to uplift remaining variables inzp ZP_BYTE:18 [ irq_sprite_ypos#6 ] +Uplifting [] best 1565 combination zp ZP_BYTE:18 [ irq_sprite_ypos#6 ] +Attempting to uplift remaining variables inzp ZP_BYTE:19 [ irq_sprite_ptr#6 ] +Uplifting [] best 1565 combination zp ZP_BYTE:19 [ irq_sprite_ptr#6 ] +Attempting to uplift remaining variables inzp ZP_BYTE:20 [ irq_cnt#24 ] +Uplifting [] best 1565 combination zp ZP_BYTE:20 [ irq_cnt#24 ] +Attempting to uplift remaining variables inzp ZP_BYTE:21 [ irq_sprite_ypos#26 ] +Uplifting [] best 1565 combination zp ZP_BYTE:21 [ irq_sprite_ypos#26 ] +Attempting to uplift remaining variables inzp ZP_BYTE:22 [ irq_sprite_ptr#5 ] +Uplifting [] best 1565 combination zp ZP_BYTE:22 [ irq_sprite_ptr#5 ] Attempting to uplift remaining variables inzp ZP_BYTE:3 [ init_sprites::xpos#2 init_sprites::xpos#1 ] -Uplifting [init_sprites] best 1458 combination zp ZP_BYTE:3 [ init_sprites::xpos#2 init_sprites::xpos#1 ] -Attempting to uplift remaining variables inzp ZP_BYTE:5 [ irq_raster_next#3 irq_raster_next#1 irq_raster_next#2 ] -Uplifting [] best 1458 combination zp ZP_BYTE:5 [ irq_raster_next#3 irq_raster_next#1 irq_raster_next#2 ] -Attempting to uplift remaining variables inzp ZP_BYTE:10 [ irq_cnt#1 ] -Uplifting [] best 1458 combination zp ZP_BYTE:10 [ irq_cnt#1 ] -Attempting to uplift remaining variables inzp ZP_BYTE:8 [ irq_sprite_ypos#0 ] -Uplifting [] best 1458 combination zp ZP_BYTE:8 [ irq_sprite_ypos#0 ] -Attempting to uplift remaining variables inzp ZP_BYTE:7 [ irq_cnt#0 ] -Uplifting [] best 1458 combination zp ZP_BYTE:7 [ irq_cnt#0 ] -Attempting to uplift remaining variables inzp ZP_BYTE:6 [ irq_raster_next#0 ] -Uplifting [] best 1458 combination zp ZP_BYTE:6 [ irq_raster_next#0 ] -Coalescing zero page register with common assignment [ zp ZP_BYTE:5 [ irq_raster_next#3 irq_raster_next#1 irq_raster_next#2 ] ] with [ zp ZP_BYTE:6 [ irq_raster_next#0 ] ] - score: 1 -Coalescing zero page register with common assignment [ zp ZP_BYTE:7 [ irq_cnt#0 ] ] with [ zp ZP_BYTE:10 [ irq_cnt#1 ] ] - score: 1 -Coalescing zero page register with common assignment [ zp ZP_BYTE:8 [ irq_sprite_ypos#0 ] ] with [ zp ZP_BYTE:11 [ irq_sprite_ypos#2 ] ] - score: 1 -Coalescing zero page register [ zp ZP_BYTE:3 [ init_sprites::xpos#2 init_sprites::xpos#1 ] ] with [ zp ZP_BYTE:5 [ irq_raster_next#3 irq_raster_next#1 irq_raster_next#2 irq_raster_next#0 ] ] -Coalescing zero page register [ zp ZP_BYTE:3 [ init_sprites::xpos#2 init_sprites::xpos#1 irq_raster_next#3 irq_raster_next#1 irq_raster_next#2 irq_raster_next#0 ] ] with [ zp ZP_BYTE:7 [ irq_cnt#0 irq_cnt#1 ] ] -Coalescing zero page register [ zp ZP_BYTE:3 [ init_sprites::xpos#2 init_sprites::xpos#1 irq_raster_next#3 irq_raster_next#1 irq_raster_next#2 irq_raster_next#0 irq_cnt#0 irq_cnt#1 ] ] with [ zp ZP_BYTE:8 [ irq_sprite_ypos#0 irq_sprite_ypos#2 ] ] -Coalescing zero page register [ zp ZP_BYTE:3 [ init_sprites::xpos#2 init_sprites::xpos#1 irq_raster_next#3 irq_raster_next#1 irq_raster_next#2 irq_raster_next#0 irq_cnt#0 irq_cnt#1 irq_sprite_ypos#0 irq_sprite_ypos#2 ] ] with [ zp ZP_BYTE:12 [ irq_cnt#2 ] ] -Coalescing zero page register [ zp ZP_BYTE:3 [ init_sprites::xpos#2 init_sprites::xpos#1 irq_raster_next#3 irq_raster_next#1 irq_raster_next#2 irq_raster_next#0 irq_cnt#0 irq_cnt#1 irq_sprite_ypos#0 irq_sprite_ypos#2 irq_cnt#2 ] ] with [ zp ZP_BYTE:13 [ irq_sprite_ypos#1 ] ] -Allocated (was zp ZP_BYTE:3) zp ZP_BYTE:2 [ init_sprites::xpos#2 init_sprites::xpos#1 irq_raster_next#3 irq_raster_next#1 irq_raster_next#2 irq_raster_next#0 irq_cnt#0 irq_cnt#1 irq_sprite_ypos#0 irq_sprite_ypos#2 irq_cnt#2 irq_sprite_ypos#1 ] -Allocated (was zp ZP_BYTE:4) zp ZP_BYTE:3 [ init_sprites::ptr#2 init_sprites::ptr#1 ] +Uplifting [init_sprites] best 1565 combination zp ZP_BYTE:3 [ init_sprites::xpos#2 init_sprites::xpos#1 ] +Attempting to uplift remaining variables inzp ZP_BYTE:4 [ irq_raster_next#13 irq_raster_next#6 irq_raster_next#20 ] +Uplifting [] best 1565 combination zp ZP_BYTE:4 [ irq_raster_next#13 irq_raster_next#6 irq_raster_next#20 ] +Attempting to uplift remaining variables inzp ZP_BYTE:17 [ irq_cnt#23 ] +Uplifting [] best 1565 combination zp ZP_BYTE:17 [ irq_cnt#23 ] +Attempting to uplift remaining variables inzp ZP_BYTE:6 [ irq_sprite_ypos#2 ] +Uplifting [] best 1565 combination zp ZP_BYTE:6 [ irq_sprite_ypos#2 ] +Attempting to uplift remaining variables inzp ZP_BYTE:7 [ irq_sprite_ptr#2 ] +Uplifting [] best 1565 combination zp ZP_BYTE:7 [ irq_sprite_ptr#2 ] +Attempting to uplift remaining variables inzp ZP_BYTE:8 [ irq_cnt#19 ] +Uplifting [] best 1565 combination zp ZP_BYTE:8 [ irq_cnt#19 ] +Attempting to uplift remaining variables inzp ZP_BYTE:5 [ irq_raster_next#2 ] +Uplifting [] best 1565 combination zp ZP_BYTE:5 [ irq_raster_next#2 ] +Coalescing zero page register with common assignment [ zp ZP_BYTE:4 [ irq_raster_next#13 irq_raster_next#6 irq_raster_next#20 ] ] with [ zp ZP_BYTE:5 [ irq_raster_next#2 ] ] - score: 1 +Coalescing zero page register with common assignment [ zp ZP_BYTE:6 [ irq_sprite_ypos#2 ] ] with [ zp ZP_BYTE:18 [ irq_sprite_ypos#6 ] ] - score: 1 +Coalescing zero page register with common assignment [ zp ZP_BYTE:7 [ irq_sprite_ptr#2 ] ] with [ zp ZP_BYTE:19 [ irq_sprite_ptr#6 ] ] - score: 1 +Coalescing zero page register with common assignment [ zp ZP_BYTE:8 [ irq_cnt#19 ] ] with [ zp ZP_BYTE:17 [ irq_cnt#23 ] ] - score: 1 +Coalescing zero page register [ zp ZP_BYTE:3 [ init_sprites::xpos#2 init_sprites::xpos#1 ] ] with [ zp ZP_BYTE:4 [ irq_raster_next#13 irq_raster_next#6 irq_raster_next#20 irq_raster_next#2 ] ] +Coalescing zero page register [ zp ZP_BYTE:3 [ init_sprites::xpos#2 init_sprites::xpos#1 irq_raster_next#13 irq_raster_next#6 irq_raster_next#20 irq_raster_next#2 ] ] with [ zp ZP_BYTE:6 [ irq_sprite_ypos#2 irq_sprite_ypos#6 ] ] +Coalescing zero page register [ zp ZP_BYTE:3 [ init_sprites::xpos#2 init_sprites::xpos#1 irq_raster_next#13 irq_raster_next#6 irq_raster_next#20 irq_raster_next#2 irq_sprite_ypos#2 irq_sprite_ypos#6 ] ] with [ zp ZP_BYTE:7 [ irq_sprite_ptr#2 irq_sprite_ptr#6 ] ] +Coalescing zero page register [ zp ZP_BYTE:3 [ init_sprites::xpos#2 init_sprites::xpos#1 irq_raster_next#13 irq_raster_next#6 irq_raster_next#20 irq_raster_next#2 irq_sprite_ypos#2 irq_sprite_ypos#6 irq_sprite_ptr#2 irq_sprite_ptr#6 ] ] with [ zp ZP_BYTE:8 [ irq_cnt#19 irq_cnt#23 ] ] +Coalescing zero page register [ zp ZP_BYTE:3 [ init_sprites::xpos#2 init_sprites::xpos#1 irq_raster_next#13 irq_raster_next#6 irq_raster_next#20 irq_raster_next#2 irq_sprite_ypos#2 irq_sprite_ypos#6 irq_sprite_ptr#2 irq_sprite_ptr#6 irq_cnt#19 irq_cnt#23 ] ] with [ zp ZP_BYTE:9 [ irq_raster_next#11 ] ] +Coalescing zero page register [ zp ZP_BYTE:3 [ init_sprites::xpos#2 init_sprites::xpos#1 irq_raster_next#13 irq_raster_next#6 irq_raster_next#20 irq_raster_next#2 irq_sprite_ypos#2 irq_sprite_ypos#6 irq_sprite_ptr#2 irq_sprite_ptr#6 irq_cnt#19 irq_cnt#23 irq_raster_next#11 ] ] with [ zp ZP_BYTE:10 [ irq_sprite_ypos#11 ] ] +Coalescing zero page register [ zp ZP_BYTE:3 [ init_sprites::xpos#2 init_sprites::xpos#1 irq_raster_next#13 irq_raster_next#6 irq_raster_next#20 irq_raster_next#2 irq_sprite_ypos#2 irq_sprite_ypos#6 irq_sprite_ptr#2 irq_sprite_ptr#6 irq_cnt#19 irq_cnt#23 irq_raster_next#11 irq_sprite_ypos#11 ] ] with [ zp ZP_BYTE:11 [ irq_sprite_ptr#3 ] ] +Coalescing zero page register [ zp ZP_BYTE:3 [ init_sprites::xpos#2 init_sprites::xpos#1 irq_raster_next#13 irq_raster_next#6 irq_raster_next#20 irq_raster_next#2 irq_sprite_ypos#2 irq_sprite_ypos#6 irq_sprite_ptr#2 irq_sprite_ptr#6 irq_cnt#19 irq_cnt#23 irq_raster_next#11 irq_sprite_ypos#11 irq_sprite_ptr#3 ] ] with [ zp ZP_BYTE:12 [ irq_cnt#11 ] ] +Coalescing zero page register [ zp ZP_BYTE:3 [ init_sprites::xpos#2 init_sprites::xpos#1 irq_raster_next#13 irq_raster_next#6 irq_raster_next#20 irq_raster_next#2 irq_sprite_ypos#2 irq_sprite_ypos#6 irq_sprite_ptr#2 irq_sprite_ptr#6 irq_cnt#19 irq_cnt#23 irq_raster_next#11 irq_sprite_ypos#11 irq_sprite_ptr#3 irq_cnt#11 ] ] with [ zp ZP_BYTE:20 [ irq_cnt#24 ] ] +Coalescing zero page register [ zp ZP_BYTE:3 [ init_sprites::xpos#2 init_sprites::xpos#1 irq_raster_next#13 irq_raster_next#6 irq_raster_next#20 irq_raster_next#2 irq_sprite_ypos#2 irq_sprite_ypos#6 irq_sprite_ptr#2 irq_sprite_ptr#6 irq_cnt#19 irq_cnt#23 irq_raster_next#11 irq_sprite_ypos#11 irq_sprite_ptr#3 irq_cnt#11 irq_cnt#24 ] ] with [ zp ZP_BYTE:21 [ irq_sprite_ypos#26 ] ] +Coalescing zero page register [ zp ZP_BYTE:3 [ init_sprites::xpos#2 init_sprites::xpos#1 irq_raster_next#13 irq_raster_next#6 irq_raster_next#20 irq_raster_next#2 irq_sprite_ypos#2 irq_sprite_ypos#6 irq_sprite_ptr#2 irq_sprite_ptr#6 irq_cnt#19 irq_cnt#23 irq_raster_next#11 irq_sprite_ypos#11 irq_sprite_ptr#3 irq_cnt#11 irq_cnt#24 irq_sprite_ypos#26 ] ] with [ zp ZP_BYTE:22 [ irq_sprite_ptr#5 ] ] +Allocated (was zp ZP_BYTE:3) zp ZP_BYTE:2 [ init_sprites::xpos#2 init_sprites::xpos#1 irq_raster_next#13 irq_raster_next#6 irq_raster_next#20 irq_raster_next#2 irq_sprite_ypos#2 irq_sprite_ypos#6 irq_sprite_ptr#2 irq_sprite_ptr#6 irq_cnt#19 irq_cnt#23 irq_raster_next#11 irq_sprite_ypos#11 irq_sprite_ptr#3 irq_cnt#11 irq_cnt#24 irq_sprite_ypos#26 irq_sprite_ptr#5 ] ASSEMBLER BEFORE OPTIMIZATION //SEG0 Basic Upstart @@ -1714,7 +2162,6 @@ ASSEMBLER BEFORE OPTIMIZATION .label SPRITES_MC = $d01c .label SPRITES_EXPAND_X = $d01d .label BORDERCOL = $d020 - .label BGCOL = $d021 .label SPRITES_COLS = $d027 .label VIC_CONTROL = $d011 .label D018 = $d018 @@ -1727,274 +2174,323 @@ ASSEMBLER BEFORE OPTIMIZATION .label CIA2_PORT_A_DDR = $dd02 .label KERNEL_IRQ = $314 .const BLACK = 0 - .const WHITE = 1 - .const BLUE = 6 + .const DARK_GREY = $b .label PLAYFIELD_SPRITES = $2000 .label PLAYFIELD_CHARSET = $1000 .label PLAYFIELD_SCREEN = $400 .const IRQ_RASTER_FIRST = $30 + .label PLAYFIELD_SPRITE_PTRS = PLAYFIELD_SCREEN+SPRITE_PTRS + .const toSpritePtr1_return = PLAYFIELD_SPRITES>>6 .label irq_raster_next = 2 - .label irq_cnt = 2 .label irq_sprite_ypos = 2 + .label irq_sprite_ptr = 2 + .label irq_cnt = 2 //SEG2 @begin bbegin: jmp b6 //SEG3 @6 b6: -//SEG4 [1] (byte) irq_raster_next#0 ← (const byte) IRQ_RASTER_FIRST#0 -- vbuz1=vbuc1 +//SEG4 [1] (byte) irq_raster_next#2 ← (const byte) IRQ_RASTER_FIRST#0 -- vbuz1=vbuc1 lda #IRQ_RASTER_FIRST sta irq_raster_next -//SEG5 [2] (byte) irq_cnt#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 - lda #0 - sta irq_cnt -//SEG6 [3] (byte) irq_sprite_ypos#0 ← (byte/signed byte/word/signed word/dword/signed dword) 50 -- vbuz1=vbuc1 +//SEG5 [2] (byte) irq_sprite_ypos#2 ← (byte/signed byte/word/signed word/dword/signed dword) 50 -- vbuz1=vbuc1 lda #$32 sta irq_sprite_ypos +//SEG6 [3] phi from @6 to toSpritePtr1 [phi:@6->toSpritePtr1] +toSpritePtr1_from_b6: + jmp toSpritePtr1 +//SEG7 toSpritePtr1 +toSpritePtr1: + jmp b9 +//SEG8 @9 +b9: +//SEG9 [4] (byte) irq_sprite_ptr#2 ← (const byte) toSpritePtr1_return#0 -- vbuz1=vbuc1 + lda #toSpritePtr1_return + sta irq_sprite_ptr +//SEG10 [5] (byte) irq_cnt#19 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 + lda #0 + sta irq_cnt jmp b8 -//SEG7 @8 +//SEG11 @8 b8: -//SEG8 kickasm(location (const byte*) PLAYFIELD_SPRITES#0) {{ .var sprites = LoadPicture("nes-playfield.png", List().add($010101, $000000)) .for(var sy=0;sy<10;sy++) { .for(var sx=0;sx<3;sx++) { .for (var y=0;y<21; y++) { .for (var c=0; c<3; c++) { .byte sprites.getSinglecolorByte(sx*3+c,sy*21+y) } } .byte 0 } } }} -//SEG9 [5] call main -//SEG10 [7] phi from @8 to main [phi:@8->main] +//SEG12 kickasm(location (const byte*) PLAYFIELD_SPRITES#0) {{ .var sprites = LoadPicture("nes-playfield.png", List().add($010101, $000000)) .for(var sy=0;sy<10;sy++) { .for(var sx=0;sx<3;sx++) { .for (var y=0;y<21; y++) { .for (var c=0; c<3; c++) { .byte sprites.getSinglecolorByte(sx*3+c,sy*21+y) } } .byte 0 } } }} +//SEG13 [7] call main +//SEG14 [9] phi from @8 to main [phi:@8->main] main_from_b8: jsr main -//SEG11 [6] phi from @8 to @end [phi:@8->@end] +//SEG15 [8] phi from @8 to @end [phi:@8->@end] bend_from_b8: jmp bend -//SEG12 @end +//SEG16 @end bend: -//SEG13 main +//SEG17 main main: { - //SEG14 [8] call init_sprites - //SEG15 [20] phi from main to init_sprites [phi:main->init_sprites] + //SEG18 [10] call init_sprites + //SEG19 [27] phi from main to init_sprites [phi:main->init_sprites] init_sprites_from_main: jsr init_sprites - //SEG16 [9] phi from main to main::@1 [phi:main->main::@1] - b1_from_main: - jmp b1 - //SEG17 main::@1 - b1: - //SEG18 [10] call init_irq + //SEG20 [11] phi from main to main::@7 [phi:main->main::@7] + b7_from_main: + jmp b7 + //SEG21 main::@7 + b7: + //SEG22 [12] call init_irq jsr init_irq - jmp breturn - //SEG19 main::@return - breturn: - //SEG20 [11] return - rts + jmp b2 + //SEG23 main::@2 + b2: + //SEG24 [13] *((const byte*) PLAYFIELD_SCREEN#0) ← ++ *((const byte*) PLAYFIELD_SCREEN#0) -- _deref_pbuc1=_inc__deref_pbuc1 + inc PLAYFIELD_SCREEN + jmp b2 } -//SEG21 init_irq +//SEG25 init_irq init_irq: { - //SEG22 asm { sei } + .const toSpritePtr2_return = PLAYFIELD_SPRITES>>6 + //SEG26 [14] (byte) irq_raster_next#11 ← (const byte) IRQ_RASTER_FIRST#0 -- vbuz1=vbuc1 + lda #IRQ_RASTER_FIRST + sta irq_raster_next + //SEG27 [15] (byte) irq_sprite_ypos#11 ← (byte/signed byte/word/signed word/dword/signed dword) 50 -- vbuz1=vbuc1 + lda #$32 + sta irq_sprite_ypos + //SEG28 [16] phi from init_irq to init_irq::toSpritePtr2 [phi:init_irq->init_irq::toSpritePtr2] + toSpritePtr2_from_init_irq: + jmp toSpritePtr2 + //SEG29 init_irq::toSpritePtr2 + toSpritePtr2: + jmp b1 + //SEG30 init_irq::@1 + b1: + //SEG31 [17] (byte) irq_sprite_ptr#3 ← (const byte) init_irq::toSpritePtr2_return#0 -- vbuz1=vbuc1 + lda #toSpritePtr2_return + sta irq_sprite_ptr + //SEG32 [18] (byte) irq_cnt#11 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 + lda #0 + sta irq_cnt + //SEG33 asm { sei } sei - //SEG23 [13] *((const byte*) CIA1_INTERRUPT#0) ← (const byte) CIA_INTERRUPT_CLEAR#0 -- _deref_pbuc1=vbuc2 + //SEG34 [20] *((const byte*) CIA1_INTERRUPT#0) ← (const byte) CIA_INTERRUPT_CLEAR#0 -- _deref_pbuc1=vbuc2 lda #CIA_INTERRUPT_CLEAR sta CIA1_INTERRUPT - //SEG24 [14] *((const byte*) VIC_CONTROL#0) ← *((const byte*) VIC_CONTROL#0) & (byte/signed byte/word/signed word/dword/signed dword) 127 -- _deref_pbuc1=_deref_pbuc1_band_vbuc2 + //SEG35 [21] *((const byte*) VIC_CONTROL#0) ← *((const byte*) VIC_CONTROL#0) & (byte/signed byte/word/signed word/dword/signed dword) 127 -- _deref_pbuc1=_deref_pbuc1_band_vbuc2 lda VIC_CONTROL and #$7f sta VIC_CONTROL - //SEG25 [15] *((const byte*) RASTER#0) ← (const byte) IRQ_RASTER_FIRST#0 -- _deref_pbuc1=vbuc2 + //SEG36 [22] *((const byte*) RASTER#0) ← (const byte) IRQ_RASTER_FIRST#0 -- _deref_pbuc1=vbuc2 lda #IRQ_RASTER_FIRST sta RASTER - //SEG26 [16] *((const byte*) IRQ_ENABLE#0) ← (const byte) IRQ_RASTER#0 -- _deref_pbuc1=vbuc2 + //SEG37 [23] *((const byte*) IRQ_ENABLE#0) ← (const byte) IRQ_RASTER#0 -- _deref_pbuc1=vbuc2 lda #IRQ_RASTER sta IRQ_ENABLE - //SEG27 [17] *((const void()**) KERNEL_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq() -- _deref_pptc1=pprc2 + //SEG38 [24] *((const void()**) KERNEL_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq() -- _deref_pptc1=pprc2 lda #irq sta KERNEL_IRQ+1 - //SEG28 asm { cli } + //SEG39 asm { cli } cli jmp breturn - //SEG29 init_irq::@return + //SEG40 init_irq::@return breturn: - //SEG30 [19] return + //SEG41 [26] return rts } -//SEG31 init_sprites +//SEG42 init_sprites init_sprites: { - .const ypos = $32 - .label sprites_ptr = PLAYFIELD_SCREEN+SPRITE_PTRS - .const toSpritePtr1_return = PLAYFIELD_SPRITES>>6 .const vicSelectGfxBank1_toDd001_return = 3^(>PLAYFIELD_SCREEN)>>6 .const toD0181_return = (>(PLAYFIELD_SCREEN&$3fff)<<2)|(>PLAYFIELD_CHARSET)>>2&$f .label xpos = 2 - .label ptr = 3 jmp vicSelectGfxBank1 - //SEG32 init_sprites::vicSelectGfxBank1 + //SEG43 init_sprites::vicSelectGfxBank1 vicSelectGfxBank1: - //SEG33 [21] *((const byte*) CIA2_PORT_A_DDR#0) ← (byte/signed byte/word/signed word/dword/signed dword) 3 -- _deref_pbuc1=vbuc2 + //SEG44 [28] *((const byte*) CIA2_PORT_A_DDR#0) ← (byte/signed byte/word/signed word/dword/signed dword) 3 -- _deref_pbuc1=vbuc2 lda #3 sta CIA2_PORT_A_DDR - //SEG34 [22] phi from init_sprites::vicSelectGfxBank1 to init_sprites::vicSelectGfxBank1_toDd001 [phi:init_sprites::vicSelectGfxBank1->init_sprites::vicSelectGfxBank1_toDd001] + //SEG45 [29] phi from init_sprites::vicSelectGfxBank1 to init_sprites::vicSelectGfxBank1_toDd001 [phi:init_sprites::vicSelectGfxBank1->init_sprites::vicSelectGfxBank1_toDd001] vicSelectGfxBank1_toDd001_from_vicSelectGfxBank1: jmp vicSelectGfxBank1_toDd001 - //SEG35 init_sprites::vicSelectGfxBank1_toDd001 + //SEG46 init_sprites::vicSelectGfxBank1_toDd001 vicSelectGfxBank1_toDd001: jmp vicSelectGfxBank1_b1 - //SEG36 init_sprites::vicSelectGfxBank1_@1 + //SEG47 init_sprites::vicSelectGfxBank1_@1 vicSelectGfxBank1_b1: - //SEG37 [23] *((const byte*) CIA2_PORT_A#0) ← (const byte) init_sprites::vicSelectGfxBank1_toDd001_return#0 -- _deref_pbuc1=vbuc2 + //SEG48 [30] *((const byte*) CIA2_PORT_A#0) ← (const byte) init_sprites::vicSelectGfxBank1_toDd001_return#0 -- _deref_pbuc1=vbuc2 lda #vicSelectGfxBank1_toDd001_return sta CIA2_PORT_A - //SEG38 [24] phi from init_sprites::vicSelectGfxBank1_@1 to init_sprites::toD0181 [phi:init_sprites::vicSelectGfxBank1_@1->init_sprites::toD0181] + //SEG49 [31] phi from init_sprites::vicSelectGfxBank1_@1 to init_sprites::toD0181 [phi:init_sprites::vicSelectGfxBank1_@1->init_sprites::toD0181] toD0181_from_vicSelectGfxBank1_b1: jmp toD0181 - //SEG39 init_sprites::toD0181 + //SEG50 init_sprites::toD0181 toD0181: jmp b4 - //SEG40 init_sprites::@4 + //SEG51 init_sprites::@4 b4: - //SEG41 [25] *((const byte*) D018#0) ← (const byte) init_sprites::toD0181_return#0 -- _deref_pbuc1=vbuc2 + //SEG52 [32] *((const byte*) D018#0) ← (const byte) init_sprites::toD0181_return#0 -- _deref_pbuc1=vbuc2 lda #toD0181_return sta D018 - //SEG42 [26] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 15 -- _deref_pbuc1=vbuc2 + //SEG53 [33] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 15 -- _deref_pbuc1=vbuc2 lda #$f sta SPRITES_ENABLE - //SEG43 [27] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 + //SEG54 [34] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 lda #0 sta SPRITES_MC - //SEG44 [28] *((const byte*) SPRITES_EXPAND_Y#0) ← *((const byte*) SPRITES_MC#0) -- _deref_pbuc1=_deref_pbuc2 + //SEG55 [35] *((const byte*) SPRITES_EXPAND_Y#0) ← *((const byte*) SPRITES_MC#0) -- _deref_pbuc1=_deref_pbuc2 lda SPRITES_MC sta SPRITES_EXPAND_Y - //SEG45 [29] *((const byte*) SPRITES_EXPAND_X#0) ← *((const byte*) SPRITES_EXPAND_Y#0) -- _deref_pbuc1=_deref_pbuc2 + //SEG56 [36] *((const byte*) SPRITES_EXPAND_X#0) ← *((const byte*) SPRITES_EXPAND_Y#0) -- _deref_pbuc1=_deref_pbuc2 lda SPRITES_EXPAND_Y sta SPRITES_EXPAND_X - //SEG46 [30] phi from init_sprites::@4 to init_sprites::toSpritePtr1 [phi:init_sprites::@4->init_sprites::toSpritePtr1] - toSpritePtr1_from_b4: - jmp toSpritePtr1 - //SEG47 init_sprites::toSpritePtr1 - toSpritePtr1: - //SEG48 [31] phi from init_sprites::toSpritePtr1 to init_sprites::@1 [phi:init_sprites::toSpritePtr1->init_sprites::@1] - b1_from_toSpritePtr1: - //SEG49 [31] phi (byte) init_sprites::ptr#2 = (const byte) init_sprites::toSpritePtr1_return#0 [phi:init_sprites::toSpritePtr1->init_sprites::@1#0] -- vbuz1=vbuc1 - lda #toSpritePtr1_return - sta ptr - //SEG50 [31] phi (byte) init_sprites::xpos#2 = (byte/signed byte/word/signed word/dword/signed dword) 24+(byte/signed byte/word/signed word/dword/signed dword) 14*(byte/signed byte/word/signed word/dword/signed dword) 8 [phi:init_sprites::toSpritePtr1->init_sprites::@1#1] -- vbuz1=vbuc1 + //SEG57 [37] phi from init_sprites::@4 to init_sprites::@1 [phi:init_sprites::@4->init_sprites::@1] + b1_from_b4: + //SEG58 [37] phi (byte) init_sprites::xpos#2 = (byte/signed byte/word/signed word/dword/signed dword) 24+(byte/signed byte/word/signed word/dword/signed dword) 14*(byte/signed byte/word/signed word/dword/signed dword) 8 [phi:init_sprites::@4->init_sprites::@1#0] -- vbuz1=vbuc1 lda #$18+$e*8 sta xpos - //SEG51 [31] phi (byte) init_sprites::s#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:init_sprites::toSpritePtr1->init_sprites::@1#2] -- vbuyy=vbuc1 - ldy #0 + //SEG59 [37] phi (byte) init_sprites::s#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:init_sprites::@4->init_sprites::@1#1] -- vbuxx=vbuc1 + ldx #0 jmp b1 - //SEG52 [31] phi from init_sprites::@1 to init_sprites::@1 [phi:init_sprites::@1->init_sprites::@1] + //SEG60 [37] phi from init_sprites::@1 to init_sprites::@1 [phi:init_sprites::@1->init_sprites::@1] b1_from_b1: - //SEG53 [31] phi (byte) init_sprites::ptr#2 = (byte) init_sprites::ptr#1 [phi:init_sprites::@1->init_sprites::@1#0] -- register_copy - //SEG54 [31] phi (byte) init_sprites::xpos#2 = (byte) init_sprites::xpos#1 [phi:init_sprites::@1->init_sprites::@1#1] -- register_copy - //SEG55 [31] phi (byte) init_sprites::s#2 = (byte) init_sprites::s#1 [phi:init_sprites::@1->init_sprites::@1#2] -- register_copy + //SEG61 [37] phi (byte) init_sprites::xpos#2 = (byte) init_sprites::xpos#1 [phi:init_sprites::@1->init_sprites::@1#0] -- register_copy + //SEG62 [37] phi (byte) init_sprites::s#2 = (byte) init_sprites::s#1 [phi:init_sprites::@1->init_sprites::@1#1] -- register_copy jmp b1 - //SEG56 init_sprites::@1 + //SEG63 init_sprites::@1 b1: - //SEG57 [32] (byte) init_sprites::s2#0 ← (byte) init_sprites::s#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuxx=vbuyy_rol_1 - tya + //SEG64 [38] (byte) init_sprites::s2#0 ← (byte) init_sprites::s#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuaa=vbuxx_rol_1 + txa asl - tax - //SEG58 [33] *((const byte*) SPRITES_XPOS#0 + (byte) init_sprites::s2#0) ← (byte) init_sprites::xpos#2 -- pbuc1_derefidx_vbuxx=vbuz1 + //SEG65 [39] *((const byte*) SPRITES_XPOS#0 + (byte) init_sprites::s2#0) ← (byte) init_sprites::xpos#2 -- pbuc1_derefidx_vbuaa=vbuz1 + tay lda xpos - sta SPRITES_XPOS,x - //SEG59 [34] *((const byte*) SPRITES_YPOS#0 + (byte) init_sprites::s2#0) ← (const byte) init_sprites::ypos#0 -- pbuc1_derefidx_vbuxx=vbuc2 - lda #ypos - sta SPRITES_YPOS,x - //SEG60 [35] *((const byte*) SPRITES_COLS#0 + (byte) init_sprites::s#2) ← (const byte) BLACK#0 -- pbuc1_derefidx_vbuyy=vbuc2 + sta SPRITES_XPOS,y + //SEG66 [40] *((const byte*) SPRITES_COLS#0 + (byte) init_sprites::s#2) ← (const byte) BLACK#0 -- pbuc1_derefidx_vbuxx=vbuc2 lda #BLACK - sta SPRITES_COLS,y - //SEG61 [36] *((const byte*) init_sprites::sprites_ptr#0 + (byte) init_sprites::s#2) ← (byte) init_sprites::ptr#2 -- pbuc1_derefidx_vbuyy=vbuz1 - lda ptr - sta sprites_ptr,y - //SEG62 [37] (byte) init_sprites::xpos#1 ← (byte) init_sprites::xpos#2 + (byte/signed byte/word/signed word/dword/signed dword) 24 -- vbuz1=vbuz1_plus_vbuc1 + sta SPRITES_COLS,x + //SEG67 [41] (byte) init_sprites::xpos#1 ← (byte) init_sprites::xpos#2 + (byte/signed byte/word/signed word/dword/signed dword) 24 -- vbuz1=vbuz1_plus_vbuc1 lda #$18 clc adc xpos sta xpos - //SEG63 [38] (byte) init_sprites::ptr#1 ← ++ (byte) init_sprites::ptr#2 -- vbuz1=_inc_vbuz1 - inc ptr - //SEG64 [39] (byte) init_sprites::s#1 ← ++ (byte) init_sprites::s#2 -- vbuyy=_inc_vbuyy - iny - //SEG65 [40] if((byte) init_sprites::s#1!=(byte/signed byte/word/signed word/dword/signed dword) 4) goto init_sprites::@1 -- vbuyy_neq_vbuc1_then_la1 - cpy #4 + //SEG68 [42] (byte) init_sprites::s#1 ← ++ (byte) init_sprites::s#2 -- vbuxx=_inc_vbuxx + inx + //SEG69 [43] if((byte) init_sprites::s#1!=(byte/signed byte/word/signed word/dword/signed dword) 4) goto init_sprites::@1 -- vbuxx_neq_vbuc1_then_la1 + cpx #4 bne b1_from_b1 jmp breturn - //SEG66 init_sprites::@return + //SEG70 init_sprites::@return breturn: - //SEG67 [41] return + //SEG71 [44] return rts } -//SEG68 irq +//SEG72 irq irq: { - //SEG69 entry interrupt(KERNEL_MIN) - //SEG70 [42] *((const byte*) BGCOL#0) ← (const byte) WHITE#0 -- _deref_pbuc1=vbuc2 - lda #WHITE - sta BGCOL - //SEG71 [43] *((const byte*) BORDERCOL#0) ← *((const byte*) BGCOL#0) -- _deref_pbuc1=_deref_pbuc2 - lda BGCOL + .const toSpritePtr2_return = PLAYFIELD_SPRITES>>6 + //SEG73 entry interrupt(KERNEL_MIN) + //SEG74 [45] *((const byte*) BORDERCOL#0) ← (const byte) DARK_GREY#0 -- _deref_pbuc1=vbuc2 + lda #DARK_GREY sta BORDERCOL - //SEG72 [44] *((const byte*) SPRITES_YPOS#0) ← (byte) irq_sprite_ypos#0 -- _deref_pbuc1=vbuz1 + //SEG75 [46] *((const byte*) SPRITES_YPOS#0) ← (byte) irq_sprite_ypos#2 -- _deref_pbuc1=vbuz1 lda irq_sprite_ypos sta SPRITES_YPOS - //SEG73 [45] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq_sprite_ypos#0 -- _deref_pbuc1=vbuz1 + //SEG76 [47] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq_sprite_ypos#2 -- _deref_pbuc1=vbuz1 lda irq_sprite_ypos sta SPRITES_YPOS+2 - //SEG74 [46] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 4) ← (byte) irq_sprite_ypos#0 -- _deref_pbuc1=vbuz1 + //SEG77 [48] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 4) ← (byte) irq_sprite_ypos#2 -- _deref_pbuc1=vbuz1 lda irq_sprite_ypos sta SPRITES_YPOS+4 - //SEG75 [47] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 6) ← (byte) irq_sprite_ypos#0 -- _deref_pbuc1=vbuz1 + //SEG78 [49] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 6) ← (byte) irq_sprite_ypos#2 -- _deref_pbuc1=vbuz1 lda irq_sprite_ypos sta SPRITES_YPOS+6 - //SEG76 [48] (byte) irq_cnt#1 ← ++ (byte) irq_cnt#0 -- vbuz1=_inc_vbuz1 + jmp b1 + //SEG79 irq::@1 + b1: + //SEG80 [50] if(*((const byte*) RASTER#0)!=(byte) irq_sprite_ypos#2) goto irq::@1 -- _deref_pbuc1_neq_vbuz1_then_la1 + lda RASTER + cmp irq_sprite_ypos + bne b1 + jmp b4 + //SEG81 irq::@4 + b4: + //SEG82 [51] (byte) irq::ptr#0 ← (byte) irq_sprite_ptr#2 -- vbuxx=vbuz1 + ldx irq_sprite_ptr + //SEG83 [52] *((const byte*) PLAYFIELD_SPRITE_PTRS#0) ← (byte) irq::ptr#0 -- _deref_pbuc1=vbuxx + stx PLAYFIELD_SPRITE_PTRS + //SEG84 [53] (byte) irq::ptr#1 ← ++ (byte) irq::ptr#0 -- vbuxx=_inc_vbuxx + inx + //SEG85 [54] *((const byte*) PLAYFIELD_SPRITE_PTRS#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) irq::ptr#1 -- _deref_pbuc1=vbuxx + stx PLAYFIELD_SPRITE_PTRS+1 + //SEG86 [55] *((const byte*) PLAYFIELD_SPRITE_PTRS#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq::ptr#1 -- _deref_pbuc1=vbuxx + stx PLAYFIELD_SPRITE_PTRS+2 + //SEG87 [56] (byte) irq::ptr#2 ← ++ (byte) irq::ptr#1 -- vbuxx=_inc_vbuxx + inx + //SEG88 [57] *((const byte*) PLAYFIELD_SPRITE_PTRS#0+(byte/signed byte/word/signed word/dword/signed dword) 3) ← (byte) irq::ptr#2 -- _deref_pbuc1=vbuxx + stx PLAYFIELD_SPRITE_PTRS+3 + //SEG89 [58] (byte) irq_cnt#23 ← ++ (byte) irq_cnt#19 -- vbuz1=_inc_vbuz1 inc irq_cnt - //SEG77 [49] if((byte) irq_cnt#1==(byte/signed byte/word/signed word/dword/signed dword) 10) goto irq::@1 -- vbuz1_eq_vbuc1_then_la1 + //SEG90 [59] if((byte) irq_cnt#23==(byte/signed byte/word/signed word/dword/signed dword) 10) goto irq::@2 -- vbuz1_eq_vbuc1_then_la1 lda irq_cnt cmp #$a - beq b1 - jmp b3 - //SEG78 irq::@3 - b3: - //SEG79 [50] (byte) irq_raster_next#2 ← (byte) irq_raster_next#0 + (byte/signed byte/word/signed word/dword/signed dword) 21 -- vbuz1=vbuz1_plus_vbuc1 + beq b2 + jmp b5 + //SEG91 irq::@5 + b5: + //SEG92 [60] (byte) irq_raster_next#6 ← (byte) irq_raster_next#2 + (byte/signed byte/word/signed word/dword/signed dword) 21 -- vbuz1=vbuz1_plus_vbuc1 lda #$15 clc adc irq_raster_next sta irq_raster_next - //SEG80 [51] (byte) irq_sprite_ypos#2 ← (byte) irq_sprite_ypos#0 + (byte/signed byte/word/signed word/dword/signed dword) 21 -- vbuz1=vbuz1_plus_vbuc1 + //SEG93 [61] (byte) irq_sprite_ypos#6 ← (byte) irq_sprite_ypos#2 + (byte/signed byte/word/signed word/dword/signed dword) 21 -- vbuz1=vbuz1_plus_vbuc1 lda #$15 clc adc irq_sprite_ypos sta irq_sprite_ypos - //SEG81 [52] phi from irq::@1 irq::@3 to irq::@2 [phi:irq::@1/irq::@3->irq::@2] - b2_from_b1: - b2_from_b3: - //SEG82 [52] phi (byte) irq_raster_next#3 = (byte) irq_raster_next#1 [phi:irq::@1/irq::@3->irq::@2#0] -- register_copy - jmp b2 - //SEG83 irq::@2 - b2: - //SEG84 [53] *((const byte*) RASTER#0) ← (byte) irq_raster_next#3 -- _deref_pbuc1=vbuz1 + //SEG94 [62] (byte) irq_sprite_ptr#6 ← (byte) irq_sprite_ptr#2 + (byte/signed byte/word/signed word/dword/signed dword) 3 -- vbuz1=vbuz1_plus_vbuc1 + lda #3 + clc + adc irq_sprite_ptr + sta irq_sprite_ptr + //SEG95 [63] phi from irq::@5 irq::@7 to irq::@3 [phi:irq::@5/irq::@7->irq::@3] + b3_from_b5: + b3_from_b7: + //SEG96 [63] phi (byte) irq_raster_next#13 = (byte) irq_raster_next#6 [phi:irq::@5/irq::@7->irq::@3#0] -- register_copy + jmp b3 + //SEG97 irq::@3 + b3: + //SEG98 [64] *((const byte*) RASTER#0) ← (byte) irq_raster_next#13 -- _deref_pbuc1=vbuz1 lda irq_raster_next sta RASTER - //SEG85 [54] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0 -- _deref_pbuc1=vbuc2 + //SEG99 [65] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0 -- _deref_pbuc1=vbuc2 lda #IRQ_RASTER sta IRQ_STATUS - //SEG86 [55] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 + //SEG100 [66] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 lda #BLACK sta BORDERCOL - //SEG87 [56] *((const byte*) BGCOL#0) ← (const byte) BLUE#0 -- _deref_pbuc1=vbuc2 - lda #BLUE - sta BGCOL jmp breturn - //SEG88 irq::@return + //SEG101 irq::@return breturn: - //SEG89 [57] return - exit interrupt(KERNEL_MIN) + //SEG102 [67] return - exit interrupt(KERNEL_MIN) jmp $ea81 - //SEG90 irq::@1 - b1: - //SEG91 [58] (byte) irq_cnt#2 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 + //SEG103 irq::@2 + b2: + //SEG104 [68] (byte) irq_cnt#24 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 lda #0 sta irq_cnt - //SEG92 [59] (byte) irq_raster_next#1 ← (const byte) IRQ_RASTER_FIRST#0 -- vbuz1=vbuc1 + //SEG105 [69] (byte) irq_raster_next#20 ← (const byte) IRQ_RASTER_FIRST#0 -- vbuz1=vbuc1 lda #IRQ_RASTER_FIRST sta irq_raster_next - //SEG93 [60] (byte) irq_sprite_ypos#1 ← (byte/signed byte/word/signed word/dword/signed dword) 50 -- vbuz1=vbuc1 + //SEG106 [70] (byte) irq_sprite_ypos#26 ← (byte/signed byte/word/signed word/dword/signed dword) 50 -- vbuz1=vbuc1 lda #$32 sta irq_sprite_ypos - jmp b2_from_b1 + //SEG107 [71] phi from irq::@2 to irq::toSpritePtr2 [phi:irq::@2->irq::toSpritePtr2] + toSpritePtr2_from_b2: + jmp toSpritePtr2 + //SEG108 irq::toSpritePtr2 + toSpritePtr2: + jmp b7 + //SEG109 irq::@7 + b7: + //SEG110 [72] (byte) irq_sprite_ptr#5 ← (const byte) irq::toSpritePtr2_return#0 -- vbuz1=vbuc1 + lda #toSpritePtr2_return + sta irq_sprite_ptr + jmp b3_from_b7 } .pc = PLAYFIELD_SPRITES "Inline" .var sprites = LoadPicture("nes-playfield.png", List().add($010101, $000000)) @@ -2012,57 +2508,70 @@ irq: { ASSEMBLER OPTIMIZATIONS Removing instruction jmp b6 +Removing instruction jmp toSpritePtr1 +Removing instruction jmp b9 Removing instruction jmp b8 Removing instruction jmp bend +Removing instruction jmp b7 +Removing instruction jmp b2 +Removing instruction jmp toSpritePtr2 Removing instruction jmp b1 Removing instruction jmp breturn -Removing instruction jmp breturn Removing instruction jmp vicSelectGfxBank1 Removing instruction jmp vicSelectGfxBank1_toDd001 Removing instruction jmp vicSelectGfxBank1_b1 Removing instruction jmp toD0181 Removing instruction jmp b4 -Removing instruction jmp toSpritePtr1 Removing instruction jmp b1 Removing instruction jmp breturn +Removing instruction jmp b1 +Removing instruction jmp b4 +Removing instruction jmp b5 Removing instruction jmp b3 -Removing instruction jmp b2 Removing instruction jmp breturn +Removing instruction jmp toSpritePtr2 +Removing instruction jmp b7 Succesful ASM optimization Pass5NextJumpElimination Removing instruction lda SPRITES_MC Removing instruction lda SPRITES_EXPAND_Y -Removing instruction lda BGCOL Succesful ASM optimization Pass5UnnecesaryLoadElimination Replacing label b1_from_b1 with b1 -Replacing label b2_from_b1 with b2 +Replacing label b3_from_b7 with b3 Removing instruction bbegin: +Removing instruction toSpritePtr1_from_b6: +Removing instruction toSpritePtr1: Removing instruction main_from_b8: Removing instruction bend_from_b8: -Removing instruction b1_from_main: +Removing instruction b7_from_main: +Removing instruction toSpritePtr2_from_init_irq: +Removing instruction toSpritePtr2: Removing instruction vicSelectGfxBank1_toDd001_from_vicSelectGfxBank1: Removing instruction vicSelectGfxBank1_toDd001: Removing instruction toD0181_from_vicSelectGfxBank1_b1: Removing instruction toD0181: -Removing instruction toSpritePtr1_from_b4: -Removing instruction b1_from_toSpritePtr1: Removing instruction b1_from_b1: -Removing instruction b2_from_b1: -Removing instruction b2_from_b3: +Removing instruction b3_from_b5: +Removing instruction b3_from_b7: +Removing instruction toSpritePtr2_from_b2: +Removing instruction toSpritePtr2: Succesful ASM optimization Pass5RedundantLabelElimination Removing instruction b6: +Removing instruction b9: Removing instruction b8: Removing instruction bend: Removing instruction init_sprites_from_main: +Removing instruction b7: Removing instruction b1: Removing instruction breturn: -Removing instruction breturn: Removing instruction vicSelectGfxBank1: Removing instruction vicSelectGfxBank1_b1: Removing instruction b4: -Removing instruction toSpritePtr1: +Removing instruction b1_from_b4: Removing instruction breturn: -Removing instruction b3: +Removing instruction b4: +Removing instruction b5: Removing instruction breturn: +Removing instruction b7: Succesful ASM optimization Pass5UnusedLabelElimination Removing instruction jmp b1 Succesful ASM optimization Pass5NextJumpElimination @@ -2070,10 +2579,10 @@ Succesful ASM optimization Pass5NextJumpElimination FINAL SYMBOL TABLE (label) @6 (label) @8 +(label) @9 (label) @begin (label) @end (byte*) BGCOL -(const byte*) BGCOL#0 BGCOL = ((byte*))(word/dword/signed dword) 53281 (byte*) BGCOL1 (byte*) BGCOL2 (byte*) BGCOL3 @@ -2081,7 +2590,6 @@ FINAL SYMBOL TABLE (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 @@ -2108,6 +2616,7 @@ FINAL SYMBOL TABLE (byte*) D018 (const byte*) D018#0 D018 = ((byte*))(word/dword/signed dword) 53272 (byte) DARK_GREY +(const byte) DARK_GREY#0 DARK_GREY = (byte/signed byte/word/signed word/dword/signed dword) 11 (byte) GREEN (byte) GREY (void()**) HARDWARE_IRQ @@ -2137,6 +2646,8 @@ FINAL SYMBOL TABLE (const byte*) PLAYFIELD_SCREEN#0 PLAYFIELD_SCREEN = ((byte*))(word/signed word/dword/signed dword) 1024 (byte*) PLAYFIELD_SPRITES (const byte*) PLAYFIELD_SPRITES#0 PLAYFIELD_SPRITES = ((byte*))(word/signed word/dword/signed dword) 8192 +(byte*) PLAYFIELD_SPRITE_PTRS +(const byte*) PLAYFIELD_SPRITE_PTRS#0 PLAYFIELD_SPRITE_PTRS = (const byte*) PLAYFIELD_SCREEN#0+(const word) SPRITE_PTRS#0 (byte*) PROCPORT (byte) PROCPORT_BASIC_KERNEL_IO (byte*) PROCPORT_DDR @@ -2181,24 +2692,26 @@ FINAL SYMBOL TABLE (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 (void()) init_irq() +(label) init_irq::@1 (label) init_irq::@return +(label) init_irq::toSpritePtr2 +(word~) init_irq::toSpritePtr2_$0 +(word~) init_irq::toSpritePtr2_$1 +(byte~) init_irq::toSpritePtr2_$2 +(byte) init_irq::toSpritePtr2_return +(const byte) init_irq::toSpritePtr2_return#0 toSpritePtr2_return = ((byte))((word))(const byte*) PLAYFIELD_SPRITES#0>>(byte/signed byte/word/signed word/dword/signed dword) 6 +(byte*) init_irq::toSpritePtr2_sprite (void()) init_sprites() (label) init_sprites::@1 (label) init_sprites::@4 (label) init_sprites::@return -(byte) init_sprites::ptr -(byte) init_sprites::ptr#1 ptr zp ZP_BYTE:3 7.333333333333333 -(byte) init_sprites::ptr#2 ptr zp ZP_BYTE:3 4.714285714285714 (byte) init_sprites::s -(byte) init_sprites::s#1 reg byte y 16.5 -(byte) init_sprites::s#2 reg byte y 6.875 +(byte) init_sprites::s#1 reg byte x 16.5 +(byte) init_sprites::s#2 reg byte x 8.8 (byte) init_sprites::s2 -(byte) init_sprites::s2#0 reg byte x 16.5 -(byte*) init_sprites::sprites_ptr -(const byte*) init_sprites::sprites_ptr#0 sprites_ptr = (const byte*) PLAYFIELD_SCREEN#0+(const word) SPRITE_PTRS#0 +(byte) init_sprites::s2#0 reg byte a 22.0 (label) init_sprites::toD0181 (word~) init_sprites::toD0181_$0 (word~) init_sprites::toD0181_$1 @@ -2213,13 +2726,6 @@ FINAL SYMBOL TABLE (byte) init_sprites::toD0181_return (const byte) init_sprites::toD0181_return#0 toD0181_return = >((word))(const byte*) PLAYFIELD_SCREEN#0&(word/signed word/dword/signed dword) 16383<<(byte/signed byte/word/signed word/dword/signed dword) 2|>((word))(const byte*) PLAYFIELD_CHARSET#0>>(byte/signed byte/word/signed word/dword/signed dword) 2&(byte/signed byte/word/signed word/dword/signed dword) 15 (byte*) init_sprites::toD0181_screen -(label) init_sprites::toSpritePtr1 -(word~) init_sprites::toSpritePtr1_$0 -(word~) init_sprites::toSpritePtr1_$1 -(byte~) init_sprites::toSpritePtr1_$2 -(byte) init_sprites::toSpritePtr1_return -(const byte) init_sprites::toSpritePtr1_return#0 toSpritePtr1_return = ((byte))((word))(const byte*) PLAYFIELD_SPRITES#0>>(byte/signed byte/word/signed word/dword/signed dword) 6 -(byte*) init_sprites::toSpritePtr1_sprite (label) init_sprites::vicSelectGfxBank1 (byte~) init_sprites::vicSelectGfxBank1_$0 (label) init_sprites::vicSelectGfxBank1_@1 @@ -2233,40 +2739,69 @@ FINAL SYMBOL TABLE (byte) init_sprites::vicSelectGfxBank1_toDd001_return (const byte) init_sprites::vicSelectGfxBank1_toDd001_return#0 vicSelectGfxBank1_toDd001_return = (byte/signed byte/word/signed word/dword/signed dword) 3^>((word))(const byte*) PLAYFIELD_SCREEN#0>>(byte/signed byte/word/signed word/dword/signed dword) 6 (byte) init_sprites::xpos -(byte) init_sprites::xpos#1 xpos zp ZP_BYTE:2 5.5 -(byte) init_sprites::xpos#2 xpos zp ZP_BYTE:2 5.5 -(byte) init_sprites::ypos -(const byte) init_sprites::ypos#0 ypos = (byte/signed byte/word/signed word/dword/signed dword) 50 +(byte) init_sprites::xpos#1 xpos zp ZP_BYTE:2 7.333333333333333 +(byte) init_sprites::xpos#2 xpos zp ZP_BYTE:2 8.25 interrupt(KERNEL_MIN)(void()) irq() (label) irq::@1 (label) irq::@2 (label) irq::@3 +(label) irq::@4 +(label) irq::@5 +(label) irq::@7 (label) irq::@return +(byte) irq::ptr +(byte) irq::ptr#0 reg byte x 3.0 +(byte) irq::ptr#1 reg byte x 2.6666666666666665 +(byte) irq::ptr#2 reg byte x 4.0 +(label) irq::toSpritePtr2 +(word~) irq::toSpritePtr2_$0 +(word~) irq::toSpritePtr2_$1 +(byte~) irq::toSpritePtr2_$2 +(byte) irq::toSpritePtr2_return +(const byte) irq::toSpritePtr2_return#0 toSpritePtr2_return = ((byte))((word))(const byte*) PLAYFIELD_SPRITES#0>>(byte/signed byte/word/signed word/dword/signed dword) 6 +(byte*) irq::toSpritePtr2_sprite (byte) irq_cnt -(byte) irq_cnt#0 irq_cnt zp ZP_BYTE:2 0.6666666666666666 -(byte) irq_cnt#1 irq_cnt zp ZP_BYTE:2 4.0 -(byte) irq_cnt#2 irq_cnt zp ZP_BYTE:2 20.0 +(byte) irq_cnt#11 irq_cnt zp ZP_BYTE:2 20.0 +(byte) irq_cnt#19 irq_cnt zp ZP_BYTE:2 0.3076923076923077 +(byte) irq_cnt#23 irq_cnt zp ZP_BYTE:2 4.0 +(byte) irq_cnt#24 irq_cnt zp ZP_BYTE:2 20.0 (byte) irq_raster_next -(byte) irq_raster_next#0 irq_raster_next zp ZP_BYTE:2 0.5 -(byte) irq_raster_next#1 irq_raster_next zp ZP_BYTE:2 2.0 -(byte) irq_raster_next#2 irq_raster_next zp ZP_BYTE:2 2.0 -(byte) irq_raster_next#3 irq_raster_next zp ZP_BYTE:2 6.0 +(byte) irq_raster_next#11 irq_raster_next zp ZP_BYTE:2 20.0 +(byte) irq_raster_next#13 irq_raster_next zp ZP_BYTE:2 6.0 +(byte) irq_raster_next#2 irq_raster_next zp ZP_BYTE:2 0.26666666666666666 +(byte) irq_raster_next#20 irq_raster_next zp ZP_BYTE:2 1.0 +(byte) irq_raster_next#6 irq_raster_next zp ZP_BYTE:2 1.3333333333333333 +(byte) irq_sprite_ptr +(byte) irq_sprite_ptr#2 irq_sprite_ptr zp ZP_BYTE:2 0.3529411764705882 +(byte) irq_sprite_ptr#3 irq_sprite_ptr zp ZP_BYTE:2 20.0 +(byte) irq_sprite_ptr#5 irq_sprite_ptr zp ZP_BYTE:2 20.0 +(byte) irq_sprite_ptr#6 irq_sprite_ptr zp ZP_BYTE:2 20.0 (byte) irq_sprite_ypos -(byte) irq_sprite_ypos#0 irq_sprite_ypos zp ZP_BYTE:2 1.3333333333333335 -(byte) irq_sprite_ypos#1 irq_sprite_ypos zp ZP_BYTE:2 20.0 -(byte) irq_sprite_ypos#2 irq_sprite_ypos zp ZP_BYTE:2 20.0 +(byte) irq_sprite_ypos#11 irq_sprite_ypos zp ZP_BYTE:2 20.0 +(byte) irq_sprite_ypos#2 irq_sprite_ypos zp ZP_BYTE:2 1.4375 +(byte) irq_sprite_ypos#26 irq_sprite_ypos zp ZP_BYTE:2 20.0 +(byte) irq_sprite_ypos#6 irq_sprite_ypos zp ZP_BYTE:2 20.0 (void()) main() -(label) main::@1 -(label) main::@return +(label) main::@2 +(label) main::@7 +(label) toSpritePtr1 +(word~) toSpritePtr1_$0 +(word~) toSpritePtr1_$1 +(byte~) toSpritePtr1_$2 +(byte) toSpritePtr1_return +(const byte) toSpritePtr1_return#0 toSpritePtr1_return = ((byte))((word))(const byte*) PLAYFIELD_SPRITES#0>>(byte/signed byte/word/signed word/dword/signed dword) 6 +(byte*) toSpritePtr1_sprite -reg byte y [ init_sprites::s#2 init_sprites::s#1 ] -zp ZP_BYTE:2 [ init_sprites::xpos#2 init_sprites::xpos#1 irq_raster_next#3 irq_raster_next#1 irq_raster_next#2 irq_raster_next#0 irq_cnt#0 irq_cnt#1 irq_sprite_ypos#0 irq_sprite_ypos#2 irq_cnt#2 irq_sprite_ypos#1 ] -zp ZP_BYTE:3 [ init_sprites::ptr#2 init_sprites::ptr#1 ] -reg byte x [ init_sprites::s2#0 ] +reg byte x [ init_sprites::s#2 init_sprites::s#1 ] +zp ZP_BYTE:2 [ init_sprites::xpos#2 init_sprites::xpos#1 irq_raster_next#13 irq_raster_next#6 irq_raster_next#20 irq_raster_next#2 irq_sprite_ypos#2 irq_sprite_ypos#6 irq_sprite_ptr#2 irq_sprite_ptr#6 irq_cnt#19 irq_cnt#23 irq_raster_next#11 irq_sprite_ypos#11 irq_sprite_ptr#3 irq_cnt#11 irq_cnt#24 irq_sprite_ypos#26 irq_sprite_ptr#5 ] +reg byte a [ init_sprites::s2#0 ] +reg byte x [ irq::ptr#0 ] +reg byte x [ irq::ptr#1 ] +reg byte x [ irq::ptr#2 ] FINAL ASSEMBLER -Score: 1200 +Score: 1182 //SEG0 Basic Upstart .pc = $801 "Basic" @@ -2282,7 +2817,6 @@ Score: 1200 .label SPRITES_MC = $d01c .label SPRITES_EXPAND_X = $d01d .label BORDERCOL = $d020 - .label BGCOL = $d021 .label SPRITES_COLS = $d027 .label VIC_CONTROL = $d011 .label D018 = $d018 @@ -2295,226 +2829,262 @@ Score: 1200 .label CIA2_PORT_A_DDR = $dd02 .label KERNEL_IRQ = $314 .const BLACK = 0 - .const WHITE = 1 - .const BLUE = 6 + .const DARK_GREY = $b .label PLAYFIELD_SPRITES = $2000 .label PLAYFIELD_CHARSET = $1000 .label PLAYFIELD_SCREEN = $400 .const IRQ_RASTER_FIRST = $30 + .label PLAYFIELD_SPRITE_PTRS = PLAYFIELD_SCREEN+SPRITE_PTRS + .const toSpritePtr1_return = PLAYFIELD_SPRITES>>6 .label irq_raster_next = 2 - .label irq_cnt = 2 .label irq_sprite_ypos = 2 + .label irq_sprite_ptr = 2 + .label irq_cnt = 2 //SEG2 @begin //SEG3 @6 -//SEG4 [1] (byte) irq_raster_next#0 ← (const byte) IRQ_RASTER_FIRST#0 -- vbuz1=vbuc1 +//SEG4 [1] (byte) irq_raster_next#2 ← (const byte) IRQ_RASTER_FIRST#0 -- vbuz1=vbuc1 lda #IRQ_RASTER_FIRST sta irq_raster_next -//SEG5 [2] (byte) irq_cnt#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 - lda #0 - sta irq_cnt -//SEG6 [3] (byte) irq_sprite_ypos#0 ← (byte/signed byte/word/signed word/dword/signed dword) 50 -- vbuz1=vbuc1 +//SEG5 [2] (byte) irq_sprite_ypos#2 ← (byte/signed byte/word/signed word/dword/signed dword) 50 -- vbuz1=vbuc1 lda #$32 sta irq_sprite_ypos -//SEG7 @8 -//SEG8 kickasm(location (const byte*) PLAYFIELD_SPRITES#0) {{ .var sprites = LoadPicture("nes-playfield.png", List().add($010101, $000000)) .for(var sy=0;sy<10;sy++) { .for(var sx=0;sx<3;sx++) { .for (var y=0;y<21; y++) { .for (var c=0; c<3; c++) { .byte sprites.getSinglecolorByte(sx*3+c,sy*21+y) } } .byte 0 } } }} -//SEG9 [5] call main -//SEG10 [7] phi from @8 to main [phi:@8->main] +//SEG6 [3] phi from @6 to toSpritePtr1 [phi:@6->toSpritePtr1] +//SEG7 toSpritePtr1 +//SEG8 @9 +//SEG9 [4] (byte) irq_sprite_ptr#2 ← (const byte) toSpritePtr1_return#0 -- vbuz1=vbuc1 + lda #toSpritePtr1_return + sta irq_sprite_ptr +//SEG10 [5] (byte) irq_cnt#19 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 + lda #0 + sta irq_cnt +//SEG11 @8 +//SEG12 kickasm(location (const byte*) PLAYFIELD_SPRITES#0) {{ .var sprites = LoadPicture("nes-playfield.png", List().add($010101, $000000)) .for(var sy=0;sy<10;sy++) { .for(var sx=0;sx<3;sx++) { .for (var y=0;y<21; y++) { .for (var c=0; c<3; c++) { .byte sprites.getSinglecolorByte(sx*3+c,sy*21+y) } } .byte 0 } } }} +//SEG13 [7] call main +//SEG14 [9] phi from @8 to main [phi:@8->main] jsr main -//SEG11 [6] phi from @8 to @end [phi:@8->@end] -//SEG12 @end -//SEG13 main +//SEG15 [8] phi from @8 to @end [phi:@8->@end] +//SEG16 @end +//SEG17 main main: { - //SEG14 [8] call init_sprites - //SEG15 [20] phi from main to init_sprites [phi:main->init_sprites] + //SEG18 [10] call init_sprites + //SEG19 [27] phi from main to init_sprites [phi:main->init_sprites] jsr init_sprites - //SEG16 [9] phi from main to main::@1 [phi:main->main::@1] - //SEG17 main::@1 - //SEG18 [10] call init_irq + //SEG20 [11] phi from main to main::@7 [phi:main->main::@7] + //SEG21 main::@7 + //SEG22 [12] call init_irq jsr init_irq - //SEG19 main::@return - //SEG20 [11] return - rts + //SEG23 main::@2 + b2: + //SEG24 [13] *((const byte*) PLAYFIELD_SCREEN#0) ← ++ *((const byte*) PLAYFIELD_SCREEN#0) -- _deref_pbuc1=_inc__deref_pbuc1 + inc PLAYFIELD_SCREEN + jmp b2 } -//SEG21 init_irq +//SEG25 init_irq init_irq: { - //SEG22 asm { sei } + .const toSpritePtr2_return = PLAYFIELD_SPRITES>>6 + //SEG26 [14] (byte) irq_raster_next#11 ← (const byte) IRQ_RASTER_FIRST#0 -- vbuz1=vbuc1 + lda #IRQ_RASTER_FIRST + sta irq_raster_next + //SEG27 [15] (byte) irq_sprite_ypos#11 ← (byte/signed byte/word/signed word/dword/signed dword) 50 -- vbuz1=vbuc1 + lda #$32 + sta irq_sprite_ypos + //SEG28 [16] phi from init_irq to init_irq::toSpritePtr2 [phi:init_irq->init_irq::toSpritePtr2] + //SEG29 init_irq::toSpritePtr2 + //SEG30 init_irq::@1 + //SEG31 [17] (byte) irq_sprite_ptr#3 ← (const byte) init_irq::toSpritePtr2_return#0 -- vbuz1=vbuc1 + lda #toSpritePtr2_return + sta irq_sprite_ptr + //SEG32 [18] (byte) irq_cnt#11 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 + lda #0 + sta irq_cnt + //SEG33 asm { sei } sei - //SEG23 [13] *((const byte*) CIA1_INTERRUPT#0) ← (const byte) CIA_INTERRUPT_CLEAR#0 -- _deref_pbuc1=vbuc2 + //SEG34 [20] *((const byte*) CIA1_INTERRUPT#0) ← (const byte) CIA_INTERRUPT_CLEAR#0 -- _deref_pbuc1=vbuc2 lda #CIA_INTERRUPT_CLEAR sta CIA1_INTERRUPT - //SEG24 [14] *((const byte*) VIC_CONTROL#0) ← *((const byte*) VIC_CONTROL#0) & (byte/signed byte/word/signed word/dword/signed dword) 127 -- _deref_pbuc1=_deref_pbuc1_band_vbuc2 + //SEG35 [21] *((const byte*) VIC_CONTROL#0) ← *((const byte*) VIC_CONTROL#0) & (byte/signed byte/word/signed word/dword/signed dword) 127 -- _deref_pbuc1=_deref_pbuc1_band_vbuc2 lda VIC_CONTROL and #$7f sta VIC_CONTROL - //SEG25 [15] *((const byte*) RASTER#0) ← (const byte) IRQ_RASTER_FIRST#0 -- _deref_pbuc1=vbuc2 + //SEG36 [22] *((const byte*) RASTER#0) ← (const byte) IRQ_RASTER_FIRST#0 -- _deref_pbuc1=vbuc2 lda #IRQ_RASTER_FIRST sta RASTER - //SEG26 [16] *((const byte*) IRQ_ENABLE#0) ← (const byte) IRQ_RASTER#0 -- _deref_pbuc1=vbuc2 + //SEG37 [23] *((const byte*) IRQ_ENABLE#0) ← (const byte) IRQ_RASTER#0 -- _deref_pbuc1=vbuc2 lda #IRQ_RASTER sta IRQ_ENABLE - //SEG27 [17] *((const void()**) KERNEL_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq() -- _deref_pptc1=pprc2 + //SEG38 [24] *((const void()**) KERNEL_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq() -- _deref_pptc1=pprc2 lda #irq sta KERNEL_IRQ+1 - //SEG28 asm { cli } + //SEG39 asm { cli } cli - //SEG29 init_irq::@return - //SEG30 [19] return + //SEG40 init_irq::@return + //SEG41 [26] return rts } -//SEG31 init_sprites +//SEG42 init_sprites init_sprites: { - .const ypos = $32 - .label sprites_ptr = PLAYFIELD_SCREEN+SPRITE_PTRS - .const toSpritePtr1_return = PLAYFIELD_SPRITES>>6 .const vicSelectGfxBank1_toDd001_return = 3^(>PLAYFIELD_SCREEN)>>6 .const toD0181_return = (>(PLAYFIELD_SCREEN&$3fff)<<2)|(>PLAYFIELD_CHARSET)>>2&$f .label xpos = 2 - .label ptr = 3 - //SEG32 init_sprites::vicSelectGfxBank1 - //SEG33 [21] *((const byte*) CIA2_PORT_A_DDR#0) ← (byte/signed byte/word/signed word/dword/signed dword) 3 -- _deref_pbuc1=vbuc2 + //SEG43 init_sprites::vicSelectGfxBank1 + //SEG44 [28] *((const byte*) CIA2_PORT_A_DDR#0) ← (byte/signed byte/word/signed word/dword/signed dword) 3 -- _deref_pbuc1=vbuc2 lda #3 sta CIA2_PORT_A_DDR - //SEG34 [22] phi from init_sprites::vicSelectGfxBank1 to init_sprites::vicSelectGfxBank1_toDd001 [phi:init_sprites::vicSelectGfxBank1->init_sprites::vicSelectGfxBank1_toDd001] - //SEG35 init_sprites::vicSelectGfxBank1_toDd001 - //SEG36 init_sprites::vicSelectGfxBank1_@1 - //SEG37 [23] *((const byte*) CIA2_PORT_A#0) ← (const byte) init_sprites::vicSelectGfxBank1_toDd001_return#0 -- _deref_pbuc1=vbuc2 + //SEG45 [29] phi from init_sprites::vicSelectGfxBank1 to init_sprites::vicSelectGfxBank1_toDd001 [phi:init_sprites::vicSelectGfxBank1->init_sprites::vicSelectGfxBank1_toDd001] + //SEG46 init_sprites::vicSelectGfxBank1_toDd001 + //SEG47 init_sprites::vicSelectGfxBank1_@1 + //SEG48 [30] *((const byte*) CIA2_PORT_A#0) ← (const byte) init_sprites::vicSelectGfxBank1_toDd001_return#0 -- _deref_pbuc1=vbuc2 lda #vicSelectGfxBank1_toDd001_return sta CIA2_PORT_A - //SEG38 [24] phi from init_sprites::vicSelectGfxBank1_@1 to init_sprites::toD0181 [phi:init_sprites::vicSelectGfxBank1_@1->init_sprites::toD0181] - //SEG39 init_sprites::toD0181 - //SEG40 init_sprites::@4 - //SEG41 [25] *((const byte*) D018#0) ← (const byte) init_sprites::toD0181_return#0 -- _deref_pbuc1=vbuc2 + //SEG49 [31] phi from init_sprites::vicSelectGfxBank1_@1 to init_sprites::toD0181 [phi:init_sprites::vicSelectGfxBank1_@1->init_sprites::toD0181] + //SEG50 init_sprites::toD0181 + //SEG51 init_sprites::@4 + //SEG52 [32] *((const byte*) D018#0) ← (const byte) init_sprites::toD0181_return#0 -- _deref_pbuc1=vbuc2 lda #toD0181_return sta D018 - //SEG42 [26] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 15 -- _deref_pbuc1=vbuc2 + //SEG53 [33] *((const byte*) SPRITES_ENABLE#0) ← (byte/signed byte/word/signed word/dword/signed dword) 15 -- _deref_pbuc1=vbuc2 lda #$f sta SPRITES_ENABLE - //SEG43 [27] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 + //SEG54 [34] *((const byte*) SPRITES_MC#0) ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- _deref_pbuc1=vbuc2 lda #0 sta SPRITES_MC - //SEG44 [28] *((const byte*) SPRITES_EXPAND_Y#0) ← *((const byte*) SPRITES_MC#0) -- _deref_pbuc1=_deref_pbuc2 + //SEG55 [35] *((const byte*) SPRITES_EXPAND_Y#0) ← *((const byte*) SPRITES_MC#0) -- _deref_pbuc1=_deref_pbuc2 sta SPRITES_EXPAND_Y - //SEG45 [29] *((const byte*) SPRITES_EXPAND_X#0) ← *((const byte*) SPRITES_EXPAND_Y#0) -- _deref_pbuc1=_deref_pbuc2 + //SEG56 [36] *((const byte*) SPRITES_EXPAND_X#0) ← *((const byte*) SPRITES_EXPAND_Y#0) -- _deref_pbuc1=_deref_pbuc2 sta SPRITES_EXPAND_X - //SEG46 [30] phi from init_sprites::@4 to init_sprites::toSpritePtr1 [phi:init_sprites::@4->init_sprites::toSpritePtr1] - //SEG47 init_sprites::toSpritePtr1 - //SEG48 [31] phi from init_sprites::toSpritePtr1 to init_sprites::@1 [phi:init_sprites::toSpritePtr1->init_sprites::@1] - //SEG49 [31] phi (byte) init_sprites::ptr#2 = (const byte) init_sprites::toSpritePtr1_return#0 [phi:init_sprites::toSpritePtr1->init_sprites::@1#0] -- vbuz1=vbuc1 - lda #toSpritePtr1_return - sta ptr - //SEG50 [31] phi (byte) init_sprites::xpos#2 = (byte/signed byte/word/signed word/dword/signed dword) 24+(byte/signed byte/word/signed word/dword/signed dword) 14*(byte/signed byte/word/signed word/dword/signed dword) 8 [phi:init_sprites::toSpritePtr1->init_sprites::@1#1] -- vbuz1=vbuc1 + //SEG57 [37] phi from init_sprites::@4 to init_sprites::@1 [phi:init_sprites::@4->init_sprites::@1] + //SEG58 [37] phi (byte) init_sprites::xpos#2 = (byte/signed byte/word/signed word/dword/signed dword) 24+(byte/signed byte/word/signed word/dword/signed dword) 14*(byte/signed byte/word/signed word/dword/signed dword) 8 [phi:init_sprites::@4->init_sprites::@1#0] -- vbuz1=vbuc1 lda #$18+$e*8 sta xpos - //SEG51 [31] phi (byte) init_sprites::s#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:init_sprites::toSpritePtr1->init_sprites::@1#2] -- vbuyy=vbuc1 - ldy #0 - //SEG52 [31] phi from init_sprites::@1 to init_sprites::@1 [phi:init_sprites::@1->init_sprites::@1] - //SEG53 [31] phi (byte) init_sprites::ptr#2 = (byte) init_sprites::ptr#1 [phi:init_sprites::@1->init_sprites::@1#0] -- register_copy - //SEG54 [31] phi (byte) init_sprites::xpos#2 = (byte) init_sprites::xpos#1 [phi:init_sprites::@1->init_sprites::@1#1] -- register_copy - //SEG55 [31] phi (byte) init_sprites::s#2 = (byte) init_sprites::s#1 [phi:init_sprites::@1->init_sprites::@1#2] -- register_copy - //SEG56 init_sprites::@1 + //SEG59 [37] phi (byte) init_sprites::s#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:init_sprites::@4->init_sprites::@1#1] -- vbuxx=vbuc1 + ldx #0 + //SEG60 [37] phi from init_sprites::@1 to init_sprites::@1 [phi:init_sprites::@1->init_sprites::@1] + //SEG61 [37] phi (byte) init_sprites::xpos#2 = (byte) init_sprites::xpos#1 [phi:init_sprites::@1->init_sprites::@1#0] -- register_copy + //SEG62 [37] phi (byte) init_sprites::s#2 = (byte) init_sprites::s#1 [phi:init_sprites::@1->init_sprites::@1#1] -- register_copy + //SEG63 init_sprites::@1 b1: - //SEG57 [32] (byte) init_sprites::s2#0 ← (byte) init_sprites::s#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuxx=vbuyy_rol_1 - tya + //SEG64 [38] (byte) init_sprites::s2#0 ← (byte) init_sprites::s#2 << (byte/signed byte/word/signed word/dword/signed dword) 1 -- vbuaa=vbuxx_rol_1 + txa asl - tax - //SEG58 [33] *((const byte*) SPRITES_XPOS#0 + (byte) init_sprites::s2#0) ← (byte) init_sprites::xpos#2 -- pbuc1_derefidx_vbuxx=vbuz1 + //SEG65 [39] *((const byte*) SPRITES_XPOS#0 + (byte) init_sprites::s2#0) ← (byte) init_sprites::xpos#2 -- pbuc1_derefidx_vbuaa=vbuz1 + tay lda xpos - sta SPRITES_XPOS,x - //SEG59 [34] *((const byte*) SPRITES_YPOS#0 + (byte) init_sprites::s2#0) ← (const byte) init_sprites::ypos#0 -- pbuc1_derefidx_vbuxx=vbuc2 - lda #ypos - sta SPRITES_YPOS,x - //SEG60 [35] *((const byte*) SPRITES_COLS#0 + (byte) init_sprites::s#2) ← (const byte) BLACK#0 -- pbuc1_derefidx_vbuyy=vbuc2 + sta SPRITES_XPOS,y + //SEG66 [40] *((const byte*) SPRITES_COLS#0 + (byte) init_sprites::s#2) ← (const byte) BLACK#0 -- pbuc1_derefidx_vbuxx=vbuc2 lda #BLACK - sta SPRITES_COLS,y - //SEG61 [36] *((const byte*) init_sprites::sprites_ptr#0 + (byte) init_sprites::s#2) ← (byte) init_sprites::ptr#2 -- pbuc1_derefidx_vbuyy=vbuz1 - lda ptr - sta sprites_ptr,y - //SEG62 [37] (byte) init_sprites::xpos#1 ← (byte) init_sprites::xpos#2 + (byte/signed byte/word/signed word/dword/signed dword) 24 -- vbuz1=vbuz1_plus_vbuc1 + sta SPRITES_COLS,x + //SEG67 [41] (byte) init_sprites::xpos#1 ← (byte) init_sprites::xpos#2 + (byte/signed byte/word/signed word/dword/signed dword) 24 -- vbuz1=vbuz1_plus_vbuc1 lda #$18 clc adc xpos sta xpos - //SEG63 [38] (byte) init_sprites::ptr#1 ← ++ (byte) init_sprites::ptr#2 -- vbuz1=_inc_vbuz1 - inc ptr - //SEG64 [39] (byte) init_sprites::s#1 ← ++ (byte) init_sprites::s#2 -- vbuyy=_inc_vbuyy - iny - //SEG65 [40] if((byte) init_sprites::s#1!=(byte/signed byte/word/signed word/dword/signed dword) 4) goto init_sprites::@1 -- vbuyy_neq_vbuc1_then_la1 - cpy #4 + //SEG68 [42] (byte) init_sprites::s#1 ← ++ (byte) init_sprites::s#2 -- vbuxx=_inc_vbuxx + inx + //SEG69 [43] if((byte) init_sprites::s#1!=(byte/signed byte/word/signed word/dword/signed dword) 4) goto init_sprites::@1 -- vbuxx_neq_vbuc1_then_la1 + cpx #4 bne b1 - //SEG66 init_sprites::@return - //SEG67 [41] return + //SEG70 init_sprites::@return + //SEG71 [44] return rts } -//SEG68 irq +//SEG72 irq irq: { - //SEG69 entry interrupt(KERNEL_MIN) - //SEG70 [42] *((const byte*) BGCOL#0) ← (const byte) WHITE#0 -- _deref_pbuc1=vbuc2 - lda #WHITE - sta BGCOL - //SEG71 [43] *((const byte*) BORDERCOL#0) ← *((const byte*) BGCOL#0) -- _deref_pbuc1=_deref_pbuc2 + .const toSpritePtr2_return = PLAYFIELD_SPRITES>>6 + //SEG73 entry interrupt(KERNEL_MIN) + //SEG74 [45] *((const byte*) BORDERCOL#0) ← (const byte) DARK_GREY#0 -- _deref_pbuc1=vbuc2 + lda #DARK_GREY sta BORDERCOL - //SEG72 [44] *((const byte*) SPRITES_YPOS#0) ← (byte) irq_sprite_ypos#0 -- _deref_pbuc1=vbuz1 + //SEG75 [46] *((const byte*) SPRITES_YPOS#0) ← (byte) irq_sprite_ypos#2 -- _deref_pbuc1=vbuz1 lda irq_sprite_ypos sta SPRITES_YPOS - //SEG73 [45] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq_sprite_ypos#0 -- _deref_pbuc1=vbuz1 + //SEG76 [47] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq_sprite_ypos#2 -- _deref_pbuc1=vbuz1 lda irq_sprite_ypos sta SPRITES_YPOS+2 - //SEG74 [46] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 4) ← (byte) irq_sprite_ypos#0 -- _deref_pbuc1=vbuz1 + //SEG77 [48] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 4) ← (byte) irq_sprite_ypos#2 -- _deref_pbuc1=vbuz1 lda irq_sprite_ypos sta SPRITES_YPOS+4 - //SEG75 [47] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 6) ← (byte) irq_sprite_ypos#0 -- _deref_pbuc1=vbuz1 + //SEG78 [49] *((const byte*) SPRITES_YPOS#0+(byte/signed byte/word/signed word/dword/signed dword) 6) ← (byte) irq_sprite_ypos#2 -- _deref_pbuc1=vbuz1 lda irq_sprite_ypos sta SPRITES_YPOS+6 - //SEG76 [48] (byte) irq_cnt#1 ← ++ (byte) irq_cnt#0 -- vbuz1=_inc_vbuz1 + //SEG79 irq::@1 + b1: + //SEG80 [50] if(*((const byte*) RASTER#0)!=(byte) irq_sprite_ypos#2) goto irq::@1 -- _deref_pbuc1_neq_vbuz1_then_la1 + lda RASTER + cmp irq_sprite_ypos + bne b1 + //SEG81 irq::@4 + //SEG82 [51] (byte) irq::ptr#0 ← (byte) irq_sprite_ptr#2 -- vbuxx=vbuz1 + ldx irq_sprite_ptr + //SEG83 [52] *((const byte*) PLAYFIELD_SPRITE_PTRS#0) ← (byte) irq::ptr#0 -- _deref_pbuc1=vbuxx + stx PLAYFIELD_SPRITE_PTRS + //SEG84 [53] (byte) irq::ptr#1 ← ++ (byte) irq::ptr#0 -- vbuxx=_inc_vbuxx + inx + //SEG85 [54] *((const byte*) PLAYFIELD_SPRITE_PTRS#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) irq::ptr#1 -- _deref_pbuc1=vbuxx + stx PLAYFIELD_SPRITE_PTRS+1 + //SEG86 [55] *((const byte*) PLAYFIELD_SPRITE_PTRS#0+(byte/signed byte/word/signed word/dword/signed dword) 2) ← (byte) irq::ptr#1 -- _deref_pbuc1=vbuxx + stx PLAYFIELD_SPRITE_PTRS+2 + //SEG87 [56] (byte) irq::ptr#2 ← ++ (byte) irq::ptr#1 -- vbuxx=_inc_vbuxx + inx + //SEG88 [57] *((const byte*) PLAYFIELD_SPRITE_PTRS#0+(byte/signed byte/word/signed word/dword/signed dword) 3) ← (byte) irq::ptr#2 -- _deref_pbuc1=vbuxx + stx PLAYFIELD_SPRITE_PTRS+3 + //SEG89 [58] (byte) irq_cnt#23 ← ++ (byte) irq_cnt#19 -- vbuz1=_inc_vbuz1 inc irq_cnt - //SEG77 [49] if((byte) irq_cnt#1==(byte/signed byte/word/signed word/dword/signed dword) 10) goto irq::@1 -- vbuz1_eq_vbuc1_then_la1 + //SEG90 [59] if((byte) irq_cnt#23==(byte/signed byte/word/signed word/dword/signed dword) 10) goto irq::@2 -- vbuz1_eq_vbuc1_then_la1 lda irq_cnt cmp #$a - beq b1 - //SEG78 irq::@3 - //SEG79 [50] (byte) irq_raster_next#2 ← (byte) irq_raster_next#0 + (byte/signed byte/word/signed word/dword/signed dword) 21 -- vbuz1=vbuz1_plus_vbuc1 + beq b2 + //SEG91 irq::@5 + //SEG92 [60] (byte) irq_raster_next#6 ← (byte) irq_raster_next#2 + (byte/signed byte/word/signed word/dword/signed dword) 21 -- vbuz1=vbuz1_plus_vbuc1 lda #$15 clc adc irq_raster_next sta irq_raster_next - //SEG80 [51] (byte) irq_sprite_ypos#2 ← (byte) irq_sprite_ypos#0 + (byte/signed byte/word/signed word/dword/signed dword) 21 -- vbuz1=vbuz1_plus_vbuc1 + //SEG93 [61] (byte) irq_sprite_ypos#6 ← (byte) irq_sprite_ypos#2 + (byte/signed byte/word/signed word/dword/signed dword) 21 -- vbuz1=vbuz1_plus_vbuc1 lda #$15 clc adc irq_sprite_ypos sta irq_sprite_ypos - //SEG81 [52] phi from irq::@1 irq::@3 to irq::@2 [phi:irq::@1/irq::@3->irq::@2] - //SEG82 [52] phi (byte) irq_raster_next#3 = (byte) irq_raster_next#1 [phi:irq::@1/irq::@3->irq::@2#0] -- register_copy - //SEG83 irq::@2 - b2: - //SEG84 [53] *((const byte*) RASTER#0) ← (byte) irq_raster_next#3 -- _deref_pbuc1=vbuz1 + //SEG94 [62] (byte) irq_sprite_ptr#6 ← (byte) irq_sprite_ptr#2 + (byte/signed byte/word/signed word/dword/signed dword) 3 -- vbuz1=vbuz1_plus_vbuc1 + lda #3 + clc + adc irq_sprite_ptr + sta irq_sprite_ptr + //SEG95 [63] phi from irq::@5 irq::@7 to irq::@3 [phi:irq::@5/irq::@7->irq::@3] + //SEG96 [63] phi (byte) irq_raster_next#13 = (byte) irq_raster_next#6 [phi:irq::@5/irq::@7->irq::@3#0] -- register_copy + //SEG97 irq::@3 + b3: + //SEG98 [64] *((const byte*) RASTER#0) ← (byte) irq_raster_next#13 -- _deref_pbuc1=vbuz1 lda irq_raster_next sta RASTER - //SEG85 [54] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0 -- _deref_pbuc1=vbuc2 + //SEG99 [65] *((const byte*) IRQ_STATUS#0) ← (const byte) IRQ_RASTER#0 -- _deref_pbuc1=vbuc2 lda #IRQ_RASTER sta IRQ_STATUS - //SEG86 [55] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 + //SEG100 [66] *((const byte*) BORDERCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 lda #BLACK sta BORDERCOL - //SEG87 [56] *((const byte*) BGCOL#0) ← (const byte) BLUE#0 -- _deref_pbuc1=vbuc2 - lda #BLUE - sta BGCOL - //SEG88 irq::@return - //SEG89 [57] return - exit interrupt(KERNEL_MIN) + //SEG101 irq::@return + //SEG102 [67] return - exit interrupt(KERNEL_MIN) jmp $ea81 - //SEG90 irq::@1 - b1: - //SEG91 [58] (byte) irq_cnt#2 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 + //SEG103 irq::@2 + b2: + //SEG104 [68] (byte) irq_cnt#24 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 lda #0 sta irq_cnt - //SEG92 [59] (byte) irq_raster_next#1 ← (const byte) IRQ_RASTER_FIRST#0 -- vbuz1=vbuc1 + //SEG105 [69] (byte) irq_raster_next#20 ← (const byte) IRQ_RASTER_FIRST#0 -- vbuz1=vbuc1 lda #IRQ_RASTER_FIRST sta irq_raster_next - //SEG93 [60] (byte) irq_sprite_ypos#1 ← (byte/signed byte/word/signed word/dword/signed dword) 50 -- vbuz1=vbuc1 + //SEG106 [70] (byte) irq_sprite_ypos#26 ← (byte/signed byte/word/signed word/dword/signed dword) 50 -- vbuz1=vbuc1 lda #$32 sta irq_sprite_ypos - jmp b2 + //SEG107 [71] phi from irq::@2 to irq::toSpritePtr2 [phi:irq::@2->irq::toSpritePtr2] + //SEG108 irq::toSpritePtr2 + //SEG109 irq::@7 + //SEG110 [72] (byte) irq_sprite_ptr#5 ← (const byte) irq::toSpritePtr2_return#0 -- vbuz1=vbuc1 + lda #toSpritePtr2_return + sta irq_sprite_ptr + jmp b3 } .pc = PLAYFIELD_SPRITES "Inline" .var sprites = LoadPicture("nes-playfield.png", List().add($010101, $000000)) diff --git a/src/test/ref/examples/tetris/test-sprites.sym b/src/test/ref/examples/tetris/test-sprites.sym index 7ce77c52b..774f78414 100644 --- a/src/test/ref/examples/tetris/test-sprites.sym +++ b/src/test/ref/examples/tetris/test-sprites.sym @@ -1,9 +1,9 @@ (label) @6 (label) @8 +(label) @9 (label) @begin (label) @end (byte*) BGCOL -(const byte*) BGCOL#0 BGCOL = ((byte*))(word/dword/signed dword) 53281 (byte*) BGCOL1 (byte*) BGCOL2 (byte*) BGCOL3 @@ -11,7 +11,6 @@ (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 @@ -38,6 +37,7 @@ (byte*) D018 (const byte*) D018#0 D018 = ((byte*))(word/dword/signed dword) 53272 (byte) DARK_GREY +(const byte) DARK_GREY#0 DARK_GREY = (byte/signed byte/word/signed word/dword/signed dword) 11 (byte) GREEN (byte) GREY (void()**) HARDWARE_IRQ @@ -67,6 +67,8 @@ (const byte*) PLAYFIELD_SCREEN#0 PLAYFIELD_SCREEN = ((byte*))(word/signed word/dword/signed dword) 1024 (byte*) PLAYFIELD_SPRITES (const byte*) PLAYFIELD_SPRITES#0 PLAYFIELD_SPRITES = ((byte*))(word/signed word/dword/signed dword) 8192 +(byte*) PLAYFIELD_SPRITE_PTRS +(const byte*) PLAYFIELD_SPRITE_PTRS#0 PLAYFIELD_SPRITE_PTRS = (const byte*) PLAYFIELD_SCREEN#0+(const word) SPRITE_PTRS#0 (byte*) PROCPORT (byte) PROCPORT_BASIC_KERNEL_IO (byte*) PROCPORT_DDR @@ -111,24 +113,26 @@ (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 (void()) init_irq() +(label) init_irq::@1 (label) init_irq::@return +(label) init_irq::toSpritePtr2 +(word~) init_irq::toSpritePtr2_$0 +(word~) init_irq::toSpritePtr2_$1 +(byte~) init_irq::toSpritePtr2_$2 +(byte) init_irq::toSpritePtr2_return +(const byte) init_irq::toSpritePtr2_return#0 toSpritePtr2_return = ((byte))((word))(const byte*) PLAYFIELD_SPRITES#0>>(byte/signed byte/word/signed word/dword/signed dword) 6 +(byte*) init_irq::toSpritePtr2_sprite (void()) init_sprites() (label) init_sprites::@1 (label) init_sprites::@4 (label) init_sprites::@return -(byte) init_sprites::ptr -(byte) init_sprites::ptr#1 ptr zp ZP_BYTE:3 7.333333333333333 -(byte) init_sprites::ptr#2 ptr zp ZP_BYTE:3 4.714285714285714 (byte) init_sprites::s -(byte) init_sprites::s#1 reg byte y 16.5 -(byte) init_sprites::s#2 reg byte y 6.875 +(byte) init_sprites::s#1 reg byte x 16.5 +(byte) init_sprites::s#2 reg byte x 8.8 (byte) init_sprites::s2 -(byte) init_sprites::s2#0 reg byte x 16.5 -(byte*) init_sprites::sprites_ptr -(const byte*) init_sprites::sprites_ptr#0 sprites_ptr = (const byte*) PLAYFIELD_SCREEN#0+(const word) SPRITE_PTRS#0 +(byte) init_sprites::s2#0 reg byte a 22.0 (label) init_sprites::toD0181 (word~) init_sprites::toD0181_$0 (word~) init_sprites::toD0181_$1 @@ -143,13 +147,6 @@ (byte) init_sprites::toD0181_return (const byte) init_sprites::toD0181_return#0 toD0181_return = >((word))(const byte*) PLAYFIELD_SCREEN#0&(word/signed word/dword/signed dword) 16383<<(byte/signed byte/word/signed word/dword/signed dword) 2|>((word))(const byte*) PLAYFIELD_CHARSET#0>>(byte/signed byte/word/signed word/dword/signed dword) 2&(byte/signed byte/word/signed word/dword/signed dword) 15 (byte*) init_sprites::toD0181_screen -(label) init_sprites::toSpritePtr1 -(word~) init_sprites::toSpritePtr1_$0 -(word~) init_sprites::toSpritePtr1_$1 -(byte~) init_sprites::toSpritePtr1_$2 -(byte) init_sprites::toSpritePtr1_return -(const byte) init_sprites::toSpritePtr1_return#0 toSpritePtr1_return = ((byte))((word))(const byte*) PLAYFIELD_SPRITES#0>>(byte/signed byte/word/signed word/dword/signed dword) 6 -(byte*) init_sprites::toSpritePtr1_sprite (label) init_sprites::vicSelectGfxBank1 (byte~) init_sprites::vicSelectGfxBank1_$0 (label) init_sprites::vicSelectGfxBank1_@1 @@ -163,33 +160,62 @@ (byte) init_sprites::vicSelectGfxBank1_toDd001_return (const byte) init_sprites::vicSelectGfxBank1_toDd001_return#0 vicSelectGfxBank1_toDd001_return = (byte/signed byte/word/signed word/dword/signed dword) 3^>((word))(const byte*) PLAYFIELD_SCREEN#0>>(byte/signed byte/word/signed word/dword/signed dword) 6 (byte) init_sprites::xpos -(byte) init_sprites::xpos#1 xpos zp ZP_BYTE:2 5.5 -(byte) init_sprites::xpos#2 xpos zp ZP_BYTE:2 5.5 -(byte) init_sprites::ypos -(const byte) init_sprites::ypos#0 ypos = (byte/signed byte/word/signed word/dword/signed dword) 50 +(byte) init_sprites::xpos#1 xpos zp ZP_BYTE:2 7.333333333333333 +(byte) init_sprites::xpos#2 xpos zp ZP_BYTE:2 8.25 interrupt(KERNEL_MIN)(void()) irq() (label) irq::@1 (label) irq::@2 (label) irq::@3 +(label) irq::@4 +(label) irq::@5 +(label) irq::@7 (label) irq::@return +(byte) irq::ptr +(byte) irq::ptr#0 reg byte x 3.0 +(byte) irq::ptr#1 reg byte x 2.6666666666666665 +(byte) irq::ptr#2 reg byte x 4.0 +(label) irq::toSpritePtr2 +(word~) irq::toSpritePtr2_$0 +(word~) irq::toSpritePtr2_$1 +(byte~) irq::toSpritePtr2_$2 +(byte) irq::toSpritePtr2_return +(const byte) irq::toSpritePtr2_return#0 toSpritePtr2_return = ((byte))((word))(const byte*) PLAYFIELD_SPRITES#0>>(byte/signed byte/word/signed word/dword/signed dword) 6 +(byte*) irq::toSpritePtr2_sprite (byte) irq_cnt -(byte) irq_cnt#0 irq_cnt zp ZP_BYTE:2 0.6666666666666666 -(byte) irq_cnt#1 irq_cnt zp ZP_BYTE:2 4.0 -(byte) irq_cnt#2 irq_cnt zp ZP_BYTE:2 20.0 +(byte) irq_cnt#11 irq_cnt zp ZP_BYTE:2 20.0 +(byte) irq_cnt#19 irq_cnt zp ZP_BYTE:2 0.3076923076923077 +(byte) irq_cnt#23 irq_cnt zp ZP_BYTE:2 4.0 +(byte) irq_cnt#24 irq_cnt zp ZP_BYTE:2 20.0 (byte) irq_raster_next -(byte) irq_raster_next#0 irq_raster_next zp ZP_BYTE:2 0.5 -(byte) irq_raster_next#1 irq_raster_next zp ZP_BYTE:2 2.0 -(byte) irq_raster_next#2 irq_raster_next zp ZP_BYTE:2 2.0 -(byte) irq_raster_next#3 irq_raster_next zp ZP_BYTE:2 6.0 +(byte) irq_raster_next#11 irq_raster_next zp ZP_BYTE:2 20.0 +(byte) irq_raster_next#13 irq_raster_next zp ZP_BYTE:2 6.0 +(byte) irq_raster_next#2 irq_raster_next zp ZP_BYTE:2 0.26666666666666666 +(byte) irq_raster_next#20 irq_raster_next zp ZP_BYTE:2 1.0 +(byte) irq_raster_next#6 irq_raster_next zp ZP_BYTE:2 1.3333333333333333 +(byte) irq_sprite_ptr +(byte) irq_sprite_ptr#2 irq_sprite_ptr zp ZP_BYTE:2 0.3529411764705882 +(byte) irq_sprite_ptr#3 irq_sprite_ptr zp ZP_BYTE:2 20.0 +(byte) irq_sprite_ptr#5 irq_sprite_ptr zp ZP_BYTE:2 20.0 +(byte) irq_sprite_ptr#6 irq_sprite_ptr zp ZP_BYTE:2 20.0 (byte) irq_sprite_ypos -(byte) irq_sprite_ypos#0 irq_sprite_ypos zp ZP_BYTE:2 1.3333333333333335 -(byte) irq_sprite_ypos#1 irq_sprite_ypos zp ZP_BYTE:2 20.0 -(byte) irq_sprite_ypos#2 irq_sprite_ypos zp ZP_BYTE:2 20.0 +(byte) irq_sprite_ypos#11 irq_sprite_ypos zp ZP_BYTE:2 20.0 +(byte) irq_sprite_ypos#2 irq_sprite_ypos zp ZP_BYTE:2 1.4375 +(byte) irq_sprite_ypos#26 irq_sprite_ypos zp ZP_BYTE:2 20.0 +(byte) irq_sprite_ypos#6 irq_sprite_ypos zp ZP_BYTE:2 20.0 (void()) main() -(label) main::@1 -(label) main::@return +(label) main::@2 +(label) main::@7 +(label) toSpritePtr1 +(word~) toSpritePtr1_$0 +(word~) toSpritePtr1_$1 +(byte~) toSpritePtr1_$2 +(byte) toSpritePtr1_return +(const byte) toSpritePtr1_return#0 toSpritePtr1_return = ((byte))((word))(const byte*) PLAYFIELD_SPRITES#0>>(byte/signed byte/word/signed word/dword/signed dword) 6 +(byte*) toSpritePtr1_sprite -reg byte y [ init_sprites::s#2 init_sprites::s#1 ] -zp ZP_BYTE:2 [ init_sprites::xpos#2 init_sprites::xpos#1 irq_raster_next#3 irq_raster_next#1 irq_raster_next#2 irq_raster_next#0 irq_cnt#0 irq_cnt#1 irq_sprite_ypos#0 irq_sprite_ypos#2 irq_cnt#2 irq_sprite_ypos#1 ] -zp ZP_BYTE:3 [ init_sprites::ptr#2 init_sprites::ptr#1 ] -reg byte x [ init_sprites::s2#0 ] +reg byte x [ init_sprites::s#2 init_sprites::s#1 ] +zp ZP_BYTE:2 [ init_sprites::xpos#2 init_sprites::xpos#1 irq_raster_next#13 irq_raster_next#6 irq_raster_next#20 irq_raster_next#2 irq_sprite_ypos#2 irq_sprite_ypos#6 irq_sprite_ptr#2 irq_sprite_ptr#6 irq_cnt#19 irq_cnt#23 irq_raster_next#11 irq_sprite_ypos#11 irq_sprite_ptr#3 irq_cnt#11 irq_cnt#24 irq_sprite_ypos#26 irq_sprite_ptr#5 ] +reg byte a [ init_sprites::s2#0 ] +reg byte x [ irq::ptr#0 ] +reg byte x [ irq::ptr#1 ] +reg byte x [ irq::ptr#2 ] diff --git a/src/test/ref/init-volatiles.asm b/src/test/ref/init-volatiles.asm new file mode 100644 index 000000000..02b209205 --- /dev/null +++ b/src/test/ref/init-volatiles.asm @@ -0,0 +1,17 @@ +.pc = $801 "Basic" +:BasicUpstart(main) +.pc = $80d "Program" + .label x = 2 + lda #$c + sta x + jsr main +main: { + b1: + inc x + lda x + cmp #$32 + bcc b1 + lda #0 + sta x + rts +} diff --git a/src/test/ref/init-volatiles.cfg b/src/test/ref/init-volatiles.cfg new file mode 100644 index 000000000..da4d97851 --- /dev/null +++ b/src/test/ref/init-volatiles.cfg @@ -0,0 +1,23 @@ +@begin: scope:[] from + [0] (byte) x#0 ← (byte/signed byte/word/signed word/dword/signed dword) 12 + to:@1 +@1: scope:[] from @begin + [1] phi() + [2] call main + to:@end +@end: scope:[] from @1 + [3] phi() +main: scope:[main] from @1 + [4] phi() + to:main::@1 +main::@1: scope:[main] from main main::@1 + [5] (byte) x#5 ← phi( main/(byte) x#0 main::@1/(byte) x#1 ) + [6] (byte) x#1 ← ++ (byte) x#5 + [7] if((byte) x#1<(byte/signed byte/word/signed word/dword/signed dword) 50) goto main::@1 + to:main::@3 +main::@3: scope:[main] from main::@1 + [8] (byte) x#2 ← (byte/signed byte/word/signed word/dword/signed dword) 0 + to:main::@return +main::@return: scope:[main] from main::@3 + [9] return + to:@return diff --git a/src/test/ref/init-volatiles.log b/src/test/ref/init-volatiles.log new file mode 100644 index 000000000..e17d73dbc --- /dev/null +++ b/src/test/ref/init-volatiles.log @@ -0,0 +1,337 @@ + +CONTROL FLOW GRAPH SSA +@begin: scope:[] from + (byte) x#0 ← (byte/signed byte/word/signed word/dword/signed dword) 12 + to:@1 +main: scope:[main] from @1 + (byte) x#8 ← phi( @1/(byte) x#10 ) + to:main::@1 +main::@1: scope:[main] from main main::@2 + (byte) x#5 ← phi( main/(byte) x#8 main::@2/(byte) x#9 ) + (byte) x#1 ← ++ (byte) x#5 + (bool~) main::$0 ← (byte) x#1 < (byte/signed byte/word/signed word/dword/signed dword) 50 + if((bool~) main::$0) goto main::@2 + to:main::@3 +main::@2: scope:[main] from main::@1 + (byte) x#9 ← phi( main::@1/(byte) x#1 ) + to:main::@1 +main::@3: scope:[main] from main::@1 + (byte) x#2 ← (byte/signed byte/word/signed word/dword/signed dword) 0 + to:main::@return +main::@return: scope:[main] from main::@3 + (byte) x#6 ← phi( main::@3/(byte) x#2 ) + (byte) x#3 ← (byte) x#6 + return + to:@return +@1: scope:[] from @begin + (byte) x#10 ← phi( @begin/(byte) x#0 ) + call main + to:@2 +@2: scope:[] from @1 + (byte) x#7 ← phi( @1/(byte) x#3 ) + (byte) x#4 ← (byte) x#7 + to:@end +@end: scope:[] from @2 + +SYMBOL TABLE SSA +(label) @1 +(label) @2 +(label) @begin +(label) @end +(void()) main() +(bool~) main::$0 +(label) main::@1 +(label) main::@2 +(label) main::@3 +(label) main::@return +(byte) x +(byte) x#0 +(byte) x#1 +(byte) x#10 +(byte) x#2 +(byte) x#3 +(byte) x#4 +(byte) x#5 +(byte) x#6 +(byte) x#7 +(byte) x#8 +(byte) x#9 + +Alias (byte) x#1 = (byte) x#9 +Alias (byte) x#2 = (byte) x#6 (byte) x#3 +Alias (byte) x#0 = (byte) x#10 +Alias (byte) x#4 = (byte) x#7 +Successful SSA optimization Pass2AliasElimination +Redundant Phi (byte) x#8 (byte) x#0 +Redundant Phi (byte) x#4 (byte) x#2 +Successful SSA optimization Pass2RedundantPhiElimination +Simple Condition (bool~) main::$0 if((byte) x#1<(byte/signed byte/word/signed word/dword/signed dword) 50) goto main::@2 +Successful SSA optimization Pass2ConditionalJumpSimplification +Culled Empty Block (label) main::@2 +Culled Empty Block (label) @2 +Successful SSA optimization Pass2CullEmptyBlocks +Added new block during phi lifting main::@7(between main::@1 and main::@1) +Adding NOP phi() at start of @1 +Adding NOP phi() at start of @end +CALL GRAPH +Calls in [] to main:2 + +Created 1 initial phi equivalence classes +Coalesced [4] x#11 ← x#0 +Coalesced [10] x#12 ← x#1 +Coalesced down to 1 phi equivalence classes +Culled Empty Block (label) main::@7 +Adding NOP phi() at start of @1 +Adding NOP phi() at start of @end +Adding NOP phi() at start of main + +FINAL CONTROL FLOW GRAPH +@begin: scope:[] from + [0] (byte) x#0 ← (byte/signed byte/word/signed word/dword/signed dword) 12 + to:@1 +@1: scope:[] from @begin + [1] phi() + [2] call main + to:@end +@end: scope:[] from @1 + [3] phi() +main: scope:[main] from @1 + [4] phi() + to:main::@1 +main::@1: scope:[main] from main main::@1 + [5] (byte) x#5 ← phi( main/(byte) x#0 main::@1/(byte) x#1 ) + [6] (byte) x#1 ← ++ (byte) x#5 + [7] if((byte) x#1<(byte/signed byte/word/signed word/dword/signed dword) 50) goto main::@1 + to:main::@3 +main::@3: scope:[main] from main::@1 + [8] (byte) x#2 ← (byte/signed byte/word/signed word/dword/signed dword) 0 + to:main::@return +main::@return: scope:[main] from main::@3 + [9] return + to:@return + + +VARIABLE REGISTER WEIGHTS +(void()) main() +(byte) x +(byte) x#0 1.3333333333333333 +(byte) x#1 16.5 +(byte) x#2 20.0 +(byte) x#5 24.0 + +Initial phi equivalence classes +[ x#5 x#0 x#1 ] +Added variable x#2 to zero page equivalence class [ x#2 ] +Complete equivalence classes +[ x#5 x#0 x#1 ] +[ x#2 ] +Allocated zp ZP_BYTE:2 [ x#5 x#0 x#1 ] +Allocated zp ZP_BYTE:3 [ x#2 ] + +INITIAL ASM +//SEG0 Basic Upstart +.pc = $801 "Basic" +:BasicUpstart(main) +.pc = $80d "Program" +//SEG1 Global Constants & labels + .label x = 2 + .label x_2 = 3 +//SEG2 @begin +bbegin: +//SEG3 [0] (byte) x#0 ← (byte/signed byte/word/signed word/dword/signed dword) 12 -- vbuz1=vbuc1 + lda #$c + sta x +//SEG4 [1] phi from @begin to @1 [phi:@begin->@1] +b1_from_bbegin: + jmp b1 +//SEG5 @1 +b1: +//SEG6 [2] call main +//SEG7 [4] phi from @1 to main [phi:@1->main] +main_from_b1: + jsr main +//SEG8 [3] phi from @1 to @end [phi:@1->@end] +bend_from_b1: + jmp bend +//SEG9 @end +bend: +//SEG10 main +main: { + //SEG11 [5] phi from main main::@1 to main::@1 [phi:main/main::@1->main::@1] + b1_from_main: + b1_from_b1: + //SEG12 [5] phi (byte) x#5 = (byte) x#0 [phi:main/main::@1->main::@1#0] -- register_copy + jmp b1 + //SEG13 main::@1 + b1: + //SEG14 [6] (byte) x#1 ← ++ (byte) x#5 -- vbuz1=_inc_vbuz1 + inc x + //SEG15 [7] if((byte) x#1<(byte/signed byte/word/signed word/dword/signed dword) 50) goto main::@1 -- vbuz1_lt_vbuc1_then_la1 + lda x + cmp #$32 + bcc b1_from_b1 + jmp b3 + //SEG16 main::@3 + b3: + //SEG17 [8] (byte) x#2 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 + lda #0 + sta x_2 + jmp breturn + //SEG18 main::@return + breturn: + //SEG19 [9] return + rts +} + +REGISTER UPLIFT POTENTIAL REGISTERS +Statement [0] (byte) x#0 ← (byte/signed byte/word/signed word/dword/signed dword) 12 [ x#0 ] ( ) always clobbers reg byte a +Statement [7] if((byte) x#1<(byte/signed byte/word/signed word/dword/signed dword) 50) goto main::@1 [ x#1 ] ( main:2 [ x#1 ] ) always clobbers reg byte a +Statement [8] (byte) x#2 ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( main:2 [ ] ) always clobbers reg byte a +Potential registers zp ZP_BYTE:2 [ x#5 x#0 x#1 ] : zp ZP_BYTE:2 , +Potential registers zp ZP_BYTE:3 [ x#2 ] : zp ZP_BYTE:3 , + +REGISTER UPLIFT SCOPES +Uplift Scope [] 41.83: zp ZP_BYTE:2 [ x#5 x#0 x#1 ] 20: zp ZP_BYTE:3 [ x#2 ] +Uplift Scope [main] + +Uplifting [] best 216 combination zp ZP_BYTE:2 [ x#5 x#0 x#1 ] zp ZP_BYTE:3 [ x#2 ] +Uplifting [main] best 216 combination +Attempting to uplift remaining variables inzp ZP_BYTE:2 [ x#5 x#0 x#1 ] +Uplifting [] best 216 combination zp ZP_BYTE:2 [ x#5 x#0 x#1 ] +Attempting to uplift remaining variables inzp ZP_BYTE:3 [ x#2 ] +Uplifting [] best 216 combination zp ZP_BYTE:3 [ x#2 ] +Coalescing zero page register [ zp ZP_BYTE:2 [ x#5 x#0 x#1 ] ] with [ zp ZP_BYTE:3 [ x#2 ] ] + +ASSEMBLER BEFORE OPTIMIZATION +//SEG0 Basic Upstart +.pc = $801 "Basic" +:BasicUpstart(main) +.pc = $80d "Program" +//SEG1 Global Constants & labels + .label x = 2 +//SEG2 @begin +bbegin: +//SEG3 [0] (byte) x#0 ← (byte/signed byte/word/signed word/dword/signed dword) 12 -- vbuz1=vbuc1 + lda #$c + sta x +//SEG4 [1] phi from @begin to @1 [phi:@begin->@1] +b1_from_bbegin: + jmp b1 +//SEG5 @1 +b1: +//SEG6 [2] call main +//SEG7 [4] phi from @1 to main [phi:@1->main] +main_from_b1: + jsr main +//SEG8 [3] phi from @1 to @end [phi:@1->@end] +bend_from_b1: + jmp bend +//SEG9 @end +bend: +//SEG10 main +main: { + //SEG11 [5] phi from main main::@1 to main::@1 [phi:main/main::@1->main::@1] + b1_from_main: + b1_from_b1: + //SEG12 [5] phi (byte) x#5 = (byte) x#0 [phi:main/main::@1->main::@1#0] -- register_copy + jmp b1 + //SEG13 main::@1 + b1: + //SEG14 [6] (byte) x#1 ← ++ (byte) x#5 -- vbuz1=_inc_vbuz1 + inc x + //SEG15 [7] if((byte) x#1<(byte/signed byte/word/signed word/dword/signed dword) 50) goto main::@1 -- vbuz1_lt_vbuc1_then_la1 + lda x + cmp #$32 + bcc b1_from_b1 + jmp b3 + //SEG16 main::@3 + b3: + //SEG17 [8] (byte) x#2 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 + lda #0 + sta x + jmp breturn + //SEG18 main::@return + breturn: + //SEG19 [9] return + rts +} + +ASSEMBLER OPTIMIZATIONS +Removing instruction jmp b1 +Removing instruction jmp bend +Removing instruction jmp b1 +Removing instruction jmp b3 +Removing instruction jmp breturn +Succesful ASM optimization Pass5NextJumpElimination +Replacing label b1_from_b1 with b1 +Removing instruction b1_from_bbegin: +Removing instruction main_from_b1: +Removing instruction bend_from_b1: +Removing instruction b1_from_main: +Removing instruction b1_from_b1: +Succesful ASM optimization Pass5RedundantLabelElimination +Removing instruction bbegin: +Removing instruction b1: +Removing instruction bend: +Removing instruction b3: +Removing instruction breturn: +Succesful ASM optimization Pass5UnusedLabelElimination + +FINAL SYMBOL TABLE +(label) @1 +(label) @begin +(label) @end +(void()) main() +(label) main::@1 +(label) main::@3 +(label) main::@return +(byte) x +(byte) x#0 x zp ZP_BYTE:2 1.3333333333333333 +(byte) x#1 x zp ZP_BYTE:2 16.5 +(byte) x#2 x zp ZP_BYTE:2 20.0 +(byte) x#5 x zp ZP_BYTE:2 24.0 + +zp ZP_BYTE:2 [ x#5 x#0 x#1 x#2 ] + + +FINAL ASSEMBLER +Score: 147 + +//SEG0 Basic Upstart +.pc = $801 "Basic" +:BasicUpstart(main) +.pc = $80d "Program" +//SEG1 Global Constants & labels + .label x = 2 +//SEG2 @begin +//SEG3 [0] (byte) x#0 ← (byte/signed byte/word/signed word/dword/signed dword) 12 -- vbuz1=vbuc1 + lda #$c + sta x +//SEG4 [1] phi from @begin to @1 [phi:@begin->@1] +//SEG5 @1 +//SEG6 [2] call main +//SEG7 [4] phi from @1 to main [phi:@1->main] + jsr main +//SEG8 [3] phi from @1 to @end [phi:@1->@end] +//SEG9 @end +//SEG10 main +main: { + //SEG11 [5] phi from main main::@1 to main::@1 [phi:main/main::@1->main::@1] + //SEG12 [5] phi (byte) x#5 = (byte) x#0 [phi:main/main::@1->main::@1#0] -- register_copy + //SEG13 main::@1 + b1: + //SEG14 [6] (byte) x#1 ← ++ (byte) x#5 -- vbuz1=_inc_vbuz1 + inc x + //SEG15 [7] if((byte) x#1<(byte/signed byte/word/signed word/dword/signed dword) 50) goto main::@1 -- vbuz1_lt_vbuc1_then_la1 + lda x + cmp #$32 + bcc b1 + //SEG16 main::@3 + //SEG17 [8] (byte) x#2 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 + lda #0 + sta x + //SEG18 main::@return + //SEG19 [9] return + rts +} + diff --git a/src/test/ref/init-volatiles.sym b/src/test/ref/init-volatiles.sym new file mode 100644 index 000000000..debb64d69 --- /dev/null +++ b/src/test/ref/init-volatiles.sym @@ -0,0 +1,14 @@ +(label) @1 +(label) @begin +(label) @end +(void()) main() +(label) main::@1 +(label) main::@3 +(label) main::@return +(byte) x +(byte) x#0 x zp ZP_BYTE:2 1.3333333333333333 +(byte) x#1 x zp ZP_BYTE:2 16.5 +(byte) x#2 x zp ZP_BYTE:2 20.0 +(byte) x#5 x zp ZP_BYTE:2 24.0 + +zp ZP_BYTE:2 [ x#5 x#0 x#1 x#2 ] diff --git a/src/test/ref/interrupt-volatile-reuse-problem.asm b/src/test/ref/interrupt-volatile-reuse-problem.asm new file mode 100644 index 000000000..357bfdaca --- /dev/null +++ b/src/test/ref/interrupt-volatile-reuse-problem.asm @@ -0,0 +1,53 @@ +.pc = $801 "Basic" +:BasicUpstart(main) +.pc = $80d "Program" + .label KERNEL_IRQ = $314 + .label BORDERCOL = $d021 + .label BGCOL = $d020 + .label col1 = 2 + .label col2 = 2 + lda #0 + sta col1 + lda #8 + sta col2 + jsr main +main: { + .label SCREEN = $400 + .label row = 2 + .label asd = 3 + lda #0 + sta asd + ldx #$20 + tay + lda #$c + sta row + b1: + inc row + lda row + sta SCREEN,y + inx + txa + clc + adc asd + sta asd + iny + cpy #$b + bne b1 + stx SCREEN + sta SCREEN+1 + lda #irq + sta KERNEL_IRQ+1 + rts +} +irq: { + lda $dc0d + lda col1 + sta BGCOL + inc col1 + lda col2 + sta BORDERCOL + inc col2 + jmp $ea81 +} diff --git a/src/test/ref/interrupt-volatile-reuse-problem.cfg b/src/test/ref/interrupt-volatile-reuse-problem.cfg new file mode 100644 index 000000000..8b3b76c80 --- /dev/null +++ b/src/test/ref/interrupt-volatile-reuse-problem.cfg @@ -0,0 +1,43 @@ +@begin: scope:[] from + [0] (byte) col1#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 + [1] (byte) col2#0 ← (byte/signed byte/word/signed word/dword/signed dword) 8 + to:@2 +@2: scope:[] from @begin + [2] phi() + [3] call main + to:@end +@end: scope:[] from @2 + [4] phi() +main: scope:[main] from @2 + [5] phi() + to:main::@1 +main::@1: scope:[main] from main main::@1 + [6] (byte) main::asd#2 ← phi( main/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@1/(byte) main::asd#1 ) + [6] (byte) main::qwe#2 ← phi( main/(byte/signed byte/word/signed word/dword/signed dword) 32 main::@1/(byte) main::qwe#1 ) + [6] (byte) main::x#2 ← phi( main/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@1/(byte) main::x#1 ) + [6] (byte) main::row#2 ← phi( main/(byte/signed byte/word/signed word/dword/signed dword) 12 main::@1/(byte) main::row#1 ) + [7] (byte) main::row#1 ← ++ (byte) main::row#2 + [8] *((const byte*) main::SCREEN#0 + (byte) main::x#2) ← (byte) main::row#1 + [9] (byte) main::qwe#1 ← ++ (byte) main::qwe#2 + [10] (byte) main::asd#1 ← (byte) main::asd#2 + (byte) main::qwe#1 + [11] (byte) main::x#1 ← ++ (byte) main::x#2 + [12] if((byte) main::x#1!=(byte/signed byte/word/signed word/dword/signed dword) 11) goto main::@1 + to:main::@2 +main::@2: scope:[main] from main::@1 + [13] *((const byte*) main::SCREEN#0) ← (byte) main::qwe#1 + [14] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) main::asd#1 + [15] *((const void()**) KERNEL_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq() + to:main::@return +main::@return: scope:[main] from main::@2 + [16] return + to:@return +irq: scope:[irq] from + asm { lda$dc0d } + [18] *((const byte*) BGCOL#0) ← (byte) col1#0 + [19] (byte) col1#1 ← ++ (byte) col1#0 + [20] *((const byte*) BORDERCOL#0) ← (byte) col2#0 + [21] (byte) col2#1 ← ++ (byte) col2#0 + to:irq::@return +irq::@return: scope:[irq] from irq + [22] return + to:@return diff --git a/src/test/ref/interrupt-volatile-reuse-problem.log b/src/test/ref/interrupt-volatile-reuse-problem.log new file mode 100644 index 000000000..d144f050d --- /dev/null +++ b/src/test/ref/interrupt-volatile-reuse-problem.log @@ -0,0 +1,775 @@ +Resolved forward reference irq to interrupt(KERNEL_MIN)(void()) irq() + +CONTROL FLOW GRAPH SSA +@begin: scope:[] from + (void()**) KERNEL_IRQ#0 ← ((void()**)) (word/signed word/dword/signed dword) 788 + (byte*) BORDERCOL#0 ← ((byte*)) (word/dword/signed dword) 53281 + (byte*) BGCOL#0 ← ((byte*)) (word/dword/signed dword) 53280 + (byte) col1#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 + (byte) col2#0 ← (byte/signed byte/word/signed word/dword/signed dword) 8 + to:@2 +main: scope:[main] from @2 + (byte*) main::SCREEN#0 ← ((byte*)) (word/signed word/dword/signed dword) 1024 + (byte) main::qwe#0 ← (byte/signed byte/word/signed word/dword/signed dword) 32 + (byte) main::asd#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 + (byte) main::row#0 ← (byte/signed byte/word/signed word/dword/signed dword) 12 + (byte) main::x#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 + to:main::@1 +main::@1: scope:[main] from main main::@1 + (byte) main::asd#2 ← phi( main/(byte) main::asd#0 main::@1/(byte) main::asd#1 ) + (byte) main::qwe#2 ← phi( main/(byte) main::qwe#0 main::@1/(byte) main::qwe#1 ) + (byte) main::x#2 ← phi( main/(byte) main::x#0 main::@1/(byte) main::x#1 ) + (byte*) main::SCREEN#1 ← phi( main/(byte*) main::SCREEN#0 main::@1/(byte*) main::SCREEN#1 ) + (byte) main::row#2 ← phi( main/(byte) main::row#0 main::@1/(byte) main::row#1 ) + (byte) main::row#1 ← ++ (byte) main::row#2 + *((byte*) main::SCREEN#1 + (byte) main::x#2) ← (byte) main::row#1 + (byte) main::qwe#1 ← ++ (byte) main::qwe#2 + (byte) main::asd#1 ← (byte) main::asd#2 + (byte) main::qwe#1 + (byte) main::x#1 ← (byte) main::x#2 + rangenext(0,10) + (bool~) main::$0 ← (byte) main::x#1 != rangelast(0,10) + if((bool~) main::$0) goto main::@1 + to:main::@2 +main::@2: scope:[main] from main::@1 + (byte) main::asd#3 ← phi( main::@1/(byte) main::asd#1 ) + (byte*) main::SCREEN#2 ← phi( main::@1/(byte*) main::SCREEN#1 ) + (byte) main::qwe#3 ← phi( main::@1/(byte) main::qwe#1 ) + *((byte*) main::SCREEN#2 + (byte/signed byte/word/signed word/dword/signed dword) 0) ← (byte) main::qwe#3 + *((byte*) main::SCREEN#2 + (byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) main::asd#3 + (void()*~) main::$1 ← & interrupt(KERNEL_MIN)(void()) irq() + *((void()**) KERNEL_IRQ#0) ← (void()*~) main::$1 + to:main::@return +main::@return: scope:[main] from main::@2 + return + to:@return +irq: scope:[irq] from + (byte) col2#3 ← phi( @2/(byte) col2#5 ) + (byte) col1#3 ← phi( @2/(byte) col1#5 ) + asm { lda$dc0d } + *((byte*) BGCOL#0) ← (byte) col1#3 + (byte) col1#1 ← ++ (byte) col1#3 + *((byte*) BORDERCOL#0) ← (byte) col2#3 + (byte) col2#1 ← ++ (byte) col2#3 + to:irq::@return +irq::@return: scope:[irq] from irq + (byte) col2#4 ← phi( irq/(byte) col2#1 ) + (byte) col1#4 ← phi( irq/(byte) col1#1 ) + (byte) col1#2 ← (byte) col1#4 + (byte) col2#2 ← (byte) col2#4 + return + to:@return +@2: scope:[] from @begin + (byte) col2#5 ← phi( @begin/(byte) col2#0 ) + (byte) col1#5 ← phi( @begin/(byte) col1#0 ) + call main + to:@3 +@3: scope:[] from @2 + to:@end +@end: scope:[] from @3 + +SYMBOL TABLE SSA +(label) @2 +(label) @3 +(label) @begin +(label) @end +(byte*) BGCOL +(byte*) BGCOL#0 +(byte*) BORDERCOL +(byte*) BORDERCOL#0 +(void()**) KERNEL_IRQ +(void()**) KERNEL_IRQ#0 +(byte) col1 +(byte) col1#0 +(byte) col1#1 +(byte) col1#2 +(byte) col1#3 +(byte) col1#4 +(byte) col1#5 +(byte) col2 +(byte) col2#0 +(byte) col2#1 +(byte) col2#2 +(byte) col2#3 +(byte) col2#4 +(byte) col2#5 +interrupt(KERNEL_MIN)(void()) irq() +(label) irq::@return +(void()) main() +(bool~) main::$0 +(void()*~) main::$1 +(label) main::@1 +(label) main::@2 +(label) main::@return +(byte*) main::SCREEN +(byte*) main::SCREEN#0 +(byte*) main::SCREEN#1 +(byte*) main::SCREEN#2 +(byte) main::asd +(byte) main::asd#0 +(byte) main::asd#1 +(byte) main::asd#2 +(byte) main::asd#3 +(byte) main::qwe +(byte) main::qwe#0 +(byte) main::qwe#1 +(byte) main::qwe#2 +(byte) main::qwe#3 +(byte) main::row +(byte) main::row#0 +(byte) main::row#1 +(byte) main::row#2 +(byte) main::x +(byte) main::x#0 +(byte) main::x#1 +(byte) main::x#2 + +Culled Empty Block (label) @3 +Successful SSA optimization Pass2CullEmptyBlocks +Alias (byte) main::qwe#1 = (byte) main::qwe#3 +Alias (byte*) main::SCREEN#1 = (byte*) main::SCREEN#2 +Alias (byte) main::asd#1 = (byte) main::asd#3 +Alias (byte) col1#1 = (byte) col1#4 (byte) col1#2 +Alias (byte) col2#1 = (byte) col2#4 (byte) col2#2 +Alias (byte) col1#0 = (byte) col1#5 +Alias (byte) col2#0 = (byte) col2#5 +Successful SSA optimization Pass2AliasElimination +Self Phi Eliminated (byte*) main::SCREEN#1 +Successful SSA optimization Pass2SelfPhiElimination +Redundant Phi (byte*) main::SCREEN#1 (byte*) main::SCREEN#0 +Redundant Phi (byte) col1#3 (byte) col1#0 +Redundant Phi (byte) col2#3 (byte) col2#0 +Successful SSA optimization Pass2RedundantPhiElimination +Simple Condition (bool~) main::$0 if((byte) main::x#1!=rangelast(0,10)) goto main::@1 +Successful SSA optimization Pass2ConditionalJumpSimplification +Constant (const void()**) KERNEL_IRQ#0 = ((void()**))788 +Constant (const byte*) BORDERCOL#0 = ((byte*))53281 +Constant (const byte*) BGCOL#0 = ((byte*))53280 +Constant (const byte*) main::SCREEN#0 = ((byte*))1024 +Constant (const byte) main::qwe#0 = 32 +Constant (const byte) main::asd#0 = 0 +Constant (const byte) main::row#0 = 12 +Constant (const byte) main::x#0 = 0 +Constant (const void()*) main::$1 = &irq +Successful SSA optimization Pass2ConstantIdentification +Consolidated array index constant in *(main::SCREEN#0+0) +Consolidated array index constant in *(main::SCREEN#0+1) +Successful SSA optimization Pass2ConstantAdditionElimination +Resolved ranged next value main::x#1 ← ++ main::x#2 to ++ +Resolved ranged comparison value if(main::x#1!=rangelast(0,10)) goto main::@1 to (byte/signed byte/word/signed word/dword/signed dword) 11 +Inlining constant with var siblings (const byte) main::qwe#0 +Inlining constant with var siblings (const byte) main::asd#0 +Inlining constant with var siblings (const byte) main::row#0 +Inlining constant with var siblings (const byte) main::x#0 +Constant inlined main::qwe#0 = (byte/signed byte/word/signed word/dword/signed dword) 32 +Constant inlined main::x#0 = (byte/signed byte/word/signed word/dword/signed dword) 0 +Constant inlined main::asd#0 = (byte/signed byte/word/signed word/dword/signed dword) 0 +Constant inlined main::$1 = &interrupt(KERNEL_MIN)(void()) irq() +Constant inlined main::row#0 = (byte/signed byte/word/signed word/dword/signed dword) 12 +Successful SSA optimization Pass2ConstantInlining +Simplifying constant plus zero main::SCREEN#0+0 +Added new block during phi lifting main::@3(between main::@1 and main::@1) +Adding NOP phi() at start of @2 +Adding NOP phi() at start of @end +Adding NOP phi() at start of main +CALL GRAPH +Calls in [] to main:3 + +Created 4 initial phi equivalence classes +Coalesced [17] main::row#3 ← main::row#1 +Coalesced [18] main::x#3 ← main::x#1 +Coalesced [19] main::qwe#4 ← main::qwe#1 +Coalesced [20] main::asd#4 ← main::asd#1 +Coalesced down to 4 phi equivalence classes +Culled Empty Block (label) main::@3 +Adding NOP phi() at start of @2 +Adding NOP phi() at start of @end +Adding NOP phi() at start of main + +FINAL CONTROL FLOW GRAPH +@begin: scope:[] from + [0] (byte) col1#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 + [1] (byte) col2#0 ← (byte/signed byte/word/signed word/dword/signed dword) 8 + to:@2 +@2: scope:[] from @begin + [2] phi() + [3] call main + to:@end +@end: scope:[] from @2 + [4] phi() +main: scope:[main] from @2 + [5] phi() + to:main::@1 +main::@1: scope:[main] from main main::@1 + [6] (byte) main::asd#2 ← phi( main/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@1/(byte) main::asd#1 ) + [6] (byte) main::qwe#2 ← phi( main/(byte/signed byte/word/signed word/dword/signed dword) 32 main::@1/(byte) main::qwe#1 ) + [6] (byte) main::x#2 ← phi( main/(byte/signed byte/word/signed word/dword/signed dword) 0 main::@1/(byte) main::x#1 ) + [6] (byte) main::row#2 ← phi( main/(byte/signed byte/word/signed word/dword/signed dword) 12 main::@1/(byte) main::row#1 ) + [7] (byte) main::row#1 ← ++ (byte) main::row#2 + [8] *((const byte*) main::SCREEN#0 + (byte) main::x#2) ← (byte) main::row#1 + [9] (byte) main::qwe#1 ← ++ (byte) main::qwe#2 + [10] (byte) main::asd#1 ← (byte) main::asd#2 + (byte) main::qwe#1 + [11] (byte) main::x#1 ← ++ (byte) main::x#2 + [12] if((byte) main::x#1!=(byte/signed byte/word/signed word/dword/signed dword) 11) goto main::@1 + to:main::@2 +main::@2: scope:[main] from main::@1 + [13] *((const byte*) main::SCREEN#0) ← (byte) main::qwe#1 + [14] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) main::asd#1 + [15] *((const void()**) KERNEL_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq() + to:main::@return +main::@return: scope:[main] from main::@2 + [16] return + to:@return +irq: scope:[irq] from + asm { lda$dc0d } + [18] *((const byte*) BGCOL#0) ← (byte) col1#0 + [19] (byte) col1#1 ← ++ (byte) col1#0 + [20] *((const byte*) BORDERCOL#0) ← (byte) col2#0 + [21] (byte) col2#1 ← ++ (byte) col2#0 + to:irq::@return +irq::@return: scope:[irq] from irq + [22] return + to:@return + + +VARIABLE REGISTER WEIGHTS +(byte*) BGCOL +(byte*) BORDERCOL +(void()**) KERNEL_IRQ +(byte) col1 +(byte) col1#0 3.0 +(byte) col1#1 20.0 +(byte) col2 +(byte) col2#0 1.5 +(byte) col2#1 20.0 +interrupt(KERNEL_MIN)(void()) irq() +(void()) main() +(byte*) main::SCREEN +(byte) main::asd +(byte) main::asd#1 6.0 +(byte) main::asd#2 5.5 +(byte) main::qwe +(byte) main::qwe#1 8.75 +(byte) main::qwe#2 7.333333333333333 +(byte) main::row +(byte) main::row#1 5.5 +(byte) main::row#2 22.0 +(byte) main::x +(byte) main::x#1 16.5 +(byte) main::x#2 6.6000000000000005 + +Initial phi equivalence classes +[ main::row#2 main::row#1 ] +[ main::x#2 main::x#1 ] +[ main::qwe#2 main::qwe#1 ] +[ main::asd#2 main::asd#1 ] +Added variable col1#0 to zero page equivalence class [ col1#0 ] +Added variable col2#0 to zero page equivalence class [ col2#0 ] +Added variable col1#1 to zero page equivalence class [ col1#1 ] +Added variable col2#1 to zero page equivalence class [ col2#1 ] +Complete equivalence classes +[ main::row#2 main::row#1 ] +[ main::x#2 main::x#1 ] +[ main::qwe#2 main::qwe#1 ] +[ main::asd#2 main::asd#1 ] +[ col1#0 ] +[ col2#0 ] +[ col1#1 ] +[ col2#1 ] +Allocated zp ZP_BYTE:2 [ main::row#2 main::row#1 ] +Allocated zp ZP_BYTE:3 [ main::x#2 main::x#1 ] +Allocated zp ZP_BYTE:4 [ main::qwe#2 main::qwe#1 ] +Allocated zp ZP_BYTE:5 [ main::asd#2 main::asd#1 ] +Allocated zp ZP_BYTE:6 [ col1#0 ] +Allocated zp ZP_BYTE:7 [ col2#0 ] +Allocated zp ZP_BYTE:8 [ col1#1 ] +Allocated zp ZP_BYTE:9 [ col2#1 ] + +INITIAL ASM +//SEG0 Basic Upstart +.pc = $801 "Basic" +:BasicUpstart(main) +.pc = $80d "Program" +//SEG1 Global Constants & labels + .label KERNEL_IRQ = $314 + .label BORDERCOL = $d021 + .label BGCOL = $d020 + .label col1 = 6 + .label col2 = 7 + .label col1_1 = 8 + .label col2_1 = 9 +//SEG2 @begin +bbegin: +//SEG3 [0] (byte) col1#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 + lda #0 + sta col1 +//SEG4 [1] (byte) col2#0 ← (byte/signed byte/word/signed word/dword/signed dword) 8 -- vbuz1=vbuc1 + lda #8 + sta col2 +//SEG5 [2] phi from @begin to @2 [phi:@begin->@2] +b2_from_bbegin: + jmp b2 +//SEG6 @2 +b2: +//SEG7 [3] call main +//SEG8 [5] phi from @2 to main [phi:@2->main] +main_from_b2: + jsr main +//SEG9 [4] phi from @2 to @end [phi:@2->@end] +bend_from_b2: + jmp bend +//SEG10 @end +bend: +//SEG11 main +main: { + .label SCREEN = $400 + .label row = 2 + .label qwe = 4 + .label asd = 5 + .label x = 3 + //SEG12 [6] phi from main to main::@1 [phi:main->main::@1] + b1_from_main: + //SEG13 [6] phi (byte) main::asd#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1 + lda #0 + sta asd + //SEG14 [6] phi (byte) main::qwe#2 = (byte/signed byte/word/signed word/dword/signed dword) 32 [phi:main->main::@1#1] -- vbuz1=vbuc1 + lda #$20 + sta qwe + //SEG15 [6] phi (byte) main::x#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#2] -- vbuz1=vbuc1 + lda #0 + sta x + //SEG16 [6] phi (byte) main::row#2 = (byte/signed byte/word/signed word/dword/signed dword) 12 [phi:main->main::@1#3] -- vbuz1=vbuc1 + lda #$c + sta row + jmp b1 + //SEG17 [6] phi from main::@1 to main::@1 [phi:main::@1->main::@1] + b1_from_b1: + //SEG18 [6] phi (byte) main::asd#2 = (byte) main::asd#1 [phi:main::@1->main::@1#0] -- register_copy + //SEG19 [6] phi (byte) main::qwe#2 = (byte) main::qwe#1 [phi:main::@1->main::@1#1] -- register_copy + //SEG20 [6] phi (byte) main::x#2 = (byte) main::x#1 [phi:main::@1->main::@1#2] -- register_copy + //SEG21 [6] phi (byte) main::row#2 = (byte) main::row#1 [phi:main::@1->main::@1#3] -- register_copy + jmp b1 + //SEG22 main::@1 + b1: + //SEG23 [7] (byte) main::row#1 ← ++ (byte) main::row#2 -- vbuz1=_inc_vbuz1 + inc row + //SEG24 [8] *((const byte*) main::SCREEN#0 + (byte) main::x#2) ← (byte) main::row#1 -- pbuc1_derefidx_vbuz1=vbuz2 + lda row + ldy x + sta SCREEN,y + //SEG25 [9] (byte) main::qwe#1 ← ++ (byte) main::qwe#2 -- vbuz1=_inc_vbuz1 + inc qwe + //SEG26 [10] (byte) main::asd#1 ← (byte) main::asd#2 + (byte) main::qwe#1 -- vbuz1=vbuz1_plus_vbuz2 + lda asd + clc + adc qwe + sta asd + //SEG27 [11] (byte) main::x#1 ← ++ (byte) main::x#2 -- vbuz1=_inc_vbuz1 + inc x + //SEG28 [12] if((byte) main::x#1!=(byte/signed byte/word/signed word/dword/signed dword) 11) goto main::@1 -- vbuz1_neq_vbuc1_then_la1 + lda x + cmp #$b + bne b1_from_b1 + jmp b2 + //SEG29 main::@2 + b2: + //SEG30 [13] *((const byte*) main::SCREEN#0) ← (byte) main::qwe#1 -- _deref_pbuc1=vbuz1 + lda qwe + sta SCREEN + //SEG31 [14] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) main::asd#1 -- _deref_pbuc1=vbuz1 + lda asd + sta SCREEN+1 + //SEG32 [15] *((const void()**) KERNEL_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq() -- _deref_pptc1=pprc2 + lda #irq + sta KERNEL_IRQ+1 + jmp breturn + //SEG33 main::@return + breturn: + //SEG34 [16] return + rts +} +//SEG35 irq +irq: { + //SEG36 entry interrupt(KERNEL_MIN) + //SEG37 asm { lda$dc0d } + lda $dc0d + //SEG38 [18] *((const byte*) BGCOL#0) ← (byte) col1#0 -- _deref_pbuc1=vbuz1 + lda col1 + sta BGCOL + //SEG39 [19] (byte) col1#1 ← ++ (byte) col1#0 -- vbuz1=_inc_vbuz2 + ldy col1 + iny + sty col1_1 + //SEG40 [20] *((const byte*) BORDERCOL#0) ← (byte) col2#0 -- _deref_pbuc1=vbuz1 + lda col2 + sta BORDERCOL + //SEG41 [21] (byte) col2#1 ← ++ (byte) col2#0 -- vbuz1=_inc_vbuz2 + ldy col2 + iny + sty col2_1 + jmp breturn + //SEG42 irq::@return + breturn: + //SEG43 [22] return - exit interrupt(KERNEL_MIN) + jmp $ea81 +} + +REGISTER UPLIFT POTENTIAL REGISTERS +Statement [0] (byte) col1#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( ) always clobbers reg byte a +Statement [1] (byte) col2#0 ← (byte/signed byte/word/signed word/dword/signed dword) 8 [ ] ( ) always clobbers reg byte a +Statement [10] (byte) main::asd#1 ← (byte) main::asd#2 + (byte) main::qwe#1 [ main::x#2 main::row#1 main::qwe#1 main::asd#1 ] ( main:3 [ main::x#2 main::row#1 main::qwe#1 main::asd#1 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:3 [ main::x#2 main::x#1 ] +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:2 [ main::row#2 main::row#1 ] +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:4 [ main::qwe#2 main::qwe#1 ] +Statement [15] *((const void()**) KERNEL_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq() [ ] ( main:3 [ ] ) always clobbers reg byte a +Statement asm { lda$dc0d } always clobbers reg byte a +Statement [18] *((const byte*) BGCOL#0) ← (byte) col1#0 [ col1#0 col2#0 ] ( ) always clobbers reg byte a +Statement [19] (byte) col1#1 ← ++ (byte) col1#0 [ col2#0 ] ( ) always clobbers reg byte y +Statement [20] *((const byte*) BORDERCOL#0) ← (byte) col2#0 [ col2#0 ] ( ) always clobbers reg byte a +Statement [21] (byte) col2#1 ← ++ (byte) col2#0 [ ] ( ) always clobbers reg byte y +Statement [0] (byte) col1#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( ) always clobbers reg byte a +Statement [1] (byte) col2#0 ← (byte/signed byte/word/signed word/dword/signed dword) 8 [ ] ( ) always clobbers reg byte a +Statement [8] *((const byte*) main::SCREEN#0 + (byte) main::x#2) ← (byte) main::row#1 [ main::x#2 main::qwe#2 main::asd#2 main::row#1 ] ( main:3 [ main::x#2 main::qwe#2 main::asd#2 main::row#1 ] ) always clobbers reg byte a +Removing always clobbered register reg byte a as potential for zp ZP_BYTE:5 [ main::asd#2 main::asd#1 ] +Statement [10] (byte) main::asd#1 ← (byte) main::asd#2 + (byte) main::qwe#1 [ main::x#2 main::row#1 main::qwe#1 main::asd#1 ] ( main:3 [ main::x#2 main::row#1 main::qwe#1 main::asd#1 ] ) always clobbers reg byte a +Statement [15] *((const void()**) KERNEL_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq() [ ] ( main:3 [ ] ) always clobbers reg byte a +Statement asm { lda$dc0d } always clobbers reg byte a +Statement [18] *((const byte*) BGCOL#0) ← (byte) col1#0 [ col1#0 col2#0 ] ( ) always clobbers reg byte a +Statement [19] (byte) col1#1 ← ++ (byte) col1#0 [ col2#0 ] ( ) always clobbers reg byte y +Statement [20] *((const byte*) BORDERCOL#0) ← (byte) col2#0 [ col2#0 ] ( ) always clobbers reg byte a +Statement [21] (byte) col2#1 ← ++ (byte) col2#0 [ ] ( ) always clobbers reg byte y +Statement [0] (byte) col1#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 [ ] ( ) always clobbers reg byte a +Statement [1] (byte) col2#0 ← (byte/signed byte/word/signed word/dword/signed dword) 8 [ ] ( ) always clobbers reg byte a +Statement [8] *((const byte*) main::SCREEN#0 + (byte) main::x#2) ← (byte) main::row#1 [ main::x#2 main::qwe#2 main::asd#2 main::row#1 ] ( main:3 [ main::x#2 main::qwe#2 main::asd#2 main::row#1 ] ) always clobbers reg byte a +Statement [10] (byte) main::asd#1 ← (byte) main::asd#2 + (byte) main::qwe#1 [ main::x#2 main::row#1 main::qwe#1 main::asd#1 ] ( main:3 [ main::x#2 main::row#1 main::qwe#1 main::asd#1 ] ) always clobbers reg byte a +Statement [15] *((const void()**) KERNEL_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq() [ ] ( main:3 [ ] ) always clobbers reg byte a +Statement asm { lda$dc0d } always clobbers reg byte a +Statement [18] *((const byte*) BGCOL#0) ← (byte) col1#0 [ col1#0 col2#0 ] ( ) always clobbers reg byte a +Statement [19] (byte) col1#1 ← ++ (byte) col1#0 [ col2#0 ] ( ) always clobbers reg byte y +Statement [20] *((const byte*) BORDERCOL#0) ← (byte) col2#0 [ col2#0 ] ( ) always clobbers reg byte a +Statement [21] (byte) col2#1 ← ++ (byte) col2#0 [ ] ( ) always clobbers reg byte y +Potential registers zp ZP_BYTE:2 [ main::row#2 main::row#1 ] : zp ZP_BYTE:2 , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:3 [ main::x#2 main::x#1 ] : zp ZP_BYTE:3 , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:4 [ main::qwe#2 main::qwe#1 ] : zp ZP_BYTE:4 , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:5 [ main::asd#2 main::asd#1 ] : zp ZP_BYTE:5 , reg byte x , reg byte y , +Potential registers zp ZP_BYTE:6 [ col1#0 ] : zp ZP_BYTE:6 , +Potential registers zp ZP_BYTE:7 [ col2#0 ] : zp ZP_BYTE:7 , +Potential registers zp ZP_BYTE:8 [ col1#1 ] : zp ZP_BYTE:8 , +Potential registers zp ZP_BYTE:9 [ col2#1 ] : zp ZP_BYTE:9 , + +REGISTER UPLIFT SCOPES +Uplift Scope [main] 27.5: zp ZP_BYTE:2 [ main::row#2 main::row#1 ] 23.1: zp ZP_BYTE:3 [ main::x#2 main::x#1 ] 16.08: zp ZP_BYTE:4 [ main::qwe#2 main::qwe#1 ] 11.5: zp ZP_BYTE:5 [ main::asd#2 main::asd#1 ] +Uplift Scope [] 20: zp ZP_BYTE:8 [ col1#1 ] 20: zp ZP_BYTE:9 [ col2#1 ] 3: zp ZP_BYTE:6 [ col1#0 ] 1.5: zp ZP_BYTE:7 [ col2#0 ] +Uplift Scope [irq] + +Uplifting [main] best 639 combination zp ZP_BYTE:2 [ main::row#2 main::row#1 ] reg byte y [ main::x#2 main::x#1 ] reg byte x [ main::qwe#2 main::qwe#1 ] zp ZP_BYTE:5 [ main::asd#2 main::asd#1 ] +Uplifting [] best 639 combination zp ZP_BYTE:8 [ col1#1 ] zp ZP_BYTE:9 [ col2#1 ] zp ZP_BYTE:6 [ col1#0 ] zp ZP_BYTE:7 [ col2#0 ] +Uplifting [irq] best 639 combination +Attempting to uplift remaining variables inzp ZP_BYTE:2 [ main::row#2 main::row#1 ] +Uplifting [main] best 639 combination zp ZP_BYTE:2 [ main::row#2 main::row#1 ] +Attempting to uplift remaining variables inzp ZP_BYTE:8 [ col1#1 ] +Uplifting [] best 639 combination zp ZP_BYTE:8 [ col1#1 ] +Attempting to uplift remaining variables inzp ZP_BYTE:9 [ col2#1 ] +Uplifting [] best 639 combination zp ZP_BYTE:9 [ col2#1 ] +Attempting to uplift remaining variables inzp ZP_BYTE:5 [ main::asd#2 main::asd#1 ] +Uplifting [main] best 639 combination zp ZP_BYTE:5 [ main::asd#2 main::asd#1 ] +Attempting to uplift remaining variables inzp ZP_BYTE:6 [ col1#0 ] +Uplifting [] best 639 combination zp ZP_BYTE:6 [ col1#0 ] +Attempting to uplift remaining variables inzp ZP_BYTE:7 [ col2#0 ] +Uplifting [] best 639 combination zp ZP_BYTE:7 [ col2#0 ] +Coalescing zero page register with common assignment [ zp ZP_BYTE:6 [ col1#0 ] ] with [ zp ZP_BYTE:8 [ col1#1 ] ] - score: 1 +Coalescing zero page register with common assignment [ zp ZP_BYTE:7 [ col2#0 ] ] with [ zp ZP_BYTE:9 [ col2#1 ] ] - score: 1 +Coalescing zero page register [ zp ZP_BYTE:2 [ main::row#2 main::row#1 ] ] with [ zp ZP_BYTE:6 [ col1#0 col1#1 ] ] +Coalescing zero page register [ zp ZP_BYTE:2 [ main::row#2 main::row#1 col1#0 col1#1 ] ] with [ zp ZP_BYTE:7 [ col2#0 col2#1 ] ] +Allocated (was zp ZP_BYTE:5) zp ZP_BYTE:3 [ main::asd#2 main::asd#1 ] + +ASSEMBLER BEFORE OPTIMIZATION +//SEG0 Basic Upstart +.pc = $801 "Basic" +:BasicUpstart(main) +.pc = $80d "Program" +//SEG1 Global Constants & labels + .label KERNEL_IRQ = $314 + .label BORDERCOL = $d021 + .label BGCOL = $d020 + .label col1 = 2 + .label col2 = 2 +//SEG2 @begin +bbegin: +//SEG3 [0] (byte) col1#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 + lda #0 + sta col1 +//SEG4 [1] (byte) col2#0 ← (byte/signed byte/word/signed word/dword/signed dword) 8 -- vbuz1=vbuc1 + lda #8 + sta col2 +//SEG5 [2] phi from @begin to @2 [phi:@begin->@2] +b2_from_bbegin: + jmp b2 +//SEG6 @2 +b2: +//SEG7 [3] call main +//SEG8 [5] phi from @2 to main [phi:@2->main] +main_from_b2: + jsr main +//SEG9 [4] phi from @2 to @end [phi:@2->@end] +bend_from_b2: + jmp bend +//SEG10 @end +bend: +//SEG11 main +main: { + .label SCREEN = $400 + .label row = 2 + .label asd = 3 + //SEG12 [6] phi from main to main::@1 [phi:main->main::@1] + b1_from_main: + //SEG13 [6] phi (byte) main::asd#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1 + lda #0 + sta asd + //SEG14 [6] phi (byte) main::qwe#2 = (byte/signed byte/word/signed word/dword/signed dword) 32 [phi:main->main::@1#1] -- vbuxx=vbuc1 + ldx #$20 + //SEG15 [6] phi (byte) main::x#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#2] -- vbuyy=vbuc1 + ldy #0 + //SEG16 [6] phi (byte) main::row#2 = (byte/signed byte/word/signed word/dword/signed dword) 12 [phi:main->main::@1#3] -- vbuz1=vbuc1 + lda #$c + sta row + jmp b1 + //SEG17 [6] phi from main::@1 to main::@1 [phi:main::@1->main::@1] + b1_from_b1: + //SEG18 [6] phi (byte) main::asd#2 = (byte) main::asd#1 [phi:main::@1->main::@1#0] -- register_copy + //SEG19 [6] phi (byte) main::qwe#2 = (byte) main::qwe#1 [phi:main::@1->main::@1#1] -- register_copy + //SEG20 [6] phi (byte) main::x#2 = (byte) main::x#1 [phi:main::@1->main::@1#2] -- register_copy + //SEG21 [6] phi (byte) main::row#2 = (byte) main::row#1 [phi:main::@1->main::@1#3] -- register_copy + jmp b1 + //SEG22 main::@1 + b1: + //SEG23 [7] (byte) main::row#1 ← ++ (byte) main::row#2 -- vbuz1=_inc_vbuz1 + inc row + //SEG24 [8] *((const byte*) main::SCREEN#0 + (byte) main::x#2) ← (byte) main::row#1 -- pbuc1_derefidx_vbuyy=vbuz1 + lda row + sta SCREEN,y + //SEG25 [9] (byte) main::qwe#1 ← ++ (byte) main::qwe#2 -- vbuxx=_inc_vbuxx + inx + //SEG26 [10] (byte) main::asd#1 ← (byte) main::asd#2 + (byte) main::qwe#1 -- vbuz1=vbuz1_plus_vbuxx + txa + clc + adc asd + sta asd + //SEG27 [11] (byte) main::x#1 ← ++ (byte) main::x#2 -- vbuyy=_inc_vbuyy + iny + //SEG28 [12] if((byte) main::x#1!=(byte/signed byte/word/signed word/dword/signed dword) 11) goto main::@1 -- vbuyy_neq_vbuc1_then_la1 + cpy #$b + bne b1_from_b1 + jmp b2 + //SEG29 main::@2 + b2: + //SEG30 [13] *((const byte*) main::SCREEN#0) ← (byte) main::qwe#1 -- _deref_pbuc1=vbuxx + stx SCREEN + //SEG31 [14] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) main::asd#1 -- _deref_pbuc1=vbuz1 + lda asd + sta SCREEN+1 + //SEG32 [15] *((const void()**) KERNEL_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq() -- _deref_pptc1=pprc2 + lda #irq + sta KERNEL_IRQ+1 + jmp breturn + //SEG33 main::@return + breturn: + //SEG34 [16] return + rts +} +//SEG35 irq +irq: { + //SEG36 entry interrupt(KERNEL_MIN) + //SEG37 asm { lda$dc0d } + lda $dc0d + //SEG38 [18] *((const byte*) BGCOL#0) ← (byte) col1#0 -- _deref_pbuc1=vbuz1 + lda col1 + sta BGCOL + //SEG39 [19] (byte) col1#1 ← ++ (byte) col1#0 -- vbuz1=_inc_vbuz1 + inc col1 + //SEG40 [20] *((const byte*) BORDERCOL#0) ← (byte) col2#0 -- _deref_pbuc1=vbuz1 + lda col2 + sta BORDERCOL + //SEG41 [21] (byte) col2#1 ← ++ (byte) col2#0 -- vbuz1=_inc_vbuz1 + inc col2 + jmp breturn + //SEG42 irq::@return + breturn: + //SEG43 [22] return - exit interrupt(KERNEL_MIN) + jmp $ea81 +} + +ASSEMBLER OPTIMIZATIONS +Removing instruction jmp b2 +Removing instruction jmp bend +Removing instruction jmp b1 +Removing instruction jmp b2 +Removing instruction jmp breturn +Removing instruction jmp breturn +Succesful ASM optimization Pass5NextJumpElimination +Replacing instruction ldy #0 with TAY +Replacing label b1_from_b1 with b1 +Removing instruction b2_from_bbegin: +Removing instruction main_from_b2: +Removing instruction bend_from_b2: +Removing instruction b1_from_b1: +Succesful ASM optimization Pass5RedundantLabelElimination +Removing instruction bbegin: +Removing instruction b2: +Removing instruction bend: +Removing instruction b1_from_main: +Removing instruction b2: +Removing instruction breturn: +Removing instruction breturn: +Succesful ASM optimization Pass5UnusedLabelElimination +Removing instruction jmp b1 +Succesful ASM optimization Pass5NextJumpElimination +Removing instruction lda asd +Succesful ASM optimization Pass5UnnecesaryLoadElimination + +FINAL SYMBOL TABLE +(label) @2 +(label) @begin +(label) @end +(byte*) BGCOL +(const byte*) BGCOL#0 BGCOL = ((byte*))(word/dword/signed dword) 53280 +(byte*) BORDERCOL +(const byte*) BORDERCOL#0 BORDERCOL = ((byte*))(word/dword/signed dword) 53281 +(void()**) KERNEL_IRQ +(const void()**) KERNEL_IRQ#0 KERNEL_IRQ = ((void()**))(word/signed word/dword/signed dword) 788 +(byte) col1 +(byte) col1#0 col1 zp ZP_BYTE:2 3.0 +(byte) col1#1 col1 zp ZP_BYTE:2 20.0 +(byte) col2 +(byte) col2#0 col2 zp ZP_BYTE:2 1.5 +(byte) col2#1 col2 zp ZP_BYTE:2 20.0 +interrupt(KERNEL_MIN)(void()) irq() +(label) irq::@return +(void()) main() +(label) main::@1 +(label) main::@2 +(label) main::@return +(byte*) main::SCREEN +(const byte*) main::SCREEN#0 SCREEN = ((byte*))(word/signed word/dword/signed dword) 1024 +(byte) main::asd +(byte) main::asd#1 asd zp ZP_BYTE:3 6.0 +(byte) main::asd#2 asd zp ZP_BYTE:3 5.5 +(byte) main::qwe +(byte) main::qwe#1 reg byte x 8.75 +(byte) main::qwe#2 reg byte x 7.333333333333333 +(byte) main::row +(byte) main::row#1 row zp ZP_BYTE:2 5.5 +(byte) main::row#2 row zp ZP_BYTE:2 22.0 +(byte) main::x +(byte) main::x#1 reg byte y 16.5 +(byte) main::x#2 reg byte y 6.6000000000000005 + +zp ZP_BYTE:2 [ main::row#2 main::row#1 col1#0 col1#1 col2#0 col2#1 ] +reg byte y [ main::x#2 main::x#1 ] +reg byte x [ main::qwe#2 main::qwe#1 ] +zp ZP_BYTE:3 [ main::asd#2 main::asd#1 ] + + +FINAL ASSEMBLER +Score: 528 + +//SEG0 Basic Upstart +.pc = $801 "Basic" +:BasicUpstart(main) +.pc = $80d "Program" +//SEG1 Global Constants & labels + .label KERNEL_IRQ = $314 + .label BORDERCOL = $d021 + .label BGCOL = $d020 + .label col1 = 2 + .label col2 = 2 +//SEG2 @begin +//SEG3 [0] (byte) col1#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 -- vbuz1=vbuc1 + lda #0 + sta col1 +//SEG4 [1] (byte) col2#0 ← (byte/signed byte/word/signed word/dword/signed dword) 8 -- vbuz1=vbuc1 + lda #8 + sta col2 +//SEG5 [2] phi from @begin to @2 [phi:@begin->@2] +//SEG6 @2 +//SEG7 [3] call main +//SEG8 [5] phi from @2 to main [phi:@2->main] + jsr main +//SEG9 [4] phi from @2 to @end [phi:@2->@end] +//SEG10 @end +//SEG11 main +main: { + .label SCREEN = $400 + .label row = 2 + .label asd = 3 + //SEG12 [6] phi from main to main::@1 [phi:main->main::@1] + //SEG13 [6] phi (byte) main::asd#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#0] -- vbuz1=vbuc1 + lda #0 + sta asd + //SEG14 [6] phi (byte) main::qwe#2 = (byte/signed byte/word/signed word/dword/signed dword) 32 [phi:main->main::@1#1] -- vbuxx=vbuc1 + ldx #$20 + //SEG15 [6] phi (byte) main::x#2 = (byte/signed byte/word/signed word/dword/signed dword) 0 [phi:main->main::@1#2] -- vbuyy=vbuc1 + tay + //SEG16 [6] phi (byte) main::row#2 = (byte/signed byte/word/signed word/dword/signed dword) 12 [phi:main->main::@1#3] -- vbuz1=vbuc1 + lda #$c + sta row + //SEG17 [6] phi from main::@1 to main::@1 [phi:main::@1->main::@1] + //SEG18 [6] phi (byte) main::asd#2 = (byte) main::asd#1 [phi:main::@1->main::@1#0] -- register_copy + //SEG19 [6] phi (byte) main::qwe#2 = (byte) main::qwe#1 [phi:main::@1->main::@1#1] -- register_copy + //SEG20 [6] phi (byte) main::x#2 = (byte) main::x#1 [phi:main::@1->main::@1#2] -- register_copy + //SEG21 [6] phi (byte) main::row#2 = (byte) main::row#1 [phi:main::@1->main::@1#3] -- register_copy + //SEG22 main::@1 + b1: + //SEG23 [7] (byte) main::row#1 ← ++ (byte) main::row#2 -- vbuz1=_inc_vbuz1 + inc row + //SEG24 [8] *((const byte*) main::SCREEN#0 + (byte) main::x#2) ← (byte) main::row#1 -- pbuc1_derefidx_vbuyy=vbuz1 + lda row + sta SCREEN,y + //SEG25 [9] (byte) main::qwe#1 ← ++ (byte) main::qwe#2 -- vbuxx=_inc_vbuxx + inx + //SEG26 [10] (byte) main::asd#1 ← (byte) main::asd#2 + (byte) main::qwe#1 -- vbuz1=vbuz1_plus_vbuxx + txa + clc + adc asd + sta asd + //SEG27 [11] (byte) main::x#1 ← ++ (byte) main::x#2 -- vbuyy=_inc_vbuyy + iny + //SEG28 [12] if((byte) main::x#1!=(byte/signed byte/word/signed word/dword/signed dword) 11) goto main::@1 -- vbuyy_neq_vbuc1_then_la1 + cpy #$b + bne b1 + //SEG29 main::@2 + //SEG30 [13] *((const byte*) main::SCREEN#0) ← (byte) main::qwe#1 -- _deref_pbuc1=vbuxx + stx SCREEN + //SEG31 [14] *((const byte*) main::SCREEN#0+(byte/signed byte/word/signed word/dword/signed dword) 1) ← (byte) main::asd#1 -- _deref_pbuc1=vbuz1 + sta SCREEN+1 + //SEG32 [15] *((const void()**) KERNEL_IRQ#0) ← &interrupt(KERNEL_MIN)(void()) irq() -- _deref_pptc1=pprc2 + lda #irq + sta KERNEL_IRQ+1 + //SEG33 main::@return + //SEG34 [16] return + rts +} +//SEG35 irq +irq: { + //SEG36 entry interrupt(KERNEL_MIN) + //SEG37 asm { lda$dc0d } + lda $dc0d + //SEG38 [18] *((const byte*) BGCOL#0) ← (byte) col1#0 -- _deref_pbuc1=vbuz1 + lda col1 + sta BGCOL + //SEG39 [19] (byte) col1#1 ← ++ (byte) col1#0 -- vbuz1=_inc_vbuz1 + inc col1 + //SEG40 [20] *((const byte*) BORDERCOL#0) ← (byte) col2#0 -- _deref_pbuc1=vbuz1 + lda col2 + sta BORDERCOL + //SEG41 [21] (byte) col2#1 ← ++ (byte) col2#0 -- vbuz1=_inc_vbuz1 + inc col2 + //SEG42 irq::@return + //SEG43 [22] return - exit interrupt(KERNEL_MIN) + jmp $ea81 +} + diff --git a/src/test/ref/interrupt-volatile-reuse-problem.sym b/src/test/ref/interrupt-volatile-reuse-problem.sym new file mode 100644 index 000000000..3c0b4f9bc --- /dev/null +++ b/src/test/ref/interrupt-volatile-reuse-problem.sym @@ -0,0 +1,40 @@ +(label) @2 +(label) @begin +(label) @end +(byte*) BGCOL +(const byte*) BGCOL#0 BGCOL = ((byte*))(word/dword/signed dword) 53280 +(byte*) BORDERCOL +(const byte*) BORDERCOL#0 BORDERCOL = ((byte*))(word/dword/signed dword) 53281 +(void()**) KERNEL_IRQ +(const void()**) KERNEL_IRQ#0 KERNEL_IRQ = ((void()**))(word/signed word/dword/signed dword) 788 +(byte) col1 +(byte) col1#0 col1 zp ZP_BYTE:2 3.0 +(byte) col1#1 col1 zp ZP_BYTE:2 20.0 +(byte) col2 +(byte) col2#0 col2 zp ZP_BYTE:2 1.5 +(byte) col2#1 col2 zp ZP_BYTE:2 20.0 +interrupt(KERNEL_MIN)(void()) irq() +(label) irq::@return +(void()) main() +(label) main::@1 +(label) main::@2 +(label) main::@return +(byte*) main::SCREEN +(const byte*) main::SCREEN#0 SCREEN = ((byte*))(word/signed word/dword/signed dword) 1024 +(byte) main::asd +(byte) main::asd#1 asd zp ZP_BYTE:3 6.0 +(byte) main::asd#2 asd zp ZP_BYTE:3 5.5 +(byte) main::qwe +(byte) main::qwe#1 reg byte x 8.75 +(byte) main::qwe#2 reg byte x 7.333333333333333 +(byte) main::row +(byte) main::row#1 row zp ZP_BYTE:2 5.5 +(byte) main::row#2 row zp ZP_BYTE:2 22.0 +(byte) main::x +(byte) main::x#1 reg byte y 16.5 +(byte) main::x#2 reg byte y 6.6000000000000005 + +zp ZP_BYTE:2 [ main::row#2 main::row#1 col1#0 col1#1 col2#0 col2#1 ] +reg byte y [ main::x#2 main::x#1 ] +reg byte x [ main::qwe#2 main::qwe#1 ] +zp ZP_BYTE:3 [ main::asd#2 main::asd#1 ]