From: Eric S. Raymond Date: Fri, 9 Apr 2004 16:43:07 +0000 (+0000) Subject: Started Chapter IV. X-Git-Tag: 1.0~29 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=4db9d2f529e9e87b31b00e8ec24da9a1bbc98e65;p=mad.git Started Chapter IV. --- diff --git a/doc/mad-manual.xml b/doc/mad-manual.xml index 9cf04fa..30aeb4b 100644 --- a/doc/mad-manual.xml +++ b/doc/mad-manual.xml @@ -4632,8 +4632,219 @@ arguments of recursive functions. - + +Mechanics of Using MAD +Card Format + +MAD Statements are punched according to the following card format: + + + + + + + +1.1 Statement labels may be punched anywhere in cols. 1-10. +Spaces are not relevant. + +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. + +1.3 The statement may start anywhere in cols. 12-72. With the +exception of characters enclosed between "$" spaces are not relevant. +(Spaces may not be relevant even if they are so enclosed (see section +2.15) on format specifications). + +1.4 The identification information in cols. 73-80 is not used by the +computer for any purpose but printing during translation and is +arbitrary. Actually, it is good practice to use the first four of the +available eight columns for the first four digits of the project +number (i.e., for R10AN use R10A). Presumably, the last four would +contain some sequence code. + + +Diagnostics + +During the process of translation many kinds of errors in the +formation of statements and the allocation of storage can be +detected. To understand this error detection and the subsequent +printing of diagnostic + +comments some knowledge of the structure of the +translator is helpful. The translation from statements to machine +code is accomplished in three major sections: + + +The decomposition of the original statements into +arrays of binary operations and pseudo-operations. + +The analysis of all of the declarative information in +order to allocate variable storage and identify the arithmetic types +(i.e. modes) of variables. + +The combination of the information produced from (1) +and (2) to translate the arrays to relocatable binary +programs. + + +When an error is encountered in one of these sections the +translation does not proceed to the next section. However, insofar as +possible, the entire set of statements is processed through the +section in which the error is detected and therefore more than one +error may be detected. It should be understood, then, that not all +detectable errors may be found because: + + +They are detectable only in a later stage of the +translation. + +Some types of errors make it impossible to attempt +further detection within the section in which it +occurs. + +One error may actually obscure another error. + + +Occasionally, an error in one statement may be such that it causes the translator to misinterpret a second statement, thus giving an error indication +even though no error exists in the later statement. + +The printed diagnostic comment may very often have an alternative or +ambiguous form. This results from the fact that it is frequently not +possible to determine what form was intended--merely that the present +structure is not admissible--and therefore some of the alternative +possibilities are suggested by the comment. + + +Structure of Subroutines + +The information in this and the following sections of Chapter IV are +in much greater detail in other Computing Center write-ups. However, +the following sections should be sufficient for the general use of +MAD. + + + +Subroutines which are written for use by MAD programs--whether +written in MAD as functions or in SAPSAP is the SHARE +Assembly Program [typo] which permits the writing of actual machine +instructions in symbolic form.--must be relocatable +and must operate from the calling sequences the translator produces. +Consider, for example the function call --FN. (A,B,C)--which might +appear in the body of a statement. Assume that B is an array which has +an associated dimension vector BDIM. Using SAP notation for +illustrative purposes, the calling sequence produced would be + + + TSX FN,4 + TXH A + TXH B,0, BDIM + TXH C + + +Input-output routines utilize two types of parameters--the +regional and single variable types. In addition an error return is +given as well as a format specification location. The parameter +operation code used is TXI and the end of the parameter list is +indicated by a TXI operation with a blank address. Thus the +statement + + + READ FORMAT FMT, BETA, X(1) ... X(100), K + + +would produce the calling sequence + + + TSX READ,4 + TXI ERROR + TXI FMT + TXI BETA + TXI X-1, 0, X-100 + TXI K + TXI + + +On occasion it is useful to use the regional notation in subroutines +which are not in the input-output category, for example, G. (GAMMA, +DELTA, Z(10)...Z(20)). The calling sequence would be + + + TSX G, 4 + TXH GAMMA + TXH DELTA + TIX Z-10, 0, Z-20 + + + +It is important to notice that in this example, as well as in the +first, the parameters--if executed as instructions--would produce no +operation. + +It is beyond the scope of this manual to discuss the structure of +relocatble programs (see IBM FORTRAN II Manual). It is suficient to +say that a relocatable program must contain--in adidtion to the actual +instructions in the program--information as to which addresses must be +relocated at the time of loading for execution and which addresses +must not. In addition, the first card (or record) of such programs +must contain information about the size of the program, the number of +subroutines it calls on, the amount of stroage it will share with +other subroutines, the location of the list of subroutines it calls +on, and the names by which the routine itself is referred to. The +symbolic names of the subroutines called on must appear as the first +words after this information. + +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. + + +Systems Subroutines + +The use of the following names for functions (subroutines) +should be avoided except where the operation is the one indicated +here. + + + +SYSTEM +Entry to this routine causes a +return to the operating system. The END OF PROGRAM statement produces +a call for this routine. + + + +ERROR +Entry to this routine also causes a return to the +operating system. However, if a dump of storage was requested of the +operating system such a print of storage will be produced before the +return to the system. The ERROR RETURN statement may produce a call +for this routine. + + + +TAPEWR Entry to this subroutine causes +BCD information to be written on tape. The arguments are: (1) +location of the format specification, (2) tape number, and (3) a list of + +variables to be written. The WRITE BCD TAPE ... statement produces +a call for this subroutine. + + + +PRINT Similar to TAPEWR above except that +the use of tape 6 (the output tape) is implied. The PRINT FORMAT +... statement produces a call for this subroutine. + + + + +