1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-11-27 04:49:27 +00:00

Added textbox-test using builtin multiply - by Scan/Desire.

This commit is contained in:
jespergravgaard 2019-06-11 06:56:51 +02:00
parent 9d8d8f02e2
commit 253babb8ea
7 changed files with 6328 additions and 0 deletions

View File

@ -0,0 +1,9 @@
sta {z1}
lda #0
sta {z1}+1
asl {z1}
rol {z1}+1
asl {z1}
rol {z1}+1
asl {z1}
rol {z1}+1

View File

@ -35,6 +35,11 @@ public class TestPrograms {
public TestPrograms() {
}
@Test
public void testTextbox() throws IOException, URISyntaxException {
compileAndCompare("textbox");
}
@Test
public void testStructPtr11() throws IOException, URISyntaxException {
compileAndCompare("struct-ptr-11");

100
src/test/kc/textbox.kc Normal file
View File

@ -0,0 +1,100 @@
/* Textbox routine with word wrap for KickC by Scan/Desire */
import "c64.kc"
const byte* screen = $0400;
const byte[] text = "this is a small test with word wrap, if a word is too long it moves it to the next line. isn't that supercalifragilisticexpialidocious? i think it's cool!";
const byte[] text2 = "textbox by scan of desire";
void main() {
for (byte x = 0; x < 15; x += 2) {
textbox(x,x,x+x+1,x+10,text2);
for (word wait = 0; wait < 35000; wait++) {}
}
textbox(0,12,20,24,text);
textbox(3,3,37,9,text);
textbox(30,8,39,24,text);
do {} while (true);
}
void textbox(byte x1, byte y1, byte x2, byte y2, byte* text) {
draw_window(x1, y1, x2, y2);
byte y = y1+1;
byte x = x1+1;
word z = y*40;
byte i = 0;
if (x == x2 || y == y2) {
// no room to draw text, simply return
return;
}
do {
screen[z+x] = text[i];
if (text[i] == $20) {
// scan ahead to determine next word length
byte c = 0;
byte ls = i+1;
while (text[ls] != $20 && text[ls] != $00) {
ls++;
c++;
}
// if it's too big to fit but not bigger than the whole box width, move to next line
if (c+x >= x2 && c < x2-x1) {
x = x1;
y++;
if (y == y2) {
// text too long for textbox
return;
}
z = y*40;
}
}
i++;
x++;
// this is in case the word is too long for one line and needs to be cut
if (x == x2) {
x = x1+1;
y++;
if (y == y2) {
// text too long for textbox
return;
}
z = y*40;
}
} while (text[i] != 0);
}
void draw_window(byte x1, byte y1, byte x2, byte y2) {
word z = y1*40;
word q = y2*40;
// draw horizontal lines
for (byte x = x1+1; x < x2; x++) {
screen[z+x] = $43;
screen[q+x] = $43;
}
// draw upper corners
screen[z+x1] = $55;
screen[z+x2] = $49;
// draw vertical lines
for (byte y = y1+1; y < y2; y++) {
z = y*40;
screen[z+x1] = $42;
screen[z+x2] = $42;
}
// draw lower corners
screen[q+x1] = $4a;
screen[q+x2] = $4b;
// window big enough to have an inside?
if (x2-x1 > 1 && y2-y1 > 1) {
// blank inside
for(byte y = y1+1; y < y2; y++) {
z = y*40;
for(byte x = x1+1; x < x2; x++) {
screen[z+x] = $20;
}
}
}
}

527
src/test/ref/textbox.asm Normal file
View File

@ -0,0 +1,527 @@
/* Textbox routine with word wrap for KickC by Scan/Desire */
.pc = $801 "Basic"
:BasicUpstart(main)
.pc = $80d "Program"
.label screen = $400
main: {
.label wait = 3
.label x = 2
lda #0
sta x
b1:
lda x
asl
clc
adc #1
sta textbox.x2
lax x
axs #-[$a]
stx textbox.y2
lda x
sta textbox.y1
lda #<text2
sta textbox.text
lda #>text2
sta textbox.text+1
jsr textbox
lda #0
sta wait
sta wait+1
b2:
inc wait
bne !+
inc wait+1
!:
lda wait+1
cmp #>$88b8
bcc b2
bne !+
lda wait
cmp #<$88b8
bcc b2
!:
lda x
clc
adc #2
sta x
cmp #$f
bcc b1
lda #<text
sta textbox.text
lda #>text
sta textbox.text+1
lda #$18
sta textbox.y2
lda #$14
sta textbox.x2
lda #$c
sta textbox.y1
lda #0
sta textbox.x1
jsr textbox
lda #<text
sta textbox.text
lda #>text
sta textbox.text+1
lda #9
sta textbox.y2
lda #$25
sta textbox.x2
lda #3
sta textbox.y1
sta textbox.x1
jsr textbox
lda #<text
sta textbox.text
lda #>text
sta textbox.text+1
lda #$18
sta textbox.y2
lda #$27
sta textbox.x2
lda #8
sta textbox.y1
lda #$1e
sta textbox.x1
jsr textbox
b5:
jmp b5
}
// textbox(byte zeropage(2) x1, byte zeropage(5) y1, byte zeropage(6) x2, byte zeropage(7) y2, byte* zeropage(8) text)
textbox: {
.label _8 = $f
.label _17 = $11
.label x1 = 2
.label y1 = 5
.label x2 = 6
.label y2 = 7
.label y = 5
.label x = $b
.label z = $c
.label i = $a
.label text = 8
.label _31 = $f
jsr draw_window
inc y
ldy x1
iny
sty x
lda y
asl
asl
clc
adc y
sta z
lda #0
sta z+1
asl z
rol z+1
asl z
rol z+1
asl z
rol z+1
tya
cmp x2
beq breturn
lda y
cmp y2
beq breturn
lda #0
sta i
b1:
lda x
clc
adc z
sta _8
lda #0
adc z+1
sta _8+1
clc
lda _31
adc #<screen
sta _31
lda _31+1
adc #>screen
sta _31+1
ldy i
lda (text),y
ldy #0
sta (_31),y
ldy i
lda (text),y
cmp #$20
bne b2
iny
ldx #0
b3:
lda (text),y
cmp #$20
beq b5
lda (text),y
cmp #0
bne b4
b5:
txa
clc
adc x
tay
lda x2
sec
sbc x1
sta _17
cpy x2
bcc b2
cpx _17
bcc b6
b2:
inc i
inc x
lda x
cmp x2
bne b8
ldy x1
iny
sty x
inc y
lda y
cmp y2
bne b9
breturn:
rts
b9:
lda y
asl
asl
clc
adc y
sta z
lda #0
sta z+1
asl z
rol z+1
asl z
rol z+1
asl z
rol z+1
b8:
ldy i
lda (text),y
cmp #0
beq !b1+
jmp b1
!b1:
rts
b6:
inc y
lda y
cmp y2
bne b7
rts
b7:
lda y
asl
asl
clc
adc y
sta z
lda #0
sta z+1
asl z
rol z+1
asl z
rol z+1
asl z
rol z+1
lda x1
sta x
jmp b2
b4:
iny
inx
jmp b3
}
// draw_window(byte zeropage(2) x1, byte zeropage(5) y1, byte zeropage(6) x2, byte zeropage(7) y2)
draw_window: {
.label _2 = $1a
.label _3 = $12
.label _4 = $20
.label _5 = $14
.label _13 = $16
.label _14 = $18
.label _18 = $1e
.label _19 = $1c
.label _24 = $24
.label x1 = 2
.label y1 = 5
.label x2 = 6
.label y2 = 7
.label z = $12
.label q = $14
.label z_1 = $1c
.label y3 = $e
.label z_2 = $22
.label _27 = $16
.label _28 = $18
.label _29 = $1a
.label _30 = $12
.label _31 = $1e
.label _32 = $1c
.label _33 = $20
.label _34 = $14
.label _35 = $24
lda y1
asl
asl
clc
adc y1
sta z
lda #0
sta z+1
asl z
rol z+1
asl z
rol z+1
asl z
rol z+1
lda y2
asl
asl
clc
adc y2
sta q
lda #0
sta q+1
asl q
rol q+1
asl q
rol q+1
asl q
rol q+1
ldx x1
inx
b1:
// draw horizontal lines
txa
clc
adc z
sta _13
lda #0
adc z+1
sta _13+1
clc
lda _27
adc #<screen
sta _27
lda _27+1
adc #>screen
sta _27+1
lda #$43
ldy #0
sta (_27),y
txa
clc
adc q
sta _14
tya
adc q+1
sta _14+1
clc
lda _28
adc #<screen
sta _28
lda _28+1
adc #>screen
sta _28+1
lda #$43
sta (_28),y
inx
cpx x2
bcc b1
lda x1
clc
adc z
sta _2
tya
adc z+1
sta _2+1
clc
lda _29
adc #<screen
sta _29
lda _29+1
adc #>screen
sta _29+1
// draw upper corners
lda #$55
sta (_29),y
lda x2
clc
adc _3
sta _3
bcc !+
inc _3+1
!:
clc
lda _30
adc #<screen
sta _30
lda _30+1
adc #>screen
sta _30+1
lda #$49
ldy #0
sta (_30),y
ldx y1
inx
b2:
// draw vertical lines
txa
asl
asl
stx $ff
clc
adc $ff
sta z_1
lda #0
sta z_1+1
asl z_1
rol z_1+1
asl z_1
rol z_1+1
asl z_1
rol z_1+1
lda x1
clc
adc z_1
sta _18
lda #0
adc z_1+1
sta _18+1
clc
lda _31
adc #<screen
sta _31
lda _31+1
adc #>screen
sta _31+1
lda #$42
ldy #0
sta (_31),y
lda x2
clc
adc _19
sta _19
bcc !+
inc _19+1
!:
clc
lda _32
adc #<screen
sta _32
lda _32+1
adc #>screen
sta _32+1
lda #$42
ldy #0
sta (_32),y
inx
cpx y2
bcc b2
lda x1
clc
adc q
sta _4
tya
adc q+1
sta _4+1
clc
lda _33
adc #<screen
sta _33
lda _33+1
adc #>screen
sta _33+1
// draw lower corners
lda #$4a
sta (_33),y
lda x2
clc
adc _5
sta _5
bcc !+
inc _5+1
!:
clc
lda _34
adc #<screen
sta _34
lda _34+1
adc #>screen
sta _34+1
lda #$4b
ldy #0
sta (_34),y
lda x2
sec
sbc x1
tax
lda y2
sec
sbc y1
cpx #1+1
bcc breturn
cmp #1+1
bcs b5
breturn:
rts
b5:
ldy y1
iny
sty y3
b3:
// blank inside
lda y3
asl
asl
clc
adc y3
sta z_2
lda #0
sta z_2+1
asl z_2
rol z_2+1
asl z_2
rol z_2+1
asl z_2
rol z_2+1
ldx x1
inx
b7:
txa
clc
adc z_2
sta _24
lda #0
adc z_2+1
sta _24+1
clc
lda _35
adc #<screen
sta _35
lda _35+1
adc #>screen
sta _35+1
lda #$20
ldy #0
sta (_35),y
inx
cpx x2
bcc b7
inc y3
lda y3
cmp y2
bcc b3
rts
}
text: .text "this is a small test with word wrap, if a word is too long it moves it to the next line. isn't that supercalifragilisticexpialidocious? i think it's cool!@"
text2: .text "textbox by scan of desire@"

220
src/test/ref/textbox.cfg Normal file
View File

@ -0,0 +1,220 @@
@begin: scope:[] from
[0] phi()
to:@1
@1: scope:[] from @begin
[1] phi()
[2] call main
to:@end
@end: scope:[] from @1
[3] phi()
main: scope:[main] from @1
[4] phi()
to:main::@1
main::@1: scope:[main] from main main::@3
[5] (byte) main::x#2 ← phi( main/(byte) 0 main::@3/(byte) main::x#1 )
[6] (byte~) main::$3 ← (byte) main::x#2 + (byte) main::x#2
[7] (byte) textbox::x2#0 ← (byte~) main::$3 + (byte) 1
[8] (byte) textbox::y2#0 ← (byte) main::x#2 + (byte) $a
[9] (byte) textbox::x1#0 ← (byte) main::x#2
[10] (byte) textbox::y1#0 ← (byte) main::x#2
[11] call textbox
to:main::@2
main::@2: scope:[main] from main::@1 main::@2
[12] (word) main::wait#2 ← phi( main::@2/(word) main::wait#1 main::@1/(byte) 0 )
[13] (word) main::wait#1 ← ++ (word) main::wait#2
[14] if((word) main::wait#1<(word) $88b8) goto main::@2
to:main::@3
main::@3: scope:[main] from main::@2
[15] (byte) main::x#1 ← (byte) main::x#2 + (byte) 2
[16] if((byte) main::x#1<(byte) $f) goto main::@1
to:main::@4
main::@4: scope:[main] from main::@3
[17] phi()
[18] call textbox
to:main::@6
main::@6: scope:[main] from main::@4
[19] phi()
[20] call textbox
to:main::@7
main::@7: scope:[main] from main::@6
[21] phi()
[22] call textbox
to:main::@5
main::@5: scope:[main] from main::@5 main::@7
[23] phi()
to:main::@5
textbox: scope:[textbox] from main::@1 main::@4 main::@6 main::@7
[24] (byte*) textbox::text#12 ← phi( main::@1/(const byte[]) text2#0 main::@4/(const byte[]) text#0 main::@6/(const byte[]) text#0 main::@7/(const byte[]) text#0 )
[24] (byte) textbox::y2#4 ← phi( main::@1/(byte) textbox::y2#0 main::@4/(byte) $18 main::@6/(byte) 9 main::@7/(byte) $18 )
[24] (byte) textbox::x2#4 ← phi( main::@1/(byte) textbox::x2#0 main::@4/(byte) $14 main::@6/(byte) $25 main::@7/(byte) $27 )
[24] (byte) textbox::y1#4 ← phi( main::@1/(byte) textbox::y1#0 main::@4/(byte) $c main::@6/(byte) 3 main::@7/(byte) 8 )
[24] (byte) textbox::x1#4 ← phi( main::@1/(byte) textbox::x1#0 main::@4/(byte) 0 main::@6/(byte) 3 main::@7/(byte) $1e )
[25] (byte) draw_window::x1#0 ← (byte) textbox::x1#4
[26] (byte) draw_window::y1#0 ← (byte) textbox::y1#4
[27] (byte) draw_window::x2#0 ← (byte) textbox::x2#4
[28] (byte) draw_window::y2#0 ← (byte) textbox::y2#4
[29] call draw_window
to:textbox::@12
textbox::@12: scope:[textbox] from textbox
[30] (byte) textbox::y#0 ← (byte) textbox::y1#4 + (byte) 1
[31] (byte) textbox::x#0 ← (byte) textbox::x1#4 + (byte) 1
[32] (byte) textbox::$32 ← (byte) textbox::y#0 << (byte) 2
[33] (byte) textbox::$33 ← (byte) textbox::$32 + (byte) textbox::y#0
[34] (word) textbox::z#0 ← (byte) textbox::$33 << (byte) 3
[35] if((byte) textbox::x#0==(byte) textbox::x2#4) goto textbox::@return
to:textbox::@13
textbox::@13: scope:[textbox] from textbox::@12
[36] if((byte) textbox::y#0==(byte) textbox::y2#4) goto textbox::@return
to:textbox::@1
textbox::@1: scope:[textbox] from textbox::@13 textbox::@8
[37] (byte) textbox::y#12 ← phi( textbox::@8/(byte) textbox::y#11 textbox::@13/(byte) textbox::y#0 )
[37] (byte) textbox::i#2 ← phi( textbox::@8/(byte) textbox::i#1 textbox::@13/(byte) 0 )
[37] (byte) textbox::x#10 ← phi( textbox::@8/(byte) textbox::x#7 textbox::@13/(byte) textbox::x#0 )
[37] (word) textbox::z#3 ← phi( textbox::@8/(word) textbox::z#4 textbox::@13/(word) textbox::z#0 )
[38] (word~) textbox::$8 ← (word) textbox::z#3 + (byte) textbox::x#10
[39] (byte*~) textbox::$31 ← (const byte*) screen#0 + (word~) textbox::$8
[40] *((byte*~) textbox::$31) ← *((byte*) textbox::text#12 + (byte) textbox::i#2)
[41] if(*((byte*) textbox::text#12 + (byte) textbox::i#2)!=(byte) $20) goto textbox::@2
to:textbox::@10
textbox::@10: scope:[textbox] from textbox::@1
[42] (byte) textbox::ls#0 ← (byte) textbox::i#2 + (byte) 1
to:textbox::@3
textbox::@3: scope:[textbox] from textbox::@10 textbox::@4
[43] (byte) textbox::c#2 ← phi( textbox::@10/(byte) 0 textbox::@4/(byte) textbox::c#1 )
[43] (byte) textbox::ls#2 ← phi( textbox::@10/(byte) textbox::ls#0 textbox::@4/(byte) textbox::ls#1 )
[44] if(*((byte*) textbox::text#12 + (byte) textbox::ls#2)==(byte) $20) goto textbox::@5
to:textbox::@14
textbox::@14: scope:[textbox] from textbox::@3
[45] if(*((byte*) textbox::text#12 + (byte) textbox::ls#2)!=(byte) 0) goto textbox::@4
to:textbox::@5
textbox::@5: scope:[textbox] from textbox::@14 textbox::@3
[46] (byte~) textbox::$15 ← (byte) textbox::c#2 + (byte) textbox::x#10
[47] (byte~) textbox::$17 ← (byte) textbox::x2#4 - (byte) textbox::x1#4
[48] if((byte~) textbox::$15<(byte) textbox::x2#4) goto textbox::@2
to:textbox::@15
textbox::@15: scope:[textbox] from textbox::@5
[49] if((byte) textbox::c#2<(byte~) textbox::$17) goto textbox::@6
to:textbox::@2
textbox::@2: scope:[textbox] from textbox::@1 textbox::@15 textbox::@5 textbox::@7
[50] (word) textbox::z#5 ← phi( textbox::@7/(word) textbox::z#1 textbox::@1/(word) textbox::z#3 textbox::@5/(word) textbox::z#3 )
[50] (byte) textbox::y#5 ← phi( textbox::@7/(byte) textbox::y#1 textbox::@1/(byte) textbox::y#12 textbox::@5/(byte) textbox::y#12 )
[50] (byte) textbox::x#5 ← phi( textbox::@7/(byte~) textbox::x#15 textbox::@1/(byte) textbox::x#10 textbox::@5/(byte) textbox::x#10 )
[51] (byte) textbox::i#1 ← ++ (byte) textbox::i#2
[52] (byte) textbox::x#1 ← ++ (byte) textbox::x#5
[53] if((byte) textbox::x#1!=(byte) textbox::x2#4) goto textbox::@8
to:textbox::@11
textbox::@11: scope:[textbox] from textbox::@2
[54] (byte) textbox::x#12 ← (byte) textbox::x1#4 + (byte) 1
[55] (byte) textbox::y#2 ← ++ (byte) textbox::y#5
[56] if((byte) textbox::y#2!=(byte) textbox::y2#4) goto textbox::@9
to:textbox::@return
textbox::@return: scope:[textbox] from textbox::@11 textbox::@12 textbox::@13 textbox::@6 textbox::@8
[57] return
to:@return
textbox::@9: scope:[textbox] from textbox::@11
[58] (byte) textbox::$38 ← (byte) textbox::y#2 << (byte) 2
[59] (byte) textbox::$39 ← (byte) textbox::$38 + (byte) textbox::y#2
[60] (word) textbox::z#2 ← (byte) textbox::$39 << (byte) 3
to:textbox::@8
textbox::@8: scope:[textbox] from textbox::@2 textbox::@9
[61] (byte) textbox::y#11 ← phi( textbox::@9/(byte) textbox::y#2 textbox::@2/(byte) textbox::y#5 )
[61] (byte) textbox::x#7 ← phi( textbox::@9/(byte) textbox::x#12 textbox::@2/(byte) textbox::x#1 )
[61] (word) textbox::z#4 ← phi( textbox::@9/(word) textbox::z#2 textbox::@2/(word) textbox::z#5 )
[62] if(*((byte*) textbox::text#12 + (byte) textbox::i#1)!=(byte) 0) goto textbox::@1
to:textbox::@return
textbox::@6: scope:[textbox] from textbox::@15
[63] (byte) textbox::y#1 ← ++ (byte) textbox::y#12
[64] if((byte) textbox::y#1!=(byte) textbox::y2#4) goto textbox::@7
to:textbox::@return
textbox::@7: scope:[textbox] from textbox::@6
[65] (byte) textbox::$35 ← (byte) textbox::y#1 << (byte) 2
[66] (byte) textbox::$36 ← (byte) textbox::$35 + (byte) textbox::y#1
[67] (word) textbox::z#1 ← (byte) textbox::$36 << (byte) 3
[68] (byte~) textbox::x#15 ← (byte) textbox::x1#4
to:textbox::@2
textbox::@4: scope:[textbox] from textbox::@14
[69] (byte) textbox::ls#1 ← ++ (byte) textbox::ls#2
[70] (byte) textbox::c#1 ← ++ (byte) textbox::c#2
to:textbox::@3
draw_window: scope:[draw_window] from textbox
[71] (byte) draw_window::$36 ← (byte) draw_window::y1#0 << (byte) 2
[72] (byte) draw_window::$37 ← (byte) draw_window::$36 + (byte) draw_window::y1#0
[73] (word) draw_window::z#0 ← (byte) draw_window::$37 << (byte) 3
[74] (byte) draw_window::$39 ← (byte) draw_window::y2#0 << (byte) 2
[75] (byte) draw_window::$40 ← (byte) draw_window::$39 + (byte) draw_window::y2#0
[76] (word) draw_window::q#0 ← (byte) draw_window::$40 << (byte) 3
[77] (byte) draw_window::x#0 ← (byte) draw_window::x1#0 + (byte) 1
to:draw_window::@1
draw_window::@1: scope:[draw_window] from draw_window draw_window::@1
[78] (byte) draw_window::x#2 ← phi( draw_window/(byte) draw_window::x#0 draw_window::@1/(byte) draw_window::x#1 )
[79] (word~) draw_window::$13 ← (word) draw_window::z#0 + (byte) draw_window::x#2
[80] (byte*~) draw_window::$27 ← (const byte*) screen#0 + (word~) draw_window::$13
[81] *((byte*~) draw_window::$27) ← (byte) $43
[82] (word~) draw_window::$14 ← (word) draw_window::q#0 + (byte) draw_window::x#2
[83] (byte*~) draw_window::$28 ← (const byte*) screen#0 + (word~) draw_window::$14
[84] *((byte*~) draw_window::$28) ← (byte) $43
[85] (byte) draw_window::x#1 ← ++ (byte) draw_window::x#2
[86] if((byte) draw_window::x#1<(byte) draw_window::x2#0) goto draw_window::@1
to:draw_window::@2
draw_window::@2: scope:[draw_window] from draw_window::@1
[87] (word~) draw_window::$2 ← (word) draw_window::z#0 + (byte) draw_window::x1#0
[88] (byte*~) draw_window::$29 ← (const byte*) screen#0 + (word~) draw_window::$2
[89] *((byte*~) draw_window::$29) ← (byte) $55
[90] (word~) draw_window::$3 ← (word) draw_window::z#0 + (byte) draw_window::x2#0
[91] (byte*~) draw_window::$30 ← (const byte*) screen#0 + (word~) draw_window::$3
[92] *((byte*~) draw_window::$30) ← (byte) $49
[93] (byte) draw_window::y#0 ← (byte) draw_window::y1#0 + (byte) 1
to:draw_window::@3
draw_window::@3: scope:[draw_window] from draw_window::@2 draw_window::@3
[94] (byte) draw_window::y#2 ← phi( draw_window::@2/(byte) draw_window::y#0 draw_window::@3/(byte) draw_window::y#1 )
[95] (byte) draw_window::$42 ← (byte) draw_window::y#2 << (byte) 2
[96] (byte) draw_window::$43 ← (byte) draw_window::$42 + (byte) draw_window::y#2
[97] (word) draw_window::z#1 ← (byte) draw_window::$43 << (byte) 3
[98] (word~) draw_window::$18 ← (word) draw_window::z#1 + (byte) draw_window::x1#0
[99] (byte*~) draw_window::$31 ← (const byte*) screen#0 + (word~) draw_window::$18
[100] *((byte*~) draw_window::$31) ← (byte) $42
[101] (word~) draw_window::$19 ← (word) draw_window::z#1 + (byte) draw_window::x2#0
[102] (byte*~) draw_window::$32 ← (const byte*) screen#0 + (word~) draw_window::$19
[103] *((byte*~) draw_window::$32) ← (byte) $42
[104] (byte) draw_window::y#1 ← ++ (byte) draw_window::y#2
[105] if((byte) draw_window::y#1<(byte) draw_window::y2#0) goto draw_window::@3
to:draw_window::@4
draw_window::@4: scope:[draw_window] from draw_window::@3
[106] (word~) draw_window::$4 ← (word) draw_window::q#0 + (byte) draw_window::x1#0
[107] (byte*~) draw_window::$33 ← (const byte*) screen#0 + (word~) draw_window::$4
[108] *((byte*~) draw_window::$33) ← (byte) $4a
[109] (word~) draw_window::$5 ← (word) draw_window::q#0 + (byte) draw_window::x2#0
[110] (byte*~) draw_window::$34 ← (const byte*) screen#0 + (word~) draw_window::$5
[111] *((byte*~) draw_window::$34) ← (byte) $4b
[112] (byte~) draw_window::$6 ← (byte) draw_window::x2#0 - (byte) draw_window::x1#0
[113] (byte~) draw_window::$8 ← (byte) draw_window::y2#0 - (byte) draw_window::y1#0
[114] if((byte~) draw_window::$6<(byte) 1+(byte) 1) goto draw_window::@return
to:draw_window::@9
draw_window::@9: scope:[draw_window] from draw_window::@4
[115] if((byte~) draw_window::$8>=(byte) 1+(byte) 1) goto draw_window::@5
to:draw_window::@return
draw_window::@return: scope:[draw_window] from draw_window::@4 draw_window::@8 draw_window::@9
[116] return
to:@return
draw_window::@5: scope:[draw_window] from draw_window::@9
[117] (byte) draw_window::y3#0 ← (byte) draw_window::y1#0 + (byte) 1
to:draw_window::@6
draw_window::@6: scope:[draw_window] from draw_window::@5 draw_window::@8
[118] (byte) draw_window::y3#2 ← phi( draw_window::@5/(byte) draw_window::y3#0 draw_window::@8/(byte) draw_window::y3#1 )
[119] (byte) draw_window::$45 ← (byte) draw_window::y3#2 << (byte) 2
[120] (byte) draw_window::$46 ← (byte) draw_window::$45 + (byte) draw_window::y3#2
[121] (word) draw_window::z#2 ← (byte) draw_window::$46 << (byte) 3
[122] (byte) draw_window::x3#0 ← (byte) draw_window::x1#0 + (byte) 1
to:draw_window::@7
draw_window::@7: scope:[draw_window] from draw_window::@6 draw_window::@7
[123] (byte) draw_window::x3#2 ← phi( draw_window::@6/(byte) draw_window::x3#0 draw_window::@7/(byte) draw_window::x3#1 )
[124] (word~) draw_window::$24 ← (word) draw_window::z#2 + (byte) draw_window::x3#2
[125] (byte*~) draw_window::$35 ← (const byte*) screen#0 + (word~) draw_window::$24
[126] *((byte*~) draw_window::$35) ← (byte) $20
[127] (byte) draw_window::x3#1 ← ++ (byte) draw_window::x3#2
[128] if((byte) draw_window::x3#1<(byte) draw_window::x2#0) goto draw_window::@7
to:draw_window::@8
draw_window::@8: scope:[draw_window] from draw_window::@7
[129] (byte) draw_window::y3#1 ← ++ (byte) draw_window::y3#2
[130] if((byte) draw_window::y3#1<(byte) draw_window::y2#0) goto draw_window::@6
to:draw_window::@return

5255
src/test/ref/textbox.log Normal file

File diff suppressed because it is too large Load Diff

212
src/test/ref/textbox.sym Normal file
View File

@ -0,0 +1,212 @@
(label) @1
(label) @begin
(label) @end
(void()) draw_window((byte) draw_window::x1 , (byte) draw_window::y1 , (byte) draw_window::x2 , (byte) draw_window::y2)
(word~) draw_window::$13 $13 zp ZP_WORD:22 202.0
(word~) draw_window::$14 $14 zp ZP_WORD:24 202.0
(word~) draw_window::$18 $18 zp ZP_WORD:30 202.0
(word~) draw_window::$19 $19 zp ZP_WORD:28 202.0
(word~) draw_window::$2 $2 zp ZP_WORD:26 4.0
(word~) draw_window::$24 $24 zp ZP_WORD:36 2002.0
(byte*~) draw_window::$27 $27 zp ZP_WORD:22 202.0
(byte*~) draw_window::$28 $28 zp ZP_WORD:24 202.0
(byte*~) draw_window::$29 $29 zp ZP_WORD:26 4.0
(word~) draw_window::$3 $3 zp ZP_WORD:18 4.0
(byte*~) draw_window::$30 $30 zp ZP_WORD:18 4.0
(byte*~) draw_window::$31 $31 zp ZP_WORD:30 202.0
(byte*~) draw_window::$32 $32 zp ZP_WORD:28 202.0
(byte*~) draw_window::$33 $33 zp ZP_WORD:32 4.0
(byte*~) draw_window::$34 $34 zp ZP_WORD:20 4.0
(byte*~) draw_window::$35 $35 zp ZP_WORD:36 2002.0
(byte) draw_window::$36 reg byte a 4.0
(byte) draw_window::$37 reg byte a 4.0
(byte) draw_window::$39 reg byte a 4.0
(word~) draw_window::$4 $4 zp ZP_WORD:32 4.0
(byte) draw_window::$40 reg byte a 4.0
(byte) draw_window::$42 reg byte a 202.0
(byte) draw_window::$43 reg byte a 202.0
(byte) draw_window::$45 reg byte a 202.0
(byte) draw_window::$46 reg byte a 202.0
(word~) draw_window::$5 $5 zp ZP_WORD:20 4.0
(byte~) draw_window::$6 reg byte x 2.0
(byte~) draw_window::$8 reg byte a 2.0
(label) draw_window::@1
(label) draw_window::@2
(label) draw_window::@3
(label) draw_window::@4
(label) draw_window::@5
(label) draw_window::@6
(label) draw_window::@7
(label) draw_window::@8
(label) draw_window::@9
(label) draw_window::@return
(word) draw_window::q
(word) draw_window::q#0 q zp ZP_WORD:20 3.242424242424242
(byte) draw_window::x
(byte) draw_window::x#0 reg byte x 4.0
(byte) draw_window::x#1 reg byte x 151.5
(byte) draw_window::x#2 reg byte x 58.00000000000001
(byte) draw_window::x1
(byte) draw_window::x1#0 x1 zp ZP_BYTE:2 3.365079365079365
(byte) draw_window::x2
(byte) draw_window::x2#0 x2 zp ZP_BYTE:6 19.852459016393443
(byte) draw_window::x3
(byte) draw_window::x3#0 reg byte x 202.0
(byte) draw_window::x3#1 reg byte x 1501.5
(byte) draw_window::x3#2 reg byte x 776.0
(byte) draw_window::y
(byte) draw_window::y#0 reg byte x 4.0
(byte) draw_window::y#1 reg byte x 151.5
(byte) draw_window::y#2 reg byte x 40.6
(byte) draw_window::y1
(byte) draw_window::y1#0 y1 zp ZP_BYTE:5 0.24999999999999997
(byte) draw_window::y2
(byte) draw_window::y2#0 y2 zp ZP_BYTE:7 3.5
(byte) draw_window::y3
(byte) draw_window::y3#0 y3 zp ZP_BYTE:14 4.0
(byte) draw_window::y3#1 y3 zp ZP_BYTE:14 151.5
(byte) draw_window::y3#2 y3 zp ZP_BYTE:14 36.90909090909091
(word) draw_window::z
(word) draw_window::z#0 z zp ZP_WORD:18 6.2941176470588225
(word) draw_window::z#1 z#1 zp ZP_WORD:28 75.75
(word) draw_window::z#2 z#2 zp ZP_WORD:34 137.75
(void()) main()
(byte~) main::$3 reg byte a 22.0
(label) main::@1
(label) main::@2
(label) main::@3
(label) main::@4
(label) main::@5
(label) main::@6
(label) main::@7
(word) main::wait
(word) main::wait#1 wait zp ZP_WORD:3 151.5
(word) main::wait#2 wait zp ZP_WORD:3 202.0
(byte) main::x
(byte) main::x#1 x zp ZP_BYTE:2 16.5
(byte) main::x#2 x zp ZP_BYTE:2 7.699999999999999
(byte*) screen
(const byte*) screen#0 screen = (byte*) 1024
(byte[]) text
(const byte[]) text#0 text = (string) "this is a small test with word wrap, if a word is too long it moves it to the next line. isn't that supercalifragilisticexpialidocious? i think it's cool!@"
(byte[]) text2
(const byte[]) text2#0 text2 = (string) "textbox by scan of desire@"
(void()) textbox((byte) textbox::x1 , (byte) textbox::y1 , (byte) textbox::x2 , (byte) textbox::y2 , (byte*) textbox::text)
(byte~) textbox::$15 reg byte y 101.0
(byte~) textbox::$17 $17 zp ZP_BYTE:17 101.0
(byte*~) textbox::$31 $31 zp ZP_WORD:15 202.0
(byte) textbox::$32 reg byte a 4.0
(byte) textbox::$33 reg byte a 4.0
(byte) textbox::$35 reg byte a 202.0
(byte) textbox::$36 reg byte a 202.0
(byte) textbox::$38 reg byte a 202.0
(byte) textbox::$39 reg byte a 202.0
(word~) textbox::$8 $8 zp ZP_WORD:15 202.0
(label) textbox::@1
(label) textbox::@10
(label) textbox::@11
(label) textbox::@12
(label) textbox::@13
(label) textbox::@14
(label) textbox::@15
(label) textbox::@2
(label) textbox::@3
(label) textbox::@4
(label) textbox::@5
(label) textbox::@6
(label) textbox::@7
(label) textbox::@8
(label) textbox::@9
(label) textbox::@return
(byte) textbox::c
(byte) textbox::c#1 reg byte x 2002.0
(byte) textbox::c#2 reg byte x 314.85714285714283
(byte) textbox::i
(byte) textbox::i#1 i zp ZP_BYTE:10 27.545454545454547
(byte) textbox::i#2 i zp ZP_BYTE:10 22.954545454545453
(byte) textbox::ls
(byte) textbox::ls#0 reg byte y 202.0
(byte) textbox::ls#1 reg byte y 1001.0
(byte) textbox::ls#2 reg byte y 1368.3333333333335
(byte*) textbox::text
(byte*) textbox::text#12 text zp ZP_WORD:8 50.108695652173914
(byte) textbox::x
(byte) textbox::x#0 x zp ZP_BYTE:11 1.0
(byte) textbox::x#1 x zp ZP_BYTE:11 151.5
(byte) textbox::x#10 x zp ZP_BYTE:11 36.214285714285715
(byte) textbox::x#12 x zp ZP_BYTE:11 33.666666666666664
(byte~) textbox::x#15 x zp ZP_BYTE:11 202.0
(byte) textbox::x#5 x zp ZP_BYTE:11 202.0
(byte) textbox::x#7 x zp ZP_BYTE:11 151.5
(byte) textbox::x1
(byte) textbox::x1#0 x1 zp ZP_BYTE:2 11.0
(byte) textbox::x1#4 x1 zp ZP_BYTE:2 6.913043478260869
(byte) textbox::x2
(byte) textbox::x2#0 x2 zp ZP_BYTE:6 5.5
(byte) textbox::x2#4 x2 zp ZP_BYTE:6 6.913043478260869
(byte) textbox::y
(byte) textbox::y#0 y zp ZP_BYTE:5 1.4285714285714284
(byte) textbox::y#1 y zp ZP_BYTE:5 84.16666666666666
(byte) textbox::y#11 y zp ZP_BYTE:5 151.5
(byte) textbox::y#12 y zp ZP_BYTE:5 27.06666666666667
(byte) textbox::y#2 y zp ZP_BYTE:5 101.0
(byte) textbox::y#5 y zp ZP_BYTE:5 101.0
(byte) textbox::y1
(byte) textbox::y1#0 y1 zp ZP_BYTE:5 22.0
(byte) textbox::y1#4 y1 zp ZP_BYTE:5 2.5
(byte) textbox::y2
(byte) textbox::y2#0 y2 zp ZP_BYTE:7 7.333333333333333
(byte) textbox::y2#4 y2 zp ZP_BYTE:7 4.717391304347826
(word) textbox::z
(word) textbox::z#0 z zp ZP_WORD:12 1.3333333333333333
(word) textbox::z#1 z zp ZP_WORD:12 101.0
(word) textbox::z#2 z zp ZP_WORD:12 202.0
(word) textbox::z#3 z zp ZP_WORD:12 29.000000000000004
(word) textbox::z#4 z zp ZP_WORD:12 151.5
(word) textbox::z#5 z zp ZP_WORD:12 101.0
zp ZP_BYTE:2 [ main::x#2 main::x#1 textbox::x1#4 textbox::x1#0 draw_window::x1#0 ]
zp ZP_WORD:3 [ main::wait#2 main::wait#1 ]
zp ZP_BYTE:5 [ textbox::y1#4 textbox::y1#0 textbox::y#5 textbox::y#1 textbox::y#12 textbox::y#11 textbox::y#0 textbox::y#2 draw_window::y1#0 ]
zp ZP_BYTE:6 [ textbox::x2#4 textbox::x2#0 draw_window::x2#0 ]
zp ZP_BYTE:7 [ textbox::y2#4 textbox::y2#0 draw_window::y2#0 ]
zp ZP_WORD:8 [ textbox::text#12 ]
zp ZP_BYTE:10 [ textbox::i#2 textbox::i#1 ]
reg byte y [ textbox::ls#2 textbox::ls#0 textbox::ls#1 ]
reg byte x [ textbox::c#2 textbox::c#1 ]
zp ZP_BYTE:11 [ textbox::x#5 textbox::x#15 textbox::x#10 textbox::x#7 textbox::x#0 textbox::x#12 textbox::x#1 ]
zp ZP_WORD:12 [ textbox::z#5 textbox::z#1 textbox::z#3 textbox::z#4 textbox::z#0 textbox::z#2 ]
reg byte x [ draw_window::x#2 draw_window::x#0 draw_window::x#1 ]
reg byte x [ draw_window::y#2 draw_window::y#0 draw_window::y#1 ]
zp ZP_BYTE:14 [ draw_window::y3#2 draw_window::y3#0 draw_window::y3#1 ]
reg byte x [ draw_window::x3#2 draw_window::x3#0 draw_window::x3#1 ]
reg byte a [ main::$3 ]
reg byte a [ textbox::$32 ]
reg byte a [ textbox::$33 ]
zp ZP_WORD:15 [ textbox::$8 textbox::$31 ]
reg byte y [ textbox::$15 ]
zp ZP_BYTE:17 [ textbox::$17 ]
reg byte a [ textbox::$38 ]
reg byte a [ textbox::$39 ]
reg byte a [ textbox::$35 ]
reg byte a [ textbox::$36 ]
reg byte a [ draw_window::$36 ]
reg byte a [ draw_window::$37 ]
zp ZP_WORD:18 [ draw_window::z#0 draw_window::$3 draw_window::$30 ]
reg byte a [ draw_window::$39 ]
reg byte a [ draw_window::$40 ]
zp ZP_WORD:20 [ draw_window::q#0 draw_window::$5 draw_window::$34 ]
zp ZP_WORD:22 [ draw_window::$13 draw_window::$27 ]
zp ZP_WORD:24 [ draw_window::$14 draw_window::$28 ]
zp ZP_WORD:26 [ draw_window::$2 draw_window::$29 ]
reg byte a [ draw_window::$42 ]
reg byte a [ draw_window::$43 ]
zp ZP_WORD:28 [ draw_window::z#1 draw_window::$19 draw_window::$32 ]
zp ZP_WORD:30 [ draw_window::$18 draw_window::$31 ]
zp ZP_WORD:32 [ draw_window::$4 draw_window::$33 ]
reg byte x [ draw_window::$6 ]
reg byte a [ draw_window::$8 ]
reg byte a [ draw_window::$45 ]
reg byte a [ draw_window::$46 ]
zp ZP_WORD:34 [ draw_window::z#2 ]
zp ZP_WORD:36 [ draw_window::$24 draw_window::$35 ]