<para>Most of this document is a faithful transcription of the
reference manual for MAD (Michigan Algorithm Decoder), an early
academic computer language from 1962. The manual should be
-accompanied by an implementation; if not, it can be found at the <ulink
-url='&retromuseum;'>Retrocomputing Museum</ulink>. MAD has been revived
-as a work of reconstructive archeology, so that language connoisseurs
-of the present and future will be able to appreciate what computing
-life was like back in that day.</para>
+accompanied by an implementation; if not, it can be found at the
+<ulink url='&retromuseum;'>Retrocomputing Museum</ulink>. MAD has
+been revived as a work of reconstructive archeology, so that language
+connoisseurs of the present and future will be able to appreciate what
+computing life was like back in that day.</para>
<para>MAD was an extended dialect of ALGOL 58, first released in 1959
near the beginning of the great age of invention in compiled languages
pipelines!</para>
<para>Punched-card input also explains some syntactic features that
-will seem strange to modern eyes. MAD statement labels lack a
+will seem bizarre to modern eyes. MAD statement labels lack a
delimiter like C's trailing colon because they were distinguished by
position (columns 1 to 10) on the card. The line continuation syntax,
a digit in column 11, also relies on character position. In the late
(capitalized) and expressions like "sections 1.1.4 and 3.2" become
"Section 1.1.4 and Section 3.2".</para>
+<para>The reference structure of the index has been faithfully
+reproduced, but DocBook renders it differently. The original lacked
+the canned section headings, and references were by page number
+rather than section name.</para>
+
<para>EPSLON and COMPLX and the like are not typos. As pointed out
earlier, MAD variable names are limited to the 6 characters in a
six-bit character set that would fit in the IBM 704's 36-bit
round-off error, than arithmetic on non-integers. [Numbers which may
have fractional parts are usually written in the so-called "scientific
notation", such as 3.1 × 10<superscript>-6</superscript> are called
-floating point numbers.] Numbers are assumed to be in the
+floating point numbers.]
+<indexterm><primary>Constants, Floating Point</primary></indexterm>
+Numbers are assumed to be in the
floating-point mode unless otherwise declared, as in the INTEGER
statement in the example. The WHENEVER statement above is to be
interpreted in the sense: Whenever the following condition (in this
"True" or "False" is exactly what is needed here. Such expressions
are called <emphasis>Boolean</emphasis><footnote><para>After the
logician George Boole.</para></footnote>
-<emphasis>expressions</emphasis>, and usually involve "and", "or",
-"not", and possibly other such words connecting shorter expressions
-involving <, ≤, =, ≠, >, and ≥. For example, the
-following is a Boolean expression:</para>
+<emphasis>expressions</emphasis><indexterm><primary>Boolean</primary></indexterm>,
+and usually involve "and", "or", "not", and possibly other such words
+connecting shorter expressions involving <, ≤, =, ≠, >,
+and ≥. For example, the following is a Boolean expression:</para>
<programlisting>
((x - 3)<superscript>3</superscript> < y and i ≤ j) or x ≥ 3
<!-- beginpage I.13 -->
<!-- This listing in the original was defective,
-missing continuation punches everywhere but in INTERNAL FUNCTION
-F. -->
+missing continuation punches everywhere but in INTERNAL FUNCTION F. -->
<programlisting>
&newton2;
</programlisting>
<para>The first statement, labelled GAMMA, would cause the program to
-read from the data card the numbers a, b, c, x<subscript>0</subscript>,
-ε<subscript>1</subscript>, ε<subscript>2</subscript>, and
-n<subscript>0</subscript>. The format of the input information is to
-be found in a block of storage labelled "CARD" whose values are set
-later in the program by a VECTOR VALUES statement. The vector CARD
-actually has as values the format information in alphabetic form
-(sometimes called HOllerith, or binary-coded decimal (BCD) form). The
+read from the data card the numbers a, b, c,
+x<subscript>0</subscript>, ε<subscript>1</subscript>,
+ε<subscript>2</subscript>, and n<subscript>0</subscript>. The
+format of the input information is to be found in a block of storage
+labelled "CARD" whose values are set later in the program by a VECTOR
+VALUES statement. The vector CARD actually has as values the format
+information in alphabetic form (sometimes called HOllerith, or
+binary-coded decimal
+(BCD)<indexterm><primary>BCD</primary></indexterm> form). The
con­struction and analysis of format information is thoroughly
-discussed in Chapter II.</para>
+discussed in Chapter II.</para>
+
<!-- beginpage I.14 at the soft hyphen above -->
<para>The second statement in the program causes the inout information,
<sect2 id='constants'><title>Constants</title>
+<indexterm><primary>Constants</primary></indexterm>
+
<para>There are four classes of constants: Integer, floating point,
alphabetic, and Boolean.</para>
<sect3><title>Integer Constants</title>
+<indexterm><primary>Constants, Integer</primary></indexterm>
+
<para>Integer constants contain from 2 to 10 decimal digits. The
decimal point is assumed to be immediately to the right of the
rightmost digit, but is <emphasis>always</emphasis> omitted. Integers
<sect3><title>Floating Point Constants</title>
+<indexterm><primary>Constants, Floating Point</primary></indexterm>
+
<para>Floating point constants may be written with or without
exponents. If written without an exponent, the constant contains from
one to eight digits and a decimal point ".", which must be written,
"-" sign. Positive constants may be preceded by a "+" sign.</para>
</sect3>
-<sect3><title>Alphabetic Constants</title> <para>An alphabetic
-constant<indexterm><primary>Alphabetic Constants</primary></indexterm>
-consists of from one to six admissible
-characters<indexterm><primary>Admissible
+<sect3><title>Alphabetic Constants</title>
+
+<para>An alphabetic constant <indexterm><primary>Alphabetic
+Constants</primary></indexterm> <indexterm><primary>Constants,
+Alphabetic</primary></indexterm> consists of from one to six
+admissible characters<indexterm><primary>Admissible
Characters</primary></indexterm> preceded and followed by the
character "$". The admiss- ible characters include all letters of the
alphabet, the digits 0 through 9, the special characters +, -(minus
to be represented here occasionally (but not punched on input cards),
as the character "□". Thus the following are alphabetic
constants: $ABCD$, $TO BE$, $DEC. 4$, $5 +3=8$. Note that blank
-spaces, while ignored elsewhere in the language, count as characters
-in alphabetic constants. An alphabetic constant is stored internally
-as an integer, and any constant containing fewer than six characters
-will be extended to six characters by adding blanks on the right; thus
-$ABCD$ will appear internally as $ABCD□□$
+spaces<indexterm><primary>Blank Spaces</primary></indexterm>, while
+ignored elsewhere in the language, count as characters in alphabetic
+constants. An alphabetic constant is stored internally as an integer,
+and any constant containing fewer than six characters will be extended
+to six characters by adding blanks on the right; thus $ABCD$ will
+appear internally as $ABCD□□$
</para>
<note><para>The Retrocomputing Museum implementation neither enforces
</sect3>
<sect3><title>Boolean Constants</title>
+
+<!-- In the original, this was incorrectly referred to II.4 -->
+<indexterm><primary>Constants, Boolean</primary></indexterm>
+
<para>There are two Boolean constants – "true", which is written
-1B, and "false" which is written 0B.</para>
+1B, and "false" which is written 0B.
+<indexterm><primary>Boolean Constants</primary></indexterm></para>
</sect3>
</sect2>
<sect2><title>Variables</title>
<sect2><title>Arithmetic Operations</title>
<para>The following arithmetic
operations<indexterm><primary>Arithmetic
-Operattions</primary></indexterm> are available:</para>
+Operations</primary></indexterm> are available:</para>
<orderedlist numeration='loweralpha'>
<listitem><para>Addition, written as "+", e.g., Z5 + D.
</sect2>
<sect2><title>Boolean Operations</title>
-<para>The following Boolean, or logical, oeprations are available in the
-language (where M and P are boolean expressions):</para>
+<para>The following Boolean, or logical, operations
+<indexterm><primary>Boolean Operations</primary></indexterm>
+ are available in the language (where M and P are boolean expressions):</para>
<orderedlist numeration='loweralpha'>
<listitem><para>.NOT.M has the value 1B if and only if M has the value
<sect2 id='boolean_expressions'><title>Boolean Expressions</title>
-<para>Boolean expressions are defined inductively as follows:</para>
+<para>Boolean expressions are defined inductively as follows:
+<indexterm><primary>Boolean Expressions</primary></indexterm>
+</para>
<orderedlist numeration='loweralpha'>
<listitem><para>Boolean constants, Boolean individual variables,
the floating point mode. If all operands are integer (or alphabetic),
then the expression is conisdered to be in the integer mode. In this
determination arguments, though not values, of functions are
-ignored.</para>
+ignored.<indexterm><primary>Compound Expression</primary></indexterm></para>
<para>Thus, if Y, Z, and W are floating point variables, while the
function GCD. and the variables I and J are in the integer mode, then
<sect2><title>Conditional Statements</title>
+<indexterm><primary>Conditional Statement</primary></indexterm>
+
<para>There are two types of conditional statements.</para>
<para>(a) Simple Conditional</para>
+<indexterm><primary>Conditional, Simple</primary></indexterm>
+
<para role='centered'>
WHENEVER B,Q
</para>
<sect2><title>CONTINUE Statement</title>
+<indexterm><primary>CONTINUE Statement</primary></indexterm>
+
<para>This statement has the simple form:</para>
<programlisting>
be an integer variable name. &scriptN; is an expression whose value is
to be either a tape number or a drum number. &scriptL; is an
input-output list. Elements of &scriptL; may be: 1) single variable
-names or array names with subscripts;, 2) blocks of the form
-A(i<subscript>i</subscript>, ..., i<subscript>n</subscript>)
-... A(j<subscript>i</subscript>, ...j<subscript>n</subscript>) where
-the i's and j's may be any subscript expression and n ≥ 1. In
-addition, when &scriptL; designates an output list, the elements of
-&scriptL; may be: 3) constants or 4) expressions. Elements of a list
-are separated by commas. Example of an output list: AB, D, 2.5,
-MTX(1) ... MTX(N), P(14), J(I, K). Example of a list which may be
-ysed either for input or output: A, B, K(3), J(25*I - L),
-A(K+1)... A(L*2). To completely understand the operation of
-statements which make an explicit reference to "TAPE" or "DRUM" it is
-advisable to read the sections of the IBM 704 Reference Manual which
-describes the operation of these units (See
-<emphasis>Restrictions</emphasis> below).</para>
+names or array names with subscripts;, 2)
+blocks<indexterm><primary>blocks. Input-Output</primary></indexterm>
+of the form A(i<subscript>i</subscript>, ...,
+i<subscript>n</subscript>) ... A(j<subscript>i</subscript>,
+...j<subscript>n</subscript>) where the i's and j's may be any
+subscript expression and n ≥ 1. In addition, when &scriptL;
+designates an output list, the elements of &scriptL; may be: 3)
+constants or 4) expressions. Elements of a list are separated by
+commas. Example of an output list: AB, D, 2.5, MTX(1) ... MTX(N),
+P(14), J(I, K). Example of a list which may be ysed either for input
+or output: A, B, K(3), J(25*I - L), A(K+1)... A(L*2). To completely
+understand the operation of statements which make an explicit
+reference to "TAPE" or "DRUM" it is advisable to read the sections of
+the IBM 704 Reference Manual which describes the operation of these
+units (See <emphasis>Restrictions</emphasis> below).</para>
<variablelist>
<varlistentry>
</listitem>
</varlistentry>
<varlistentry>
-<term>(j) BACKSPACE RECORD OF TAPE &scriptN;</term>
+<term>(j) BACKSPACE RECORD OF TAPE &scriptN;
+<indexterm><primary>BACKSPACE RECORD statement</primary></indexterm>
+</term>
<listitem>
<para>Move tape &scriptN; back to beginning of last record.</para>
</listitem>
</varlistentry>
<varlistentry>
-<term>(k) BACKSPACE FILE OF TAPE &scriptN;, IF LOAD POINT TRANSFER TO &scriptS;</term>
+<term>(k) BACKSPACE FILE OF TAPE &scriptN;, IF LOAD POINT TRANSFER TO &scriptS;
+<indexterm><primary>BACKSPACE FILE statement</primary></indexterm>
+</term>
<listitem>
<para>Tape &scriptN; is moved backward until an en-of-file mark, the
load point gap, or the load point is encountered. If an end-of-file
<sect3 id='carriage_control'><title>Carriage Control</title>
+<indexterm><primary>Carriage Control</primary></indexterm>
+
<para>Every format specification consists of a description of the allocation
of available columns, and the form in which the particular information
is to appear. Specifications for reading or punching cards and
<row><entry>F</entry> <entry>Fixed point number (Internally floating point)</entry></row>
<row><entry>E</entry> <entry>Floating point number</entry></row>
<row><entry>K</entry> <entry>Octal number</entry></row>
-<row><entry>C</entry> <entry>Characters</entry></row>
+<row>
+ <entry>C
+ <indexterm><primary>C Field (Format)</primary></indexterm>
+ </entry>
+ <entry>Characters</entry>
+</row>
</tbody>
</tgroup>
</informaltable>
specification I2,K18,2C5, and the next by 7I3. It must be noted that
each line (if printing is being described) is described individually
here, and must <emphasis> include its own carriage control </emphasis>
-(see <xref linkend='carriage_control'/>).</para>
+(see <xref linkend='carriage_control'/>).
+<indexterm><primary>Carriage Control</primary></indexterm>
+</para>
</sect3>
<sect3 id='hollerith_fields'><title>Hollerith fields</title>
1H1 F10.3, 6HBETA = E10.2
</para>
-<para>were used in printing one would obtain a new page skip, because of the
-one column Hollerith field containing the character "1". Then a ten
-column F number would print, followed by the characters "BETA =" and a
-floating point ten column field. Note that blanks are completely
-ignored throughout all format specifications except when they occur as
-characters in a Hollerith string. Note also, that while every field
-specification of types S, I, E, F, K, and C must be followed by
-commas, the comma may be omitted after a
+<para>were used in printing one would obtain a new page skip, because
+of the one column Hollerith field containing the character "1". Then
+a ten column F number would print, followed by the characters "BETA ="
+and a floating point ten column field. Note that blanks are
+completely ignored throughout all format specifications except when
+they occur as characters in a Hollerith string. Note also, that while
+every field specification of types S, I, E, F, K, and C must be
+followed by commas<indexterm><primary>Comma (in
+Format)</primary></indexterm>, the comma may be omitted after a
<!-- beginpage II.32 -->
Hollerith string of the type
described here. The comma may be used, however, if desired.</para>
<para>It has been stated above that a <emphasis> number </emphasis>
appearing in an oversize field is pushed as far as possible to the
<emphasis> right</emphasis>. In the case of C information
-(characters), any information occurring in an oversize field is pushed
-to the <emphasis> left </emphasis>, while in either case, unused
-columns of the field are filled with blanks. Similarly, in the case
-the specification describes too small a field, characters are taken
-from the <emphasis> left end </emphasis> of the field until the field
-is exhausted.</para>
+(characters)
+<indexterm><primary>C Field (Format)</primary></indexterm>
+<indexterm><primary>Character Field (Format)</primary></indexterm>,
+any information occurring in an
+oversize field is pushed to the <emphasis> left </emphasis>, while in
+either case, unused columns of the field are filled with blanks.
+Similarly, in the case the specification describes too small a field,
+characters are taken from the <emphasis> left end </emphasis> of the
+field until the field is exhausted.</para>
<para>Thus, if a card contins the characters: ABCDEFGHIJK in column 1
through 11, and it is read according to the specification 2C3*, the
</para>
<para>to be read (since at most six characters can go into one word of
-storage).</para>
+storage).<indexterm><primary>Bocks, Input-Output</primary></indexterm></para>
</sect3>
<sect3><title>Relationship between the List and the Specification</title>
different modes.</para>
<para>All constants are automatically assigned modes by the translator
-(see <xref linkend='constants'/>). Other automatic assignments of
-modes are:</para>
+(see <xref
+linkend='constants'/><indexterm><primary>Constants</primary></indexterm>
+). Other automatic assignments of modes are:</para>
<!-- beginpage II.36 -->
<orderedlist numeration='loweralpha'>
as elsewhere in the main program, and the current values of these
variables and functions will be used. Names of variables and
functions which occur as arguments of the function being defined are
-designated "dummy arguments" (or "bound variables"). They must be
-distinct from those appearing elsewhere in the program. The modes of
-dummy arguments (if other than normal mode) must be declared in the
-usual way, but arrays<indexterm><primary>Array
+designated "dummy arguments" (or "bound
+variables")<indexterm><primary>Bound Variables</primary></indexterm>.
+They must be distinct from those appearing elsewhere in the program.
+The modes of dummy arguments (if other than normal mode) must be
+declared in the usual way, but arrays<indexterm><primary>Array
Variables</primary></indexterm> which are arguments need not be
dimensioned.</para>
ERROR. SETETT. COMMNT. TAPERD.
TAPEWR. PUNCH. SETERR.
</programlisting>
+<indexterm><primary>COMMNT Subroutine</primary></indexterm>
<!-- beginpage II.49 -->
<para>If a block designation
</para>
<para>could have been used as tthe second statement of this program
-instead of the BOOLEAN declaration.</para>
+instead of the BOOLEAN declaration.<indexterm><primary>Boolean</primary></indexterm></para>
</sect2>
<!-- beginpage III.7 -->
</sect1>
<!-- beginpage III.24 -->
<sect1><title>Business Data Processing Examples</title>
+
+<indexterm><primary>Business Data Processing Examples</primary></indexterm>
+
<sect2><title>Example 1<emphasis role='note'>: Payroll Processing</emphasis></title>
<para><emphasis>Problem:</emphasis> Compute the social security deduction
<sect1><title>Card Format</title>
+<indexterm><primary>Card Format</primary></indexterm>
+
<para>MAD Statements are punched according to the following card format:</para>
<mediaobject>
<para>1.1 Statement labels may be punched anywhere in cols. 1-10.
Spaces are not relevant.</para>
-<para>1.2 Column 11 is used to designate a remark (R) or, alternatively, a
-continuation of a statement (0, 1, 2, ..., 9). The digits used to
-indicate continuation cards need not be in any particular order but
-there may be at most 10 cards in a statement.</para>
+<para>1.2 Column 11<indexterm><primary>Column 11 (Card
+ Format)</primary></indexterm> is used to designate a remark (R) or,
+ alternatively, a continuation of a statement (0, 1, 2, ..., 9). The
+ digits used to indicate continuation cards need not be in any
+ particular order but there may be at most 10 cards in a
+ statement.</para>
<para>1.3 The statement may start anywhere in cols. 12-72. With the
exception of characters enclosed between "$" spaces are not relevant.
symbolic names of the subroutines called on must appear as the first
words after this information.</para>
-<para>The execution of MAD programs requires the use of a loading routine to
-relocate and store the program and subroutines. A slightly modified
-BSS FORTRAN loader is automatically produced by the University of
-Michigan executive routine. Also there are certain subroutines which
-may be automatically called for by a MAD program without an explicit
-reference to them in the source program.</para>
+<para>The execution of MAD programs requires the use of a loading
+routine to relocate and store the program and subroutines. A slightly
+modified BSS FORTRAN loader<indexterm><primary>BSS Fortran
+Loader</primary></indexterm> is automatically produced by the
+University of Michigan executive routine. Also there are certain
+subroutines which may be automatically called for by a MAD program
+without an explicit reference to them in the source program.</para>
</sect1>
<sect1><title>Systems Subroutines</title>
</varlistentry>
<varlistentry>
-<term>COMMNT</term>
+<term>COMMNT
+<indexterm><primary>COMMNT Subroutine</primary></indexterm>
+</term>
<listitem><para>Entry to this subroutine causes
BCD informtion to be printed on the attached (on-line) printer. The
arguments are the same as PRINT except that the line spacing is not
designating a point of return after an illegal data
<!-- beginpage IV.6 -->
character or illegal format specification has been encounterered by an
-input-output subroutine.</para></listitem>
+input-output subroutine.<indexterm><primary>Bocks,
+Input-Output</primary></indexterm></para></listitem>
</varlistentry>
</variablelist>
-<para>It should be understood thatthe subroutines described above may be called by other subroutines as well as statements. Thus, for example,
-SETEOF is called by TAPERD, TAPEWR calls PRINT, and all of the
-input-output routines call ERROR.</para>
+<para>It should be understood thatthe subroutines described above may
+be called by other subroutines as well as statements. Thus, for
+example, SETEOF is called by TAPERD, TAPEWR calls PRINT, and all of
+the input-output routines call ERROR.</para>
</sect1>
</chapter>
subscript restrictions still hold, i.e. i ≤ 0, (V(i)+j) ≤ 0. For
example, if A is a 4 x 3 matrix (m = 4, n = 3) and b = 1, then V(1) =
0, V(2) = 3, V(3) 6, and V(4) = 9.</para>
+</appendix>
+<appendix><title>Index</title>
<!-- stray index entries go here -->
<indexterm><primary>Array</primary><see>Vector</see></indexterm>
-</appendix>
+<indexterm><primary>BCD (Hollerith)</primary><see>Hollerith (BCD)</see></indexterm>
+<indexterm><primary>Call For Function</primary><see>Function Call</see></indexterm>
+<indexterm><primary>Calling Sequence</primary><see>Function Call</see></indexterm>
+<indexterm><primary>Characters, Admissible</primary><see>Admissible Characters</see></indexterm>
+<indexterm><primary>Conditional, Compound</primary><see>Compoound Conditional</see></indexterm>
+<indexterm><primary>Conditional, Simple</primary><see>Simple Conditional</see></indexterm>
+
+<index/>
+</appendix>
</book>
<!--
Local Variables: