mirror of
https://gitlab.com/camelot/kickc.git
synced 2024-12-19 15:29:48 +00:00
Fixed constant inlining of strings. Closes #102
This commit is contained in:
parent
23ff5bab95
commit
7fd8669cc1
@ -8,9 +8,7 @@ import dk.camelot64.kickc.model.symbols.Symbol;
|
||||
import dk.camelot64.kickc.model.symbols.Variable;
|
||||
import dk.camelot64.kickc.model.types.SymbolType;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* Compiler Pass consolidating unnamed constants and constant aliasses into the place using them (instructions or the definition of another constant value).
|
||||
@ -36,6 +34,15 @@ public class Pass2ConstantInlining extends Pass2SsaOptimization {
|
||||
inline.putAll(findUnnamedConstants());
|
||||
inline.putAll(findAliasConstants());
|
||||
inline.putAll(findConstVarVersions());
|
||||
|
||||
// Remove all string constants
|
||||
List<ConstantRef> refs = new ArrayList(inline.keySet());
|
||||
for(ConstantRef constantRef : refs) {
|
||||
ConstantValue constantValue = inline.get(constantRef);
|
||||
if(constantValue instanceof ConstantString) {
|
||||
inline.remove(constantRef);
|
||||
}
|
||||
}
|
||||
|
||||
// Perform alias replacement within the constant values inside the aliases
|
||||
replaceInValues(inline);
|
||||
|
@ -50,6 +50,11 @@ public class TestPrograms {
|
||||
compileAndCompare("c64dtv-gfxexplorer");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInlineString2() throws IOException, URISyntaxException {
|
||||
compileAndCompare("inline-string-2");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testVarForwardProblem() throws IOException, URISyntaxException {
|
||||
try {
|
||||
|
@ -164,31 +164,41 @@ byte[] preset_chunky = { 7, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0,
|
||||
// Preset: Sixs FREDs mode
|
||||
byte[] preset_sixsfred = { 8, 1, 1, 1, 1, 1, 0, 0, 0, 0, $9, 0, 0, 0, 1, 0, 0, $a, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0 };
|
||||
|
||||
|
||||
// Apply a form value preset to the form values
|
||||
// idx is the ID of the preset
|
||||
void apply_preset(byte idx) {
|
||||
byte* preset;
|
||||
byte* name;
|
||||
if(idx==0) {
|
||||
preset = preset_stdchar;
|
||||
name = "Standard Charset @";
|
||||
} else if(idx==1){
|
||||
preset = preset_ecmchar;
|
||||
name = "Extended Color Charset @";
|
||||
} else if(idx==2){
|
||||
preset = preset_stdbm;
|
||||
name = "Standard Bitmap @";
|
||||
} else if(idx==3){
|
||||
preset = preset_mcbm;
|
||||
name = "Multicolor Bitmap @";
|
||||
} else if(idx==4){
|
||||
preset = preset_hi_stdchar;
|
||||
name = "Hicolor Charset @";
|
||||
} else if(idx==5){
|
||||
preset = preset_hi_ecmchar;
|
||||
name = "Hicolor Extended Color Charset@";
|
||||
} else if(idx==6){
|
||||
preset = preset_twoplane;
|
||||
name = "Twoplane Bitmap @";
|
||||
} else if(idx==7){
|
||||
preset = preset_chunky;
|
||||
name = "Chunky 8bpp @";
|
||||
} else if(idx==8){
|
||||
preset = preset_sixsfred;
|
||||
name = "Sixs Fred @";
|
||||
} else {
|
||||
preset = preset_stdchar;
|
||||
name = "Standard Charset @";
|
||||
}
|
||||
|
||||
// Copy preset values into the fields
|
||||
@ -197,6 +207,8 @@ void apply_preset(byte idx) {
|
||||
*values++ = *preset++;
|
||||
}
|
||||
|
||||
print_str_at(name, FORM_SCREEN+40*2+10);
|
||||
|
||||
}
|
||||
|
||||
// Form fields direct addressing
|
||||
|
23
src/test/java/dk/camelot64/kickc/test/kc/inline-string-2.kc
Normal file
23
src/test/java/dk/camelot64/kickc/test/kc/inline-string-2.kc
Normal file
@ -0,0 +1,23 @@
|
||||
// Inline Strings in assignments
|
||||
|
||||
void main() {
|
||||
print_msg(1);
|
||||
print_msg(2);
|
||||
}
|
||||
|
||||
void print_msg(byte idx) {
|
||||
byte* msg;
|
||||
if(idx==1) {
|
||||
msg = "Hello @";
|
||||
} else {
|
||||
msg = "World!@";
|
||||
}
|
||||
print(msg);
|
||||
}
|
||||
|
||||
byte* screen = $0400;
|
||||
void print(byte* msg) {
|
||||
while(*msg!='@') {
|
||||
*(screen++) = *(msg++);
|
||||
}
|
||||
}
|
@ -915,11 +915,25 @@ form_field_ptr: {
|
||||
rts
|
||||
}
|
||||
apply_preset: {
|
||||
.label values = 5
|
||||
.label preset = 3
|
||||
.label values = $10
|
||||
.label preset = 5
|
||||
.label name = 3
|
||||
cmp #0
|
||||
bne b1
|
||||
lda #<name_0
|
||||
sta name
|
||||
lda #>name_0
|
||||
sta name+1
|
||||
lda #<preset_stdchar
|
||||
sta preset
|
||||
lda #>preset_stdchar
|
||||
sta preset+1
|
||||
jmp b2
|
||||
b4:
|
||||
lda #<name_8
|
||||
sta name
|
||||
lda #>name_8
|
||||
sta name+1
|
||||
lda #<preset_stdchar
|
||||
sta preset
|
||||
lda #>preset_stdchar
|
||||
@ -945,10 +959,15 @@ apply_preset: {
|
||||
inx
|
||||
cpx #form_fields_cnt
|
||||
bne b19
|
||||
jsr print_str_at
|
||||
rts
|
||||
b1:
|
||||
cmp #1
|
||||
bne b3
|
||||
lda #<name_1
|
||||
sta name
|
||||
lda #>name_1
|
||||
sta name+1
|
||||
lda #<preset_ecmchar
|
||||
sta preset
|
||||
lda #>preset_ecmchar
|
||||
@ -957,6 +976,10 @@ apply_preset: {
|
||||
b3:
|
||||
cmp #2
|
||||
bne b5
|
||||
lda #<name_2
|
||||
sta name
|
||||
lda #>name_2
|
||||
sta name+1
|
||||
lda #<preset_stdbm
|
||||
sta preset
|
||||
lda #>preset_stdbm
|
||||
@ -965,6 +988,10 @@ apply_preset: {
|
||||
b5:
|
||||
cmp #3
|
||||
bne b7
|
||||
lda #<name_3
|
||||
sta name
|
||||
lda #>name_3
|
||||
sta name+1
|
||||
lda #<preset_mcbm
|
||||
sta preset
|
||||
lda #>preset_mcbm
|
||||
@ -973,6 +1000,10 @@ apply_preset: {
|
||||
b7:
|
||||
cmp #4
|
||||
bne b9
|
||||
lda #<name_4
|
||||
sta name
|
||||
lda #>name_4
|
||||
sta name+1
|
||||
lda #<preset_hi_stdchar
|
||||
sta preset
|
||||
lda #>preset_hi_stdchar
|
||||
@ -981,6 +1012,10 @@ apply_preset: {
|
||||
b9:
|
||||
cmp #5
|
||||
bne b11
|
||||
lda #<name_5
|
||||
sta name
|
||||
lda #>name_5
|
||||
sta name+1
|
||||
lda #<preset_hi_ecmchar
|
||||
sta preset
|
||||
lda #>preset_hi_ecmchar
|
||||
@ -989,6 +1024,10 @@ apply_preset: {
|
||||
b11:
|
||||
cmp #6
|
||||
bne b13
|
||||
lda #<name_6
|
||||
sta name
|
||||
lda #>name_6
|
||||
sta name+1
|
||||
lda #<preset_twoplane
|
||||
sta preset
|
||||
lda #>preset_twoplane
|
||||
@ -997,6 +1036,10 @@ apply_preset: {
|
||||
b13:
|
||||
cmp #7
|
||||
bne b15
|
||||
lda #<name_7
|
||||
sta name
|
||||
lda #>name_7
|
||||
sta name+1
|
||||
lda #<preset_chunky
|
||||
sta preset
|
||||
lda #>preset_chunky
|
||||
@ -1007,11 +1050,52 @@ apply_preset: {
|
||||
beq !b4+
|
||||
jmp b4
|
||||
!b4:
|
||||
lda #<name_9
|
||||
sta name
|
||||
lda #>name_9
|
||||
sta name+1
|
||||
lda #<preset_sixsfred
|
||||
sta preset
|
||||
lda #>preset_sixsfred
|
||||
sta preset+1
|
||||
jmp b2
|
||||
name_0: .text "Standard Charset @"
|
||||
name_1: .text "Extended Color Charset @"
|
||||
name_2: .text "Standard Bitmap @"
|
||||
name_3: .text "Multicolor Bitmap @"
|
||||
name_4: .text "Hicolor Charset @"
|
||||
name_5: .text "Hicolor Extended Color Charset@"
|
||||
name_6: .text "Twoplane Bitmap @"
|
||||
name_7: .text "Chunky 8bpp @"
|
||||
name_8: .text "Standard Charset @"
|
||||
name_9: .text "Sixs Fred @"
|
||||
}
|
||||
print_str_at: {
|
||||
.label at = 5
|
||||
.label str = 3
|
||||
lda #<FORM_SCREEN+$28*2+$a
|
||||
sta at
|
||||
lda #>FORM_SCREEN+$28*2+$a
|
||||
sta at+1
|
||||
b1:
|
||||
ldy #0
|
||||
lda (str),y
|
||||
cmp #'@'
|
||||
bne b2
|
||||
rts
|
||||
b2:
|
||||
ldy #0
|
||||
lda (str),y
|
||||
sta (at),y
|
||||
inc at
|
||||
bne !+
|
||||
inc at+1
|
||||
!:
|
||||
inc str
|
||||
bne !+
|
||||
inc str+1
|
||||
!:
|
||||
jmp b1
|
||||
}
|
||||
form_control: {
|
||||
.label field = 3
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -174,6 +174,7 @@
|
||||
(label) apply_preset::@2
|
||||
(label) apply_preset::@3
|
||||
(label) apply_preset::@36
|
||||
(label) apply_preset::@38
|
||||
(label) apply_preset::@5
|
||||
(label) apply_preset::@7
|
||||
(label) apply_preset::@9
|
||||
@ -183,13 +184,25 @@
|
||||
(byte) apply_preset::i#2 reg byte x 500.5
|
||||
(byte) apply_preset::idx
|
||||
(byte) apply_preset::idx#0 reg byte a 13.222222222222214
|
||||
(byte*) apply_preset::name
|
||||
(const string) apply_preset::name#0 name#0 = (string) "Standard Charset @"
|
||||
(const string) apply_preset::name#1 name#1 = (string) "Extended Color Charset @"
|
||||
(byte*) apply_preset::name#12 name zp ZP_WORD:3 0.2857142857142857
|
||||
(const string) apply_preset::name#2 name#2 = (string) "Standard Bitmap @"
|
||||
(const string) apply_preset::name#3 name#3 = (string) "Multicolor Bitmap @"
|
||||
(const string) apply_preset::name#4 name#4 = (string) "Hicolor Charset @"
|
||||
(const string) apply_preset::name#5 name#5 = (string) "Hicolor Extended Color Charset@"
|
||||
(const string) apply_preset::name#6 name#6 = (string) "Twoplane Bitmap @"
|
||||
(const string) apply_preset::name#7 name#7 = (string) "Chunky 8bpp @"
|
||||
(const string) apply_preset::name#8 name#8 = (string) "Standard Charset @"
|
||||
(const string) apply_preset::name#9 name#9 = (string) "Sixs Fred @"
|
||||
(byte*) apply_preset::preset
|
||||
(byte*) apply_preset::preset#10 preset zp ZP_WORD:3 667.3333333333334
|
||||
(byte*) apply_preset::preset#11 preset zp ZP_WORD:3 1001.6666666666667
|
||||
(byte*) apply_preset::preset#12 preset zp ZP_WORD:3 2.0
|
||||
(byte*) apply_preset::preset#10 preset zp ZP_WORD:5 667.3333333333334
|
||||
(byte*) apply_preset::preset#11 preset zp ZP_WORD:5 1001.6666666666667
|
||||
(byte*) apply_preset::preset#12 preset zp ZP_WORD:5 2.0
|
||||
(byte*) apply_preset::values
|
||||
(byte*) apply_preset::values#1 values zp ZP_WORD:5 500.5
|
||||
(byte*) apply_preset::values#2 values zp ZP_WORD:5 1501.5
|
||||
(byte*) apply_preset::values#1 values zp ZP_WORD:16 500.5
|
||||
(byte*) apply_preset::values#2 values zp ZP_WORD:16 1501.5
|
||||
(void()) bitmap_clear()
|
||||
(word~) bitmap_clear::$3 $3 zp ZP_WORD:3 2.0
|
||||
(label) bitmap_clear::@1
|
||||
@ -1213,6 +1226,17 @@
|
||||
(label) print_set_screen::@return
|
||||
(byte*) print_set_screen::screen
|
||||
(byte*) print_set_screen::screen#2 screen zp ZP_WORD:16 5.631578947368421
|
||||
(void()) print_str_at((byte*) print_str_at::str , (byte*) print_str_at::at)
|
||||
(label) print_str_at::@1
|
||||
(label) print_str_at::@2
|
||||
(label) print_str_at::@return
|
||||
(byte*) print_str_at::at
|
||||
(byte*) print_str_at::at#0 at zp ZP_WORD:5 1001.0
|
||||
(byte*) print_str_at::at#2 at zp ZP_WORD:5 1001.0
|
||||
(byte*) print_str_at::str
|
||||
(byte*) print_str_at::str#0 str zp ZP_WORD:3 2002.0
|
||||
(byte*) print_str_at::str#1 str zp ZP_WORD:3 2.0
|
||||
(byte*) print_str_at::str#2 str zp ZP_WORD:3 1001.5
|
||||
(void()) print_str_lines((byte*) print_str_lines::str)
|
||||
(label) print_str_lines::@1
|
||||
(label) print_str_lines::@4
|
||||
@ -1232,8 +1256,8 @@ reg byte x [ gfx_mode::dtv_control#12 gfx_mode::dtv_control#6 gfx_mode::dtv_cont
|
||||
reg byte x [ gfx_mode::vic_control#4 gfx_mode::vic_control#2 gfx_mode::vic_control#5 ]
|
||||
reg byte a [ gfx_mode::vic_control2#2 ]
|
||||
zp ZP_BYTE:2 [ gfx_mode::cy#4 gfx_mode::cy#1 keyboard_event_scan::row#2 keyboard_event_scan::row#1 keyboard_event_pressed::keycode#4 gfx_init_plane_vertical2::by#4 gfx_init_plane_vertical2::by#1 gfx_init_plane_horisontal2::ay#4 gfx_init_plane_horisontal2::ay#1 gfx_init_plane_vertical::by#4 gfx_init_plane_vertical::by#1 gfx_init_plane_horisontal::ay#4 gfx_init_plane_horisontal::ay#1 gfx_init_plane_8bppchunky::y#6 gfx_init_plane_8bppchunky::y#1 gfx_init_vic_bitmap::l#2 gfx_init_vic_bitmap::l#1 bitmap_clear::y#4 bitmap_clear::y#1 gfx_init_screen3::cy#4 gfx_init_screen3::cy#1 gfx_init_screen2::cy#4 gfx_init_screen2::cy#1 gfx_init_screen1::cy#4 gfx_init_screen1::cy#1 gfx_init_screen0::cy#4 gfx_init_screen0::cy#1 gfx_mode::$65 bitmap_init::$6 ]
|
||||
zp ZP_WORD:3 [ gfx_mode::vic_colors#2 gfx_mode::vic_colors#3 gfx_mode::vic_colors#1 gfx_mode::vic_colors#0 get_vic_screen::return#10 get_vic_screen::return#1 get_vic_screen::return#6 gfx_mode::$61 gfx_mode::$63 gfx_mode::$64 get_vic_charset::return#1 get_vic_charset::return#4 gfx_mode::$66 gfx_mode::$68 apply_preset::preset#11 apply_preset::preset#10 apply_preset::preset#12 form_set_screen::line#2 form_set_screen::line#1 print_str_lines::str#4 print_str_lines::str#3 print_str_lines::str#5 print_str_lines::str#0 print_cls::sc#2 print_cls::sc#0 print_cls::sc#1 gfx_init_plane_vertical2::gfxb#2 gfx_init_plane_vertical2::gfxb#3 gfx_init_plane_vertical2::gfxb#1 gfx_init_plane_horisontal2::gfxa#2 gfx_init_plane_horisontal2::gfxa#3 gfx_init_plane_horisontal2::gfxa#1 gfx_init_plane_vertical::gfxb#2 gfx_init_plane_vertical::gfxb#3 gfx_init_plane_vertical::gfxb#1 gfx_init_plane_horisontal::gfxa#3 gfx_init_plane_horisontal::gfxa#6 gfx_init_plane_horisontal::gfxa#7 gfx_init_plane_horisontal::gfxa#1 gfx_init_plane_horisontal::gfxa#2 gfx_init_plane_8bppchunky::x#2 gfx_init_plane_8bppchunky::x#1 bitmap_clear::bitmap#2 bitmap_clear::bitmap#3 bitmap_clear::bitmap#5 bitmap_clear::bitmap#1 bitmap_clear::$3 bitmap_init::yoffs#2 bitmap_init::yoffs#4 bitmap_init::yoffs#1 gfx_init_screen3::ch#2 gfx_init_screen3::ch#3 gfx_init_screen3::ch#1 gfx_init_screen2::ch#2 gfx_init_screen2::ch#3 gfx_init_screen2::ch#1 gfx_init_screen1::ch#2 gfx_init_screen1::ch#3 gfx_init_screen1::ch#1 gfx_init_screen0::ch#2 gfx_init_screen0::ch#3 gfx_init_screen0::ch#1 gfx_mode::$33 gfx_mode::$35 gfx_mode::$37 gfx_mode::$47 gfx_mode::$49 gfx_mode::$51 form_field_ptr::return#2 form_render_values::field#0 form_field_ptr::return#0 form_field_ptr::$2 form_field_ptr::return#3 form_control::field#0 bitmap_plot::plotter_x#0 bitmap_plot::$0 ]
|
||||
zp ZP_WORD:5 [ gfx_mode::col#2 gfx_mode::col#3 gfx_mode::col#1 apply_preset::values#2 apply_preset::values#1 print_char_cursor#20 print_char_cursor#22 print_char_cursor#75 print_char_cursor#76 print_char_cursor#38 print_char_cursor#1 gfx_init_plane_8bppchunky::gfxb#4 gfx_init_plane_8bppchunky::gfxb#3 gfx_init_plane_8bppchunky::gfxb#5 gfx_init_plane_8bppchunky::gfxb#1 print_cls::$0 bitmap_plot::plotter_y#0 ]
|
||||
zp ZP_WORD:3 [ gfx_mode::vic_colors#2 gfx_mode::vic_colors#3 gfx_mode::vic_colors#1 gfx_mode::vic_colors#0 get_vic_screen::return#10 get_vic_screen::return#1 get_vic_screen::return#6 gfx_mode::$61 gfx_mode::$63 gfx_mode::$64 get_vic_charset::return#1 get_vic_charset::return#4 gfx_mode::$66 gfx_mode::$68 apply_preset::name#12 print_str_at::str#2 print_str_at::str#1 print_str_at::str#0 form_set_screen::line#2 form_set_screen::line#1 print_str_lines::str#4 print_str_lines::str#3 print_str_lines::str#5 print_str_lines::str#0 print_cls::sc#2 print_cls::sc#0 print_cls::sc#1 gfx_init_plane_vertical2::gfxb#2 gfx_init_plane_vertical2::gfxb#3 gfx_init_plane_vertical2::gfxb#1 gfx_init_plane_horisontal2::gfxa#2 gfx_init_plane_horisontal2::gfxa#3 gfx_init_plane_horisontal2::gfxa#1 gfx_init_plane_vertical::gfxb#2 gfx_init_plane_vertical::gfxb#3 gfx_init_plane_vertical::gfxb#1 gfx_init_plane_horisontal::gfxa#3 gfx_init_plane_horisontal::gfxa#6 gfx_init_plane_horisontal::gfxa#7 gfx_init_plane_horisontal::gfxa#1 gfx_init_plane_horisontal::gfxa#2 gfx_init_plane_8bppchunky::x#2 gfx_init_plane_8bppchunky::x#1 bitmap_clear::bitmap#2 bitmap_clear::bitmap#3 bitmap_clear::bitmap#5 bitmap_clear::bitmap#1 bitmap_clear::$3 bitmap_init::yoffs#2 bitmap_init::yoffs#4 bitmap_init::yoffs#1 gfx_init_screen3::ch#2 gfx_init_screen3::ch#3 gfx_init_screen3::ch#1 gfx_init_screen2::ch#2 gfx_init_screen2::ch#3 gfx_init_screen2::ch#1 gfx_init_screen1::ch#2 gfx_init_screen1::ch#3 gfx_init_screen1::ch#1 gfx_init_screen0::ch#2 gfx_init_screen0::ch#3 gfx_init_screen0::ch#1 gfx_mode::$33 gfx_mode::$35 gfx_mode::$37 gfx_mode::$47 gfx_mode::$49 gfx_mode::$51 form_field_ptr::return#2 form_render_values::field#0 form_field_ptr::return#0 form_field_ptr::$2 form_field_ptr::return#3 form_control::field#0 bitmap_plot::plotter_x#0 bitmap_plot::$0 ]
|
||||
zp ZP_WORD:5 [ gfx_mode::col#2 gfx_mode::col#3 gfx_mode::col#1 apply_preset::preset#11 apply_preset::preset#10 apply_preset::preset#12 print_str_at::at#2 print_str_at::at#0 print_char_cursor#20 print_char_cursor#22 print_char_cursor#75 print_char_cursor#76 print_char_cursor#38 print_char_cursor#1 gfx_init_plane_8bppchunky::gfxb#4 gfx_init_plane_8bppchunky::gfxb#3 gfx_init_plane_8bppchunky::gfxb#5 gfx_init_plane_8bppchunky::gfxb#1 print_cls::$0 bitmap_plot::plotter_y#0 ]
|
||||
reg byte x [ gfx_mode::cx#2 gfx_mode::cx#1 ]
|
||||
reg byte x [ gfx_mode::i#2 gfx_mode::i#1 ]
|
||||
reg byte x [ gfx_mode::j#2 gfx_mode::j#1 ]
|
||||
@ -1250,10 +1274,10 @@ zp ZP_BYTE:14 [ form_field_idx#28 form_field_idx#1 form_field_idx#14 form_field_
|
||||
zp ZP_BYTE:15 [ form_mode::preset_current#6 form_mode::preset_current#0 form_mode::preset_current#1 bitmap_line_ydxi::e#3 bitmap_line_ydxi::e#0 bitmap_line_ydxi::e#6 bitmap_line_ydxi::e#2 bitmap_line_ydxi::e#1 bitmap_line_xdyi::x1#6 bitmap_line_xdyi::x1#0 bitmap_line_xdyi::x1#1 bitmap_line::x0#0 bitmap_line_ydxd::e#3 bitmap_line_ydxd::e#0 bitmap_line_ydxd::e#6 bitmap_line_ydxd::e#2 bitmap_line_ydxd::e#1 bitmap_line_xdyd::$6 ]
|
||||
reg byte x [ form_render_values::idx#2 form_render_values::idx#1 ]
|
||||
reg byte x [ form_field_ptr::field_idx#2 form_field_ptr::field_idx#1 form_field_ptr::field_idx#0 ]
|
||||
zp ZP_WORD:16 [ apply_preset::values#2 apply_preset::values#1 print_line_cursor#21 print_line_cursor#2 print_set_screen::screen#2 print_line_cursor#22 gfx_init_plane_8bppchunky::$6 ]
|
||||
reg byte x [ apply_preset::i#2 apply_preset::i#1 ]
|
||||
reg byte x [ form_control::return#2 ]
|
||||
reg byte x [ form_set_screen::y#2 form_set_screen::y#1 ]
|
||||
zp ZP_WORD:16 [ print_line_cursor#21 print_line_cursor#2 print_set_screen::screen#2 print_line_cursor#22 gfx_init_plane_8bppchunky::$6 ]
|
||||
reg byte x [ gfx_init_plane_vertical2::bx#2 gfx_init_plane_vertical2::bx#1 ]
|
||||
reg byte a [ dtvSetCpuBankSegment1::cpuBankIdx#11 dtvSetCpuBankSegment1::cpuBankIdx#1 ]
|
||||
reg byte x [ gfx_init_plane_horisontal2::ax#2 gfx_init_plane_horisontal2::ax#1 ]
|
||||
|
@ -0,0 +1,58 @@
|
||||
.pc = $801 "Basic"
|
||||
:BasicUpstart(main)
|
||||
.pc = $80d "Program"
|
||||
.label screen = 2
|
||||
jsr main
|
||||
main: {
|
||||
lda #<$400
|
||||
sta screen
|
||||
lda #>$400
|
||||
sta screen+1
|
||||
ldx #1
|
||||
jsr print_msg
|
||||
ldx #2
|
||||
jsr print_msg
|
||||
rts
|
||||
}
|
||||
print_msg: {
|
||||
.label msg = 4
|
||||
cpx #1
|
||||
bne b1
|
||||
lda #<msg_1
|
||||
sta msg
|
||||
lda #>msg_1
|
||||
sta msg+1
|
||||
jmp b2
|
||||
b1:
|
||||
lda #<msg_0
|
||||
sta msg
|
||||
lda #>msg_0
|
||||
sta msg+1
|
||||
b2:
|
||||
jsr print
|
||||
rts
|
||||
msg_0: .text "World!@"
|
||||
msg_1: .text "Hello @"
|
||||
}
|
||||
print: {
|
||||
.label msg = 4
|
||||
b1:
|
||||
ldy #0
|
||||
lda (msg),y
|
||||
cmp #'@'
|
||||
bne b2
|
||||
rts
|
||||
b2:
|
||||
ldy #0
|
||||
lda (msg),y
|
||||
sta (screen),y
|
||||
inc screen
|
||||
bne !+
|
||||
inc screen+1
|
||||
!:
|
||||
inc msg
|
||||
bne !+
|
||||
inc msg+1
|
||||
!:
|
||||
jmp b1
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
@begin: scope:[] from
|
||||
[0] phi() [ ] ( )
|
||||
to:@3
|
||||
@3: scope:[] from @begin
|
||||
[1] phi() [ ] ( )
|
||||
[2] call main param-assignment [ ] ( )
|
||||
to:@end
|
||||
@end: scope:[] from @3
|
||||
[3] phi() [ ] ( )
|
||||
main: scope:[main] from @3
|
||||
[4] phi() [ ] ( main:2 [ ] )
|
||||
[5] call print_msg param-assignment [ screen#14 ] ( main:2 [ screen#14 ] )
|
||||
to:main::@1
|
||||
main::@1: scope:[main] from main
|
||||
[6] phi() [ screen#14 ] ( main:2 [ screen#14 ] )
|
||||
[7] call print_msg param-assignment [ ] ( main:2 [ ] )
|
||||
to:main::@return
|
||||
main::@return: scope:[main] from main::@1
|
||||
[8] return [ ] ( main:2 [ ] )
|
||||
to:@return
|
||||
print_msg: scope:[print_msg] from main main::@1
|
||||
[9] (byte*) screen#18 ← phi( main/((byte*))(word/signed word/dword/signed dword) 1024 main::@1/(byte*) screen#14 ) [ print_msg::idx#2 screen#18 ] ( main:2::print_msg:5 [ print_msg::idx#2 screen#18 ] main:2::print_msg:7 [ print_msg::idx#2 screen#18 ] )
|
||||
[9] (byte) print_msg::idx#2 ← phi( main/(byte/signed byte/word/signed word/dword/signed dword) 1 main::@1/(byte/signed byte/word/signed word/dword/signed dword) 2 ) [ print_msg::idx#2 screen#18 ] ( main:2::print_msg:5 [ print_msg::idx#2 screen#18 ] main:2::print_msg:7 [ print_msg::idx#2 screen#18 ] )
|
||||
[10] if((byte) print_msg::idx#2!=(byte/signed byte/word/signed word/dword/signed dword) 1) goto print_msg::@2 [ screen#18 ] ( main:2::print_msg:5 [ screen#18 ] main:2::print_msg:7 [ screen#18 ] )
|
||||
to:print_msg::@3
|
||||
print_msg::@3: scope:[print_msg] from print_msg
|
||||
[11] phi() [ screen#18 ] ( main:2::print_msg:5 [ screen#18 ] main:2::print_msg:7 [ screen#18 ] )
|
||||
to:print_msg::@2
|
||||
print_msg::@2: scope:[print_msg] from print_msg print_msg::@3
|
||||
[12] (byte*) print_msg::msg#2 ← phi( print_msg/(const string) print_msg::msg#0 print_msg::@3/(const string) print_msg::msg#1 ) [ screen#18 print_msg::msg#2 ] ( main:2::print_msg:5 [ screen#18 print_msg::msg#2 ] main:2::print_msg:7 [ screen#18 print_msg::msg#2 ] )
|
||||
[13] (byte*) print::msg#0 ← (byte*) print_msg::msg#2 [ screen#18 print::msg#0 ] ( main:2::print_msg:5 [ screen#18 print::msg#0 ] main:2::print_msg:7 [ screen#18 print::msg#0 ] )
|
||||
[14] call print param-assignment [ screen#14 ] ( main:2::print_msg:5 [ screen#14 ] main:2::print_msg:7 [ screen#14 ] )
|
||||
to:print_msg::@return
|
||||
print_msg::@return: scope:[print_msg] from print_msg::@2
|
||||
[15] return [ screen#14 ] ( main:2::print_msg:5 [ screen#14 ] main:2::print_msg:7 [ screen#14 ] )
|
||||
to:@return
|
||||
print: scope:[print] from print_msg::@2
|
||||
[16] phi() [ screen#18 print::msg#0 ] ( main:2::print_msg:5::print:14 [ screen#18 print::msg#0 ] main:2::print_msg:7::print:14 [ screen#18 print::msg#0 ] )
|
||||
to:print::@1
|
||||
print::@1: scope:[print] from print print::@2
|
||||
[17] (byte*) screen#14 ← phi( print/(byte*) screen#18 print::@2/(byte*) screen#6 ) [ screen#14 print::msg#2 ] ( main:2::print_msg:5::print:14 [ screen#14 print::msg#2 ] main:2::print_msg:7::print:14 [ screen#14 print::msg#2 ] )
|
||||
[17] (byte*) print::msg#2 ← phi( print/(byte*) print::msg#0 print::@2/(byte*) print::msg#1 ) [ screen#14 print::msg#2 ] ( main:2::print_msg:5::print:14 [ screen#14 print::msg#2 ] main:2::print_msg:7::print:14 [ screen#14 print::msg#2 ] )
|
||||
[18] if(*((byte*) print::msg#2)!=(byte) '@') goto print::@2 [ screen#14 print::msg#2 ] ( main:2::print_msg:5::print:14 [ screen#14 print::msg#2 ] main:2::print_msg:7::print:14 [ screen#14 print::msg#2 ] )
|
||||
to:print::@return
|
||||
print::@return: scope:[print] from print::@1
|
||||
[19] return [ screen#14 ] ( main:2::print_msg:5::print:14 [ screen#14 ] main:2::print_msg:7::print:14 [ screen#14 ] )
|
||||
to:@return
|
||||
print::@2: scope:[print] from print::@1
|
||||
[20] *((byte*) screen#14) ← *((byte*) print::msg#2) [ screen#14 print::msg#2 ] ( main:2::print_msg:5::print:14 [ screen#14 print::msg#2 ] main:2::print_msg:7::print:14 [ screen#14 print::msg#2 ] )
|
||||
[21] (byte*) screen#6 ← ++ (byte*) screen#14 [ print::msg#2 screen#6 ] ( main:2::print_msg:5::print:14 [ print::msg#2 screen#6 ] main:2::print_msg:7::print:14 [ print::msg#2 screen#6 ] )
|
||||
[22] (byte*) print::msg#1 ← ++ (byte*) print::msg#2 [ print::msg#1 screen#6 ] ( main:2::print_msg:5::print:14 [ print::msg#1 screen#6 ] main:2::print_msg:7::print:14 [ print::msg#1 screen#6 ] )
|
||||
to:print::@1
|
1068
src/test/java/dk/camelot64/kickc/test/ref/inline-string-2.log
Normal file
1068
src/test/java/dk/camelot64/kickc/test/ref/inline-string-2.log
Normal file
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,32 @@
|
||||
(label) @3
|
||||
(label) @begin
|
||||
(label) @end
|
||||
(void()) main()
|
||||
(label) main::@1
|
||||
(label) main::@return
|
||||
(void()) print((byte*) print::msg)
|
||||
(label) print::@1
|
||||
(label) print::@2
|
||||
(label) print::@return
|
||||
(byte*) print::msg
|
||||
(byte*) print::msg#0 msg zp ZP_WORD:4 2.0
|
||||
(byte*) print::msg#1 msg zp ZP_WORD:4 22.0
|
||||
(byte*) print::msg#2 msg zp ZP_WORD:4 11.5
|
||||
(void()) print_msg((byte) print_msg::idx)
|
||||
(label) print_msg::@2
|
||||
(label) print_msg::@3
|
||||
(label) print_msg::@return
|
||||
(byte) print_msg::idx
|
||||
(byte) print_msg::idx#2 reg byte x 2.0
|
||||
(byte*) print_msg::msg
|
||||
(const string) print_msg::msg#0 msg#0 = (string) "World!@"
|
||||
(const string) print_msg::msg#1 msg#1 = (string) "Hello @"
|
||||
(byte*) print_msg::msg#2 msg zp ZP_WORD:4 2.0
|
||||
(byte*) screen
|
||||
(byte*) screen#14 screen zp ZP_WORD:2 4.625
|
||||
(byte*) screen#18 screen zp ZP_WORD:2 0.6666666666666666
|
||||
(byte*) screen#6 screen zp ZP_WORD:2 11.0
|
||||
|
||||
reg byte x [ print_msg::idx#2 ]
|
||||
zp ZP_WORD:2 [ screen#18 screen#14 screen#6 ]
|
||||
zp ZP_WORD:4 [ print_msg::msg#2 print::msg#2 print::msg#0 print::msg#1 ]
|
Loading…
Reference in New Issue
Block a user