mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-09-29 03:56:15 +00:00
560 lines
18 KiB
Plaintext
560 lines
18 KiB
Plaintext
Resolved forward reference irq to interrupt(HARDWARE_CLOBBER)(void()) irq()
|
|
|
|
CONTROL FLOW GRAPH SSA
|
|
@begin: scope:[] from
|
|
to:@1
|
|
|
|
(void()) main()
|
|
main: scope:[main] from @2
|
|
*((const nomodify void()**) KERNEL_IRQ) ← &interrupt(HARDWARE_CLOBBER)(void()) irq()
|
|
to:main::@return
|
|
main::@return: scope:[main] from main
|
|
return
|
|
to:@return
|
|
@1: scope:[] from @begin
|
|
(volatile byte) irq_raster_next ← (byte) 0
|
|
to:@2
|
|
|
|
interrupt(HARDWARE_CLOBBER)(void()) irq()
|
|
irq: scope:[irq] from
|
|
*((const byte*) BORDER_COLOR) ← (const byte) DARK_GREY
|
|
(volatile byte) irq_raster_next ← (volatile byte) irq_raster_next + (number) $15
|
|
(byte) irq::raster_next#0 ← (volatile byte) irq_raster_next
|
|
(number~) irq::$0 ← (byte) irq::raster_next#0 & (number) 7
|
|
(bool~) irq::$1 ← (number~) irq::$0 == (number) 0
|
|
(bool~) irq::$2 ← ! (bool~) irq::$1
|
|
if((bool~) irq::$2) goto irq::@1
|
|
to:irq::@2
|
|
irq::@1: scope:[irq] from irq irq::@2
|
|
(byte) irq::raster_next#2 ← phi( irq/(byte) irq::raster_next#0 irq::@2/(byte) irq::raster_next#1 )
|
|
*((const byte*) RASTER) ← (byte) irq::raster_next#2
|
|
*((const byte*) BORDER_COLOR) ← (const byte) BLACK
|
|
to:irq::@return
|
|
irq::@2: scope:[irq] from irq
|
|
(byte) irq::raster_next#3 ← phi( irq/(byte) irq::raster_next#0 )
|
|
(byte) irq::raster_next#1 ← (byte) irq::raster_next#3 - (number) 1
|
|
to:irq::@1
|
|
irq::@return: scope:[irq] from irq::@1
|
|
return
|
|
to:@return
|
|
@2: scope:[] from @1
|
|
call main
|
|
to:@3
|
|
@3: scope:[] from @2
|
|
to:@end
|
|
@end: scope:[] from @3
|
|
|
|
SYMBOL TABLE SSA
|
|
(label) @1
|
|
(label) @2
|
|
(label) @3
|
|
(label) @begin
|
|
(label) @end
|
|
(const byte) BLACK = (byte) 0
|
|
(const byte*) BORDER_COLOR = (byte*)(number) $d020
|
|
(const byte) DARK_GREY = (byte) $b
|
|
(const nomodify void()**) KERNEL_IRQ = (void()**)(number) $314
|
|
(const byte*) RASTER = (byte*)(number) $d012
|
|
interrupt(HARDWARE_CLOBBER)(void()) irq()
|
|
(number~) irq::$0
|
|
(bool~) irq::$1
|
|
(bool~) irq::$2
|
|
(label) irq::@1
|
|
(label) irq::@2
|
|
(label) irq::@return
|
|
(byte) irq::raster_next
|
|
(byte) irq::raster_next#0
|
|
(byte) irq::raster_next#1
|
|
(byte) irq::raster_next#2
|
|
(byte) irq::raster_next#3
|
|
(volatile byte) irq_raster_next loadstore
|
|
(void()) main()
|
|
(label) main::@return
|
|
|
|
Adding number conversion cast (unumber) $15 in (volatile byte) irq_raster_next ← (volatile byte) irq_raster_next + (number) $15
|
|
Adding number conversion cast (unumber) 7 in (number~) irq::$0 ← (byte) irq::raster_next#0 & (number) 7
|
|
Adding number conversion cast (unumber) irq::$0 in (number~) irq::$0 ← (byte) irq::raster_next#0 & (unumber)(number) 7
|
|
Adding number conversion cast (unumber) 0 in (bool~) irq::$1 ← (unumber~) irq::$0 == (number) 0
|
|
Adding number conversion cast (unumber) 1 in (byte) irq::raster_next#1 ← (byte) irq::raster_next#3 - (number) 1
|
|
Successful SSA optimization PassNAddNumberTypeConversions
|
|
Simplifying constant pointer cast (void()**) 788
|
|
Simplifying constant pointer cast (byte*) 53280
|
|
Simplifying constant pointer cast (byte*) 53266
|
|
Simplifying constant integer cast $15
|
|
Simplifying constant integer cast 7
|
|
Simplifying constant integer cast 0
|
|
Simplifying constant integer cast 1
|
|
Successful SSA optimization PassNCastSimplification
|
|
Finalized unsigned number type (byte) $15
|
|
Finalized unsigned number type (byte) 7
|
|
Finalized unsigned number type (byte) 0
|
|
Finalized unsigned number type (byte) 1
|
|
Successful SSA optimization PassNFinalizeNumberTypeConversions
|
|
Inferred type updated to byte in (unumber~) irq::$0 ← (byte) irq::raster_next#0 & (byte) 7
|
|
Inversing boolean not [8] (bool~) irq::$2 ← (byte~) irq::$0 != (byte) 0 from [7] (bool~) irq::$1 ← (byte~) irq::$0 == (byte) 0
|
|
Successful SSA optimization Pass2UnaryNotSimplification
|
|
Alias irq::raster_next#0 = irq::raster_next#3
|
|
Successful SSA optimization Pass2AliasElimination
|
|
Simple Condition (bool~) irq::$2 [8] if((byte~) irq::$0!=(byte) 0) goto irq::@1
|
|
Successful SSA optimization Pass2ConditionalJumpSimplification
|
|
Added new block during phi lifting irq::@3(between irq and irq::@1)
|
|
Adding NOP phi() at start of @begin
|
|
Adding NOP phi() at start of @2
|
|
Adding NOP phi() at start of @3
|
|
Adding NOP phi() at start of @end
|
|
CALL GRAPH
|
|
Calls in [] to main:3
|
|
|
|
Created 1 initial phi equivalence classes
|
|
Coalesced [14] irq::raster_next#5 ← irq::raster_next#1
|
|
Coalesced [19] irq::raster_next#4 ← irq::raster_next#0
|
|
Coalesced down to 1 phi equivalence classes
|
|
Culled Empty Block (label) @3
|
|
Culled Empty Block (label) irq::@3
|
|
Adding NOP phi() at start of @begin
|
|
Adding NOP phi() at start of @2
|
|
Adding NOP phi() at start of @end
|
|
|
|
FINAL CONTROL FLOW GRAPH
|
|
@begin: scope:[] from
|
|
[0] phi()
|
|
to:@1
|
|
@1: scope:[] from @begin
|
|
[1] (volatile byte) irq_raster_next ← (byte) 0
|
|
to:@2
|
|
@2: scope:[] from @1
|
|
[2] phi()
|
|
[3] call main
|
|
to:@end
|
|
@end: scope:[] from @2
|
|
[4] phi()
|
|
|
|
(void()) main()
|
|
main: scope:[main] from @2
|
|
[5] *((const nomodify void()**) KERNEL_IRQ) ← &interrupt(HARDWARE_CLOBBER)(void()) irq()
|
|
to:main::@return
|
|
main::@return: scope:[main] from main
|
|
[6] return
|
|
to:@return
|
|
|
|
interrupt(HARDWARE_CLOBBER)(void()) irq()
|
|
irq: scope:[irq] from
|
|
[7] *((const byte*) BORDER_COLOR) ← (const byte) DARK_GREY
|
|
[8] (volatile byte) irq_raster_next ← (volatile byte) irq_raster_next + (byte) $15
|
|
[9] (byte) irq::raster_next#0 ← (volatile byte) irq_raster_next
|
|
[10] (byte~) irq::$0 ← (byte) irq::raster_next#0 & (byte) 7
|
|
[11] if((byte~) irq::$0!=(byte) 0) goto irq::@1
|
|
to:irq::@2
|
|
irq::@2: scope:[irq] from irq
|
|
[12] (byte) irq::raster_next#1 ← (byte) irq::raster_next#0 - (byte) 1
|
|
to:irq::@1
|
|
irq::@1: scope:[irq] from irq irq::@2
|
|
[13] (byte) irq::raster_next#2 ← phi( irq/(byte) irq::raster_next#0 irq::@2/(byte) irq::raster_next#1 )
|
|
[14] *((const byte*) RASTER) ← (byte) irq::raster_next#2
|
|
[15] *((const byte*) BORDER_COLOR) ← (const byte) BLACK
|
|
to:irq::@return
|
|
irq::@return: scope:[irq] from irq::@1
|
|
[16] return
|
|
to:@return
|
|
|
|
|
|
VARIABLE REGISTER WEIGHTS
|
|
interrupt(HARDWARE_CLOBBER)(void()) irq()
|
|
(byte~) irq::$0 4.0
|
|
(byte) irq::raster_next
|
|
(byte) irq::raster_next#0 2.6666666666666665
|
|
(byte) irq::raster_next#1 4.0
|
|
(byte) irq::raster_next#2 6.0
|
|
(volatile byte) irq_raster_next loadstore 4.0
|
|
(void()) main()
|
|
|
|
Initial phi equivalence classes
|
|
[ irq::raster_next#2 irq::raster_next#0 irq::raster_next#1 ]
|
|
Added variable irq_raster_next to live range equivalence class [ irq_raster_next ]
|
|
Added variable irq::$0 to live range equivalence class [ irq::$0 ]
|
|
Complete equivalence classes
|
|
[ irq::raster_next#2 irq::raster_next#0 irq::raster_next#1 ]
|
|
[ irq_raster_next ]
|
|
[ irq::$0 ]
|
|
Allocated zp[1]:2 [ irq::raster_next#2 irq::raster_next#0 irq::raster_next#1 ]
|
|
Allocated zp[1]:3 [ irq_raster_next ]
|
|
Allocated zp[1]:4 [ irq::$0 ]
|
|
|
|
INITIAL ASM
|
|
Target platform is c64basic / MOS6502X
|
|
// File Comments
|
|
// Upstart
|
|
.pc = $801 "Basic"
|
|
:BasicUpstart(__bbegin)
|
|
.pc = $80d "Program"
|
|
// Global Constants & labels
|
|
.const DARK_GREY = $b
|
|
.const BLACK = 0
|
|
.label KERNEL_IRQ = $314
|
|
.label BORDER_COLOR = $d020
|
|
.label RASTER = $d012
|
|
.label irq_raster_next = 3
|
|
// @begin
|
|
__bbegin:
|
|
jmp __b1
|
|
// @1
|
|
__b1:
|
|
// [1] (volatile byte) irq_raster_next ← (byte) 0 -- vbuz1=vbuc1
|
|
lda #0
|
|
sta.z irq_raster_next
|
|
// [2] phi from @1 to @2 [phi:@1->@2]
|
|
__b2_from___b1:
|
|
jmp __b2
|
|
// @2
|
|
__b2:
|
|
// [3] call main
|
|
jsr main
|
|
// [4] phi from @2 to @end [phi:@2->@end]
|
|
__bend_from___b2:
|
|
jmp __bend
|
|
// @end
|
|
__bend:
|
|
// main
|
|
main: {
|
|
// [5] *((const nomodify void()**) KERNEL_IRQ) ← &interrupt(HARDWARE_CLOBBER)(void()) irq() -- _deref_pptc1=pprc2
|
|
lda #<irq
|
|
sta KERNEL_IRQ
|
|
lda #>irq
|
|
sta KERNEL_IRQ+1
|
|
jmp __breturn
|
|
// main::@return
|
|
__breturn:
|
|
// [6] return
|
|
rts
|
|
}
|
|
// irq
|
|
irq: {
|
|
.label __0 = 4
|
|
.label raster_next = 2
|
|
// entry interrupt(HARDWARE_CLOBBER)
|
|
sta rega+1
|
|
stx regx+1
|
|
sty regy+1
|
|
// [7] *((const byte*) BORDER_COLOR) ← (const byte) DARK_GREY -- _deref_pbuc1=vbuc2
|
|
lda #DARK_GREY
|
|
sta BORDER_COLOR
|
|
// [8] (volatile byte) irq_raster_next ← (volatile byte) irq_raster_next + (byte) $15 -- vbuz1=vbuz1_plus_vbuc1
|
|
lax.z irq_raster_next
|
|
axs #-[$15]
|
|
stx.z irq_raster_next
|
|
// [9] (byte) irq::raster_next#0 ← (volatile byte) irq_raster_next -- vbuz1=vbuz2
|
|
// Setup next interrupt
|
|
lda.z irq_raster_next
|
|
sta.z raster_next
|
|
// [10] (byte~) irq::$0 ← (byte) irq::raster_next#0 & (byte) 7 -- vbuz1=vbuz2_band_vbuc1
|
|
lda #7
|
|
and.z raster_next
|
|
sta.z __0
|
|
// [11] if((byte~) irq::$0!=(byte) 0) goto irq::@1 -- vbuz1_neq_0_then_la1
|
|
lda.z __0
|
|
cmp #0
|
|
bne __b1_from_irq
|
|
jmp __b2
|
|
// irq::@2
|
|
__b2:
|
|
// [12] (byte) irq::raster_next#1 ← (byte) irq::raster_next#0 - (byte) 1 -- vbuz1=vbuz1_minus_1
|
|
dec.z raster_next
|
|
// [13] phi from irq irq::@2 to irq::@1 [phi:irq/irq::@2->irq::@1]
|
|
__b1_from_irq:
|
|
__b1_from___b2:
|
|
// [13] phi (byte) irq::raster_next#2 = (byte) irq::raster_next#0 [phi:irq/irq::@2->irq::@1#0] -- register_copy
|
|
jmp __b1
|
|
// irq::@1
|
|
__b1:
|
|
// [14] *((const byte*) RASTER) ← (byte) irq::raster_next#2 -- _deref_pbuc1=vbuz1
|
|
lda.z raster_next
|
|
sta RASTER
|
|
// [15] *((const byte*) BORDER_COLOR) ← (const byte) BLACK -- _deref_pbuc1=vbuc2
|
|
lda #BLACK
|
|
sta BORDER_COLOR
|
|
jmp __breturn
|
|
// irq::@return
|
|
__breturn:
|
|
// [16] return - exit interrupt(HARDWARE_CLOBBER)
|
|
rega:
|
|
lda #00
|
|
regx:
|
|
ldx #00
|
|
regy:
|
|
ldy #00
|
|
rti
|
|
}
|
|
// File Data
|
|
|
|
REGISTER UPLIFT POTENTIAL REGISTERS
|
|
Statement [1] (volatile byte) irq_raster_next ← (byte) 0 [ ] ( [ ] { } ) always clobbers reg byte a
|
|
Statement [5] *((const nomodify void()**) KERNEL_IRQ) ← &interrupt(HARDWARE_CLOBBER)(void()) irq() [ ] ( main:3 [ ] { } ) always clobbers reg byte a
|
|
Statement [7] *((const byte*) BORDER_COLOR) ← (const byte) DARK_GREY [ irq_raster_next ] ( [ irq_raster_next ] { } ) always clobbers reg byte a
|
|
Statement [8] (volatile byte) irq_raster_next ← (volatile byte) irq_raster_next + (byte) $15 [ irq_raster_next ] ( [ irq_raster_next ] { } ) always clobbers reg byte a reg byte x
|
|
Statement [15] *((const byte*) BORDER_COLOR) ← (const byte) BLACK [ ] ( [ ] { } ) always clobbers reg byte a
|
|
Statement [16] return [ ] ( [ ] { } ) always clobbers reg byte a reg byte x reg byte y
|
|
Potential registers zp[1]:2 [ irq::raster_next#2 irq::raster_next#0 irq::raster_next#1 ] : zp[1]:2 , reg byte a , reg byte x , reg byte y ,
|
|
Potential registers zp[1]:3 [ irq_raster_next ] : zp[1]:3 ,
|
|
Potential registers zp[1]:4 [ irq::$0 ] : zp[1]:4 , reg byte a , reg byte x , reg byte y ,
|
|
|
|
REGISTER UPLIFT SCOPES
|
|
Uplift Scope [irq] 12.67: zp[1]:2 [ irq::raster_next#2 irq::raster_next#0 irq::raster_next#1 ] 4: zp[1]:4 [ irq::$0 ]
|
|
Uplift Scope [] 4: zp[1]:3 [ irq_raster_next ]
|
|
Uplift Scope [main]
|
|
|
|
Uplifting [irq] best 246 combination reg byte x [ irq::raster_next#2 irq::raster_next#0 irq::raster_next#1 ] reg byte a [ irq::$0 ]
|
|
Uplifting [] best 246 combination zp[1]:3 [ irq_raster_next ]
|
|
Uplifting [main] best 246 combination
|
|
Attempting to uplift remaining variables inzp[1]:3 [ irq_raster_next ]
|
|
Uplifting [] best 246 combination zp[1]:3 [ irq_raster_next ]
|
|
Allocated (was zp[1]:3) zp[1]:2 [ irq_raster_next ]
|
|
Interrupt procedure irq clobbers AXCNZ
|
|
Removing interrupt register storage sty regy+1 in 16 entry interrupt(HARDWARE_CLOBBER)
|
|
Removing interrupt register storage regy: in 30 [16] return - exit interrupt(HARDWARE_CLOBBER)
|
|
Removing interrupt register storage ldy #00 in 30 [16] return - exit interrupt(HARDWARE_CLOBBER)
|
|
|
|
ASSEMBLER BEFORE OPTIMIZATION
|
|
// File Comments
|
|
// Upstart
|
|
.pc = $801 "Basic"
|
|
:BasicUpstart(__bbegin)
|
|
.pc = $80d "Program"
|
|
// Global Constants & labels
|
|
.const DARK_GREY = $b
|
|
.const BLACK = 0
|
|
.label KERNEL_IRQ = $314
|
|
.label BORDER_COLOR = $d020
|
|
.label RASTER = $d012
|
|
.label irq_raster_next = 2
|
|
// @begin
|
|
__bbegin:
|
|
jmp __b1
|
|
// @1
|
|
__b1:
|
|
// [1] (volatile byte) irq_raster_next ← (byte) 0 -- vbuz1=vbuc1
|
|
lda #0
|
|
sta.z irq_raster_next
|
|
// [2] phi from @1 to @2 [phi:@1->@2]
|
|
__b2_from___b1:
|
|
jmp __b2
|
|
// @2
|
|
__b2:
|
|
// [3] call main
|
|
jsr main
|
|
// [4] phi from @2 to @end [phi:@2->@end]
|
|
__bend_from___b2:
|
|
jmp __bend
|
|
// @end
|
|
__bend:
|
|
// main
|
|
main: {
|
|
// [5] *((const nomodify void()**) KERNEL_IRQ) ← &interrupt(HARDWARE_CLOBBER)(void()) irq() -- _deref_pptc1=pprc2
|
|
lda #<irq
|
|
sta KERNEL_IRQ
|
|
lda #>irq
|
|
sta KERNEL_IRQ+1
|
|
jmp __breturn
|
|
// main::@return
|
|
__breturn:
|
|
// [6] return
|
|
rts
|
|
}
|
|
// irq
|
|
irq: {
|
|
// entry interrupt(HARDWARE_CLOBBER)
|
|
sta rega+1
|
|
stx regx+1
|
|
// [7] *((const byte*) BORDER_COLOR) ← (const byte) DARK_GREY -- _deref_pbuc1=vbuc2
|
|
lda #DARK_GREY
|
|
sta BORDER_COLOR
|
|
// [8] (volatile byte) irq_raster_next ← (volatile byte) irq_raster_next + (byte) $15 -- vbuz1=vbuz1_plus_vbuc1
|
|
lax.z irq_raster_next
|
|
axs #-[$15]
|
|
stx.z irq_raster_next
|
|
// [9] (byte) irq::raster_next#0 ← (volatile byte) irq_raster_next -- vbuxx=vbuz1
|
|
// Setup next interrupt
|
|
ldx.z irq_raster_next
|
|
// [10] (byte~) irq::$0 ← (byte) irq::raster_next#0 & (byte) 7 -- vbuaa=vbuxx_band_vbuc1
|
|
txa
|
|
and #7
|
|
// [11] if((byte~) irq::$0!=(byte) 0) goto irq::@1 -- vbuaa_neq_0_then_la1
|
|
cmp #0
|
|
bne __b1_from_irq
|
|
jmp __b2
|
|
// irq::@2
|
|
__b2:
|
|
// [12] (byte) irq::raster_next#1 ← (byte) irq::raster_next#0 - (byte) 1 -- vbuxx=vbuxx_minus_1
|
|
dex
|
|
// [13] phi from irq irq::@2 to irq::@1 [phi:irq/irq::@2->irq::@1]
|
|
__b1_from_irq:
|
|
__b1_from___b2:
|
|
// [13] phi (byte) irq::raster_next#2 = (byte) irq::raster_next#0 [phi:irq/irq::@2->irq::@1#0] -- register_copy
|
|
jmp __b1
|
|
// irq::@1
|
|
__b1:
|
|
// [14] *((const byte*) RASTER) ← (byte) irq::raster_next#2 -- _deref_pbuc1=vbuxx
|
|
stx RASTER
|
|
// [15] *((const byte*) BORDER_COLOR) ← (const byte) BLACK -- _deref_pbuc1=vbuc2
|
|
lda #BLACK
|
|
sta BORDER_COLOR
|
|
jmp __breturn
|
|
// irq::@return
|
|
__breturn:
|
|
// [16] return - exit interrupt(HARDWARE_CLOBBER)
|
|
rega:
|
|
lda #00
|
|
regx:
|
|
ldx #00
|
|
rti
|
|
}
|
|
// File Data
|
|
|
|
ASSEMBLER OPTIMIZATIONS
|
|
Removing instruction jmp __b1
|
|
Removing instruction jmp __b2
|
|
Removing instruction jmp __bend
|
|
Removing instruction jmp __breturn
|
|
Removing instruction jmp __b2
|
|
Removing instruction jmp __b1
|
|
Removing instruction jmp __breturn
|
|
Succesful ASM optimization Pass5NextJumpElimination
|
|
Removing instruction ldx.z irq_raster_next
|
|
Succesful ASM optimization Pass5UnnecesaryLoadElimination
|
|
Replacing label __b1_from_irq with __b1
|
|
Removing instruction __b1:
|
|
Removing instruction __b2_from___b1:
|
|
Removing instruction __bend_from___b2:
|
|
Removing instruction __b1_from_irq:
|
|
Removing instruction __b1_from___b2:
|
|
Removing instruction __breturn:
|
|
Succesful ASM optimization Pass5RedundantLabelElimination
|
|
Removing instruction __b2:
|
|
Removing instruction __bend:
|
|
Removing instruction __breturn:
|
|
Removing instruction __b2:
|
|
Succesful ASM optimization Pass5UnusedLabelElimination
|
|
Adding RTS to root block
|
|
Succesful ASM optimization Pass5AddMainRts
|
|
|
|
FINAL SYMBOL TABLE
|
|
(label) @1
|
|
(label) @2
|
|
(label) @begin
|
|
(label) @end
|
|
(const byte) BLACK = (byte) 0
|
|
(const byte*) BORDER_COLOR = (byte*) 53280
|
|
(const byte) DARK_GREY = (byte) $b
|
|
(const nomodify void()**) KERNEL_IRQ = (void()**) 788
|
|
(const byte*) RASTER = (byte*) 53266
|
|
interrupt(HARDWARE_CLOBBER)(void()) irq()
|
|
(byte~) irq::$0 reg byte a 4.0
|
|
(label) irq::@1
|
|
(label) irq::@2
|
|
(label) irq::@return
|
|
(byte) irq::raster_next
|
|
(byte) irq::raster_next#0 reg byte x 2.6666666666666665
|
|
(byte) irq::raster_next#1 reg byte x 4.0
|
|
(byte) irq::raster_next#2 reg byte x 6.0
|
|
(volatile byte) irq_raster_next loadstore zp[1]:2 4.0
|
|
(void()) main()
|
|
(label) main::@return
|
|
|
|
reg byte x [ irq::raster_next#2 irq::raster_next#0 irq::raster_next#1 ]
|
|
zp[1]:2 [ irq_raster_next ]
|
|
reg byte a [ irq::$0 ]
|
|
|
|
|
|
FINAL ASSEMBLER
|
|
Score: 159
|
|
|
|
// File Comments
|
|
// Upstart
|
|
.pc = $801 "Basic"
|
|
:BasicUpstart(__bbegin)
|
|
.pc = $80d "Program"
|
|
// Global Constants & labels
|
|
.const DARK_GREY = $b
|
|
.const BLACK = 0
|
|
.label KERNEL_IRQ = $314
|
|
.label BORDER_COLOR = $d020
|
|
.label RASTER = $d012
|
|
.label irq_raster_next = 2
|
|
// @begin
|
|
__bbegin:
|
|
// @1
|
|
// irq_raster_next = 0
|
|
// [1] (volatile byte) irq_raster_next ← (byte) 0 -- vbuz1=vbuc1
|
|
lda #0
|
|
sta.z irq_raster_next
|
|
// [2] phi from @1 to @2 [phi:@1->@2]
|
|
// @2
|
|
// [3] call main
|
|
jsr main
|
|
rts
|
|
// [4] phi from @2 to @end [phi:@2->@end]
|
|
// @end
|
|
// main
|
|
main: {
|
|
// *KERNEL_IRQ = &irq
|
|
// [5] *((const nomodify void()**) KERNEL_IRQ) ← &interrupt(HARDWARE_CLOBBER)(void()) irq() -- _deref_pptc1=pprc2
|
|
lda #<irq
|
|
sta KERNEL_IRQ
|
|
lda #>irq
|
|
sta KERNEL_IRQ+1
|
|
// main::@return
|
|
// }
|
|
// [6] return
|
|
rts
|
|
}
|
|
// irq
|
|
irq: {
|
|
// entry interrupt(HARDWARE_CLOBBER)
|
|
sta rega+1
|
|
stx regx+1
|
|
// *BORDER_COLOR = DARK_GREY
|
|
// [7] *((const byte*) BORDER_COLOR) ← (const byte) DARK_GREY -- _deref_pbuc1=vbuc2
|
|
lda #DARK_GREY
|
|
sta BORDER_COLOR
|
|
// irq_raster_next += 21
|
|
// [8] (volatile byte) irq_raster_next ← (volatile byte) irq_raster_next + (byte) $15 -- vbuz1=vbuz1_plus_vbuc1
|
|
lax.z irq_raster_next
|
|
axs #-[$15]
|
|
stx.z irq_raster_next
|
|
// raster_next = irq_raster_next
|
|
// [9] (byte) irq::raster_next#0 ← (volatile byte) irq_raster_next -- vbuxx=vbuz1
|
|
// Setup next interrupt
|
|
// raster_next&7
|
|
// [10] (byte~) irq::$0 ← (byte) irq::raster_next#0 & (byte) 7 -- vbuaa=vbuxx_band_vbuc1
|
|
txa
|
|
and #7
|
|
// if((raster_next&7)==0)
|
|
// [11] if((byte~) irq::$0!=(byte) 0) goto irq::@1 -- vbuaa_neq_0_then_la1
|
|
cmp #0
|
|
bne __b1
|
|
// irq::@2
|
|
// raster_next -=1
|
|
// [12] (byte) irq::raster_next#1 ← (byte) irq::raster_next#0 - (byte) 1 -- vbuxx=vbuxx_minus_1
|
|
dex
|
|
// [13] phi from irq irq::@2 to irq::@1 [phi:irq/irq::@2->irq::@1]
|
|
// [13] phi (byte) irq::raster_next#2 = (byte) irq::raster_next#0 [phi:irq/irq::@2->irq::@1#0] -- register_copy
|
|
// irq::@1
|
|
__b1:
|
|
// *RASTER = raster_next
|
|
// [14] *((const byte*) RASTER) ← (byte) irq::raster_next#2 -- _deref_pbuc1=vbuxx
|
|
stx RASTER
|
|
// *BORDER_COLOR = BLACK
|
|
// [15] *((const byte*) BORDER_COLOR) ← (const byte) BLACK -- _deref_pbuc1=vbuc2
|
|
lda #BLACK
|
|
sta BORDER_COLOR
|
|
// irq::@return
|
|
// }
|
|
// [16] return - exit interrupt(HARDWARE_CLOBBER)
|
|
rega:
|
|
lda #00
|
|
regx:
|
|
ldx #00
|
|
rti
|
|
}
|
|
// File Data
|
|
|