while and delay_ms issues
Closed this issue · 3 comments
Hi!:
This sample programs try to fill screen with available characters and then show a wellcome message and repeat it 10 times.
The issues are:
- Delay_MS does not delay
- Repeat 10 times using while cycle does not work
{"Hello World" P65Pas program.}
program Hello;
uses Commodore64;
var
i : word;
c : byte;
v : byte;
begin
screenBack := 1;
screenBorder := 15;
v := 1;
while v <= 10 do <== this don't work
CLRSCR;
c := 0;
for i := 0 to 999 do
screen[i] := c;
inc(c);
end;
delay_ms(word(1000)); <== this don't work
CLRSCR;
ChrOUT(' ');
ChrOUT('H');
ChrOUT('E');
ChrOUT('L');
ChrOUT('L');
ChrOUT('O');
ChrOUT(' ');
delay_ms(word(1000)); <== this don't work
inc(v);
end;
asm RTS end
end.
Hi!
Yes, WHILE loop works OK, is too fast! because of this I can't realize that it works.
Here an example program, enjoy!
{"Fill useless chars & colors" P65Pas program.}
program Useless;
uses Commodore64;
var
i : word;
c : byte;
l : byte;
v : byte;
color: [1000]byte absolute $D800;
procedure Fill;
begin
for i := 0 to 999 do
screen[i] := c;
inc(c);
end;
end;
procedure SetColor;
begin
for i := 0 to 999 do
color[i] := l;
inc(l);
end;
end;
procedure doit;
begin
Fill;
SetColor;
end;
begin
screenBack := 0;
screenBorder := 15;
c := 0;
l := 0;
for v := 0 to 254 do // Actually can't use "for v := 0 to 255"
doit;
end;
doit; // one more time, because I ain't can't use "for v := 0 to 255"
asm RTS end
end.
Best Regards!
That's good. It really works! There are still many things to finish implementing in the compiler, after the redesign of the Code generator but the good news is that now we have a more solid design to work.