Closed odflor closed 1 year ago
Hi.
Arrays are still in implementation in this new redesigned version. However ChrOUT() must be working OK. Maybe some modification have affected it.
I will check.
Fixed the bug when calling a ChrOut() from inside a FOR loop. In fact the problem was for all function called inside a FOR. The new code for code optimization wasn't considering to work inside FOR loop. The loop for an array is working OK.:
uses Commodore64;
var
a : array[4] of char;
i : byte;
begin
a[0] := 'H';
a[1] := 'O';
a[2] := 'L';
a[3] := 'A';
for i := 0 to 3 do
ChrOUT(a[i]);
end;
asm RTS end
end.
I don't see any problem here.
The problem about the "FOR k:=0 TO 255" is still opened. By now the compiler is converting the condition to "k<256" and it produces a infinite loop. I need to change the code generation for this interval.
The problem of the loop control variable of the FOR is fixed now. Check https://github.com/t-edson/P65Pas/issues/40
In this modified version of Hello World I found some issues
1) the loop control variable k doesn't stop at 255 loops 2) the original ChrOUT with constants after for i is not executed 3) to call the routine ChrOUT need to assign to a variable, can't be used directly from a array of char 4) the array needs to be defined with a additional element or not work
{"Hello World" P65Pas program.} program Hello; uses Commodore64; var a : array[5] of char; // 5 instead of 4 or the space is not printed i : byte; k : byte; e : char; begin a[0] := 'H'; a[1] := 'O'; a[2] := 'L'; a[3] := 'A'; a[4] := ' ';
for k := 0 to 255 do // this don't stop at 256 loops
end;
asm RTS end end.
there is a reason?