11-26-2011, 07:10 PM
nitrofurano Wrote:btw, i checked my code by testing it in part, and the compiler bug seems to be related with a variable name i used - i replaced 'character$' with 'name$', and that error message dissapeared.First of all, the above code has a bug: the parameter variable is characters$ whilst the inner variable is character$ (there is a missing -s at the end). They're different variables. The compiler crashed because it was not correctly managing this bug: when you use an undeclared alfanumeric VARIABLE$(Expression) it can mean be one of these 3 things:
Code:...
sub print64x32at(x2 as ubyte,y2 as ubyte,characters$ as string)
for i3=0 to len(characters$)-1
e3=code(character$(i3)) ' <<== BUG wrong (undeclared) variable
putchar64x32( (x2+i3) mod 64 ,y2 + int((x2+i3)/64), e3)
next i3
end sub
...
- VARIABLE$ is an array of Strings, and you want to get the i-th one (<expression>). This is discarded as undeclared arrays are not allowed (precisely to avoid this ambiguity)
- VARIABLE$ is a function returning a string, and you want to get the result (<expression> is the parameter). This is also discarded, since ZX Basic requires you to use DECLARE to prototype functions in advance.
- VARIABLE$ is a String, and you want the i-th character (string slicing). THIS is the meaning the compiler will get now since the other two are discarded.