t-edson / P65Pas

CPU 6502 Pascal Compiler/IDE/Debugger
GNU General Public License v3.0
119 stars 27 forks source link

Pointer doesn't accept a value. #52

Closed Skertan closed 7 months ago

Skertan commented 1 year ago
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

t-edson commented 1 year ago

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

Skertan commented 1 year ago

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.

t-edson commented 1 year ago

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.

Skertan commented 1 year ago

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)?

t-edson commented 1 year ago

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

Skertan commented 7 months ago

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

Skertan commented 7 months ago

Issue solved