t-edson/P65Pas

Pointer doesn't accept a value.

Closed this issue · 7 comments

program NewProgram;
uses Commodore64;
var
  p : ^byte;
  bt: byte;
begin
  p := @bt;
  p^ := $01;
end.

This program gives an error:
newfile1[9,5] Error: Index must be byte or word

Sorry. Pointers are not complete implemented. I'm working on that.

No worries, at the moment I need pointers to read from different locations and write in an fixed array.
Since reading a pointer works, I'm ok.

Pointers are useful. It's needed to implement the VAR parameters too. I'm doing several changes in the compiler to achieve this objective. I think soon we're going to have pointers implemented.
Compiler is changing a lot these days. Fortunately, now we have one more contributor to the project.
Thanks for testing. It helps to detect and fix the errors. I will tell you when pointers are implemented.

VAR parameters would be cool, too. I solved it at the moment with a global variable.
I think the same goes for return values from procedures -> functions.

My solution with array_x[n] := p^ works only for the first byte. After inc(p) it seems to stop reading

for n:= 0 to 10 do
  framcolor := framecolor + 1;
  array_x[n] := p^;
  framcolor := framecolor + 1;
  inc(p);
end;

with the help of the colorchange it seems to freeze the C64 at the secondDelphi array_x[n] := p^. Maybe a problem with inc(p)?

HI.
Basic support for pointers is implemented now in P65Pas. You can work with pointers to bytes and words.

Wasn't able to test the issue due to HDD-crash and data loss, but now I've tested it with success.

Issue solved