1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2025-08-08 13:25:12 +00:00

Improved test.

This commit is contained in:
jespergravgaard
2020-11-06 08:21:23 +01:00
parent 0e9a7e94ca
commit d905298115
6 changed files with 101 additions and 106 deletions

View File

@@ -53,7 +53,7 @@ public class TestPrograms {
@Test @Test
public void testConstVolatileProblem1() throws IOException, URISyntaxException { public void testConstVolatileProblem1() throws IOException, URISyntaxException {
compileAndCompare("const-volatile-problem.c", log()); compileAndCompare("const-volatile-problem.c");
} }
@Test @Test

View File

@@ -5,20 +5,20 @@
// A potential fix is https://gitlab.com/camelot/kickc/-/issues/430 // A potential fix is https://gitlab.com/camelot/kickc/-/issues/430
// The address of the sprite pointers on the current screen (screen+0x3f8). // The address of the sprite pointers on the current screen (screen+0x3f8).
char* PLEX_SCREEN_PTR1 = 0x400+0x3f8; char* PLEX_SCREEN_PTR1 = 0x400;
char* PLEX_SCREEN_PTR2 = 0x400+0x3f8; char* PLEX_SCREEN_PTR2 = 0x500;
volatile char plex_sprite_idx = 0; volatile char idx = 0;
void()** const IRQ = 0x314; void()** const IRQ = 0x314;
void main() { void main() {
PLEX_SCREEN_PTR1 = 0x400+0x3f8; PLEX_SCREEN_PTR1 = 0x400;
*IRQ = &irq; *IRQ = &irq;
} }
// Interrupt Routine // Interrupt Routine
interrupt(kernel_keyboard) void irq() { interrupt(kernel_keyboard) void irq() {
PLEX_SCREEN_PTR1[plex_sprite_idx] = 7; PLEX_SCREEN_PTR1[idx]++;
PLEX_SCREEN_PTR2[plex_sprite_idx] = 7; PLEX_SCREEN_PTR2[idx]++;
plex_sprite_idx++; idx++;
} }

View File

@@ -7,27 +7,30 @@
:BasicUpstart(__start) :BasicUpstart(__start)
.pc = $80d "Program" .pc = $80d "Program"
.label IRQ = $314 .label IRQ = $314
.label PLEX_SCREEN_PTR2 = $400+$3f8 .label PLEX_SCREEN_PTR2 = $500
.label plex_sprite_idx = 4 .label idx = 4
// The address of the sprite pointers on the current screen (screen+0x3f8). // The address of the sprite pointers on the current screen (screen+0x3f8).
.label PLEX_SCREEN_PTR1 = 2 .label PLEX_SCREEN_PTR1 = 2
__start: { __start: {
// plex_sprite_idx = 0 // idx = 0
lda #0 lda #0
sta.z plex_sprite_idx sta.z idx
jsr main jsr main
rts rts
} }
// Interrupt Routine // Interrupt Routine
irq: { irq: {
// PLEX_SCREEN_PTR1[plex_sprite_idx] = 7 // PLEX_SCREEN_PTR1[idx]++;
lda #7 ldy.z idx
ldy.z plex_sprite_idx lda (PLEX_SCREEN_PTR1),y
clc
adc #1
sta (PLEX_SCREEN_PTR1),y sta (PLEX_SCREEN_PTR1),y
// PLEX_SCREEN_PTR2[plex_sprite_idx] = 7 // PLEX_SCREEN_PTR2[idx]++;
sta PLEX_SCREEN_PTR2,y ldx.z idx
// plex_sprite_idx++; inc PLEX_SCREEN_PTR2,x
inc.z plex_sprite_idx // idx++;
inc.z idx
// } // }
jmp $ea31 jmp $ea31
} }

View File

@@ -4,7 +4,7 @@ __start: scope:[__start] from
[0] phi() [0] phi()
to:__start::__init1 to:__start::__init1
__start::__init1: scope:[__start] from __start __start::__init1: scope:[__start] from __start
[1] plex_sprite_idx = 0 [1] idx = 0
to:__start::@1 to:__start::@1
__start::@1: scope:[__start] from __start::__init1 __start::@1: scope:[__start] from __start::__init1
[2] phi() [2] phi()
@@ -17,9 +17,9 @@ __start::@return: scope:[__start] from __start::@1
interrupt(KERNEL_KEYBOARD) void irq() interrupt(KERNEL_KEYBOARD) void irq()
irq: scope:[irq] from irq: scope:[irq] from
[5] PLEX_SCREEN_PTR1#6 = phi( ) [5] PLEX_SCREEN_PTR1#6 = phi( )
[6] PLEX_SCREEN_PTR1#6[plex_sprite_idx] = 7 [6] PLEX_SCREEN_PTR1#6[idx] = ++ PLEX_SCREEN_PTR1#6[idx]
[7] PLEX_SCREEN_PTR2[plex_sprite_idx] = 7 [7] PLEX_SCREEN_PTR2[idx] = ++ PLEX_SCREEN_PTR2[idx]
[8] plex_sprite_idx = ++ plex_sprite_idx [8] idx = ++ idx
to:irq::@return to:irq::@return
irq::@return: scope:[irq] from irq irq::@return: scope:[irq] from irq
[9] return [9] return

View File

@@ -5,7 +5,7 @@ CONTROL FLOW GRAPH SSA
void main() void main()
main: scope:[main] from __start::@1 main: scope:[main] from __start::@1
PLEX_SCREEN_PTR1#0 = ((byte*)) $400+$3f8 PLEX_SCREEN_PTR1#0 = ((byte*)) $400
*IRQ = &irq *IRQ = &irq
to:main::@return to:main::@return
main::@return: scope:[main] from main main::@return: scope:[main] from main
@@ -17,9 +17,9 @@ main::@return: scope:[main] from main
interrupt(KERNEL_KEYBOARD) void irq() interrupt(KERNEL_KEYBOARD) void irq()
irq: scope:[irq] from irq: scope:[irq] from
PLEX_SCREEN_PTR1#6 = phi( ) PLEX_SCREEN_PTR1#6 = phi( )
PLEX_SCREEN_PTR1#6[plex_sprite_idx] = 7 PLEX_SCREEN_PTR1#6[idx] = ++ PLEX_SCREEN_PTR1#6[idx]
PLEX_SCREEN_PTR2[plex_sprite_idx] = 7 PLEX_SCREEN_PTR2[idx] = ++ PLEX_SCREEN_PTR2[idx]
plex_sprite_idx = ++ plex_sprite_idx idx = ++ idx
to:irq::@return to:irq::@return
irq::@return: scope:[irq] from irq irq::@return: scope:[irq] from irq
return return
@@ -29,8 +29,8 @@ void __start()
__start: scope:[__start] from __start: scope:[__start] from
to:__start::__init1 to:__start::__init1
__start::__init1: scope:[__start] from __start __start::__init1: scope:[__start] from __start
PLEX_SCREEN_PTR1#2 = (byte*)$400+$3f8 PLEX_SCREEN_PTR1#2 = (byte*)$400
plex_sprite_idx = 0 idx = 0
to:__start::@1 to:__start::@1
__start::@1: scope:[__start] from __start::__init1 __start::@1: scope:[__start] from __start::__init1
PLEX_SCREEN_PTR1#9 = phi( __start::__init1/PLEX_SCREEN_PTR1#2 ) PLEX_SCREEN_PTR1#9 = phi( __start::__init1/PLEX_SCREEN_PTR1#2 )
@@ -59,36 +59,27 @@ byte* PLEX_SCREEN_PTR1#6
byte* PLEX_SCREEN_PTR1#7 byte* PLEX_SCREEN_PTR1#7
byte* PLEX_SCREEN_PTR1#8 byte* PLEX_SCREEN_PTR1#8
byte* PLEX_SCREEN_PTR1#9 byte* PLEX_SCREEN_PTR1#9
const byte* PLEX_SCREEN_PTR2 = (byte*)$400+$3f8 const byte* PLEX_SCREEN_PTR2 = (byte*)$500
void __start() void __start()
volatile byte idx loadstore
interrupt(KERNEL_KEYBOARD) void irq() interrupt(KERNEL_KEYBOARD) void irq()
void main() void main()
volatile byte plex_sprite_idx loadstore
Adding number conversion cast (unumber) 7 in PLEX_SCREEN_PTR1#6[plex_sprite_idx] = 7 Inlining cast PLEX_SCREEN_PTR1#0 = (byte*)$400
Adding number conversion cast (unumber) 7 in PLEX_SCREEN_PTR2[plex_sprite_idx] = 7
Successful SSA optimization PassNAddNumberTypeConversions
Inlining cast PLEX_SCREEN_PTR1#0 = (byte*)$400+$3f8
Inlining cast PLEX_SCREEN_PTR1#6[plex_sprite_idx] = (unumber)7
Inlining cast PLEX_SCREEN_PTR2[plex_sprite_idx] = (unumber)7
Successful SSA optimization Pass2InlineCast Successful SSA optimization Pass2InlineCast
Simplifying constant pointer cast (void()**) 788 Simplifying constant pointer cast (void()**) 788
Simplifying constant integer cast 7 Simplifying constant pointer cast (byte*) 1280
Simplifying constant integer cast 7 Simplifying constant pointer cast (byte*) 1024
Simplifying constant pointer cast (byte*) 1024
Successful SSA optimization PassNCastSimplification Successful SSA optimization PassNCastSimplification
Finalized unsigned number type 7
Finalized unsigned number type 7
Successful SSA optimization PassNFinalizeNumberTypeConversions
Alias PLEX_SCREEN_PTR1#0 = PLEX_SCREEN_PTR1#5 PLEX_SCREEN_PTR1#1 Alias PLEX_SCREEN_PTR1#0 = PLEX_SCREEN_PTR1#5 PLEX_SCREEN_PTR1#1
Alias PLEX_SCREEN_PTR1#2 = PLEX_SCREEN_PTR1#9 Alias PLEX_SCREEN_PTR1#2 = PLEX_SCREEN_PTR1#9
Alias PLEX_SCREEN_PTR1#3 = PLEX_SCREEN_PTR1#7 PLEX_SCREEN_PTR1#8 PLEX_SCREEN_PTR1#4 Alias PLEX_SCREEN_PTR1#3 = PLEX_SCREEN_PTR1#7 PLEX_SCREEN_PTR1#8 PLEX_SCREEN_PTR1#4
Successful SSA optimization Pass2AliasElimination Successful SSA optimization Pass2AliasElimination
Identical Phi Values PLEX_SCREEN_PTR1#3 PLEX_SCREEN_PTR1#0 Identical Phi Values PLEX_SCREEN_PTR1#3 PLEX_SCREEN_PTR1#0
Successful SSA optimization Pass2IdenticalPhiElimination Successful SSA optimization Pass2IdenticalPhiElimination
Constant right-side identified [0] PLEX_SCREEN_PTR1#0 = (byte*)$400+$3f8 Constant PLEX_SCREEN_PTR1#0 = (byte*) 1024
Successful SSA optimization Pass2ConstantRValueConsolidation Constant PLEX_SCREEN_PTR1#2 = (byte*) 1024
Constant PLEX_SCREEN_PTR1#0 = (byte*)$400+$3f8
Constant PLEX_SCREEN_PTR1#2 = (byte*)$400+$3f8
Successful SSA optimization Pass2ConstantIdentification Successful SSA optimization Pass2ConstantIdentification
Eliminating unused constant PLEX_SCREEN_PTR1#0 Eliminating unused constant PLEX_SCREEN_PTR1#0
Eliminating unused constant PLEX_SCREEN_PTR1#2 Eliminating unused constant PLEX_SCREEN_PTR1#2
@@ -112,7 +103,7 @@ __start: scope:[__start] from
[0] phi() [0] phi()
to:__start::__init1 to:__start::__init1
__start::__init1: scope:[__start] from __start __start::__init1: scope:[__start] from __start
[1] plex_sprite_idx = 0 [1] idx = 0
to:__start::@1 to:__start::@1
__start::@1: scope:[__start] from __start::__init1 __start::@1: scope:[__start] from __start::__init1
[2] phi() [2] phi()
@@ -125,9 +116,9 @@ __start::@return: scope:[__start] from __start::@1
interrupt(KERNEL_KEYBOARD) void irq() interrupt(KERNEL_KEYBOARD) void irq()
irq: scope:[irq] from irq: scope:[irq] from
[5] PLEX_SCREEN_PTR1#6 = phi( ) [5] PLEX_SCREEN_PTR1#6 = phi( )
[6] PLEX_SCREEN_PTR1#6[plex_sprite_idx] = 7 [6] PLEX_SCREEN_PTR1#6[idx] = ++ PLEX_SCREEN_PTR1#6[idx]
[7] PLEX_SCREEN_PTR2[plex_sprite_idx] = 7 [7] PLEX_SCREEN_PTR2[idx] = ++ PLEX_SCREEN_PTR2[idx]
[8] plex_sprite_idx = ++ plex_sprite_idx [8] idx = ++ idx
to:irq::@return to:irq::@return
irq::@return: scope:[irq] from irq irq::@return: scope:[irq] from irq
[9] return [9] return
@@ -144,40 +135,40 @@ main::@return: scope:[main] from main
VARIABLE REGISTER WEIGHTS VARIABLE REGISTER WEIGHTS
byte* PLEX_SCREEN_PTR1 byte* PLEX_SCREEN_PTR1
byte* PLEX_SCREEN_PTR1#6 2.0 byte* PLEX_SCREEN_PTR1#6 4.0
void __start() void __start()
volatile byte idx loadstore 4.666666666666666
interrupt(KERNEL_KEYBOARD) void irq() interrupt(KERNEL_KEYBOARD) void irq()
void main() void main()
volatile byte plex_sprite_idx loadstore 3.333333333333333
Initial phi equivalence classes Initial phi equivalence classes
[ PLEX_SCREEN_PTR1#6 ] [ PLEX_SCREEN_PTR1#6 ]
Added variable plex_sprite_idx to live range equivalence class [ plex_sprite_idx ] Added variable idx to live range equivalence class [ idx ]
Complete equivalence classes Complete equivalence classes
[ PLEX_SCREEN_PTR1#6 ] [ PLEX_SCREEN_PTR1#6 ]
[ plex_sprite_idx ] [ idx ]
Allocated zp[2]:2 [ PLEX_SCREEN_PTR1#6 ] Allocated zp[2]:2 [ PLEX_SCREEN_PTR1#6 ]
Allocated zp[1]:4 [ plex_sprite_idx ] Allocated zp[1]:4 [ idx ]
REGISTER UPLIFT POTENTIAL REGISTERS REGISTER UPLIFT POTENTIAL REGISTERS
Statement [1] plex_sprite_idx = 0 [ ] ( [ ] { } ) always clobbers reg byte a Statement [1] idx = 0 [ ] ( [ ] { } ) always clobbers reg byte a
Statement [6] PLEX_SCREEN_PTR1#6[plex_sprite_idx] = 7 [ plex_sprite_idx ] ( [ plex_sprite_idx ] { } ) always clobbers reg byte a reg byte y Statement [6] PLEX_SCREEN_PTR1#6[idx] = ++ PLEX_SCREEN_PTR1#6[idx] [ idx ] ( [ idx ] { } ) always clobbers reg byte a reg byte y
Statement [7] PLEX_SCREEN_PTR2[plex_sprite_idx] = 7 [ plex_sprite_idx ] ( [ plex_sprite_idx ] { } ) always clobbers reg byte a reg byte y Statement [7] PLEX_SCREEN_PTR2[idx] = ++ PLEX_SCREEN_PTR2[idx] [ idx ] ( [ idx ] { } ) always clobbers reg byte x
Statement [10] *IRQ = &irq [ ] ( main:3 [ ] { } ) always clobbers reg byte a Statement [10] *IRQ = &irq [ ] ( main:3 [ ] { } ) always clobbers reg byte a
Potential registers zp[2]:2 [ PLEX_SCREEN_PTR1#6 ] : zp[2]:2 , Potential registers zp[2]:2 [ PLEX_SCREEN_PTR1#6 ] : zp[2]:2 ,
Potential registers zp[1]:4 [ plex_sprite_idx ] : zp[1]:4 , Potential registers zp[1]:4 [ idx ] : zp[1]:4 ,
REGISTER UPLIFT SCOPES REGISTER UPLIFT SCOPES
Uplift Scope [] 3.33: zp[1]:4 [ plex_sprite_idx ] 2: zp[2]:2 [ PLEX_SCREEN_PTR1#6 ] Uplift Scope [] 4.67: zp[1]:4 [ idx ] 4: zp[2]:2 [ PLEX_SCREEN_PTR1#6 ]
Uplift Scope [main] Uplift Scope [main]
Uplift Scope [irq] Uplift Scope [irq]
Uplift Scope [__start] Uplift Scope [__start]
Uplifting [] best 106 combination zp[1]:4 [ plex_sprite_idx ] zp[2]:2 [ PLEX_SCREEN_PTR1#6 ] Uplifting [] best 113 combination zp[1]:4 [ idx ] zp[2]:2 [ PLEX_SCREEN_PTR1#6 ]
Uplifting [main] best 106 combination Uplifting [main] best 113 combination
Uplifting [irq] best 106 combination Uplifting [irq] best 113 combination
Uplifting [__start] best 106 combination Uplifting [__start] best 113 combination
Attempting to uplift remaining variables inzp[1]:4 [ plex_sprite_idx ] Attempting to uplift remaining variables inzp[1]:4 [ idx ]
Uplifting [] best 106 combination zp[1]:4 [ plex_sprite_idx ] Uplifting [] best 113 combination zp[1]:4 [ idx ]
ASSEMBLER BEFORE OPTIMIZATION ASSEMBLER BEFORE OPTIMIZATION
// File Comments // File Comments
@@ -192,8 +183,8 @@ ASSEMBLER BEFORE OPTIMIZATION
.pc = $80d "Program" .pc = $80d "Program"
// Global Constants & labels // Global Constants & labels
.label IRQ = $314 .label IRQ = $314
.label PLEX_SCREEN_PTR2 = $400+$3f8 .label PLEX_SCREEN_PTR2 = $500
.label plex_sprite_idx = 4 .label idx = 4
// The address of the sprite pointers on the current screen (screen+0x3f8). // The address of the sprite pointers on the current screen (screen+0x3f8).
.label PLEX_SCREEN_PTR1 = 2 .label PLEX_SCREEN_PTR1 = 2
// __start // __start
@@ -201,9 +192,9 @@ __start: {
jmp __init1 jmp __init1
// __start::__init1 // __start::__init1
__init1: __init1:
// [1] plex_sprite_idx = 0 -- vbuz1=vbuc1 // [1] idx = 0 -- vbuz1=vbuc1
lda #0 lda #0
sta.z plex_sprite_idx sta.z idx
// [2] phi from __start::__init1 to __start::@1 [phi:__start::__init1->__start::@1] // [2] phi from __start::__init1 to __start::@1 [phi:__start::__init1->__start::@1]
__b1_from___init1: __b1_from___init1:
jmp __b1 jmp __b1
@@ -221,16 +212,17 @@ __start: {
// Interrupt Routine // Interrupt Routine
irq: { irq: {
// entry interrupt(KERNEL_KEYBOARD) // entry interrupt(KERNEL_KEYBOARD)
// [6] PLEX_SCREEN_PTR1#6[plex_sprite_idx] = 7 -- pbuz1_derefidx_vbuz2=vbuc1 // [6] PLEX_SCREEN_PTR1#6[idx] = ++ PLEX_SCREEN_PTR1#6[idx] -- pbuz1_derefidx_vbuz2=_inc_pbuz1_derefidx_vbuz2
lda #7 ldy.z idx
ldy.z plex_sprite_idx lda (PLEX_SCREEN_PTR1),y
clc
adc #1
sta (PLEX_SCREEN_PTR1),y sta (PLEX_SCREEN_PTR1),y
// [7] PLEX_SCREEN_PTR2[plex_sprite_idx] = 7 -- pbuc1_derefidx_vbuz1=vbuc2 // [7] PLEX_SCREEN_PTR2[idx] = ++ PLEX_SCREEN_PTR2[idx] -- pbuc1_derefidx_vbuz1=_inc_pbuc1_derefidx_vbuz1
lda #7 ldx.z idx
ldy.z plex_sprite_idx inc PLEX_SCREEN_PTR2,x
sta PLEX_SCREEN_PTR2,y // [8] idx = ++ idx -- vbuz1=_inc_vbuz1
// [8] plex_sprite_idx = ++ plex_sprite_idx -- vbuz1=_inc_vbuz1 inc.z idx
inc.z plex_sprite_idx
jmp __breturn jmp __breturn
// irq::@return // irq::@return
__breturn: __breturn:
@@ -259,9 +251,6 @@ Removing instruction jmp __breturn
Removing instruction jmp __breturn Removing instruction jmp __breturn
Removing instruction jmp __breturn Removing instruction jmp __breturn
Succesful ASM optimization Pass5NextJumpElimination Succesful ASM optimization Pass5NextJumpElimination
Removing instruction lda #7
Removing instruction ldy.z plex_sprite_idx
Succesful ASM optimization Pass5UnnecesaryLoadElimination
Removing instruction __b1_from___init1: Removing instruction __b1_from___init1:
Succesful ASM optimization Pass5RedundantLabelElimination Succesful ASM optimization Pass5RedundantLabelElimination
Removing instruction __init1: Removing instruction __init1:
@@ -274,19 +263,19 @@ Succesful ASM optimization Pass5UnusedLabelElimination
FINAL SYMBOL TABLE FINAL SYMBOL TABLE
const nomodify void()** IRQ = (void()**) 788 const nomodify void()** IRQ = (void()**) 788
byte* PLEX_SCREEN_PTR1 byte* PLEX_SCREEN_PTR1
byte* PLEX_SCREEN_PTR1#6 PLEX_SCREEN_PTR1 zp[2]:2 2.0 byte* PLEX_SCREEN_PTR1#6 PLEX_SCREEN_PTR1 zp[2]:2 4.0
const byte* PLEX_SCREEN_PTR2 = (byte*)$400+$3f8 const byte* PLEX_SCREEN_PTR2 = (byte*) 1280
void __start() void __start()
volatile byte idx loadstore zp[1]:4 4.666666666666666
interrupt(KERNEL_KEYBOARD) void irq() interrupt(KERNEL_KEYBOARD) void irq()
void main() void main()
volatile byte plex_sprite_idx loadstore zp[1]:4 3.333333333333333
zp[2]:2 [ PLEX_SCREEN_PTR1#6 ] zp[2]:2 [ PLEX_SCREEN_PTR1#6 ]
zp[1]:4 [ plex_sprite_idx ] zp[1]:4 [ idx ]
FINAL ASSEMBLER FINAL ASSEMBLER
Score: 59 Score: 71
// File Comments // File Comments
// Demonstrates problem where a pointer with constant value is never assigned - because it is only used in an IRQ // Demonstrates problem where a pointer with constant value is never assigned - because it is only used in an IRQ
@@ -300,17 +289,17 @@ Score: 59
.pc = $80d "Program" .pc = $80d "Program"
// Global Constants & labels // Global Constants & labels
.label IRQ = $314 .label IRQ = $314
.label PLEX_SCREEN_PTR2 = $400+$3f8 .label PLEX_SCREEN_PTR2 = $500
.label plex_sprite_idx = 4 .label idx = 4
// The address of the sprite pointers on the current screen (screen+0x3f8). // The address of the sprite pointers on the current screen (screen+0x3f8).
.label PLEX_SCREEN_PTR1 = 2 .label PLEX_SCREEN_PTR1 = 2
// __start // __start
__start: { __start: {
// __start::__init1 // __start::__init1
// plex_sprite_idx = 0 // idx = 0
// [1] plex_sprite_idx = 0 -- vbuz1=vbuc1 // [1] idx = 0 -- vbuz1=vbuc1
lda #0 lda #0
sta.z plex_sprite_idx sta.z idx
// [2] phi from __start::__init1 to __start::@1 [phi:__start::__init1->__start::@1] // [2] phi from __start::__init1 to __start::@1 [phi:__start::__init1->__start::@1]
// __start::@1 // __start::@1
// [3] call main // [3] call main
@@ -323,17 +312,20 @@ __start: {
// Interrupt Routine // Interrupt Routine
irq: { irq: {
// entry interrupt(KERNEL_KEYBOARD) // entry interrupt(KERNEL_KEYBOARD)
// PLEX_SCREEN_PTR1[plex_sprite_idx] = 7 // PLEX_SCREEN_PTR1[idx]++;
// [6] PLEX_SCREEN_PTR1#6[plex_sprite_idx] = 7 -- pbuz1_derefidx_vbuz2=vbuc1 // [6] PLEX_SCREEN_PTR1#6[idx] = ++ PLEX_SCREEN_PTR1#6[idx] -- pbuz1_derefidx_vbuz2=_inc_pbuz1_derefidx_vbuz2
lda #7 ldy.z idx
ldy.z plex_sprite_idx lda (PLEX_SCREEN_PTR1),y
clc
adc #1
sta (PLEX_SCREEN_PTR1),y sta (PLEX_SCREEN_PTR1),y
// PLEX_SCREEN_PTR2[plex_sprite_idx] = 7 // PLEX_SCREEN_PTR2[idx]++;
// [7] PLEX_SCREEN_PTR2[plex_sprite_idx] = 7 -- pbuc1_derefidx_vbuz1=vbuc2 // [7] PLEX_SCREEN_PTR2[idx] = ++ PLEX_SCREEN_PTR2[idx] -- pbuc1_derefidx_vbuz1=_inc_pbuc1_derefidx_vbuz1
sta PLEX_SCREEN_PTR2,y ldx.z idx
// plex_sprite_idx++; inc PLEX_SCREEN_PTR2,x
// [8] plex_sprite_idx = ++ plex_sprite_idx -- vbuz1=_inc_vbuz1 // idx++;
inc.z plex_sprite_idx // [8] idx = ++ idx -- vbuz1=_inc_vbuz1
inc.z idx
// irq::@return // irq::@return
// } // }
// [9] return - exit interrupt(KERNEL_KEYBOARD) // [9] return - exit interrupt(KERNEL_KEYBOARD)

View File

@@ -1,11 +1,11 @@
const nomodify void()** IRQ = (void()**) 788 const nomodify void()** IRQ = (void()**) 788
byte* PLEX_SCREEN_PTR1 byte* PLEX_SCREEN_PTR1
byte* PLEX_SCREEN_PTR1#6 PLEX_SCREEN_PTR1 zp[2]:2 2.0 byte* PLEX_SCREEN_PTR1#6 PLEX_SCREEN_PTR1 zp[2]:2 4.0
const byte* PLEX_SCREEN_PTR2 = (byte*)$400+$3f8 const byte* PLEX_SCREEN_PTR2 = (byte*) 1280
void __start() void __start()
volatile byte idx loadstore zp[1]:4 4.666666666666666
interrupt(KERNEL_KEYBOARD) void irq() interrupt(KERNEL_KEYBOARD) void irq()
void main() void main()
volatile byte plex_sprite_idx loadstore zp[1]:4 3.333333333333333
zp[2]:2 [ PLEX_SCREEN_PTR1#6 ] zp[2]:2 [ PLEX_SCREEN_PTR1#6 ]
zp[1]:4 [ plex_sprite_idx ] zp[1]:4 [ idx ]