TM3013501103_MAC_16_LEAP_Assembler_Manual_2ed_Jul1969 TM3013501103 MAC 16 LEAP Assembler Manual 2ed Jul1969
User Manual: Pdf TM3013501103_MAC_16_LEAP_Assembler_Manual_2ed_Jul1969
Open the PDF directly: View PDF .
Page Count: 54
Download | |
Open PDF In Browser | View PDF |
LEAP Assembler m~ 0 (I) n Q.~ o-.:r (I) 2.(1) Manual nC- Ut 16 LEAP Assembler m .... -0 CD n Manual o o.~ -':r ::J ;;e en 16 TM3013501103 July 1969 Second Edition © Copyright 1969 by Lockheed Electronics Company Los Angeles, California All rights reserved Printed in U. S. A. CD CD Q.. TABLE OF CONTENTS SECTION 1 - INTRODUCTION 1-1 GENERAL 1-1 Programmer Options 1-1 Features 1-1 THE ASSEMBLY PROCESS 1-2 Pass 1 1-2 Pass 2 1-2 SECTION 2 - LEAP LANGUAGE SYNTAX 2-1 GENERAL 2-1 THE CHARACTER SET 2-1 FIELDS 2-1 The LOCATION Field 2-2 Symbols 2-2 The OPERATION Field 2-2 LEAP CODING FORM 2-3 The VARIABLE Field 2-4 The COMMENTS Field 2-4 2-4 2-4 2-4 2-4 2-5 2-5 2-5 2-5 2-5 2-5 2-6 2-6 2-6 2-7 2-8 2-8 2-8 2-8 2-8 2-9 2-9 2-9 2-9 2-9 2-9 The IDENTIFICATION Field EXPRESSIONS Elements Value Assignment Mode Assignment Absolute External Relocatable Data Single Precision, Fixed-Point Double Precision, Fixed-Point Single Precision, Floating-Point Double Precision, Floating-Point LEAP CODING FORM Examples of Decimal Data Hexadecimal USASCII The Asterisk as an Element Expression Operators Elements and Operators in Expressions Absolute Values Relocatable Values External Values The Asterisk Uses of Parentheses in Expressions Summary of Legal and Illegal Expressions 2-10 iii TABLE OF CONTENTS (cont'd) LITERALS 2-10 SUMMARY OF ASTERISK USES 2-10 ERROR CODES 2-11 SECTION 3 - LEAP PSEUDO-OPERATIONS ASSEMBLY CONTROLLING PSEUDO-OPERATIONS 3-1 BOOT - BOOTSTRAP FORMAT 3-1 DUP-Duplicate the Next Source Line 3-2 END - End of Source Program 3-2 ORG - Set Program Origin 3-3 SKIPF - Skip if False 3-3 CODING FORM 3-3 SKIPT - Skip if True 3-4 SKIPT ARG, 2*ARG 3-4 SKIPF ARG-3,9 CODING FORM 3-4 3-4 LDI (3-ARG)*2 3-5 TWA 3-5 STACOUNT 3-5 LDX = Al05 3-5 CLA 3-5 LOOP STA 0,1 3-5 DNX 1 3-5 INC COUNT 3-5 JMP LOOP 3-5 DATA GENERATING PSEUDO-OPERATIONS 3-5 DC - Data Constant 3-5 MAC 16 Print Out Example 3-6 CODING FORM 3-7 PTR - Address Pointer LISTING CONTROLLING PSEUDO-OPERATIONS 3-8 3-8 3-8 EJECT - Skip to the Top of the Next Page 3-8 LIST - List During Pass 2 3-8 NLiST - Don't List During Pass 2 3-9 SPACE - Space n Lines Before Resuming Listing 3-9 TITLE - heading to be Printed at Top of Page 3-9 TXT - CHARACTER String LSTSY - List Symbol Table iv 3-1 3-9 EXTERNAL REFERENCE PSEUDO-OPERATIONS 3-10 EXTRN - External Symbol 3-10 ENTRY - External Symbol Definition 3-10 STORAGE ALLOCATING PSEUDO-OPERATIONS 3-11 CLEAR - Clear and Reserve an Area 3-11 COMN - Reserve an Area in COMMON 3-12 DS - Reserve Data Storage Area 3-12 TABLE OF CONTENTS (cont'd) SYMBOL DEFINING PSEUDO-OPERATIONS 3-13 EOU - Symbol Equals Value and Type of Expression 3-13 EOUR - Symbol Equals Value of Expression, Relocatable Mode 3-14 REDEF - Redefine Symbol 3-14 MISCELLANEOUS PSEUDO-OPERATIONS SETB - Set the Loading B Flip-Flop 3-14 3-14 RESB - Reset the Loading B Flip-Flop 3-14 PRINT - PRINT During Pass 1 3-15 MACRO Definition' 3-15 Parameters 3-15 EXAMPLE 1 CODING FORM 3-16 EXAMPLE 2 CODING FORM 3-17 EXAMPLE 3 CODING FORM 3-18 SECTION 4 - ASSEMBLING MAC 16 INSTRUCTIONS 4-1 CLASS 0: 16 BIT, UNMODIFIED 4-1 CLASS 1: MEMORY REFERENCE 4-1 CLASS 2: I/O INSTRUCTIONS 4-1 CLASS 3: SKIP INSTRUCTIONS 4-2 CLASS 4: N FI ELD 4-2 CLASS 5: IMMEDIATES 4-2 CLASS 6: STATUS MODIFIERS 4-2 SECTION 5 -INPUT/OUTPUT 5-1 SOURCE PROGRAM PREPARATION 5-1 Preamble-Start-of-File 5-1 Card I mages 5-1 End-of-File 5-1 ASSEMBLY LISTING FORMAT 5-1 Page Format 5-1 Line Format 5-1 Value Formats (Positions 13-21) 5-2 OBJECT CODE 5-3 Bootstrap Format 5-3 Extended Format 5-3 Checksum 5-5 APPENDIX A - USASCII CHARACTER SET AND HEXADECIMAL CODES A-1 APPENDIX B - MAC 16 MACHINE OPERATIONS B-1 APPENDIX C - LEAP PSEUDO-OPERATIONS C-1 v Section 1 I ntrod uction This manual contains a discussion of the Lockheed of assembly are (1) absolute and (2) relocatable. Through Electronics Assembly Program (LEAP) for the MAC 16 the use of pseudo-operations the programmer can change a computer. Included are discussions of LEAP and its pur- mode at will. For example, to access the MAC 16 executive pose, the LEAP language and the rules for using the page in memory, an absolute memory location is specified; language, programming examples using the LEAP language, whereas, unless the program is assembled in bootstrap and instructions for preparing a program for assembly. format, the majority of memory reference instructions refer Assumption is made that the reader is familiar with the to locations that are of relocatable mode. MAC 16 (described in the MAC 16 Programmer's Manual) The two object code formats are (1) bootstrap and (2) and is generally familiar with computer programming at the extended. A program object code format cannot be assembly language level. changed during assembly. Basically, what makes assembling GENERAL format is that in bootstrap format the programmer must do in bootstrap format different from assembling in extended his own memory reference depaging, and also, he cannot An assembly program is a language translator that trans- use external references or use the relocation mode of lates one language (called the source language) into another language (called the object language). The process by which extended format, depaging is automatic during the loading assembly. See Section 3 for an explanation. Under the translation takes place is called the assembly process. process, and also, both external and relocatable references The source language is in symbolic form, a form easily are allowed. understood (and used) by the programmer. The object language is in numeric form, a form understood by the Features computer. As in all languages, the LEAP source language has gram- Some LEAP features follow: matical rules that must be followed so that the "sender" 1. Two-pass assembler (the programmer) can be understood by the "receiver" (the 2. The programmer completely controls depaging. I f the programmer wishes, the assembler/loader automatically LEAP program). The entire set of grammatical rules of language is called the syntax of the language. I n later sec- depages programs of any size tions, the LEAP syntax is covered in detail; this section is 3. As many as 200 symbols and/or literals can be defined concerned primarily with general descriptive information within the symbol table of the assembler operating on a and definitions of terms. basic 4K MAC 16 4. Pseudo-operations are provided for: Programmer Options The LEAP assembly language provides several basic a. defining constants of various types 1. Single and double precision, fixed-point (with scaling) programmer options that a user may exercise. First the 2. Single and double precision, floating-point LEAP language contains two assembly modes, and second, two formats for object code generation. The two modes 3. Hexadecimal 4. Text 1-1 b. conditional assembling symbol table with the value of the VARIABLE field and c. LEAP reads the next source line. Each time a pseudo- defining COMMON data storage d. reserving and/or clearing areas of computer memory operation that modifies one of the Location Counters is e. defining external programs and data encountered, the proper Location Counter is modified f. controlling the format of the object code (extended according to what appears in the VARIABLE field. If a or bootstrap) symbol appears in the LOCA TI ON field of one of these g. controlling the program listing 5. Expressions are allowed, including parenthetical subexpressions, with a full range of operators pseudo-operations, a value may be assigned before or after the modification, depending on the pseudo-operation. All MAC 16 instructions cause the LEAP Location Counter to 6. Literals are allowed be increased by one. If a symbol is encountered in the 7. LOCATION field of a MAC 16 instruction, it is assigned the 16 error flags (up to 4 printed with each source line) 8. Macros value of the Location Counter before the increase. If a 9. Symbol-table dump (in alphabetical order). macro definition is encountered, the macro is stored for a macro call. When a call is encountered for the macro, it is THE ASSEMBLY PROCESS inserted in the program in place of its call. This process continues until the end of the program (END pseudo- LEAP reads the source language (one line or statement at a time) and produces the object language. The Loader reads the object language, does whatever processing is operation) is encountered. Pass 2 now starts. Pass 2 necessary (depaging, relocating, etc.), and stores the object program in memory. LEAP starts reading the source program again. If the To assemble a program, LEAP reads the source program operation is a pseudo-operation controlling the assembly two times. Each reading is called a pass; thus, LEAP is a process, the proper function is performed. If the operation two-paSs assembler. Object code is produced during pass 2. is a MAC 16 machine instruction, the proper operation Pass 1 evaluated in the VARIABLE field and its value is inserted The purpose of pass 1 is to: VARIABLE field). The second subfield is evaluated and if 1. Develop a table of defined symbols and assign memory not zero, the index bit is set to one in the object code (if it code is inserted into the object code. The first subfield is into the object code (if it is legal to have a value in the addresses (values) to them 2. Develop a table of external references 3. Develop a table of literals and assign values to them 4.. Define Macros. is legal to have indexing for this instruction). If the first subfield of the VARIABLE field was preceded by an asterisk, the indirect address bit is set to one in the object code (if indirect addressing is legal for this instruction). The source line and the object code is now transferred to the At the start of pass 1, the two location counters used program listing device. The object code is placed in a table by LEAP are set to zero (Execution Location Counter, and and when the table is full, the code is transferred to the Common Counter); a source line is then read. If the source object producing device. line is a comment, the source line is passed over and LEAP 1-2 This process continues until the end of the source reads the next source line. If the OPERATION field con- program tains a symbol-defining pseudo-operation, the symbol encountered. The assembler then produces the object code (END pseudo-operation) is once again appearing in the LOCATION field is entered into the for literals and the process is complete. Section 2 LEAP Language Syntax This section contains the grammatical rules (syntax) of by one or more blanks. The LOCATION field begins with the LEAP language. Rules for forming symbols, expres- the first character of the statement, and is terminated by sions, data, operations, etc. are discussed along with some the first blank. The OPERATION field immediately follows possible error conditions and resultant consequences. This the LOCATION field and is terminated with a blank. The section, along with Sections 3 and 4 provides a complete VARIABLE (operand) field is defined by the first non- description of the entire LEAP language. This Section is blank character following the OPERATION field if this primarily concerned with statement format; Sections 3 and character is within 5 blank characters of the OPERATION descriptions of the pseudo-operations and field, and is terminated by the first blank character or by an 4 contain machine operations recognized by LEAP. end of record signal. (The end of record signal on paper tape is defined as a carriage return-line. feed.) If the first GENERAL non-blank character after the OPERATION field is greater than 5 blank characters away, or if there is a non-blank Throughout this manual, little reference is made to input/output media. LEAP is not concerned with external representation of the source input, or the object and listing character following the VARIABLE field, the COMMENTS field is defined. The COMMENTS field is terminated either by the end-of-record signal or by the eightieth character. output but communicates with the outside world via an An entire line of comments can be entered by writing an elementary executive. (LEAP asks for a source line and is asterisk in the first character position of the line. Fields are not concerned with where the executive received the source usually written in fixed positions on a coding sheet; how- line; in the same manner, the object code and listing code ever, any format that satisfies the above definition is per- are given to the executive for processing.) missible. Free form tolerance is of greatest advantage in The internal format for the source, object, and listing are: SOURCE-SO-column card image OBJECT-72-column binary card image LISTING-lOS-column print image, plus carriage control characters An example of the coding sheet is shown on page 2-3. Statements are composed of fields; each containing a constant, a symbol, an expression, or two or more of these separated by commas. The assembler evaluates constants and expressions, and saves a table of the symbols and the values assigned to these symbols when the programmer (or overcoming a common keypunching error; that is, starting a field in the wrong column or character position of the line. THE CHARACTER SET The character set used by LEAP (and the MAC 16) is the USA Standard Code for I nformation Interchange (USASCII) set. There is syntactic significance to some of the characters, but this is discussed later (see ELEMENTS later in this section). The USASCII character set is listed in APPENDIX A. FIELDS the assembly program itself) defines them. The four fields composing a statement are: the LOCA- The LEAP COOl NG FORM is used to assist the pro- TION field, the OPERATION field, the VARIABLE field, grammer in writing a program in a consistent format and the COMMENT field, in that order. Fields are separated acceptable to LEAP. Each line of the form is used for 2-1 writing one symbolic line of the program (called a source 3P14 Does not begin with an alphabetic character statement). The source statement is divided into five fields: LOCATION OPERATION AB.CD Illegal character used (.) ALPHABET More than six characters , 1F F Illegal character used (') VARIABLE :AB doesn't begin with an alphabetic character COMMENTS IDENTIFICATION No provisions in LEAP are made for continuation of If an asterisk (*) appears in card column 1 (and only in card column 1) of the LOCA TI ON field, the entire source source statements except as outlined in macro definition line is treated as a comment. That is, it will be printed on (Section 3). the listing, but otherwise ignored by the assembler. This allows the programmer to freely document his program list- The LOCATION Field ing without adding to the size of his object code. The following are the only entries allowed in the The LOCATION field normally is used for a symbol by LOCATION field: which a source statement can be referenced from other all blank parts of the source program (often referred to as the legal symbol symbolic location). The LOCATION field has a special *in column 1 meaning for some pseudo-operations and is ignored by others; the discussion with each pseudo-operation (Section 3) specifically states the use of the LOCATION field. Violation of this rule causes the error code "S" to be printed on the listing. A legal symbol within the LOCATION field consists of The remaining discussion assumes that no asterisk is one or more (up to a maximum of six) alphanumeric char- written in card column 1 (the remainder of the card is acters (A through Z, 0 thru 9, and colon (:)), the first of ignored, if a comment). which must be alphabetic. The symbol must start in the first character pOSition of the LOCA TI ON field and is The OPERATION Field terminated by the first blank. The special character colon (:) is considered a numeric The OPERATION field is used for entering the symbol by the syntax of the LEAP assembler when used mnemonic for a desired operation. This operation can be within the LOCATION or VARIABLE fields. the mnemonic for a pseudo-operation (see Section 3) or a machine operation (see Section 4). When the mnemonic Symbols represents one of the MAC 16 machine operations, LEAP inserts the appropriate code for that operation into the Symbols consist of alphabetic characters, (letters A through Z), numeric characters (numbers 0 through 9 and mnemonic represents one of the LEAP pseudo-operations, colon (:)) or a combination of alphabetic and numeric characters. A symbol may be formed of one to six characters, the instructed action is taken. Appendices Band C sum- but the first character of every symbol must be alphabetic. OPERATION field. The contents of the OPERATION field The special character colon (:) is considered a numeric character by the syntax of LEAP. Example: LEGAL ALPHA marize the mnemonics that are accepted by LEAP in the are optional i.e., a macro (see Section 3). The OPERATION field starts with the first non-blank character following the LOCATION field and is terminated by the first blank character encountered. A mnemonic entry within the OPERATION field con- PI sists of one to six alphanumeric characters (A thru Z, 0 thru A239B 9, and colon (:)), the first of which must be alphabetic. P68475 2-2 object code produced by the source statement. When the The remaining characters must conform to the syntax X for either a mnemonic or a valid pseudo-operation, a ZAP:U machine operation or a predefined macro. Otherwise, the statement is flagged with an error code "0". I LLEGAL (Error Code "S") I ) . LEAP CODING FORM PROGRAMMER DATE PAGE PROGRAM LOCATION . I 2 2 J 4 5 6 I 4 II 5 4 flSF ITIt-= ~r6L LD I~ nu~ 7 9 10 - ; VARIABLE 1 8 'I 10 11 12 13 14 15 T~E Ffj II LC IA 6 8 CHARGE OPERATION U~~ 3 20 COMMENTS 132 25 35 40 45 • .N 55 50 VA. IH 16~ E Fix E,,- 0 I I"'~ ~Ir; IR~ R£ IFE. RE 11'4 ,. ED IN ST R\J 'I' ITt rI~ G XL L-U SiT R~ Te S ~NI SV I~~ .IJ ,. lL LU stT iAi .5 IYM 6(1L L8 I) I I ES ~ NI trl1 b~ lol~ I'IT 1\'11ST 1R. \) 19 • .... ~N I F-i5 LL !ZS~ L" ~ 11 l\tl G IL LU ST Rl~ 1"E ~ ANI IN ~T ~U CT r.t Q5N I I ~r- e !~1 I I 13 I I 14 65 '70 80 7.1 I I I I I I I IN10il RE c:.~ -I Win 1= ill E.it: ,5 12 IDENTIFICATION 60 I I T~f OF I I I I I I I 15 I 16 I I I 17 I I I 18 19 I I I I 20 21 I I I I 22 23 I I I I 24 25 I J I I 26 I 27 28 29 LECW FORM 213-1 ~ W I I I i I I 30 I I LOCKHEED ELECTRONICS COMPANY DATA PRODUCTS DIVISION The VARIABLE Field sion of the COMMENTS field. Otherwise, IDENTIFICATION is treated in the same manner as described for COM- The VARI ABLE field or operand is so called because of MENTS. its function as modifier to the operation. The VARIABLE field starts with the first non-blank character following the OPERATION field and is terminated with the first blank encountered (or column 80, whichever is first). It is most commonly used for specifying the variable part of a machine instruction (address, M, N, amount of shift, etc.), and the index register flag. When used for these purposes, the VARIABLE field is actyally broken down into subfields. For memory-reference instructions, there are two subfields: the address subfield and the X (index) subfield. The programmer indicates the separation of these two subfields by placing a comma (,) between them. Section 3 includes a description for the use of the VARIABLE field on various pseudo-operations; Section 4 describes the uses for the various machine operations. If an asterisk (*) preceeds the mnemonic in the VARIABLE field, it is interpreted to mean that the instruction indirect address tag, I, is to be set to a one. This is allowed with all memory reference operations. If the operation is EXPRESSIONS It is often desirable to specify a value in the VARIABLE field that is generated by combining more than one value. LEAP provides the programmer with this capability by allowing expressions in the VARIABLE field. An expression is composed of elements and operators; it can be composed of a single element, or n elements separated by n-1 operators. The length of an expression is limited only to the size of the VARIABLE field. If two or more elements appear in an expression, all of the elements in the expression must be single precision; i.e., a value that is not larger than 16 bits. The only time an element is multiple precision (e.g., double precision numbers, or text string of more than two characters, etc.) is when the element is in the VARIABLE field of a multiple precision DC or TXT pseudo-operation. Illegal use of multiple precision elements causes the error code "C" to be printed on the listing. not a memory reference type, the error code "I" is printed on the listing. LEAP terminates the scan of the VARIABLE field when the first blank is encountered (exceptions: USASCII data and the TXT and TITLE pseudo-operations). The COMMENTS Field The COMMENTS field is used for any remarks that the programmer cares to write. The contents of the COMMENTS field are printed on the program listing, but are otherwise ignored by the assembler. The COMMENTS field starts with the first blank following the VARIABLE FIELD (except as noted above). Although the starting position of the COMMENTS field is Elements An element is an operand in an expression. An element may be a symbol, a datum, or the asterisk. As stated, LEAP places special syntactic significance on some characters in the character set. Some of this significance is associated with the first character of an element. If the first character of an element is: A thru Z: the element is a symbol a thru 9 or the decimal point: the element is a decimal number $: the element is a hexadecimal number ': the element is USASCII data. variable, the program listing is less confusing if the programmer always starts a comment in the same column. By Value Assignment following this rule, a predictable separation exists between the program instructions and the commentary, thus, making a more readable listing. A symbol normally has an assigned value when the symbol is encountered in the LOCATION field of a source line. When an undefined symbol (not in the LOCATION The IDENTIFICATION Field field of any source line) is encountered in the VARI ABLE field, LEAP assigns a value of zero and causes the error The IDENTIFICATION field may be used for record 2-4 identification (if cards are used) and is cQnsidered an exten- code "U" to be printed with the line in which the symbol was encountered. If a symbol does not have a unique value (i.e., it was encountered in the LOCA TI ON field of more than one source line), it is considered to be a multiple definition. The value of the symbol is the value assigned by LEAP the last time the symbol was encountered in the LOCATION field; subsequent encounters change the value. Multiple definitions cause the error code "0" to be printed with the line in which the symbol is encountered in the LOCATION field. If a source statement refers to the multiply defined symbol in the VARIABLE field, the error code "M" is 3. The symbol appears in the LOCATION field of a COMN pseudo-operation. Data LEAP will process three different data notations as elements: decimal, hexadecimal, and USASCII text. DECIMAL Single Precision, Fixed-Point (4.5 decimal digits) printed with the line in which the symbol is encountered. SINGLE PRECISION, FIXED-POINT (1 word) The value of a symbol encountered in a pseudooperation LOCA TI ON field is the value and type of the S LEAP LOCATION counter at the time the source line is o encountered with two exceptions. These exceptions are the 15 bits of data 15 A single precision, fixed-point decimal number requires EQU and EQUR pseudo-operations (see Section 3 for one computer word (sign and 15 bits) and is written in two further explanation.) parts: the numeric part and the scaling part. Mode Assignment The numeric part of the single precision, fixed-point number is a signed or unsigned decimal number, with or The mode of a symbol is dependent on the mode of the without a decimal point. If no sign is specified, the number value assigned to the symbol. A value may be either abso- is assumed to be positive. If no decimal point is specified, it lute, external, or relocatable. is assumed to be immediately to the right of the final digit of the numeric part (a decimal integer). Absolute The scaling part of the single precision, fixed-point number is composed of the binary scale factor and the A symbol is absolute if the value assigned to the symbol is absolute. This can be done in two ways: 1. LEAP assigns the value of the LOCA TI ON counter and the mode of assembly is absolute; or, 2. the value is assigned through the use of a symboldefining pseudo-operation and the expression in the VARIABLE field is absolute. External decimal scale factor. The binary scale factor may be omitted if no decimal point is included and must be included when the binary scale factor is the letter B followed by a signed or unsigned decimal integer. The binary scale factor specifies the position of the understood binary point relative to the machine binary point (between bit positions 0 and] of the computer word). If the binary scale factor is positive, the understood binary point is to the right of the machine binary point, if negative, it is to the left of the machine binary point. A symbol is external if it appears in the VARIABLE field of an EXTRN pseudo- operation. The decimal scale factor may be omitted, but if included, it is the letter E followed by a signed or unsigned decimal integer. The decimal scale factor specifies the loca- Relocatable tion of the decimal point in the numeric part relative to the written decimal point (if no decimal point had been A symbol is relocatable if the value assigned to the symbol is relocatable. This can be done in three ways: 1. LEAP assigns the value of the LOCATION counter and written, it is assumed to be immediately to the right of the final digit). If the decimal scale factor is positive, the decimal point is to the right; if negative, the decimal point is to the left. the mode of assembly is relocatable; or, 2. the value is assigned through the use of a symbol- The binary scale factor may appear before the decimal defining pseudo-operation and the expression in the scale factor, or vice versa, but the scale factors must appear VARIABLE field is relocatable; or after the numeric part (error code "C", if not). 2-5 If information is lost in the most significant part of the word during conversion (improper scaling), the error code "C" is printed on the listing. hexadecimal digits of data) and is written in two parts: the numeric part and the scaling part. The numeric part of the single precision, floating-point number is a signed or unsigned decimal number, with a Double Precision. Fixed-Point (9.4 decimal digits) decimal point. If no sign is specified, the number is assumed to be positive. If no decimal point is specified, the number DOUBLE PRECISION, FIXED-POINT (2 words) is assumed to be an integer. The scaling part of the single precision, floating-point word IS I number is the decimal scale factor. The decimal scale factor specifies the location of the decimal point relative to the 15 most-significant bits o written decimal point in the numeric part. If the decimal 15 scale factor is positive, the decimal point is to the right; if (see footnote 1.) negative, the decimal point is to the left. word 2 Double Precision. Floating-Point (16.7 significant decimal 15-bit extension o digits) 15 *Unused A word S double precision, fixed-point decimal number o requires two computer words (sign and 31 bits). A double precision, fixed-point number is written the same way as the single precision number, except that two B's are written EXP fraction 7 8 15 (2 hexadecimal digits of fraction) word 2 for the binary scale factor or two E's are written for the decimal scale factor (or both). o Single Precision. Floating-Point (7 significant decimal digits) word 3 SINGLE PRECISION, FLOATING-POINT (2 words) o 15 (4 hexadecimal extension) 15 (4 hexadecimal extension) word word 4 S EXP o 7 8 15 (see footnotes 2 and 3) (2 hexadecimal o 15 (4 hexadecimal extension) digits of Fraction) A double precision, floating-point decimal number word 2 requires four computer words (sign, 7-bit hexadecimal exponent, 14 hexadecimal digits of data). o (4 hexidecimal extension) 15 A double precision, floating-point number is written the same way as the single precision number, except that a A single precision, floating-point decimal number requires two computer words (sign, 7-bit exponent, and 6 decimal scale factor must be specified, and two E's must be written for the decimal scale factor. Notes: 2-6 1. S is the sign 2. EXP is the 7-bit exponent (power of 16), offset by 4016' The decimal range of the hexadecimal exponent is +63 to -64 (approximately 3. 10+19 to 10_19). Fraction is the normalized hexadecimal fraction; extensions are 4 hexadecimal digits. t). LEAP CODING FORM PROGRAMMER DATE PROGRAM LOCATION 1234~6 IT~ 'e CHARGE OPERATION 7 8 9 10 11 12 13 14 15 E~ A~ PL r; 3 I GI1 It D" 5 E~ l~ PI- ~ ~ 6 14 Glt 7 0" 8 IE~ fA III PIL te ~ 9 10 11 12 13 II ~GI~ IEiYII NP ttlA ~~ lor,. I~ 14 ID~ VARIABLE 20 II 1':111 I II 2 4 OF PAGE 25 132 u~ TI~ AT IE '~ rtl~ Ie 45 50 ITT Ill! N Q!!F .. I F 10 Die: ~~ 1!3 rr~ N141FIll4 IArt IIIH G- .If I: -11 IE IQlu 'AIL Is I 15 I 16 I 17 I 18 I 19 I I I 21 40 55 ! I liN ~LE II.! I~ [W6 NI'tIF 1'1 f\ -ip III INIr IE Q ~L S I~ IE~ ~o Oi.IS 15 I IT 11~ NI"IF TV s:lrl .p rJ ~~tt ~ u~ LE Pill .14 1:1: "Ia zl1. IE Q ~l S ~ IE )c ~a o~ nln Inl! I ~II Nk.; LE 10 IDII! ~11' ~I' il!w I"IF iL~ Air liN ki -P ~ ~~tf Ie ~I' IAL S "IE ~ C1 10 !~O 010 -~ 14 20 35 Is: itot INA L ~A h"~ ~I~ II~ IDENTI F ICATION COMMENTS I" E~ ~ lUI I' ~b II 9 ~~ ~~ 60 65 70 BC 73 I I I I I I I I I I I I I I I I I I I I I 22 I I 23 I I I 24 25 I I I I 26 I I 27 28 29 I I 30 LECW FORM 213-1 r:-> '-I I I I I r LOCKHEED ELECTRONICS COMPANY DATA PRODUCTS DIVISION Examples of Decimal Data NUMBER FORMAT Expression Operators AS IT APPEARS ON THE LISTING (HEXADECIMAL) I tems are combined using the operators defined in the table below. The table also is a list of hierarchy numbers for determining how the value of an expression is computed. 1. 1.B15 .lEE1B31 single precision, fixed-point 0001 sin~le 4110 before operations having lesser hierarchical value. Opera- 0000 tions with the same hierarchical value are performed from precision, floating-point single precision, fixed-point double precision, fixed-point 0001 left to right. (Parentheses may be used to change this 0000 hierarchical structure.) 0001 -1. 1.EE-l Operations with greater hierarchical value are performed single precision, floating-point Cll0 0000 double precision, floating-point 4019 9999 9999 9999 Table 3 Hierarchy Operator Description 6 % Logical binary left shift 5 * Arithmetic product 5 / Arithmetic quotient 4 + Arithmetic sum Hexadecimal A hexadecimal number is represented by the dollar sign ($) followed by a signed or unsigned string of hexadecimal digits. A single precision hexadecimal number has less than five digits; a double precision hexadecimal number has more than four digits, but fewer than nine digits. If a negative sign is specified, the resulting number is two's complement. USASCII USASCII text is defined to be the single quote (') 4 3 terminates the strings. < 3 Boolean less than Boolean equals 3 > Boolean greater than 2 & Logical product (AND) @ Logical sum (OR) followed by a string of characters. Two characters are stored per word. If more than two characters are written, the string will use more than one word. A single quote (') Arithmetic difference Control characters (carriage return, line feed, tab, etc.) and the single quote (') are not allowed in a USASCII text Logical difference string. If it is necessary to specify any of these a separate (exclusive OR) DC statement must be used, with the character(s) specified in hexadecimal. Example of USASCII characters in a DC statement: DC,4 'WEDNESDA' The Asterisk As An Element 2-8 An expression can have a leading minus sign; if so, its value is computed as though a zero preceded the minus sign. Thu~ - 1;30;6 (-2) is evaluated as 0-(13%(-2)), which is not the same as (0-13% (-2). A single asterisk (*) may be used as an element in an The value of an item will be right-justified in its expression. The value of the asterisk is the value of the generated resultant field and unspecified leading bit posi- LOCATION counter at the time the asterisk is encountered tions will contain zeros. during the expression evaluation. The value mode of the Note that the subexpression item provides for paren- asterisk depends on the current mode of assembly (absolute thetical expressions; i.e., according to the above rules or relocatable). (A+B)/2 is a valid expression. Elements And Operators In Expressions If two or more elements appear in an expression, all of the value are treated as 16-bit values. A multiple precision element must exist alone in an expression and can only be used in the VARIABLE field of a DC or TXT pseudooperation. Two consecutive elements are not permitted without an operator separating them (3M does not mean 3*M and will cause the error code "E" to be printed on the listing). Consecutive operators are not permitted without elements except for the minus sign (-). Any of the elements described in this section may be used in expressions (with the above-noted restriction on multiple precision elements). Certain combinations, described below, have no meaning and are not permitted. The table at the end of this section summarizes the legal and illegal combinations. Absolute Values Any 16-bit absolute value can be combined with any other 16-bit absolute value with any operator. Absolute values are: Symbols with absolute values Data Elements Relocatable Values Only one relocatable value can exist in an expression, unless the combination of relocatable values causes an absolute result. For example, a relocatable value subtracted from a relocatable value produces an absolute result. It is the programmer's responsibility to group the elements in an expression so that the value of the entire expression is dependent on only one relocatable element. Violation of this rule causes the error code "R" to be printed on the listing. External Values External values cannot be combined with other expressions elements. Violation of this rule causes the error code "R" to be printed on the listing. Relocatable and external values are not defined until load time; absolute values are known at assembly time. The use of relocatable and external values is assumed to be associated with a reference to a memory location by the Extended Loader. The following are the only memoryreference values recognized by the Extended Loader. ABSOLUTE VALUE . Depage POSTITIVE RELOCATABLE VALUE. . . . . . Add relocation constant to value and depage POSITIVE EXTERNAL VALU E. . . • . . Add value to value of external symbol and depage. The Asterisk If the asterisk is used as an element and it has a reiDeatable value, the restrictions described above apply for relocatable values in expressions. There is no restriction regarding the use of an asterisk as an absolute value. The asterisk is also an operator and there is one syntactical ambiguity in the use of the asterisk for either purpose. LEAP evaluates asterisks in the VARI ABLE field "in the following manner. The first element, if an asterisk, forces LEAP to evaluate the second element. If the second item is a legal operator (+.-,*.1, etc., the value of the first item (*) will be the value and type of the LOCATION counter. If the second item is a legal element the first item (*) will be used to define an indirect call to a location. With this in mind the following example will be easy to decipher. Example: LOA **2 The value of the expression is the value of the LOCATION counter multiplied by two. If the programmer wished the value to be indirect through LOCATION counter +2, a name (label) should be assigned to the desired location and the coding written as LOA *NAME Uses of Parentheses In Expressions LEAP gives the programmer the capability to specify subexpressions within expressions. A subexpression is a string of elements and operators bounded by parentheses. A subexpression starts after a left parenthesis and is closed when a matching right parenthesis is encountered. After evaluating a subexpression, the resulting 16-bit value is treated as an element by LEAP. Parenthetical subexpressions may be nested within subexpressions. LEAP can evaluate up to five levels of nested parenthetical subexpressions. However, for each left parenthesis encountered, there must be a matching right parenthesis within the expression. If there are more left or right parentheses than the other, the error code liZ" is printed on the listing. 2-9 Examples: The value and mode of a literal is assigned at the end of (((((A+B)*(C-D))/E) & F) the first pass over the source program. For each literal $FFFF)+l encountered in the literal table, LEAP assigns the value of (A)+(B)-(C*D) the LOCATION counter and then increases the LOCATION Note, that redundant parentheses are allowed; A+B-C*D would produce exactly the same results as this example. counter by one. Mode assignment is dependent on the mode of assembly at the time the EN D pseudo-operation is encountered. If LEAP is assembling in the absolute mode, ALPHA/(BETA-GAMMA-DEL TA) the literals will be the absolute mode; if in the relocatable (BITS/2) & 1 mode, the mode will be relocatable. Shifts BITS right 1 place and keeps only low-order bit. Examples: =' AB' -EXTENT requires one word (USASCII string, two characters per word). Forms two's complement =$lFF Summary of Legal and Illegal Expressions requires one word (single precision, hexadecimal). When LEAP is assembling in bootstrap format, literals are used only if the program, including all literals, is less than The following table lists the legal and illegal combinations of elements in expressions. If an illegal combination is one page in size. A literal expression is composed of more than one ele- encountered, the error code "R" will be printed on the ment (or a single element with a 16-bit value), and is always listing. The table is applicable to values and intermediate a 16-bit word containing the value of the expression. Thus, values. For example, the table shows that r+r is illegal; absolute, external, or relocatable values are elements in therefore, r+r-r would also be illegal; however, r+(r-r) would literals. be interpreted as r+a, which is legal. Examples: LDA LEGAL =*+3 means "load the A-register with a word containing the value of *+3." It does not a=a r=r a+a=a a+r=r a-a=a r+a=r a*a=a r-a=r a/a=a a&a=a a@a=a r-r=a mean "load the A-register with the word e=e that is three locations away." EXTRN SINE LDX =SINE means "load the index register with the external value of SINE." At execution time, this value will be the memory a!a=a address of where SI N E had been placed a = absolute; e=external; r=relocatable by the loader. I LLEGAL (error code "R") SUMMARY OF ASTERISK USES Any other combination of elements is illegal. No ~ or I item may be an element of: * .I,&,@,! operators The following are the various uses of the asterisk and their meanings: LITERALS 1. An asterisk in column 1 of the source statement: treat entire source line as a comment. A literal is the equals sign(=), followed by any legal expression. Multiple precision elements are not permitted following the equals sign. If a multiple precision element is encountered, the error code "E" is printed on the listing. The value of a literal is the 16-bit address of the 2-10 memory location in which the literal is stored. 2. An asterisk preceding a VARIABLE field mnemonic: set indirect address flag. 3. An asterisk as an element in an expression: current value and mode of the LOCATION counter. 4. An asterisk as an operator: form the product of the adjacent elements. o ERROR CODES OPERATION CODE An illegal mnemonic, or undefined mnemonic has been encountered in the OPERATION field. The following is a summary of the error codes and their P meanings: A ADDRESS SUBFIELD PHASE A relocatable expression is not permitted, or an expression has an element that has not been previously A null expression was encountered in the address sub- defined. field (memory reference instructions only). There must always be an entry in the address subfield of memory reference instructions, even if it is just B R a (zero). combination of relocatable and/or external elements. BOOTSTRAP While running the bootstrap format, either a memory S reference instruction has attempted to address a loca- C RELOCATABLE An expression has been encountered with an illegal SYMBOL An illegal character has been encountered in the LOCA- tion not in the current page or the base page, or an TION field; or a symbol-definition has been attempted illegal pseudo-operation has been encountered. without starting the symbol with an alphabetic char- CONVERSION acter; or a symbol has been encountered in the VARI- A data element cannot be correctly converted. This is ABLE field with too many characters (more than six); usually associated with an illegal character or combina- or a symbol has been omitted in the LOCA TI ON field tion or characters in a data element; however, too many for a pseudo-operation requiring a symbol. characters in a hexadecimal element or improper scaling of a decimal element can also cause this error. D U UNDEFINED A reference has been made to a symbol that is not DOUBLE DEFINITION defined anywhere in the program. A symbol has been defined more than once in the source program. E F V VARIABLE FIELD EXPRESSION An error has been encountered in the VARIABLE field An illegal expression has been encountered. There are that cannot be classified more explicitly - this could be many reasons for this error; see Section 2 for details. a string of characters that has no syntactic meaning; or FIELD OVERFLOW nothing was entered in the VARIABLE field when an A value has been formed that is too large for the entry is required. intended field. Examples of this are: a value of more than one bit in the Index subfield, a value of more than X An index subfield was specified, but nothing was 4 bits in the M and N subfields, etc. entered; or an index subfield has been encountered for INDIRECT ADDRESSING an instruction that does not allow indexing. An asterisk has preceded the VARIABLE field of a non-memory reference instruction. M REFERENCE TO MULTIPLE DEFINITION INDEX SUBFIELD Z NON-ZERO LEVEL REDUCTION An expression has been encountered that does not have A multipally defined symbol has been referenced in the matching pairs of parentheses; there must be exactly source statement. the same number of left and right parentheses. 2-11 LEAP PseudoOperations Section 3 This section contains a description of the pseudo- code produced. In addition, pseudo-operations are provided operations provided in the LEAP language. Examples using for conditional assembling of source lines and setting the the pseudo-operations are included when further clarifica- value tion is required. operation is provided for defining the end of the source Preceding each pseudo-operation description is a figure of the LOCATION counter. A single pseudo- program. showing the format of the LOCATION, OPERATION, and VARIABLE fields. The pseudo-operations described in this section are: BOOT - BOOTSTRAP FORMAT LOCATION OPERATION VARIABLE DUP - DUPLICATE NEXT SOURCE LINE END - END OF SOURCE PROGRAM ORG - SET PROGRAM ORIGIN SKIPF - SKIP IF FALSE The above figure illustrates the format; the fields cor- SKIPT - SKIP IF TRUE respond to the fields defined in Section 2. Except for the TITLE and PRINT psuedo-operations, BOOT - BOOTSTRAP FORMAT the COMMENTS field always starts with the termination of the VARIABLE field (the first space encountered that is LOCATION OPERATION VARIABLE normal BOOT ignored not part of text data). To conserve space and the reader's time, the COMMENTS field is not shown with each of the pseudo-operations. If the word "normal" appears in the LOCATION field of the format figure preceding the pseudo-operation discus- This pseudo-operation specifies to LEAP that the sion, it means that entry of a symbol in the LOCATION format of the object code produced should be the format field is optional. If a symbol is entered in the LOCATION recognized by the bootstrap loader and that the mode of field, its value is assigned in the normal manner. assembly should be absolute for the entire assembly. There are several reasons why a programmer uses this If the word "symbol" appears in the LOCATION field of the format figure preceding the pseudo-operation discus- option. Among these are the following: sion, it means that there must be a symbol entered in the 1. The programmer is in complete control of program and data storage in memory. LOCATION field. If no symbol is encountered, the error code "S" is printed on the listing. 2. ASSEMBLY CONTROLLING PSEUDO-OPERATIONS 3. All base page linkages can be assigned by the programmer. The Bootstrap Loader program can be used to load memory rather than the much larger Extended Loader. The following paragraphs describe those pseudo- 4. This also saves the added step of using the Extended operations provided as part of the LEAP language that Loader through its genboot option to generate boot- allow the programmer to control the format of the object strap object code. 3-1 The BOOT pseudo-operation causes the object program to be completely absolute; no memory-reference instructions may make reference to relocatable or external elements, or elements either outside the page in which the instruction is located or the base page. If a violation of these rules occurs, the error code "B" will be printed on the listing with the source line in which the offending element is encountered. When used, the BOOT pseudo-operation must be the first source statement to be read by LEAP or it will be considered an illegal command to LEAP and the error code "B" will be printed on the listing with the source line. See Section 5 for a description of the bootstrap format. A summary of illegal expression, the value of the LOCATION counter for each duplication. The expression must equal some finite value n. The source statement then appears n times, not n+1 times. An example of this pseudo-operation is found in Section 3. When the expression equals zero, the following source line is not assembled. END - End of Source Program pseudo-operations when LOCATION OPERATION VARIABLE normal END expression assembling with he BOOT pseudo-operation are as follows: 1. ORG when the expression is relocatable; 2. EXTRN This pseudo-operation gives the programmer the capa- 3. ENTRY 4. CLEAR bility to specify to LEAP that the end of the source program is reached and that the value of the expression in the 5. COMN VARIABLE field defines the location of the first instruc- 6. OS 7. EQUR when the expression is relocatable; tion to be executed at run time. THERE MUST BE ONLY ONE END PSEUDO-OPERATION IN A SOURCE PROGRAM. Each of these pseudo-operations requires either relocatable items or special type codes. Since bootstrap format When LEAP encounters the END pseudo-operation, the following action takes place: requires absolute assembly and has no provision for relocation, each of these will have the "B" error code printed on PASS 1 the listing with the source line in which they appear. The Location Counter used for value and mode assignment is dependent on the mode of assembly at the time the DUP.Duplicate the Next Source Line END pseudo-operation is encountered. If LEAP is procesLOCATION OPERATION VARIABLE normal DUP expression sing absolute statements, the mode and value assignment is absolute; if LEAP is processing relocatable statements, the mode and value is relocatable. 1. The literal table is examined. For each literal found, LEAP assigns the value and mode of the LOCATION counter for reference during pass 2. The LOCATION This pseudo-operation gives the programmer the capa- counter is incremented by one for each literal; thus, the bility to specify to LEAP that the next source statement value assigned for later reference is actually the location should be duplicated the number of times specified by the expression in the VARIABLE field. The expression in the VARIABLE field must be absolute and if any symbol appears in the expression, the symbol must have been previously defined (no forward reference); violation of this rule causes the error code "P" to be printed on the listing. If the source statement that follows the DUP pseudooperation causes object code to be generated, the LOCATION counter will be increased the appropriate amount for 3-2 each duplication. If the asterisk is used as an element in the of the literal. 2. LEAP now prints a message signifying the completion of Pass 1 on the system's tele-printer, and waits for operator action before continuing. PASS 2 1. A listing of the literals and their values (if any exist) is printed. 2. The literals are output in the proper object code format. 3. A listing of all symbols and their values (in alphabetic SKIPF - Skip If False order) is printed if the LSTSY pseudo-operation has been encountered. 4. The expression in the VARIABLE field is evaluated. If LOCATION OPERATION normal SKIPF VARIABLE first expression, nothing is entered in the VARIABLE field, LEAP out- second expression, puts the END/JUMP object code and makes the address of the jump equal to absolute zero. If an expression is entered, the resultant value is the address of the iump. 5. An end-of-assembly message is typed on the systems The pseudo-operation gives the programmer the capability to specify to LEAP that a portion of the program should be conditionally excluded from the assembly process, dependent on the first expression being false. teleprinter. Both of the expressions in the VARIABLE field must be absolute. Any symbols used in the expressions must be ORG - Set Program Origin previously defined. If either (or both) of these conditions is LOCATION OPERATION VARIABLE normal ORG expression not met, the error code "P" is printed on the listing and the value of the first expression is set to zero (false). When LEAP encounters a SKIPF pseudo-operation, it evaluates the first expression in the VARIABLE field. If the value of the expression is not zero (true), the remainder of the line is ignored and LEAP proceeds to the next source This pseudo-operation gives the programmer the capa- line in the normal manner. If the value of the first expres- bility to specify to LEAP that the LOCATION counter sion is zero (false). LEAP evaluates the second expression. should be set to the value of the expression in the VAR 1- The resultant value is the number of subsequent source ABLE field. The LOCATION counter may be set absolute lines skipped. If the LIST pseudo-operation is in effect, the or relocatable depending on whether the expression in the skipped source lines are listed. VARIABLE field is absolute or relocatable. In the example below, the programmer specifies that When LEAP encounters the ORG pseudo-operation, the the 2 lines following the SKIPF should not be included in expression in the VARIABLE field is evaluated and the the program, if the value of the symbol, DEBUG, is zero LOCATION counter is set to the value and mode of the (false). If the value of DEBUG is not zero (true). the 2 lines expression. should be included. When LEAP is assembl ing bootstrap formatted object If the programmer chose not to define DEBUG, it code, the expression in the VAR IABLE field must not be would be a phase error (error code "P"), forcing the value relocatable. If the expression is relocatable, the error code of the first expression to be zero, and the next 2 lines "B" is printed on the listing with the source statement. would be skipped. LOCATION 123456 OPERATION VARIABLE 1 8 9 10 11 12 13 14 15 20 25 ItJ es UG •2. iT'i Plr: p" I~ S.E ~ P 1= r L O~ I~ J MM C!0 ~ ~. P I ! '2 E COMMENTS 132 ~ BE EINI I I I 35 i 40 ' - 45 50 55 I - I [ftf; ~- ~ HE-It) .. ;:.. m 3-3 SKIPT - Skip If True skipped. If the LIST pseudo-operation is in effect, the skipped source lines are listed. LOCATION OPERATION normal SKIPF This coding form example illustrates: VARIABLE 1. use of SKIPT and SKIPF 2. program being modified at assembly time, dependent first expression, on the parameter, ARG, and second expression 3. program being modified at execution time, dependent on the same parameter, ARG. The following discussion explains each line of the The pseudo-operation gives the programmer the capa- example. Assume that ARG is defined earlier in the pro- bility to specify to LEAP that a portion of his program gram and that it has only four values: 0,1,2, or 3. should conditionally be excluded from the assembly pro- SKIPT ARG, 2*ARG cess, dependent on the first expression being true. Both of the expressions in the VARIABLE field must If ARG=O, the next, and subsequent lines are assembled be absolute. Any symbols used in the expressions must have in the normal manner. If ARG=l, 2* ARG lines are skipped been previously defined. If either (or both) of these condi- (2) and assembling resumes at A 102. If ARG=2, 4 lines are tions is not met, the error code "P'. is printed on the listing skipped and assembling resumes at A 104. If ARG=3, 6 lines and the value of the first expression is set to zero (false). are skipped and assembling resumes at Al05+1. When LEAP encounters a SKIPT pseudo-operation, it evaluates the first expression in the VARIABLE field. If the value of the expression is zero (false), the remainder of the SKIPF ARG-3,9 If ARG=3, none of the lines A 100 thru A 105 are line is ignored and LEAP proceeds to the next source line in assembled; therefore, there is no clear loop and all lines the normal manner. If the value of the first expression is down to, but not including, DONE are skipped (if not zero (true), LEAP evaluates the second expression. The 3-ARG=O, 9 'lines are skipped). resultant value is the number of subsequent source lines assembling resumes with the next line. LOCATION 123456 OPERATION Is lit ... 1t'1 iOls 4' 012. ~ I 0 I'J 05 ~ \0 ~ ~ I 0 Is ltIJ ~ p OS m 20 Dis 1 5 kIn I~R G- 13:. () ~ T~ ICIGl \JIN T 5 T~ I Nt. J MP e \C. Q, , I 55 50 , I I I Ci3 -~ IR~ ) jj IZ ~m 45 Hi L /"II. T ~~ =A Ilol~ 40 35 tt I 1 o~ PI) COMMENTS 132 25 i2. iA IR e 11 Ii 11 0 NX Df I~ e VARIABLE 7 8 9 10 1112 13 14 15 ~ 1O 10 ~ I en If ARG=3, normal mE I I I I I I I I ClfJ UIH T I L0 fJiP I I i ttt I -- ifF-- LDI (3-ARG)*2 DATA GENERATING PSEUDO-OPERATIONS The value loaded into the A-register (immediate) is The pseudo-operations described in this section are: dependent on the value of ARG. If ARG=O, the value DC - DATA CONSTANT loaded is 6,(3-0)*2=6 with 6 the number of locations to be PTR - ADDRESS POINTER cleared (if ARG=O, none of the lines A 100 thru A 105 are TXT - CHARACTER STRING skipped). If ARG=1, the value loaded is 4; if ARG=2, the Because the syntax for expressions in the LEAP lan- value is 2. If ARG=3, this instruction or the next 8 instructions are not included in the program (the SKIPF would guage is not ambiguous, only two pseudo-operations (DC have skipped). and TXT) are required for generating data values within a TWA program. It should be noted that data of different types (decimal, hexadecimal, USASCII, address) can be generated This instruction forms the negative of the count for the loop counter. from one source line; it is not necessary to have a different DC statement for each of the different types. Up to 7 subfields per source line can be written. The maximum number STACOUNT Initializes the loop counter LDX = A105 This instruction initializes the index register to point to the first location to be cleared. CLA Clears the A-register for storing into the locations to be cleared. LOOPSTA 0,1 or words reserved with one DC statement is 28. It is sometimes desirable to have what may appear to be superfluous operations; i.e., two different operations may be used to generate the same result. This is the case with the DC and PTR pseudo-operations. By using the DC pseudo-operation, it is possible to duplicate any of the capabilities provided with the PTR pseudo-operation. The reason for having the PTR pseudo-operation is to provide a convenient documentation aid. As a courtesy to others who may have to understand a program, it is recommended that the PTR pseudo-operation be used whenever an address or indirect address constant is used. This will make it easy to quickly differentiate between actual data and pointers to memory locations (both of which may be data, but the intended functions are not the same). Clears the location pointed to by the index register DC - Data Constant DNX 1 LOCATION OPERATION normal DC LKJ VARIABLE Decrements the index register by 1. Each time through the loop, the index register points to the next location to exp 1, exp 2, ... , expn be cleared. This pseudo-operation gives the programmer the capa- INC COUNT bility to have LEAP convert certain types of data and Increments the loop counter by 1, making it less negative. expressions into the hexadecimal code used by the MAC 16. If there is a symbol in the LOCATION field, the value JMP LOOP and mode of the symbol will be the value and mode of the LOCATION counter at the time the symbol is encountered. When the loop counter reaches 0, this instruction is The optional OPERATION sub-field (,K) is the field skipped and execution resumes at DONE. Otherwise, the size (in words) that will be generated for each value and computer will go back to LOOP for its next instruction. may be an evaluative absolute expression (no forward or 3-5 \ external references) that results in an integer in the range The DC pseudo-operation generates each value in the 1::;K:S4. If K is not in the range 1::;K~4, the error code list into a field whose size is K words (if K is specified) or "0" will be printed on the listing on the line of the source one word (if K is not specified). When the field size to be generated for each value is one statement and K will be assumed to be 1. The LOCATION counter will be incremented by the value of K for each expression in the VARIABLE field of the DC pseudo-operation. 1. Single precision fixed-point decimal data. The expressions in the VARIABLE field must follow 2. Hexadecimal values of from one to four hexadecimal the rules described in Section 2 - Expressions. Any legal digits. If fewer than four hexadecimal digits are written, expression may be written in the VARIABLE field. If two the digits are right justified in a data word with leading or more expressions are written, there must be a comma (,) hexadecimal zeros instead. If more than four digits are between the expressions. Up to 7 expressions can be written, the last four are entered in a data word and the written in the VARIABLE field. remaining digits are truncated. F 0000 0001 0002 0003 0004 0005 0006 0007 0008 0009 OOOA OOOB OOOD OOOE OOOF 0010 R R R R R R R R R R R R R R R R R 0011 0012 0013 0014 0015 0016 0017 0018 0019 001A R R R R R R R R R R oooe C E E E *1 OK 3-6 word, the expressions in the value list must be evaluated as one of the following: 0218 FFEA 0001 0001 D3C4 00D3 0000 0218 FFFF FFEA 0000 0001 0001 2345 0000 C5C3 0042 0010 0000 0000 0000 0010 0000 0000 0000 OC8F 4132 3D70 0000 EXAMPLE OF DC PSEUDO-OPERATION 0001 * 536., - 22., 1, $12345, , SD' , 'S' 0002 EXl DC 0003 EX2 DC., 2 536,-22.,1.,$12345., 'LEC' 0004 EX3 0005 START 0006 EX4 DC EQUR DC., 2 $42R *-1 , START"3. 14B5.,3.14 0007 END Example: Value $ ABC OABC $12345 2345 3. eight digits and character strings of up to four characters may be used. Dataword When K=4, double precision floating point data; hexa- USASCII text of one or two characters. A 2-character decimal values of up to sixteen digits and character strings of up to eight characters are allowed. string fills a word. A single character is placed in the right byte of a word and zeros are placed in the left byte. If a character string contains more than two Examples of the DC pseudo-operation follow. characters, an error is noted and the last two characters \ I are entered in the data word. Note that in the example listing, there is an error code "c" to 4. A symbol. The value of the symbol becomes the data entry. $ 12345 is incorrect because it takes more than a single When K=2, double precision fixed point data; single word to convert it. In Ex. 3, $42R is incorrect because 'R' precision floating point data; hexadecimal values of up to the left of each incorrectly converted line. In Ex. 1, is not a legitimate hexadecimal character. I PROGRAMMER DATE PROGRAM LOCATION 123456 * s: IE )(i " OPERATION 7 A ~ Die E)( 2 EX 3 DC EX ~ ~ $ 1 2 13 45 ,1' 2 1, $ i 2 I~ 4fS tl' $~ ~- ,s ~ 11 m 35 40 I¢ -~ pie RA rtlI ¢~ 1.5 3',-Z2 I- l!i 3 COMMENTS 132 ,25 20 Pl e ~ F 10 c PS DC ,,2 srr ~ IRtf VARIABLE 8 9 10 1112 13 J4 15 ,14Ie 15 • I ! I I I ,3 JI I L +Hi I -r ++ s· I 45 50 1m 55 i--- f-f- I tt lit I tt1 ill T T I I I I ! I 1 tt L ITT T ~ ! T I 3-7 PTR - Address Pointer LISTING CONTROLLING PSEUDO-OPERATIONS LOCATION OPERATION VARIABLE normal PTR exp The following paragraphs describe those pseudo- opera.tions provided in the LEAP language to give the programmer control over the documentation of a program. None of the pseudo-operations in this section have any effect on the object code produced by LEAP. The pseudo- This pseudo-operation gives the programmer the capability to generate a single word of data. Although there is no restriction to the type of single-word data that can be generated, it is recommended that the use of the PTR pseudo-operation be limited to generating address or indirect address words. operations described in this section are: EJECT - Skip to the top of the next page* LIST - List during Pass 2 NLiST - Don't list during Pass 2 SPACE - Space N lines before resuming listing* TITLE - Heading to be printed at top of page* LSTSY - List symbol table in alphabetical order *These pseudo-operations are not listed unless the pseudo- TXT - CHARACTER String LOCATION OPERATION normal TXT, MM operation is stated. VARIABLE Character String EJECT - Skip To The Top Of The Next Page LOCATION OPERATION VARIABLE normal EJECT ignored This pseudo-operation enables the user to assemble a character string for use as data. The character string is a USASCII text string as described in Section 2. The character string is assembled in binary-coded form, two characters per word. A blank is inserted as the second character of the last word if the number of characters is odd. The string can contain up to 58 ASCII characters per source statement and starts after one blank character following MM. Example of TXT pseudo-operation: TXT, 11 VALUE OF XX This pseudo-operation gives the programmer the capability to specify to LEAP that a new page of printed output should be started before resuming the program listing. When LEAP encounters an EJECT pseudo-operation, the following action takes place: 1. The paper in the listing output device is spaced to the start of the next page. 2. The heading (if any) and page number are printed at the top of the page. 3. The paper is spaced down four lines. 4. The listing resumes. Generates 6 words as follows: V A L U E 0 F LIST - List During Pass 2 LOCATION OPERATION VARIABLE normal LIST ignored X X This pseudo-operation gives the programmer the capaThe pseudo-operation mnemonic (TXT). the subfield bility to specify to LEAP that the program listing should be delimiter (comma). and the character count (MM) must be listed on the listing device during pass 2. The LIST pseudo- wholly contained within the operation field. Blanks within operation is printed on the listing. this field result in a misinterpretation of the statement and 3-8 improper object code is generated. When the LIST pseudo-operation is in effect, all skipped codes are listed (see SKIPF and SKIPT). The program listing will continue to be produced until TITLE - Heading to be Printed at top of Page the N LIST pseudo-operation is encountered. If neither the LIST nor NLiST pseudo-operations are encountered, LEAP LOCATION OPERATION normal TITLE VARIABLE lists the program on the listing device (see Appendix C). 'character string' NLiST - Don't List During Pass 2 LOCATION OPERATION This pseudo-operation gives the programmer the capa- VARIABLE bil ity to specify a heading to be printed on the program normal NLiST listing. The TITLE pseudo-operation is not printed on the ignored listing unless the LIST pseudo-operation is in effect. When LEAP encounters a TITLE pseudo-operation, the This pseudo-operation gives the programmer the capability to specify to LEAP that the program listing should following action takes place: 1, All of the characters in the character string are placed in not be listed on the listing device (during pass 2). The the heading buffer. 2. N LIST pseudo-operation is printed on the listing. The program listing will continue to be inhibited until a The action described for the EJECT pseudo-operation takes place. The contents of the heading buffer continues to be LIST pseudo-operation is encountered. printed on each page until another TITLE pseudo-operation is encountered. SPACE - Space n Lines Before Resuming Listing If printing is inhibited (NLIST pseudo-operation), printLOCATION OPERATION VARIABLE normal SPACE expression ing does not occur, but the characters in the character string is still placed in the heading buffer. If no TITLE pseudo-operation is encountered in the source program, the contents of the heading buffer encompass all spaces. This pseudo-operation gives the programmer the capability to specify to LEAP that the number of lines specified LSTSY - List Symbol Table by the expression in the VARIABLE field should be spaced up before resuming the program listing. The SPACE LOCATION OPERATION VARIABLE normal LSTSY ignored pseudo-operation is not printed on the listing unless the LIST pseudo-operation is in effect. The expression in the VARIABLE field must be absolute. If the expression is not absolute, the error code "E" is printed on the listing, along with the SPACE pseudo-operati on. If the listing has been inhibited (NLlST), the SPACE pseudo-operation has no effect. If the value of the expression in the VAR IABLE field is This pseudo-operation gives the programmer the capability to specify to LEAP that the assembly symbol table should be listed on the listing device (after pass 2) in alphabetical order. The LSTSY pseudo-operation is printed on the listing. When LEAP encounters a LSTSY pseudo-operation, the large enough to cause spacing beyond the bottom of the following action takes place: current page, spacing is terminated, the action described for 1. The line in which the LSTSY pseudo-operation appears the EJECT pseudo-operation is taken, and listing resumes in is printed on the listing (subject to NLiST and LIST the normal manner. pseudo-operations). 3-9 2. An internal flag is set to denote that the LSTSY commas) in the VAR IABLE field. If no symbol is encountered in the VAR IABLE field, the error code "V" is pseudo-operation is encountered. 3. When the END pseudo-operation is encountered, the printed on the listing. Symbol (name or label) table is printed in alphabetical order along with the value of each of the symbols. The most common use for the EXTRN pseudooperation is to specify the names of subroutines referenced EXTERNAL REFERENCE PSEUDO-OPERATIONS within a program, but are assembled separately. The EXTRN pseudo-operation causes the proper codes to be It is desirable to segment programs to decrease the size of source programs. When this is done, it is usually neces- produced in the object code so that the Extended Loader is able to complete linkages to subroutines. sary to reference elements that are in another segment from Although the use of the EXTRN pseudo-operation is the one being assembled. The pseudo-operations described primarily associated with subroutine reference, it is not in this section make it possible for the programmer to con- restricted to this. It is often desirable to reference an ele- veniently do this. ment or group of elements (array) that is external to the There are two pseudo-operations provided in the LEAP language for external reference and definition. If either (or both) of these pseudo-operations are used in a source program, the Extended Loader must be used to load the object code produced by the assembly process. The two pseudo-operations are: EXTRN - program. This can also be done by using the EXTRN pseudo-operation. Symbols in the VARIABLE field of an EXTRN statement may not appear as statement names in the same program as the EXTRN statement itself. These will be flagged with an error code E. The statement with the name EXTERNAL SYMBOL (DEFINED OUT- SIDE THIS PROGRAM) REFERENCE which appears in the EXTRN statement VARIABLE field is flagged with an error code S. ENTRY - EXTERNAL SYMBOL DEFINITION ENTRY - External Symbol Definition EXTRN - External Symbol LOCATION normal OPERATION EXTRN LOCATION OPERATION normal ENTRY VARIABLE VARIABLE symbol, symbol, symbol, symbol, ..... ,symbol ... ,symbol This pseudo-operation gives the programmer the capaThis pseudo-operation gives the programmer the capa- bility to specify to LEAP that the symbols appearing in the bility to specify to LEAP that the symbol (s) listed in the VARIABLE field may be referenced externally (by other VARIABLE field are external symbols (not defined within programs), the program). Programs which reference external symbols must be loaded by the Extended Loader. There must be at least one symbol in the VARIABLE field; there can be as many as 7 symbols (separated with 3-10 There must be at least one symbol and, there can be as many as 7 symbols (separated with commas) in the VARIABLE field. If no symbol appears in the VARIABLE field, the error code "V" is printed on the listing. The example below is a subroutine that refers to is external, the EXTRN pseudo-operation is used to define another subroutine; therefore, both the ENTRY and the external subroutine. If the EXTRN pseudo-operation is EXTRN pseudo-operations are used. included, the reference to SINE would have the error code "U" printed on the listing (the symbol would have been The subroutine is referenced externally as COSINE. Since the subroutine is "calling" another subroutine which undefined). PROGRAMMER DATE PROGRAM , OPERATION LOCATION 123456 IE )(1 , VARIABLE 7 8 9 10 1112 13 14 15 I: toe NiAL Er4 C~ S IINiE !~ 1\1)1) S ttx L~O~ JMl E itT «IN T!E ftIIp iO~ 25 'ex ~ IN ip LE ~ l~il 20 C.IQl Is lINE =, le2 Tf MP SI NE lE MP COMMENTS 132 35 40 50 45 I I 55 ! 1 I I I C I C!I I I I I , "F ~ STORAGE ALLOCATING PSEUDO-OPERATIONS pseudo-operation, except that the reserved area is cleared (the DS pseudo-operation does not clear the reserved area). When it is necessary to reserve an area of one or more If a symbol is encountered in the LOCATION field, the words for temporary or calculated values, LEAP provides value of the symbol will be the location of the first word of the capability of specifying that area (of any size) with just the area to be reserved and cleared. References to the other one source statement. This prevents forcing the pro- words in the area must be relative to the first word. grammer to write a line of code for each word that is to be The value of the expression in the VARIABLE field is reserved. Three pseudo-operations are described in the the number of words to be reserved and cleared. The value following paragraphs: of the expression must be absolute, and any symbols used CLEAR - CLEAR AND RESERVE AN AREA in the expression must have been previously defined (no COMN - RESERVE AN AREA IN COMMON forward reference). If the value of the expression is not DS - RESERVE A DATA STORAGE AREA absolute, or if a symbol is used that has not been previously defined, the error code "P" will be printed on the listing CLEAR - Clear and Reserve an Area with the line. Also, if nothing is entered for the expression, the error code "V" will be printed. LOCATION OPERATION VARIABLE normal CLEAR expression When LEAP encounters a CLEAR pseudo-operation, the following actions take place: 1. If there is a symbol in the LOCATION field, the symbol will be assigned the mode and value ofthe LOCATION counter. This, pseudo-operation gives the programmer the capability to specify to LEAP that an area of memory should be reserved and cleared (set to zeros) at load time. The CLEAR pseudo-operation is basically the same as the DS 2. The expression in the VARIABLE field will be evaluated. 3. The value of the expression in the VARIABLE field will be added to the LOCATION counter. 3-11 4. Object code is produced to specify to the Extended os - Reserve Data Storage Area Loader the number of words that should be cleared at load time. COMN - Reserve an Area in COMMON LOCATION OPERATION VARIABLE normal COMN expression LOCATION OPERATION VARIABLE normal OS[,K] expression This pseudo-operation gives the programmer the capability to specify to LEAP that an area of memory should be reserved at load time. The OS pseudo-operation is the same as the CLEAR pseudo-operation, except that the reserved This pseudo-operation gives the programmer the capability to specify to LEAP that an area of memory should be reserved in the COMMON area. of the symbol will If a symbol is encountered in the LOCATION field, the value of the symbol will be the location of the first word of If a symbol is encountered in the LOCATION field, the value area is not cleared. be the location of the (numerically) first wora of the area to be reserved. References to the other words in the area must be defined symbolically. The value of the expression in the VARIABlE field is the number of words to be reserved. The value of the expression must be absolute, and any symbols used in the expression must have been previously defined (no forward reference). If the value of the expression is not absolute, or if a symbol is used that has not been previously defined, the error code "P" will be printed on the listing with the line. Also, if nothing is entered for the expression, the error code "V" will be printed. the area to be reserved. References to the other words in the area must be relative to the first word. The optional OPERATION sub-field [,K] is the field I size (in words) that will be generated for the expression in the VARIABLE field and may be a evaluatable absolute expression (no forward or external references) that results in an integer in the range lsKs4. If K is not specified, it will be assumed as 1 (default condition). If K is not within the limits of from 1 to 4, the error code 0 will be printed on the listiRg on the line with the source statement and K will be assumed to be 1. The value of the expression in the VARIABLE field is the number of fields to be reserved. The value of the expression must be absolute, and any symbols used in the When LEAP encounters a COMN pseudo-operation, the following action takes place: expression must have been previously defined (no forward reference). If the value of the expression is not absolute, or if a symbol is used that has not been previously defined, the error code "P" will be printed on the listing with the line. 1. If there is a symbol in the LOCATION field, it will be assigned the current value of the COMMON counter (the COMMON counter is initialized to zero at the start of an assembly). 2. The expression Also, if nothing is entered for the expression, the error code "P" will be printed. When LEAP encounters a OS pseudo-operation, the following actions take place: in the VARIABLE field will be evaluated and the resultant value will be added to the COMMON counter. 1. If there is a symbol in the LOCATION field, the symbol will be assigned the mode and value of the LOCATION counter. 2. The value of K will be recorded. The Extended Loader assigns the external location of COMMON in memory at load time. The value assigned to 3-12 3. The expression in the VARIABLE field will be evaluated. the symbol in the LOCATION field of a COMN pseudo- 4. The value of the expression in the VARIABLE field will operation is actually the value of the offset from the start be multiplied by K and added to the LOCATION of COMMON. counter. ·..L-O-C-A-TION-,r.......,O""P-=E-=R-A""T-,O-N-r-.-----":"""V-A-=R-:-,A:"":B::":L"":E:------.--------------C-o-M-;,:;i-ENT-S-35 25 In this example, the following action takes place: 40 45 SYMBOL DEFINING PSEUDO-OPERATIONS 1. Initial values: A) LOCATION counter set to zero B) COMMON counter set to zero C) relocatable mode set D) the object is defined as extended format. 2. The first line defines E as relocatable 0 (default condition is relocatable) 3. The second line sets the LOCATION counter to 07DO (hex), absolute 4. The symbol A is assigned the absolute mode with a value of 07DO (hex) The pseudo-operations described in this section make it possible for the programmer to assign values (and mode) to symbols without necessarily relying on the value of the LOCATION counter. The pseudo-operations discussed are: EQU - SYMBOL EQUALS VALUE AND MODE OF EXPRESSED EQUR - SYMBOL EQUALS VALUE OF EXPRESSION, RELOCATABLE MODE 5. The LOCATION counter is increased to 0834 (hex) and object code is produced to tell the extended loader to REDEF - REDEFINE SYMBOL clear from 07DO to 0833 (hex) 6. The symbol B is assigned the absolute mode with a value of 0834 (hex) 7. The LOCATION counter is increased to 0898 (hex) EQU - Symbol Equals Value and Type of Expression LOCATION OPERATION VARIABLE symbol EQU expression 8. The symbol C is assigned the absolute mode with a value of 0897 (hex) 9. The LOCATION counter is set to relocatable 0 10. The symbol D is assigned the relocatable mode with a value of 0000 This pseudo-operation gives the programmer the capa- 11. The LOCATION counter is increased to 0032 (hex) 12. The symbol TEMPl is assigned the value of the COMMON counter (0000) 13. The COMMON counter is increased to 0001 (hex) 14. The symbol TEMP2 is assigned the value of the COMMON counter (0001 ) bility to specify to LEAP that the symbol appearing in the LOCA TI ON· field is to be assigned the value and mode of the expression in the VARIABLE field. If a symbol is not entered in the LOCATION field, the error code "S" is printed on the listing. If no expression is entered Oeft blank), the error code "V" is printed on the 15. The COMMON counter is increased to OOOB (hex) listing. Any symbols used in the VARIABLE field must be 16. The sy mbol TE MP3 is assigned the val ue of the previously defined; if not, the error code "P" will be COMMON counter (OOOB) printed on the listing. 3-13 EQUR - Symbol Equals Value of Expression, Relocatable MISCELLANEOUS PSEUDO-OPERATIONS Mode The pseudo-operations discussed in the section are: LOCATION OPERATION VARIABLE SETB - SET THE LOADING B FLIP-FLOP RESB - RESET THE LOADING B FLIP-FLOP symbol EOUR expression PRINT - PRINT DURING PASS 1 SETB - Set the Loading B Flip-Flop This pseudo-operation gives the programmer the capability to specify to LEAP that the symbol appearing in the LOCATION OPERATION VARIABLE normal SETB ignored LOCATION field is to be assigned the value of the ex pression in the VARIABLE field, but that the mode assignment is relocatable. If a symbol is not entered in the LOCATION field, the error code "S" is printed on the listing. If no expression is entered (left blank), the error code "V" is printed on the listing. Any symbols used in the VAR IABLE field must be previously defined; if not, the error code "P" will be The SETB pseudo-operation enables the programmer to specify to LEAP that the status of the B flip-flop is a "one" . 1. SETB generates type code 16 (see Section 5), which is a printed on the listing. directive to the Extended Loader indicating that automatic depaging should be through the fixed base page REDEF - Redefine Symbol LOCATION OPERATION VARIABLE 2. (location 51210-102310). If LEAP is assembling object code in bootstrap format, SETB is used to specify to LEAP that the correct base normal REDEF Symbol, page expression 51210-102310). Any memory reference instruction of the program is page ·1 (locations must reference a location either in the local page or to page one. Otherwise, the error code "B" appears on the The REDEF pseudo-operation, like EOU, enables the user to define a symbol by assigning it the value and mode of the expression in VAR IABLE field. The REDEF pseudo-operation differs from the EOU pseudo-operation in that any symbol defined by a REDEF is redefined later by means of a subsequent REDEF. If a symbol defined via a REDEF pseudo-operation is redefined but the user writes an EOU instead of a new listed source line. If neither SETB nor RESB appears at the beginning of the program, LEAP assumes that the B flip-flop is a "1" (initial or default condition). The extended loader's B flip-flop can also be set via the SEX machine instruction. This instruction acts as a pseudooperation also, and generates a type code 16 on the object tape or control error detection. REDEF pseudo-operation, LEAP prints an "M" error code and retains the earlier definition. RESB - Reset the Loading B Flip-Flop If symbol is not entered in the VARIABLE field, the error code "S" is printed on the listing. If no expression is LOCATION OPERATION VARIABLE normal RESB ignored entered (left blank), the error code "V" is printed on the listing. Any symbols used in the variable field must be previously defined; if not, the error code "P" will be printed on the listing. 3-14 The RESB instruction enables the programmer to are generally used as an aid for programming in-line specify to LEAP that the status of the B flip-flop is a standard functions in which the sequence of operations "zero". (instructions) does not vary, but the expressions in the 1. RESB generates type code 17 (see Section 5) which is a VARIABLE fields (parameters) do. This is illustrated in directive to the Extended Loader indicating that auto- Example 1 which defines a double precision, fixed point 2. matic depaging should be through the floating base page add. (The contents of location 0 and 0+1 are added to the (refer to MAC 16 Programmer's Manual). contents of location E and E+1. The result is stored in If LEAP is assembling object code in bootstrap format, locations F and F+1. HALT is the location of the overflow RESB is used to specify to LEAP that the correct base error routine.) page of the program is relative to the current LOCA- A macro definition must precede its first calling state- TION Counter value (refer to page control in the MAC ment. A macro is defined when LEAP encounters the 16 Programmer's Manual). special character Any memory reference # in the first column of a location field. instruction must reference a location either in the local This is the macro header. All statements within the macro page or to the correct floating base page. Otherwise, the definition are called model statements and, except for the error code "B" will appear on the listed source line. If last statement are terminated with the special continuation neither SETB nor RESB appear at the beginning of the character (;). The collection of model statements for a program, LEAP will assume that the B flip-flop is a "1" macro comprise the "macro skeleton". The last statement (initial or default condition). signals the end of the macro skeleton (by failing to have the The extended loader's B flip-flop can also be reset via continuation character). the REX machine instruction. This instruction acts as a pseudo-operation also, and it generates a type code 17 on the object tape. Parameters The parameters of a macro are the operands of the reference or calling statement. Within a macro definition, PRINT - PRINT During Pass 1 LOCATION OPERATION normal PRINT the parameters are represented by the special character pound sign (#) followed by either a number or an asterisk VARIABLE 'character string' followed by a number e.g. #2 or #*2. Since macros are positional rather than key-word, #1 refers to the first parameter on the reference statement, #2 refers to the second parameter on the reference statement, etc. #* 1 refers to the This pseudo-operation gives the programmer the capability to have the remarks specified by the USACII character string printed on the systems teleprinter during pass 1. No object code is generated by the PR I NT pseudo-operation. The characters in the character string of the source line are printed on the teleprinter as they are; no scan takes place. Assembling continues with the next source line in the normal manner. indirect attribute associated with the first parameter on the reference statement, #*2 refers to the indirect attribute associated with the second parameter on the reference statement, etc. I n a model statement, a reference to a parameter may be written anywhere an item of an expression can be written. However, parameter references are meaningful only within the VARIABLE or OPERAND field of the model statement. The values of the parameters will normally be different each time the macro is called or referenced. Macro definitions and references need not agree in number of param- MACRO Definition eters. However, parameters not defined on the reference line will have the value zero. The error code "A" will A macro is a group of one or more statements inserted whenever a corresponding macro reference or call occurs. appear on the listing if no parameters appear on the reference line. Macros are, in a sense, analogous to subroutines which can A macro is referenced or called by writing the name of be called by a reference or calling statement. Like a sub- the macro in the OPERATION field of a statement. The routine, a macro has a name by which it is called. Macros VARIABLE field of the calling statement will contain the 3-15 parameters to the macro. If more than one parameter is to In this example, argument substitutions are made. When be supplied to the macro, the parameters are written one the macro name DADD is encountered in the OPERATION after the other, separated by commas. The last parameter is field, the object code corresponding to the following source not followed with a comma. The maximum number of lines is inserted in its place: parameters capable of being passed to the macro is seven. REX C, V LDA D+1 ADD E+1 Parameter substitution is positional rather than key- STA F+1 word, i.e., the first parameter is equated to (#1) in the LDA D #2', ADC etc. Other symbols besides those used as parameters in macro calls may also be included in macro definitions. In ADD STA addition, the reserved symbols C,V,R,S,B, and H may be SNV used in a macro as in example 1, where C and V are used. JMP macro expansion, the second parameter is equated to LOCATiON VARIABLE OPERATION 20 25 E F HALT COMMENTS 50 -r~-+-r+-r+-r+-r+-r;-~-r~~-r+-r+-r;-~-r+-r+~;-+4-+-+-r H=-1-LF~4=f=4-+-+-+--+-+-+-+-+--I-4--JH .J- f++-++-t-HI-'-f'-t--t-'-H-t'-+-++-++~-'I-'-l.:::.pH-'=t-=-t'--!=l"'+--""+-++-t-+--l-+-f-+-+-++-+++-+-+-4--JI-I-+-HJ. .J-..JI.....L.-L.-l.-I.--I.--l--1-.L-1-I--L-L-J.--l--'--'--I-L-I_J •. 3-16 i ..1 If the following code had been written, using the above macro definition: 1 8 9 10 1112 13 14 15 la I~P COMMENTS VARIABLE OPERATION LOCATION 123456 132 25 20 ,~ 12 Is ,.AI. O~ olt LP A 45 40 35 , I II' I "IA Ltr '- 55 50 I T 1< «, I I The JMP' *+2 instruction would cause a jump to the the following coding is generated: second word of the macro definition, not the source line LDA ALPHA following the DADD operation. For this reason, it is recom- STA BETA mended that relative notation not be used preceding macro When the MOVE MACRO IS CALLED BY; calls, especially, if the programmer has macro definitions MOVE 5, ALPHA, BETA that generate more than one instruction. the following coding is generated: LDX =5 LDA ALPHA, 1 macro is called by: STA BETA, 1 MOVE 1, ALPHA, BETA JMP This macro uses SKIPT and SKIPF. When the MOVE DNX LOCATION I 2 3 4 5 6 OPERATION 7 8 9 10 1112 13 14 15 ~ lEX AM PL E Z ~ I !TH I~ I.., AC Ii< 125 * Ahl ~ T~ Er2· l- 20 :0 LD ~ S S L ~~ L alA ~ IT~ Ie 1~11 J iN P ttt M~ vI:. WT Tll E F f6 WI .. ~I\ itt. Ir ~ IdT "'iT ~ I. ~iQ Eli. " I I: n: 45 40 50 55 rl~ tt I III 2 i I ~3 ) ~I I =:fI: ii M~ It I ) It I, I. I. i 1.1 ) I ~~ I- ~IF IE L ~Ic IIC !R I - l- 13 l- lellIs I.oJk It: I J i) I I" I~ :i ~ 13 l- f- 35 I OJN E MEM ~It '~ ~U~ ~ ~I~ ViE COMMENTS 132 I 5T rI1r.l lr:.r: I VARIABLE 25 * -3 I I -I-fI-f- • I I I r I =ttt -Ht I I I I - n ill r'- 3-17 Example 3 illustrates a technique of microcoding the MAC 16 through LEAP. When LEAP encounters "TAL14" This particular instruction could have been generated by "TAL9". The purpose of generating the new operation code is for ease in documentation. This particular in the OPE RATI ON field of a source line, it generates instruction will logically OR the contents of the A register object code of type 1 (see Section 5) consisting of 0589. Into register L 1 and L4. PROGRAMMER DATE PROGRAM LOCATION 123456 7 ~ERAT~ 8 9 11 12 13 14 15 VARIABLE 20 l(} 132 25 E"" 1.6 lulc LIE JH ~ ~ ~Ir All- I~ I)~ 1\1 IA t' 12 ~ bEI~ l NIEls ~b 5 Be AN ~ Hi PE 40 R~IT 1~ tl ~ ~ DIE I I I I 3-18 COMMENTS 35 45 ceO 55 Section 4 Assembling MAC 16 Instructions This section contains information on the assembly current page or the base page. In the bootstrap format, any process performed by LEAP when the mnemonic for a reference outside the current page causes the error code MAC 16 instruction is encountered in the OPERATION "B" to be printed on the listing. field. The process performed by LEAP varies with the type The address subfield is terminated with either a blank of instruction encountered. The six classifications of MAC character or a comma (,). If a comma is encountered, the 16 instructions are: next subfield is evaluated for indexing. The value of the CLASS 0: 16 BIT, UNMODIFIED the address subfield, the error code" A" is printed on the index subfield is treated modulo 1. If nothing is entered in listing. No entry is allowed in the VARIABLE field on this class of instructions. If any entry is encountered, the error code "V" is printed on the listing. The following instructions are in Class 0: ABA - Absolute Value of A ADC - Add Carry to A CLA - Clear A HLT-Halt JMA - Jump Direct Thru A LSB - Load A (0-5) with status of C,V,R,S,B and H NOP - No Operation ONA - One's Complement of A SSB - Store AO-5 into status bits C,V,R,S,B and H TLA - Transfer Level to A TSA - Transfer Switches to A TWA - Two's Complement of A The following instructions are in Class 1: ADD - Add Memory to A ANA - AND memory with A CAA - Compare A with Memory Arithmetically INC - Increment Memory and Skip if Zero JMM - Jump and Mark JMP - Jump JR L - Jump and Reset Level LOA - Load A from Memory LOX - Load I ndex from Memory ORA - OR from Memory to A STA - Store A in Memory STL - Store Left Byte of A in Memory STR - Store Right Byte of A in Memory STX - Store I ndex in Memory SUB - Subtract Memory from A XXA - Exchange I ndex and A MPY - Multiply A CLASS 2: I/O INSTRUCTIONS DIV - Divide A This class of instructions requires a subfield for both CLASS 1: MEMORY REFERENCE the M and N fields. If either the M or N subfield is omitted, the error code "V" will be printed on the listing. Values in This class of instructions is the only class that allows either subfield are evaluated modulo 16. If either of the indirect addressing and indexing. The first subfield in the values is too large (more than 4 bits), the error code "F" is VARIABLE field is evaluated and a 16-bit address is pro- printed on the listing. The M subfield is equivalent to the duced, if in the extended format; if in the bootstrap for- address subfield of a memory reference instruction, and the mat, the address is checked for reference outside the N subfield is equivalent to the index subfield. 4-1 ARI - Arithmetic Right Shift & Insert The following instructions are in Class 2: EAI - External Address In ARS - Arithmetic Right Shift ECO - External Command Out DNX - Decrement Index and Skip on Zero EDI - External Data In INX - Increment Index and Skip on Zero EDO - External Data Out JIX - Jump Indirect Thru Index ESI - External Status In JMX - Jump Direct Thru Index CLASS 3: SKIP INSTRUCTIONS Index LAX - Load A Direct from Memory Location Specified by LI X This class requires an entry in the VARIABLE field. If Load A I ndirect from Memory Location Specified by Index nothing is encountered, the error code "V" is printed on LLC - Logical Left Shift, Closed the listing. The VARIABLE field is evaluated in the follow- LLI - Logical Left Shift & Insert ing manner: LLN - Logical Left Shift, No Change to C 1. If the value in the VARIABLE field is in the range of a to 15 inclusive and the mode is absolute, the value is 2. LLO - Logical Left Shift, Open LRC - Logical Right Shift, Closed inserted directly into the N field of the instruction. LR I - Logical Right Shift & Insert If the value in the VARIABLE field is greater than 15 LRN - Logical Right Shift, No Change to C or the mode is relocatable, it is assumed to be a mem- LRO - Logical Right Shift, Open ory address. LEAP computes the N value required to SAX - Store A in Location Specified by Index skip to the specified memory location (forward only). SIX - Store A Indirect thru Location Specified by Index If the resulting value is larger than 4 bits, the error code TAL - Transfer A to L Register "F" is printed on the listing; the value is truncated to 4 CLASS 5: IMMEDIATES bits and inserted into the instruction's N field. The following instructions are in Class 3: This class of instructions requires an entry in the SAG - Skip if A is Greater than Zero VARIABLE field. If nothing is encountered, the error code SAN - Skip if A is Negative "V" is printed on the listing. The VARIABLE field is SAZ - Skip if A is Zero evaluated modulo 256; if the value is greater than 255 SKN - Skip if A is Normalized (more than 8 bits), the error code "F" is printed on the SKP - Skip Unconditional listing. SKX - Skip if Index is Zero The following instructions are in Class 5: SLZ - Skip if Least-Significant Bit of A is Zero ADI - Add I mmediate to A SNB - Skip if Base Page Control is Zero LDI - Load A Immediate SNC - Skip if C is Zero SBI - Subtract Immediate from A SNH - Skip in Interrupt Not Inhibited SNV - Skip if V is Zero SNR - Skip if R is Zero SNS - Skip if S is Zero CLASS 4: N FI ELD This class requires an entry in the VARIABLE field. If This class of instructions requires an entry in the VAR 1ABLE field. If nothing is encountered, the error code "V" is printed on the listing. The VA R I AB LE field is evaluated modulo 64; if the value is greater than 63 (more than 6 bits). the error code "F" is printed on the listing. nothing is encountered, the error code "V" is printed on The following instructions are in Class 6: the listing. The VARIABLE field is evaluated modulo 16; if SEX - Set Sense Indicator the value is greater than 15 (more than 4 bits). the error REX - Reset Sense I nd i cator code "F" is printed on the listing. The following instruc- 4-2 CLASS 6: STATUS MODIFIERS For these instructions, the indicators may be repre- tions are in Class 4: sented by any combination of the reserved symbols ALI - Arithmetic Left Shift & Insert C,V ,R ,S,B and H. When writing the indicators on a coding ALS - Arithmetic Left Shift sheet, they are separated by commas U. Section 5 SOURCE PROGRAM PREPARATION Input/Output Page Format This listing is printed on continuous form paper. If the If cards are not used for the source program, prepare a paper tape according to the following instructions: teleprinter is being used, the output routine keeps a line count so that spacing is in 11 inch increments. The follow- Preamble-Start-Of-File ing are the specifications for the page format. There are a total of 66 lines on an l1-inch page (6 lines per inch). The preamble character ($81) must be used. It is formed (on TTY) by simultaneously depressing the CTRL
Source Exif Data:File Type : PDF File Type Extension : pdf MIME Type : application/pdf PDF Version : 1.6 Linearized : No XMP Toolkit : Adobe XMP Core 4.2.1-c041 52.342996, 2008/05/07-21:37:19 Create Date : 2018:05:15 09:38:24-08:00 Modify Date : 2018:05:15 09:50:43-07:00 Metadata Date : 2018:05:15 09:50:43-07:00 Producer : Adobe Acrobat 9.0 Paper Capture Plug-in Format : application/pdf Document ID : uuid:fd2d5de6-7b35-e84d-abd0-e45496b5b42c Instance ID : uuid:6c73d26e-ba06-c24e-a2c2-8cf04c36f691 Page Layout : SinglePage Page Mode : UseNone Page Count : 54EXIF Metadata provided by EXIF.tools