Pascal-M V1.4

Here you find Pascal-M V1.4. Developed from the 1978 version with many updates:

Most important are: lowercase, bugs solved, file I/O. Freepascal based, so can be compiled for all current platforms.
The KIM-1 interpreter is not updated yet, requires minor adaptations and of course no file I/O.

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
     - updated M-code machine documentation

Example session

D:\myfiles\Pascal-M\2020 v1.4\compiler>type test.pas
program test ;

begin

writeln(‘hello world’) ;

end.

D:\myfiles\Pascal-M\2020 v1.4\compiler>pascalmv14.exe test.pas
Pascal-M compiler V1.4 Freepascal version August 2020

Pascal-M Compilation successful

A debugging interpreter for Pascal-M V1.4 M-code.

Command-line application, optional parameter is the .OBP Px objectfile
Default the program is executed.
The second parameter can be ‘debug to start a debugging session. ‘?’ for help on available commands

D:\myfiles\Pascal-M\2020 v1.4\compiler>pascalmintv14.exe test.obp

Interpreter for Pascal-M V1.4
Object filename = test.obp

hello world

D:\myfiles\Pascal-M\2020 v1.4\compiler>

D:\myfiles\Pascal-M\2020 v1.4\compiler>pascalmintv14.exe test.obp debug

Interpreter for Pascal-M V1.4
Program test Loaded

PC = 07CC
M-Debug > ?

Available debug commands :

B = Breakpoint commands
C = Show stack contents
D = Display store
E = Show stack contents
G = Continue without debugger
H = Show heappointer
I = Insert in store
M = Show markpointer
N = Next instruction executed
P = Show programcounter
S = Show stackpointer
T = Show procedure table
X = Exit interpreter

PC = 07CC
M-Debug > G

hello world

PASCAL-M stop

Binary loader

The KIM-1 interpreter can only execute M-code if it is already loaded into memory, there is no loader for Px records.
Version v1.0 of the KIM-1 interpreter needs two binaries loaded (and of course the interpreter code itself!)
– the M-code in memory from $2FA3
– the procedure address table at $0200

These binaries are made from the Px file with the program pascalmbinloader.exe

The program is a command-line application, and accepts two optional arguments:
– the M-code objectfile .OBP
– the load address in memory of the interpreter, default $2FA3 as in the KIM-1 V1 interpreter

If no argument is give the program prompts for the objectfile .OBP

Output are two binary files:
– .bin, the M-code loaded in memory
– .proc, the procedure address list

M-code disassembler

Disassembly of M-code. Command-line application, optional parameter is the .OBP Px objectfile
The second parameter can be the memory load address, default $2FA3 for the V1 KIM-1 interpreter.

If no argument is give the program prompts for the objectfile .OBP name.

Output are two text files:
.lst a textual paged disassembly of M-code and Procedure address list
.asm the assembler source in M-code format (no assembler exists yet!)

Downloads:

– Compiler Pascal-M V1.4
– Pascal-M V1.4 interpreter
– Binary loader
– Disassembler
– Pascal-M M-code documentation (pdf).