Index of folder retro-220/software/BALGOL/BALGOL-Examples:
Source, object, and compilation listings for example and test programs
used with the BAC-220 Burroughs Algebraic Compiler.

Each program consists of multiple files contained in a directory. The
following standard file name extensions and suffixes indicate the format
and purpose of each file:

    .card       80-column card image, usually for assembly language
                source code or data for the program. The retro-220
                emulator will internally truncate longer lines to 80
                characters and pad shorter lines out to a length of 80.

    .lst        printer output listing of assembly or program run.
                Lines may be preceded by a form-feed (ASCII hex 0C) to
                indicate a skip to top-of-page. Generally, files with a
                suffix of "-List.lst" are output from a compile and/or
                run of the program. "-Code-List.lst" is the same, but
                the compilation listing includes generated object code.

    .Load.card  80-column card image file containing loadable object
                code. Unless specified otherwise, these decks will be in
                self-loading 220 band-6 format for the Cardatron reader,
                and will require manual insertion of a card read
                instruction into the C register of the processor (e.g.,
                1000 60 0000 for input unit 1) to load the program.

    .tape       Magnetic tape image file in the format used by the
                retro-220 emulator

    .pt         paper-tape file in the format used by the retro-220
                emulator.

Unless otherwise specified, all files are in standard Windows text
format, with carriage-return/line-feed delimiters.


777-Cards.card
    A small deck with three Cardatron "777" (ignore) cards that can be
    used to pad the end of a card deck.

Library-Test-1/
    BALGOL program to compute values from various library routines as a
    test of the compiler and library. The listings include output from
    runs of the program.

    The "-ROUND.lst" file has output from the program run under an
    experimental version of the retro-220 that attempted to do rounding
    for floating-point add/subtract to see what kind of difference that
    made. The 220 did not round floating-point add/subtract results.

Reference-Manual/
    The example BALGOL programs from Section 11 of the BAC-220 Burroughs
    Algebraic Compiler manual, revised edition, March 1963, Burroughs
    document 220-21017, available at:
    http://bitsavers.org/pdf/burroughs/electrodata/220/
    220-21017_B220_BALGOL_Mar63.pdf.

    All examples include test data that was arbitrarily made up, along
    with the resulting output.

    Example-1/
        Program to approximate harmonic-boundary values using
        orthonormal functions; written by J. G. Herriot of Stanford
        University. The listing files include the results from running
        the program. The files below illustrate the various forms of
        object code the compiler can generate.

        The "-Object.tape" file is the tape image of the object code for
        the program written to tape unit 1 by the compiler. This can be
        used to execute the program without recompiling, or to punch a
        loadable object program onto cards or paper tape.

        The "-Object.card" file is the card deck of object code
        generated by running the "BAC-220-Object-Dump-Callout.card"
        program against "-Object.tape" with Program
        Control Switch 4 off.

        The "-Object-WITH-LOADER.card" file is a complete load-and-go
        card deck for the program. It consists of:

            1. The BAC-220-Object-Program-Loader-Bootstrap.card deck,
            followed by...
            2. The BAC-220-Object-Program-Loader.card deck, generated by
            running the "BAC-220-Object-Dump-Callout.card" program
            against "-Object.tape" with Program Control Switch 4 on,
            followed by...
            3. A blank card to allow the card reader format bands to be
            loaded, followed by...
            4. The card deck of object code in the "-Object.card" file
            above, followed by...
            5. The data for the object program.

        The "-Object.pt" file is the paper tape image of object code
        generated by running the "BAC-220-Object-Dump-Callout.card"
        program against "-Object.tape" with Program Control Switch 3 on
        and 4 off. This combination generates a tape with just the
        object program and no loader. To load and run the program:

            * Mount the compiler tape on magnetic tape unit 2.
            * Set Program Control Switch 3 on and 4 off.
            * Load the BAC-220-Object-Loader-Callout.card deck into card
            reader 1.
            * Enter 1000 60 0000 into the C register.
            * Set the Execute toggle.
            * Click START on the Control Console. Once the program
            loader is loaded, the system will halt with 0757 00 7250
            ("OK") in the C register.
            * Load the object program tape into paper-tape reader 1 and
            make it ready.
            * Enter 1000 04 0300 into the C register.
            * Set the Execute toggle.
            * Click START on the Control Console. The paper tape will
            load, and if successful, the object program will start to
            run.

        The "-Object-WITH-LOADER.pt" file is the paper tape image of
        object code generated by running the "BAC-220-Object-Dump-
        Callout.card" program against "-Object.tape" with Program
        Control Switches 3 and 4 on. This combination causes the Object
        Program Loader code to be included on the tape. To load and run
        the program:

            * Load the tape into paper-tape reader 1 and make it
            ready.
            * Set Program Control Switches 3 and 4.
            * Enter 1000 04 0300 into the C register.
            * Set the Execute toggle.
            * Click START on the Control Console. The loader will
            bootstrap from the paper tape, which will then load the
            object program from the tape. If the load is successful, the
            object program will start to run.

        The "-Typos.card" file represents the initial transcription of
        the source code. It contains several transcription errors, plus
        a few errors as published in the manual. This version was
        retained to test the compiler's ability to recover from such
        errors.

        The "-ROUND.lst" file has output from the program run under an
        experimental version of the retro-220 emulator that attempted to
        do rounding for floating-point add/subtract.

        B5500-EMODE/ contains source and listings of Algol programs as
        converted to run on the Burroughs B5500 (retro-b5500 emulator)
        and modern Unisys ClearPath MCP (E-mode) systems. These were
        used to compare the results generated from the BALGOL compiler.

    Example-2/
        Program for survey traverse calculations. The printed output
        shows an example of the data produced by the TRACE and DUMP
        diagnostic declarations. The first data set comes from the
        January 1961 edition of the BALGOL reference manual; the second
        data set was made up.

        The program does not compute area of the traverse properly, so a
        corrected version of the program is also included.

    Example-3/
        Program for reduction of a square matrix to tridiagonal form,
        using the method of Householder. A version of this program,
        written for modern Unisys MCP Algol ("Emode"), along with its
        results is also included as a check of the compiler.

    Example-4/
        Program to solve a set of linear equations of the form Ay = B
        using Crout's method with interchanges; written by G. Forsythe
        of Stanford University. Note that to compile and run this
        program, you will need to use a compiler and emulator configured
        for at least 8000 words of memory.

    Example-5/
        Program to do optical ray-tracing calculations. This program was
        included in the examples for the January 1961 edition of the
        BALGOL reference manual, but not in the March 1953 revised
        edition. It it self-contained and requires no input data.

DIRICHLET
    Program for computing the solution to a Dirichlet problem for a
    bean-shaped region. Reference to the article from which the program
    was developed is cited in the source file. I originally wrote this
    program in 1970 in Burroughs B5500 XALGOL as part of a senior thesis
    project. It was later translated to B6500 Algol and modern Unisys
    MCP ("E-mode") Algol. This is a modest number-cruncher, so it seemed
    like a good test for BALGOL.

    The BALGOL version was created from the B5500 version. Several
    changes had to be made, primarily in changing arrays from lower-
    bounds of zero to one, accommodating BALGOL's lack of support for
    dynamically-sized arrays, differences in IF-THEN-ELSE and SWITCH
    constructs, and the somewhat different syntax for formatted I/O.

    The program requires a 220 with at least 7000 words of memory and a
    BALGOL compiler configured for the system's memory size. It compiles
    on the retro-220 emulator in a little less than six minutes (when
    generating a program listing) and runs for 172 seconds before
    starting to output results. The B5500 (as the retro- b5500 emulator)
    generates results in about six seconds. Performance on the modern E-
    mode systems varies widely by model, but on the oldest, slowest
    system I have available (300 RPM, about 12 Gartner MIPS), the
    equivalent time is 0.25 second.

    DIRICHLET.card
        Source card deck for the 220 BALGOL version of the program,
        including data cards at the end.

    DIRICHLET-OUTPUT.lst
        Listing of compilation and results produced by the card deck
        above.

    DIRICHLET-OUTPUT.lst
        Another listing of compilation and results produced by the card
        deck above. This listing includes the code generated by the
        compiler.

    DIRICHLET-Object.tape
        Magnetic tape image of the code generated by the compiler.

    DIRICHLET-B5500-OUTPUT.lst
        Listing of the B5500 version of the program, including results.

    DIRICHLET-Emode-OUTPUT.lst
        Listing of the Unisys MCP version of the program, including
        results from a run on a 300 RPM LX100 VM system running MCP
        10.1.

Simpsons-Rule/
    BALGOL program to compute the integral of an arbitrary single-
    argument function between between two points using Simpson's Rule.
    This example is adapted to BALGOL from the one at the end of the
    Algol-58 "Preliminary Report--International Algorithmic Language",
    Communications of the ACM, Volume 1, Number 12 (December 1958),
    pages 8-22. It also illustrates the use of the MONITOR declaration
    to trace variable assignments.

U.Dayton-Program/
    Source for two short BALGOL programs submitted to Burroughs by the
    University of Dayton in 1963 to report a compiler issue. Includes a
    transcription of the letter describing the problem and transmitting
    the two programs.
    Found at CBI by Tom Sawyer and transcribed by Paul Kimpel.

    Note: the version of the compiler reconstructed by the retro-220
    project still exhibits this error.

WINTER-PI/
    BALGOL program to compute the first 800 digits of Pi. This was
    converted from a version for the Burroughs B5500, which in turn was
    adapted from a one-line C program by Dik T. Winter at CWI in
    Amsterdam:

    int a=10000,b,c=2800,d,e,f[2801],g;main(){for(;b-c;)f[b++]=a/5;
         for(;d=0,g=c*2;c-=14,printf("%.4d",e+d/a),e=d%a)
         for(b=c;d+=f[b]*a,f[b]=d%--g,d/=g--,--b;d*=b);}

    See https://cs.uwaterloo.ca/~alopez-o/math-faq/mathtext/node12.html
    and https://crypto.stanford.edu/pbc/notes/pi/code.html.

    This program takes about 73 minutes to run to completion. Compare
    this to the hand-coded assembler version in the software/examples/
    WINTER.PI/ directory of the repository, which takes about 40 minutes
    to complete.


Paul Kimpel
February 2018
    Original creation.
2018-06-10  Paul Kimpel
    Finalize DIRICHLET program and tests.
2018-07-07  Paul Kimpel
    Complete Reference-Manual example programs and update results.
2018-07-19  Paul Kimpel
    Add Simpsons-Rule example.
2018-08-10  Paul Kimpel
    Add WINTER-PI example.
