PASCAL Compiler

Programming the 6502 microprocessor and its relatives in assembly and other languages.
Post Reply
bvold
Posts: 23
Joined: 07 Jul 2005
Location: Minnesota
Contact:

PASCAL Compiler

Post by bvold »

I was wondering if anyone new of a PASCAL compiler out there for the 6502? Thanks. :)
User avatar
GARTHWILSON
Forum Moderator
Posts: 8775
Joined: 30 Aug 2002
Location: Southern California
Contact:

Post 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?
kc5tja
Posts: 1706
Joined: 04 Jan 2003

Post 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..*)
cas
Posts: 27
Joined: 21 May 2003
Location: Germany
Contact:

Post 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
User avatar
Ruud
Posts: 259
Joined: 12 Dec 2003
Location: Heerlen, NL
Contact:

Post 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.

Code: Select all

    ___
   / __|__
  / /  |_/     Groetjes, Ruud 
  \ \__|_\
   \___|       URL: www.baltissen.org

Post Reply