![]() |
|
CODE <constant string> is broken (*solved*) - Printable Version +- Boriel Basic Forum (https://forum.boriel.com) +-- Forum: Compilers and Computer Languages (https://forum.boriel.com/forumdisplay.php?fid=12) +--- Forum: ZX Basic Compiler (https://forum.boriel.com/forumdisplay.php?fid=11) +---- Forum: Bug Reports (https://forum.boriel.com/forumdisplay.php?fid=15) +---- Thread: CODE <constant string> is broken (*solved*) (/showthread.php?tid=103) |
CODE <constant string> is broken (*solved*) - britlion - 2009-05-08 I was playing with some complex code from the "One Liners" stuff. The following program behaves completely differently in basic as opposed to going through the compiler. Actually, it crashes when run compiled. (I tried several different types for f and g). Oddly, at the first PLOT, there appears some other changes to the screen - a few bytes of corruption. Something weird is happening there. There are more brackets than I need - mostly in an attempt to make sure the math functions are coming out clearly. Try it in BASIN and then compile it. I know the functions are unnecessarily complex. That's the nature of the one liner type code. Nonetheless, it ought to behave when compiled just like the interpreted version. Shouldn't it? Code: DIM f,g as UBYTE
1 PRINT AT 9,9;"SIMON"
3 FOR f=1 TO 4
4 INK f
5 FOR g=1 TO 32
6 PLOT INT ABS((SGN (f-2.5)*80)+24+g), INT (((CODE "0202"(f TO f)-49)*99)-48+g)
7 DRAW 32,0
8 NEXT g
9 goto 11
10 STOP
11 PRINT INK f; OVER 1;AT CODE "1919"(f TO f)-44,CODE "0099"(f to f)-41;f
12 NEXT f
13 LET f=1
14 goto 9Re: This is bugged... - boriel - 2009-05-09 The bug seems to be related CODE "0202"(f TO f) part. ![]() The CODE <constant string> is wrong. I'm fixing it. And should also allow CODE "0202"(f) ... syntaxMeanwhile, try this workaround and see if you notice any other issue: Code: LET z$="0202"Re: This is bugged... - boriel - 2009-05-09 Well, I have fixed the "0909"(F to F) problem. It works now. Regarding your program, I've managed to work, making this changes:
Code: DIM f,g as UBYTE
1 PRINT AT 9,9;"SIMON"
3 FOR f=1 TO 4
4 INK f
5 FOR g=1 TO 32
6 PLOT INT ABS((SGN (f-2.5)*CAST(INTEGER, 80))+24+g), 16 + INT ABS (((CAST(INTEGER, CODE "-0202"(f))-49)*99)-48+g)
7 DRAW 32,0
8 NEXT g
9 goto 11
10 STOP
11 PRINT INK f; OVER 1;AT CODE "-1919"(f)-44,CODE "-0099"(f)-41;f
12 NEXT f
13 LET f=1
goto 4 |