Page 1 of 1

PASCAL Compiler

Posted: Thu Mar 02, 2006 3:42 am
by bvold
I was wondering if anyone new of a PASCAL compiler out there for the 6502? Thanks. :)

Posted: Thu Mar 02, 2006 5:13 am
by GARTHWILSON
Ruud was working on one but said the executable size was looking like it was going to be too big for the address space of the 6502. Have there been further developments since that post, Ruud?

Posted: Thu Mar 02, 2006 7:37 am
by kc5tja
If executable size grows to be too big, then perhaps one should look into using direct, indirect, or subroutine-threaded code (a la Forth-style). I know a number of Pascal compilers for the Z-80 and 8085 used subroutine threading extensively. This ought to cut down substantially on executable size, although software will now take longer to execute.

Perhaps it's possible to explicitly declare specific procedures as speed-critical, so that it generates non-threaded code for maximum speed (alas, but now the resulting code is rather large).

Code: Select all

procedure ThisCodeRunsSlowly;
begin
  blah;
  blort;
  SomeFastCode
end;

(*%fast%*)

procedure SomeFastCode;
begin
  (* ..etc.. *)
end;

(*%compact%*)
(*..etc..*)

Posted: Thu Mar 02, 2006 5:58 pm
by cas
A good Pascal for 6502 Computers is Kyan Pascal (for Atari XL/XE and Apple II). It has inline assembler and produced moderate sized code. Maybe it is possible to patch Kyan Pascal to generate generic 65023 code (not Atari or Apple II dependend). I guess a generic Runtime Lib needs to be written.

A PASCAL -> C translator with CC65 might be worth a try.

Best regards

Carsten

Posted: Fri Mar 03, 2006 11:20 am
by Ruud
GARTHWILSON wrote:
Have there been further developments since that post, Ruud?
Unfortunately not much :( Too many projects, too less time.

I wished I could code a smaller Pascal. But the idea is to write it in Pascal. Which means that it can only run if it is capable of compiling itself. At this moment it is able to generate very small programs but only on a PC. Which is not bad at all, I must say. At this moment my compiler generates PRG's which can be run by the C64 emulator I use.