Stanford Pascal compiler for VM - more extensions including static variables

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view

Stanford Pascal compiler for VM - more extensions including static variables

Hercules390 - Vm mailing list
Hello Hercules-VM group,

I'm continuing to work on the Stanford Pascal compiler;
this is much fun, and maybe someone out there is interested, too.

The latest version is usable again for everyone who has a VM Rel 6 running
with Hercules; you can download the AWSTAPE image from

at the bottom of the page there is a "Resource" paragraph, and the link
to the AWSTAPE should give you a file named PAS2016E.ZIP - that's it.

If you have any questions regarding how to use the compiler, feel free
to contact me offline. PP <name> compiles your Pascal program, and
PRUN <name> runs it - in the most simple case. There are lots of
examples on the AWS-Tape, including the compiler itself.

This version contains the following extensions compared to the version
from earlier this month:

- static definitions (same syntax as IBMs Pascal VS), especially useful in
external modules, which can now have their own private variables which hold
their values across calls;

- the module PASSNAP aka SNAPSHOT was extended, so that static variables
are shown, too;

- the EPAs of functions and procs are shown in hex, dto. the call offsets
and - for every variable - not only name and value, but also storage class,
offset, and address ... and the address of the stack frame and the
static area
of every procedure or function

That makes the snapshots look more technical, but this way they provide
much more information, esspecially for the ASSEMBLER programmer.

A short example:

      FROM LINE: 37
      EPA address of FIBONACCI is 000205A8
      Call offset is 0098

      Stack at address 0002B1D0
      Static variables at address 00020598

      J                   (A/0070/0002B240) =      10
      ANZCALL             (S/0008/000205A0) =      10

      FROM LINE: 46
      EPA address of FIBONACCI is 000205A8
      EPA address of $PASMAIN is 000206D8
      Call offset is 0108

      Stack at address 0002B068
      Static variables at address 00020580

      I                   (A/0160/0002B1C8) =      10
      TIME                (A/0164/0002B1CC) =      13
      TESTDUMP            (S/0008/00020588) =      42
      TESTCHAR            (S/000C/0002058C) = 'Oppolzer  '


this is the end of a call trace; we have recursive calls of
procedure FIBONACCI; see first line.

Now I have a little request for help:

to do the Snapshots, PASSNAP must have access to a debug-info file that
contains the symbolic informations for the compile unit. This file
is created by the compiler.

If the runtime object consists of multiple compile units (main program
and several modules), there is a problem at the moment, because normally
there is only one debug-info file that PASSNAP can handle. So variable
etc. works for the main program but not for the sub-modules.

To change this, it would be necessary to open the debug-info files
of the sub-modules on demand.

This in turn would require to issue FILEDEFs for certain file names
computed at runtime when the program is already active and
then doing the RESET (= OPEN) from the Pascal program (that is,
from PASSNAP).

I recall, that in our Stuttgart University installation in 1985 we had a
subroutine called CMSX, which was callable from Pascal VS, and which
was able to execute an arbitrary CMS command under the control of
the Pascal program. The parameters were the command and a return code.

For example:


This would be exactly what I need.

Could anyone tell me if such a routine already exists somewhere or
tell me how it could be implemented?

Thank you very much,
kind regards


Reply | Threaded
Open this post in threaded view

Stanford Pascal compiler for VM - new extensions

Hercules390 - Vm mailing list
Hello Hercules-VM group,

new extensions to Stanford Pascal available:

*New functions MEMSET and MEMCPY <>
Direct WRITE of scalar variables or expressions
Maximum length of string constants is now 254 (was 64)
Making CSP numbers consistent between PASCAL1, PASCAL2 and PASMONN
Call CMS commands from PASCAL programs
PASSNAP prints variables from more than one source file
PASSNAP prints heap variables allocated by NEW and ALLOC
**BTW: I managed to call CMS commands from Stanford Pascal using SVC 202;
this was no big deal.

You will find all the details here:

and there is also a link in the resources paragraph to a AWS Tape file,
if you want to install and test the compiler on your VM installation.

I will now stop to do more extensions to the compiler for a while, because
I reached all my goals from 2011. The next big targets are

- documenting the P-Code language, as it exists know, and the CSPs
(the documentation from 1979 is very out-dated)

- porting the compiler to Windows, Linux and OS/2 by building a
P-Code translator or interpreter there (there will be some issues)

Kind regards
have a nice weekend

Bernd Oppolzer