In search of PL/I for the Z80

Continuing the discussion from Computing sin(x) in Basic:

An interesting adventure… there are two versions of PL/i-80 from Digital Research here - are they any use? Which ones have you found?

EdS,

I rebuilt my ‘clcsin.pli’ program to accept user input for range (0 to nPi) and number of terms (5-13). Using 0-2Pi and 9 terms, my error was extremely low for the entire run. In the initial run 0-2Pi with 5 terms error was high above Pi. Now it’s not, and between 0 and Pi the error was shown as 0 (limit of precision basically).

As for PL/I compilers for Z80, there are two: PL v1.0 and PL v1.3. The 1.0 compiler has many examples included, while the PL 1.3 is ‘bare compiler’.

I had been using 1.0 as it seemed ‘more complete’ to me when I started, and it was fine until it would not compile my most recent program - an Analyical Well Model program. The compile ‘just froze’ during Pass 2. At that point I removed all the V1.0 components and installed the 1.3 components. V 1.3 DID compile my analytical well program and it ran very well.

So now I’m using v1.3 and am very happy with it. I am about to try 0-4Pi with 11 terms, but it will take a while to calculate…

Darn! 11 terms caused an OVERFLOW(1), so I’m running 0-4Pi with 9 terms, which works. I’ll have to see if there’s a way to use more than 9 terms given the precision of the PL/I Z80 compilers.

I need to find the V1.4 PL/I compiler for the Z80 because it’s the first one that supports DOUBLE precision. Up to V 1.3 only supports single precision or ‘float binary(24)’. Double precision in PL/I is ‘float binary(53)’ which would be nice on some problems.

There’s a link to a 1.4 version here:
http://www.cpm.z80.de/binary.html

Thanks EdS. I also found it here: https://schorn.ch/altair_6.php

The only issue with the shorn link is that it runs on a SIMH Altair, so you first have to install the main file set and run it, then get the compiler and run that. I used the linux version as it was quickest for me and worked perfectly the first time. Then use the tool ‘W’ on the simh/altair to copy the PL/I 1.4 main files to the local (linux) disk, then copy them to my PC where I can zip them and beam them to the Z80 single board.

Or… just grab the 1.4 Digital Research zip you linked and use that, which is what I think I’ll do.

1 Like

OK. I installed the DR 1.4 version of PL/I and then compiled a double precision (float binary(53)) version. It’s happily cranking out values of sin(x) and has reached x=6.40 radians with an error of 0.000009 (reported). This is from 0 to 4Pi with 11 terms. (11 terms seems to work fine with double precision).
Yay!

1 Like

Silly question - does anyone know the option commands for the Digital Research Editor (edit.com) as comes with PL/I?

I tried compiling a program under v1.4 that compiled and ran under v1.3 and I’m getting the error:
LINK 1.31
MEMORY OVERFLOW, USE [A] SWITCH

Unfortunately all my attempts at linking with an ‘a’ switch have failed. The compiler switches are $x where x is a compiler option, but that does not work with the linker. I’ve looked and cannot find a linker manual (and it’s not in either of the PL/I manuals I’ve downloaded)

Maybe you put the option after the filename, in brackets:
LINK FILENAME[A]

I found a couple of PDFs
Digital Research : CP/M 3 Programmer’s Manual

But see also page 237 on page 253 of this:
Programmer’s Utilities Guide For the CP/M® Family of Operating Systems

Thanks again EdS. Very much appreciated.
I actually figured out the ‘link pgm [a]’ switch by trying many combinations, and that one worked.

Thanks also for the excellent manuals.

I also recompiled my sin(x) program with double precision PL/I (float binary(53)) and it now runs with 11 Taylor terms no problem. Going from 0 to 4Pi it starts to fail (difference > 0.000000) at about 10 radians. here’s a quick sample of the special case part (where I use close to exact x=nPi values)

Special cases - sin( Pi):
sin x( 3.14) = 0.0000002 (calculated) 0.0000002 (actual) -0.0000000 (diff)

Special cases - sin( 2Pi):
sin x( 6.28) = -0.0000058 (calculated) -0.0000003 (actual) -0.0000055 (diff)

Special cases - sin( 3Pi):
sin x( 9.42) = -0.1299004 (calculated) -0.0000000 (actual) -0.1299003 (diff)

Special cases - sin( 4Pi):
sin x( 12.57) = -158.2498658 (calculated) -0.0000006 (actual) -158.2498652 (diff)

You can see that 4Pi goes ‘nuts’ with 11 series terms. I could try 13 terms but the 11-term calculation took a very long time to run. :slight_smile:

1 Like