Pascal-M

In 1978, via the dutch KIM-1 user club, a Pascal compiler, written by Mark Rustad,  with a 6502 interpreter by G.J. v.d. Grinten, was given to me.
It was a complete package, on a KIM-1 cassette tape, and with some documentation. Micro-Ade, the invaluable assembler/editor, was enhanced to edit Pascal program source.

The latest version is Pascal-M 2K1, a complete system to compile load link and run on the KIM-1 or the KIM-1 Simulator.


The idea was great, the result was not very userfiendly: load Micro-Ade, edit a Pascal program, save to tape load the interpreter (4K), compiler (19K), compile the program by loading from tape, save the obejct to tape, load the object from tape, and run the program. Of course the compiler would find errors and then the editing and compiling cycle on a cassette based system could start again. Even with the automated control of two tape decks and hypertape, it took a long time to get something.

See the Userguide and required binaries here.

I did this several times and then gave up. No way a Pascal compiler was a viable option on a dual cassette player based KIM-1.
At that moment I was finishing my Masters at the VU university in Amsterdam, in Computer Science, and was introduced to Pascal, compilers, the VU Pascal compiler, the books by Niklaus Wirth  and that was all very exciting.

My good friend Anton Muller managed to get the (earlier?) sources of the compiler (in Pascal) and the interpreter (assembler), all on paper photocopies and it was exciting to study those. I did notice the similarity to the P4 compiler in the book by Steve Pemberton, P2 sources were not available to me then. Pascal-M is a descendent of P2. Alas, I could not do anything useful with all this since the KIM-1 has no suitable file system, tape is too slow for compiling, and so I stored paper and cassette tapes away. Thee compiler really worked on the KIM-1, since the compiler produces Px tapes and the interpreter loads these. But so time consuming!

In 1983 I joined Digital Equipment  and had access,first to the PDP-11 RSX-11M Pascal compiler (itself a P4 descendent) and a bit later the first versions of VAX/VMS Pascal. And now things were possible that made me return to the Pascal-M compiler: cross-compile on VMS and run on the KIM-1! I had sources, so I spent all my lunch hours typing in the sources, compiling, testing, all possible on those excellent Digital machines!. In fact, it took me two years of lunch breaks to have the first working version of the PASCAL-M compiler on VMS, an interpreter/debugger in Pascal on VMS and an interpreter on the KIM-1. And with some VMS tools I could compile on VMS and load the program from cassette on the KIM-1. This is version 1.x of the PASCAL-M compiler, still mostly original as received form Mark Rustad en Willem v d Grinten, but completely embedded in the VMS – KIM-1 toolbench. It worked!

Now the plans were made to enhance the KIM-1 with floppy disk drives and he compiler with a file system, already in place in the VMS version od compiler/interpreter.
Nothing like that happened though. CP/M (on the Spectravideo SVI-738) and and Turbo Pascal came along and I left the PASCAL-M compiler, together with all KIM-1 related work, again alone to collect dust. Luckily most source files, living on the VAX/VMS system, made it to floppies on CP/M and later survived many PC changes. All paper of course was of course kept, I seldom throw something away!

In 2003 Ruud Baltissen asked about Pascal and 6502 and I remembered the PASCAL-M compiler. So I digged up the paper, and loaded the sources in what I had available then: Borland Pascal 7. And found out I could get the package working on that platform! Still fun. But I was too busy to fire up the KIM-1. It still runs, but I have my doubts about the reliability of the RAM expansion memory IC’s. So it is not tested again on the real hardware. That will change, as the Micro-KIM and KIM Clone came along, and also a PC based KIM-1 emulator! The perfect excuse to finally get this package working again and make it better.

So this is still a Work In Progress!  Now with cross-compiling/running also on the PC, and bootstrapping with a host Pascal compiler. Windows, and also Linux, with Freepascal and Lazarus.
To show you the progress (V1.0 is available again in both source an binary format!): here the relevant documents and source files so far:

1978 Pascal-M

Original package. Version 1.0 Some tape binaries preserved, compiler tape is lost. Original compiler source restored in 2020, needs more testing. Cross compilation works.

1986 VAX/VMS Pascal

The 1978 V1.0 compiler was a subset of P2, uppercase, no file I/O. So in 1986, with the aid of the excellent VAX/VMS compiler, an updated version 1.3 was constructed. The project was interrupted by ‘life’ and the 6502 interpreter not finished, the CP/M interpreter lost due to floppy disk problems. Stored unitl the next iteration in 2003

Cross-compiler, native Pascal interpreter with debugger and m-code disassembler. Compiler enhanced with file I/O. VAX/VMS Pascal sources.  Compiler can compile itself. Version 1.3

VAX/VMS Pascal sources of enhanced Pascal-M compiler, interpreter, self-compiling version, disassembler

2003 Turbo/Borland Pascal 7

VAX/VMS sources converted to Turbo Pascal. Documentation typed in again.

2009 Delphi 7

VAX/VMS sources converted to Delphi console application, started with V1.5 of Pascal-M: lift limitations like identifiers maximum 8 characters in length etc. and add some practical extensions.
Not ready for publication at the moment.

2020 Freepascal/Lazarus

VAX/VMS sources converted to Freepascal console application. Documentation corrected and enhanced. V1 compiler and cross compiler and tools restored to original Pascal-M V1 and binaries recreated. So now the 1978 version is available for the first time again in over 20 years!

Release notes sofar:

 (* Additions for version 1.1 :

     - restructured
     - documented
     - upper- and lowercase accepted in identifiers
     - tab-characters accepted and expanded
     - form-feed character accepted and replaced with blank
     - listing file output
     - HALT and EXIT standard procedure added
     - compile time boundary check on sets
       in types and constants
     - beside ELSE also OTHERWISE in CASE added
     - Error numbers renumbered and messages added
     - error in generating ENT instructions with parameter
       list corrected
     - error in generating correct code for set inclusion
       corrected in EXPRESSION and in CONDGEN
     - error in generating code for Read procedure if
       undeclared identifier used corrected

     Additions for version 1.2 :

     - filetype text added in standard names and read and write
     - standard procedures reset and rewrite added including
       file-open non-standard extension
     - standard function status added for file-variables
     - standard procedure CLOSE added for file-variables   
     - standard input file keyboard (not buffered, no echo) added
     - error in generating access to 1 byte parameters lod1 
     - error in WriteProc checking types with Comptypes corrected 
     - error in handling constant string array of char in
       procedure/function call in CallNonStandard corrected 

     Additions for version 1.3 :

     - standard functions SUCC and PRED added
     - array of character constants and variables of any length
       may be assigned to variables of type (packed) array of char
       if length is less or more than nr of characters in array   
       The result is padded with blanks or truncated              
     - character may be assigned to array of char,
       result padded with blanks
     - bug in body (complex structures formal type corrected
     - separate listing, source and error file output

     Additions for V1.4

     - ObjectPascal file open/close hacked in
     - Corrected P4 -> P2 origin
     - code buffer large enough to prevent P2 records
     - todo: output binaries also
     - other tools (loader, disassembler, interpreter uptodate