2019-11-17 00:51:42 +00:00
|
|
|
Setting inferred volatile on symbol affected by address-of (struct Point*) main::q ← &(struct Point) main::p
|
2019-06-16 17:54:03 +00:00
|
|
|
Created struct value member variable (byte) main::p_x
|
|
|
|
Created struct value member variable (byte) main::p_y
|
|
|
|
Converted struct value to member variables (struct Point) main::p
|
|
|
|
Adding struct value list initializer (byte) main::p_x ← (number) 2
|
|
|
|
Adding struct value list initializer (byte) main::p_y ← (number) 3
|
|
|
|
Rewriting struct pointer member access *((struct Point*) main::q).x
|
|
|
|
Rewriting struct pointer member access *((struct Point*) main::q).y
|
2019-11-17 00:51:42 +00:00
|
|
|
Identified constant variable (struct Point*) main::q
|
2019-06-16 20:26:17 +00:00
|
|
|
Adding versioned struct unwinding for (struct Point) main::p#0
|
2019-06-16 17:54:03 +00:00
|
|
|
|
|
|
|
CONTROL FLOW GRAPH SSA
|
|
|
|
@begin: scope:[] from
|
|
|
|
to:@1
|
2019-09-18 21:00:30 +00:00
|
|
|
|
|
|
|
(void()) main()
|
2019-06-16 17:54:03 +00:00
|
|
|
main: scope:[main] from @1
|
|
|
|
(byte) main::p_x#0 ← (number) 2
|
|
|
|
(byte) main::p_y#0 ← (number) 3
|
|
|
|
(struct Point) main::p#0 ← struct-unwound {(byte) main::p_x#0, (byte) main::p_y#0}
|
2019-11-17 00:51:42 +00:00
|
|
|
(byte*) main::$0 ← (byte*)(const struct Point*) main::q + (const byte) OFFSET_STRUCT_POINT_X
|
|
|
|
*((const byte*) main::SCREEN + (number) 0) ← *((byte*) main::$0)
|
|
|
|
(byte*) main::$1 ← (byte*)(const struct Point*) main::q + (const byte) OFFSET_STRUCT_POINT_Y
|
|
|
|
*((const byte*) main::SCREEN + (number) 1) ← *((byte*) main::$1)
|
2019-06-16 17:54:03 +00:00
|
|
|
to:main::@return
|
|
|
|
main::@return: scope:[main] from main
|
|
|
|
return
|
|
|
|
to:@return
|
|
|
|
@1: scope:[] from @begin
|
|
|
|
call main
|
|
|
|
to:@2
|
|
|
|
@2: scope:[] from @1
|
|
|
|
to:@end
|
|
|
|
@end: scope:[] from @2
|
|
|
|
|
|
|
|
SYMBOL TABLE SSA
|
|
|
|
(label) @1
|
|
|
|
(label) @2
|
|
|
|
(label) @begin
|
|
|
|
(label) @end
|
|
|
|
(const byte) OFFSET_STRUCT_POINT_X = (byte) 0
|
|
|
|
(const byte) OFFSET_STRUCT_POINT_Y = (byte) 1
|
2019-11-03 19:11:06 +00:00
|
|
|
(byte) Point::x
|
|
|
|
(byte) Point::y
|
2019-06-16 17:54:03 +00:00
|
|
|
(void()) main()
|
2019-11-17 00:51:42 +00:00
|
|
|
(byte*) main::$0
|
2019-06-16 17:54:03 +00:00
|
|
|
(byte*) main::$1
|
|
|
|
(label) main::@return
|
2019-11-03 16:05:55 +00:00
|
|
|
(const byte*) main::SCREEN = (byte*)(number) $400
|
2019-06-16 17:54:03 +00:00
|
|
|
(struct Point) main::p
|
|
|
|
(struct Point) main::p#0
|
|
|
|
(byte) main::p_x
|
|
|
|
(byte) main::p_x#0
|
|
|
|
(byte) main::p_y
|
|
|
|
(byte) main::p_y#0
|
2019-11-17 00:51:42 +00:00
|
|
|
(const struct Point*) main::q = &(struct Point) main::p
|
2019-06-16 17:54:03 +00:00
|
|
|
|
|
|
|
Adding number conversion cast (unumber) 2 in (byte) main::p_x#0 ← (number) 2
|
|
|
|
Adding number conversion cast (unumber) 3 in (byte) main::p_y#0 ← (number) 3
|
2019-11-17 00:51:42 +00:00
|
|
|
Adding number conversion cast (unumber) 0 in *((const byte*) main::SCREEN + (number) 0) ← *((byte*) main::$0)
|
|
|
|
Adding number conversion cast (unumber) 1 in *((const byte*) main::SCREEN + (number) 1) ← *((byte*) main::$1)
|
2019-06-16 17:54:03 +00:00
|
|
|
Successful SSA optimization PassNAddNumberTypeConversions
|
|
|
|
Inlining cast (byte) main::p_x#0 ← (unumber)(number) 2
|
|
|
|
Inlining cast (byte) main::p_y#0 ← (unumber)(number) 3
|
|
|
|
Successful SSA optimization Pass2InlineCast
|
2019-11-03 16:05:55 +00:00
|
|
|
Simplifying constant pointer cast (byte*) 1024
|
2019-06-16 17:54:03 +00:00
|
|
|
Simplifying constant integer cast 2
|
|
|
|
Simplifying constant integer cast 3
|
|
|
|
Simplifying constant integer cast 0
|
|
|
|
Simplifying constant integer cast 1
|
|
|
|
Successful SSA optimization PassNCastSimplification
|
|
|
|
Finalized unsigned number type (byte) 2
|
|
|
|
Finalized unsigned number type (byte) 3
|
|
|
|
Finalized unsigned number type (byte) 0
|
|
|
|
Finalized unsigned number type (byte) 1
|
|
|
|
Successful SSA optimization PassNFinalizeNumberTypeConversions
|
2019-11-17 00:51:42 +00:00
|
|
|
Rewriting struct address-of to first member &(struct Point) main::p
|
2019-06-16 17:54:03 +00:00
|
|
|
Successful SSA optimization PassNStructAddressOfRewriting
|
2019-11-17 00:51:42 +00:00
|
|
|
Constant right-side identified [3] (byte*) main::$0 ← (byte*)(const struct Point*) main::q + (const byte) OFFSET_STRUCT_POINT_X
|
|
|
|
Constant right-side identified [5] (byte*) main::$1 ← (byte*)(const struct Point*) main::q + (const byte) OFFSET_STRUCT_POINT_Y
|
|
|
|
Successful SSA optimization Pass2ConstantRValueConsolidation
|
|
|
|
Constant (const byte*) main::$0 = (byte*)main::q+OFFSET_STRUCT_POINT_X
|
|
|
|
Constant (const byte*) main::$1 = (byte*)main::q+OFFSET_STRUCT_POINT_Y
|
2019-06-16 17:54:03 +00:00
|
|
|
Successful SSA optimization Pass2ConstantIdentification
|
2019-11-17 00:51:42 +00:00
|
|
|
Simplifying expression containing zero (byte*)main::q in
|
|
|
|
Simplifying expression containing zero main::SCREEN in [4] *((const byte*) main::SCREEN + (byte) 0) ← *((const byte*) main::$0)
|
2019-06-16 17:54:03 +00:00
|
|
|
Successful SSA optimization PassNSimplifyExpressionWithZero
|
|
|
|
Eliminating unused variable (struct Point) main::p#0 and assignment [2] (struct Point) main::p#0 ← struct-unwound {(byte) main::p_x#0, (byte) main::p_y#0}
|
|
|
|
Eliminating unused constant (const byte) OFFSET_STRUCT_POINT_X
|
|
|
|
Successful SSA optimization PassNEliminateUnusedVars
|
2019-11-17 00:51:42 +00:00
|
|
|
Constant inlined main::$1 = (byte*)(const struct Point*) main::q+(const byte) OFFSET_STRUCT_POINT_Y
|
|
|
|
Constant inlined main::$0 = (byte*)(const struct Point*) main::q
|
|
|
|
Successful SSA optimization Pass2ConstantInlining
|
2019-09-29 18:57:23 +00:00
|
|
|
Consolidated array index constant in *(main::SCREEN+1)
|
2019-06-16 17:54:03 +00:00
|
|
|
Successful SSA optimization Pass2ConstantAdditionElimination
|
|
|
|
Adding NOP phi() at start of @begin
|
|
|
|
Adding NOP phi() at start of @1
|
|
|
|
Adding NOP phi() at start of @2
|
|
|
|
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
|
|
|
|
Culled Empty Block (label) @2
|
|
|
|
Adding NOP phi() at start of @begin
|
|
|
|
Adding NOP phi() at start of @1
|
|
|
|
Adding NOP phi() at start of @end
|
|
|
|
|
|
|
|
FINAL CONTROL FLOW GRAPH
|
|
|
|
@begin: scope:[] from
|
|
|
|
[0] phi()
|
|
|
|
to:@1
|
|
|
|
@1: scope:[] from @begin
|
|
|
|
[1] phi()
|
|
|
|
[2] call main
|
|
|
|
to:@end
|
|
|
|
@end: scope:[] from @1
|
|
|
|
[3] phi()
|
2019-09-18 21:00:30 +00:00
|
|
|
|
|
|
|
(void()) main()
|
2019-06-16 17:54:03 +00:00
|
|
|
main: scope:[main] from @1
|
|
|
|
[4] (byte) main::p_x#0 ← (byte) 2
|
|
|
|
[5] (byte) main::p_y#0 ← (byte) 3
|
2019-11-17 00:51:42 +00:00
|
|
|
[6] *((const byte*) main::SCREEN) ← *((byte*)(const struct Point*) main::q)
|
|
|
|
[7] *((const byte*) main::SCREEN+(byte) 1) ← *((byte*)(const struct Point*) main::q+(const byte) OFFSET_STRUCT_POINT_Y)
|
2019-06-16 17:54:03 +00:00
|
|
|
to:main::@return
|
|
|
|
main::@return: scope:[main] from main
|
|
|
|
[8] return
|
|
|
|
to:@return
|
|
|
|
|
|
|
|
|
|
|
|
VARIABLE REGISTER WEIGHTS
|
2019-11-03 19:11:06 +00:00
|
|
|
(byte) Point::x
|
|
|
|
(byte) Point::y
|
2019-06-16 17:54:03 +00:00
|
|
|
(void()) main()
|
|
|
|
(struct Point) main::p
|
|
|
|
(byte) main::p_x
|
|
|
|
(byte) main::p_x#0 20.0
|
|
|
|
(byte) main::p_y
|
|
|
|
(byte) main::p_y#0 20.0
|
|
|
|
|
|
|
|
Initial phi equivalence classes
|
|
|
|
Complete equivalence classes
|
|
|
|
[ main::p_x#0 ]
|
|
|
|
[ main::p_y#0 ]
|
2019-10-12 09:40:36 +00:00
|
|
|
Allocated zp[1]:2 [ main::p_x#0 ]
|
|
|
|
Allocated zp[1]:3 [ main::p_y#0 ]
|
2019-06-16 17:54:03 +00:00
|
|
|
|
|
|
|
INITIAL ASM
|
2019-09-08 00:29:17 +00:00
|
|
|
Target platform is c64basic / MOS6502X
|
2019-07-08 14:43:09 +00:00
|
|
|
// File Comments
|
2019-06-16 17:54:03 +00:00
|
|
|
// Minimal struct - using address-of
|
2019-07-25 15:06:17 +00:00
|
|
|
// Upstart
|
2019-06-16 17:54:03 +00:00
|
|
|
.pc = $801 "Basic"
|
2019-09-29 21:13:37 +00:00
|
|
|
:BasicUpstart(__bbegin)
|
2019-06-16 17:54:03 +00:00
|
|
|
.pc = $80d "Program"
|
2019-07-08 14:43:09 +00:00
|
|
|
// Global Constants & labels
|
2019-06-16 17:54:03 +00:00
|
|
|
.const OFFSET_STRUCT_POINT_Y = 1
|
2019-07-08 14:43:09 +00:00
|
|
|
// @begin
|
2019-09-29 21:13:37 +00:00
|
|
|
__bbegin:
|
2019-07-08 14:43:09 +00:00
|
|
|
// [1] phi from @begin to @1 [phi:@begin->@1]
|
2019-09-29 21:13:37 +00:00
|
|
|
__b1_from___bbegin:
|
|
|
|
jmp __b1
|
2019-07-08 14:43:09 +00:00
|
|
|
// @1
|
2019-09-29 21:13:37 +00:00
|
|
|
__b1:
|
2019-07-08 14:43:09 +00:00
|
|
|
// [2] call main
|
2019-06-16 17:54:03 +00:00
|
|
|
jsr main
|
2019-07-08 14:43:09 +00:00
|
|
|
// [3] phi from @1 to @end [phi:@1->@end]
|
2019-09-29 21:13:37 +00:00
|
|
|
__bend_from___b1:
|
|
|
|
jmp __bend
|
2019-07-08 14:43:09 +00:00
|
|
|
// @end
|
2019-09-29 21:13:37 +00:00
|
|
|
__bend:
|
2019-07-08 14:43:09 +00:00
|
|
|
// main
|
2019-06-16 17:54:03 +00:00
|
|
|
main: {
|
|
|
|
.label SCREEN = $400
|
2019-11-03 16:05:55 +00:00
|
|
|
.label q = p_x
|
2019-06-16 17:54:03 +00:00
|
|
|
.label p_x = 2
|
|
|
|
.label p_y = 3
|
2019-07-08 14:43:09 +00:00
|
|
|
// [4] (byte) main::p_x#0 ← (byte) 2 -- vbuz1=vbuc1
|
2019-06-16 17:54:03 +00:00
|
|
|
lda #2
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z p_x
|
2019-07-08 14:43:09 +00:00
|
|
|
// [5] (byte) main::p_y#0 ← (byte) 3 -- vbuz1=vbuc1
|
2019-06-16 17:54:03 +00:00
|
|
|
lda #3
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z p_y
|
2019-11-17 00:51:42 +00:00
|
|
|
// [6] *((const byte*) main::SCREEN) ← *((byte*)(const struct Point*) main::q) -- _deref_pbuc1=_deref_pbuc2
|
2019-09-01 20:06:32 +00:00
|
|
|
lda.z q
|
2019-06-16 17:54:03 +00:00
|
|
|
sta SCREEN
|
2019-11-17 00:51:42 +00:00
|
|
|
// [7] *((const byte*) main::SCREEN+(byte) 1) ← *((byte*)(const struct Point*) main::q+(const byte) OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2
|
2019-06-16 17:54:03 +00:00
|
|
|
lda q+OFFSET_STRUCT_POINT_Y
|
|
|
|
sta SCREEN+1
|
2019-09-29 21:13:37 +00:00
|
|
|
jmp __breturn
|
2019-07-08 14:43:09 +00:00
|
|
|
// main::@return
|
2019-09-29 21:13:37 +00:00
|
|
|
__breturn:
|
2019-07-08 14:43:09 +00:00
|
|
|
// [8] return
|
2019-06-16 17:54:03 +00:00
|
|
|
rts
|
|
|
|
}
|
2019-07-08 14:43:09 +00:00
|
|
|
// File Data
|
2019-06-16 17:54:03 +00:00
|
|
|
|
|
|
|
REGISTER UPLIFT POTENTIAL REGISTERS
|
|
|
|
Statement [4] (byte) main::p_x#0 ← (byte) 2 [ ] ( main:2 [ ] ) always clobbers reg byte a
|
|
|
|
Statement [5] (byte) main::p_y#0 ← (byte) 3 [ ] ( main:2 [ ] ) always clobbers reg byte a
|
2019-11-17 00:51:42 +00:00
|
|
|
Statement [6] *((const byte*) main::SCREEN) ← *((byte*)(const struct Point*) main::q) [ ] ( main:2 [ ] ) always clobbers reg byte a
|
|
|
|
Statement [7] *((const byte*) main::SCREEN+(byte) 1) ← *((byte*)(const struct Point*) main::q+(const byte) OFFSET_STRUCT_POINT_Y) [ ] ( main:2 [ ] ) always clobbers reg byte a
|
2019-10-12 09:40:36 +00:00
|
|
|
Potential registers zp[1]:2 [ main::p_x#0 ] : zp[1]:2 ,
|
|
|
|
Potential registers zp[1]:3 [ main::p_y#0 ] : zp[1]:3 ,
|
2019-06-16 17:54:03 +00:00
|
|
|
|
|
|
|
REGISTER UPLIFT SCOPES
|
2019-10-12 09:40:36 +00:00
|
|
|
Uplift Scope [main] 20: zp[1]:2 [ main::p_x#0 ] 20: zp[1]:3 [ main::p_y#0 ]
|
2019-06-16 17:54:03 +00:00
|
|
|
Uplift Scope [Point]
|
|
|
|
Uplift Scope []
|
|
|
|
|
2019-10-12 09:40:36 +00:00
|
|
|
Uplifting [main] best 46 combination zp[1]:2 [ main::p_x#0 ] zp[1]:3 [ main::p_y#0 ]
|
2019-09-01 20:06:32 +00:00
|
|
|
Uplifting [Point] best 46 combination
|
|
|
|
Uplifting [] best 46 combination
|
2019-10-12 09:40:36 +00:00
|
|
|
Attempting to uplift remaining variables inzp[1]:2 [ main::p_x#0 ]
|
|
|
|
Uplifting [main] best 46 combination zp[1]:2 [ main::p_x#0 ]
|
|
|
|
Attempting to uplift remaining variables inzp[1]:3 [ main::p_y#0 ]
|
|
|
|
Uplifting [main] best 46 combination zp[1]:3 [ main::p_y#0 ]
|
2019-06-16 17:54:03 +00:00
|
|
|
|
|
|
|
ASSEMBLER BEFORE OPTIMIZATION
|
2019-07-08 14:43:09 +00:00
|
|
|
// File Comments
|
2019-06-16 17:54:03 +00:00
|
|
|
// Minimal struct - using address-of
|
2019-07-25 15:06:17 +00:00
|
|
|
// Upstart
|
2019-06-16 17:54:03 +00:00
|
|
|
.pc = $801 "Basic"
|
2019-09-29 21:13:37 +00:00
|
|
|
:BasicUpstart(__bbegin)
|
2019-06-16 17:54:03 +00:00
|
|
|
.pc = $80d "Program"
|
2019-07-08 14:43:09 +00:00
|
|
|
// Global Constants & labels
|
2019-06-16 17:54:03 +00:00
|
|
|
.const OFFSET_STRUCT_POINT_Y = 1
|
2019-07-08 14:43:09 +00:00
|
|
|
// @begin
|
2019-09-29 21:13:37 +00:00
|
|
|
__bbegin:
|
2019-07-08 14:43:09 +00:00
|
|
|
// [1] phi from @begin to @1 [phi:@begin->@1]
|
2019-09-29 21:13:37 +00:00
|
|
|
__b1_from___bbegin:
|
|
|
|
jmp __b1
|
2019-07-08 14:43:09 +00:00
|
|
|
// @1
|
2019-09-29 21:13:37 +00:00
|
|
|
__b1:
|
2019-07-08 14:43:09 +00:00
|
|
|
// [2] call main
|
2019-06-16 17:54:03 +00:00
|
|
|
jsr main
|
2019-07-08 14:43:09 +00:00
|
|
|
// [3] phi from @1 to @end [phi:@1->@end]
|
2019-09-29 21:13:37 +00:00
|
|
|
__bend_from___b1:
|
|
|
|
jmp __bend
|
2019-07-08 14:43:09 +00:00
|
|
|
// @end
|
2019-09-29 21:13:37 +00:00
|
|
|
__bend:
|
2019-07-08 14:43:09 +00:00
|
|
|
// main
|
2019-06-16 17:54:03 +00:00
|
|
|
main: {
|
|
|
|
.label SCREEN = $400
|
2019-11-03 16:05:55 +00:00
|
|
|
.label q = p_x
|
2019-06-16 17:54:03 +00:00
|
|
|
.label p_x = 2
|
|
|
|
.label p_y = 3
|
2019-07-08 14:43:09 +00:00
|
|
|
// [4] (byte) main::p_x#0 ← (byte) 2 -- vbuz1=vbuc1
|
2019-06-16 17:54:03 +00:00
|
|
|
lda #2
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z p_x
|
2019-07-08 14:43:09 +00:00
|
|
|
// [5] (byte) main::p_y#0 ← (byte) 3 -- vbuz1=vbuc1
|
2019-06-16 17:54:03 +00:00
|
|
|
lda #3
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z p_y
|
2019-11-17 00:51:42 +00:00
|
|
|
// [6] *((const byte*) main::SCREEN) ← *((byte*)(const struct Point*) main::q) -- _deref_pbuc1=_deref_pbuc2
|
2019-09-01 20:06:32 +00:00
|
|
|
lda.z q
|
2019-06-16 17:54:03 +00:00
|
|
|
sta SCREEN
|
2019-11-17 00:51:42 +00:00
|
|
|
// [7] *((const byte*) main::SCREEN+(byte) 1) ← *((byte*)(const struct Point*) main::q+(const byte) OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2
|
2019-06-16 17:54:03 +00:00
|
|
|
lda q+OFFSET_STRUCT_POINT_Y
|
|
|
|
sta SCREEN+1
|
2019-09-29 21:13:37 +00:00
|
|
|
jmp __breturn
|
2019-07-08 14:43:09 +00:00
|
|
|
// main::@return
|
2019-09-29 21:13:37 +00:00
|
|
|
__breturn:
|
2019-07-08 14:43:09 +00:00
|
|
|
// [8] return
|
2019-06-16 17:54:03 +00:00
|
|
|
rts
|
|
|
|
}
|
2019-07-08 14:43:09 +00:00
|
|
|
// File Data
|
2019-06-16 17:54:03 +00:00
|
|
|
|
|
|
|
ASSEMBLER OPTIMIZATIONS
|
2019-09-29 21:13:37 +00:00
|
|
|
Removing instruction jmp __b1
|
|
|
|
Removing instruction jmp __bend
|
|
|
|
Removing instruction jmp __breturn
|
2019-06-16 17:54:03 +00:00
|
|
|
Succesful ASM optimization Pass5NextJumpElimination
|
2019-09-29 21:13:37 +00:00
|
|
|
Replacing label __bbegin with __b1
|
|
|
|
Removing instruction __bbegin:
|
|
|
|
Removing instruction __b1_from___bbegin:
|
|
|
|
Removing instruction __bend_from___b1:
|
2019-06-16 17:54:03 +00:00
|
|
|
Succesful ASM optimization Pass5RedundantLabelElimination
|
2019-09-29 21:13:37 +00:00
|
|
|
Removing instruction __bend:
|
|
|
|
Removing instruction __breturn:
|
2019-06-16 17:54:03 +00:00
|
|
|
Succesful ASM optimization Pass5UnusedLabelElimination
|
|
|
|
Updating BasicUpstart to call main directly
|
|
|
|
Removing instruction jsr main
|
|
|
|
Succesful ASM optimization Pass5SkipBegin
|
2019-09-29 21:13:37 +00:00
|
|
|
Removing instruction __b1:
|
2019-06-16 17:54:03 +00:00
|
|
|
Succesful ASM optimization Pass5UnusedLabelElimination
|
|
|
|
|
|
|
|
FINAL SYMBOL TABLE
|
|
|
|
(label) @1
|
|
|
|
(label) @begin
|
|
|
|
(label) @end
|
2019-10-13 22:51:15 +00:00
|
|
|
(const byte) OFFSET_STRUCT_POINT_Y = (byte) 1
|
2019-11-03 19:11:06 +00:00
|
|
|
(byte) Point::x
|
|
|
|
(byte) Point::y
|
2019-06-16 17:54:03 +00:00
|
|
|
(void()) main()
|
|
|
|
(label) main::@return
|
2019-10-13 22:51:15 +00:00
|
|
|
(const byte*) main::SCREEN = (byte*) 1024
|
2019-06-16 17:54:03 +00:00
|
|
|
(struct Point) main::p
|
|
|
|
(byte) main::p_x
|
2019-10-12 09:40:36 +00:00
|
|
|
(byte) main::p_x#0 p_x zp[1]:2 20.0
|
2019-06-16 17:54:03 +00:00
|
|
|
(byte) main::p_y
|
2019-10-12 09:40:36 +00:00
|
|
|
(byte) main::p_y#0 p_y zp[1]:3 20.0
|
2019-11-17 00:51:42 +00:00
|
|
|
(const struct Point*) main::q = (struct Point*)&(byte) main::p_x#0
|
2019-06-16 17:54:03 +00:00
|
|
|
|
2019-10-12 09:40:36 +00:00
|
|
|
zp[1]:2 [ main::p_x#0 ]
|
|
|
|
zp[1]:3 [ main::p_y#0 ]
|
2019-06-16 17:54:03 +00:00
|
|
|
|
|
|
|
|
|
|
|
FINAL ASSEMBLER
|
2019-09-01 20:06:32 +00:00
|
|
|
Score: 31
|
2019-06-16 17:54:03 +00:00
|
|
|
|
2019-07-08 14:43:09 +00:00
|
|
|
// File Comments
|
2019-06-16 17:54:03 +00:00
|
|
|
// Minimal struct - using address-of
|
2019-07-25 15:06:17 +00:00
|
|
|
// Upstart
|
2019-06-16 17:54:03 +00:00
|
|
|
.pc = $801 "Basic"
|
|
|
|
:BasicUpstart(main)
|
|
|
|
.pc = $80d "Program"
|
2019-07-08 14:43:09 +00:00
|
|
|
// Global Constants & labels
|
2019-06-16 17:54:03 +00:00
|
|
|
.const OFFSET_STRUCT_POINT_Y = 1
|
2019-07-08 14:43:09 +00:00
|
|
|
// @begin
|
|
|
|
// [1] phi from @begin to @1 [phi:@begin->@1]
|
|
|
|
// @1
|
|
|
|
// [2] call main
|
|
|
|
// [3] phi from @1 to @end [phi:@1->@end]
|
|
|
|
// @end
|
|
|
|
// main
|
2019-06-16 17:54:03 +00:00
|
|
|
main: {
|
|
|
|
.label SCREEN = $400
|
2019-11-03 16:05:55 +00:00
|
|
|
.label q = p_x
|
2019-06-16 17:54:03 +00:00
|
|
|
.label p_x = 2
|
|
|
|
.label p_y = 3
|
2019-07-08 14:43:09 +00:00
|
|
|
// p = { 2, 3 }
|
|
|
|
// [4] (byte) main::p_x#0 ← (byte) 2 -- vbuz1=vbuc1
|
2019-06-16 17:54:03 +00:00
|
|
|
lda #2
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z p_x
|
2019-07-08 14:43:09 +00:00
|
|
|
// [5] (byte) main::p_y#0 ← (byte) 3 -- vbuz1=vbuc1
|
2019-06-16 17:54:03 +00:00
|
|
|
lda #3
|
2019-08-07 19:00:19 +00:00
|
|
|
sta.z p_y
|
2019-07-08 14:43:09 +00:00
|
|
|
// SCREEN[0] = q->x
|
2019-11-17 00:51:42 +00:00
|
|
|
// [6] *((const byte*) main::SCREEN) ← *((byte*)(const struct Point*) main::q) -- _deref_pbuc1=_deref_pbuc2
|
2019-09-01 20:06:32 +00:00
|
|
|
lda.z q
|
2019-06-16 17:54:03 +00:00
|
|
|
sta SCREEN
|
2019-07-08 14:43:09 +00:00
|
|
|
// SCREEN[1] = q->y
|
2019-11-17 00:51:42 +00:00
|
|
|
// [7] *((const byte*) main::SCREEN+(byte) 1) ← *((byte*)(const struct Point*) main::q+(const byte) OFFSET_STRUCT_POINT_Y) -- _deref_pbuc1=_deref_pbuc2
|
2019-06-16 17:54:03 +00:00
|
|
|
lda q+OFFSET_STRUCT_POINT_Y
|
|
|
|
sta SCREEN+1
|
2019-07-08 14:43:09 +00:00
|
|
|
// main::@return
|
|
|
|
// }
|
|
|
|
// [8] return
|
2019-06-16 17:54:03 +00:00
|
|
|
rts
|
|
|
|
}
|
2019-07-08 14:43:09 +00:00
|
|
|
// File Data
|
2019-06-16 17:54:03 +00:00
|
|
|
|