raxis logo

Play the Retro Axis original theme song


Testing Pascal Compilers for Commodore 64

13 Jan 2019 -

While the Commodore 64 included a built-in BASIC rutime, other programming languages were also available. This is part 1 of a 4 part series exploring a few of the Pascal Compilers available for Commodore systems. In this series, I use a C64 mini as the demonstration platform. The firmware revision is 1.2.0. Future updates may add new features or change the workflow that I am showing, so keep that in mind as you follow along.

Test Program

The test program shown is very simple. It will ask for a name, and output a reply. While more complex examples are possible, the purpose of this demonstration is to show the basic functionality of each compiler suite rather demonstrate all the whistles and bells and advanced programming techniques available. The example files and disk images are avaiable on the content server in the episode folder.

Kyan Pascal

(*Retro Axis - Kyan Pascal demo*)
program theaxis;
  const chan = \'retro axis\';
        year = \'2019\';
  type string = array [1..15] of char;
  var  name : string;
begin
  write(chr(147));
  write(\'what is your name? \');
  read(name);
  write(name);
  writeln(\'the year is \',year);
  writeln(\'* time to\');
  writeln(\'subscribe to \',chan);
end.

G-PASCAL

(*Retro Axis - G-Pascal demo*)
  var name : array [8] of char;
  i : integer;
begin
  write(chr(147));
  writeln(Retro Axis Demo);
  writeln( );
  read(name);
  (* G-Pascal does not handle strings *)
  (* parse the characters in the array *)
  for i := 0 to 7 do
    write(chr(name[i]));
    writeln(The year is 2019);
    writeln(\* time to subscribe to Retro Axis);
end.

PASCAL64

10 (*retro axis - pascal64 demo*)
20 program theaxis;
30 var name:array[1..15] of char;
40 var chan:array[1..10] of char;
50 var year:array[1..4] of char;
100 begin101 chan:= retro axis;
102 year:= 2019;
110 (*screenclear;*)115 write (chr(147));
120 write (what is your name? );
130 read (name);140 write (name);
150 writeln (the year is ,year);
160 writeln (\* time to);
170 writeln (subscribe to ,chan);
180 end.

SUPER PASCAL

1000 program retroaxis;
1005 const year = \'2019\';
1010 chan = \'Retro Axis\';
1015 var name:string;
1020 begin
1025 writeln(\'Retro Axis on superpascal\');
1030 write(\'What is your name?: \');
1035 read(name);
1036 writeln(\' \');
1040 write(name);
1045 writeln(\' the year is \',year);
1050 writeln(\'Subscribe to \',chan);
1055 end.

Final Thoughts

After spending a little over a week learning the quirks and features of these compilers and using them on the C64 Mini, I can conclude that it is possible to use alternative languages such as Pascal. During development of this episode, I also used the VICE emulator to perform testing and validate my results. Because the C64 Mini currently lacks the ability to change disks without using the snap-shot technique I describe in Episode 1, the additional workflow quickly becomes tedious. Another advantage of using VICE was that I could use a normal text editor and copy/paste my code back and forth between the emulator and text editor on my workstation. While possible, anyone wanting to seriously develop new software for the C64 would be better served using real hardware or taking the time to setup a more featured emulator.

Videos

Episode 2.1 - Kyan Pascal

Episode 2.2 - GPascal

Episode 2.3 - Pascal64

Episode 2.4 - Super Pascal