APL on a CP/M Z-80: This APL/Z program is running on the Z80Pack/Z80Pack-1.36/cpmsim emulator. This actually is pretty exciting for us. I found something called "APL/Z-11" - a zip-file collection of what amounts to a complete APL interpreter for the Z-80. Except it runs under full CP/M, of course, and so far, I only have the binary image of the interpreter. (The "APL.COM" CP/M file).

To test it, I had to build a complete CP/M machine - complete with virtual disks, and a running Z-80 box emulator and all of CP/M - on one of my Linux machines. This was an experimental hack, and I honestly did not expect it to all work. One has to download and build from the source, the Z80Pack utilities, and then also get the CPMTools utilities, that let you copy your files from the Linux directory, to the virtual disk-drive that your CP/M emulator/simulator looks at.

Then, you can load and run the APL, and need to figure out the translate-tables the original author had used. But to my astonishment, it all worked - rather well, actually. The instructions were on a site called "Techtinkering.com", and I followed these to the letter, to get all the CP/M emulation code working, and then used the CPMtools program ("cpmcp") to copy all the APL stuff onto a virtual CP/M disk, called "I:".

You can list the files on the CP/M disk, with "cpmls" - from your Linux command-line session. Once you start the CP/M simulator - with the disks defined so they can be seen - you can see all the APL files, and you can start APL and load "matinv" and "matdiv", and invert a matrix. It's like black-magic, really. You can even save and load your workspace.

The cyan/black-background right-side panel shows the Z-80 CP/M APL session, with results of inversion of a simple 4x4 matrix.

The various math functions, shown with ")clib" command, are APL/Z *.ACO files. Each of these files is one function, which can be loaded into the small CP/M Z-80 workspace (which is about 30K), and can be used as needed, and then erased to save room and to prevent the symbol-table (number of variables) limit from being reached.

The *.ACO files of individual functions are full math programs in their own right. And they are not overlays - you ")COPY and ")ERASE" them explicitly, as needed.

But this is a full, professional-quality APL, and seem to be free of bugs. You can set the index-origin using the old APL-360 command ")ORIGIN n", where n=0 or n=1. Note that to use the "matinv" and "matdiv" functions, you need index origin set to 1.

The command "y matdiv x J.^ 0 1 2" works, where y and x are vectors defining a scatter-plot on the x-y grid, which you want to pass a second--order least-squares curve through. J is the APL jot character, and "^" is the exponentiation character, normally a "*". The "*" char has been remapped for "multiply" and the "%" has been remapped for "divide". The high-minus is remapped as an underscore. The APL arrow (assignment) operator is remapped as the backwards quote "`". But it all works.

y ` 100 300 320 600 1300 1400 2000 2200 2300 2300
x ` 80 100 140 150 200 240 300 360 390 420

y matdiv x J.^ 0 1 2

(The above program returns the co-efficients:... )

-9.9687297e2 1.3215355e1 -1.2303062e2

You can load the app "sAPL" onto your Android device, and create vectors x and y, and use function "domino2" (the dyadic - ie left and right parameter function) for matrix divide, and get the same answer. Try it. Note, you will have to create the "domino2" function by editing the "domino" function, since it is monadic. Send me a note, if you want detailed instructions and are learning APL. It's easy. Only reason I have function "domino" in the sAPL workspace, is because it is difficult (or impossible!) to generate the quad+divide-symbol in Android. I will update the sAPL "continue" workspace, to have this example, with x, y and domino2, in next release of sAPL.
(Note, you can run sAPL in side a Windows CMD session, or in any DOSbox on Linux, MacOSx or Windows)

On sAPL, the program:

y domino2 x <jot>.* 0 1 2 (the <jot> is made by pressing <ALT>J on the Android device, using "Hackers Keyboard".)

sAPL program returns: -996.8729766 13.2153557 -0.01230306278

This is intial page, showing some APL-ASCII character translation information, the example of the cpmsim emulator starting, and a full APL/Z session running, with simple 4x4 matrix "mat2" being inverted, using the APL/Z "MATINV" function, which would correspond to the traditonal "Domino" character for matrix-inverse, in APL.