mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-09-29 03:56:15 +00:00
242 lines
5.8 KiB
Plaintext
242 lines
5.8 KiB
Plaintext
Resolved forward reference irq to __interrupt(rom_sys_c64) void irq()
|
|
Inlined call vicSelectGfxBank::$0 = call toDd00 vicSelectGfxBank::gfx
|
|
|
|
CONTROL FLOW GRAPH SSA
|
|
|
|
void main()
|
|
main: scope:[main] from __start
|
|
asm { sei }
|
|
*KERNEL_IRQ = &irq
|
|
asm { cli }
|
|
to:main::@return
|
|
main::@return: scope:[main] from main
|
|
return
|
|
to:@return
|
|
|
|
__interrupt(rom_sys_c64) void irq()
|
|
irq: scope:[irq] from
|
|
*BG_COLOR = WHITE
|
|
*BG_COLOR = BLACK
|
|
to:irq::@return
|
|
irq::@return: scope:[irq] from irq
|
|
return
|
|
to:@return
|
|
|
|
void __start()
|
|
__start: scope:[__start] from
|
|
call main
|
|
to:__start::@1
|
|
__start::@1: scope:[__start] from __start
|
|
to:__start::@return
|
|
__start::@return: scope:[__start] from __start::@1
|
|
return
|
|
to:@return
|
|
|
|
SYMBOL TABLE SSA
|
|
const nomodify byte* BG_COLOR = (byte*)$d021
|
|
const nomodify byte BLACK = 0
|
|
const nomodify void()** KERNEL_IRQ = (void()**)$314
|
|
const nomodify byte WHITE = 1
|
|
void __start()
|
|
__interrupt(rom_sys_c64) void irq()
|
|
void main()
|
|
|
|
Simplifying constant pointer cast (byte*) 53281
|
|
Simplifying constant pointer cast (void()**) 788
|
|
Successful SSA optimization PassNCastSimplification
|
|
Removing unused procedure __start
|
|
Removing unused procedure block __start
|
|
Removing unused procedure block __start::@1
|
|
Removing unused procedure block __start::@return
|
|
Successful SSA optimization PassNEliminateEmptyStart
|
|
CALL GRAPH
|
|
|
|
Created 0 initial phi equivalence classes
|
|
Coalesced down to 0 phi equivalence classes
|
|
|
|
FINAL CONTROL FLOW GRAPH
|
|
|
|
__interrupt(rom_sys_c64) void irq()
|
|
irq: scope:[irq] from
|
|
[0] *BG_COLOR = WHITE
|
|
[1] *BG_COLOR = BLACK
|
|
to:irq::@return
|
|
irq::@return: scope:[irq] from irq
|
|
[2] return
|
|
to:@return
|
|
|
|
void main()
|
|
main: scope:[main] from
|
|
asm { sei }
|
|
[4] *KERNEL_IRQ = &irq
|
|
asm { cli }
|
|
to:main::@return
|
|
main::@return: scope:[main] from main
|
|
[6] return
|
|
to:@return
|
|
|
|
|
|
VARIABLE REGISTER WEIGHTS
|
|
__interrupt(rom_sys_c64) void irq()
|
|
void main()
|
|
|
|
Initial phi equivalence classes
|
|
Complete equivalence classes
|
|
REGISTER UPLIFT POTENTIAL REGISTERS
|
|
Statement [0] *BG_COLOR = WHITE [ ] ( [ ] { } ) always clobbers reg byte a
|
|
Statement [1] *BG_COLOR = BLACK [ ] ( [ ] { } ) always clobbers reg byte a
|
|
Statement [4] *KERNEL_IRQ = &irq [ ] ( [ ] { } ) always clobbers reg byte a
|
|
|
|
REGISTER UPLIFT SCOPES
|
|
Uplift Scope [MOS6526_CIA]
|
|
Uplift Scope [MOS6569_VICII]
|
|
Uplift Scope [MOS6581_SID]
|
|
Uplift Scope [main]
|
|
Uplift Scope [irq]
|
|
Uplift Scope []
|
|
|
|
Uplifting [MOS6526_CIA] best 70 combination
|
|
Uplifting [MOS6569_VICII] best 70 combination
|
|
Uplifting [MOS6581_SID] best 70 combination
|
|
Uplifting [main] best 70 combination
|
|
Uplifting [irq] best 70 combination
|
|
Uplifting [] best 70 combination
|
|
|
|
ASSEMBLER BEFORE OPTIMIZATION
|
|
// File Comments
|
|
// A minimal working IRQ
|
|
// Upstart
|
|
// Commodore 64 PRG executable file
|
|
.file [name="irq-kernel-minimal.prg", type="prg", segments="Program"]
|
|
.segmentdef Program [segments="Basic, Code, Data"]
|
|
.segmentdef Basic [start=$0801]
|
|
.segmentdef Code [start=$80d]
|
|
.segmentdef Data [startAfter="Code"]
|
|
.segment Basic
|
|
:BasicUpstart(main)
|
|
// Global Constants & labels
|
|
// The colors of the C64
|
|
.const BLACK = 0
|
|
.const WHITE = 1
|
|
.label BG_COLOR = $d021
|
|
// The vector used when the KERNAL serves IRQ interrupts
|
|
.label KERNEL_IRQ = $314
|
|
.segment Code
|
|
// irq
|
|
// The Interrupt Handler
|
|
irq: {
|
|
// interrupt(isr_rom_sys_c64_entry) -- isr_rom_sys_c64_entry
|
|
// [0] *BG_COLOR = WHITE -- _deref_pbuc1=vbuc2
|
|
lda #WHITE
|
|
sta BG_COLOR
|
|
// [1] *BG_COLOR = BLACK -- _deref_pbuc1=vbuc2
|
|
lda #BLACK
|
|
sta BG_COLOR
|
|
jmp __breturn
|
|
// irq::@return
|
|
__breturn:
|
|
// [2] return
|
|
// interrupt(isr_rom_sys_c64_exit) -- isr_rom_sys_c64_exit
|
|
jmp $ea31
|
|
}
|
|
// main
|
|
// Setup the IRQ routine
|
|
main: {
|
|
// asm { sei }
|
|
sei
|
|
// [4] *KERNEL_IRQ = &irq -- _deref_qprc1=pprc2
|
|
lda #<irq
|
|
sta KERNEL_IRQ
|
|
lda #>irq
|
|
sta KERNEL_IRQ+1
|
|
// asm { cli }
|
|
cli
|
|
jmp __breturn
|
|
// main::@return
|
|
__breturn:
|
|
// [6] return
|
|
rts
|
|
}
|
|
// File Data
|
|
|
|
ASSEMBLER OPTIMIZATIONS
|
|
Removing instruction jmp __breturn
|
|
Removing instruction jmp __breturn
|
|
Succesful ASM optimization Pass5NextJumpElimination
|
|
Removing instruction __breturn:
|
|
Removing instruction __breturn:
|
|
Succesful ASM optimization Pass5UnusedLabelElimination
|
|
|
|
FINAL SYMBOL TABLE
|
|
const nomodify byte* BG_COLOR = (byte*) 53281
|
|
const nomodify byte BLACK = 0
|
|
const nomodify void()** KERNEL_IRQ = (void()**) 788
|
|
const nomodify byte WHITE = 1
|
|
__interrupt(rom_sys_c64) void irq()
|
|
void main()
|
|
|
|
|
|
|
|
FINAL ASSEMBLER
|
|
Score: 64
|
|
|
|
// File Comments
|
|
// A minimal working IRQ
|
|
// Upstart
|
|
// Commodore 64 PRG executable file
|
|
.file [name="irq-kernel-minimal.prg", type="prg", segments="Program"]
|
|
.segmentdef Program [segments="Basic, Code, Data"]
|
|
.segmentdef Basic [start=$0801]
|
|
.segmentdef Code [start=$80d]
|
|
.segmentdef Data [startAfter="Code"]
|
|
.segment Basic
|
|
:BasicUpstart(main)
|
|
// Global Constants & labels
|
|
// The colors of the C64
|
|
.const BLACK = 0
|
|
.const WHITE = 1
|
|
.label BG_COLOR = $d021
|
|
// The vector used when the KERNAL serves IRQ interrupts
|
|
.label KERNEL_IRQ = $314
|
|
.segment Code
|
|
// irq
|
|
// The Interrupt Handler
|
|
irq: {
|
|
// interrupt(isr_rom_sys_c64_entry) -- isr_rom_sys_c64_entry
|
|
// *BG_COLOR = WHITE
|
|
// [0] *BG_COLOR = WHITE -- _deref_pbuc1=vbuc2
|
|
lda #WHITE
|
|
sta BG_COLOR
|
|
// *BG_COLOR = BLACK
|
|
// [1] *BG_COLOR = BLACK -- _deref_pbuc1=vbuc2
|
|
lda #BLACK
|
|
sta BG_COLOR
|
|
// irq::@return
|
|
// }
|
|
// [2] return
|
|
// interrupt(isr_rom_sys_c64_exit) -- isr_rom_sys_c64_exit
|
|
jmp $ea31
|
|
}
|
|
// main
|
|
// Setup the IRQ routine
|
|
main: {
|
|
// asm
|
|
// asm { sei }
|
|
sei
|
|
// *KERNEL_IRQ = &irq
|
|
// [4] *KERNEL_IRQ = &irq -- _deref_qprc1=pprc2
|
|
lda #<irq
|
|
sta KERNEL_IRQ
|
|
lda #>irq
|
|
sta KERNEL_IRQ+1
|
|
// asm
|
|
// asm { cli }
|
|
cli
|
|
// main::@return
|
|
// }
|
|
// [6] return
|
|
rts
|
|
}
|
|
// File Data
|
|
|