KAL4

Under construction

Kal4 and Eldon2

KAL4 became the dominant assembly language for new Eldon2 software. The assembler reads the source file from the Eldon2 filestore, which is basically the English Electric PROMPT filestore.

The Eldon2/PROMPT filestore area of the disc is read using OUT 32. The kdf9 emulator has a particularly crude implementation of OUT 32 which emulates a PROMPT/Eldon2 filestore with only one file in it, viz the requested source text.

For the purposes of development, the assembler has been modified replacing calls of OUT 32 by a subroutine which reads the equivalent data from paper tape. This modified version is in the file kal4wf.k4.

Current state December 2011

The program successfully assembles itself. This works under either emulator, when using the kal4wf.k4 source file. Using the kdf9 emulator the unmodified version will also assemble itself (or the modified version).

The language accepted by my new assembler turns out to be slightly incompatible with the original assembler. So there are two source files, the version for input to my new assembler (EDNKAL4o.k4), and the true version (EDNKAL4.k4) —give or take undetected typos. The file kal4lp.txt is the lineprinter output, The file kal4.bin is the bootstrapped binary program. The paper tape data file, specifies two load-and-go runs, followed by a run to save the binary to disc. The lineprinter output shows reference tables from the assembler.

You can run the bootstrap for yourself using kdf9.c:
              kdf9 kal4.bin
The Eldon2 filestore is emulated by reading disc.txt so you need this to be a copy of EDNKAL4.k4. The paper tape reader is emulated by ptr.txt. The file punch.txt is generated containing all the printer and/or punch output.

You can run the bootstrap for yourself using the Findlay emulator ee9:
              ee9 < kal4wf.bin > TP0
The Eldon2 filestore is emulated by reading a sort of base64 encoded binary paper tape. The program ednfile.c reads a KAL4 source file, and converts it into a TR1 for use with ee9. The file LP0 is generated containing all the printer output.

After the bootstrap

The source code of the assembler does not contain any floating point constants, nor any decimal points. The KAL4 language is defined as accepting Algol numbers as constants, i.e.
        <digits> | <digits> . <digits> | <digits> 10 <digits> | <digits> . <digits> 10 <digits> | . <digits> | 10 <digits> | . <digits> 10 <digits>

The assembler's code in the area is particularly complex with frequent use of instructions like CAB, PERM and REVD., very slick but hard to understand. More challenging was the use of ÷R. This gem of an instruction for doing multiple length division hides in a section of the manual headed “Lesser used arithmetic instructions”, where it is the last entry. Both emulators needed careful work before we were confident that this arcane instruction was emulated correctly, but the constants with decimal points now come out correctly.

I plan to continue cleaning up rough edges such as this, but it looks substantially correct.

Some relevant files

You are welcome to browse:
        The KAL4 manual, a scan of the user manual.
        EDNKAL4.k4 The copy-typed source — you can download by use of the right mouse button.
        kal4.txt The assembler listing from my new assembler
        ptr.txt Paper tape input inviting the assembler to assemble itself
        kal4log.txt Log showing the result of running the assembler with my rough-and-ready emulator.
        kal4lp.txt The lineprinter output

There is a zip file containg the source text of the new assembler. It has:
        kal4.y yacc source for the new KAL4 assembler
        kal4.c C source for the new KAL4 assembler, plus
        kal4tab.c more C source for the new KAL4 assembler
        y.tab.c yacc-generated output for the new KAL4 assembler
        y.tab.h header file from yacc
The command to compile this is: gcc -o kal4 kal4.c kal4tab.c y.tab.c