From cbab8e13f28326879b0ed24b8c1d1ede5e614589 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Sun, 20 Jun 2004 04:22:00 +0000 Subject: [PATCH] All text entered. --- doc/mad-manual.xml | 400 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 400 insertions(+) diff --git a/doc/mad-manual.xml b/doc/mad-manual.xml index 4572379..7a7c2ef 100644 --- a/doc/mad-manual.xml +++ b/doc/mad-manual.xml @@ -5441,10 +5441,410 @@ in the sequence must have the "operation code" in columns 8-10, and the rest of the instruction in (or after) column 12. Blanks are ignored throughout, except in operating codes. + +Operation Codes + + +ACL LDA STA +ADD LDQ STD +ADM LFM STO +ALS LGL STP +ANA LLS STQ + + +ANS LRS STZ +ARS LTM SUB +BSF LXA SXD +BST LXD TIX +CAD MPR TLQ + +CAS MPY TMI +CHS MSE TNO +CLA NOP TNX +CLM ORA TNZ +CLS ORS TOV + +COM PAX TPL +CPY PBT TOC +DCT PDX TQP +DVH PSE TRA +DVP PXD TSX + +EFM RDS TTR +ETM REW TXH +ETT RND TXI +FAD RQL TXL +FDH RTT TZE + +FDP SBM UFA +FMP SLQ UFM +FSB SLW UFS +HPR SSM WEF +HTR SSP WRS +LBT + + +Simplified Input-Output Statements + +(a) READ DATA + +This statement causes information to be read from cards; no list of +variable names or format specification is necessary. The values to be +read and the variable names are punched in the data cards in a +sequence of fields of the form: + +v1 = n1, v2 = n2 , v3 = n3, ...., vk = nk * + +The v1, ..., vk are the +variable names and n1, ... , +nk are the corresponding values. Reading is +continued from card to card until the terminating mark * is +encountered. Fields cannot be divided between cards, so the last +character in a card not terminated by an asterisk would normally be a +comma. However, as a convenience, the end of the card is treated as +an implied comma and hence this final comma may be omitted. The +variable names may designate single variables or elements of linear +and two-dimensional arrays. The subscripts on the array vaiables must +be integer constants. The values may be floating point, integer, +octal, Boolean, or alphabetic with the forms descibed in the section +on constants in the MAD manual (See section +). + +For convenience in entering values of array elements it is +possible to designate only one variable name and have successive +numbers, written without names, interpreted as the consecutive values +of the array, i.e., + +V(j) = n1, n2, n3 . . . , nk + +would be the same as + +V(j) = n1. V(j + 1) + n2, ..., V(j + k - 1_ = nk + +For 2-dimensional arrays successive numbers will be entered in +succeeding columns of the designated row until the row - as determined +from the current value of the dimension vector - is filled, and then +the next row will be started. + +Zeros must be punched; adjacent commas (,,) are simply skipped. +Blanks are ignored throughout except between dollar signs (which are +used only to delimit a string of Hollerith characters). + +Six or less Hollerith characters - delimited by dollar signs - +may be values of single integer variables. Longer strings of +Hollerith characters may be entered as elements of arrays. Such +strings are divided into six character groups for storage. + +As an example illustrating many of the features described herein +consider the data card set: + + + X1 = 1.2, Y1 = -6.8, INDEX = 4, A(4) = 3.1, -10.93, + 12.6, MATRIX (2,1) = 25 E-2, 1.8 E-10, 3.14 E-8, + STRING (1) = $ END OF PROBLEM $ * + + +It is important to remember that, since such cards are data +cards, they should not be included as an integral part of the MAD +statements but handled as ordinary data. + + +(b) PRINT COMMENT &scriptS; + +Here &scriptS; designates a string of no more than 120 Hollerith +characters. These characters may not include dollar signs and here +blanks are valid characters. The string, delimited by dollar signs as +indicated, will be printed. The first character will be interpreted +as a carriage control code and will not be printed. For convenience +the carriage control code is reproduced here: + + + + +CharacterResult + + +blank single space ++ no space +- triple space +0 double space +1 space to top of next page +2 space to next half-page +4 space to next quarter page +8 space to next one sixth page + + + + +An example statement is: + +PRINT COMMENT $1 JOHN PUBLIC, MATH 373 PROBLEM 1$ + + +(c) PRINT RESULTS &scriptL; + +Here &scriptL; designates a list of variable names or block +designations. Expressions may not appear in the list although +subscripts of variables in the list may be expressions. The printed +output is analogous to the input in that the numbers printed are +preceded by the appropriate variable name and an equal sign - e.g., X += -12.4 - and only the initial elements of arrays are so labelled. +Elements of three and higher demensional [typo?] arrays will be +labelled with the equivalent linear subscript. If dummy variables (in +a function definition) are included in the list the specific values +assigned to such variables during execution will not be labelled but +simply preceded by ... . + +An example statement is: + +PRINT RESULTS X1, Y1, Z(1) . . . Z(N + 1), MTX (1,1) ...MTX(M,N) + + + +Supplement to the MAD Manual + +November 15, 1960 + +The notes which appear below describe several new features which have +been added to MAD. Existing programs need not be changed in any way. +Most programs will be reduced in size and execution time, however, if +they are recomplied to take advantage of the internal improvements +that have been made with regard to the translation of Boolean +expressions and which are described below (see (8)). Included here, +also, are some comments on reducing the size of some subroutines. + +(1) The Appendix to this supplement describes the new DEFINE facility. +By means of this facility, new operators can be added temporarily to +MAD, as well as new modes of arithmetic. + +(2) Along with integer, floating point, Boolean, and alphabetic +constants, one may now write octal constants. +These constants are written as twelve digit octal integers followed by +the letter K, except that leading zeros may be omitted. If one or +more decimal digits follow the letter K, this is +interpreted as an octal scale factor. This 127K2 would be the octal +integer 000000012700, and 1K10 would produce the octal number +010000000000. + +(3) Any constant (integer, floating point, Boolean, alphabetic, +or octal) may be declared to be of a mode other than its normally +assigned mode by following the constant by the letter M and the digit +code for that mode. The digit codes are: + + + 0 Floating point + 1 Integer + 2 Boolean + 3 Function Name + 4 Statement Label + + +The new modes 5, 6, and 7, which may be defined as described in +the Appendix, may also be used. The constant is converted +as usual, but then is assigned the indicated +mode, if the letter M is used. Thus, if some new mode numbered 6 were +defined for certain integers, then the appearance of the constant 32M6 +would assign mode 6 to the decimal integer 32. The appearance of +32KM6 would assign mode 6 to the octal constant 32, and the appearance +of $AB$M6 would assign the mode 6 to the constant $AB$. Similarly, +the appearance of 32.1E-1M6 would assign mode 6 to the number 3.21 +which appears in storage in the usual floating point form. + +(4) A subroutine is not available, called ZERO., which will +accept as arguments single variables or blocks (i.e., an "input list") +and very efficiently (i.e., using STZ and TIX operations) store +0 in +these locations. This saves writing an iteration loop. + +(5) In addition to the usual notation for a block: e.g., A(6) ...A(N), MAD will now accept the traditional use of commas as well: + +A(6), ... , A(N) + + +(6) A list of variables used in the program, but to which only one +reference is made, is printed out for each MAD program. This list +does not include any variables appearing in PROGRAM COMMON, ERASABLE, +DIMENSION, VECTOR VALUES, or EQUIVALENCE statements. Variables +appearing in this list are all assigned to the same location, under +the assumption that they are not purposely used for anything except +perhaps redundant labelling of statements. This list has proven to be +a valuable debugging aid, since misspelled names almost +invariably show up on this list. It should therefore be checked +carefully whenever it appears. + +(7) In order to conserve storage, it may be desirable to store, for +example, only one half of symmetric matrix or an upper (or lower) +triangular matrix, etc. Perhaps only the non-zero elements of a +sparse matrix might be stored, also. For such arrays, it is necessary +to use a subscription subroutine other than the standard one supplied +by MAD which expects to find the entire matrix stored by rows (in the +two-dimensional case). Such special subscription subroutines may now +be written as any other internal or external functions in MAD or in +SAP, as usual. The arguments must be the array name, followed by the +n subscripts (integer expressions) in the usual order. The value of +the function which is to be computed is the linear +subscript to be used to obtain the value desired. For +example, if one wished to store only the upper triangle (plus +diagonal) of an upper triangular two-dimensional array (by rows, +starting as A(2)), the subscription function F, could be defined as +follows: (We shall assume a constant zero stored at A(1)) + + + + + + + +where n is the nubmer of columns in the matrix A, and b is the +base point. Of course, if n (and/or b) is not a constant, it will +have to be made available to the subscription subroutine, probably via +PROGRAM COMMON, as will the base point, if used. It will +automatically be available, of course, if the subroutine is written as +an internal function. Note that in the case i > +j, we give as the value of F.(A,i,j) the linear +subscript 1 of the value 0, rather than the value +itself. + +In order to notify MAD that such a subscription function is to be +used, one merely inserts the name of the function as the first entry +of the dimension vector of the appropriate array, moving the number of +dimensions, etc., down by one in the dimension vector. Thus, the +above example might be indicated as follows: + + + DIMENSION A(100, ADIM) + VECTOR VALUES ADIM = F.,2,2,10 + + +if there were ten columns. Although dimension information could +always be computed or brought in as data instead of via a VECTOR +VALUES declaration, the one exception to this is now the name of the +subscription function. If used, it must occur as +the first entry in a VECTOR VALUES declaration, and it must be +followed immediately by at least one integer in the same declaration. +It should be understood that if this feature is used, references to +matrix elements by means of subscripts are made as if the matrix were +stored as originally described in the MAD manual. Thus, subroutines +do not need to know whether a calling program is or is not using such +storage conservation functions. + +Two special subscription functions are available from the subroutine +library: (a) SYMM. will handle two-dimensional symmetric arrays for +which only the upper half (plus diagonal) is stored by rows. (b) +TRANSP. will handle a two dimensional array stored by rows (in full) +but considered to be in transposed form. In other words, if a matrix +B is designated as having subscription function TRANSP., then a call +of B(6,2) will, in fact, produce the linear subscript of B(2,6). + +Both SYMM. and TRANSP. automatically have access to the dimension +vector (including the base point), so no provision need to be made for +putting any information in PROGRAM COMMON, for example. In fact, if +the subscription function is written in SAP, it may be able to use the +fact that MAD provides the address of the dimension vector in the +decrement part of the parameter which contains the address of the +array, in this case the first parameter. Note, however, that the +dimension information has been moved down by one because of the +presence of the name of the subscription function; and this must be +accounted for in any references to the dimension vector. + +In order to accommodate this new feature, the MAD library +subroutines (03310, (03311, and (MTX have been modified. Anyone using +special subscription subroutines should discard any previously punched +versions of these library subroutines. Note, also, that TRANS and +TRANS1 may not be used for transposing matrices stored in short form, +since they were not written to recognize special subscription +fuctions. + +(8) A Boolean expression usually contins one or more atomic Boolean +expressions consisteing of two arithmetic expressions on either side +of a relation. Exampls of atomic Boolean expressions are X + 3 +.LE. Y, I, .E. 1, and so on. It has been found possible to save as +many as 60% of the object program instructions formerly generated for +atomic Boolean expressions. Moreover, the object programs now +produced will skip the evaluation of the remaining terms of a +disjunction (an "or" expression) as soon as one terms has the value +1B, and a similar statement holds for conjunctions ("and" +expressions). These changes are entirely internal to MAD, and require +no change in MAD source programs. A recompilation will be necessary, +however, to obtain the shorter, faster object program which results. +In order to obtain the maximum benefit from the skipping behavior +indicated above, it is necessary to understand that the atomic Boolean +epxressions in a complex Boolean expression are evaluated from right +to left, and the one most likely to be "true" in a conjunction, and +the one most likely to be "false" in a conjunction, should be placed +as far toward the right end of the expression as possible. + +Thus, if one were testing for values of X between 0 and 2 and +between 5 and 6, one might write + +WHENEVER 0 .L. X .AND X .L. .OR. 5 .L. X .AND X .L. 6 + +If one knew that for the data expected, the values of X would +occur most often between -1 and 2, one would do better to write the +above as follows: + +WHENEVER X .L. 6 .AND. 5 .L. X .OR. X .L. 2 .AND. 0 .L. X + +(9) There is a table within MAD in which are recorded all +occurrences of parameters within an external or internal +function definition. Since all such occurrences +must be initialized on each entry to the subroutine, it is very +desirable that the number of entries in this table be kept as small as +possible. This is especially important when a diagnostic comment is +generated saying that this table has in fact overflowed! (The +diagnostic comment produced in this case is PARAMETER USE TABLE +EXCEEDED.) + +There are several ways to cut down the entries in this table and +thus speed up the execution of the subroutine and shorten its length +as well. (1) If X is an input to the subroutine +and its value is used several times, start off the subroutine's +computation with the substitution statement Y = X and use Y instead of +X everywhere. Only this substitution statement will then need to be +initialized with the address of X. (2) If the +address of a variable is needed, as in the case +of an output argument, or an argument which is an +array name, one cannot use the method just given in (1). One can +instead put the variable or array in PROGRAM COMMON by means of +(identical) declarations in both the main program and the subroutine. +Then the variable or array should not be used as +an argument at all, and the initialization is thus avoided. Note that +in this case (identical) dimension declarations are necessary for such +arrays in both the main program and the +subroutine. + +(10) A new logical operation is now available in MAD, the +"exclusive or", written as .EXOR.. The precedence of .EXOR. is the +same as the precedence of .OR., and its definition is: M .EXOR. N has +the value 1B if and only if either M or N has the value 1B, but not +both. + +(11) Most diagnostic comments printed for errors in part I of +the translation now include references to the appropriate section of +the MAD manual. These references appear in parentheses following the +comment. For example, (II.1.1.4) refers to Chapter II, section 1.1.4 +which is titled Boolean Constants. + +(12) Each use of the subscript notation A(i,j) where A is an m x +n array, involves evaluation of the expression n(i - 1) + (j - 1) + b +where n = the number of columns in A and b = the base point, i.e., +A(1,1,) ≡ A(b). A method which is much more +efficient is to preset or compute at the beginning of the +program, the vector: V(1) = b-1, V(2) = b-1+n, V(3) = b=1+2n, ..., +V(m) = b-1+(m-1)n. The ith element in the +vector is the linear subscript in A of the element in A immediately +preceding the first element in the ith row. +To refer to A(i,j) one now writes A(V(i)+j). The base point and +number of columns may be changed during computation, but each time +either is changed the elements of V must be recomputed. The usual +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. + +