mirror of
https://gitlab.com/camelot/kickc.git
synced 2025-04-11 04:37:29 +00:00
Added another test for structs with char* members. Closes #397
This commit is contained in:
parent
41f50629c4
commit
f01db23d0d
@ -976,7 +976,7 @@ public class TestProgramsFast extends TestPrograms {
|
||||
|
||||
@Test
|
||||
public void testPreprocessor17() throws IOException {
|
||||
compileAndCompare("preprocessor-17.c", log());
|
||||
compileAndCompare("preprocessor-17.c");
|
||||
}
|
||||
|
||||
@Test
|
||||
@ -2382,6 +2382,11 @@ public class TestProgramsFast extends TestPrograms {
|
||||
compileAndCompare("union-0.c");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStruct49() throws IOException {
|
||||
compileAndCompare("struct-49.c");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStruct48() throws IOException {
|
||||
compileAndCompare("struct-48.c");
|
||||
|
34
src/test/kc/cstyle-decl-var-1.c
Normal file
34
src/test/kc/cstyle-decl-var-1.c
Normal file
@ -0,0 +1,34 @@
|
||||
// Test declarations of variables without definition
|
||||
|
||||
/// Unsigned integer type with a width of exactly 16 bits
|
||||
typedef unsigned int uint16_t;
|
||||
/// Unsigned integer type with a width of exactly 32 bits
|
||||
typedef unsigned long uint32_t;
|
||||
|
||||
#define byte_t unsigned char
|
||||
|
||||
typedef union {
|
||||
uint32_t d;
|
||||
uint16_t w[2];
|
||||
byte_t b[4];
|
||||
} _uint32_t;
|
||||
|
||||
// A volatile extern
|
||||
extern volatile _uint32_t ticks;
|
||||
|
||||
// The actual declarations
|
||||
volatile _uint32_t ticks;
|
||||
|
||||
// And a little code using them
|
||||
void main() {
|
||||
_uint32_t * SCREEN = (_uint32_t*)0x0400;
|
||||
*SCREEN = ticks;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
33
src/test/kc/struct-49.c
Normal file
33
src/test/kc/struct-49.c
Normal file
@ -0,0 +1,33 @@
|
||||
// Structs with char* pointer members
|
||||
// https://gitlab.com/camelot/kickc/-/issues/397
|
||||
|
||||
typedef struct {
|
||||
unsigned char Y;
|
||||
char *Msg;
|
||||
} TextDesc;
|
||||
|
||||
static TextDesc Text [] = {
|
||||
{ 2, "Wolfgang Amadeus Mozart" },
|
||||
{ 4, "\"Eine kleine Nachtmusik\"" },
|
||||
{ 5, "(KV 525)" },
|
||||
{ 9, "Ported to the SID in 1987 by" },
|
||||
{ 11, "Joachim von Bassewitz" },
|
||||
{ 12, "(joachim@von-bassewitz.de)" },
|
||||
{ 13, "and" },
|
||||
{ 14, "Ullrich von Bassewitz" },
|
||||
{ 15, "(ullrich@von-bassewitz.de)" },
|
||||
{ 18, "C Implementation by" },
|
||||
{ 19, "Ullrich von Bassewitz" },
|
||||
{ 23, "Press any key to quit..." }
|
||||
};
|
||||
|
||||
void main() {
|
||||
char * screen = (char*)0x0400;
|
||||
TextDesc *txt = Text;
|
||||
for(char i=0;i<sizeof(Text)/sizeof(TextDesc); i++, txt++) {
|
||||
for(char* msg = txt->Msg; *msg; msg++)
|
||||
*(screen++) = *msg;
|
||||
*(screen++) = ' ';
|
||||
}
|
||||
}
|
||||
|
126
src/test/ref/struct-49.asm
Normal file
126
src/test/ref/struct-49.asm
Normal file
@ -0,0 +1,126 @@
|
||||
// Structs with char* pointer members
|
||||
// https://gitlab.com/camelot/kickc/-/issues/397
|
||||
// Commodore 64 PRG executable file
|
||||
.file [name="struct-49.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)
|
||||
.segment Code
|
||||
main: {
|
||||
.label msg = 4
|
||||
.label screen = 6
|
||||
.label txt = 2
|
||||
lda #<$400
|
||||
sta.z screen
|
||||
lda #>$400
|
||||
sta.z screen+1
|
||||
lda #<Text
|
||||
sta.z txt
|
||||
lda #>Text
|
||||
sta.z txt+1
|
||||
ldx #0
|
||||
__b1:
|
||||
// for(char i=0;i<sizeof(Text)/sizeof(TextDesc); i++, txt++)
|
||||
cpx #$c*3/3
|
||||
bcc __b2
|
||||
// }
|
||||
rts
|
||||
__b2:
|
||||
// char* msg = txt->Msg
|
||||
ldy #1
|
||||
lda (txt),y
|
||||
sta.z msg
|
||||
iny
|
||||
lda (txt),y
|
||||
sta.z msg+1
|
||||
__b3:
|
||||
// for(char* msg = txt->Msg; *msg; msg++)
|
||||
ldy #0
|
||||
lda (msg),y
|
||||
cmp #0
|
||||
bne __b4
|
||||
// *(screen++) = ' '
|
||||
lda #' '
|
||||
sta (screen),y
|
||||
// *(screen++) = ' ';
|
||||
inc.z screen
|
||||
bne !+
|
||||
inc.z screen+1
|
||||
!:
|
||||
// for(char i=0;i<sizeof(Text)/sizeof(TextDesc); i++, txt++)
|
||||
inx
|
||||
lda #3
|
||||
clc
|
||||
adc.z txt
|
||||
sta.z txt
|
||||
bcc !+
|
||||
inc.z txt+1
|
||||
!:
|
||||
jmp __b1
|
||||
__b4:
|
||||
// *(screen++) = *msg
|
||||
ldy #0
|
||||
lda (msg),y
|
||||
sta (screen),y
|
||||
// *(screen++) = *msg;
|
||||
inc.z screen
|
||||
bne !+
|
||||
inc.z screen+1
|
||||
!:
|
||||
// for(char* msg = txt->Msg; *msg; msg++)
|
||||
inc.z msg
|
||||
bne !+
|
||||
inc.z msg+1
|
||||
!:
|
||||
jmp __b3
|
||||
}
|
||||
.segment Data
|
||||
Text: .byte 2
|
||||
.word __0_msg
|
||||
.byte 4
|
||||
.word __0_msg1
|
||||
.byte 5
|
||||
.word __0_msg2
|
||||
.byte 9
|
||||
.word __0_msg3
|
||||
.byte $b
|
||||
.word __0_msg4
|
||||
.byte $c
|
||||
.word __0_msg5
|
||||
.byte $d
|
||||
.word __0_msg6
|
||||
.byte $e
|
||||
.word __0_msg10
|
||||
.byte $f
|
||||
.word __0_msg8
|
||||
.byte $12
|
||||
.word __0_msg9
|
||||
.byte $13
|
||||
.word __0_msg10
|
||||
.byte $17
|
||||
.word __0_msg11
|
||||
__0_msg: .text "Wolfgang Amadeus Mozart"
|
||||
.byte 0
|
||||
__0_msg1: .text @"\"Eine kleine Nachtmusik\""
|
||||
.byte 0
|
||||
__0_msg2: .text "(KV 525)"
|
||||
.byte 0
|
||||
__0_msg3: .text "Ported to the SID in 1987 by"
|
||||
.byte 0
|
||||
__0_msg4: .text "Joachim von Bassewitz"
|
||||
.byte 0
|
||||
__0_msg5: .text "(joachim@von-bassewitz.de)"
|
||||
.byte 0
|
||||
__0_msg6: .text "and"
|
||||
.byte 0
|
||||
__0_msg8: .text "(ullrich@von-bassewitz.de)"
|
||||
.byte 0
|
||||
__0_msg9: .text "C Implementation by"
|
||||
.byte 0
|
||||
__0_msg10: .text "Ullrich von Bassewitz"
|
||||
.byte 0
|
||||
__0_msg11: .text "Press any key to quit..."
|
||||
.byte 0
|
33
src/test/ref/struct-49.cfg
Normal file
33
src/test/ref/struct-49.cfg
Normal file
@ -0,0 +1,33 @@
|
||||
|
||||
void main()
|
||||
main: scope:[main] from
|
||||
[0] phi()
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@5
|
||||
[1] main::screen#6 = phi( main/(byte*) 1024, main::@5/main::screen#2 )
|
||||
[1] main::txt#2 = phi( main/Text, main::@5/main::txt#1 )
|
||||
[1] main::i#2 = phi( main/0, main::@5/main::i#1 )
|
||||
[2] if(main::i#2<$c*3/3) goto main::@2
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main::@1
|
||||
[3] return
|
||||
to:@return
|
||||
main::@2: scope:[main] from main::@1
|
||||
[4] main::msg#0 = ((byte**)main::txt#2)[1]
|
||||
to:main::@3
|
||||
main::@3: scope:[main] from main::@2 main::@4
|
||||
[5] main::screen#3 = phi( main::@2/main::screen#6, main::@4/main::screen#1 )
|
||||
[5] main::msg#2 = phi( main::@2/main::msg#0, main::@4/main::msg#1 )
|
||||
[6] if(0!=*main::msg#2) goto main::@4
|
||||
to:main::@5
|
||||
main::@5: scope:[main] from main::@3
|
||||
[7] *main::screen#3 = ' '
|
||||
[8] main::screen#2 = ++ main::screen#3
|
||||
[9] main::i#1 = ++ main::i#2
|
||||
[10] main::txt#1 = main::txt#2 + 3
|
||||
to:main::@1
|
||||
main::@4: scope:[main] from main::@3
|
||||
[11] *main::screen#3 = *main::msg#2
|
||||
[12] main::screen#1 = ++ main::screen#3
|
||||
[13] main::msg#1 = ++ main::msg#2
|
||||
to:main::@3
|
680
src/test/ref/struct-49.log
Normal file
680
src/test/ref/struct-49.log
Normal file
@ -0,0 +1,680 @@
|
||||
|
||||
CONTROL FLOW GRAPH SSA
|
||||
|
||||
void main()
|
||||
main: scope:[main] from __start
|
||||
main::screen#0 = (byte*)$400
|
||||
main::txt#0 = Text
|
||||
main::i#0 = 0
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@5
|
||||
main::screen#7 = phi( main/main::screen#0, main::@5/main::screen#2 )
|
||||
main::txt#4 = phi( main/main::txt#0, main::@5/main::txt#1 )
|
||||
main::i#2 = phi( main/main::i#0, main::@5/main::i#1 )
|
||||
main::$0 = sizeof Text
|
||||
main::$1 = main::$0 / SIZEOF_STRUCT_$0
|
||||
main::$2 = main::i#2 < main::$1
|
||||
if(main::$2) goto main::@2
|
||||
to:main::@return
|
||||
main::@2: scope:[main] from main::@1
|
||||
main::i#5 = phi( main::@1/main::i#2 )
|
||||
main::screen#6 = phi( main::@1/main::screen#7 )
|
||||
main::txt#2 = phi( main::@1/main::txt#4 )
|
||||
main::$4 = (byte**)main::txt#2
|
||||
main::$3 = main::$4 + OFFSET_STRUCT_$0_MSG
|
||||
main::msg#0 = *main::$3
|
||||
to:main::@3
|
||||
main::@3: scope:[main] from main::@2 main::@4
|
||||
main::txt#5 = phi( main::@2/main::txt#2, main::@4/main::txt#6 )
|
||||
main::i#4 = phi( main::@2/main::i#5, main::@4/main::i#6 )
|
||||
main::screen#5 = phi( main::@2/main::screen#6, main::@4/main::screen#1 )
|
||||
main::msg#2 = phi( main::@2/main::msg#0, main::@4/main::msg#1 )
|
||||
main::$5 = 0 != *main::msg#2
|
||||
if(main::$5) goto main::@4
|
||||
to:main::@5
|
||||
main::@4: scope:[main] from main::@3
|
||||
main::txt#6 = phi( main::@3/main::txt#5 )
|
||||
main::i#6 = phi( main::@3/main::i#4 )
|
||||
main::screen#3 = phi( main::@3/main::screen#5 )
|
||||
main::msg#3 = phi( main::@3/main::msg#2 )
|
||||
*main::screen#3 = *main::msg#3
|
||||
main::screen#1 = ++ main::screen#3
|
||||
main::msg#1 = ++ main::msg#3
|
||||
to:main::@3
|
||||
main::@5: scope:[main] from main::@3
|
||||
main::txt#3 = phi( main::@3/main::txt#5 )
|
||||
main::i#3 = phi( main::@3/main::i#4 )
|
||||
main::screen#4 = phi( main::@3/main::screen#5 )
|
||||
*main::screen#4 = ' '
|
||||
main::screen#2 = ++ main::screen#4
|
||||
main::i#1 = ++ main::i#3
|
||||
main::txt#1 = main::txt#3 + SIZEOF_STRUCT_$0
|
||||
to:main::@1
|
||||
main::@return: scope:[main] from main::@1
|
||||
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
|
||||
constant byte* $0_msg[$18] = "Wolfgang Amadeus Mozart"
|
||||
constant byte* $0_msg1[$19] = ""Eine kleine Nachtmusik""
|
||||
constant byte* $0_msg10[$16] = "Ullrich von Bassewitz"
|
||||
constant byte* $0_msg11[$19] = "Press any key to quit..."
|
||||
constant byte* $0_msg2[9] = "(KV 525)"
|
||||
constant byte* $0_msg3[$1d] = "Ported to the SID in 1987 by"
|
||||
constant byte* $0_msg4[$16] = "Joachim von Bassewitz"
|
||||
constant byte* $0_msg5[$1b] = "(joachim@von-bassewitz.de)"
|
||||
constant byte* $0_msg6[4] = "and"
|
||||
constant byte* $0_msg7[$16] = "Ullrich von Bassewitz"
|
||||
constant byte* $0_msg8[$1b] = "(ullrich@von-bassewitz.de)"
|
||||
constant byte* $0_msg9[$14] = "C Implementation by"
|
||||
constant byte OFFSET_STRUCT_$0_MSG = 1
|
||||
constant byte SIZEOF_STRUCT_$0 = 3
|
||||
constant struct $0* Text[] = { { Y: 2, Msg: $0_msg }, { Y: 4, Msg: $0_msg1 }, { Y: 5, Msg: $0_msg2 }, { Y: 9, Msg: $0_msg3 }, { Y: $b, Msg: $0_msg4 }, { Y: $c, Msg: $0_msg5 }, { Y: $d, Msg: $0_msg6 }, { Y: $e, Msg: $0_msg7 }, { Y: $f, Msg: $0_msg8 }, { Y: $12, Msg: $0_msg9 }, { Y: $13, Msg: $0_msg10 }, { Y: $17, Msg: $0_msg11 } }
|
||||
void __start()
|
||||
void main()
|
||||
word~ main::$0
|
||||
word~ main::$1
|
||||
bool~ main::$2
|
||||
byte**~ main::$3
|
||||
byte**~ main::$4
|
||||
bool~ main::$5
|
||||
byte main::i
|
||||
byte main::i#0
|
||||
byte main::i#1
|
||||
byte main::i#2
|
||||
byte main::i#3
|
||||
byte main::i#4
|
||||
byte main::i#5
|
||||
byte main::i#6
|
||||
byte* main::msg
|
||||
byte* main::msg#0
|
||||
byte* main::msg#1
|
||||
byte* main::msg#2
|
||||
byte* main::msg#3
|
||||
byte* main::screen
|
||||
byte* main::screen#0
|
||||
byte* main::screen#1
|
||||
byte* main::screen#2
|
||||
byte* main::screen#3
|
||||
byte* main::screen#4
|
||||
byte* main::screen#5
|
||||
byte* main::screen#6
|
||||
byte* main::screen#7
|
||||
struct $0* main::txt
|
||||
struct $0* main::txt#0
|
||||
struct $0* main::txt#1
|
||||
struct $0* main::txt#2
|
||||
struct $0* main::txt#3
|
||||
struct $0* main::txt#4
|
||||
struct $0* main::txt#5
|
||||
struct $0* main::txt#6
|
||||
|
||||
Adding number conversion cast (unumber) 0 in main::$5 = 0 != *main::msg#2
|
||||
Successful SSA optimization PassNAddNumberTypeConversions
|
||||
Simplifying constant pointer cast (byte*) 1024
|
||||
Simplifying constant integer cast 0
|
||||
Successful SSA optimization PassNCastSimplification
|
||||
Finalized unsigned number type (byte) 0
|
||||
Successful SSA optimization PassNFinalizeNumberTypeConversions
|
||||
Alias main::txt#2 = main::txt#4
|
||||
Alias main::screen#6 = main::screen#7
|
||||
Alias main::i#2 = main::i#5
|
||||
Alias main::msg#2 = main::msg#3
|
||||
Alias main::screen#3 = main::screen#5 main::screen#4
|
||||
Alias main::i#3 = main::i#6 main::i#4
|
||||
Alias main::txt#3 = main::txt#6 main::txt#5
|
||||
Successful SSA optimization Pass2AliasElimination
|
||||
Identical Phi Values main::i#3 main::i#2
|
||||
Identical Phi Values main::txt#3 main::txt#2
|
||||
Successful SSA optimization Pass2IdenticalPhiElimination
|
||||
Simple Condition main::$2 [7] if(main::i#2<main::$1) goto main::@2
|
||||
Simple Condition main::$5 [13] if(0!=*main::msg#2) goto main::@4
|
||||
Successful SSA optimization Pass2ConditionalJumpSimplification
|
||||
Constant right-side identified [4] main::$0 = sizeof Text
|
||||
Successful SSA optimization Pass2ConstantRValueConsolidation
|
||||
Constant main::screen#0 = (byte*) 1024
|
||||
Constant main::txt#0 = Text
|
||||
Constant main::i#0 = 0
|
||||
Constant main::$0 = sizeof Text
|
||||
Successful SSA optimization Pass2ConstantIdentification
|
||||
Consolidated constant strings into $0_msg7
|
||||
Successful SSA optimization Pass2ConstantStringConsolidation
|
||||
Converting *(pointer+n) to pointer[n] [10] main::msg#0 = *main::$3 -- main::$4[OFFSET_STRUCT_$0_MSG]
|
||||
Successful SSA optimization Pass2InlineDerefIdx
|
||||
Eliminating unused variable main::$3 and assignment [4] main::$3 = main::$4 + OFFSET_STRUCT_$0_MSG
|
||||
Successful SSA optimization PassNEliminateUnusedVars
|
||||
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
|
||||
Resolving array sizeof() sizeof Text
|
||||
Successful SSA optimization PassNSizeOfSimplification
|
||||
Constant right-side identified [1] main::$1 = main::$0 / SIZEOF_STRUCT_$0
|
||||
Successful SSA optimization Pass2ConstantRValueConsolidation
|
||||
Constant main::$1 = main::$0/SIZEOF_STRUCT_$0
|
||||
Successful SSA optimization Pass2ConstantIdentification
|
||||
Adding number conversion cast (unumber) $c in
|
||||
Successful SSA optimization PassNAddNumberTypeConversions
|
||||
Simplifying constant integer cast $c
|
||||
Successful SSA optimization PassNCastSimplification
|
||||
Finalized unsigned number type (byte) $c
|
||||
Successful SSA optimization PassNFinalizeNumberTypeConversions
|
||||
Inlining Noop Cast [2] main::$4 = (byte**)main::txt#2 keeping main::txt#2
|
||||
Successful SSA optimization Pass2NopCastInlining
|
||||
Inlining constant with var siblings main::screen#0
|
||||
Inlining constant with var siblings main::txt#0
|
||||
Inlining constant with var siblings main::i#0
|
||||
Constant inlined main::txt#0 = Text
|
||||
Constant inlined main::screen#0 = (byte*) 1024
|
||||
Constant inlined main::$1 = $c*3/3
|
||||
Constant inlined main::$0 = $c*3
|
||||
Constant inlined SIZEOF_STRUCT_$0 = 3
|
||||
Constant inlined main::i#0 = 0
|
||||
Constant inlined OFFSET_STRUCT_$0_MSG = 1
|
||||
Constant inlined $0_msg7 = $0_msg10
|
||||
Successful SSA optimization Pass2ConstantInlining
|
||||
Adding NOP phi() at start of main
|
||||
CALL GRAPH
|
||||
|
||||
Created 5 initial phi equivalence classes
|
||||
Coalesced [5] main::msg#4 = main::msg#0
|
||||
Coalesced [6] main::screen#9 = main::screen#6
|
||||
Coalesced [13] main::i#7 = main::i#1
|
||||
Coalesced [14] main::txt#7 = main::txt#1
|
||||
Coalesced [15] main::screen#8 = main::screen#2
|
||||
Coalesced [19] main::msg#5 = main::msg#1
|
||||
Coalesced [20] main::screen#10 = main::screen#1
|
||||
Coalesced down to 4 phi equivalence classes
|
||||
Adding NOP phi() at start of main
|
||||
|
||||
FINAL CONTROL FLOW GRAPH
|
||||
|
||||
void main()
|
||||
main: scope:[main] from
|
||||
[0] phi()
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main main::@5
|
||||
[1] main::screen#6 = phi( main/(byte*) 1024, main::@5/main::screen#2 )
|
||||
[1] main::txt#2 = phi( main/Text, main::@5/main::txt#1 )
|
||||
[1] main::i#2 = phi( main/0, main::@5/main::i#1 )
|
||||
[2] if(main::i#2<$c*3/3) goto main::@2
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main::@1
|
||||
[3] return
|
||||
to:@return
|
||||
main::@2: scope:[main] from main::@1
|
||||
[4] main::msg#0 = ((byte**)main::txt#2)[1]
|
||||
to:main::@3
|
||||
main::@3: scope:[main] from main::@2 main::@4
|
||||
[5] main::screen#3 = phi( main::@2/main::screen#6, main::@4/main::screen#1 )
|
||||
[5] main::msg#2 = phi( main::@2/main::msg#0, main::@4/main::msg#1 )
|
||||
[6] if(0!=*main::msg#2) goto main::@4
|
||||
to:main::@5
|
||||
main::@5: scope:[main] from main::@3
|
||||
[7] *main::screen#3 = ' '
|
||||
[8] main::screen#2 = ++ main::screen#3
|
||||
[9] main::i#1 = ++ main::i#2
|
||||
[10] main::txt#1 = main::txt#2 + 3
|
||||
to:main::@1
|
||||
main::@4: scope:[main] from main::@3
|
||||
[11] *main::screen#3 = *main::msg#2
|
||||
[12] main::screen#1 = ++ main::screen#3
|
||||
[13] main::msg#1 = ++ main::msg#2
|
||||
to:main::@3
|
||||
|
||||
|
||||
VARIABLE REGISTER WEIGHTS
|
||||
void main()
|
||||
byte main::i
|
||||
byte main::i#1 11.0
|
||||
byte main::i#2 3.3000000000000003
|
||||
byte* main::msg
|
||||
byte* main::msg#0 22.0
|
||||
byte* main::msg#1 202.0
|
||||
byte* main::msg#2 103.75
|
||||
byte* main::screen
|
||||
byte* main::screen#1 101.0
|
||||
byte* main::screen#2 7.333333333333333
|
||||
byte* main::screen#3 84.0
|
||||
byte* main::screen#6 7.333333333333333
|
||||
struct $0* main::txt
|
||||
struct $0* main::txt#1 22.0
|
||||
struct $0* main::txt#2 2.0
|
||||
|
||||
Initial phi equivalence classes
|
||||
[ main::i#2 main::i#1 ]
|
||||
[ main::txt#2 main::txt#1 ]
|
||||
[ main::msg#2 main::msg#0 main::msg#1 ]
|
||||
[ main::screen#3 main::screen#6 main::screen#2 main::screen#1 ]
|
||||
Complete equivalence classes
|
||||
[ main::i#2 main::i#1 ]
|
||||
[ main::txt#2 main::txt#1 ]
|
||||
[ main::msg#2 main::msg#0 main::msg#1 ]
|
||||
[ main::screen#3 main::screen#6 main::screen#2 main::screen#1 ]
|
||||
Allocated zp[1]:2 [ main::i#2 main::i#1 ]
|
||||
Allocated zp[2]:3 [ main::txt#2 main::txt#1 ]
|
||||
Allocated zp[2]:5 [ main::msg#2 main::msg#0 main::msg#1 ]
|
||||
Allocated zp[2]:7 [ main::screen#3 main::screen#6 main::screen#2 main::screen#1 ]
|
||||
REGISTER UPLIFT POTENTIAL REGISTERS
|
||||
Statement [4] main::msg#0 = ((byte**)main::txt#2)[1] [ main::i#2 main::txt#2 main::screen#6 main::msg#0 ] ( [ main::i#2 main::txt#2 main::screen#6 main::msg#0 ] { } ) always clobbers reg byte a reg byte y
|
||||
Removing always clobbered register reg byte a as potential for zp[1]:2 [ main::i#2 main::i#1 ]
|
||||
Removing always clobbered register reg byte y as potential for zp[1]:2 [ main::i#2 main::i#1 ]
|
||||
Statement [6] if(0!=*main::msg#2) goto main::@4 [ main::i#2 main::txt#2 main::msg#2 main::screen#3 ] ( [ main::i#2 main::txt#2 main::msg#2 main::screen#3 ] { } ) always clobbers reg byte a reg byte y
|
||||
Statement [7] *main::screen#3 = ' ' [ main::i#2 main::txt#2 main::screen#3 ] ( [ main::i#2 main::txt#2 main::screen#3 ] { } ) always clobbers reg byte a reg byte y
|
||||
Statement [10] main::txt#1 = main::txt#2 + 3 [ main::i#1 main::txt#1 main::screen#2 ] ( [ main::i#1 main::txt#1 main::screen#2 ] { } ) always clobbers reg byte a
|
||||
Statement [11] *main::screen#3 = *main::msg#2 [ main::i#2 main::txt#2 main::msg#2 main::screen#3 ] ( [ main::i#2 main::txt#2 main::msg#2 main::screen#3 ] { } ) always clobbers reg byte a reg byte y
|
||||
Statement [4] main::msg#0 = ((byte**)main::txt#2)[1] [ main::i#2 main::txt#2 main::screen#6 main::msg#0 ] ( [ main::i#2 main::txt#2 main::screen#6 main::msg#0 ] { } ) always clobbers reg byte a reg byte y
|
||||
Statement [6] if(0!=*main::msg#2) goto main::@4 [ main::i#2 main::txt#2 main::msg#2 main::screen#3 ] ( [ main::i#2 main::txt#2 main::msg#2 main::screen#3 ] { } ) always clobbers reg byte a reg byte y
|
||||
Statement [7] *main::screen#3 = ' ' [ main::i#2 main::txt#2 main::screen#3 ] ( [ main::i#2 main::txt#2 main::screen#3 ] { } ) always clobbers reg byte a reg byte y
|
||||
Statement [10] main::txt#1 = main::txt#2 + 3 [ main::i#1 main::txt#1 main::screen#2 ] ( [ main::i#1 main::txt#1 main::screen#2 ] { } ) always clobbers reg byte a
|
||||
Statement [11] *main::screen#3 = *main::msg#2 [ main::i#2 main::txt#2 main::msg#2 main::screen#3 ] ( [ main::i#2 main::txt#2 main::msg#2 main::screen#3 ] { } ) always clobbers reg byte a reg byte y
|
||||
Potential registers zp[1]:2 [ main::i#2 main::i#1 ] : zp[1]:2 , reg byte x ,
|
||||
Potential registers zp[2]:3 [ main::txt#2 main::txt#1 ] : zp[2]:3 ,
|
||||
Potential registers zp[2]:5 [ main::msg#2 main::msg#0 main::msg#1 ] : zp[2]:5 ,
|
||||
Potential registers zp[2]:7 [ main::screen#3 main::screen#6 main::screen#2 main::screen#1 ] : zp[2]:7 ,
|
||||
|
||||
REGISTER UPLIFT SCOPES
|
||||
Uplift Scope [main] 327.75: zp[2]:5 [ main::msg#2 main::msg#0 main::msg#1 ] 199.67: zp[2]:7 [ main::screen#3 main::screen#6 main::screen#2 main::screen#1 ] 24: zp[2]:3 [ main::txt#2 main::txt#1 ] 14.3: zp[1]:2 [ main::i#2 main::i#1 ]
|
||||
Uplift Scope [$0]
|
||||
Uplift Scope []
|
||||
|
||||
Uplifting [main] best 7141 combination zp[2]:5 [ main::msg#2 main::msg#0 main::msg#1 ] zp[2]:7 [ main::screen#3 main::screen#6 main::screen#2 main::screen#1 ] zp[2]:3 [ main::txt#2 main::txt#1 ] reg byte x [ main::i#2 main::i#1 ]
|
||||
Uplifting [$0] best 7141 combination
|
||||
Uplifting [] best 7141 combination
|
||||
Allocated (was zp[2]:3) zp[2]:2 [ main::txt#2 main::txt#1 ]
|
||||
Allocated (was zp[2]:5) zp[2]:4 [ main::msg#2 main::msg#0 main::msg#1 ]
|
||||
Allocated (was zp[2]:7) zp[2]:6 [ main::screen#3 main::screen#6 main::screen#2 main::screen#1 ]
|
||||
|
||||
ASSEMBLER BEFORE OPTIMIZATION
|
||||
// File Comments
|
||||
// Structs with char* pointer members
|
||||
// https://gitlab.com/camelot/kickc/-/issues/397
|
||||
// Upstart
|
||||
// Commodore 64 PRG executable file
|
||||
.file [name="struct-49.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
|
||||
.segment Code
|
||||
// main
|
||||
main: {
|
||||
.label msg = 4
|
||||
.label screen = 6
|
||||
.label txt = 2
|
||||
// [1] phi from main to main::@1 [phi:main->main::@1]
|
||||
__b1_from_main:
|
||||
// [1] phi main::screen#6 = (byte*) 1024 [phi:main->main::@1#0] -- pbuz1=pbuc1
|
||||
lda #<$400
|
||||
sta.z screen
|
||||
lda #>$400
|
||||
sta.z screen+1
|
||||
// [1] phi main::txt#2 = Text [phi:main->main::@1#1] -- pssz1=pssc1
|
||||
lda #<Text
|
||||
sta.z txt
|
||||
lda #>Text
|
||||
sta.z txt+1
|
||||
// [1] phi main::i#2 = 0 [phi:main->main::@1#2] -- vbuxx=vbuc1
|
||||
ldx #0
|
||||
jmp __b1
|
||||
// main::@1
|
||||
__b1:
|
||||
// [2] if(main::i#2<$c*3/3) goto main::@2 -- vbuxx_lt_vbuc1_then_la1
|
||||
cpx #$c*3/3
|
||||
bcc __b2
|
||||
jmp __breturn
|
||||
// main::@return
|
||||
__breturn:
|
||||
// [3] return
|
||||
rts
|
||||
// main::@2
|
||||
__b2:
|
||||
// [4] main::msg#0 = ((byte**)main::txt#2)[1] -- pbuz1=qbuz2_derefidx_vbuc1
|
||||
ldy #1
|
||||
lda (txt),y
|
||||
sta.z msg
|
||||
iny
|
||||
lda (txt),y
|
||||
sta.z msg+1
|
||||
// [5] phi from main::@2 main::@4 to main::@3 [phi:main::@2/main::@4->main::@3]
|
||||
__b3_from___b2:
|
||||
__b3_from___b4:
|
||||
// [5] phi main::screen#3 = main::screen#6 [phi:main::@2/main::@4->main::@3#0] -- register_copy
|
||||
// [5] phi main::msg#2 = main::msg#0 [phi:main::@2/main::@4->main::@3#1] -- register_copy
|
||||
jmp __b3
|
||||
// main::@3
|
||||
__b3:
|
||||
// [6] if(0!=*main::msg#2) goto main::@4 -- 0_neq__deref_pbuz1_then_la1
|
||||
ldy #0
|
||||
lda (msg),y
|
||||
cmp #0
|
||||
bne __b4
|
||||
jmp __b5
|
||||
// main::@5
|
||||
__b5:
|
||||
// [7] *main::screen#3 = ' ' -- _deref_pbuz1=vbuc1
|
||||
lda #' '
|
||||
ldy #0
|
||||
sta (screen),y
|
||||
// [8] main::screen#2 = ++ main::screen#3 -- pbuz1=_inc_pbuz1
|
||||
inc.z screen
|
||||
bne !+
|
||||
inc.z screen+1
|
||||
!:
|
||||
// [9] main::i#1 = ++ main::i#2 -- vbuxx=_inc_vbuxx
|
||||
inx
|
||||
// [10] main::txt#1 = main::txt#2 + 3 -- pssz1=pssz1_plus_vbuc1
|
||||
lda #3
|
||||
clc
|
||||
adc.z txt
|
||||
sta.z txt
|
||||
bcc !+
|
||||
inc.z txt+1
|
||||
!:
|
||||
// [1] phi from main::@5 to main::@1 [phi:main::@5->main::@1]
|
||||
__b1_from___b5:
|
||||
// [1] phi main::screen#6 = main::screen#2 [phi:main::@5->main::@1#0] -- register_copy
|
||||
// [1] phi main::txt#2 = main::txt#1 [phi:main::@5->main::@1#1] -- register_copy
|
||||
// [1] phi main::i#2 = main::i#1 [phi:main::@5->main::@1#2] -- register_copy
|
||||
jmp __b1
|
||||
// main::@4
|
||||
__b4:
|
||||
// [11] *main::screen#3 = *main::msg#2 -- _deref_pbuz1=_deref_pbuz2
|
||||
ldy #0
|
||||
lda (msg),y
|
||||
ldy #0
|
||||
sta (screen),y
|
||||
// [12] main::screen#1 = ++ main::screen#3 -- pbuz1=_inc_pbuz1
|
||||
inc.z screen
|
||||
bne !+
|
||||
inc.z screen+1
|
||||
!:
|
||||
// [13] main::msg#1 = ++ main::msg#2 -- pbuz1=_inc_pbuz1
|
||||
inc.z msg
|
||||
bne !+
|
||||
inc.z msg+1
|
||||
!:
|
||||
jmp __b3_from___b4
|
||||
}
|
||||
// File Data
|
||||
.segment Data
|
||||
Text: .byte 2
|
||||
.word __0_msg
|
||||
.byte 4
|
||||
.word __0_msg1
|
||||
.byte 5
|
||||
.word __0_msg2
|
||||
.byte 9
|
||||
.word __0_msg3
|
||||
.byte $b
|
||||
.word __0_msg4
|
||||
.byte $c
|
||||
.word __0_msg5
|
||||
.byte $d
|
||||
.word __0_msg6
|
||||
.byte $e
|
||||
.word __0_msg10
|
||||
.byte $f
|
||||
.word __0_msg8
|
||||
.byte $12
|
||||
.word __0_msg9
|
||||
.byte $13
|
||||
.word __0_msg10
|
||||
.byte $17
|
||||
.word __0_msg11
|
||||
__0_msg: .text "Wolfgang Amadeus Mozart"
|
||||
.byte 0
|
||||
__0_msg1: .text @"\"Eine kleine Nachtmusik\""
|
||||
.byte 0
|
||||
__0_msg2: .text "(KV 525)"
|
||||
.byte 0
|
||||
__0_msg3: .text "Ported to the SID in 1987 by"
|
||||
.byte 0
|
||||
__0_msg4: .text "Joachim von Bassewitz"
|
||||
.byte 0
|
||||
__0_msg5: .text "(joachim@von-bassewitz.de)"
|
||||
.byte 0
|
||||
__0_msg6: .text "and"
|
||||
.byte 0
|
||||
__0_msg8: .text "(ullrich@von-bassewitz.de)"
|
||||
.byte 0
|
||||
__0_msg9: .text "C Implementation by"
|
||||
.byte 0
|
||||
__0_msg10: .text "Ullrich von Bassewitz"
|
||||
.byte 0
|
||||
__0_msg11: .text "Press any key to quit..."
|
||||
.byte 0
|
||||
|
||||
ASSEMBLER OPTIMIZATIONS
|
||||
Removing instruction jmp __b1
|
||||
Removing instruction jmp __breturn
|
||||
Removing instruction jmp __b3
|
||||
Removing instruction jmp __b5
|
||||
Succesful ASM optimization Pass5NextJumpElimination
|
||||
Removing instruction ldy #0
|
||||
Succesful ASM optimization Pass5UnnecesaryLoadElimination
|
||||
Replacing label __b3_from___b4 with __b3
|
||||
Removing instruction __b3_from___b2:
|
||||
Removing instruction __b3_from___b4:
|
||||
Succesful ASM optimization Pass5RedundantLabelElimination
|
||||
Removing instruction __b1_from_main:
|
||||
Removing instruction __breturn:
|
||||
Removing instruction __b5:
|
||||
Removing instruction __b1_from___b5:
|
||||
Succesful ASM optimization Pass5UnusedLabelElimination
|
||||
Removing instruction ldy #0
|
||||
Succesful ASM optimization Pass5UnnecesaryLoadElimination
|
||||
|
||||
FINAL SYMBOL TABLE
|
||||
constant byte* $0_msg[$18] = "Wolfgang Amadeus Mozart"
|
||||
constant byte* $0_msg1[$19] = ""Eine kleine Nachtmusik""
|
||||
constant byte* $0_msg10[$16] = "Ullrich von Bassewitz"
|
||||
constant byte* $0_msg11[$19] = "Press any key to quit..."
|
||||
constant byte* $0_msg2[9] = "(KV 525)"
|
||||
constant byte* $0_msg3[$1d] = "Ported to the SID in 1987 by"
|
||||
constant byte* $0_msg4[$16] = "Joachim von Bassewitz"
|
||||
constant byte* $0_msg5[$1b] = "(joachim@von-bassewitz.de)"
|
||||
constant byte* $0_msg6[4] = "and"
|
||||
constant byte* $0_msg8[$1b] = "(ullrich@von-bassewitz.de)"
|
||||
constant byte* $0_msg9[$14] = "C Implementation by"
|
||||
constant struct $0* Text[] = { { Y: 2, Msg: $0_msg }, { Y: 4, Msg: $0_msg1 }, { Y: 5, Msg: $0_msg2 }, { Y: 9, Msg: $0_msg3 }, { Y: $b, Msg: $0_msg4 }, { Y: $c, Msg: $0_msg5 }, { Y: $d, Msg: $0_msg6 }, { Y: $e, Msg: $0_msg10 }, { Y: $f, Msg: $0_msg8 }, { Y: $12, Msg: $0_msg9 }, { Y: $13, Msg: $0_msg10 }, { Y: $17, Msg: $0_msg11 } }
|
||||
void main()
|
||||
byte main::i
|
||||
byte main::i#1 reg byte x 11.0
|
||||
byte main::i#2 reg byte x 3.3000000000000003
|
||||
byte* main::msg
|
||||
byte* main::msg#0 msg zp[2]:4 22.0
|
||||
byte* main::msg#1 msg zp[2]:4 202.0
|
||||
byte* main::msg#2 msg zp[2]:4 103.75
|
||||
byte* main::screen
|
||||
byte* main::screen#1 screen zp[2]:6 101.0
|
||||
byte* main::screen#2 screen zp[2]:6 7.333333333333333
|
||||
byte* main::screen#3 screen zp[2]:6 84.0
|
||||
byte* main::screen#6 screen zp[2]:6 7.333333333333333
|
||||
struct $0* main::txt
|
||||
struct $0* main::txt#1 txt zp[2]:2 22.0
|
||||
struct $0* main::txt#2 txt zp[2]:2 2.0
|
||||
|
||||
reg byte x [ main::i#2 main::i#1 ]
|
||||
zp[2]:2 [ main::txt#2 main::txt#1 ]
|
||||
zp[2]:4 [ main::msg#2 main::msg#0 main::msg#1 ]
|
||||
zp[2]:6 [ main::screen#3 main::screen#6 main::screen#2 main::screen#1 ]
|
||||
|
||||
|
||||
FINAL ASSEMBLER
|
||||
Score: 6261
|
||||
|
||||
// File Comments
|
||||
// Structs with char* pointer members
|
||||
// https://gitlab.com/camelot/kickc/-/issues/397
|
||||
// Upstart
|
||||
// Commodore 64 PRG executable file
|
||||
.file [name="struct-49.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
|
||||
.segment Code
|
||||
// main
|
||||
main: {
|
||||
.label msg = 4
|
||||
.label screen = 6
|
||||
.label txt = 2
|
||||
// [1] phi from main to main::@1 [phi:main->main::@1]
|
||||
// [1] phi main::screen#6 = (byte*) 1024 [phi:main->main::@1#0] -- pbuz1=pbuc1
|
||||
lda #<$400
|
||||
sta.z screen
|
||||
lda #>$400
|
||||
sta.z screen+1
|
||||
// [1] phi main::txt#2 = Text [phi:main->main::@1#1] -- pssz1=pssc1
|
||||
lda #<Text
|
||||
sta.z txt
|
||||
lda #>Text
|
||||
sta.z txt+1
|
||||
// [1] phi main::i#2 = 0 [phi:main->main::@1#2] -- vbuxx=vbuc1
|
||||
ldx #0
|
||||
// main::@1
|
||||
__b1:
|
||||
// for(char i=0;i<sizeof(Text)/sizeof(TextDesc); i++, txt++)
|
||||
// [2] if(main::i#2<$c*3/3) goto main::@2 -- vbuxx_lt_vbuc1_then_la1
|
||||
cpx #$c*3/3
|
||||
bcc __b2
|
||||
// main::@return
|
||||
// }
|
||||
// [3] return
|
||||
rts
|
||||
// main::@2
|
||||
__b2:
|
||||
// char* msg = txt->Msg
|
||||
// [4] main::msg#0 = ((byte**)main::txt#2)[1] -- pbuz1=qbuz2_derefidx_vbuc1
|
||||
ldy #1
|
||||
lda (txt),y
|
||||
sta.z msg
|
||||
iny
|
||||
lda (txt),y
|
||||
sta.z msg+1
|
||||
// [5] phi from main::@2 main::@4 to main::@3 [phi:main::@2/main::@4->main::@3]
|
||||
// [5] phi main::screen#3 = main::screen#6 [phi:main::@2/main::@4->main::@3#0] -- register_copy
|
||||
// [5] phi main::msg#2 = main::msg#0 [phi:main::@2/main::@4->main::@3#1] -- register_copy
|
||||
// main::@3
|
||||
__b3:
|
||||
// for(char* msg = txt->Msg; *msg; msg++)
|
||||
// [6] if(0!=*main::msg#2) goto main::@4 -- 0_neq__deref_pbuz1_then_la1
|
||||
ldy #0
|
||||
lda (msg),y
|
||||
cmp #0
|
||||
bne __b4
|
||||
// main::@5
|
||||
// *(screen++) = ' '
|
||||
// [7] *main::screen#3 = ' ' -- _deref_pbuz1=vbuc1
|
||||
lda #' '
|
||||
sta (screen),y
|
||||
// *(screen++) = ' ';
|
||||
// [8] main::screen#2 = ++ main::screen#3 -- pbuz1=_inc_pbuz1
|
||||
inc.z screen
|
||||
bne !+
|
||||
inc.z screen+1
|
||||
!:
|
||||
// for(char i=0;i<sizeof(Text)/sizeof(TextDesc); i++, txt++)
|
||||
// [9] main::i#1 = ++ main::i#2 -- vbuxx=_inc_vbuxx
|
||||
inx
|
||||
// [10] main::txt#1 = main::txt#2 + 3 -- pssz1=pssz1_plus_vbuc1
|
||||
lda #3
|
||||
clc
|
||||
adc.z txt
|
||||
sta.z txt
|
||||
bcc !+
|
||||
inc.z txt+1
|
||||
!:
|
||||
// [1] phi from main::@5 to main::@1 [phi:main::@5->main::@1]
|
||||
// [1] phi main::screen#6 = main::screen#2 [phi:main::@5->main::@1#0] -- register_copy
|
||||
// [1] phi main::txt#2 = main::txt#1 [phi:main::@5->main::@1#1] -- register_copy
|
||||
// [1] phi main::i#2 = main::i#1 [phi:main::@5->main::@1#2] -- register_copy
|
||||
jmp __b1
|
||||
// main::@4
|
||||
__b4:
|
||||
// *(screen++) = *msg
|
||||
// [11] *main::screen#3 = *main::msg#2 -- _deref_pbuz1=_deref_pbuz2
|
||||
ldy #0
|
||||
lda (msg),y
|
||||
sta (screen),y
|
||||
// *(screen++) = *msg;
|
||||
// [12] main::screen#1 = ++ main::screen#3 -- pbuz1=_inc_pbuz1
|
||||
inc.z screen
|
||||
bne !+
|
||||
inc.z screen+1
|
||||
!:
|
||||
// for(char* msg = txt->Msg; *msg; msg++)
|
||||
// [13] main::msg#1 = ++ main::msg#2 -- pbuz1=_inc_pbuz1
|
||||
inc.z msg
|
||||
bne !+
|
||||
inc.z msg+1
|
||||
!:
|
||||
jmp __b3
|
||||
}
|
||||
// File Data
|
||||
.segment Data
|
||||
Text: .byte 2
|
||||
.word __0_msg
|
||||
.byte 4
|
||||
.word __0_msg1
|
||||
.byte 5
|
||||
.word __0_msg2
|
||||
.byte 9
|
||||
.word __0_msg3
|
||||
.byte $b
|
||||
.word __0_msg4
|
||||
.byte $c
|
||||
.word __0_msg5
|
||||
.byte $d
|
||||
.word __0_msg6
|
||||
.byte $e
|
||||
.word __0_msg10
|
||||
.byte $f
|
||||
.word __0_msg8
|
||||
.byte $12
|
||||
.word __0_msg9
|
||||
.byte $13
|
||||
.word __0_msg10
|
||||
.byte $17
|
||||
.word __0_msg11
|
||||
__0_msg: .text "Wolfgang Amadeus Mozart"
|
||||
.byte 0
|
||||
__0_msg1: .text @"\"Eine kleine Nachtmusik\""
|
||||
.byte 0
|
||||
__0_msg2: .text "(KV 525)"
|
||||
.byte 0
|
||||
__0_msg3: .text "Ported to the SID in 1987 by"
|
||||
.byte 0
|
||||
__0_msg4: .text "Joachim von Bassewitz"
|
||||
.byte 0
|
||||
__0_msg5: .text "(joachim@von-bassewitz.de)"
|
||||
.byte 0
|
||||
__0_msg6: .text "and"
|
||||
.byte 0
|
||||
__0_msg8: .text "(ullrich@von-bassewitz.de)"
|
||||
.byte 0
|
||||
__0_msg9: .text "C Implementation by"
|
||||
.byte 0
|
||||
__0_msg10: .text "Ullrich von Bassewitz"
|
||||
.byte 0
|
||||
__0_msg11: .text "Press any key to quit..."
|
||||
.byte 0
|
||||
|
33
src/test/ref/struct-49.sym
Normal file
33
src/test/ref/struct-49.sym
Normal file
@ -0,0 +1,33 @@
|
||||
constant byte* $0_msg[$18] = "Wolfgang Amadeus Mozart"
|
||||
constant byte* $0_msg1[$19] = ""Eine kleine Nachtmusik""
|
||||
constant byte* $0_msg10[$16] = "Ullrich von Bassewitz"
|
||||
constant byte* $0_msg11[$19] = "Press any key to quit..."
|
||||
constant byte* $0_msg2[9] = "(KV 525)"
|
||||
constant byte* $0_msg3[$1d] = "Ported to the SID in 1987 by"
|
||||
constant byte* $0_msg4[$16] = "Joachim von Bassewitz"
|
||||
constant byte* $0_msg5[$1b] = "(joachim@von-bassewitz.de)"
|
||||
constant byte* $0_msg6[4] = "and"
|
||||
constant byte* $0_msg8[$1b] = "(ullrich@von-bassewitz.de)"
|
||||
constant byte* $0_msg9[$14] = "C Implementation by"
|
||||
constant struct $0* Text[] = { { Y: 2, Msg: $0_msg }, { Y: 4, Msg: $0_msg1 }, { Y: 5, Msg: $0_msg2 }, { Y: 9, Msg: $0_msg3 }, { Y: $b, Msg: $0_msg4 }, { Y: $c, Msg: $0_msg5 }, { Y: $d, Msg: $0_msg6 }, { Y: $e, Msg: $0_msg10 }, { Y: $f, Msg: $0_msg8 }, { Y: $12, Msg: $0_msg9 }, { Y: $13, Msg: $0_msg10 }, { Y: $17, Msg: $0_msg11 } }
|
||||
void main()
|
||||
byte main::i
|
||||
byte main::i#1 reg byte x 11.0
|
||||
byte main::i#2 reg byte x 3.3000000000000003
|
||||
byte* main::msg
|
||||
byte* main::msg#0 msg zp[2]:4 22.0
|
||||
byte* main::msg#1 msg zp[2]:4 202.0
|
||||
byte* main::msg#2 msg zp[2]:4 103.75
|
||||
byte* main::screen
|
||||
byte* main::screen#1 screen zp[2]:6 101.0
|
||||
byte* main::screen#2 screen zp[2]:6 7.333333333333333
|
||||
byte* main::screen#3 screen zp[2]:6 84.0
|
||||
byte* main::screen#6 screen zp[2]:6 7.333333333333333
|
||||
struct $0* main::txt
|
||||
struct $0* main::txt#1 txt zp[2]:2 22.0
|
||||
struct $0* main::txt#2 txt zp[2]:2 2.0
|
||||
|
||||
reg byte x [ main::i#2 main::i#1 ]
|
||||
zp[2]:2 [ main::txt#2 main::txt#1 ]
|
||||
zp[2]:4 [ main::msg#2 main::msg#0 main::msg#1 ]
|
||||
zp[2]:6 [ main::screen#3 main::screen#6 main::screen#2 main::screen#1 ]
|
Loading…
x
Reference in New Issue
Block a user