Resolved forward reference irq to interrupt(KERNEL_KEYBOARD)(void()) irq() Inlined call (byte~) vicSelectGfxBank::$0 ← call toDd00 (byte*) vicSelectGfxBank::gfx CONTROL FLOW GRAPH SSA @begin: scope:[] from (byte*) PROCPORT_DDR#0 ← ((byte*)) (byte/signed byte/word/signed word/dword/signed dword) 0 (byte) PROCPORT_DDR_MEMORY_MASK#0 ← (byte/signed byte/word/signed word/dword/signed dword) 7 (byte*) PROCPORT#0 ← ((byte*)) (byte/signed byte/word/signed word/dword/signed dword) 1 (byte) PROCPORT_RAM_ALL#0 ← (byte/signed byte/word/signed word/dword/signed dword) 48 (byte) PROCPORT_RAM_IO#0 ← (byte/signed byte/word/signed word/dword/signed dword) 53 (byte) PROCPORT_RAM_CHARROM#0 ← (byte/signed byte/word/signed word/dword/signed dword) 49 (byte) PROCPORT_KERNEL_IO#0 ← (byte/signed byte/word/signed word/dword/signed dword) 54 (byte) PROCPORT_BASIC_KERNEL_IO#0 ← (byte/signed byte/word/signed word/dword/signed dword) 55 (byte*) CHARGEN#0 ← ((byte*)) (word/dword/signed dword) 53248 (word) SPRITE_PTRS#0 ← (word/signed word/dword/signed dword) 1016 (byte*) SPRITES_XPOS#0 ← ((byte*)) (word/dword/signed dword) 53248 (byte*) SPRITES_YPOS#0 ← ((byte*)) (word/dword/signed dword) 53249 (byte*) SPRITES_XMSB#0 ← ((byte*)) (word/dword/signed dword) 53264 (byte*) RASTER#0 ← ((byte*)) (word/dword/signed dword) 53266 (byte*) SPRITES_ENABLE#0 ← ((byte*)) (word/dword/signed dword) 53269 (byte*) SPRITES_EXPAND_Y#0 ← ((byte*)) (word/dword/signed dword) 53271 (byte*) SPRITES_PRIORITY#0 ← ((byte*)) (word/dword/signed dword) 53275 (byte*) SPRITES_MC#0 ← ((byte*)) (word/dword/signed dword) 53276 (byte*) SPRITES_EXPAND_X#0 ← ((byte*)) (word/dword/signed dword) 53277 (byte*) BORDERCOL#0 ← ((byte*)) (word/dword/signed dword) 53280 (byte*) BGCOL#0 ← ((byte*)) (word/dword/signed dword) 53281 (byte*) BGCOL1#0 ← ((byte*)) (word/dword/signed dword) 53281 (byte*) BGCOL2#0 ← ((byte*)) (word/dword/signed dword) 53282 (byte*) BGCOL3#0 ← ((byte*)) (word/dword/signed dword) 53283 (byte*) BGCOL4#0 ← ((byte*)) (word/dword/signed dword) 53284 (byte*) SPRITES_MC1#0 ← ((byte*)) (word/dword/signed dword) 53285 (byte*) SPRITES_MC2#0 ← ((byte*)) (word/dword/signed dword) 53286 (byte*) SPRITES_COLS#0 ← ((byte*)) (word/dword/signed dword) 53287 (byte*) VIC_CONTROL#0 ← ((byte*)) (word/dword/signed dword) 53265 (byte*) D011#0 ← ((byte*)) (word/dword/signed dword) 53265 (byte) VIC_RST8#0 ← (byte/word/signed word/dword/signed dword) 128 (byte) VIC_ECM#0 ← (byte/signed byte/word/signed word/dword/signed dword) 64 (byte) VIC_BMM#0 ← (byte/signed byte/word/signed word/dword/signed dword) 32 (byte) VIC_DEN#0 ← (byte/signed byte/word/signed word/dword/signed dword) 16 (byte) VIC_RSEL#0 ← (byte/signed byte/word/signed word/dword/signed dword) 8 (byte*) VIC_CONTROL2#0 ← ((byte*)) (word/dword/signed dword) 53270 (byte*) D016#0 ← ((byte*)) (word/dword/signed dword) 53270 (byte) VIC_MCM#0 ← (byte/signed byte/word/signed word/dword/signed dword) 16 (byte) VIC_CSEL#0 ← (byte/signed byte/word/signed word/dword/signed dword) 8 (byte*) D018#0 ← ((byte*)) (word/dword/signed dword) 53272 (byte*) VIC_MEMORY#0 ← ((byte*)) (word/dword/signed dword) 53272 (byte*) LIGHTPEN_X#0 ← ((byte*)) (word/dword/signed dword) 53267 (byte*) LIGHTPEN_Y#0 ← ((byte*)) (word/dword/signed dword) 53268 (byte*) IRQ_STATUS#0 ← ((byte*)) (word/dword/signed dword) 53273 (byte*) IRQ_ENABLE#0 ← ((byte*)) (word/dword/signed dword) 53274 (byte) IRQ_RASTER#0 ← (byte/signed byte/word/signed word/dword/signed dword) 1 (byte) IRQ_COLLISION_BG#0 ← (byte/signed byte/word/signed word/dword/signed dword) 2 (byte) IRQ_COLLISION_SPRITE#0 ← (byte/signed byte/word/signed word/dword/signed dword) 4 (byte) IRQ_LIGHTPEN#0 ← (byte/signed byte/word/signed word/dword/signed dword) 8 (byte*) COLS#0 ← ((byte*)) (word/dword/signed dword) 55296 (byte*) CIA1_PORT_A#0 ← ((byte*)) (word/dword/signed dword) 56320 (byte*) CIA1_PORT_B#0 ← ((byte*)) (word/dword/signed dword) 56321 (byte*) CIA1_PORT_A_DDR#0 ← ((byte*)) (word/dword/signed dword) 56322 (byte*) CIA1_PORT_B_DDR#0 ← ((byte*)) (word/dword/signed dword) 56323 (byte*) CIA1_INTERRUPT#0 ← ((byte*)) (word/dword/signed dword) 56333 (byte) CIA_INTERRUPT_CLEAR#0 ← (byte/signed byte/word/signed word/dword/signed dword) 127 (byte*) CIA2_PORT_A#0 ← ((byte*)) (word/dword/signed dword) 56576 (byte*) CIA2_PORT_B#0 ← ((byte*)) (word/dword/signed dword) 56577 (byte*) CIA2_PORT_A_DDR#0 ← ((byte*)) (word/dword/signed dword) 56578 (byte*) CIA2_PORT_B_DDR#0 ← ((byte*)) (word/dword/signed dword) 56579 (byte*) CIA2_INTERRUPT#0 ← ((byte*)) (word/dword/signed dword) 56589 (void()**) KERNEL_IRQ#0 ← ((void()**)) (word/signed word/dword/signed dword) 788 (void()**) HARDWARE_IRQ#0 ← ((void()**)) (word/dword/signed dword) 65534 (byte) BLACK#0 ← (byte/signed byte/word/signed word/dword/signed dword) 0 (byte) WHITE#0 ← (byte/signed byte/word/signed word/dword/signed dword) 1 (byte) RED#0 ← (byte/signed byte/word/signed word/dword/signed dword) 2 (byte) CYAN#0 ← (byte/signed byte/word/signed word/dword/signed dword) 3 (byte) PURPLE#0 ← (byte/signed byte/word/signed word/dword/signed dword) 4 (byte) GREEN#0 ← (byte/signed byte/word/signed word/dword/signed dword) 5 (byte) BLUE#0 ← (byte/signed byte/word/signed word/dword/signed dword) 6 (byte) YELLOW#0 ← (byte/signed byte/word/signed word/dword/signed dword) 7 (byte) ORANGE#0 ← (byte/signed byte/word/signed word/dword/signed dword) 8 (byte) BROWN#0 ← (byte/signed byte/word/signed word/dword/signed dword) 9 (byte) PINK#0 ← (byte/signed byte/word/signed word/dword/signed dword) 10 (byte) DARK_GREY#0 ← (byte/signed byte/word/signed word/dword/signed dword) 11 (byte) GREY#0 ← (byte/signed byte/word/signed word/dword/signed dword) 12 (byte) LIGHT_GREEN#0 ← (byte/signed byte/word/signed word/dword/signed dword) 13 (byte) LIGHT_BLUE#0 ← (byte/signed byte/word/signed word/dword/signed dword) 14 (byte) LIGHT_GREY#0 ← (byte/signed byte/word/signed word/dword/signed dword) 15 to:@6 main: scope:[main] from @6 asm { sei } (void()*~) main::$0 ← & interrupt(KERNEL_KEYBOARD)(void()) irq() *((void()**) KERNEL_IRQ#0) ← (void()*~) main::$0 asm { cli } to:main::@return main::@return: scope:[main] from main return to:@return irq: scope:[irq] from *((byte*) BGCOL#0) ← (byte) WHITE#0 *((byte*) BGCOL#0) ← (byte) BLACK#0 to:irq::@return irq::@return: scope:[irq] from irq return to:@return @6: scope:[] from @begin call main to:@7 @7: scope:[] from @6 to:@end @end: scope:[] from @7 SYMBOL TABLE SSA (label) @6 (label) @7 (label) @begin (label) @end (byte*) BGCOL (byte*) BGCOL#0 (byte*) BGCOL1 (byte*) BGCOL1#0 (byte*) BGCOL2 (byte*) BGCOL2#0 (byte*) BGCOL3 (byte*) BGCOL3#0 (byte*) BGCOL4 (byte*) BGCOL4#0 (byte) BLACK (byte) BLACK#0 (byte) BLUE (byte) BLUE#0 (byte*) BORDERCOL (byte*) BORDERCOL#0 (byte) BROWN (byte) BROWN#0 (byte*) CHARGEN (byte*) CHARGEN#0 (byte*) CIA1_INTERRUPT (byte*) CIA1_INTERRUPT#0 (byte*) CIA1_PORT_A (byte*) CIA1_PORT_A#0 (byte*) CIA1_PORT_A_DDR (byte*) CIA1_PORT_A_DDR#0 (byte*) CIA1_PORT_B (byte*) CIA1_PORT_B#0 (byte*) CIA1_PORT_B_DDR (byte*) CIA1_PORT_B_DDR#0 (byte*) CIA2_INTERRUPT (byte*) CIA2_INTERRUPT#0 (byte*) CIA2_PORT_A (byte*) CIA2_PORT_A#0 (byte*) CIA2_PORT_A_DDR (byte*) CIA2_PORT_A_DDR#0 (byte*) CIA2_PORT_B (byte*) CIA2_PORT_B#0 (byte*) CIA2_PORT_B_DDR (byte*) CIA2_PORT_B_DDR#0 (byte) CIA_INTERRUPT_CLEAR (byte) CIA_INTERRUPT_CLEAR#0 (byte*) COLS (byte*) COLS#0 (byte) CYAN (byte) CYAN#0 (byte*) D011 (byte*) D011#0 (byte*) D016 (byte*) D016#0 (byte*) D018 (byte*) D018#0 (byte) DARK_GREY (byte) DARK_GREY#0 (byte) GREEN (byte) GREEN#0 (byte) GREY (byte) GREY#0 (void()**) HARDWARE_IRQ (void()**) HARDWARE_IRQ#0 (byte) IRQ_COLLISION_BG (byte) IRQ_COLLISION_BG#0 (byte) IRQ_COLLISION_SPRITE (byte) IRQ_COLLISION_SPRITE#0 (byte*) IRQ_ENABLE (byte*) IRQ_ENABLE#0 (byte) IRQ_LIGHTPEN (byte) IRQ_LIGHTPEN#0 (byte) IRQ_RASTER (byte) IRQ_RASTER#0 (byte*) IRQ_STATUS (byte*) IRQ_STATUS#0 (void()**) KERNEL_IRQ (void()**) KERNEL_IRQ#0 (byte*) LIGHTPEN_X (byte*) LIGHTPEN_X#0 (byte*) LIGHTPEN_Y (byte*) LIGHTPEN_Y#0 (byte) LIGHT_BLUE (byte) LIGHT_BLUE#0 (byte) LIGHT_GREEN (byte) LIGHT_GREEN#0 (byte) LIGHT_GREY (byte) LIGHT_GREY#0 (byte) ORANGE (byte) ORANGE#0 (byte) PINK (byte) PINK#0 (byte*) PROCPORT (byte*) PROCPORT#0 (byte) PROCPORT_BASIC_KERNEL_IO (byte) PROCPORT_BASIC_KERNEL_IO#0 (byte*) PROCPORT_DDR (byte*) PROCPORT_DDR#0 (byte) PROCPORT_DDR_MEMORY_MASK (byte) PROCPORT_DDR_MEMORY_MASK#0 (byte) PROCPORT_KERNEL_IO (byte) PROCPORT_KERNEL_IO#0 (byte) PROCPORT_RAM_ALL (byte) PROCPORT_RAM_ALL#0 (byte) PROCPORT_RAM_CHARROM (byte) PROCPORT_RAM_CHARROM#0 (byte) PROCPORT_RAM_IO (byte) PROCPORT_RAM_IO#0 (byte) PURPLE (byte) PURPLE#0 (byte*) RASTER (byte*) RASTER#0 (byte) RED (byte) RED#0 (byte*) SPRITES_COLS (byte*) SPRITES_COLS#0 (byte*) SPRITES_ENABLE (byte*) SPRITES_ENABLE#0 (byte*) SPRITES_EXPAND_X (byte*) SPRITES_EXPAND_X#0 (byte*) SPRITES_EXPAND_Y (byte*) SPRITES_EXPAND_Y#0 (byte*) SPRITES_MC (byte*) SPRITES_MC#0 (byte*) SPRITES_MC1 (byte*) SPRITES_MC1#0 (byte*) SPRITES_MC2 (byte*) SPRITES_MC2#0 (byte*) SPRITES_PRIORITY (byte*) SPRITES_PRIORITY#0 (byte*) SPRITES_XMSB (byte*) SPRITES_XMSB#0 (byte*) SPRITES_XPOS (byte*) SPRITES_XPOS#0 (byte*) SPRITES_YPOS (byte*) SPRITES_YPOS#0 (word) SPRITE_PTRS (word) SPRITE_PTRS#0 (byte) VIC_BMM (byte) VIC_BMM#0 (byte*) VIC_CONTROL (byte*) VIC_CONTROL#0 (byte*) VIC_CONTROL2 (byte*) VIC_CONTROL2#0 (byte) VIC_CSEL (byte) VIC_CSEL#0 (byte) VIC_DEN (byte) VIC_DEN#0 (byte) VIC_ECM (byte) VIC_ECM#0 (byte) VIC_MCM (byte) VIC_MCM#0 (byte*) VIC_MEMORY (byte*) VIC_MEMORY#0 (byte) VIC_RSEL (byte) VIC_RSEL#0 (byte) VIC_RST8 (byte) VIC_RST8#0 (byte) WHITE (byte) WHITE#0 (byte) YELLOW (byte) YELLOW#0 interrupt(KERNEL_KEYBOARD)(void()) irq() (label) irq::@return (void()) main() (void()*~) main::$0 (label) main::@return Culled Empty Block (label) @7 Successful SSA optimization Pass2CullEmptyBlocks Constant (const byte*) PROCPORT_DDR#0 = ((byte*))0 Constant (const byte) PROCPORT_DDR_MEMORY_MASK#0 = 7 Constant (const byte*) PROCPORT#0 = ((byte*))1 Constant (const byte) PROCPORT_RAM_ALL#0 = 48 Constant (const byte) PROCPORT_RAM_IO#0 = 53 Constant (const byte) PROCPORT_RAM_CHARROM#0 = 49 Constant (const byte) PROCPORT_KERNEL_IO#0 = 54 Constant (const byte) PROCPORT_BASIC_KERNEL_IO#0 = 55 Constant (const byte*) CHARGEN#0 = ((byte*))53248 Constant (const word) SPRITE_PTRS#0 = 1016 Constant (const byte*) SPRITES_XPOS#0 = ((byte*))53248 Constant (const byte*) SPRITES_YPOS#0 = ((byte*))53249 Constant (const byte*) SPRITES_XMSB#0 = ((byte*))53264 Constant (const byte*) RASTER#0 = ((byte*))53266 Constant (const byte*) SPRITES_ENABLE#0 = ((byte*))53269 Constant (const byte*) SPRITES_EXPAND_Y#0 = ((byte*))53271 Constant (const byte*) SPRITES_PRIORITY#0 = ((byte*))53275 Constant (const byte*) SPRITES_MC#0 = ((byte*))53276 Constant (const byte*) SPRITES_EXPAND_X#0 = ((byte*))53277 Constant (const byte*) BORDERCOL#0 = ((byte*))53280 Constant (const byte*) BGCOL#0 = ((byte*))53281 Constant (const byte*) BGCOL1#0 = ((byte*))53281 Constant (const byte*) BGCOL2#0 = ((byte*))53282 Constant (const byte*) BGCOL3#0 = ((byte*))53283 Constant (const byte*) BGCOL4#0 = ((byte*))53284 Constant (const byte*) SPRITES_MC1#0 = ((byte*))53285 Constant (const byte*) SPRITES_MC2#0 = ((byte*))53286 Constant (const byte*) SPRITES_COLS#0 = ((byte*))53287 Constant (const byte*) VIC_CONTROL#0 = ((byte*))53265 Constant (const byte*) D011#0 = ((byte*))53265 Constant (const byte) VIC_RST8#0 = 128 Constant (const byte) VIC_ECM#0 = 64 Constant (const byte) VIC_BMM#0 = 32 Constant (const byte) VIC_DEN#0 = 16 Constant (const byte) VIC_RSEL#0 = 8 Constant (const byte*) VIC_CONTROL2#0 = ((byte*))53270 Constant (const byte*) D016#0 = ((byte*))53270 Constant (const byte) VIC_MCM#0 = 16 Constant (const byte) VIC_CSEL#0 = 8 Constant (const byte*) D018#0 = ((byte*))53272 Constant (const byte*) VIC_MEMORY#0 = ((byte*))53272 Constant (const byte*) LIGHTPEN_X#0 = ((byte*))53267 Constant (const byte*) LIGHTPEN_Y#0 = ((byte*))53268 Constant (const byte*) IRQ_STATUS#0 = ((byte*))53273 Constant (const byte*) IRQ_ENABLE#0 = ((byte*))53274 Constant (const byte) IRQ_RASTER#0 = 1 Constant (const byte) IRQ_COLLISION_BG#0 = 2 Constant (const byte) IRQ_COLLISION_SPRITE#0 = 4 Constant (const byte) IRQ_LIGHTPEN#0 = 8 Constant (const byte*) COLS#0 = ((byte*))55296 Constant (const byte*) CIA1_PORT_A#0 = ((byte*))56320 Constant (const byte*) CIA1_PORT_B#0 = ((byte*))56321 Constant (const byte*) CIA1_PORT_A_DDR#0 = ((byte*))56322 Constant (const byte*) CIA1_PORT_B_DDR#0 = ((byte*))56323 Constant (const byte*) CIA1_INTERRUPT#0 = ((byte*))56333 Constant (const byte) CIA_INTERRUPT_CLEAR#0 = 127 Constant (const byte*) CIA2_PORT_A#0 = ((byte*))56576 Constant (const byte*) CIA2_PORT_B#0 = ((byte*))56577 Constant (const byte*) CIA2_PORT_A_DDR#0 = ((byte*))56578 Constant (const byte*) CIA2_PORT_B_DDR#0 = ((byte*))56579 Constant (const byte*) CIA2_INTERRUPT#0 = ((byte*))56589 Constant (const void()**) KERNEL_IRQ#0 = ((void()**))788 Constant (const void()**) HARDWARE_IRQ#0 = ((void()**))65534 Constant (const byte) BLACK#0 = 0 Constant (const byte) WHITE#0 = 1 Constant (const byte) RED#0 = 2 Constant (const byte) CYAN#0 = 3 Constant (const byte) PURPLE#0 = 4 Constant (const byte) GREEN#0 = 5 Constant (const byte) BLUE#0 = 6 Constant (const byte) YELLOW#0 = 7 Constant (const byte) ORANGE#0 = 8 Constant (const byte) BROWN#0 = 9 Constant (const byte) PINK#0 = 10 Constant (const byte) DARK_GREY#0 = 11 Constant (const byte) GREY#0 = 12 Constant (const byte) LIGHT_GREEN#0 = 13 Constant (const byte) LIGHT_BLUE#0 = 14 Constant (const byte) LIGHT_GREY#0 = 15 Constant (const void()*) main::$0 = &irq Successful SSA optimization Pass2ConstantIdentification Successful SSA optimization PassNEliminateUnusedVars Constant inlined main::$0 = &interrupt(KERNEL_KEYBOARD)(void()) irq() Successful SSA optimization Pass2ConstantInlining Adding NOP phi() at start of @begin Adding NOP phi() at start of @6 Adding NOP phi() at start of @end CALL GRAPH Calls in [] to main:2 Created 0 initial phi equivalence classes Coalesced down to 0 phi equivalence classes Adding NOP phi() at start of @begin Adding NOP phi() at start of @6 Adding NOP phi() at start of @end FINAL CONTROL FLOW GRAPH @begin: scope:[] from [0] phi() to:@6 @6: scope:[] from @begin [1] phi() [2] call main to:@end @end: scope:[] from @6 [3] phi() main: scope:[main] from @6 asm { sei } [5] *((const void()**) KERNEL_IRQ#0) ← &interrupt(KERNEL_KEYBOARD)(void()) irq() asm { cli } to:main::@return main::@return: scope:[main] from main [7] return to:@return irq: scope:[irq] from [8] *((const byte*) BGCOL#0) ← (const byte) WHITE#0 [9] *((const byte*) BGCOL#0) ← (const byte) BLACK#0 to:irq::@return irq::@return: scope:[irq] from irq [10] return to:@return VARIABLE REGISTER WEIGHTS (byte*) BGCOL (byte*) BGCOL1 (byte*) BGCOL2 (byte*) BGCOL3 (byte*) BGCOL4 (byte) BLACK (byte) BLUE (byte*) BORDERCOL (byte) BROWN (byte*) CHARGEN (byte*) CIA1_INTERRUPT (byte*) CIA1_PORT_A (byte*) CIA1_PORT_A_DDR (byte*) CIA1_PORT_B (byte*) CIA1_PORT_B_DDR (byte*) CIA2_INTERRUPT (byte*) CIA2_PORT_A (byte*) CIA2_PORT_A_DDR (byte*) CIA2_PORT_B (byte*) CIA2_PORT_B_DDR (byte) CIA_INTERRUPT_CLEAR (byte*) COLS (byte) CYAN (byte*) D011 (byte*) D016 (byte*) D018 (byte) DARK_GREY (byte) GREEN (byte) GREY (void()**) HARDWARE_IRQ (byte) IRQ_COLLISION_BG (byte) IRQ_COLLISION_SPRITE (byte*) IRQ_ENABLE (byte) IRQ_LIGHTPEN (byte) IRQ_RASTER (byte*) IRQ_STATUS (void()**) KERNEL_IRQ (byte*) LIGHTPEN_X (byte*) LIGHTPEN_Y (byte) LIGHT_BLUE (byte) LIGHT_GREEN (byte) LIGHT_GREY (byte) ORANGE (byte) PINK (byte*) PROCPORT (byte) PROCPORT_BASIC_KERNEL_IO (byte*) PROCPORT_DDR (byte) PROCPORT_DDR_MEMORY_MASK (byte) PROCPORT_KERNEL_IO (byte) PROCPORT_RAM_ALL (byte) PROCPORT_RAM_CHARROM (byte) PROCPORT_RAM_IO (byte) PURPLE (byte*) RASTER (byte) RED (byte*) SPRITES_COLS (byte*) SPRITES_ENABLE (byte*) SPRITES_EXPAND_X (byte*) SPRITES_EXPAND_Y (byte*) SPRITES_MC (byte*) SPRITES_MC1 (byte*) SPRITES_MC2 (byte*) SPRITES_PRIORITY (byte*) SPRITES_XMSB (byte*) SPRITES_XPOS (byte*) SPRITES_YPOS (word) SPRITE_PTRS (byte) VIC_BMM (byte*) VIC_CONTROL (byte*) VIC_CONTROL2 (byte) VIC_CSEL (byte) VIC_DEN (byte) VIC_ECM (byte) VIC_MCM (byte*) VIC_MEMORY (byte) VIC_RSEL (byte) VIC_RST8 (byte) WHITE (byte) YELLOW interrupt(KERNEL_KEYBOARD)(void()) irq() (void()) main() Initial phi equivalence classes Complete equivalence classes INITIAL ASM //SEG0 File Comments // A minimal working IRQ //SEG1 Basic Upstart .pc = $801 "Basic" :BasicUpstart(bbegin) .pc = $80d "Program" //SEG2 Global Constants & labels .label BGCOL = $d021 // The vector used when the KERNAL serves IRQ interrupts .label KERNEL_IRQ = $314 // The colors of the C64 .const BLACK = 0 .const WHITE = 1 //SEG3 @begin bbegin: //SEG4 [1] phi from @begin to @6 [phi:@begin->@6] b6_from_bbegin: jmp b6 //SEG5 @6 b6: //SEG6 [2] call main jsr main //SEG7 [3] phi from @6 to @end [phi:@6->@end] bend_from_b6: jmp bend //SEG8 @end bend: //SEG9 main // Setup the IRQ routine main: { //SEG10 asm { sei } sei //SEG11 [5] *((const void()**) KERNEL_IRQ#0) ← &interrupt(KERNEL_KEYBOARD)(void()) irq() -- _deref_pptc1=pprc2 lda #irq sta KERNEL_IRQ+1 //SEG12 asm { cli } cli jmp breturn //SEG13 main::@return breturn: //SEG14 [7] return rts } //SEG15 irq // The Interrupt Handler irq: { //SEG16 entry interrupt(KERNEL_KEYBOARD) //SEG17 [8] *((const byte*) BGCOL#0) ← (const byte) WHITE#0 -- _deref_pbuc1=vbuc2 lda #WHITE sta BGCOL //SEG18 [9] *((const byte*) BGCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 lda #BLACK sta BGCOL jmp breturn //SEG19 irq::@return breturn: //SEG20 [10] return - exit interrupt(KERNEL_KEYBOARD) jmp $ea31 } REGISTER UPLIFT POTENTIAL REGISTERS Statement [5] *((const void()**) KERNEL_IRQ#0) ← &interrupt(KERNEL_KEYBOARD)(void()) irq() [ ] ( main:2 [ ] ) always clobbers reg byte a Statement [8] *((const byte*) BGCOL#0) ← (const byte) WHITE#0 [ ] ( [ ] ) always clobbers reg byte a Statement [9] *((const byte*) BGCOL#0) ← (const byte) BLACK#0 [ ] ( [ ] ) always clobbers reg byte a REGISTER UPLIFT SCOPES Uplift Scope [main] Uplift Scope [irq] Uplift Scope [] Uplifting [main] best 55 combination Uplifting [irq] best 55 combination Uplifting [] best 55 combination ASSEMBLER BEFORE OPTIMIZATION //SEG0 File Comments // A minimal working IRQ //SEG1 Basic Upstart .pc = $801 "Basic" :BasicUpstart(bbegin) .pc = $80d "Program" //SEG2 Global Constants & labels .label BGCOL = $d021 // The vector used when the KERNAL serves IRQ interrupts .label KERNEL_IRQ = $314 // The colors of the C64 .const BLACK = 0 .const WHITE = 1 //SEG3 @begin bbegin: //SEG4 [1] phi from @begin to @6 [phi:@begin->@6] b6_from_bbegin: jmp b6 //SEG5 @6 b6: //SEG6 [2] call main jsr main //SEG7 [3] phi from @6 to @end [phi:@6->@end] bend_from_b6: jmp bend //SEG8 @end bend: //SEG9 main // Setup the IRQ routine main: { //SEG10 asm { sei } sei //SEG11 [5] *((const void()**) KERNEL_IRQ#0) ← &interrupt(KERNEL_KEYBOARD)(void()) irq() -- _deref_pptc1=pprc2 lda #irq sta KERNEL_IRQ+1 //SEG12 asm { cli } cli jmp breturn //SEG13 main::@return breturn: //SEG14 [7] return rts } //SEG15 irq // The Interrupt Handler irq: { //SEG16 entry interrupt(KERNEL_KEYBOARD) //SEG17 [8] *((const byte*) BGCOL#0) ← (const byte) WHITE#0 -- _deref_pbuc1=vbuc2 lda #WHITE sta BGCOL //SEG18 [9] *((const byte*) BGCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 lda #BLACK sta BGCOL jmp breturn //SEG19 irq::@return breturn: //SEG20 [10] return - exit interrupt(KERNEL_KEYBOARD) jmp $ea31 } ASSEMBLER OPTIMIZATIONS Removing instruction jmp b6 Removing instruction jmp bend Removing instruction jmp breturn Removing instruction jmp breturn Succesful ASM optimization Pass5NextJumpElimination Removing instruction b6_from_bbegin: Removing instruction b6: Removing instruction bend_from_b6: Succesful ASM optimization Pass5RedundantLabelElimination Removing instruction bend: Removing instruction breturn: Removing instruction breturn: Succesful ASM optimization Pass5UnusedLabelElimination Updating BasicUpstart to call main directly Removing instruction jsr main Succesful ASM optimization Pass5SkipBegin Removing instruction bbegin: Succesful ASM optimization Pass5UnusedLabelElimination FINAL SYMBOL TABLE (label) @6 (label) @begin (label) @end (byte*) BGCOL (const byte*) BGCOL#0 BGCOL = ((byte*))(word/dword/signed dword) 53281 (byte*) BGCOL1 (byte*) BGCOL2 (byte*) BGCOL3 (byte*) BGCOL4 (byte) BLACK (const byte) BLACK#0 BLACK = (byte/signed byte/word/signed word/dword/signed dword) 0 (byte) BLUE (byte*) BORDERCOL (byte) BROWN (byte*) CHARGEN (byte*) CIA1_INTERRUPT (byte*) CIA1_PORT_A (byte*) CIA1_PORT_A_DDR (byte*) CIA1_PORT_B (byte*) CIA1_PORT_B_DDR (byte*) CIA2_INTERRUPT (byte*) CIA2_PORT_A (byte*) CIA2_PORT_A_DDR (byte*) CIA2_PORT_B (byte*) CIA2_PORT_B_DDR (byte) CIA_INTERRUPT_CLEAR (byte*) COLS (byte) CYAN (byte*) D011 (byte*) D016 (byte*) D018 (byte) DARK_GREY (byte) GREEN (byte) GREY (void()**) HARDWARE_IRQ (byte) IRQ_COLLISION_BG (byte) IRQ_COLLISION_SPRITE (byte*) IRQ_ENABLE (byte) IRQ_LIGHTPEN (byte) IRQ_RASTER (byte*) IRQ_STATUS (void()**) KERNEL_IRQ (const void()**) KERNEL_IRQ#0 KERNEL_IRQ = ((void()**))(word/signed word/dword/signed dword) 788 (byte*) LIGHTPEN_X (byte*) LIGHTPEN_Y (byte) LIGHT_BLUE (byte) LIGHT_GREEN (byte) LIGHT_GREY (byte) ORANGE (byte) PINK (byte*) PROCPORT (byte) PROCPORT_BASIC_KERNEL_IO (byte*) PROCPORT_DDR (byte) PROCPORT_DDR_MEMORY_MASK (byte) PROCPORT_KERNEL_IO (byte) PROCPORT_RAM_ALL (byte) PROCPORT_RAM_CHARROM (byte) PROCPORT_RAM_IO (byte) PURPLE (byte*) RASTER (byte) RED (byte*) SPRITES_COLS (byte*) SPRITES_ENABLE (byte*) SPRITES_EXPAND_X (byte*) SPRITES_EXPAND_Y (byte*) SPRITES_MC (byte*) SPRITES_MC1 (byte*) SPRITES_MC2 (byte*) SPRITES_PRIORITY (byte*) SPRITES_XMSB (byte*) SPRITES_XPOS (byte*) SPRITES_YPOS (word) SPRITE_PTRS (byte) VIC_BMM (byte*) VIC_CONTROL (byte*) VIC_CONTROL2 (byte) VIC_CSEL (byte) VIC_DEN (byte) VIC_ECM (byte) VIC_MCM (byte*) VIC_MEMORY (byte) VIC_RSEL (byte) VIC_RST8 (byte) WHITE (const byte) WHITE#0 WHITE = (byte/signed byte/word/signed word/dword/signed dword) 1 (byte) YELLOW interrupt(KERNEL_KEYBOARD)(void()) irq() (label) irq::@return (void()) main() (label) main::@return FINAL ASSEMBLER Score: 37 //SEG0 File Comments // A minimal working IRQ //SEG1 Basic Upstart .pc = $801 "Basic" :BasicUpstart(main) .pc = $80d "Program" //SEG2 Global Constants & labels .label BGCOL = $d021 // The vector used when the KERNAL serves IRQ interrupts .label KERNEL_IRQ = $314 // The colors of the C64 .const BLACK = 0 .const WHITE = 1 //SEG3 @begin //SEG4 [1] phi from @begin to @6 [phi:@begin->@6] //SEG5 @6 //SEG6 [2] call main //SEG7 [3] phi from @6 to @end [phi:@6->@end] //SEG8 @end //SEG9 main // Setup the IRQ routine main: { //SEG10 asm { sei } sei //SEG11 [5] *((const void()**) KERNEL_IRQ#0) ← &interrupt(KERNEL_KEYBOARD)(void()) irq() -- _deref_pptc1=pprc2 lda #irq sta KERNEL_IRQ+1 //SEG12 asm { cli } cli //SEG13 main::@return //SEG14 [7] return rts } //SEG15 irq // The Interrupt Handler irq: { //SEG16 entry interrupt(KERNEL_KEYBOARD) //SEG17 [8] *((const byte*) BGCOL#0) ← (const byte) WHITE#0 -- _deref_pbuc1=vbuc2 lda #WHITE sta BGCOL //SEG18 [9] *((const byte*) BGCOL#0) ← (const byte) BLACK#0 -- _deref_pbuc1=vbuc2 lda #BLACK sta BGCOL //SEG19 irq::@return //SEG20 [10] return - exit interrupt(KERNEL_KEYBOARD) jmp $ea31 }