t-edson / P65Pas

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

Assembler documentation #42

Closed odflor closed 1 year ago

odflor commented 1 year ago

Hi!

Where can I find documentation about the assembler used by P65Pas?

As contribution there is other Useless program example:

//////////////////////////////////////////// // New program created in 12/09/2022} //////////////////////////////////////////// program NewProgram; uses Commodore64; var i,c,k : word; r : byte; color: [1000]byte absolute $D800;

procedure fill1; begin for i := 0 to 999 do r := RANDOM; screen[i] := 250; color[i] := r; end; end;

procedure again; begin c := c + 256; color[c] := r; end;

procedure fill2; begin for i := 1 to 20000 do c := RANDOM; r := RANDOM; color[c] := r;

  again;
  again;
  again;
end;

end;

procedure fill3; begin r := 0;

for i := 1 to 2000 do
  c := RANDOM;
  color[c] := r;

  again;
  again;
  again;
end;

end;

procedure fill4; begin for i := 0 to 999 do color[i] := 0;

  for c := 1 to word(50) do
    // NOP
  end;

end;

end;

begin k := 0; screenBorder := 0; screenBack := 0; CLRSCR;

while k = 0 do fill1; fill2; // fill3; fill4; end;

asm RTS end
end.

t-edson commented 1 year ago

Hi. There is only the section "ASM blocks" in the Github main page of P65Pas. Maybe I need to expand it and include in a Wiki. If you refer to the syntax of the assembler, there is not a special standard. I just implemented the syntax I used to work for 6502 assemblers with some minors additions for interact with the Pascal code. I think I can include your codes as examples in the repository, if you agree of course.

odflor commented 1 year ago

Yes please, this is the reason because I send to You the examples....

I will provide more advanced examples as the compiler grows up at features.

I request the assembler docs because I want to begin to do some support libraries for c64 and c128 and even vic 20. I have a huge library of assembler routines at my disposition to do some advanced programming.

I don't like to use them directly from assembler, but on "Pascual" there is more challenging to me.

(also I'm a Lazarus programmer.....if somebody need)

Best Regards

odflor commented 1 year ago

The first goal I want to reach with p65pas is do a "demo" with graphics, sound an music and provide the sources to encourage people to use it for its "Useless Programs".

t-edson commented 1 year ago

Assembler implementation is very complete in P65Pas. That's a feature with minor changes and even it has been improved after the last redesign of the compiler. Tell me if you have some problem. There is a good unit for compiling to the Vic-20. The unit for Commodore128.pas is some poor because I haven't found good information of the Kernal. image

t-edson commented 1 year ago

Your code have been added to the samples code folder.