APL 68000

Version Franšaise



I got permission to distribute this old APL 68000 6.05c for Atari ST version with my PATCH from the editor: MicroAPL.
(See at the bottom of the page for download).

The director, Richard Nabavi, specifies that: This society goes on developing interesting tools that you can find on their web page at MicroAPL. Especially if you are interested in this language, have a look at their new APLX that runs under Windows, MacOSX and Linux.
Many thanks to them!



A concise and powerful programming language!


I own version 6.05c of the interpretor that runs on an Atari ST(e). Being a GEM program, I thought that it could be run easely on a newer and powerful machine.
  • Can it be run on an Atari TT?
  • Can it be run on a Falcon/CT060 ?

After some testing, the answer is NO...

I tried to see what's happening and found some problems liked to:
  • the use of the TT Ram
  • the use of newer CPUs 030/060
  • the use of newer TOS (mostly 4.xx)
  • the use of an AZERTY keyboard instead of a QWERTY one

I wrote a program, APLPATCH.PRG, (in Forth) that allows you to set those options to match your requirements according to your machine.

Calculation time of PI in 32 and in 48MHz
on a TT with a CaTTamaran.


Langage (short) overview


PI approximation with a sum


Here is a very short program to compute PI. The two lines surrounding the formula are there to compute the calculation time.
I use the sum of the reciprocals of the squares of integers from 1 to n whose limit is square(PI)/6.
"N" is the number of integers to be used.
  • the part iotaN creates a table from 1 to N.
  • *2 computes all the squares
  • the division sign computes the inverses of every element in the table
  • the group +/ computes the sum of all the table elements
  • the sum is multiplied by 6
  • finally the program takes the square root of the result with power 0.5
  • this result, close to PI, is displayed


Execution time


Here is the concise program to compute the duration.
The variable quadTS returns the current time in a table defined as (YEAR MONTH DAY HOUR MIN SEC 1/1000).
"T" is the variable containing the start time of execution. So you must call DUREE at the end of the execution.
Let's say that the program started at 10h 59mn 45,240s and ended at 11h 01mn 50,000s the same day:
  • the part -4 arrowT returns the 4 last elements of T, so (10 59 45 240).
  • the same for -4arrow quadTS that returns the 4 last elements of the end time, so (11 01 50 0).
  • the two tables are substacted (1 -58 5 -760)
  • then multiplied by their value in seconds (3600 60 1 0.001), so we get (3600 -3480 5 -0.760)
  • last, +/ computes the sum of the table elements 3600-3480+5-0.760 = 124.24 sec
  • this result is displayed


A bit of statistics, the specifications of the STAT function


Here is the result of the execution.
STAT is called with a parameter that is a vector of effectives you want to work with. Upon return, this display is expected:
  • the effectives
  • the growing cumulative effectives
  • the descending cumulative effectives
  • the frequencies (values into [0;1])
  • the percentages
  • the angles for a pie (360░)


Let's examine the details of the STAT function


Source code that you can get with "Open Fn" from the menu.
In STAT V, the local variable V represents the vector of effectives.
  • N gets the value ρV, this is the dimension of V (N=4 in my example).
  • FREQ gets the value of V divided by the sum of its elements, this is the definition of the frequency.
  • Then a large vector is created concatenating various elements (with the comma)
    • 1st element V: the effectives
    • 2nd element +\V that performs successive additions, these are the cumulative effectives.
    • 3rd element, the same but with the symbol circlestile to reverse the vector for descending
    • 4th element: the vector of frequencies.
    • 5th element: freq times 100 for percentages
    • 6th element: freq times 360 for angles in degrees
  • this vector, with (6,N) ρ is reorganized in a 6 lines by N columns matrix and stored in TAB.
  • Finally, titles are displayed with this long string reorganized as 6 lines of 6 chars.
  • And TAB is also displayed with symbol α for formatting (8 chars per number and 2 decimals)


The specifications of the GRAPH function


Here is the expected graphic.
The GRAPH function must be called after the STAT function because it needs the value of N and the FREQ vector.
  • Vertical scales for 0%, 25%, 50%, 75% and 100%.
  • Horizontal scales for each element of the vector..
  • In addition to the broken line, each point will have a mark.
  • The graphic size will be 300×200 with 10 pixels for the margins.


Let's examine the details fo the GRAPH function


You can get the source code with the menu "Open Fn".
In the GRAPH function, there are two implicit parameters: FREQ vector and value N returned by the STAT function.
  • The three first lines set the output to the APL window, clear the display and set the + sign as a point marker for scale on the axis.
  • XTAB is a vector that will contain the N abscissa of the different points. In detail:
    • ιN creates a table from 1 to N, so (1 2 3 4) in my example.
    • this table is divided by N, in my example, N=4, so (0.25 0.5 0.75 1).
    • then multiplied by 300: (75 150 225 300)
    • 10 is added for the left margin XTAB = (85 160 235 310), abscissa of the 4 points!
  • Then a large vector with all abscissa and ordinate of the points corresponding to the scale on both axis is generated.
    • first (5ρ10),XTAB will be (10 10 10 10 10 85 160 235 310), abscissa of the five vertical marks and 4 horizontal ones.
    • then 10 60 110 160 210,(Nρ210) will be (10 60 110 160 210 210 210 210 210), ordinate of the five vertical marks and 4 horizontal ones.
    • finally, (2,(N+5))ρ turns this vector in a 2 lines by N+5 colums matrix, each column being a pair of coordinates of a scale mark, this matrix is stored in PIXEL.
  • This matrix is sent to POLYLINE to draw the axis and to POLYMARKER to mark the scale with the + sign.
  • Then the new mak is set to ◊
  • a new PIXEL matrix is cretaed with XTAB for abscissa and the frequencies FREQ for ordinate converted into [210;10]
  • again, POLYLINE and POLYMARKER allow to draw the broken line and mark the points.
Note: instead of representing the frequencies with 100% as a maximal value in the graph, you can have the higher frequency as maximum. To do this, you have to change the line
(210-FREQ×200)
with
(210-(FREQ÷Γ/FREQ)×200)


APLPATCH for TT/Falcon


Here is the program to modify the APL68000 to fit your hardware configuration. Below are the details of each option:
Use alternate Fast RAM
If your machine has Fast RAM (or TT RAM), you can execute the program with a better speed with this option.
On the STE or Mega STE this only allows the fast loading.


French AZERTY keyboard
To adapt the program to the french keyboard layout.


MC68030/68060 stack format
If your computer has a CPU 68030 or better, this option is essential as the stack usage has changed compared to the 68000 and the program hangs...


16MB ram limit if more present
The APL68000 can only manage 16MB ram. If you have more free memory than 16MB, the program will hang, so this option makes the APL think that the memory is limited to 16MB.


APL font patch (for TOS 4)
An undocumented VDI function is called to set the APL Font, unfortunately, this doesn't work anymore with the TOS 4.xx. Unfortunately again, I couldn't get my patch to work on the Falcon... See below "APLFONT.PRG" as a temporary solution.


Missing \ in FileSelector
If you run the APL from a folder, a "slash" is missing in the default path in the fileselector, you have to correct the line at each file operation. If you run APL from the root of a drive (a floppy disk for example), you don't have to use this patch.


Here are my settings on the TT with 64MB TT Ram.
Tipical settings

A ST(E) or Mega ST(e)
The FAST RAM allows the fast load feature, eventually the AZERTY layout.


A TT030
  • FAST RAM option if you have some.
  • MC68030 option required!
  • 16MB Limit if you have more than 16MB of free TT RAM (with a 32MB expansion board or more)


A Falcon CT060
everything !!


APLFONT program for Falcon


As long as my patch doesn't allow the APL68000 to install the APL font by itself, you'll have to use APLFONT.PRG on the TOS 4.xx.



The workspace MESTESTS.AWS


After running APL, you can load, via the menu, my workspace MESTESTS.AWS. It contains the three little programs that are presented above DUREE, PI and the group STAT/GRAPH.

To test it, just run PI 100 and you should get an approximation of PI with the duration in seconds. Here are some results:

machine Atari ST(e) 4MB TT 64MB/48mhz Falcon CT060/95mhz
result of PI 100000 3.141583104
280.56 sec
3.141583104
47.32 sec
3.141583104
3.5 sec


You can easely understand the advantage of the patch to use a newer machine!
The TT is 6 times faster than the STE
The Falcon is 80 times faster than the STE


Download Content


Content:
  • APL.PRG et APL.RSC
    • the original program for the ST(e) or Mega ST(e)
  • APLWORK.PRG
    • a copy to work on with the patch program
  • *.AWS
    • several workspaces with facilities to access files, GEM, etc...
  • Folder RUNTIME
    • everything to diffuse your programs without the need of the complete interpreter.
  • APLPATCH.PRG and APLPATCH.RSC
    • my patch program to modify the APL for newer machines.
  • APLFONT.PRG
    • installs the APL font on TOS 4.xx for Falcon
Download
APL.ZIP.


15 dÚcembre 2007