Digital PDFs
Documents
Guest
Register
Log In
AA-4159C-TM
May 1978
225 pages
Original
6.3MB
view
download
Document:
Macro Assembler Reference Apr78
Order Number:
AA-4159C-TM
Revision:
0
Pages:
225
Original Filename:
AA-4159C-TM_Macro_Assembler_Reference_Apr78.pdf
OCR Text
MACRO ASSEMBLER Reference Manual Order No. AA-4159C-TM MACRO ASSEMBLER Reference Manual Order No. AA-4159C-TM To order additional copies of this document, contact the Software Distribution Center, Digital Equipment Corporation, Maynard, Massachusetts 01754 digital equipment corporation · maynard, massachusetts First printing, February 1976 Revised, April 1977 Revised, April 1978 The information in this document is subject to change without notice and should not be construed as a commitment by Digital Equipment Corporation. Digital Equipment Corporation assumes no responsibility for any errors that may appear in this document. The software described in this document is furnished under a license and may be u~ed or copied only in accordance with the terms of such license. Digital Equipment Corporation assumes no responsibility for the use or reliability of its software on equipment that is not supplied by DIGITAL. Copyright ~ 1976, 1977, 1978 by Digital Equipment Corporation The postage prepaid READER'S COMMENTS form on the last page of this document requests the user's critical evaluation to assist us in preparing future documentation. The following are trademarks of Digital Equipment Corporation: DIGITAL DEC PDP DECUS UNIBUS COMPUTER LABS COMTEX DDT DECCOMM DECsystem-lO DEC tape DIBOL EDUSYSTEM FLIP CHIP FOCAL INDAC LAB-8 DECSYSTEM-20 MASSBUS OMNIBUS OS/8 PHA RSTS RSX TYPESET-8 TYPESET-II CONTENTS Page PREFACE CHAPTER CHAPTER CHAPTER ix 1 INTRODUCTION TO MACRO 1-1 1.1 1.2 1.3 HOW THE ASSEMBLER OPERATES ADDRESSES AND MEMORY RELOCATABLE ADDRESSES 1-2 1-3 1-3 2 ELEMENTS OF MACRO 2-1 2.1 SPECIAL CHARACTERS NUMBERS 2.2 2.2.1 Integers 2.2.2 Radix 2.2.3 Adding Zeros to Integers in Source Code 2.2.4 Fixed-Point Decimal Numbers 2.2.5 Floating-Point Decimal Numbers Binary Shifting 2.2.6 Underscore Shifting 2.2.7 2.2.8 Querying the Position of a Bit Pattern LITERALS 2.3 SYMBOLS 2.4 2.4.1 Selecting Valid Symbols 2.4.2 Defining Symbols 2.4.2.1 Defining Labels 2.4.2.2 Direct Assignments 2.4.3 Variable Symbols 2.4.4 Using Symbols 2.4.5 Symbol Attributes 2.4.5.1 Local Symbols 2.4.5.2 Global Symbols 2.5 EXPRESSIONS 2.5.1 Arithmetic Expressions 2.5.2 Logical Expressions Polish (Complex) Expressions 2.5.3 2.5.4 Evaluating Expressions 2.5.4.1 Hierarchy of Operations 2.5.4.2 Evaluating Expressions with Relocatable Values 2.6 MACRO-DEFINED MNEMONICS 2-2 2-2 2-2 2-2 2-3 2-3 2-4' 2-6 2-6 2-6 2-7 2-9 2-9 2-10 2-10 2-11 2-11 2-12 2-12 2-12 2-12 2-13 2-13 2-13 2-14 2-14 2-14 3 PSEUDO-OPS 3-1 ARRAY ASCII ASCIZ .ASSIGN ASUPPRESS 3-2 3-3 3-4 3-6 3-7 iii 2-15 2-16 CONTENTS (CONT.) Page CHAPTER 3 PSEUDO-OPS (CONT.) BLOCK BYTE COMMENT • COMMON .CREF DEC DEFINE DEPHASE .DIRECTIVE END .ENDPS ENTRY EXP EXTERN • HWFRMT .IF .IFN IFx group INTEGER INTERN IOWD IRP IRPC LALL .LINK LIST LIT .LNKEND LOC .MFRMT MLOFF MLON .NODDT NOSYM OCT OPDEF .ORG PAGE PASS2 PHASE POINT PRGEND PRINTX .PSECT PURGE RADIX RADIX50 RELOC REMARK REPEAT .REQUEST .REQUIRE SALL SEARCH 3-8 3-9 3-10 3-11 3-12 3-13 3-14 3-15 3-16 3-17 3-18 3-19 3-20 3-21 3-22 3-23 3-24 3-25 3-27 3-28 3-29 3-30 3-31 3-32 3-33 3-34 3-35 3-37 3-38 3-39 3-40 3-41 3-42 3-43 3-44 3-45 3-46 3-47 3-48 3-49 3-50 3-51 3-52 3-53 3-54 3-55 3-56 3-57 3-59 3-60 3-61 3-62 3-63 3-64 iv CONTENTS (CONT.) Page CHAPTER 3 PSEUDO-OPS (CONT.) SIXBIT SQUOZE STOPI SUBTTL SUPPRESS SYN TAPE .TEXT TITLE TWOSEG UNIVERSAL VAR XALL .XCREF XLIST XPUNGE XWD 3-65 3-66 3-67 3-68 3-69 3-70 3-71 3-72 3-73 3-74 3-75 3-77 3-78 3-79 3-80 3-81 3-82 3-83 Z CHAPTER CHAPTER CHAPTER 4 MACRO STATEMENTS AND STATEMENT PROCESSING 4-1 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.7.1 4.7.2 4.7.3 4.7.4 LABELS OPERATORS OPERANDS COMMENTS STATEMENT PROCESSING ASSIGNING ADDRESSES MACHINE INSTRUCTION MNEMONICS AND FORMATS Primary Instructions Mnemonics With Implicit Accumulators Input/Output Instructions Extended Instructions 4-1 4-2 4-2 4-2 4-3 4-3 4-4 4-4 4-6 4-6 4-7 5 USING MACROS 5-1 5.1 5.2 5.2.1 5.2.2 5.2.3 5.3 5.4 5.5 5.5.1 5.5.2 5.6 5.7 DEFINING MACROS CALLING MACROS Macro Call Format Quoting Characters in Arguments Listing of Called Macros NESTING MACRO DEFINITIONS CONCATENATING ARGUMENTS DEFAULT ARGUMENTS AND CREATED SYMBOLS Specifying Default Values Created Symbols INDEFINITE REPETITION ALTERNATE INTERPRETATIONS OF CHARACTERS PASSED TO MACROS 5-1 5'-2 5-4 5-4 5-6 5-6 5-8 5-8 5-9 5-9 5-10 6 ASSEMBLER OUTPUT 6-1 6.1 6.2 6.3 THE PROGRAM LISTING FILE THE BINARY PROGRAM FILE THE UNIVERSAL FILE 6-1 6-5 6-5 v 5-11 CONTENTS (CONT.) Page CHAPTER 7 USING THE ASSEMBLER 7-1 CHAPTER 8 ERRORS AND MESSAGES 8-1 8.1 8.2 8.3 INFORMATIONAL MESSAGES SINGLE-CHARACTER ERROR CODES MCRxxx MESSAGES 8-1 8-3 8-7 9 PROGRAMMING CONSIDERATIONS 9-1 9.1 PROGRAM SEGMENTATION Single-Segment Programs Two-Segment Programs Programs With PSECTs UNIVERSAL FILES CONDITIONAL ASSEMBLY 9-1 9-1 APPENDIX A MACRO CHARACTER SETS A-I APPENDIX B MACRO SPECIAL CHARACTERS B-1 APPENDIX C MACRO-DEFINED MNEMONICS C-l MACHINE INSTRUCTION MNEMONICS I/O INSTRUCTION AND DEVICE CODE MNEMONICS KLIO EXTEND INSTRUCTION MNEMONICS JRST AND JFCL MNEMONICS C-l APPENDIX D PROGRAM EXAMPLES D-l APPENDIX E PSEUDO-OPS FOR SYSTEM COMPATIBILITY E-l CHAPTER 9.1.1 9.1.2 9.1.3 9.2 9.3 C.l C.2 C.3 C.4 HISEG RIM RIMIO RIMIOB 9-2 9-3 9-4 9-5 C-6 C-9 C-IO E-2 E-3 E-4 E-5 APPENDIX F STORAGE ALLOCATION F-l APPENDIX G ACCESSING ANOTHER USER'S FILE G-l G.l USING LOGICAL NAMES G.l.l Giving the DEFINE Command G.l.2 Using the Logical Name G.l.2.1 Command Lines G.l.2.2 User Programs G.2 USING PROJECT-PROGRAMMER NUMBERS G.2.1 Running the TRANSL Program G.2.2 Using the Project-Programmer Number G.2.2.1 Command Lines G.2.2.2 User Programs G-l G-l G-2 G-2 G-2 G-2 G-2 INDEX G-3 G-3 G-3 Index-l vi CONTENTS (CONT • ) TABLES TABLE 7-1 8-1 8-2 8-3 A-I B-1 C-l C-2 C-3 C-4 C-5 MACRO Switch Options MACRO Informational Messages MACRO Single-Character Error Codes MCRxxx Messages MACRO Character Sets Interpretations of Special Characters Machine Instruction Mnemonics I/O Instruction Mnemonics I/O Device Code Mnemonics KLIO EXTEND Instruction Mnemonics JRST and JFCL Mnemonics vii 7-3 8-2 8-4 8-8 A-I B-2 C-2 C-6 C-7 C-9 C-IO PREFACE This manual is a reference for the programmer with some assemblers and assembly languages. knowledge of Using the MACRO assembler effectively involves using other DECSYSTEM-20 facilities: the monitor, the LINK program, the CREF program, a debugging program, a text editor, and machine language. Therefore the following DECSYSTEM-20 documents will prove useful: User's Guide AD-4179B-TI Monitor Calls User's Guide AA-4166C-TM LINK Reference Manual AA-4183B-TM EDIT User's Guide DEC-20-UEUGA-A-D DDT Dynamic Debugging Technique DEC-IO-UDDTA-A-D BATCH Reference Manual DEC-20-0BRMA-A-DN3 Hardware Reference Manual EK-IOj20-HR-OOI ix CHAPTER 1 INTRODUCTION TO MACRO the DECSYSTEM-20. The MACRO is the symbolic assembler program for assembler reads a file of MACRO statements and composes relocatable binary machine instruction code suitable for loading by LINK, the system's linking loader. MACRO is a statement-oriented language; statements are in free format and are processed in two passes. In processing statements, the assembler: 1. Interprets machine instruction mnemonics 2. Accepts symbol definitions 3. Interprets symbols 4. Interprets pseudo-ops 5. Accepts macro definitions 6. Expands macros on call 7. Assigns memory addresses 8. Generates a relocatable binary program file ( .REL input to LINK 9. Generates a program listing file showing source statements, the corresponding binary code, and any errors found 10. Generates a UNIVERSAL file that assemblies can be searched file) by for other In addition to translating machine instruction mnemonics and special-purpose operators called pseudo-ops, MACRO allows you to create your own language elements, called macros. In this way you can tailor the assembler's functions for each program. Since the assembler is device independent, you can use any peripheral devices for input and output files. For example, you can use a terminal for your source program input, a line printer for your program listing output, and a disk for your binary program output. MACRO programs must input/output services. use the monitor for device-independent (See the Monitor Calls User's Guide.) 1-1 INTRODUCTION TO MACRO NOTES The following conventions throughout this manual: 1.1 are used 1. All numbers in the examples are octal unless otherwise indicated. 2. All numbers in the text are unless otherwise indicated. 3. The name of the assembler, MACRO, appears in uppercase letters; references to user-defined macros appear in lowercase letters. 4. Examples sometimes show the code generated as it appears in the program listing file. This file is described in Section 6.1. decimal HOW THE ASSEMBLER OPERATES MACRO is a 2-pass assembler; it reads your source program twice. On Pass 1, some symbolic addresses will not be resolved, if they refer to parts of the program not yet read. These symbolic references are entered in the symbol table and will be resolved on Pass 2. The main purpose of Pass 1 is to build symbol tables rUdimentary assembly of each source statement. and to make a The first task of Passl is initializing all impure data areas that MACRO uses (internally) for assembly. This area includes all dynamic storage areas and all buffer areas. MACRO then reads a command string into memory. This command string contains specifications for the files to be used during assembly. After scanning the command string for proper syntax, MACRO initializes the specified ou~put files. As assembly begins, MACRO initiates a routine that retrieves source lines from the proper input file. If no such file is currently open, MACRO opens the next input file specified in the command string. Source lines are assembled as they are retrieved from input files. Assembly Pass 2 performs the same steps as Pass 1. However, during Pass 2 MACRO writes the object code to the binary (and usually relocatable) output file; it also generates the program listing file, followed by the symbol table listing for the program. MACRO can also generate a cross-referenced symbol table. (See Chapter 6. ) During Pass 2 MACRO also flags erroneous source statements with single-character error codes. (See Chapter 7.) These error codes appear in the program listing file. 1-2 INTRODUCTION TO MACRO The relocatable binary object file created during Pass- 2 contains all binary code generated; this code is in a form suitable for loading by the LINK program. (See the LINK Reference Manual.) MACRO processes relocation counters on both passes. If a labeled statement has a different relocation value on the second pass, MACRO generates a phase error. 1.2 ADDRESSES AND MEMORY The address space of a DECSYSTEM-20 program consists of 512P (IP = 512 words), each word having 36 bits. Since the total number of storage locations is 2 to the 18th power, the address of a location can be expressed in 18 bits, or one halfword. The left halfword of a storage location is bits 0 to halfword is bits 18 to 35. 1.3 17; the right RELOCATABLE ADDRESSES Normally the binary program generated by MACRO is relocatable. This means that when the program is loaded for execution, it can be loaded anywhere in physical memory. (The address for loading is selected at load time, and depends on what has already been loaded.) Unless you specify otherwise, MACRO assembles your binary program beginning with address 0 (400000 for high-segment code). References to addresses within your program are therefore relative to 0 (400000 for the high segment), and must be changed at loading time. LINK does this by adding the load address to all such relative addresses, resolving them to absolute addresses. For programs assembled with multiple PSECT counters, each PSECT begins with the relative address o. At load time, each PSECT has its own relocation constant; PSECT or1g1ns must be selected carefully to avoid overlapping of PSECTs in memory. 1-3 CHAPTER 2 ELEMENTS OF MACRO The character set recognized in MACRO statements includes all ASCII alphanumeric characters and 28 special characters (ASCII 040 through 137). Lowercase letters (ASCII 141 through 172) are treated internally as uppercase letters (ASCII 101 through 132). MACRO also recognizes seven ASCII control codes: horizontal tab (011), linefeed (012), vertical tab (013), formfeed (014), carriagereturn (015), CTRL/underscore (037), and CTRL/Z (032). MACRO accepts any ASCII character in quoted text, or as text arguments to the ASCII and ASCIZ pseudo-ops. NOTES 1. The line-continuation character (CTRL/_) is always effective. 2. Delimiters for certain pseudo-ops (such as ASCII, ASCIZ, and COMMENT) can be any nonblank, non tab ASCII character. Characters and their codes are listed in Appendix A. A MACRO program consists of statements made up of elements. Separated into general types, these are: 1. Special characters 2. Numbers 3. Literals 4. Symbols 5. Expressions 6. MACRO-defined mnemonics 7. Pseudo-ops 8. Macros MACRO The format of a MACRO statement is discussed in Chapter 4. 2-1 language ELEMENTS OF MACRO 2.1 SPECIAL CHARACTERS Characters and combinations that have special interpretations in MACRO are listed in Appen~ix B. These interpretations apply only in the contexts described. In particular, they do not apply within comment fields or text strings. 2.2 NUMBERS The two properties of numbers that are important to MACRO are: 1. In what radix (base) the number is given. 2. How the number should be placed in memory. You can control the interpretation of these properties pseudo-ops or special characters to indicate your choices. 2.2.1 by using Integers MACRO stores an integer in its binary form, right justified in bits 1 to 35 of its storage word. If you use a sign, place it immediately before the integer. (If you omit the sign, the integer is assumed positive.) For a negative in£eger, MACRO first forms its absolute value in bits 1 to 35, then takes its two's complement. Therefore a positive integer is stored with 0 in bit 0, while a negative integer has 1 in bit o. The largest integer that MACRO can store is 377777 777777 the smallest (most negative) is 400000 000000 (octal). 2.2.2 (octal); Radix The initial implicit radix for a MACRO program is octal (base 8). The integers you use in your program will be interpreted as octal unless you indicate otherwise. You can change the radix to any base from 2 to 10 by using the RADIX pseudo-oPe (See the pseudo-op RADIX in Chapter 3.) The new radix will remain in effect until you change it. Without changing the prevailing radix, you can write a particular expression in binary, octal, or decimal. To do this, prefix the integer with AB for binary, AO for octal, or AD for decimal. The indicated radix applies only to the single integer immediately following it. 2-2 ELEMENTS OF MACRO NOTES 1. A single-digit number is always interpreted as radix 10. Thus 9 is seen as decimal 9, even if the current radix is 8. 2. In the notations for ~B, ~D, and ~O, the up-arrow in the text indicates the up-arrow character, not the CONTROL character. For example, suppose the current radix is 8. decimal number 23 as: Then you can write the octal (current radix) decimal binary But you cannot write decimal 23 as ~D45-22 since the ~D applies only to the first number, 45; the 22 is octal. However, you can write decimal 23 as ~D<45-22>. 2.2.3 Adding Zeros to Integers in Source Code You can add zeros to an integer (multiply it by a program by suffixing K, M, or G to it. K adds 3 zeros M adds 6 zeros G adds 9 zeros (K (M (G constant) in your "kilo-", thousands) "mega-", millions) "giga-", billions) These zeros are suffixed before any conversion, so that in radix la, 5K means 5000 decimal; in radix 8, 5K means 5000 octal, or 2560 decimal. 2.2.4 Fixed-Point Decimal Numbers To indicate a fixed-point decimal number, prefix it with ~F, include a decimal point wherever you wish, and suffix Bn to show that you want to place the "assumed point" after bit n in the storage word. If you omit the decimal point, MACRO assumes that it follows the last digit. If you omit the Bn, MACRO assumes B35. To handle the number, MACRO forms the integer part in a fullword register, and the fractional part in another fullword register. It then places the integer part (right justified) in bits 1 to n (n is from your Bn) of a binary word, and the fractional part (left justified) in the remaining bits. The integer part is truncated at the left, and the fractional part at the right. Bit a shows the sign of the number. 2-3 ELEMENTS OF MACRO For example, ~F123.45B8 is formed in two registers as 000000 000173 (integer part, right justified) 346314 631462 (fractional part, left justified) Since the Bn operator sets the assumed point after bit 8, the integer part is placed in bits 1 to 8, and the fractional part in bits 9 to 35. (The sign bit 0 is 0, showing a positive number.) Truncation is on the left and right, respectively, giving 173 346 314631 t assumed point You can show a fixed-point decimal number as negative by placing a minus sign before the ~F. The absolute value of the negative number is formed in two registers as a positive number, then two's complemented. This complementing sets bit 0 to 1, showing that the number is negative. NOTE The binary number resulting from AF does not show where the assumed point should be. You must keep track of this through your own programming conventions. Examples: 2.2.5 000000 000173 ~F123.45 000173 346314 ~F123.45B17 346314 631462 ~F123.45B-1 777777 777604 -~F123.45 777604 431463 -~F123.45B17 431463 146316 -~F123.45B-l Floating-Point Decimal Numbers In your program, a floating-point decimal number is a string of digits with a leading, trailing, or embedded decimal point and an optional leading sign. MACRO recognizes this as a mixed number in radix 10. MACRO forms a floating-point decimal number with the sign in bit 0, a binary exponent in bits 1 to 8, and a normalized binary fraction in bits 9 to 35. The normallzed fraction can be viewed as follows: its numerator is the binary number in bits 9 to 35, whose value is less than 2 to the 28th power, but greater than or equal to 2 to the 27th power. Its denominator is 2· to the 28th power, so that the value of the fraction is always less than 1, but greater than or equal to o. (This value is o only if the entire stored number is 0.) 2-4 ELEMENTS OF MACRO The binary exponent is incremented by 128 so that exponents from to 127 are represented as 0 to 255. -128 For a negative floating-point decimal number, MACRO first forms its absolute value as a p6sitive number, then takes the two's complement of the entire word. Examples: The floating-point number 17. generates the binary a 10 000 101 100 010 000 000 000 000 000 000 000 where bit a shows the positive sign, bits 1 to 8 show the binary exponent, and bits 9 to 35 show the proper binary fraction. The binary exponent is 133 (decimal), which after subtracting the added 128 gives 5. The fraction is equal to 0.53125 decimal. And 0.53125 times 2 to the 5th power is 17, which is the number given. Similarly, 153. generates a 10 001 000 while -153. 1 100 110 010 000 000 000 000 000 000 generates 01 110 I I I all 001 110 000 000 000 000 000 000 These two examples show that a negative number is two's complemented. Notice that since the binary fraction for a negative number always has some nonzero bits, the exponent field (taken by itself) appears to be one's complemented. As in FORTRAN, you can write a floating-point decimal number with a suffixed E±n, and the number will be multiplied by 10 to the ±nth power. If the sign is missing, n is assumed positive. Examples: 2840000. can be written 284.E+4 2840000. can be written .284E7 .0000284 can be written .284E-4 .0000284 can be written 284.E-7 Using this E notation with an integer (no decimal point) is not allowed, and causes an error. Therefore you can use 284.E4, but 284E4 is illegal. NOTE MACRO's algorithm for handling numbers given with the E notation is not identical to FORTRAN's. The binary values generated by the two translators may differ in the lowest order bits. 2-5 ELEMENTS OF MACRO 2.2.6 Binary Shifting Binary shifting of a number with Bn sets the location of the rightmost bit at bit n in the storage word, where n is a decimal integer. The shift takes place after the binary number is formed. Any bits shifted outside the range (bits 0 to 35) of the storage word are lost. For example, here are some numbers with their given in octal: 2.2.7 300000 000000 ~D3B2 000000 042000 ~D17B25 000001 000000 lB17 400000 000000 lBO 777777 777777 -lB35 000000 000001 lB35 000000 777777 -lB35 binary representations Underscore Shifting You can also shift a number by using the underscore operator. (On some terminals this is a left-arrow.) If V is an expreSSIon with value n, suffixing _V to a number shifts it n bits to the left. (If n is negative, the shift is to the right.) In an expression of the form W_V, Wand V can be any expressions including symbols. The binary value of W is formed in a register, V is evaluated, and the binary of W is shifted V bits when placed in storage. NOTE A An expression such as -3.75E4_ D18 is legal, but the shift occurs after conversion to floating-point decimal storage format. Therefore the sign, exponent, and fraction fields are all shifted away from their usual locations. This is true also for other storage formats. 2.2.8 Querying the Position of a Bit Pattern You can query the position of a bit pattern by prefixing AL (up-arrow L) to an expression. This generates the number of leading zeros in the binary value of the expression. (ALO generates 36 decimal.) 2-6 ELEMENTS OF MACRO For example, suppose the current radix is 10. "L153 generates 35 "L153. generates 1 "L-153 generates a "L-153. generates a Then (29 decimal) In the first example, "L153 generates 29 (decimal) because the representation of 153 decimal has its leftmost 1 in bit 28: binary 000 000 000 000 000 000 000 000 000 010 all 001 is in In both of the last two examples, "L-153 and "L-153. generate O. is because a negative number in any format sets bit a to 1. This But in the second example, the binary floating-point format (see Section 2.2.5), form of 153. 010 001 000 100 110 010 000 000 000 000 000 000 and its leftmost 1 is in bit 1. 2.3 LITERALS A literal is a character string within square brackets inserted in your source code. MACRO stores the code generated by the enclosed string in a literal pool beginning with the first available literal storage location, and places the address of this location in place of the literal. The literal pool is normally at the end of the binary program. (See the pseudo-op LIT in Chapter 3.) The statements 135 01 0 00 002016' LDB T1,CPOINT 6,.JBVER,17J LIT 22 06 0 00 000137 are equivalent to 135 01 0 00 002020' • • • 22 06 0 00 000137 LDB T1,PLACE PLACE: POINT 6,.JBVER,17 A literal can also be used to generate a constant: PUSH 17,[OJ ;Generate zero fullword MOVE L,C3"lJ ;Generate a wbrd with 3 in ; lefthalf and 14 in ri~hthalf 2-7 ELEMENTS OF MACRO Multiline literals are also allowed: GETCHR: ILDB T2,T1 ;Get a character CAIN T2,0 ;Is it a null? JRST [MOVE T1,TXTPTR ;Yes, retrieve pointer ILDB T2,T1 ;Get a new character CAIN T2,·?· ;Is it a Guestion mark? JRST [MOVE Tl,TXTPTl ;Yes, ~et alternate pointer ILDB T2,T1 ;Get the messa~e character JRST GETHLPJ ;Go to help routine ;Not Guestion mark, return POPJ P,J ;Not a null, return POPJ R, The text of a literal continues until a matching bracket is found (unquoted and not in comment field). closing square A literal can include any term, symbol, expression, or statement, but it must generate at least one but no more than 99 words of data. A statement that does not generate data (such as a direct-assignment statement or a RADIX pseudo-op) can be included in a literal, but the literal must not consist entirely of such statements. You can nest literals up to 18 levels. You can include any number of labels in a literal, but a forward reference to a label in a literal is illegal. If you use a dot (.) in a literal to retrieve the location counter, remember that the counter is pointing at the statement containing the literal, not at the literal itself. In nested literals, a dot location outside the outermost literal. counter references a statement In the sequence JRST [HRRZ AC1,V CAIE AC1,OP JRST .+1 JRST EVTSTSJ SKIPE C the expression .+1 generates the address of SKIPE C, not JRST EVTSTS. Literals having the same value are collapsed in MACRO's literal Thus for the statements: pool. PUSH P,[OJ PUSH P,[OJ MOVEI AC1,[ASCIZ /TEST1/J the same address is shared by the two literals [0], and by the null word generated at the end of [ASCIZ /TESTI/]. Literal collapsing is suppressed for those literals that contain errors, undefined expressions, or EXTERNAL symbols. 2-8 ELEMENTS OF MACRO 2.4 SYMBOLS MACRO symbols include: 1. MACRO-defined pseudo-ops (discussed in Chapter 3) 2. MACRO-defined mnemonics (discussed in Section 2.6) 3. User-defined macros (discussed in Chapter 5) 4. User-defined 5. User-defined labels (discussed in this section) 6. Direct-assignment symbols (discussed in Section 2.4.2.2) 7. Dummy-arguments for macros (discussed in Chapter 5) opdefs~ (discu3sed at OPDEF in Chapter 3) MACRO stores symbols in three symbol tables: 1. Op-code table: machine instruction mnemonics and pseudo-ops 2. Macro table: macros, user-defined OPDEFs, (See the SYN pseudo-op in Chapter 3.) 3. User symbol table: and synonyms labels and direct-assignment symbols An entry in one of these tables shows the symbol, its value. type, and its Symbols are helpful in your programs because: 1. Defining a symbol as a label gives a name to an address. You can use the label in debugging or as a target for program control statements. 2. In revising a program, you can change a value throughout your program by changing a symbol definition. 3. You can give names to values to make computations clearer. 4. You can make values available to other programs. 2.4.1 Selecting Valid Symbols Follow these rules in selecting symbols: 1. Use only letters, numerals, dots (.), dollar signs ($), and percent signs (%). MACRO will consider any other character (including a blank) as a delimiter. 2. Do not begin a symbol with a numeral. 3. If you use a dot for the first character, do not use a numeral for the second. Do not use dots for the first two characters; doing so can interfere with MACRO's created symbols. (See Section 5.5.2.) 4. Make the first six characters unique among your symbols. You can use more than six characters, but MACRO will use only the first six. 2-9 ELEMENTS OF MACRO Examples: VELOCITY (legal, only VELOCI is meaningful to MACRO) CHG.VEL (legal, only CHG.VE is meaningful to MACRO) CHG VEL (illegal, looks like two symbols to MACRO) ISTNUM (illegal, begins with a numeral) NUMI (legal) .1111 (illegal, begins with dot-numeral) •• 1111 (unwise, could interfere with created symbols) 2.4.2 Defining Symbols You can define a symbol by making it a label or by g1v1ng its value in a direct-assignment statement. Labels cannot be redefined, but direct-assignment symbols can be redefined anywhere in your program. You can also defin~ special-purpose symbols called OPDEFs and macros using the pseudo-op OPDEF and the pseudo-op DEFINE. (See Chapter 3.) 2.4.2.1 Defining Labels - A label is always a symbol with a suffixed colon. A label is in the first (leftmost) field of a MACRO statement and is one of the forms: ERRFOUND: (MACRO uses only ERRFOU) CASEl: (legal label) OK:CONTIN: (legal; you can use more than one label at a location) CASE2:: (double colon declares see Section 2.4.5.2) label INTERNAL; CASE3:! (colon and exclamation point output by debugger) suppresses CASE4::! (double colon and exclamation point declares label INTERNAL and suppresses output by debugger) 2-10 ELEMENTS OF MACRO When MACRO processes the label, the symbol and the current the location counter are entered in the user symbol reference to the symbol addresses the code at the label. value of table. A You cannot redefine a label to have a value different from its original value. A label is relocatable if the address it represents is relocatable; otherwise it is absolute. 2.4.2.2 Direct Assignments - You define a direct-assignment symbol by associating it with an expression. (See Section 2.5 for a discussion of expressions.) A direct assignment is in one of the forms: symbol=expression (symbol and value of expression entered in user symbol table) symbol==expression (symbol and value of expression are entered in user symbol table, output by debugger is suppressed) symbol=:expression (symbol and value of expression are entered in user symbol table, symbol is declared INTERNAL; see Section 2.4.5.2) symbol==:expression (symbol and value of expression are entered in user symbol table, symbol is declared INTERNAL, output by debugger is suppressed) You can redefine a direct-assignment symbol at any time; direct assignment simply replaces the old definition. the are new NOTE If you assign a multiword value using direct assignment, only the first word of the value is assigned to the symbol. For example, A=ASCIZ /ABCDEFGH/ is equivalent to A=ASCIZ /ABCDE/, since only the first five characters in the string correspond to code in the first word. 2.4.3 Variable Symbols You can specify a symbol as a variable by suffixing it with a number sign (#). A variable symbol needs no explicit storage allocation. On finding your END statement, MACRO assembles variables into locations following the literal pool. You can assemble variables anywhere in your program by using the VAR pseudo-op. This pseudo-op causes all variables found so far to be assembled immediately. (Variables fO'und after the VAR statement are assembled at the end of the program or at the next VAR statement.) 2-11 ELEMENTS OF MACRO 2.4.4 Using Symbols When you use a symbol in your program, MACRO looks it up in the symbol tables. Normally MACRO searches the macro table first, then the op-code table, and finally the user symbol table. However, if MACRO has already found an operator in the current statement and is expecting operands, then it searches the user symbol table first. You can control the order of search for symbol pseudo-op .DIRECTIVE MACPRF. 2.4.5 tables by using the Symbol Attributes The value of a symbol is either relocatable or absolute. The relocatability of a label is determined by the relocatability of the address assigned to it. You can define either an absolute or a relocatable value for a direct-assignment symbol. In addition, each symbol in your program has one of attributes: local, INTERNAL global, or EXTERNAL attribute is determined when the symbol is defined. the following global. This 2.4.5.1 Local Symbols - A local symbol is defined for the use of the current program only. You can define the same symbol to have different values in separately assembled programs. A symbol is local unless you indicate otherwise. 2.4.5.2 Global Symbols - A global symbol is defined in one program, but is also available for use in other programs. Its table entry is visible to all programs in which the symbol is declared global. A global symbol must be declared INTERNAL in the program where it is defined; it can be defined in only one program. In other programs sharing the global symbol, it must be declared EXTERNAL; it can be EXTERNAL in any number of programs. To declare a symbol as INTERNAL global, you can: 1. Use the INTERN pseudo-oPe INTERN FLAG1 2. Insert a colon after in a direct-assignment statement. FLAG2=:200 FLAG3==:200 3. Use an extra colon with a label. FLAG4:: 4. For subroutine entry points, use the ENTRY pseudo-oPe (This pseudo-op does more than declare the symbol INTERNAL. See Chapter 3.) ENTRY FLAG5 2-12 ELEMENTS OF MACRO To declare a symbol as an EXTERNAL global, you can: 1. Use the EXTERN pseudo-oPe EXTERN FLAG6 2. Suffix ## to the symbol at any of its uses. (Doing this once is sufficient, but you can use ## with all references to the symbol.) FLAG7tt 2.5 EXPRESSIONS You can combine numbers and defined symbols with arithmetic and logical operators to form expressions. You can nest expressions by using angle brackets. MACRO evaluates each expression (innermost nesting levels first), and either resolves it to a fullword value, or generates a Polish expression to pass to LINK. (See Sections 2.5.3 and 2.5.4.) 2.5.1 Arithmetic Expressions An arithmetic expression can include any number or defined symbol, and any of the following operators: + addition subtraction * multiplication / division These examples assume that WORDS, elsewhere: X, Y, and Z have been defined symbol whose MOVEI 3,WORDS/S ADD! 12,<X+Y-Z> ADD! 12,«WORDS/S>+1>*S 2.5.2 Logical Expressions A logical expression can include any number or defined value is absolute, and any of the following operators: & AND OR (inclusive-OR) ft! XOR (exclusive OR) - NOT 2-13 ELEMENTS OF MACRO The unary operation A_A generates the fullword one's complement of the value of A. Each of the binary operations &, 1, and Al generates a fullword by performing the indicated operation over corresponding bits of the two operands. For 'example, A&B generates a fullword whose bit 0 is the result of A's bit 0 ANDed with B's bit 0, and so forth for all 36 bits. 2.5.3 Polish (Complex) Expressions MACRO cannot evaluate certain expressions containing relocatable values or EXTERNAL symbols. Instead MACRO generates special expressions called Polish expressions, which tell LINK how to resolve the values at load time. MACRO also generates Polish expressions to resolve inter-PSECT references. For example, assum~ that A and B are externally defined symbols. Then MACRO cannot perform the operations A+B-3, but instead generates a special Polish block containing an expression to pass to LINK~ the expression is equivalent to -+AB3. (See REL Block Type 11 in the LINK Reference Manual.) At load time, the values of A and B are available to LINK, and the expression is resolved. NOTE If you have used reverse Polish notation with a calculator, you should notice that although MACRO's Polish expressions are similar, they are not reversed. (These notations are called Polish because they were invented by the Polish logician Jan Lukasiewicz.) 2.5.4 Evaluating Expressions 2.5.4.1 Hierarchy of Operations - MACRO has a hierarchy of operations in evaluating expressions. In an expression ~ithout nests (angle brackets), or within a nested expression, MACRO performs its operations in this effective order: 1. All unary operations and shifts: +, -, "'-, ""0, ""a, ""B, B (binary shift), - (underscore shift), ""F, ""L, E, K, M, G. Zeros are added for K, M, and G before any other operation is performed. 2. Logical binary operations (from left to right): (XOR), & (AND). (OR), 3. Multiplication and division (from left to right): *, I. 4. Addition and subtraction (binary operations): 2-14 +,- ""I ELEMENTS OF MACRO You can override thi~ hierarchy by using angle brackets to show what you want done first. For example, suppose you want to calculate the sum of A and B, divided by C. You cannot do this with A+B/C because MACRO will perform the division B/C first, then add the result to A. With angle brackets you can write the expression <A+B>/C, telling MACRO to add A and B first, then divide the result by C. Expressions can be nested to any level. The innermost nest is evaluated first; the outermost, last. Some examples of legal expressions (assuming that AI, Bl, and C are defined symbols) are: Al+B1/5 <Al+Bl)/5 ~-Al&Bl~!C ~Bl01M-~D98+6 NOTE An expression given in halfword notation (that is, lefthalf"righthalf) has each half evaluated separately in a 36-bit register. Then the 18 low-order bits of each half are joined to form a fullword. For example, the expression <4,,6>/2 generates the value 000002 000003. 2.5.4.2 Evaluating Expressions with Relocatable Values - The value of an expression is usually either absolute or relocatable. Recall that relocatable values in your binary code will have the relocation constant added at load time by LINK. Assume that A and Bare relocatable symbols, and that X and Yare absolute symbols, and that the relocation constant is k. Let a+k and b+k be the values of A and B after relocation. Then A+X makes sense (to LINK) because it means <a+k>+X, which is the same as <a+X>+k, clearly relocatable. Since X and Yare both absolute, any operation combining them gives an absolute result. Now look at the expression A+B. This means <a+k>+<b+k), which is same as <a+b>+2k, neither absolute nor relocatable. Similarly, means <a+k>*<b+k>, or <a*b>+<a+b>*k+k*k, again neither absolute relocatable. Such expressions cannot be evaluated by MACRO and passed as Polish expressions to LINK. the A*B nor are More generally, you can see if an expression is absolute or relocatable by substituting relocated forms as above (for example, a+k), and separating it (if possible) into the form absolute+n*k where absolute is an absolute expression. If n=O, the expression is absolute; if n=l, i i is relocatable. If n is neither 0 nor 1, or if the expression cannot be put into the form above, then the expression is neither absolute nor relocatable. (Nevertheless, LINK will correctly evaluate the expression at load time.) 2-15 ELEMENTS OF MACRO 2.6 MACRO-DEFINED MNEMONICS MACRO-defined mnemonics are words that MACRO recognizes translate to binary code. These mnemonics include: 1. Machine instruction mnemonics 2. I/O instruction mnemonics 3. I/O device code mnemonics 4. KL10 EXTEND instruction mnemonics 5. JRST and JFCL mnemonics and can Each type of mnemonic is discussed and tabulated in Appendix C. These mnemonics, together with MACRO's pseudo-ops and special characters, form the MACRO language. 2-16 CHAPTER 3 PSEUDO-OPS A pseudo-op is a statement that directs the assembler to generate code or set switches to control assembly and listing of your program. For example, the pseudo-op RADIX does not generate code, but it tells MACRO how to interpret numbers in your program. The pseudo-op EXP generates one word of code for each argument given with it. To use a pseudo-op in your program, follow it with a space or tab, and any required or optional arguments or parameters. The program examples in Appendix D show pseudo-ops used in context. This chapter describes (alphabetically) • The applicable, are: the use headings 1. FORMAT 2. FUNCTION 3. EXAMPLES 4. OPTIONAL NOTATIONS 5. RELATED PSEUDO-OPS 6. COMMON ERRORS and functions of each pseudo-op included for each description, if Some entries under COMMON ERRORS cite single-character error codes (for example, M error). These codes are discussed in Section 8.2. Many of the examples show some parts of the code assembled. format and meaning of assembled code is discussed in Section 6.1. 3-1 The PSEUDO-OPS ARRAY FORMAT ARRAY sym[expression] expression = an integer value in the current radix, indicating the number of words to be allocated; the expression cannot be EXTERNAL, relocatable, or a floating-point decimal number, and its value must not be negative. FUNCTION Reserves a block of storage whose length is the value of the expression, and whose location is identified by the symbol. Storage is allocated along with other variable symbols in the program. If the pseudo-op TWOSEG is used, ARRAY storage must in the low segment. (See the VAR pseudo-op.) be The allocated storage is not necessarily zeroed. If you use ARRAY in within that PSECT. a PSECT, storage is allocated NOTE Though the expression portion of an OPDEF must be in square brackets, this use of the brackets is completely unrelated to literals or literal handling. EXAMPLES ARRAY START[200J ARRAY PLACE[1000J ARRAY ERRS[2000J OPTIONAL NOTATIONS ARRAY syml,sym2 [expression] Both syml and sym2 have a length equal to the value the expression. RELATED PSEUDO-OPS BLOCK, • COMMON, INTEGER, VAR COMMON ERRORS Using an EXTERNAL (E error). of symbol for name or size of the array 3-2 PSEUDO-OPS ASCII FORMAT ASCII dtex.td d = delimiter; first nonblank character, whose appearance terminates the text. second text = string of text characters to be entered. FUNCTION Enters ASCII text in the binary code. Each character uses seven bits. Characters are left justified in storage, five per word, with bit 35 in each word set to 0, and any unused bits in the last word set to o. EXAMPLES 105 122 122 117 122 040 115 105 123 123 101 107 105 000 000 ASCII IERROR MESSAGEI 123 124 101 122 124 111 116 107 040 101 107 101 111 116 000 ASCII !STARTING AGAIN! 105 116 104 123 040 127 111 124 110 040 132 105 122 117 123 ASCII ?ENDS WITH ZEROS? OPTIONAL NOTATIONS Omit the space or tab after ASCII. This is not allowed if the delimiter is a letter, number, dot, dollar sign, or percent sign (that is, a possible symbol constituent), or if the ASCII value of the delimiter character is less than 040 or greater than 172. Right justified ASCII can be entered by using double quotes to surround up to five characters; for example, MOVEI AC1,·A· 201 01 0 00 000101 RELATED PSEUDO-OPS ASCIZ, .DIRECTIVE FLBLST, RADIX50, SIXBIT COMMON ERRORS Using the delimiter character in the text string. Missing the end delimiter (that is, attempting to use a carriage return as a delimiter). Using more than 5 characters in a right-justified ASCII string, or more than 2 characters if in the address field (Q error) • Giving direct assignment of a long ASCII string value to a symbol (for example A=ASCII /ABCDEFGH/). Only the first word (five characters, left justified) is assigned. Using ASCII when ASCIZ is required. 3-3 PSEUDO-OPS ASCIZ FORMAT ASCIZ dtextd d = delimiter; first nonblank character, whose appearance terminates the text. second text = string of text characters to be entered. FUNCTION Enters ASCII text exactly as in the pseudo-op ASCII, except that a trailing null character is guaranteed. That is, if the number of characters in text is a multiple of five, a fullword of zeros is generated. EXAMPLES 105 122 122 117 122 040 115 105 123 123 101 107 105 000 000 ASCIZ IERROR MESSAGEI 123 124 101 122 124 111 116 107 040 101 107 101 111 116 000 ASCIZ !STARTING AGAIN! 105 116 104 123 040 127 111 124 110 040 132 105 122 117 123 000 000 000 000 000 ASCIZ 1ENDS WITH ZEROS1 OPTIONAL NOTATIONS Omit the space or tab after ASCIZ. This is not allowed if the delimiter is a letter, number, dot, dollir sign, or percent sign (that is, a possible symbol constituent), or if the ASCII value of the delimiter character is less than 040 or greater than 172. RELATED PSEUDO-OPS ASCII, .DIRECTIVE FLBLST, RADIX50, SIXBIT COMMON ERRORS Using the delimiter character in the text string. Missing the end delimiter (that is, attempting to use a carriage return as a delimiter). Giving direct assignment of a long ASCII string value to a symbol (for example A=ASCII /ABCDEFGH/). Only the first word (five characters, left justified) is assigned. In a macro, using a delimiter character that interferes with recognition of a dummy-argument. For example, in the macro DEFINE FOO(X)< ASCIZ .X. X is not seen as a dummy-argument because .X. is itself a valid symbol. (Continued on next page) 3-4 PSEUDO-OPS ASCIZ (Cont.) In the macro DEFINE FOO(X>< IXI ASCIZ x is seen as a dummy-argument because the slash (/) i not valid in a symbol. The macro DEFINE FOO(X>< ASCIZ . ' X' • uses the concatenation operator (') to assure recogni tion of X as a dummy-argument. (See Section 5.4 for a discussion on concatenating arguments.) 3-5 PSEUDO-OPS .ASSIGN FORMAT .ASSIGN syml,sym2,increment syml and sym2 = global symbols. increment FUNCTION = expression with integer value. MACRO generates a REL Block Type 100. (See the LINK Reference Manual.) At the time the program is loaded into memory, assigns the value of sym2 to syml, and adds increment to sym2. The .ASSIGN pseudo-op is useful for assigning a block of storage in one module and providing another module with the symbols needed to reference that block • EXAMPLES OPTIONAL NOTATIONS • ASSIGN A,PC,5 ;Assi~ns the value of PC to A, ; then redefines the value of ; PC to be F'C+!:5 + .ASSIGN ERR1,ERRS,ERNO ;A5si~ns the value of ERRS to ERR1, then redefines ERRS to be ERRS plus the current value of ERNO • • ASSIGN syml,sym2 If the increment is missing, its value is 1. COMMON ERRORS Syml or sym2 not global. Increment not defined at assembly time. 3-6 PSEUDO-OPS ASUPPRESS FORMAT ASUPPRESS FUNCTION Causes all local or INTERNAL symbols that are not referenced after the ASUPPRESS to be deleted from MACRO's symbol table at the end of Pass 2. These symbols will not be output to LINK, will not be available to the debugger, and will not appear in the symbol table in the program listing file. If you use ASUPPRESS at the end of Pass 1, only those symbols defined or referenced in Pass 2 remain in MACRO's symbol table. This is useful for parameter files that define many more symbols than are actually used, since the unused symbols can be automatically deleted if they are defined in IFI conditionals. RELATED PSEUDO-OPS PURGE, SUPPRESS 3-7 PSEUDO-OPS BLOCK FORMAT BLOCK expression expression = an integer value in the current radix, indicating the number of words to be allocated; the expression cannot be EXTERNAL, relocatable, or a floating-point decimal number, and its value must not be negative. FUNCTION Reserves a block of locations whose length is the value of the expression. The location counter is incremented by this value. The allocated locations are not necessarily zeroed. Note that the BLOCK pseudo-op does not generate or store code. Therefore it should not be used in a literal, since this will result in overwriting the reserved space during literal pooling. If you use the BLOCK pseudo-op to reserve words meant for data storage, these words should be reserved in the low segment of a two-segment program. EXAMPLES MOVE 2,EXW[I FRM,TOJ BLT 2,TOENIJ 002101' 200 02 0 00 400033' 002102' 251 02 0 00 003010' •••••• 002611' 002711' FRM: TO: 003010' • • • BLOCK 100 BLOCK 100 TOENrl=. -1 OPTIONAL NOTATIONS Use the pseudo-op Z inside literals. RELATED PSEUDO-OPS ARRAY, .COMMON, INTEGER, VAR COMMON ERRORS Relocatable expression (R error) • Floating-point or negative expression (A error). Value of expression larger than 777777. Expression contains EXTERNAL symbol (E error). Expression contains nonexistent symbol (V error) • BLOCK used in literal (L error). 3-8 PSEUDO-OPS BYTE FORMAT BYTE bytedef bytedef bytedef=(n)expression, ••• ,expression n = byte size in bits; the range 1 to 36. n is a decimal expression in expression = value to be stored. FUNCTION Stores values of expressions in n-bit bytes, starting at bit 0 of the storage word. The first value is stored in bits 0 to n-l; the second in bits n to 2n-l; and so forth for each given value. If a byte will not fit in the remaining bits of a word, the bits are zeroed and the byte begins in bit 0 of the next word. If a value is too large for the byte, it is truncated on the left. (empty If the byte size is 0 or is missing parentheses), a zero word is generated. EXAMPLES 000002 05 00 00 01 05 02 VELOCY=2 BYTE (6)5,0,,101,5,VELOCY generates the storage value 050000 010502. The two commas indicate a null argument; the 101 (octal) is too_ large for the byte size and is left truncated. 07 00 01 007 000 001 101 000000 BYTE (6)7,O,1(9)7,0,1,·A· Notice that the code for "A" (101) is in its 9-bit byte. COMMON ERRORS right justified Byte size too big (A error). Missing left or right parenthesis (A error) • Extraneous comma before left generates a null byte. parenthesis; the comma Using an EXTERNAL symbol or EXTERNAL complex expression for n or expression. 3~ PSEUDO-OPS COMMENT FORMAT COMMENT dtextd d = delimiter1 the first nonblank character, second appearance terminates the text. whose text = text to be entered as a comment. FUNCTION Treats the text between the delimiters as a comment. The text can include a CR-LF to facilitate multiline comments, as shown below. EXAMPLES COMMENT ITHIS IS A COMMENT THAT IS MORE THAN 1 LINE LONGI OPTIONAL NOTATIONS Omit the space or tab after COMMENT. This is not allowed if the delimiter is a letter, number, dot, dollar sign, or percent sign (that is, a possible symbol constituent), or if the ASCII value of the delimiter character is less than 040 or greater than 172. Use a semicolon (;) to make the rest of the line into a comment. RELATED PSEUDO-OPS REMARK COMMON ERRORS Using the delimiter character in the text string. Missing the end delimiter (that is, attempting to use a carriage return as a delimiter). 3-10 PSEUDO-OPS • COMMON FORMAT .COMMON symbol [expression] symbol = name of at FORTRAN COMMON block. expression = an expression having a positive integer value; this value defines the length of the COMMON block. FUNCTION Defines a FORTRAN or FORTRAN-compatible COMMON block. Causes the equivalent action of a FORTRAN labeled COMMON. (See the FORTRAN Reference Manual.) You can use .COMMON to define blank COMMON; to do this, use the symbol .COMM. as the name of the COMMON block. (Both FORTRAN and LINK recognize this as the name of blank COMMON.) To define a COMMON block, MACRO generates a Type 20. (See the LINK Reference Manual.) REL Block If used, the .COMMON pseudo-op must precede any MACRO statement that generates binary code, and must precede any other reference to the symbol name. EXAMPLES .COMMON DATA1[SO] OPTIONAL NOTATIONS .COMMON symbol, ••• ,symbol[expression] defines a COMMON array for each symbol given. Each array has a length equal to the value of the expression. RELATED PSEUDO-OPS ARRAY, BLOCK, EXTERN, INTEGER COMMON ERRORS Missing left or right square bracket (A error) • Using a relocatable expression. 3-11 value or EXTERNAL symbol in PSEUDO-OPS .CREF FORMAT .CREF FUNCTION Resumes output of cross-referencing that was by the .XCREF pseudo-oPe suspended OPTIONAL NOTATIONS Can apply to specific symbols .XCREF on those symbols, as in a previous to cancel .CREF symbol, ••• ,symbol RELATED PSEUDO-OPS .XCREF COMMON ERRORS Specifying a nonexistent symbol (A error) • 3-12 PSEUDO-OPS DEC FORMAT DEC expression, ••• ,expression FUNCTION Defines the local radix for the line as decimal; the value of each expression is entered in a fullword of code. The location counter is incremented by 1 for each expression. EXAMPLES 000000 203440 202622 055452 000000 OPTIONAL NOTATIONS RADIX 8 DEC 10,4.5,3.1416,6.03E-26,3 Use the EXP pseudo-op and prefix AD to each expression that must be evaluated in radix 10. In the example above, only the first expression, "10," has different evaluations in radix 8 and radix 10. Therefore an equivalent notation is 000000 203440 202622 055452 000000 RELATED PSEUDO-OPS 000012 000000 077714 456522 000003 000012 000000 077714 456522 000003 EXP ~D10,4.5,3.1416,6.03E-26,3 EXP, RADIX, OCT 3-13 PSEUDO-OPS DEFINE FORMAT DEFINE rnacroname (darglist) <macrobody> macroname ; a symbolic name for the macro defined. This name must be unique among all macro, OPDEF, and SYN symbols. darglist = a list of dummy-arguments. macrobody = source code to be assembled when the is called. macro FUNCTION Defines a macro. EXAMPLES See Chapter 5. RELATED PSEUDO-OPS • DIRECTIVE (with .ITABM, .XTABM, or MACMPD arguments), IRP, IRPC, OPDEF, STOPI, SYN COMMON ERRORS Mismatched parentheses. (See Chapter 5.) Mismatched angle brackets. Using identical names for a macro and an OPDEF symbol (X error). 3-14 or SYN PSEUDO-OPS DEPHASE FORMAT DEPHASE FUNCTION Suspends the effect of a PHASE pseudo-oPe Restores the location counter to its mode previous to the segment of PHASEd code. For further details, see the pseudo-op PHASE. EXAMPLES RELATED PSEUDO-OPS 400000' 000000 000000 201 01 0 00 000000 400001' 400001' 254 00 0 00 000000' PHASE 3-15 TAG: RELOC 400000 PHASE 0 MOVEl 1,0 IIEPHASE" JRST TAG PSEUDO-OPS .DIRECTIVE FORMAT .DIRECTIVE directive, ••• ,directive FUNCTION Sets switches to enable or disable MACRO features. If a directive has a logical opposite, you can use NO as a prefix to reverse the directive. The directives are: .ITABM - include spaces and tabs arguments in macro call • as part of • XTABM - strip leading and trailing spaces from passed arguments in macro call. the default setting. passed and tabs .XTABM is MACMPD - match paired delimiters in macro call. MACMPD is the default for assembly. It implies .XTABM and disables .ITABM. Using .DIRECTIVE NO MACMPD disables all quoting characters except angle brackets in macro arguments, and offers you a choice of .ITABM or .XTABM. LITLST - list all binary code for literals in-line. FLBLST - list only first line of binary code multiline text. NO FLBLST is the default • for • OKOVL - allow overflow for arithmetic pseudo-ops DEC, EXP, and OCT • the • EROVL - give an N error • EROVL is the default. for and arithmetic for overflow • MACPRF - prefer macro definition of symbol over other definitions of the same symbol. This does not affect the searching of .UNV files. SFCOND - suppress listing failing source for conditional assembly. The lines containing the opening and closing angle brackets are not suppressed. .NOBIN - do not generate binary ( • REL) file. KAlO - enter KAlO as CPU type in header block of binary file. KIlO - enter KIlO as CPU type in header block of binary file. KLIO - enter KLIO as CPU type in header block of binary file. EXAMPLES .DIRECTIVE MACMPD,.NOBIN COMMON ERRORS Using NO with a directive that does not have a opposite. 3-16 logical PSEUDO-OPS END FORMAT END expression expression = an optional operand that specifies the address of the first instruction to be executed; can be EXTERNAL. FUNCTION Must be the last statement in a MACRO program. Statements after END are ignored. The starting address is optional and normally is given only in the main program. (Since subprograms are called from the main program, they need not specify a starting address.) When the assembler first encounters an END statement, it terminates Pass 1 and begins Pass 2. The END terminates Pass 2 on the second encounter, after which the assembler simulates XLISTed LIT and VAR statements beginning at the current location. (In a PSECTed program, the LIT and VAR statements are simulated for each PSECT.) EXAMPLES END START START is a label at the starting address. OPTIONAL NOTATIONS Use the END statement to specify a transfer word in (See pseudo-ops RIM, RIMIO, some output file formats. and RIMIOB in Appendix E.) RELATED PSEUDO-OPS PRGEND COMMON ERRORS Failing to end a text string or literal with a closing delimiter; MACRO cannot see the END statement. Including an END statement in a source file when it is not the last file in a group of files you want assembled as a single program. Closing the input file immediately after the characters "END" with no following carriage return. 3-17 PSEUDO-OPS .ENDPS FORMAT .ENDPS FUNCTION Suspends use of the relocation counter associated with the current PSECT. If the current PSECT is nested in other PSECTs, the relocation counter for the next outer PSECT is activated. Otherwise, the relocation counter for the blank PSECT is activated. MACRO generates a REL Block Type Reference Manual.) 22. (See the LINK For a complete discussion of PSECTs and their handling, see Section 9.1.3. OPTIONAL NOTATIONS Give the name of the pseudo-oPe For example, current PSECT with the .ENDPS .ENIIPS A causes MACRO to verify that A is the name of the current PSECTi if not, an error message is issued. RELATED PSEUDO-OPS LOC, .ORG, .PSECT, RELOC, TWOSEG 3-18 PSEUDO-OPS ·1 ENTRY FORMAT ENTRY symbol, ••• ,symbol symbol = name of subroutine. FUNCTION an entry point in a library Defines each symbol in the .list following the ENTRY pseudo-op as an INTERNAL symbol and places them in a REL Block Type 4 at the beginning of the .REL output file. If this .REL file· is later included in an indexed library of subroutines, then the symbol will also be included in a REL Block Type 14 at the beg inning of the 1 ibrary. (Except for this, ENTRY is equivalent to INTERN.) If LINK is in library search mode, a subroutine will be loaded if the program to be executed contains an undefined global symbol that matches a name in the library entry list for that program. Since library subroutines using them, the calling EXTERN statements. EXAMPLES are external program must If the MATRIX subroutine is a must contain the statement library to programs list them in subroutine, it ENTRY MATRIX in order to make the symbol MATRIX available to other programs. In addition, it must define the symbol MATRIX as a label at the address where execution of the call is to begin: MATRIX: RELATED PSEUDO-OPS INTERN, EXTERN COMMON ERRORS Not defining the symbol in the program. Purging an ENTRY symbol in Pass 2 only. The ENTRY symbol is normally output at the beginning of Pass 2; a PURGE of an ENTRY symbol must occur in Pass 1 to be effective. 3-19 PSEUDO-OPS EXP FORMAT EXP expression, ••• ,expression FUNCTION Enters the value of each expression radix) in a fullword of code. EXAMPLES 000000 000000 000000 000000 000000 RELATED PSEUDO-OPS 000003 000101 000004 000002 000003 000004 000101 000101 000364 (in X=3 HALF=101 I~=4 A=2 EXP X,4,~D65,HALF,B+362-A DEC, OCT 3-20 the current PSEUDO-OPS EXTERN FORMAT EXTERN symbol, ••• ,symbol FUNCTION Identifies symbols as being defined in other programs. EXTERNAL symbols cannot be defined within the current program. At load time, the value of an EXTERNAL symbol is resolved by LINK if you load a module that defines the symbol as an INTERNAL symbol. (If you do not load such a module, LINK gives an error message for the undefined EXTERNAL symbol.) An EXTERNAL symbol cannot be used for any program values affecting address assignment (such as arguments to LOC or RELOC). For a discussion of global symbols and their resolution by LINK, see Section 2.4.5.2. EXAMPLES EXTERN SQRT,CUBE,TYPE OPTIONAL NOTATIONS Suffix ## to the symbol. This declares the symbol EXTERNAL, and eliminates the need for the EXTERN pseudo-oPe Most programmers who use the ## notation do so at all occurrences of the symbol to show at each site that the symbol is EXTERNAL. For example, the two statements EXTERN A ATWO=A*2 can be simplified to RELATED PSEUDO-OPS INTERN, ENTRY, UNIVERSAL COMMON ERRORS Attempting to declare a symbol first use has made it local (by (by declaration). Declaring a searches a definition. as EXTERNAL after its default) or INTERNAL symbol as EXTERNAL in a program that UNIVERSAL file that gives a conflicting 3-21 PSEUDO-OPS • HWFRMT FORMAT . HWFRMT FUNCTION Causes binary code to be listed in halfword format. EXAMPLES 200 01 o 02 000002 200042 000002 MOVE 1,2(2) .HWFRMT MOVE 1,2 (2) OPTIONAL NOTATIONS Use the /G switch described in Table RELATED PSEUDO-OPS .MFRMT 3-22 7~1. PSEUDO~OPS .IF FORMAT .IF expression,qualifier,(code) FUNCTION Gives criterion and code for conditional assembly. code is assembled if: The qualifier is AND expression is ABSOLUTE ASSIGNMENT ENTRY EXTERNAL INTERNAL GLOBAL LABEL LOCAL LRELOCATABLE MACRO NEEDED NUMERIC OPCODE OPDEF REFERENCED RELOCATABLE RRELOCATABLE SYMBOL SYNONYM absolute a direct-assignment 'symbol a symbol given in ENTRY pseudo-op an EXTERNAL symbol an INTERNAL or ENTRY symbol a global symbol a label a local symbol a lefthalf relocatable symbol a macro name an undefined but referenced symbol numeric an opcode a symbol defined by OPDEF pseudo-op a symbol already in the symbol table a relocatable symbol a righthalf relocatable symbol a symbol (instead of a number) a symbol ~efined by,SYN pseudo-op NOTE If the expression has- different properties in Pass 1 and Pass 2, the number of words of code generated may be different for.each pass • EXAMPLES • IF FOO,MACRO,(FOO> OPTIONAL NOTATIONS Abbreviate qualifier up to unique ~nitial letters. For example, you can abbreviate OPCODi to OPC, but -not to OP, since OPDEF has the'same first two lett~rs. Omit the comma preceding the left angle bracket • RELATED PSEUDO-OPS • DIRECTIVE SFCOND, .IFN, IFx group COMMON ERRORS Omitting the comma between expression and qualifier. Mismatching angle brackets. Misplacing the .IF statement in such a way that the 'property given by the qualifier is different in Pass I and Pass 2. For example, the following code generates phase errors in Pass 2: .IF FOO,OPDEF,(JFCL> OPDEF FOOCJRSTJ . NXTLAB: END 3-23 _ _ _ _e_I_F_N_ _ _ _1 FORMAT .IFN expression,qualifier,<code> FU'NCTION Gives criterion and code for conditional assembly. code is assembled if:· The expression IS. NOT qualifier is AND ABSOLUTE ASSIGNMENT ENTRY EXTERNAL 'INTERNAL GLOBAL LABEL LOCAL LRELOCATABLE MACRO NEEDED NUMERIC OPCODE OPDEF REFERENCED RELOCATABLE RRELOCATABLE SYMBOL SYNONYM absolute a direct-assignment symbol a symbol given in ENTRY pseudo-op an EXTERNAL symbol . an INTERNAL or ENTRY symbol a global symbol a label a local symbol a lefthalf,relocatable symbol a macro name an undefined but referenced symbol numeric an opcode a symbol defined by OPDEF pseudo-op a symbol already in the symbol table a relocatable symbol a righthalf relocatable symbol a symbol (instead of a number) a symbol defined by SYN pseudo-op NOTE If the expression has different properties in Pass 1 and Pass 2, the number of words of code generated maybe different for each pass • EXAMPLES • IFN FOO,OPDEF,(OPDEF FOOC270B8J) OPTIONAL NOTATIONS Abbreviate qualifier up to unique initial letters. For example, OPCODE can be abbreviated to OPC, but not to OP, since OPDEF has the same first two letters. Omit the comma prededing the left angle bracket • RELATED PSEUDO-OPS • DIRECTIVE SFCOND, .IF, IFx group COMMON ERRORS Omitting the comma between expression and qualifier. Mismatching angle brackets. Misplacing the .IFN statement in such a way that the property given by the qualifier is different in Pass I and Pass 2. For example, the following code generates phase errors in Pass 2: .IFN FOO,OPDEF,(JFCL> OPDEF FOOeJRSTJ NXTLAB: END 3-24 PSEUDO-OPS IFx group FUNCTION Gives criterion and code for conditional assembly. A symbol or expression used to define the conditions for assembly must be defined before MACRO reaches the conditional statement. If the value of such a symbol or expression is not the same on both assembly passes, a different number of words of code may be generated, and a phase error can occur. The forms of the IF pseudo-op are listed below; in the forms, n is the value of the given first six expression. IFE expression,<code> - assemble code if n=O. IFN expression,<code> - assemble code if n=i=O. IFG expression,<code> - assemble code if n>O. IFGE expression,<code> - assemble code if n~O. IFL expression,<code> - assemble code if n<O. IFLE expression,<code> - assemble code if n~O. IFI <code> - assemble code on Pass 1. IF2 <code> - assemble code on Pass 2. IFDEF symbol,<code> - assemble code if defined as user-defined, an pseudo-oPe the symbol is opcode, or a IFNDEF symbol,<code> - assemble code if the symbol is not defined as user-defined, an opcode, or a pseudo-oPe Code is also assembled if the symbol has been referenced, but is not yet defined. This can occur during Pass 1. IFIDN <stringl><string2>,<code> - assemble code if strings are identical. the IFDIF <stringl><string2>,<code> - assemble code if strings are different. the NOTES 1. For IFIDN and IFDIF, the assembler compares the two strings (interp~eted as ASCII) character by character. 2. The IFIDN and IFDIF pseudo-ops usually appear in macro definitions, where one or both strings are dummy-arguments. (Continued on next page) 3-25 PSEUDO-OPS IFx group IFB (Cont.) I <string>,<code> - assemble code contains only blanks and tabs. if the string IFNB<string>,<code> - assemble code if the string does not contain only blanks and tabs. EXAMPLES ~~CC==~~CC+l IFG ~~CC-5,<~~CC==O ~~WC==~~WC+l> OPTIONAL NOTATIONS ;Increment character count ;Word overflowed? ;Yes, to next word Omit angle brackets conditionals. enclosing Omit the comma preceding the enclosed in angle brackets. code code for single-line if the code is For IFIDN, IFDIF, IFB, and IFNB only: use a nonblank, non tab character other than < as the initial and terminal delimiters for a string (as in pseudo-ops ASCII and ASCIZ). You can then include angle brackets in the string • RELATED PSEUDO-OPS • DIRECTIVE SFCOND, .IF, .IFN COMMON ERRORS Comparison string too large (A error). Mismatched angle brackets. EXTERNAL symbol used for comparison (E error). String not properly delimited. Missing comma with single-line conditional. 3-26 PSEUDO-OPS INTEGER FORMAT ., INTEGER symbol, ••• ,symbol symbol = the name of a location to be reserved. FUNCTION Reserves storage locations at the end of the program on one-per-given-symbol basis. The symbols are a equivalent to variable symbols. For a two-segment program, INTEGER storage must the low segment. be in EXAMPLES INTEGER A,B,C OPTIONAL NOTATIONS Reserve a single storage location by suffixing a number sign (#) to a symbol in the operand field. For example, ADD 3,TEMPI is equivalent to INTEGER TEMP ADD 3,TEMP RELATED PSEUDO-OPS ARRAY, BLOCK, .COMMON, VAR 3-27 PSEUDO-OPS INTERN FORMAT INTERN symbol, ••• ,symbol FUNCTION Declares each given symbol to be INTERNAL global; therefore its definition, which must be in the current program, is available to other programs at load time. Each such symbol must be defined as a label, a variable, or a direct-assignment symbol. MACRO builds a list of symbol definitions that will available to other programs at load time. be OPDEF symbols can be declared INTERNAL, and thus be made available to other programs at load time. However, if the current program has another symbol (besides the OPDEF symbol) of the same name, the INTERNAL declaration will apply to that symbol rather than to the OPDEF symbol. EXAMPLES INTERN SQUARE,CBROOT,TYPE2 OPTIONAL NOTATIONS TAG: : VALUE=:expression RELATED PSEUDO-OPS EXTERN, ENTRY COMMON ERRORS Failing to program. ;INTERNAL label ;INTERNAL direct assignment define an INTERNAL symbol in the current Using INTERN for a library entry point (when required) • 3-28 ENTRY is PSEUDO-OPS IOWD FORMAT IOWD expl,exp2 expl, exp2 = expressions. FUNCTION Generates one I/O transfer word in a special format for use in BLKI and BLKO and all five pushdown instructions (ADJSP, PUSH, POP, PUSHJ, POPJ). The left half of the assembled word contains the 2's complement of the value of expl, and the right half contains the value exp2-1. EXAMPLES The following line shows how IOWD 6,A D256 places -6 (octal 777772) in the left halfword and 256 (octal 377) in the right halfword: 777772 IOWD 6,"'D256 000377 The following lines show IOWD STL,STK used in a literal. The LIT pseudo-op then shows the code generated in the literal pool~ 000017 000001 000100 P==17 AC1==1 STL==100 STK: BLOCK STL MOVE P,[IOWD STL,STKJ 200 17 0 00 001053' PUSH P,AC1 261 17 0 00 000001 254 00 0 00 001054' JRST END ... • • • 777700 000001 104 00 0 00 000170 OPTIONAL NOTATIONS LIT END: HALTF XWD -expl,exp2-1 -expl, ,exp2-1 COMMON ERRORS Using a relocatable expression for expl (R error). 3-29 PSEUDO-OPS IRP FORMAT ., IRP darg,<code> darg = one of the dummy-arguments of the enclosing macro definition. (You can use IRP only in the body of a macro definition.) FUNCTION Generates one expansion of code for each subargument of the string that replaces darg. Each occurrence of darg within the expansion is replaced by the subargument currently controlling the expansion. (See Section 5.6.) Concatenation and line continuation are not allowed across end-of-IRP, since a carriage return and linefeed are appended to each expansion. See the example below. EXAMPLES LALL Z=O ANSWER=l Q=2 X=3 Y=4 DEFINE SUM(A,B)( MOVEI Q,O lRF' A,<ADD Q,A> MOVEM Q,B 000000 000001 000002 000003 000004 SUM 201 02 0 00 000000 140 02 0 00 000003 140 02 0 00 000004 140 02 0 00 000000 «X,Y,Z>,ANSWER)~ ADD lhX ADII Q, Y ADD Q,Z 202 02 0 00 000001 MOVEl thO lRF' MOVEM Q,ANSWER RELATED PSEUDO-OPS IRPC, STOPI COMMON ERRORS IRP NOT IN A MACRO (A ERROR). Argument is not a dummy symbol (A error) . Argument is a created symbol (A error) • Mismatched angle brackets. 3-30 PSEUDO-OPS IRPC FORMAT IRPC darg,(code) darg FUNCTION = one of the dummy-arguments of the enclosing macro definition. (IRPC can only be used in the body of a macro definition.) Generates one expansion of code for each character of the string that replaces darg. Each occurrence of darg within the expansion is replaced by the character currently controlling the expansion. (See Section 5.6. ) Concatenation and line across end-of-IRPC, linefeed are appended example below. EXAMPLES 123 000 000 000 000 124 000 000 000 000 122 000 000 000 000 111 000 000 000 000 116 000 000 000 000 107 000 000 000 000 continuation are not allowed since a carriage return and to each expansion. See the DEFINE ACB)(IRPC B,(ASCIZ \B\» ACSTRIN-G)"'IRPC ASC1Z \S\ ASCIZ \T\ ASC1Z \R\ ASC1Z \1\ ASCIZ \N\ ASC1Z \G\ RELATED PSEUOD-OPS IRP, STOPI COMMON ERRORS IRPC NOT IN A MACRO (A ERROR). Argument is not a dummy symbol (A error). Argument is a created symbol (A error). Mismatched angle brackets. 3-31 PSEUDO-OPS LALL FORMAT L~LL FUNCTION Causes the assembler to print in the program listing file everything that is processed, including all text and macro expansions. Since XALL is the default, you must use LALL if you want full macro expansions listed. This can be helpful in debugging a program. LALL does not produce comments in a macro expansion if the comments are preceded by double semicolons ( i i ) . This is because such comments are not stored. OPTIONAL NOTATIONS Use the IE switch described in Table 7-1. RELATED PSEUDO-OPS LIST, SALL, XALL, XLIST 3-32 PSEUDO-OPS .LINK FORMAT .LINK chain-number,store-address,chain-address chain-number = a positive associates the link number. integer expression that with others having the same store-address a symbol giving the store this entry in the chain. address for chain-address = an optional integer expression giving the address of this entry in the chain. If you omit the chain-address, MACRO generates a 0 and LINK uses the store-address as the chain-address. FUNCTION Generates static chains at load time. MACRO generates a REL Block Type 12. (See the LINK Reference Manual for a full discussion of LINK's handling of these chains.) EXAMPLES See the LINK Reference Manual (REL Block Type 12) extensive examples of using .LINK and .LNKEND • RELATED PSEUDO-OPS • LNKEND COMMON ERRORS Chain-number not absolute (A error) . EXTERNAL expression for store-address or (E error). 3-33 for chain-address PSEUDO-OPS LIST FORMAT LIST FUNCTION Resumes listing following an XLIST statement. The LIST function is implicitly contained in the END statement. OPTIONAL NOTATIONS Use the IL switch described in Table 7-1. RELATED PSEUDO-OPS LALL, SALL, XALL, XLIST 3-34 PSEUDO-OPS LIT FORMAT LIT FUNCTION Assembles literals b~ginning' at the current address. The literals assembled are those found since the previous LIT,' or since the beginning of the ,program, whichever is later. The location counter is incremented by 1 fo~ each word assembled. In a PSECTed ,program, LIT assembles the crirr~nt PSECT. 6nly literals in A literal found after the LIT is not affected. It will be assembled at the next followirig LIT, or at the END statement, whichever is earlier. At the END statement; uhassembled literals are placed in open-ended storage after the end-of-program. If data is also to be entered in open-ended storage, literals stored ther~ may "be overwritten. (See Appendix F for a discussion of storage allocation.) This possibility is avoided by using LIT before the END statement. Assembling literals with LIT also produces a listing of their binary code. Literals unassembled at the END are XLISTed. Liter~ls having the same va~ue are collapsed in MACRO's literal pool. Thus for thest~tements: PUSH P,[O] PUSH P,[O] MOVEI AC1,[ASCIZ ITEST1/] the same address is shared by the two literals [0], and by the null word generated' at the end of [ASCIZ /TESTI/]. Literal collapsing is suppressed for those literals that contain errors, undefined expressions, or EXTERNAL symbols. NOTES 1. If the code immediately preceding a LIT does not cause a transfer of execution control to some other location, execution will "fall into" the literal pool, producing unpredictable results. 2. In a file containing PRGEND pseudo-ops, only one LIT is permitted in each module before the last one. The last module (containing the END statement), or any file without PRGENDs, can contain multiple LITs. (Continued on next page) 3-35 PSEUDO-OPS J LIT (Cant. ) EXAMPLES 400046' 200 00 0 00 400050' 400047' 047 00 0 00 000041 400050' 400050' 000001, 000003 RELATED PSEUDO-OPS .DIRECTIVE LITLST, END, PRGEND, VAR COMMON ERRORS Assembling literals so that some are collapsed on Pass 1, but not on Pass 2. For example, in the following lines, the literals [A] and [B] are collapsed on Pass 1 since they have the same value~ but on Pass 2 their values are different and they are not collapsed. This produces a phase error for the label FOO. MOVE O,[XWD 1,3J GETTAB 0, LIT IF1,<A=5 :8=5> IF2,<A=5 :8=4> MOVE AC,[AJ MOVE AC,[SJ LIT FOO: However, literals that have different values in Pass 1 but the same value in Pass 2 do not produce a phase error. For example, the following code generates two words of literal storage in Pass 1. During Pass 2 the values of [A] and [B] are collapsed, but nevertheless MACRO generates two words of literal storage to avoid a phase error at the label FOO. MOVE AC1,[AJ MOVE AC1,[BJ LIT A=5 S=5 FOO: 3-36 PSEUDO-OPS .LNKEND FORMAT .LNKEND chain-number,store-address FUNCTION Ends a static chain generated at load time. See the LINK Reference Manual (REL Block Type 12) for extensive examples of using .LINK and .LNKEND.) RELATED PSEUDO-OPS .LINK COMMON ERRORS Chain~number not absolute (A error). EXTERNAL expression for store-address (E error). 3-37 PSEUDO-OPS Loe . 1 FORMAT LOC express ion' expression = an optional operand whos •. value gives the address at which sequential 'address assignment is to continue. . ., FUNCTION Sets the location counter to the value of the expression and begins assigning absolute addresses to the instructions and data following the LOC instruction. If no address is specified, . the location counter is restored to its value previous to the last LOC pseudo-op or RELOC-RELOC sequence. (See example below.) If no previous LOC pseudo-op was encountered, the assumed address is o. To switch to relocatable address mode, use the pseudo-op RELOC. If no ~rgument is specified, RELOC (in this context) restores the location counter to its value previous to the LOC pseudo-op or LOC-LOC sequence. (An impl ic it RELOC 0 beg ins each program.) If an entire program is to be assigned absolute locations, a LOC statement must precede all instructions and data. Note that, unlike RELOC-RELOC sequences, typically used to switch between segments in a two-segment program, LOC-LOC sequences cannot be successfully interrupted and then resumed. This is demonstrated in the example below. EXAMPLES 400000' 000000' 000010 000010 000011 000100 000100 000101 000012 000102 000000' 000000 000000 000001 000002 000000 000000 000003 000004 TWOSEG 400000 RELOC LOC 10 DEC 1,2 'Set UP hise. 'Back to lowses 'Set UP LOC-LOC LOC 100 [IEC 3,4 LOC LOC RELOC 'But we can't resume LOC-LOC RELOC LOC LOC RELOC 400000' 000102 000102 400000' 'Resume RELOC, RELOC 'But RELOC, RELOC is fine LOC 000102 RELATED PSEUDO-OPS RELOC, .ORG, TWOSEG COMMON ERRORS Using an EXTERNAL expression for the address expression (E error). 3-38 PSEUDO-OPS .MFRMT FORMAT .MFRMT FUNCTION Causes multiformat listing of binary code. The type of instruction assembled determines this format. (See Section 6.1.) .MFRMT is the default setting. OPTIONAL NOTATIONS Use the RELATED PSEUDO-OPS .HFRMT IF switch described in Table 7-1. 3-39 PSEUDO-OPS ·1 KLOFF FORMAT MLOFF FUNCTION Terminates each literal at end-of-line even if no closing square bracket is found. This pseudo-op is intended only to maintain compatibility of programs written for very old versions of MACRO. EXAMPLES This example shows how MLOFF can be used [1234 as [1234]. MLOFF 000000 000000 (1234 (1234J 402001' 402001' OPTIONAL NOTATIONS Use the /0 switch described in Table 7-1. RELATED PSEUDO-OPS MLON 3-40 to interpret PSEUDO-OPS MLON FORMAT MLON FUNCTION Suspends the effect of an earlier MLOFF pseudo-op, thereby enabling the use of multiline literals. MLON is the default ,setting; RELATED PSEUDO-OPS MLOFF 3-41 PSEUDO-OPS • NODDT FORMAT .NODDT symbo1, ••• ,symbo1 FUNCTION Suppresses debugger output of each 'given symbol. Each symbol must have been previously defined. Symbols suppressed with .NODDT can include OPDEF symbols • EXAMPLES • NODDT CALL,PJRST,P OPTIONAL NOTATIONS Use -- for 2.4.2.2.) direct-assignment symbols. Use :! for label symbols. (See (See Section 2.4.2.1.) RELATED PSEUDO-OPS PURGE COMMON ERRORS Using .NODDT with an undefined symbol argument. 3-42 Section PSEUDO-OPS NOSYM FORMAT NOSYM FUNCTION Suppresses listing of the symbol table in listing file. the program Suppressing the listing of symbol tables is useful a library file containing many PRGENDs. 3-43 for PSEUDO-OPS OCT FORMAT OCT expression, •.. ,expression FUNCTION Defines the local radix for the line as octal; the value of each expression is entered in a fullword of code. The location counter is incremented by 1 for each' expression. EXAMPLES 000000 000000 000000 000000 OPTIONAL NOTATIONS Use the EXP pseudo-op and prefix AO to each expression that must be evaluated in radix 8. In the example above, only the third and fourth expressions, "20,100," could have different evaluations in different radixes. Therefore an equivalent notation is: 000000 000000 000000 000000 RELATED PSEUDO-OPS OCT 1,2,20,100 000001 000002 000020 000100 000001 000002 000020 000100 DEC, EXP, RADIX 3-44 PSEUDO-OPS OPDEF FORMAT OPDEF symbol [expression] FUNCTION Defines the symbol as an operator equivalent to expression, giving the symbol a fullword value. When the operator is later used with operands, the accumulator fields are added, the indirect bits are ORed, the memory addresses are added, and the index register addresses are added. An OPDEF can be declared INTERNAL, using the INTERN pseudo-op. However, if a symbol of the same name exists, the INTERNAL declaration will apply only to that symbol, and not to the OPDEF. NOTES EXAMPLES 1. If you use a relocatable symbol in d~fining an OPDEF, the value of the symbol may not be the same for all references to the OPDEF. 2. Though the expression portion of an OPDEF must be in square brackets, this use of the brackets is completely unrelated to literals or literal handling. OPDEF CAL [MOVE 1,@SYM(2)] CAL 1,BOL(2) 200062 000010 200 02 1 04 000014 The CAL statement is equivalent to: MOVE 2,@SYM+BOL(4) 200 02 1 04 000014 RELATED PSEUDO-OPS DEFINE, SYN COMMON ERRORS OPDEF of macroname or SYN symbol (A error). No code generated by statement in er ror) • Missing square brackets (A error). 3-45 square brackets (A PSEUDO-OPS .ORG FORMAT .ORG address FUNCTION Sets the location counter to the address and causes the assembler to assign absolute or relocatable addresses depending on the mode of the argument. If A is relocatable, then .ORG A is equivalent to RELOC Ai if A is ab~olute, then .ORG A is equivalent to LOC A . • ORG with no address sets the location counter to the value it had immediately before the last LOC, RELOC, or .ORG. EXAMPLES 400000' 400000' 000000' 000000' 000100 000100 400100 400100 000100 RELOC 400000 ;Set UP some labels RELAD1: RELOC 0 RELAD2: LOC 100 ABSAD1: LOC 400100 ABSAD2: LOC ABSAD1 400000' RELOC RELAD1 400100 .ORG ABSAD2 400000' .ORG 000000' .ORG RELAII2 400000' .ORG 000000' .ORG ;Set counter to ABSAD1 ; and be~in absolute ; address assi~nment. ;Set counter to RELADl ; and be~in relative ; address assi~nment. ;Set counter to ABSAD2 ; and be~in absolute ; address assi~nment. ;Set counter to value immediatel~ before last LOC, RELOC, or • ORG, and be~irl address assi~nment ; in appropriate mode. ;Set counter to.RELAII2 ; and be~in absolute ; address assi~nment. ;Set counter to value immediatel~ before last LOC, RELOC, or .ORG, and be~in address assi~nment ; in appropriate mode. ;Set counter to value immediatel~ before last LOC, RELOC, or .ORG, and be~in address assi~nment in appropriate mode. RELATED PSEUDO-OPS LOC, RELOC, TWOSEG COMMON ERRORS Using an EXTERNAL symbol or complex EXTERNAL expression for the address expression. 3-46 PSEUDO-OPS PAGE FORMAT PAGE FUNCTION Causes the assembler to list the current line and then skip to the top of the next listing page. The subpage number is incremented, but the page number is not. OPTIONAL NOTATIONS A formfeed character (CTRL/L) in the input text has a similar effect, but increments the page number and resets the subpage number. 3-47 PSEUDO-OPS PASS2 FORMAT PASS2 FUNCTION Switches the assembler to Pass 2 processing for the remaining code. All code preceding this statement will have been processed by Pass I only; all following code by Pass 2 only. You can use PASS2 to reduce assembly time during debugging; you can also use PASS2 to omit the second pass for a UNIVERSAL file containing only symbol definitions (OPDEFs, macros, and direct assignments). EXAMPLES Testing a macro defined in the Pass I portion: IFE NON,< PRINTX 1HORRIBLE ERROR PASS2 END stops assembly if NON 3-48 = O. PSEUDO-OPS PHASE FORMAT PHASE address address = an integer expression; symbol. cannot be an EXTERNAL FUNCTION Assembles part of a program so that it can be moved to other locations for execution. To use this feature; the subroutine is assembled at sequential relocatable or absolute addresses along with the rest of the program, but the first statement before the subroutine is PHASE, followed by the address of the first location of the block into which the subroutine is to be moved prior to execution. All address assignments in the subroutine are in relation to the address argument. The subroutine is terminated by DEPHASE, which restores the location counter. EXAMPLES In the following example, which is the central loop in a matrix inversion, a block transfer instruction moves the subroutine LOOP into accumulators 11 to 15 for execution. (This results in faster execution on KAla and KIlO processors.) 002000' 002001' 002002' 000011 000011 000012 000013 000014 000015 002010' 200 00 0 00 402002'MAIN: 251 00 0 00 000015 254 00 0 00 000011 LOOPX: 210 02 0 03 000002 LOOP: 160 02 0 00 000100 142 02 0 04 000002 365 03 0 00 000011 254 00 0 00 002000' MOUE eXWD LOOPX,LOOPJ BLT LOOP+4 JRST LOOP PHASE 11 MOUN AC,A(X) FMP AC,MPYR FADM AC,A(Y) SOJGE X,. --3 JRST MAIN DEPHASE The label LOOP represents accumulator 11, and the in the SOJGE instruction represents accumulator 11. .-3 Note that the code inside the PHASE-to-DEPHASE program segment is loaded into the address following the previous relocatable code; all labels inside the segment, however, have the address corresponding to the phase address. Thus the phased code, if it contains control transfers other than skips, cannot be executed until it has been moved (for example, by a BLT instruction) to the address for which it was assembled. RELATED PSEUDO-OPS DEPHASE COMMON ERRORS Using an EXTERNAL symbol or complex EXTERNAL expression as the address (E error). 3-49 PSEUDO-OPS POINT FORMAT POINT bytesize,address,bitplace FUNCTION Generates a byte pointer word for use with the machine language mnemonics ADJBP, LDB, IBP, ILDB, and IDBP. Bytesize gives the decimal number of bits in the byte, and is assembled in bits 6 to 11 of the storage word. Addrese-gives the location of the byte word, and is assembled in bits 13 to 35. Bitplac~ gives the position (in decimal) of the rightmost bit of the byte. MACRO places the value 35 minus bitplace in bits 0 to 5 of the storage word. If the address is indirect, bit 13 is set. If the address is indexed, the index is placed in bits 14 to 17. The default bytesize is o. The default bitplace is -1, so that the byte increment instructions IBP, ILDB, and IDBP will begin at the left of the address word. POINT 6,0,5 POINT 6,100 EXAMPLES 36 06 0 00 000000 44 06 0-00 000100 COMMON ERRORS Bytesize or bitplace not given in decimal. Bytesize or bitplace not absolute. Bytesize or bitplace EXTERNAL. 3-50 PSEUDO-OPS PRGEND FORMAT PRGEND FUNCTION Replaces the END statement for all except the last program of a multiprogram assembly. PRGEND closes the local symbol table for the current module. You can use PRGEND to place several small programs into one file to save space and disk accesses. The resulting binary file can be .loaded. in search mode. (See the LINK Reference Manual.) Using PRGEND requires extra memory for assembly, since the tables for each program must be saved for Pass 2. Functionally, however" PRGEND· is .identical to END, except that PRGEND does not end the current assembly pass. NOTE 1. PRGEND is not allowed in macros or PSECTs. 2. PRGEND clears the TWOSEG pseudo-oPe 3. Like END, PRGEND causes assembly of all unassembled literals and variable symbols. 4. In a file containing PRGENDs, using more than one LIT pseudo-op in any but the last program produces unpredictable results. OPTIONAL NOTATIONS Give an argument with PRGEND, specifying the start address for the program. See the END pseudo-op for a discussion of this argument and its meaning. RELATED PSEUDO-OPS END, LIT, VAR COMMON ERRORS Failing to end a text string, REPEAT, conditional code, DEFINE, or literal with a closing delimiter; MACRO cannot see any following PRGEND or END. Confusing multiprogram and multifile assemblies. A multiprogram assembly involves multiple programs separated by PRGENDs. A multifile assembly always involves multiple files separated by end-of-file. The two types of assemblies are not mutually exclusive. 3-51 PSEUDO-OPS PRINTX FORMAT PRINTX text FUNCTION Causes text to be output during assembly. On Pass 1 the text. is output to the terminal and the listing device. On Pass 2 the text is output to the terminal, but only if the terminal is not the listing device. PRINTX is frequently used to. output conditional information and, ln very long assemblies, to report progress of the assembler through Pass 1. EXAMPLES PRINTX ASSEMBLER HAS REACHED POINT NOWGO IFGE .-1000,(PRINTX CODE MORE THAN lP) 3-52 PSEUDO-OPS .PSECT FORMAT ~PSECT name/attribute,origin name = a valid symbol giving the name of the PSECT. attribute = either CONCATENATE or OVERLAID. origin = an expression giving an address for the origin. FUNCTION PSECT Specifies the relocation counter to be used for the code fOllowing. MACRO generates a REL Block Type 23. (See the LINK Reference Manual.) Do not use PRGEND and .PSECT in the same file. MACRO will treat the first PRGEND as an END statement and ignore any following source code. For a complete discussion of PSECTS and th~ir handling, see Section 9.1.3. EXAMPLES .PSECT A/CONCATENATE,O .PSECT FIRST/OVERLAID,1000 OPTIONAL NOTATIONS Omit attribute (defaults to CONCATENATE). RELATED PSEUDO-OPS .ENDPS, LOC, .ORG, RELOC, TWOSEG COMMON Using TWOSEG and .PSECT in the same module. Using HISEG and .PSECT in the same module. 3-53 PSEUDO-OPS PURGE FORMAT PURGE symbol, ••• ,symbol symbol = an assigned symbol, a label, an operator, or a macro name. FUNCTION Deletes symbols from the symbol tables. Normally used at the end of a program to conserve storage and to delete symbols for the debugger. Purged symbol table space is reused by the assembler. If you use the same symbol for both a macro name or OPDEF and a label, a PURGE statement deletes the macro name or OPDEF. Repeating the instruction then purges the label. Purging a symbol that is EXTERNAL or undefined suppresses any error messages associated with it. EXAMPLES 000040 RELATED PSEUDO-OPS .NODDT, XPUNGE LABEL: 1,1 PURGE LABEL 000001 3-54 PSEUDO-OPS RADIX FORMAT RADIX expression expression FUNCTION = decimal value from 2 to 10 Sets the radix to the value of expression. An implicit RADIX 8 statement begins every MACRO program. All numerical expressions that follow (up to the next RADIX pseudo-op) are interpreted in the given radix unless another local radix is indicated. (A different local radix for the line can be indicated by the DEC or OCT pseudo-ops; a different local radix for an expression can be indicated by AB , AD, or AO. See Section 2.2.2.) Ordinarily, numbers outside the range of the given radix are not interpreted. For example, in radix 8, the number 99 causes an error. However, a single-digit number i.s interpreted in any case. For example, in radix 8, the number 9 is recognized as octal 11. RADIX 10 EXAMPLES 000000 000012 EXP 10 000000 000010 EXP 10 RADIX 8 OPTIONAL NOTATIONS Use one of the following prefixes to change the radix for a single expression: AB for binary, ~O for octal, AD for decimal. RELATED PSEUDO-OPS DEC, OCT COMMON ERRORS Using a relocatable expression (A error). Using an external expression (E error). Giving a radix argument decimal (A error). not in Misusing numbers in a given radix; statements the range to 10 for example, in the RADIX 10 RELOC 400000 MACRO treats the number 400000 as decimal. 3-55 2 PSEUDO-OPS RADIX50 FORMAT RADIX50 code,symbol FUNCTION Packs the symbol into bits 4 to 35 of the storage word, with the code in bits 0 to 3. The "50" in RADIX50 is octal, so that the radix in decimal is 40. The 40 characters permitted in symbols are the "digits" of the RADIX50 symbol expression. Thus a symbol is seen by RADIX50 as a "6-digit" number in base 40, converted to binary, and placed in bits 4 to 35 in storage. The code expression for RADIX50 is a number in the range 0 to 74 octal. Its binary equivalent should end with two zeros (that is,the octal should end with 0 or 4), since the two low-order bits will not be stored. The four high-order bits are placed in bits 0 to 3 in storage. A EXAMPLES 126633 466633 RADIX50 10,SYMBOL RADIX50 44,SYMBOL OPT!ONAL NOTATIONS The mnemonic SQUOZE can be used in place of RADIX50. 472376 472376 for the octal values of See Appendix characters. RADIX50 ,symbol (code is taken as zero). RELATED PSEUDO-OPS SQUOZE COMMON ERRORS RADIX50 code not absolute (A error). RADIX50 code does not end with 0 or 4 (Q error) • 3-56 RADIX50 ·PSEODO-OPS RELOC FORMAT RELOC expression expression = an optional operand that specifies the address at which sequential address assignment is to continue. FUNCTION Sets the location counter to the value of extression, and begins assigning relocatable addresses to the instructions and data that follow. In a PSECTed program, RELOC sets the for the current PSECT. location counter If no address is specified, the location counter is restored to its value befor~ the last RELOC, or before the last LOC-LOC sequence, whichever is later. (See the first example below.) If no previous RELOC or LOC-LOC sequence was encountered, the location counter is set to O. An implicit RELOC 0 begins every MACRO program. To switch t~ absolute address mode, use the pseudo-op LOC. Note that· RELOC-RELOC sequences (typically used to switch between segments in a two-segment program) can be interrupted and then resumed. This is demonstrated in the first example below. EXAMPLES 400000' 000000' 000000' 000000 000001 000001' 000000 000002 400000' 400000' 255 00 o 00 000000 000137 000137 000100 400001' RELOC JFCL LOC 137 ;Back to hises ;Deposit version ; irl absolute 137 XWD 100,1 RELOC ;Back to hises ; where left off 400001' 254 00 0 00 400000' JRST .-1 000002' RELOC ;Back to lowses RELATED PSEUDO-OPS 000001 TWOSEG 400000 ;Set I.JP hises RELOC ;Back to lowses DEC 1,2 LOC, .ORG, TWOSEG (Continued on next page) 3-57 PSEUDO-OPS RELOC COMMON ERRORS (Cont.) Using an EXTERNAL symbol or complex EXTERNAL expression as the address. Returning to the wrong segment when using RELOC with TWOSEG. The last four lines of the following example show how this can occur: 400000' 400000' TWOSEG RELOC 400000 ;Sets first RELOC ; counter to 000000' RELOC 0 ; 400000' 400000' 400000' 400001' 000000' 000000' 000001' 400002' 400000' 000000 000000 000001 000002 000000 000000 000003 000004 400002' 400000' 400000' 000000 000001 3-58 RELOC EXP 1,2 ;Saves 400000', ; sets to 000000' ;Swaps counters ;Enter values here RELOC EXP 3,4 ;Swaps asain ;More values here ;Swaps aSain RELOC RELOC 400000 ;Lost counter ; to 000002' ;Swaps aSain RELOC ; Swaps aSairl RELOC ;Overwrites 400000' EXF' 1 PSEUDO-OPS REMARK FORMAT REMARK text FUNCTION Text is a comment. EXAMPLES REMARK OPTIONAL NOTATIONS A comment line can also begin with a semicolon. RELATED PSEUDO-OPS COMMENT COMMON ERRORS Continuing REMARK text to next line without using the continuation character (CTRL/underscore). I CAN SAY ANYTHING HERE. 3-59 PSEUDO-OPS REPEAT FORMAT REPEAT expression,<code> expression = the repeat index, which gives the number of times to repeat assembly of the code given; the repeat index can be any expression having a nonnegative integer value. FUNCTION Generates the code given in angle brackets n REPEAT statements can be nested to any level. times. Line continuation is not allowed across end-of-REPEAT, since a carriage return and linefeed are appended to each expansion of the code. Note that REPEAT O,<code> is logically equivalent to a false conditional, and REPEAT l,<code> is logically equivalent to a true conditional. EXAMPLES 000000 002020' 000000 002021' 000000 002022' 000000 002023' 000000 002024' 000000 002025' 000000 002026' 000000 000000 000001 000001 000002 000002 000003 000003 000004 COUNT=O TABLE: REPEAT 4,<COUNT COUNT=COUNT+1> COUNT COUNT=COUNT+1 COUNT COUNT=COUNT+1 COUNT COUNT=COUNT+1 COUNT COLJNT=COUNT+l REPEAT 3,<.> 002024' • 002025' • 002026' • RELATED PSEUDO-OPS DEFINE, IRP, IPRC COMMON ERRORS No comma after n (A error). Using an EXTERNAL symbol or complex EXTERNAL expression as the repeat index. Mismatching angle brackets. 3-60 PSEUDO-OPS .REQUEST FORMAT .REQUEST· filespec FUNCTION Causes the specified file to be loaded only to satisfy a global r~quest~ that is, the file is loaded in library search mode. (See Chapter '7 for a discussion of fi,les.) The filespec ~ust not include a file type. If you specify a directory, the specification must be a project-programmer number, not a directory name. MACRO generates a REL Block Type Reference Manual.) EXAMPLES .REQUEST DSK:MACROS .REQUEST MACROS OPTIONAL NOTATIONS DSK: 17. the LINK is the default device. Your connected directory at load time directory • RELATED PSEUDO-OPS (See • REQUIRE, . TEXT 3-61 is the default PSEUDO-OPS • REQUIRE FORMAT .REQUIRE filespec FUNCTION Causes the specified file to be loaded automatically, independent of any global requests. (See Chapter 7 for discussion of files.) The filespec must not include a file type. If you specify a directory, the specification must be a project-programmer number, not a directory name. MACRO generates a REL Block Type Reference Manual.) EXAMPLES .REQUIRE DSK:MACROS .REQUIRE MACROS .REQUIRE SYS:MACREL OPTIONAL NOTATIONS DSK: 16. the LINK is the default device. Your connected directory at load time directory. RELATED PSEUDO-OPS (See .REQUEST, .TEXT 3-62 is the default PSEUDO-OPS SALL FORMAT SALL FUNCTION Causes suppression of all macro and repeat expansions and their text~ only the input file and the binary generated will be listed. SALL can be nullified by either XALL or LALL. Using SALL generally produces the tidiest listing file. OPTIONAL NOTATIONS Use the 1M switch described in Table 7-1. RELATED PSEUDO-OPS LALL, LIST, XALL, XLIST 3-63 PSEUDO-OPS SEARCH FORMAT SEARCH tablename(filename) , •.• ,tablename(filename) FUNCTION Defines a list of symbol tables for MACRO to search if a symbol is not found in the current symbol table. A Tables are maximum of ten tables can be specified. searched in the order specified. When the SEARCH pseudo-op is seen, MACRO checks its UNIVERSAL table for a memory-resident internal (See the UNIVERSAL UNIVERSAL of the specified name. pseudo-op for further discussion of memory-resident UNIVERSAL tables and use of the /U switch.) If no such entry is found in the UNIVERSAL table, MACRO reads in the symbol table using the g~ven file specification. If no file specification 1S given, MACRO reads tablename.UNV from the connected directory. If no such file is found, MACRO then tries UNV:tablename.UNV and SYS:tablename.UNV, in that order. When all the specified files are found, MACRO builds a table for the search sequence. If MACRO cannot find a given symbol in the current symbol table, the UNIVERSAL tables are searched in the order specified. When the symbol is found, it is moved into the current symbol table. This procedure saves time (at the expense of core) on future references to the same symbol. A UNIVERSAL file can search provided all names in the assembled. other UNIVERSAL files, search list have been The internal table of UNIVERSAL names is cleared on each run (@MACRO) or START command, but is not cleared when MACRO responds with an asterisk. In a PSECTed program, all UNIVERSAL symbols the blank PSECT. belong to EXAMPLES SEARCH MONSYM,MACSYM OPTIONAL NOTATIONS Omit the filename and its enclosing parentheses. MACRO then looks on DSK:, UNV:, and SYS: (in that order) for tablename.UNV. RELATED PSEUDO-OPS UNIVERSAL COMMON ERRORS Not purging a macro that redefines itself (P error). If a macro is found in a universal file, the definition is copied into the current macro table and the auxiliary table is not searched on Pass 2. Thus, a macro that redefines itself can cause P errors similar to enclosing the macro by IFI. Such macros should be purged before Pass 2. 3-64 PSEUDO-OPS SIXBIT FORMAT SIXBIT dtextd d = delimiter; first nonblank character, whose appearance terminates the text. FUNCTION second Enters strings of text characters in 6-bit format. Six characters per word are left justified in sequential storage words. Any unused bits are set to zero. Lowercase letters in SIXBIT text strings,are treated as uppercase. Otherwise, only the SIXBIT character set is allowed. (See Appendix A for SIXBIT characters and their octal codes.) EXAMPLES OPTIONAL NOTATIONS 64 45 70 64 00 63 64 62 51 56 47 00 SIXBIT \TEXT STRING\ 644570 EXP SIXBIT ITEXTI 640000 Omit the space or tab after SIXBIT. This is not allowed if the delimiter is a letter, number, dot, dollar sign, or percent sign (that is, a possible symbol constituent) , or if the ASCII value of the delimiter character is less than 040 or greater than 172. Right-justified SIXBIT can be entered by quotes to surround up to six characters; 006251 475064 using single for example, 'RIGHT' RELATED PSEUDO-OPS ASCII, ASCIZ, .DIRECTIVE FLBLST COMMON ERRORS Using the delimiter character in the text string. Missing the end delimiter (that is, attempting to use a carriage return as a delimiter). Using more than six characters in a right-justified SIXBIT string, or more than three characters if in the address field (Q error) • Using non,SIXBIT characters in the text string. 3-65 PSEUDO-OPS SQUOZE 1 FORMAT SQUOZE code,symbol FUNCTION SQUOZE is a mnemonic for RADIX50. EXAMPLES 126633 126633 OPTIONAL NOTATIONS RADIX50 code,symbol 472376 472376 RADIX50 10,SYMBOL SQUOZE 10,SYMBOL SQUOZE ,symbol. (code is taken as 0). RELATED PSEUDO-OPS RADIX50 COMMON Errors Code not absolute (A error). Code does not end with 0 or 4 (Q error) • 3-66 PSEUDO-OPS STOPI FORMAT STOPI FUNCTION Ends an IRP or IRPC before all subarguments or characters are used. The current expansion is completed, but no new expansions are started. STOPI can be used with conditionals inside IRP or IRPC to end the repeat if the given condition is met. EXAMPLES LALL DEFINE ONETWO(A>( IRP A,(IFIDN(A)(ONE),(STOPI EXP 1» IRP A,(IFIDN(A>(TWO),(STOPI EXP 2» ONETWO (A,B,D>'"' IRP IFIDN(A>(ONE>,(STOPI IFIDN(B>(ONE>,(STOPI EXP 1> EXP 1> IFIDN(D>(ONE),(STOPI EXP 1> IRP IFIDN(A>(TWO>,(STOPI EXP 2> IFIDN(B>(TWO>,(STOPI EXP 2> IFIDN(D>(TWO>,(STOPI EXP 2> 000000 ONETWO (A,ONE,B,ONE,TWO>~ IRP IFIDN(A>(ONE>,(STOPI EXP 1) IFIDN(ONE>(ONE),(STOPI 000001 EXP 1) IRP IFIDN(A>(TWO>,(STOPI IFIDN(ONE)(TWO>,(STOPI IFIDN(B>(TWO),(STOPI IFIDN(ONE)(TWO>,(STOPI IFIDN(TWO>(TWO),(STOPI 000000 000002 EXP 2) EXP 2)EXP 2> EXP 2> EXP 2> RELATED PSEUDO-OPS IRP, IRPC COMMON ERRORS STOPI not inside IRP or IRPC. 3-67 PSEUDO-OPS SUBTTL FORMAT SUBTTL subtitle FUNCTION Defines a subtitle (of up to 80 characters) to be printed at the top of each page of the listing file until the end-of-listing or until another SUBTTL statement is found. The initial SUBTTL usually appears on the second line of the first page of the input file, immediately following the TITLE statement. For subsequent SUBTTL statements, the applies: if the new SUBTTL is on the new page, then the new subtitle appears if not, the new subtitle appears on the following rule first line of a on that page; next page. NOTE The statements • • • PRGEND TITLE FOO SUB TTL BAR do not cause BAR to appear as the subtitle the first page of the listing of FOO. on SUBTTL affects only the listing file, and subtitles can be changed as often as desired. EXAMPLES SUB TTL THIS SECTION CONTAINS DEVICE-DEPENDENT ROUTIN.ES RELATED PSEUDO-OPS TITLE 3-68 PSEUDO-OPS SUPPRESS FORMAT SUPPRESS symbol, ••• ,symbol FUNCTION Turns on a suppress bit in the symbol table for the specified symbols. The s~ppress bit will be turned off for any symbol later referenced in the program. Symbols whose suppress bits are on at the end of assembly are not listed in the symbol table, but will be listed in any tables built by CREF unless they are XCREFed. When an appended parameter file (as opposed to a UNIVERSAL file) is used in an assembly, many symbols may be defined but never used. These take up space in the binary file and complicate listing of the file. Unused and unwanted symbols can be removed from tables by SUPPRESS or ASUPPRESS. These pseudo-ops control the suppress bit in each entry of the symbol table; if the bit is on, the symbol in that location is not output. RELATED PSEUDO-OPS ASUPPRESS COMMON ERRORS Attempting to suppress an undefined symbol. 3-69 PSEUDO-OPS SYN FORMAT SYN syml,sym2 syml = a defined symbol. sym2 = a symbol to be defined as synonymous with syml. FUNCTION Defines sym2 as synonymous with syml. If syml is defined as both a label sym2 assumes the label definition. EXAMPLES and an operator, The following are legal SYN statements: SYN X,K SYN FAD,ADD SYN END,XEND To turn XLIST into a hull operator, DEFINE .XL <: )SYN .XL,XLIST To restore its operation, PURGE XLIST RELATED PSEUDO-OPS DEFINE, OPDEF COMMON ERRORS Missing symbol (A error). Unknown symbol - first operand not defined (A error). Missing comma (A error) • Using a variable as one error). 3-70 of the symbol arguments (A PSEUDO-OPS TAPE FORMAT TAPE FUNCTION Causes the assembler to begin assembling the program contained in the next source file in the MACRO command string. EXAMPLES (Interactive) @MACRO *DSK:BINAME,LPT:=TTY:,DSK:MORE PARAM=6 TAPE ;THIS COMMENT WILL BE IGNORED ,..z This sets PARAM to 6 and assembles the remainder of the program from the source file DSK:MORE. Since MACRO is a two-pass assembler, the TTY: file must be repeated for Pass 2. [MCREP1 END OF PASS 1J PARAM=6 TAPE ,..z Note that all text after the TAPE pseudo-op is ignored. 3-71 PSEUDO-OPS .TEXT FORMAT .TEXT dtextd d = delimiter; first nonblank character, whose appearance terminates the text. FUNCTION second Generates an ASCIZ REL Block Type for LINK and inserts the text string directly into the .REL file output as a separate block. (See the LINK Reference Manual.) The text inserted in the .REL file is interpreted as a command string for LINK. Therefore a MACRO program loaded by user commands to LINK can contain additional LINK commands, carried out when the MACRO program is loaded. EXAMPLES .TEXT '/SET:.HIGH.:SOOOOO' OPTIONAL NOTATIONS Omit the space or tab after .TEXT. This is not allowed if the delimiter is a letter, number, dot, dollar sign, or percent sign (that is, a possible symbol constituent), or if the ASCII value of the delimiter character is less than 040 or greater than 172 . RELATED PSEUDO-OPS • REQUEST, .REQUIRE COMMON ERRORS Using the delimiter character in the text string. Missing the end delimiter (that is, attempting to use a carriage return as a delimiter). 3-72 PSEUDO-OPS I TITLE FORMAT TITLE title FUNCTION Gives the program name and a title to be printed at the top of each page of the program listing. The first characters (up to six characters, or up to the first non-RADIX50 character) are the program name. This name is used when debugging with DDT to gain access to the program's symbol table. The entire text of the title is printed on each page of the program listing. Only one TITLE statement is allowed . in a module; programs with PRGEND statements can use one TITLE statement for each module. A TITLE statement can appear anywhere in the program; it usually appears as the first line of the program. If no TITLE statement is used, the program name ".MAIN". EXAMPLES the assembler inserts TITLE FLOATING-POINT NUMBER PACKAGE The program name is FLOATI; the words FLOATING-POINT NUMBER PACKAGE will appear at the head of each page and subpage of the listing. RELATED PSEUDO-OPS SUBTTL, UNIVERSAL COMMON ERRORS Using more than one TITLE in a program. Using TITLE and UNIVERSAL in the same module (M error). 3-73 PSEUDO-OPS TWOSEG FORMAT _I TWOSEG expression expression = any expression glvlng a nonnegative value as the begihning of the program high segment1 cannot be EXTERNAL. FUNCTION Directs MACRO t~ assemble a two-segment program with 'the high segment beginning at the given address. MACRO sets the location counter to the given address, and generates a REL Block Type 3, which tells LINK to expect two segments. (The address is reduced to the next lower multiple of 2000 (octal). If this result is 0, the address defaults to 400000.) Only one TWOSEG pseud6-op is allowed in a program. High-segment code is controlled by using RELOC with a value 'at least as large as the TWOSEG address. Low-segment-code is controlled by smaller RELOC values. NOTE Using TWOSEG without an argument sets the beginning address for the high segment to 400000. However, this does not set the location counter to 400000. EXAMPLES DATA: START: TWOSEG RElOC 0 BLOCK 10000 RElOC 400000 EXIT 0 flow seSment ;HiSh sesment RELATED PSEUDO-OPS LOC, .ORG, RELOC COMMON ERRORS Using an EXTERNAL symbol or complex EXTERNAL expression as the address argument. Using TWOSEG more than once in a program (Q error). Generating relocatable code before the TWOSEG pseudo-op (Q error) • Using PSECT and TWOSEG in the same program. 3-74 PSEUDO-OPS UNIVERSAL FORMAT UNIVERSAL tablename FUNCTION Declares the symbol table of the current program available to other programs, and stores the given tablename in MACRO's internal UNIVERSAL table. The tablename is also taken as the program name, and appears in the heading of each page of the listing file. When an END or PRGEND statement is found, the symbol table is placed immediately after the assembler's pushdown stacks and buffers. In addition to this memory-resident copy of the UNIVERSAL symbol table, the file tablename.UNV is generated. (This file can be suppressed by the /U switch described in Table 7-1.) UNIVERSAL files can be used to generate data, but are more commonly used to generate symbols, macros, and OPDEFs. The symbols and OPDEFs generated in a UNIVERSAL program need not be declared INTERNAL, since its local symbols are available to accessing programs. (See the SEARCH pseudo-op.) Memory-resident UNIVERSAL symbol tables are cleared on each run (@MACRO) or START, but are not cleared when MACRO responds with an asterisk. This saves redundant lookups when many programs search a common set of UNIVERSALs. Note that if a sequence of programs (or even one program) searches more than ten UNIVERSAL symbol tables, a SEARCH table overflow occurs. This overflow forces reinitialization of the assembler by a run (@MACRO) or START command. For a UNIVERSAL program that does not generate data (that is, it has only symbol, macro, and OPDEF I-pass definitions), you can save time by using assembly. However, such a file must not contain forward references to symbol definitions. A UNIVERSAL file cannot contain PSECTs. (Continued on next page) 3-75 PSEUDO-OPS I UNIVERSAL (Con t. l NOTES 1. For COMPILE-class commands, the existence of the file tablename.REL may prevent recompilation of the UNIVERSAL file tablename.MAC. To avoid this, force compilation of the .MAC file by including /COMPIL in the command string. 2. Generally, a UNIVERSAL file need not be reassembled when referencing programs are assembled with newer versions of MACRO. However, if the UNIVERSAL's assembler version is newer than the program's, you may get the MCRUVS message, indicating skewed UNIVERSAL versions. In this case, reassembly or one or both files is required (using the same assembler version). EXAMPLES UNIVERSAL Sl START=765 AC1=1 F=O END RELATED PSEUDO-OPS SEARCH, TITLE COMMON ERRORS Using TITLE and UNIVERSAL in the same module (M error). 3-76 PSEUDO-OPS VAR I FORMAT VAR FUNCTION Causes variable symbols (defined in previous statements by sUffixing the number sign (#), or by ARRAY or INTEGER statements) to be assembled as BLOCK statements. This has no effect on subsequent definitions of symbols of the same type. If the VAR statement does not appear in the program, all variables are stored at the end of the program. If the pseudo-op TWOSEG is used, the variables reserved by an array statement must be assigned to the low segment;· thus a RELOC back to· the low segment is required before using the VAR pseudo-oPe EXAMPLES 402003' 402004' 402005' 402006' 402007' 402010' 402011' 001052' 001052' 001055' RELA.TED PSEUDO-OPS ARRAY, BLOCK, INTEGER 201 01 0 202 01 0 201 02 0 202 02 0 140 01 0 200 01 0 263 17 0 01 000000 00 402012' 02 000000 00 402013' 00 000002 00 402014' 00 000000 . 3-77 A[I[J2! MOVE I 1,0(1) MOVEM 1,FIRSTi MOVE I 2,0(2) MOVEM 2,SECONDi ADD 1,2 MOVE 1,SUMi F'OF'J 17, RELOC VAR BLOCK 2 PSEUDO-OPS XALL FORMAT XALL FUNCTION Resumes standard listing after previous LALL (XALL is the default among these three.) XALL suppresses all lines of the program that do not generate binary code. or SALL. listing file XALL does not suppress REPEAT expansions. NOTE Under XALL only one listing line is output for each source line generating binary code in a macro expansion. Occasionally, a single line of a macro definition expands into several lines of listing text. When this occurs, part of a binary-generating source line may not be listed. You can avoid this by temporarily setting the listing mode to LALL (list all) or SALL (suppress all) around such lines. RELATED PSEUDO-OPS LALL, LIST, SALL, XLIST OPTIONAL NOTATIONS Use the IX switch described in Table 7-1. 3-78 PSEUDO-OPS .XCREF FORMAT .XCREF symbol, ••• ,symbol FUNCTION Suspends output of cross-referencing for the specified symbols. References to these symbols between this statement and the next .CREF or the end of the program will not appear in the cross-reference listing • OPTIONAL NOTATIONS • XCREF If no symbol names are specified, for all symbols • MACRO cross-refer~ncing RELATED PSEUDO-OPS • CREF COMMON ERRORS Specifying a nonexistent symbol 3-79 (A error). suspends PSEUDO-OPS XLIST FORMAT XLIST FUNCTION Suspends output to the program listing file. This output occurs only in Pass 2; XLIST does not affect Pass 1. To resume output, use the pseudo-op LIST • EXAMPLES . The following sequence of code shows an XLIST pseudo-op suppressing listing of literals: EXIT XLIST LIT LIST EN[I ; Er.d of p rog ram ;[lon't list literals This sequence of code lists as: 401023' 104 00 0 00 000170 HALTF XLIST LIST EN[I ;End of program ;[lon't list literals Note that the high-segment break will be greater than 401023' because the literals are assembled after the HALTF. RELATED PSEUDO-OPS LALL, LIST, SALL, XALL OPTIONAL NOTATIONS Use the /S switch described in Table 7-1. 3-80 PSEUDO-OPS XPUNGE FORMAT XPUNGE FUNCTION Deletes all local symbols during Pass 2. This reduces the size of the .REL file and speeds up loading. XPUNGE should immediately precede the END statement. RELATED PSEUDO-OPS PURGE 3-81 PSEUDO-OPS XWD FORMAT XWD lefthalf,righthalf FUNCTION Enters two halfwords in a single storage word. Each half is formed in a 36-bit register, and the low-order 18 bits are placed in the. halfword. The high-order bits are ignored. XWD statements are used to set up pointer words for block transfer instructions. Block transfer pointer words contain two 18-bit addresses; the left half is the starting location of the block to be moved, and the right half is the first location of the destination. EXAMPLES 402017' 200 02 0 00 403040' 402020' 251 02 0 00 403035' •• • ••• t FROM1: T01: 402636' 402736' 403035' OPTIONAL NOTATIONS MOVE 2,CXWD FROM1,T01J BLT 2,TOENDl t • BLOCK 100 BLOCK 100 TOEND1=.-1 lefthalf"righthalf BYTE (18)lefthalf,righthalf COMMON ERRORS Using halfword with absolute (Q error). value larger than 18 bits Using two commas between the arguments to XWD. For example, XWD A,3 is correct; XWD A,,3 is incorrect. 3-82 PSEUDO-OPS z FORMAT Z accumulator, address FUNCTION Z is treated as if it were the null machine langua~e mnemonic. An instruction word is formed with zeros In bits 0 to 8. The rest of the word is formed from the accumulator and address. (See Section 4.7.1.) EXAMPLES 403036' 000 00 0 00 000000 403037' 000 01 0 04 000002 3-83 z Z 1,2(4) CHAPTER 4 MACRO STATEMENTS AND STATEMENT PROCESSING A MACRO statement has one or more of the following: a label, an operator, one or more operands, and a comment. The general form of a MACRO statement is: label: operator operand,operand ;comment A carriage return ends the statement. NOTES 4.1 1. Direct-assignment statements receive special handling. (See Section 2.4.2.2.) 2. Processing of macros is not discussed here because a macro call produces a text substitution. After substitution, the text is processed as described In this chapter. Macros are discussed in Chapter 5. LABELS A label is always a symbol with a suffixed colon. (See Section 2.4.2.1.) The assembler recognizes a label by finding the colon. If a statement has labels (you can use more than one), they must be the first elements in the statement. A label can be defined only once; its value is first word of code generated after it. the address of the Since a label gives an address, the label can be either absolute or relocatable. A label is a local symbol by default. You can declare a label INTERNAL global or EXTERNAL global. (See Section 2.4.5.) 4-1 MACRO STATEMENTS AND STATEMENT PROCESSING 4.2 OPERATORS After processing any labels, the assembler views nonblank, non tab characters as a possible operator. one of the following: 1. All A MACRO-defined mnemonic. Appendix C, and are discussed Manual. 2. A user-defined operator. 3. A pseudo-op. 3. ) . the following An operator is mnemonics are listed in in the Hardware Reference (See the pseudo-op OPDEF in Chapter (See Chapter 3.) If the characters found do not form one of the above, then MACRO views them as an expression. An operator is ended by the first non-RADIX50 character: if it is ended by a blank or tab, op~iands may follow; if it is ended by a semicolon, there are no operands and the comment field begins; if it is ended by a carriage return, the statement ends and there are no operands or comments. 4.3 OPERANDS After processing labels and the operator, if any, the assembler views as operands all characters up to the first unquoted semicolon or carriage return. Commas delimit the operands. The operator in a statement determines the number (none, one, two or more) and kinds of permitted or required operands. Any expected operand not found is interpreted as null. An operand can be any expression or symbol appropriate for the operator. 4.4 COMMENTS The first unquoted semicolon in a statement begins the comment field. You can use any ASCII characters in a comment; however, angle brackets in a comment may produce unpredictable results. You can continue a comment to the next line by typing CTRL/ , followed by a carriage return. If the first nonblank, non tab character in a line is a semicolon, the entire line is a comment. You can also enter a full line of comment with the pseudo-op REMARK, or a multiline comment with the pseudo-op COMMENT. (See Chapter 3.) Comments do not affect binary program output. 4-2 MACRO STATEMENTS AND STATEMENT PROCESSING 4.5 STATEMENT PROCESSING MACRO processes your program as a linear stream of data. During Pass 1, MACRO may find references to symbols not yet defined. These symbols are entered in the user symbol ~able. Whenever a symbol is defined, it is entered in the table with its value, so that on Pass 2 all definitions can be found in the table. The values then replace the symbols in the binary code generated. NOTE Delayed definition is allowed only for labels and direct-assignment symbols. A symbol that contributes to code generation (for example, an OPDEF, a macro, or a REPEAT index) must be defined before any reference to it. Statement processing proceeds as follows: 4.6 1. Labels are found and entered in the user symbol table. 2. The next characters up to the first unquoted blank, tab, comma, or equal sign are processed. semicolon, a. Equal sign: the characters form a symbol, and the following characters form an expression. The symbol and the value of the expression are entered in the user symbol table. b. Other delimiter: the characters form an expression or an operator. If an operator, it is found in a table and assembled. If an expression, its value is assembled. 3. If the operator takes operands, the next characters up to the first unquoted semicolon or carriage return form operands. Unquoted commas delimit operands. For each operand, leading and trailing blanks and tabs are ignored. Operands are evaluated and assembled for the given operator. 4. The first unquoted semicolon ends processing of the line. Any further characters up to the first carriage return are comment. 5. The first unquoted carriage return ends the following characters begin a new statement. statement. Any ASSIGNING ADDRESSES MACRO normally (and by default) assembles statements with relocatable addresses. Assembly begins with the zero storage word and proc~eds sequentially. Each time MACRO assembles a word of binary code, it increments its location counter by 1. 4-3 MACRO STATEMENTS AND STATEMENT PROCESSING A mnemonic operator generates one word of binary code. Directassignment statements and some pseudo-ops do not generate code. Some pseudo-ops generate more than one word of code. You can control address assignment by setting the assembler's location counter using the pseudo-ops LOC and RELOC. (See Section 9.1.) You can also reference addresses relative to the location counter by using the dot symbol (.). For example, the expression .-1 used as an address refers to the location immediately preceding the current location. In revising MACRO program~, you can cause an incorrect address to be assembled by adding or removing statements within the range of a .+n expression. For example, in the sequence SKIPE O(AC) JRST GOTONE AOJA AC,.-2 000000' 332 00 0 01 000000 000001' 254 00 0 00 001020' 000002' 344 01 0 00 000000' the expression .-2 gives the address of the SKIPE statement. If you revise this sequence by inserting a statement, you should change the expression to .-3 so that it still refers to the correct statement. 000000' 000001' 000002' 000003' 332 00 254 00 350 00 344 01 0 0 0 0 SKIPE O(AC) JRST GDTONE ADS NULCNT ADJA AC,.-3 01 000000 00 001020' 00 000014 00 000000' ;Added line ;Chansed line For this reason, use great care with such expressions other and • -1. Using labels avoids this problem entirely • 4.7 than .+1 MACHINE INSTRUCTION MNEMONICS AND FORMATS There are two kinds of machine instruction mnemonics: primary and input/output. Primary instructions generate binary code in primary instruction format; input/output instructions generate binary code in input/output instruction format. 4.7.1 Primary Instructions A primary instruction is in one of the forms mnemonic accumulator,address mnemonic accumulator, mnemonic address where mnemonic is a machine instruction mnemonic, accumulator is an accumulator register address, and address is a memory address. The memory address can be modified by indexing, indirect addressing, or both. 4-4 MACRO STATEMENTS AND STATEMENT PROCESSING A complete list of machine instruction mnemonics and their octal codes is given in Appendix C, and these mnemonics are discussed in the Hardware Reference Manual. The accumulator address gives the address of a register, and can be any expression or symbol whose value is an integer in the range 0 to 17 octal. The memory address gives a location in memory, and can be any expression or symbol whose value is an integer in the range 0 to octal 777777. You can modify the memory address by indirect addressing, indexed addressing, or both. For indirect addressing, prefix an at sign (@) to the memory address in your program. For indexed addressing, suffix an index register address in parentheses to the memory address in your program. This address can be any expression or symbol whose value is an integer in the range 1 to octal 17. NOTE To assemble the index, MACRO places the index register address in a fullword of storage, swaps its halfwords, and then adds the swapped word to the instruction word. For an example of a primary instruction (assuming that AC17, TEMP, and XR have the octal values 17, 100, and 3, respectively), the statement ADD AC17,@TEMP(XR) generates the binary code instruction code 010 III 000 memory address indirect bit 1 III accumulator 1 o 011 000 000 000 001 000 000 index register which appears in the program listing as 270 17 1 03 000100 ADD AC17,@TEMP(XR) The mnemonic ADD has the octal code 270, and this is assembled into bits 0 to 8. The accumulator goes into bits 9 to 12. Since the @ appears with the memory address, bit 13 is set to 1. The index register goes into bits 14 to 17. Finally, the memory address is assembled into bits 18 to 35. If any element is missing from a primary assembled in its instruction word field. 4-5 instruction, zeros are MACRO STATEMENTS AND STATEMENT PROCESSING 4.7.2 Mnemonics With Implicit Accumulators A few mnemonics set bits in the accumulator field as well as in the instruction field. Therefore these mnemonics do not take accumulator operands, and are of the form mnemonic address These mnemonics and their octal codes Appendix C. are listed in Table C-5 in For example, the mnemonic JFOV gives the octal code 25504; JFCL gives 255. Therefore both give the opcode 255 in bits 0 to 8, but JFOV also sets the accumulator bits (9 to 12) to binary 0001. This makes JFOV 100 equivalent to JFCL 1,100: 255 01 0 00 000100 255 01 0 00 000100 4.7.3 JFOV 100 JFCL 1,100 Input/Output Instructions An input/output statement in your program resembles a primary instruction statement except that the first operand gives a device number instead of an accumulator. The general format is: mnemonic device,address In an input/output instruction, the indirect, index, and address fields (bits 13 to 35 inclusive) are assembled exactly as in a primary instruction. Unlike a primary instruction word, however, an input/output word has a split instruction code in bits 0 to 2 (always set to I I I binary) and 10 to 12, and a device code in bits 3 to 9. The device code can be any expression or symbol giving a valid device code for your system. (MACRO-defined I/O instruction mnemonics and device code mnemonics are listed in Tables C-2 and C-3 in Appendix C.) For example statement (assuming that NVR has the octal value 1037), the DATAl CDR,@NVR(4) generates the binary code device code III 001 001 1 memory address indirect bit 00 1 1 instruction code o 100 index register which appears in the listing as 7 114 04 1 04 001037' DATAl CDR,@NVR(4) 4-6 000 000 001 000 011 I I I MACRO STATEMENTS AND STATEMENT PROCESSING The octal code for the mnemonic DATAl is 70004, which is written in bits 0 to 14. The octal device code 114 (for card reader) is then overwritten in bits 3 to 9. The @ in the statement sets bit 13 to 1. The index register and memory address are placed in bits 14 to 17 and 18 to 35, as in a primary instruction. 4.7.4 Extended Instructions The KLIO Extended Instruction Set is a multifunction instruction set that performs character-string editing, decimal-to-binary conversion, string move with left or right justification, string move with offset or translation, and string compare. The Extended Instruction Set consists of a single KL10 instruction (EXTEND, octal 123) and a set of 16 extended operators. (See the Supplement to the Hardware Reference Manual.) The KL10 EXTEND instruction mnemonics Appendix C. 4-7 are listed in Table C-4 in CHAPTER 5 USING MACROS A macro is a sequence of statements defined and named in your program. When you call a macro (by invoking its name in your program), the sequence of statements from its definition is generated in line, replacing the call. A macro can have arguments. By using macros with arguments, you can generate passages of code that are similar, but whose differences are controlled by the passed arguments. This saves repetition in building a source file. 5.1 DEFINING MACROS Before you can call a macro, you must define it. You can also the new definition simply replaces the redefine a macro if you wish; old one. To define (or redefine) a macro, use the pseudo-op DEFINE: DEFINE macroname {darglist)<macrobody> where macronam~ is the name of the macro, darglist is an optional list of dummy-arguments, and macrobody is a sequence of statements. The macroname is a symbol; you must follow the rules symbols in selecting a macroname. (See Section 2.4.1.) for valid The optional dummy-argument list can give one or more dummy-argument symbols through which values are passed to the sequence of statements. If a macro definition has dummy-arguments, they must be enclosed in parentheses. Use commas-as delimiters between dummy-arguments. For each dummy-argument, leading and trailing spaces and tabs are ignored. The macrobody is the sequence of statements you want to generate when you call the macro. The macrobody must be enclosed in angle brackets. Here is an example of a macro definition: 5-1 USING MACROS DEFINE VHAG (WHERE,LENG) < ;Vector lensth routine ;Get first HOVE O,WHERE ; component ;SalJare it FMP 0 HOVE 1,WHERE+1 ;Get second ; COI,IF-Onent FMP 1,1 ;SalJdre it ;Add SQuare FAD 1 ; of second ;Get third HOVE1,WHERE+2 ; component ;SQuare it FMP 1,1 ;Add SQuare FAD 1 ; of third PUSHJ 17,FSQRT ;Floatins SQRT ; routine ;Store the HOVEM LENG ; lensth ). NOTE Comments in a macro use storage. If you begin a comment with a double semicolon, the comment is listed in the definition but not stored for listing with expansions. 5.2 CALLING MACROS You can call a macro by putting its name in your program. Recall that you must define the macro before you can call it. You can use the macroname as a label, an operator, or an operand. If the macro's definition has dummy-arguments, the macro call can have arguments. The arguments passed to the macro are inserted into the defined sequence of statements as it is generated. The first passed argument replaces the first dummy-argument; the second passed argument replaces the second dummy-argument; this treatment continues for each argument passed. Any missing arguments are passed as nulls (zeros) or filled in by default arguments (see Section 5.5). NOTE If Faa is a macro with four dummyarguments, the call Faa A"c passes A and C as the first and third arguments. The second argument is passed as nulls; it is not considered missing and cannot be replaced by a default argument. The fourth argument is missing and will be replaced by a default argument if one has been defined; otherwise it is passed as nulls. (See section 5.5.1.) 5-2 OSING MACROS After argument substitution, the defined sequence of statements replaces the macroname and argument list in the source text. For example, suppose you have defined VMAG(A,B) as shown in Section 5.1 above, and VMAG appea~s in your program as TAG1: TAG2: TAG3: LALL F'7=245 VLEN=ll F'LACE=15 ;Get P7 MOVE 1,F'7 ; PIJt it in PLACE MOVEM PL.ACE VMAG PLACE,VLEN ;Get length MOVE 1,VLEN Then the code to be assembled is: LALL 000245 000011 000015 200 01 o 00 000245 202 00 o 00 000015 TAG1: TAG2: 200 00 0 00 000015 160 00 0 00 000000 200 01 0 00 000016 160 01 0 00 000001 140 00 0 00 000001 200 01 0 00 000017 160 01 0 00 000001 140 00 0 00 000001 264 00 0 00 001007' 202 00 0 00 000011 200 01 o 00 000011 TAG3: F'7=2.45 VLEN=11 PLACE=15 ;Get P7 MOVE 1,P7 ;Put it in PLACE MOVEM PLACE VMAG F'LACE,VLEN~ ;Vector length rOIJtine MOVE O,PLACE ;Get first ; cOITIPonent ; SCHJare it FMF' 0 MOVE 1,PLACE+1 ;Get second ; cOITIPonent ;Sauare it FMP 1,1 ; Add salJa re FAD 1 ; of second MOVE 1,PLACE+2 ;Get third ; cOITIPonent ;Sauare it FMP 1,1 ;Add sauare FAD 1 ; of third ;Floating SQRT JSR FSQRT ; routine ;Store MOVEM VLEN ; length MOVE 1,VLEN ;Get length Notice that the macro definition has the dummy-arguments A and B in the macrobody. The call VMAG PLACE,VLEN causes PLACE to replace each appearance of A, and VLEN to replace each appearance of B. NOTES 1. Under LALL, when the text of a macrobody is listed at call, it is enclosed in up-arrows (A). 2. Under XALL, the beginning of the text of a macrobody is marked by an up-arrow; the ending is marked by an up-arrow only if the last line of the macrobody generates binary code. 5-3 USING MACROS 5.2.1 Macro Call Format In a macro'call, tabs. deli~it the macroname with one or more blanks or If the macro has arguments, the first nonblank, non tab character begins the argument list. Each argument ends with a comma, a carriage return, or a semicolon. These three characters cannot be used within arguments unless enclosed by special quoting characters. (See Section 5.2.2.) Leading and trailing spaces and tabs are stripped from' each argument unless they are within special quoting characters. Embedded spaces and tabs are not stripped. You can continue an argument to the next line by using CTRL/underscore. Otherwise an unquoted carriage return or semicolon ends the argument and the argument list. An unquoted semicolon also begins the comment field. 5.2.2 Quoting Characters in Arguments The special quoting characters for: macro argument handling are: < ) ( ) [ ] " " angle brackets parentheses square brackets quote marks NOTE Single quote marks (apostrophes) are not special quoting characters. Any character, including the semicolon (i), enclosed in special quoting characters is treated as a regular character. If one of the special quoting characters is to be passed as a regular character, it must be enclosed by different special quoting characters. Here are the rules for macro argument handling. is assumed to be a defined macro: 1. In the examples, Faa The special quoting characters are not argument delimiters. They only tell the assembler to treat the enclosed characters as regular characters. Faa C<A,B) has one argument: C<A,B). Faa C,D<A,B) has two arguments: C and D<A,B). 5-4 USING MACROS 2. With the two exceptions explained below, special characters are always included in passed arguments. FOO A, (B,C) has two arguments: A and (B,C). FOO [XWD 1,Ll]-1(AC) has one argument: FOO "(",0 has two arguments: quoting [XWD 1,Ll]-1(AC). "(" and O. Exception 1: If the first character of the argument list is a left parenthesis, then it and its matching right parenthesis delimit the argument list. They are not treated as special quoting characters and are not included in passed arguments. All nested quoting characters except angle brackets are disabled. After stripping the outer parentheses, angle brackets are handled as described in Exception 2 below. FOO (A,B,C) has three arguments: A, B, and C. FOO (?LENGTH >132) has one argument: FOO ([A,B]) has two arguments: FOO «A,B» has one argument: ?LENGTH >132. [A and B]. A,B. Exception 2: If a left angle bracket is the first character of the argument list, or the first character after an unquoted comma, then it and its matching right angle bracket are treated as special quoting characters, but are not included in pas~ed arguments. FOO <A,B>,C has two arguments: A,B and C. FOO C,<A,B> has two arguments: C and A,B. You can alter this argument handling by using the pseudo-op .DIRECTIVE with MACMPD, .ITABM, and .XTABM. (See Chapter 3.) NOTE To pass special characters in a macro call, we suggest defining the macro so that the delimiters are part of the passed argument. For example, use DEFINE Tl CA) <OUTSTR [ASCIZ AJ) rather than DEFINE T2 CA) <OUTSTR [ASCIZ \A\J> The call Tl "»" will work, but T2 will not. 5-5 "»" USING MACROS 5.2.3 Listing of Called Macros You can control the listing of called macros by using ~he pseudo-ops XALL, SALL, and LALL. LALL causes macro expansions to be listed in full: XALL suppresses part of the listing; LALL suppresses all of the listing. The default among these three is XALL. The following example shows the action of these listings: pseudo-ops on macro DEFINE FOO (N)( IFE N,<2> IFN N,<l> 000000 000000 000002 000001 000000 000002 000000 000001 000000 000002 000000 000001 SALL FOO(O) FOO(l) XALL FOO(O)'" IFE 0,<2> FOO(l)'" IFN 1,<1> LALL FOO(O)'" IFE 0,<2> IFN 0,<1> FOO(l)'" IFE 1,<:2> IFN 1,<:1> '" 5.3 NESTING MACRO DEFINITIONS You can nest macro definitions. That is, you can define a macro within the body of another macro definition. Notice, however, that the nested macro is not defined to the assembler until the nesting macro is called. Here is an example: DEFINE PERSON (A) < DEFINE CHILD CS) ( DEFINE GRANDCHILD CC)( EXP A,S,C::::::- 5-6 USING MACROS Until the DEFINE PERSON statement is assembled, calls to PERSON, CHILD, and GRANDCHILD are illegal. These macros are not yet defined to the assembler. When the DEFINE PERSON statement is reached and assembled, PERSON can be called, but not CHILD or GRANDCHILD. The call PERSON 1 generates the text PERSON 1'"' DEFINE CHILD (B) < DEFINE GRANDCHILD (C) EXP 1,B,C> thus defining CHILD to the assembler. generates the text The CHILD 2'"' DEFINE GRANDCHILD (C) EXP 1,2,C> and GRANDCHILD is defined GRANDCHILD 3 generates to the < following call CHILD 2 call to < assembler. Finally, a GRANDCHILD 3'"' 000000 000000 000000 000001 000002 000003 Notice the result of a subsequent call to CHILD 10. The text CHILD 10'"' DEFINE GRANDCHILD (C) . EXP 1,10. C> < is generated, and this definition replaces the old definition of GRANDCHILD; the definitions of PERSON and CHILD are not changed. After this, the call GRANDCHILD 3 generates GRANDCHILD 3'"' 000000 000000 000000 EXP 1,10,3'" 000001 000010 000003 NOTE Using multiple angle brackets for a passed argument preserves the argument as one unit. For example passing the argument «A,B,C» to nested macros causes the outer macro to pass <A,B,C> as one argument; the first nested macro passes A, B, and C as three arguments. 5-7 USING MACROS 5.4 CONCATENATING ARGUMENTS The apostrophe (I) is the concatenation operator for macro calls. If you insert an apostrophe immediately before or after a dummy-argument in the body of a macro, the assembler removes it at· call. This removal joins (concatenates) the passed argument to the neighboring character in the generated text. (One application of this concatenation is shown for the ASCIZ pseudo-op.) under COMMON ERRORS If the apostrophe precedes the dummy-argument, the passed argument is suffixed to the preceding character; if the apostrophe follows the dummy-argument, the passed argument is prefixed to the following character. You can use more than one apostrophe with a dummy-argument. In this case only apostrophes next to the dummy-argument will be removed (at most one from each side). Other apostrophes are treated as regular characters in the macrobody. The following example shows the treatment of apostrophes on both sides of the dummy-argument, and of double apostrophes. DEFINE 0 (PREFIX,MIDFIX) < DEFINE OCOMP (SUFFIX) < PREFIX'O'MIDFIX"SUFFIX> > Now the call 0 A,J generates DEFINE OCOMP (SUFFIX) AOJ'SUFFIX> < because when the assembler replaces PREFIX with A, the apostrophe following is removed to form AO. When J replaces MIDFIX, the preceding apostrophe and first following apostrophe are removed to form AOJ1SUFFIX. Now the call OCOMP LE generates OCOMP LE~ 343 00 0 00 000000 AOJLE~ since the apostrophe is removed to join AOJ to LE. 5.5 DEFAULT ARGUMENTS AND CREATED SYMBOLS Ordinarily, an argument missing from a macro call is passed as For example, the macro defined by DEFINE WORDS (A,B,C) EXP A,B,C> nulls. < when called by WORDS 1,1 generates three words containing 1, 1, and 0, respectively. WORDS 000000 000000 000000 1,1~ EXP 1,1," 000001 000001 000000 5-8 USING MACROS You can, however, alter this handling by specifying other than nulls, or by using created symbols. 5.5.1 default values Specifying Default Values If you want a missing argument to default to some value other than nulls, you can specify the default value in your DEFINE statement. Do this by inserting the default value in angle brackets immediately after the dummy-argument. For example, the macro defined by DEFINE WORDS (A,B(222),C(333»( EXP A,B,C) when called by WORDS 1,1 generates three words containing 333, respectively. WORDS 000000 000000 000000 1, 1, and 1,1~ EXP 1,1,333~ 000001 000001 000333 NOTE An argument passed as nulls by consecutive commas is not considered missing and cannot invoke a default value. Therefore missing arguments can occur only at the end of the list of passed arguments. 5.5.2 Created Symbols A symbol used as a label in a macrobody must be different for each call of the macro (since duplicate labels are not allowed). Therefore for each call a d1fferent symbol for the label must be passed as an argument. If you do not refer to such a label from outside the macro, you can simply let the assembler provide a new label for each call. This label is called" a created symbol, and is of the form •• nnnn where nnnn is a 4-digit number. To use a created symbol in place of a passed argument, use the percent sign (%) as the first character of the dummy-argument in your DEFINE statement. The assembler then creates a symbol for use in the macro expansion if that argument is missing from a call to the macro. If you provide an argument in the call, the passed argument overrides the created symbol. 5-9 USING MACROS NOTES 1. A null argument (indicated by two adjacent delimiters) is not treated as missing. 2. Avoid using symbols of the form •• nnnn, since they could interfere with created symbols. The following example shows a macro defined with a created symbol, the macro called using the created symbol, and the macro called overriding the created symbol: DEFINE COMPAR (TEST,SAVE,INDEX,~HERE) ( 7.HERE: MOVE SAVE, TEST SETZ INDEX, CAME SAVE,TABLE(INDEX) JRST 7.HERE > COMPAR T1,T2,T3~ •• 0001: MOVE T2,T1 SETZ T3, CAME T2,TABLE(T3) JRST •• 0001 COMPAR T1,T2,T4,HERE1~ HERE1: MOVE T2,T1 SETZ T4 CAME T2~TABLE(T4) JRST HERE1 5.6 INDEFINITE REPETITION The pseudo-ops IRP, IRPC, and STOPI give a convenient way to repeat all or part of a macro; you can change arguments on each repetition if you wish, and the number of repetitions can be computed at assembly time. You can use these three pseudo-ops only within the body of a macro definition. To see how IRP works, assume the macro definition DEFINE DOEACH (A) ( IRP A,<A» The call DOEACH <ALPHA,BETA,GAMMA> produces the code 000200 000300 000400 000000 000000 000000 000200 000300 000400 ALPHA=200 BETA=300 GAMMA=400 DO EACH (ALPHA, BETA, IRP ALPHA BETA GAMMA GAMMA>~ because each subargument passed to IRP generates one repetition of the code. Notice that the range of IRP must be enclosed in angle brackets. 5-10 USING MACROS NOTE Using angle brackets in the call to DOEACH is critical, since they make the string ALPHA,BETA,GAMMA a single argument for IRP. IRP then sees the commas as delimiting subarguments. IRPC is similar to IRP, but an argument passed to IRPC repetition for each character of the argument. generates one STOPI ends the action of IRP or IRPC after assembly of the current expansion. You can use STOP I with a conditional assembly to calculate a stopping point during assembly. For example: ;Enter value of 111 for each radix from 2 to K DEFINE CONVl (L) ( RADIX L ;Set radix 111 ;Evaluate and enter RADIX 8 ;Back to radix 8 DEFINE CONVERT (A) < IRP A,(IFE K-A,(STOPI> ;Still OK? CONVl A> ;CONVl 000004 000000 000000 000000 000007 000015 000025 K=4 CONVERT (2,3,4,5,6,7,8,9)IRP IFE K-2,(STOPI> ;Still OK? CONVl 2RADIX 2 ;Set radix ;Evaluate and enter 111 RADIX 8 ;Back to radi~·, 8 IFE K-3,(STOPI> ;Still OK? CONVl 3RADIX 3 ;Set radix ;Evaluate and enter 111 RADIX 8 ; Back to radi~·~ 8 IFE K-4,{STOPI> ;Still OK? CONV1 4RADIX 4 ;Set radix ;Evaluate and enter 111 RADIX 8 ;Back to radix 8 ;CONVl 5.7 ALTERNATE INTERPRETATIONS OF CHARACTERS PASSED TO MACROS The normal argument passed by a macro call is simply the string of characters given with the call. MACRO offers three alternate interpretations of the passed argument. 5-11 USING MACROS If you prefix a backslash (\) to an expr:ssion argument, the argument passed is the ASCII numeric character string giving the value of the expression. If you prefix a backslash-apostrophe (\') to an expression argument, the argument passed is the string whose value is the SIXBIT string with the integer value of the expression. If you prefix a backslash-quotemark (\") to an expression argument, the argument passed is the string whose value is the ASCII string -with the integer value of the expression. To show how these work, the following example defines a macro to print the argument passed. Then four different arguments are passed using the various argument interpretations. 000060 635170 425164 LALL DEFINE LOOKIE (ARG) .( REMARK The passed argl.JlTlent is: ARG LOOKIE 60'" REMARK The passed argl.JlTlent is: 60 LOOKIE \60'" REMARK The passed a rgl.JlTlent is: 60 LOOKIE \'60'" REMARK The passed argl.JlTlent is: p LOOK IE \-60'" REMARK The passed argulTlent is: o > Z=60 LOOKIE Z'" REMARK The passed argulTlent is: Z LOOK IE \Z'" REMARK The passed argl.JlTlent is: 60 LOOKIE \'Z'" REMARK The passed a rgl.JITIent is: p LOOKIE \-Z'" REMARK The passed argulTlent is: o ZZ='SIXBIT' LOOKIE ZZ'" REMARK The passed argl.JlTlent is: ZZ LOOKIE \ZZ'" REMARK The passed a rgl.JlTlent is: 635170425164 LOOKIE \'ZZ'" REMARK The passed argulTlent is: SIXBIT 5-12 USING MACROS 203234 162311 ZZZ=·ASCII· LOOKIE ZZZ'" REMARK The passed argument is: ZZZ LOOKIE 'ZZZ'" REMARK The passed argument is: 203234162311 LOOKIE ,·ZZZ .... REMARK The passed arglJment is: ASCII 5-13 CHAPTER 6 ASSEMBLER OUTPUT MACRO can generate three kinds of output files: 6.1 1. A program listing (.LST) file 2. A binary program (.REL) file 3. A UNIVERSAL (.UNV) file THE PROGRAM LISTING FILE MACRO outputs the program listing file to the device you specify, usually your terminal or a disk file. You can control the form of the program listing by using the pseudo-ops .DIRECTIVE FLBLST, .DIRECTIVE SFCOND, LIST, XLIST, LALL, XALL and SALL. (See Chapter 3.) All MACRO programs begin with the implicit pseudo-ops LIST and XALL. The listing has a heading at the top of each page and subpage. The first line gives the program name, the assembler version, the time and date of assembly, and the page number. The second line gives the program filename (including file type), the date and time of creation, and an optional program subtitle. Example: TIMER TIMER MACRO %53(711) 10:07 27-APR-77 MAC 27-AUG-77 10:06 PAGE 2 MACDEP The listing has up to 55 lines per page. You can change this by using the L switch; /nnL specifies nn lines per page. A formfeed (CTRL/L) in your program begins a new page and increments the page number. If the linecount exceeds lines-per-page before a formfeed is found, a subpage number is formed. For example, the subpages following page 6 are 6-1, 6-2, and so forth. A formfeed would begin page 7. 6-1 ASSEMBLER OUTPUT The five columns in the program listing give: 1. The CREF line number (if the program was assembled CREF switch on). 2. The line sequence number (if the input file is sequenced). 3. The 6-digit octal address of the sequential location assignment. storage word, with the usually a 400066' 400067' 400070' An apostrophe relocatable. (') after the address shows that it is For a BLOCK pseudo-op, only the address of the first word given. is For a PHASE pseudo-op, the phased address is given. For a program with PSECTS, the 2-digit PSECT number of the current PSECT immediately follows the address. For example, 000100'02 For a LaC or RELOC pseudo-op, only the address to which the location counter is set is given; the next word of code will be assembled at that address. 4. The assembled binary code (if any) in one of eight formats. Fullword: all zeros with number sign (000000000000#), showing that a fullword Polish fixup is required for the word of code. Halfword: two IS-bit bytes. Each halfword can be followed by an apostrophe (') to indicate that it is relocatable, or by a pound sign (#) to indicate that a Polish fixup is required for it. When you use the .HWFRMT pseudo-op, all code is listed in halfword format. Instruction: 9-bit op-code; 4-bit accumulator code; I-bit indirect code; 4-bit index; IS-bit address. Input/output: 3-bit I/O code; 7-bit device code; 4~bit index; 3-bit operand; I-bit indirect code; IS-bit address. Byte pointer: 6-bit byte position; unused bit; I-bit indirect IS-bit address. ASCII: five 7-bit bytes; SIXBIT: six 6-bit bytes. 6-2 6-bit byte size; 1 code; 4-bit index; one unused bit. ASSEMBLER OUTPUT BYTE: binary representation of specified bytes. Bytes appear on the program listing only to the extent that available horizontal space permits. For example, 36 I-bit bytes cannot be represented as individual bytes on the listing. Any halfword byte containing an address can be flagged by an apostrophe (') or by a pound sign (#). See the halfword format above. OPDEF or assignment: needed. one or two IS-bit bytes, as These examples show some code in each format: 000056' B=A+C 000000000000:1: 1"TAGl AC17,,1 iHalfword iHalfword 000061' 255 01 0 00 000100 000062' 255 01 0 00 000100 JFOV 100 JFCL 1,100 ilnstruction ilnstruction 000063' 7 114 04 1 04 001037' 000064' 7 110 20 1 05 000004 DATAl CDR,@NVR(4) iI/O CONO CDP,@4(5) iI/O 000057' 000001 000060' 000017 000017' 000001 000065' 21 06 0 00 000067' 000066' 44 10 0 00 000070' Pl: P2: POINT 6,Bl,lS P.OINT S,B2 iB~te 000067' 07 00 01 000000 000070' 006 004 002 000 00 Bl: B"'· ". BYTE (6)7,0,1 BYTE (S)6,4,2,0 ;B~te OPDEF Zl[17BSJ OPDEF Z2[26BSJ iOPDEF iOPDEF 000071' 061 062 063 064 065 000072' 101 102 103 104 105 ASCII 1123451 ASCII \ABCDE\ iASCII iASCII 000073' 21 22 23 24 25 26 000074' 41 42 43 44 45 46 SIXBIT /123456/ iSIXBIT SIXBIT \ABCDEF\ ;SIXBIT 017000 026000 000000 000000 pointer pointer iB~te ;B~te An apostrophe (') shows the code as relocatable. The examples show relocatable values in the right half of some words. The left half can also be relocatable. An asterisk (*) shows a symbol to be EXTERNAL or· undefined. A number sign (#) shows that a Polish expression is to resolve the value. 5. required Source statements and comments. If the assembler finds errors in a line of text, it suffixes one or more letters to the sequence number as error codes. These error codes are discussed in Chapter S. A code is not repeated for multiple errors of the same type in a line. 6-3 ASSEMBLER OUTPUT At the end of the listing, the asselbler gives the total number of errors, followed by break addresses. The prog~am break is the largest relocatable address assembled, plus 1. The absolute break is the largest absolute address assembled. The high-segment break is the largest high-segment address assemble'. For a program with PSECTs, the break for each PSECT is also given. The listing gives CPU time in the form mm:ss.sss where mm is minutes and ss.sss is seconds. Core used is given in piS; one P is 512 words (1000 octal). In the symbol table at the end of the listing, some symbols the following codes: ent ext int pol sen sex sin spd udf may have result of ENTRY pseudo-op EXTERNAL symbol INTERNAL symbol defined in terms of EXTERNAL symbols suppressed result of ENTRY pseudo-op suppressed EXTERNAL symbol suppressed INTERNAL symbol suppressed for debugger undefined symbol If you use the IC switch with MACRO, you can generate three additional tables in the program listing. The /C switch directs MACRO to generate the listing file in a format suitable for input to CREF, the cross-referencing program. This is a .CRF file rather than the usual .LST file. After assembly, the .CRF file can be used as input to CREF, and the output is the cross-referenced .LST file. This file contains the program listing and symbol table as destribed above. In addition, it tias a cross-referenced symbol table, a table of macros and OPDEFs, and, if you use the /0 switch with CREF, a cross-referenced table of opcodes and pseudo-ops. The cross-referenced symbol table lists each user-defined symbol (except macros, OPDEFs, and SYN symbols), and lists the sequence number of each line containing the symbol. The table of macros and OPDEFs shows each reference to macros, OPDEFs, and SYN symbols. The opcode table shows each reference to MACRO-defined opcodes and pseudo-ops, giving the sequence number of each line containing the opcode or pseudo-oPe 6-4 ASSEMBLER OUTPUT 6.2 THE BINARY PROGRAM FILE MACRO outputs the binary program file to the device you specify, usually a storage device. The default device is a disk •. Most of the file is the binary expansion of your program instructions. These instructions are formatted into groups called REL Blocks; each block is labeled so that LINK can recognize it. Details of this formatting and labeling are discussed in the LINK Reference Manual. A relocatable binary program file can be stored on any input/output device. The output format" is not related to either block types or logical divisions of the device. 6.3 THE UNIVERSAL FILE THE UNIVERSAL file is output only if the source file contains the UNIVERSAL pseudo-op. (See the discussions at UNIVERSAL in Chapter 3 and in Section 9.2.) A UNIVERSAL file contains only symbols and definitions. These definitions are available to any program, and can be obtained by using the SEARCH pseudo-op. 6-5 CHAPTER 7 USING THE ASSEMBLER To assemble a MACRO program, use one of the following: 1. The operating system command COMPILE for details.) 2. The $MACRO card for Reference Manual.) 3. The MACRO command level the BATCH (See the User's program (See the Guide BATCH To assemble a program in the command level of MACRO, type the word MACRO to the system. The system then runs MACRO, which responds with an asterisk (*): @MACRO * Then define files for MACRO by typing a command of the form relfile,listfile=sourcefile, ••• ,sourcefile where: reI file is a filespec for the binary program output file. listfile is a filespec for the program listing output file. each sourcefile is a filespec for a source program MACRO assembles source files in the order given. input file~ The default device for each file is DSK:, but you can override this by prefixing devicecode: to any of the files. Default file types are .REL for relfile, .LST for listfile (.CRF if you use the IC switch), and .MAC for each sourcefile. You can override these by suffixing a file type to any of the files. You can specify a directory for any of these files by project-programmer number (PPN) in square brackets. (See You can set switches by suffixing Ichar or (char) to a char is a switch code. Switch codes and their meanings Table 7-1. 7-1 suffixing a Appendix G.) file, where are given in USING THE ASSEMBLER You can suppress the binary file by omitting (but keeping the comma) : its file specification You can suppress the listing file by omitting its· file and the comma: specification ,listfile=sourcefile, ••• ,sourcefile relfile=sourcefile, ••• ,sourcefile You can suppress both output files by specifications (but keeping the equal sign): omitting their file =sourcefile, .•• ,sourcefile You can access an indirect file (containing valid asterisk-level MACRO command strings) by typing a command of the form: @indirectfile where indirectfile is the file specification for. the file. Examples: DATE,DATE=DATE Assemble source file DATE.MAC from disk into binary ·program file DATE.REL on disk, and put the listing in file DATE.LST on disk. DATE=DATE No listing file. ,DATE=DATE No binary file. =DATE No binary or listing file. Print error diagnostics on the terminal. DATE,TTY:=DATE Send the listing to the terminal. DATE,DATE=TTY: Accept source code from the terminal. DATE,DATE=TTY:,DSK:DATE Accept source code from the terminal (usually symbol definitions), followed by more source code from the disk. Notice that DSK must be specified; otherwise, TTY would be assumed. NOTE Many programmers use the following commands to check assembly of short code sequences: *,TTY:=TTV: F'ASS2 Thi$ displays the assembled code line by line as you type it in. 7-2 all USING THE ASSEMBLER Table 7-1 MACRO Switch Options Switch Meaning /A Advance magnetic tape reel by one file. The /A switch must immediately follow the device to which the switch refers~ /B Backspace magnetic tape reel by one file. The /B switch must immediately follow the device to which the switch refers. /C Produce listing file in a format acceptable as input to CREF. Unless the filename is given, CREF.CRF is assumed; if no file type is given, .CRF is assumed; if no listing device is specified, DSK: is assumed. The /C switch can be used only with the file specification for the program listing file; it must appear between the comma and the equal sign. /E List macro expansions (same as LALL pseudo-op) • /F Output binary listing in multiformat (same as pseudo-op) • /G Output binary listing in .HWFRMT pseudo-op) • /H Print HELP text (list of switches and explanations). /L Reinstate listing (same as LIST pseudo-op) • /M List only the call and binary produced expansion (same as SALL pseudo-op) • halfword format in .MFRMT (same as a macro /N Suppress error printouts on the terminal. /0 End literal with CR-LF or right square bracket as MLOFF pseudo-op). (same /P Increase the size of the pushdown list. This switch can appear as many times as desired. The pushdown list is initially set to a size of 80 (decimal) locations; each /P increases the size by 80 (decimal). /P must appear on the left of the =. /Q Suppress listing. Q (questionable) warning errors on /Q must appear on the left of the =. the (Continued on next page) 7-3. USING THE ASSEMBLER Table 7-1 (Cont.) MACRO Switch Options Meaning Switch /S Suppress listing (same as XLIST pseudo-op). /T Skip to the logical end of the magnetic tape. The /T switch must immediately follow the device to which the switch refers. /U Do not generate a .UNV file on DSK. The /U switch must appear immediately after the specification for the binary program file; that 1S, it must appear· between the file specification and the comma. /W Rewind the immediately refers. /X Suppress listing of macro expansions (same as XALL). magnetic tape. The /W switch must follow the device to which the switch 7-4 CHAPTER 8 ERRORS AND MESSAGES MACRO has three kinds of messages: 8.1 1. Informational messages 2. Single-character error codes 3. MCRxxx messages (where xxx is a 3-letter mnemonic code) INFORMATIONAL MESSAGES MACRO's informational messages are printed at the foot of the program listing. These messages and their explanations are given in Table 8-1. 8-1 ERRORS AND MESSAGES Table B-1 MACRO Informational Messages Explanation Message ABSLUTE BREAK The highest absolute address over 137. CORE USED The size of the low segment assemble the source program. CPU TIME USED The CPU time for assembly seconds. ERRORS DETECTED The number of errors detected by MACRO during assembly (errors marked on the listing by single-character codes other than Q). HI-SEG. BREAK The length of the high segment. PROGRAM BREAK The length of the low segment. PSECT n BREAK The length of PSECT n. UNASSIGNED DEFINED AS IF EXTERNAL Undefined symbol; WARNINGS GIVEN The·number of Q errors found. is terminated if under BATCH. 8-2 in treated as used to minutes and EXTERNAL~ Processing ERRORS AND MESSAGES 8.2 SINGLE-CHARACTER ERROR CODES Single-character error codes are printed in the program listing near the left margin of the line where the error occurs. If more than one kind of error occurs in the same line, more than one character will be printed; if more than one error of the same kind occurs in the line, the code is printed only once. Codes for M, P, V, and X errors are typed during Pass 1. If you use CREF to produce a cross-referenced listing file, all the single-character error codes will appear in the cross-reference table as %•••• x, where x is the code character. Table 8-2 gives explanations. the single-character 8-3 error codes and their ERRORS AND MESSAGES Table S~2 MACRO Single-Character Error Codes Code Explanation A Argument error in pseudo-oPe This is a broad class of errors that can be caused by an improper argument in a pseudo-oPe The A errors include: 1. Symbol used is improperly formed. 2. IFIDN comparison string is too 3. OPDEF of macro or SYN. 4. Invalid SIXBIT character. 5. Byte size in BYTE more than 36. 6. RADIX50 code not absolute. 7. End of line of IF rea~hed before < character seen. S. Assignment made in an address field; for example, MOVEI A=lO. (However, MOVEI <A=lO> is valid.) 9. Assignment of a label; 10. Missing symbol in SYN. 11. Unknown symbol in SYN. 12. Missing right parenthesis in an index. 13. Missing left parenthesis in a BYTE statement. 14. No comma after repeat count. l~rge. for example, TAG: TAG=l. 15.- IRP or IRPC not in a macro. D 16. Argument for IRP or IRPC is not a dummy symbol; example, DEFINE GO (A) IRP B. 17. IRP or IRPC argument is a created symbol. IS. STOPI not in IRP or IRPC. for Multiply defined symbol. The statement contains a tag that refers to a multiply defined symbol. The first definition is used for assembling the statement. (Continued on next page) S-4 ERRORS AND MESSAGES Table 8-2 (Cont.) MACRO Single-Character Error Codes Code Explanation E Improper use of an EXTERNAL symbol. The E errors include: 1. Symbol both EXTERNAL and internal. 2. EXTERNAL symbol used as accumulator register address. 3. EXTERNAL symbol used with IF. 4. EXTERNAL symbol used as address for LOC, RELOC, PHASE, HISEG, or TWOSEG. 5. EXTERNAL symbol used for array name or size in ARRAY. 6. EXTERNAL symbol used as REPEAT count. L Literal generates less than 1 or mo~e data. than M Symbol defined more than once; retains its first definition. If a symbol is first defined as a variable and later as a label, it retains the label definition. This error can be caused by multiple appearances of TITLE, or TITLE with UNIVER$AL. N Number error. 99 words of The N errors ihclude: 1. Number exceeds the permitted range. 2. B shift not absolute. 3. Digits exceed current radix. If radix is 8, the single character 9 is acceptable but the number 19 is not acceptable. 4. Character after up-arrow not B, 0, F, L, D, 1, or - 5. Illegal expression after E. o Operation code undefined. P Phase error. In general, the assembler generates the same number of program locations in Pass 1 and Pass 2. Any discrepancy causes a phase error. Phase errors allocation. can be It is assembled as,zeros. caused by incorrect literal If a symbol is used as a macro to generate code in Pass 1, and is used as a label in Pass 2, a phase error can occur. A relocatable label that is defined in a literal and then used in an arbitrary expression; MACRO generates a Polish expression instead of treating the label as EXTERNAL. (Continu"ed on next page) 8-5 ERRORS AND MESSAGES Table 8-2 (Cont.) MACRO Single-Character Error Codes Code Explanation Q Questionable. This is a broad class of warnings in which the assembler finds ambiguous language. Statements causing Q errors may not generate correct code. The Q errors include: R S 1. Too many ASCII characters in double quotes ("). the first five are used. Only 2. Too many SIXBIT characters. used. are 3. Value too large~ 4. Illegal expression after E. S. Illegal control character. 6. Comma detected after all required fields example, MOVE 1,2,. 7. HISEG or TWOSEG assembled. 8. Instruction memory address operand does not have either all D's or alII's in its left half~ for example, 1,,0 or -4,,-1. 9. More than l8-bit values used in XWD. Relocation error. Only the first high-order bits are lost. found after filled~ relocatable for code The R errors include: 1. Expression neither absolute nor relocatable. 2. LaC or RELOC used improperly. 3. Relocatable BLOCK size given. 4. Relocatable accumulator address given. PSECT usage error. six The S errors include: 1. More than 64 distinct PSECT names used. 2. More than 16 levels of PSECT nesting used. 3. PSECT name given with .ENDPS is not the current PSECT. name U Undefined symbol. V Symbol used to control the assembler is the definition precede the reference. X Error in defining or calling a macro during Pass 1. 8-6 undefined. of the Make ERRORS AND MESSAGES 8.3 MCRxxx MESSAGES The MCRxxx messages are issued to the terminal during assembly. xxx represents a 3-letter code.) (The Any MCRxxx message that is preceded by a question mark is normally fatal under batch processing. A few MCRxxx messages are informational; these are issued within square brackets. Table 8-3 gives all the MCRxxx messages. Each 3-letter code and its message are printed in boldface type. For some messages, an explanation is printed in lightface type. 8-7 ERRORS AND MESSAGES Table 8-3 MCRxxx Messages Code ATS Message and Explanation LINES/PAGE ARGUMENT TOO SMALL The argument given must be greater than three to allow space for the page heading. CAP CORE ALLOCATION PROBLEM WITH MEMORY-RESIDENT UNIVERSALS UNIVERSAL programs assembled with the /U switch must have the same output specifications as succeeding files. (See the pseudo-op UNIVERSAL in Chapter 3.) However, if none of the memory-resident UNIVERSALS are to be searched by subsequent files in the command sequence, you can clear the UNIVERSALs and force the needed memory allocation by typing CTRL/C, followed by START. CFU CANNOT FIND UNIVERSAL Correct the request for the UNIVERSAL file, or assemble required UNIVERSAL file. CME the COMMAND ERROR The last command string contains an error. CTL COMMAND LINE TOO LONG The last input characters. DNA ECF command string contains more than 200 The specified device cannot be initialized because it is use. in DEVICE NOT AVAILABLE ERROR READING COMMAND FILE This is a file status error. EPI END OF PASS I Manual input is required to begin Pass 2 from cards or terminal. EPP because input is EXPRESSION PARSING PROBLEM An expression was misinterpreted because MACRO interpreted a slash as a division operator, or a hyphen as a subtraction operator. ERU UNEXPECTED END-OF-FILE READING UNIVERSAL FILE EWE ERROR WHILE EXPANDING MACRO has an internal error in expanding a macro. Rewrite the macro, and submit a Software Performance Report. (Continued on next page) 8-8 ERRORS AND MESSAGES Table 8-3 (Cont.) MCRxxx Messages Code Message and Explanation FNF FILE NOT FOUND IBL INPUT BLOCK TOO LARGE DEVICE An input block from the specified device is too large. ICP INPUT CHECKSUM OR PARITY ERROR DEVICE This is a hard-data error. IDE INPUT DATA ERROR DEVICE This is a hard-data error. ISC ILLEGAL SYNTAX IN CONDITIONAL OR REPEAT ISO ILLEGAL SYNTAX IN MACRO DEFINITION The macro is improperly defined. lSI ILLEGAL SYNTAX IN [IRP or IRPC] INSIDE MACRO ISR ILLEGAL SYNTAX IN REPEAT LFO LST FILE OPEN ERROR LNF LOAD THE NEXT FILE The command string specifies the next file device as card reader or terminal. Input the file through the appropriate device. LTL LITERAL TOO LONG MOE MONITOR DETECTED SOFTWARE INPUT ERROR DEVICE The input file is not in a valid mode. MPA MISSING CLOSE PAREN AROUND ARG LIST NEC INSUFFIBIENT CORE Not enough memory is available to assemble the program. NES NO END STATEMENT ENCOUNTERED ON INPUT FILE NUF NOT A REAL UNIVERSAL FILE No such UNIVERSAL file was found. (Continued on next page) 8-9 ERRORS AND MESSAGES Table 8-3 (Cont.) MCRxxx Messages Code OBL Message and Explanation OUTPUT BLOCK TOO LARGE DEVICE This is a file-status error. OCP OUTPUT CHECKSUM OR PARITY ERROR DEVICE This is a hard-data error. ODE OUTPUT DATA ERROR DEVICE This is a hard data error. OQE OUTPUT QUOTA EXCEEDED ON DEVICE OUF UNIVERSAL FILE DEFAULT ARGUMENTS LOST, REASSEMBLE POL PDP OVERFLOW, TRY IP See the IP switch in Table 7-1. PET INPUT PHYSICAL END OF TAPE DEVICE PGE PRGEND ERROR See the PRGEND pseudo-op for proper use of PRGEND. PTC POLISH TOO COMPLEX A Polish expression is too complex for Restructure or split the expression. RFO .REL FILE OPEN ERROR SOC STATEMENT OUT OF ORDER .COMMON MACRO to handle. The .COMMON pseudo-op must precede all statements generate code, and all references to the COMMON block. STO SEARCH TABLE OVERFLOW, CANNOT SEARCH UNIVERSAL TMU TOO MANY UNIVERSALS that . The number Too many UNIVERSAL files are being searched. permitted is an assembly parameter; it can be increased by reassembling MACRO. UVS UNIVERSAL VERSION SKEW, REASSEMBLE UNIVERSAL The UNIVERSAL file was assembled with a later version of MACRO than you are using now. Reassemble the UNIVERSAL file. UWU UNABLE TO WRITE UNIVERSAL FILE WLE OUTPUT WRITE-LOCK ERROR DEVICE 8-10 CHAPTER 9 PROGRAMMING CONSIDERATIONS The previous chapters of this manual define the MACRO language elements. In particular, the pseudo-op definitions in Chapter 3 define many of MACRO's most important features. However, the usefulness of some pseudo-ops can be seen only in the context of a "family" of pseudo-ops. In this chapter, we discuss three such families programming features concerned are: 9.1 1. Program segmentation 2. UNIVERSAL files 3. Conditional assembly of pseudo-ops. The PROGRAM SEGMENTATION MACRO's relocation counters can accommodate three types of programs: 9.1.1 1. A single-segment program uses only one relocation counter. 2. A two-segment program also uses one relocation counter, is characterized by its use of the TWOSEG pseudo-op. 3. A program with PSECTS can use many relocation counters, and is characterized by its use of the .PSECT and .ENDPS pseudo-ops. and Single-Segment Programs A single-segment program uses only one relocation counter. This counter can be used to assign any address from 0 to 777777. The initial setting of the counter is O. As MACRO assembles your program, it places code and data at the address given by the current value of the relocation counter, incrementing the counter's value for each word assembled. For example, a statement can require assembly of one word of code, incrementing the relocation counter by 1. Another statement can require assembly of five words of code, incrementing the relocation counter by 5. Still another statement may not generate code, leaving the relocation counter unchanged. 9-1 PROGRAMMING CONSIDERATIONS You can reset the value of the relocation counter by using the pseudo-op RELOC with an argument. For example, using RELOC A sets the value of the relocation counter to the value of A. In the following example, 100 words are allocated for a table, incrementing the relocation counter by 100. Then the table length is calculated as TABLEN. A RELOC TABLE returns to the top of the table, where the first three words are initialized. Finally a RELOC TABLE+TABLEN sets the relocation to the foot of the table to continue assembly. TABLE: 000000' 000100 000000' 000000' 000000 000001 000001' 000000 000002 000002' 000000 000003 000100' BLOCK 100 TABLEN=.-TABLE R[~LOC TABLE EXF' 1,2,3 ;Allocate table ;Table lensth ;To ..:, of table ; Irli t fi T'st 3 RELOC TABLE+TABLEN ; ContinlJe Two-Segment Programs 9.1.2 By using the TWOSEG pseudo-op, you can divide your program into a high segment and a low segment. This pseudo-op must precede any statement in your program that generates code. The TWOSEG pseudo-op tells MACRO that there will be two segments, and MACRO generates a REL Block Type 3, which tells LINK to expect two segments for loading. You can use TWOSEG either with or without an address argument. are important differences between the two: There 1. TWOSEG without an argument specifies that the high segment begins at the address 400000. The initial value of the relocation counter is at the address a in the low segment. 2. TWOSEG with an argument specifies that the high segment begins at the given address, and further specifies that the initial value of the relocation counter is that address. (The given address is reduced to the next lower multiple of 2000 octal; if this result is 0, MACRO treats the TWOSEG as if no argument were given.) . The high-segment starting address divides all code into two segments. MACRO and LINK consider all code at addresses above the high-segment address to be in the high segment, and all other code to be in the low segment. MACRO always remembers the value the relocation counter had before the last RELOC found. (This stored value is initially 0.) Therefore in a two-segment program, you can begin in one segment, and then RELOC to the other. From then on, you can switch segments simply by using RELOC with no argument. MACRO will begin assigning addresses at the first unused location in the opposite segment. 9-2 PROGRAMMING CONSIDERATIONS For example, 400000' 000000' 000001' 400000' 400000' 400001' 000002' 000002' 000003' 400002' 400002' 400003' 9.1.3 OOOOO~ 000001 000002 000000 000000 000003 000004 000000 000000 000005 000006 000000 000000 000007 000010 000000 TWOSEG EXP 1,2 iLo-ses RELOC 400000 EXP 3,4 iHi-ses RELOC EXP 5,6 iLo-seS RELOC EXP 7,10 ;Hi-seS Programs with PSECTs You can construct a program having up to .PSECT and .ENDPS pseudo-ops. These among program segments (PSECTs). 64 segments by using the pseudo-ops control switching Each PSECT has its own relocation counter; each is separately relocated at load time. Therefore a program with two PSECTs is different from a two-segment program in that the PSECTed program has two relocation counters, while the two-segment program has only one. The pseudo-op .PSECT specifies that code should be assembled for a given PSECT. For example, .PSECT A specifies that code is to be assembled in the program segment (PSECT) called A. The pseudo-op .ENDPSends assembly in the current PSECT. PSECTs can be nested up to 16 levels. In a nested PSECT, the .ENDPS pseudo-op begins assembly in the next outer PSECT; in an unnested PSECT, .ENDPS begins assembly in the blank PSECT. (You can think of the blank PSECT· as being outside of all your explicitly declared PSECTs. ) Here is an example showing three PSECTs (A, B, and C): 000000'00 000001'00 000000'01 000000'01 000001'01 000000'02 000000'02 000001'02 000002'01 000002'01 000003'01 000002'00 000002'00 000003'00 000000'03 000000'03 000001'03 000004'00 000002'02 000002'02 000003'02 000004'00 000000 000000 000001 000002 000000 000000 000003 000004 000000 000000 000005 000006 000000 000000 000007 000010 000000 000000 000011 000012 000000 000000 000013 000014 000000 000000 000015 000016 EXP 1,2 iBlank PSECT .PSECT A EXP 3,4 i1st PSECT .PSECT B EXP 5,6 i2nd PSECT (nested) .ENDPS B EXP 7,10 i1st PSECT .ENDPS A EXP 11,12 i Blar.k PSECT .PSECT C EXP 13,14 i3rd PSECT .ENDPS C .PSECT B EXP 15,16 iBlank PSECT ;2nd PSECT .ENDPS B iBlank PSECT 9-3 PROGRAMMING CONSIDERATIONS In the example, the blank PSECT surrounds everything. blank PSECT are: 1. PSECT A (which also nests some of PSECT B) 2. PSECT C 3. Another segment of PSECT B Embedded in the Each PSECT used in a program generates thePSECT name as a global symbol. At load time, this symbol will take the value of the origin specified for the PSECT. When LINK loads your program, all the parts of the same PSECT are loaded together. These parts can be in more than one program, or in more than one file. For details of LINK's handling of PSECTs at load time, see the LINK Reference Manual. 9.2 UNIVERSAL FILES A UNIVERSAL file contains direct-assignment symbol symbols defined can have any attributes. definitions. The A UNIVERSAL file is convenient because it can contain definitions that you want for many programs. Those programs can then obtain the definitions by your use of the SEARCH pseudo-oPe This searching adds to the assembly only those definitions that are needed; other definitions in the UNIVERSAL file are not used. To build a UNIVERSAL pseudo-op file from a MACRO source file, insert the UNIVERSAL filespec wheie the filespec gives the file for output of the UNIVERSAL file. This file will contain all the symbols and definitions given in the program. Another program can obtain these definitions if it contains the SEARCH pseudo-op: SEARCH filespec where filespec names the UNIVERSAL file. At the end of Pass I assembly, MACRO will search the UNIVERSAL file for any undefined symbols. If a definition is found in the UNIVERSAL file, MACRO moves it into the symbol tables of the current program. For example, a UNIVERSAL file can mnemonics: contain definitions UNIVERSAL REGS 000000 000001 000002 000003 000004 000005 000016 000017 RO=O R1=1 R2=2 R3=3 Tl=4 T2=5 SP=16 P=17 END 9-4 for register PROGRAMMING CONSIDERATIONS Then another assembly can pseudo-op: these obtain by using the SEARCH REGS SEARCH REGS 000000' 000001' 000002' 000003' 000004' 000005' 000006' 000007' 000 000 000 000 000 000 000 000 00 0 01 0 02 0 03 0 04 0 05 0 16 0 17 0 00 00 00 00 00 00 00 00 000000 000000 000000 000000 000000 000000 000000 000000 Z Z Z Z Z Z Z Z RO, Rl, R2, R3, Tl, T2, SP, p, A UNIVERSAL file can contain definitions for any user-defined symbols. You may find it convenient to build UNIVERSAL files containing macros, OPDEFs, and direct-assignment symbols that you use often in your programs. An example of a UNIVERSAL program appears in the program Appendix D. 9.3 examples in CONDITIONAL ASSEMBLY Using conditional assembly in your programs can make programming easier, and can make your assembled programs shorter. The pseudo-ops used for conditional assembly are IRP, IRPC, STOPI, .IF, .IFN, and the IF~ group. IRP, IRPC, and STOPI are discussed fully in Chapter 3 and Section 5.6. We will confine the discussion here to a few remaining conditional assembly pseudo-ops. classic uses of the The first of these is the use of IFNDEF to establish default switch settings for a program. The example here is from the MACRO program itself, and concerns assembly of F40-switch-dependent symbols. Near the beginning of the code, MACRO has the statement: IFNDEF F40 <F40==O> This statement has effect only if the symbol F40 is which case the statement F40==O is assembled. switch to "off." not defined, in This sets the F40 But if a file defining F40 is assembled with (and before) the MACRO source file, then the statement F40==O is not assembled, leaving the "outside" definition in force. Therefore the statement IFNDEF F40 <F40==O> serves as a default definition for F40, and this default is used only if no other definition overrides it. Another application of conditional assembly is connected with the symbol F40. In MACRO's program segments on symbol searching, some symbols will be defined (and therefore found in the search) only if the F40 switch is "on." 9--5 PROGRAMMING CONSIDERATIONS Here is how MACRO's code handles sequence as follows: ;MACRO TO HANDLE F40 UUOS IFE F4~,< DEFINE XF (SB,CD) <» IFN F40,<SYN X,XF> chese symbols. There is a code ;NULL MACRO ;USUAL X MACRO The "usual X macro" is merely a macro to set up symbols to be defined and the code to assemble on finding them. . The macro XF will be used to handle definitions for r40 UUOs. Now if the F40 switch is on, the macro XF is made synonymous with the macro X, and the F40 UUOs are defined in the same way as other operator~. But if the F40 switch is off, XF is made a null macro so that all the F40 UUOs are ignored during assembly and are not defined to MACRO. The assembly of the F40 UUOs depends on the value of the F40 switch, and the value of the switch depends on its definition. If MACRO had no IFNDEF F40 statement, an "outside" file would have to define the switch at every assembly of MACRO. But the default definition allows assembly of MACRO alone, and the outside file is needed only to turn the switch on. Examples of conditional assembly are shown in the program examples Appendix D. 9-6 in APPENDIX A MACRO CHARACTER SETS Table A-I gives the 101 ASCII characters allowed in MACRO and their octal ASCII codes: the 64 SIXSIT characters and their octal SIXBIT codes: and the 40 RADIX50 characters and their octal RADIX50 codes. Table A-I MACRO Chara.cter Sets Character ASCII Code (horizontal tab) (linefeed) (vertical tab) (formfeed) (carriage-return) 011 012 013 014 015 (CTRL/Z) (CTRL/_) 032 037 (blank) II # $ % & ( ) * + / SIXBIT Code RADIX50 Code 040 041 042 043 044 045 046 047 00 01 02 03 04 05 06 07 00 050 051 052 053 054 055 056 057 10 11 12 13 14 15 16 17 46 47 45 (Continued on next page) A-l MACRO CHARACTER SETS Table A-I (Cont;) MACRO Character Sets ASCII Code SIXBIT Code RADIX50 Code 0 1 2 3 4 5 6 7 060 061 062 063 064 065 066 067 20 21 22 23 24 25 26 27 01 02 03 04 05 06 07 10 8 070 071 072 073 074 075 076 077 30 31 32 33 34 35 36 37 11 12 100 101 102 103 104 105 106 107 40 41 42 43 44 45 46 47 13 14 15 16 17 20 21 110 111 112 113 114 115 116 117 50 51 52 53 54 55 56 57 22 23 24 25 26 27 30 31 120 121 122 123 124 125 126 127 60 61 62 63 64 65 66 67 32 33 34 35 36 37 40 41 Character . 9 1 < = > ? @ A B C D E F G H I J K L M N 0 p Q R S T U V W (Continued on next page) A-2 MACRO CHARACTER SETS Table A-I (Cont.) MACRO Character Sets Character X y Z [ \ ! a b c d e f 9 h i j k 1 m n 0 p q r s t u v w x y z ASCII Code SIXBIT Code RADIX50 Code 130 131 132 133 134 135 136 137 70 71 72 73 74 75 76 77 42 43 44 141 142 143 144 145 146 147 150 151 152 153 154 155 156 157 160 161 162 163 164 165 166 167 170 171 172 A-3 APPENDIX B MACRO SPECIAL CHARACTERS Characters and combinations having special interpretations in MACRO are given in Table B-1. These interpretations apply only in the contexts described. In particular, they do not apply within text strings or comment fields. For each usage of special characters, a cross-reference to a text discussion is given in the rightmost column of the table. For references to pseudo-ops, only the' pseudo-op name is given; all pseudo-ops are discussed in alphabetical order in Chapter 3. B-1 Table B-1 Interpretations of Special Characters Characters Context Form Interpretation between two integer expressions mBn causes the binary representation of m to be placed with rightmost bit at bit n (decimal). 2.2.6 AB before integer expression ABn shows that n is a binary number. 2.2.2 AD before integer expression ADn shows that n is a decimal number. 2.2.2 between floatingpoint decimal number and signed decimal integer fE+n before integer expression AFn G after integer K AL B E OJ I N AF Discussed in Section 3: ~ (") !:d o en multiplies f by the +nth power of 10. '"tI t'Il (") 2.2.5 H ~ t"' (") shows that n is a fixedpoint decimal number. 2.2.4 nG suffixes nine zeros to n. 2.2.3 (") after integer nK suffixes three zeros to n. 2.2.3 en before decimal integer expression ALn generates the~umber of. leading zeros in the binary representation of n. 2.2.8 after integer nM suffixes six zeros to n. 2.2.3 :ll ~ $! t-3 t'Il M (Continued on next page) !:d Table B-1 (Cont.) Interpretations of Sp~cial Characters Characters "'0 Context Form Interpretation Discussed in Section before integer expression "'On shows that n is an octal number. 2.2.2 after symbol sym: shows that sym is a label. 2.4.2.1, 4.1, 4.5 after symbol sym: : shows that sym is a global INTERNAL label. 2.4.2.1, 4.1, 4.5 s: !:tlI n : ! after symbol sym: ! shows that sym is a label, but not to be output by debugger. ~ 2.4.2.1, 4.1, 4.5 o en ttJ : :! after symbol sym: : ! to I LV before end of line ;text before end of line (usually in a macro) ~ ~ text shows that sym is a global INTERNAL label, but not to be output by debugger. ttl n H 2.4.2.1, 4.1, 4.5 !:tlI t"1 n shows that text is a comment. tIl 4.4, 4.5 !:tlI !;tI !:tlI i ; as expression embedded in numerals int.fr shows that text is a comment to be printed in the macro definition but not at call. n 1-3 4.4, 4.5 generates current value of the location counter. 2.3, 4.6 shows that int.fr is a floating-point decimal number. 2.2.5 (Continued on next page) t7Ij !;tI en Table B-1 1Cont.) Interpretations of Special Characters Characters Context Form among numbers and symbols OJ I Interpretation Discussed in Section delimits operands, accumulator, arguments. 4.3, 4.5 5.1, 5.2 ,, among numbers and symbols ,, delimits a null macro argument. 5.2, 5.5 ,, between two expressions lhw, ,rhw delimits left halfword (lhw) from right halfword (rhw). 2.5.4.1 between two expressions A!B '" 1- ~ & between two expressions A"'!B between two expressions A&B before expression "'-A generates the logical inclusive OR of A and B. 3: :t- () ~ o 2.5.2 til "U t%] () generates the logical exclusive OR of A and B. H 2.5.2 :t:o' t'1 () generates the logical AND of A and B. generates one's complement of value of A (logical NOT). ::r: 2.5.2 :t:o' ~ () 1-3 2.5.2 t%] ~ til * between two expressions A*B I between two expressions AlB + between two expressions A+B generates product of A and B. 2.5.1 generates quotient of A by B. 2.5.1 generates sum of A and B. 2.5.1' (Continued on next P?ge) Table B-1 (Cont.) Interpretations of Special Characters Characters n " Context Form Interpretation between two expressions A-B generates difference of A and B. before an expression -A generates the two's complement of the value of A. around text "text" shows that text is a 7-bit ASCII string, to be right justified in field of five characters. around text Discussed in Section 2.5.1 'text' 0:1 I shows that text is a SIXBIT string, to be right justified in field of six characters. 2.2.1, 2.2.4., 2.2.5 3: ~ ASCII, ASCIZ ## ttl tt:l SIXBIT \ text'darg or darg'text concatenates passed argument to text at call to macro. after symbol sym# shows that sym is a variable symbol, whose address is usually at the end of the binary program. 2.4.3 shows that sym is a global EXTERNAL symbol. 2.4.5.2 directs that the argument passed be the string for the ASCII value of expr in the current radix. 5.7.1 prefixed to expression in macro call sym## \expr () H ~ t"t adjoining dummy argument in macro body after symbol o til U1 # () ~ () tIl 5.4 ~ ~ () 1-3 ttl (Continued on next page) ~ til Table B-1 (Cont.) Interpretations of Special Characters Characters \1 \" Context Form Interpretation prefixed to expression in macro call \Iexpr directs that the argument passed be the string whose SIXBIT code is the value of expr. 5.7.3 prefixed to expression in macro call \"expr directs that the argument passed be the string whose ASCII code is the value of expr. 5.7.3 Discussed in Section 3: :J:II (") CTRL/_ (CONTROLunderscore) before CR-LF 0'\ continues argument to next line; does not operate across end-of-macro. ~ 5.2.1 o til ttt between two expressions ttl I CTRL/_ A B shifts the binary representation of A to the left B positions. (If B is negative, shift is to right.) t%] (") H :J:II 2.2.6 t'1 (") ::z: @ prefixed to address @address sets bit 13 of the instruction word, indicating indirect addressing. ~ 4.7.1 ~ (") 1-3 % ( ) 1st character %darg of dummy argument in macro definition ( ... ) t%] ~ directs that %darg be replaced by a created symbol at macro call; MACRO will substitute a different symbol for it on each use of the macro. til 5.5.2 enclos~s index field; encloses dummy arguments in macro definition; quotes characters for macro argument handling; swaps the two halves of enclosed value. 4.7.1, 5.1 5.2.2 (Continued on next page) Table B-,1 (Cont.) Interpretations of Special Characters Characters Context < > [ ] Discussed in Section Form Interpretation <••• > nests expressions; encloses conditional assembly code; encloses code in REPEAT, IRP, and IRPC pseudo-ops; encloses macrobody in DEFINE pseudo-op; quotes characters for macro argument handling; forces evaluation of symbol. [ ... ] to I delimits literals; in ARRAY, .COMMON, pseudo-ops; quotes for macro argument delimits argument and OPDEF characters handling. 2.5.4 IFx, .IF, .IFN, REPEAT, IRP, IRPC, DEFINE, 5.1, 5.2.2 2.3, ARRAY, .COMMON, OPDEF, 5.2.2 3: ~ (') !:d 0 til "tI ~ (') H ~ t'i -J between symbol and expression sym=exp between symbol and expression sym==exp assigns value of exp to sym. (') 2.4.2.2, 4.5 Ol ~ !:d assigns value of exp to sym but sym is not output by debugger. 2.4.2.2, 4.5 ~ (') 1-3 ~ !:d =: ==: between symbol and expression sym=:exp between symbol and expression sym==:exp til assigns value of exp to sym and declares sym as global INTERNAL. 2.4.2.2, 4.5 assigns value of exp to sym and declares sym as global INTERNAL, but sym is not output by debugger. 2.4.2.2, 4.5 APPENDIX C MACRO-DEFINED MNEMONICS This appendix contains tables showing all of MACRO's defined mnemonics and the code they generate. These mnemonics, together with the pseudo-ops and the special characters given in Appendix B, make up the entire MACRO language. NOTE Throughout this appendix, the notes apply to the tables: following * Indicates mnemonic defined only if MACRO is assembled with the KLlO switch on. ** Indicates mnemonic defined only if MACRO is assembled with the KIlO switch on. C.l MACHINE INSTRUCTION MNEMONICS Table C-l shows MACRO's machine instruction mnemonics and the code assembled by each mnemonic. See Section 4.7 for a discussion of machine instructions used in programs. C-l MACRO-DEFINED MNEMONICS Table C-l Machine Instruction Mnemonics 270 273 271 272 133 105 404 407 410 413 411 412 440 443 441 442 420 423 421 422 405 406 253 252 340 344 342 347 345 341 343 346 350 354 352 357 355 351 353 356 320 240 244 251 300 304 302 307 305 301 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0 0 0 0 0 00 00 00 00 00 a 00 0 00 a 00 0 00 0 00 a 00 a 00 0 00 0 00 0 00 0 00 a 00 a 00 a 00 0 00 0 00 0 00 0 00 0 00 0 00 0 00 0 00 a 00 0 00 0 00 0 00 0 00 0 00 0 00 0 00 a 00 0 00 0 00 0 00 0 00 0 00 0 00 0 00 0 00 0 00 0 00 0 00 0 00 0 00 0 00 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 000000 ADD ADDB ADDI ADDM *ADJBP *ADJSP AND ANDB ANDCA AND CAB ANDCAI AND CAM ANDCB ANDCBB ANDCBI ANDCBM ANDCM ANDCMB ANDCMI ANDCMM ANDI ANDM AOBJN AOBJP. AOJ AOJA AOJE AOJG AOJGE AOJL AOJLE AOJN AOS AOSA AOSE AOSG AOSGE AOSL AOSLE AOSN ARG ASH ASHC BLT CAl CAlA CAlE CAlG CAIGE CAlL 303 306 310 314 312 317 315 311 313 316 400 403 401 402 114 117 110 113 112 131 III 234 237 235 236 120 124 121 125 116 137 115 444 447 445 446 250 123 140 143 141 142 144 147 145 146 170 173 171 172 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0 0 0 0 0 00 00 00 00 00 a 00 0 00 0 00 a 00 0 00 0 00 a 00 0 00 0 00 0 00 0 00 0 00 0 00 0 00 0 00 0 00 0 00 0 00 0 00 a 00 0 00 0 00 0 00 0 00 0 00 0 00 0 00 a 00 0 00 0 00 0 00 0 00 0 00 0 00 0 00 0 00 a 00 0 00 0 00 0 00 0 00 0 00 0 00 0 00 0 00 000000 CAlLE 000000 CAIN 000000 CAM 000000 CAMA 000000 CAME 000000 CAMG 000000 CAMGE 000000 CAML 000000 CAMLE 000000 CAMN 000000 CLEAR 000000 CLEARB 000000 CLEARI 000000 CLEARM 000000 *DADD 000000 *DDIV 000000 **DFAD 000000. **DFDV 000000 . **DFMP DFN 000000 000000 **DFSB 000000 DIV 000000 DIVB 000000 DIVI 000000 DIVM 000000 **DMOVE 000000 **DMOVEM 000000 **DMOVN 000000 **DMOVNM 000000 *DMUL 000000 DPB 000000 *DSUB 000000 EQV 000000 EQVB EQVI 000000 000000 EQVM EXCH 000000 000000 . *EXTEND FAD 000000 000000 FADB 000000 FADL FADM 000000 000000 FADR 000000 FADRB FADRl 000000 FADRM 000000 000000 FDV FDVB 000000 000000 FDVL FDVM 000000 (Continued on Next Page) C-2 -MACRO-OEFINEO-MNEMONICS Table- C~l(Cont.) Machine Instruction Mnemonics 174 00 177 00 175 00 176 00 126 00 127 00 160 00 163 00 161 00 162 00 164 00 167 00 165 00 166 00 150 00 153 00 151 00 152 00 154 00 157 00 155 00 156 00 132 00 500 00 530 00 531 00 532 00 533 00 501 00 502 -DO 520 00 521 00 522 00 523 00 503 00 510 00 511 00 512 00 513 00 544 00 574 00 575 00 576 00 577 00 545 00 546 00 564 00 565 00 566 00 567 00 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 0 00 000000 a 00 000000 a 00 000000 0 00 000000 0 00 000000 a 00 000000 a 00 000000 a 00 000000 0 00 000000 a 00 000000 0 00 000000 0 00 000000 a 00 000000 0 00 000000 0 00 000000 a 00 000000 0 00 000000 a 00 000000 a 00 000000 0 00 000000 0 00 000000 a 00 000000 0 00 000000 a 00 000000 a 00 000000 0 00 000000 a 00 000000 0 00 000000 0 00 000000 a 00 000000 0 00 000000 a 00 000000 0 00 000000 0 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 FDVR FDVRB FDVRI FDVRM **FIXR **FLTR FMP FMPB FMPL FMPM FMPR FMPRB _ FMPRI FMPRM FSB FSBB FSBL FSBM FSBR FSBRB FSBRI FSBRM FSC HLL HLLE HLLEI HLLEM HLLES HLLI' HLLM HLLO HLLOI HLLOM HLLOS HLLS HLLZ HLLZI HLLZM HLLZS HLR HLRE HLREI HLREM HLRES HLRl HLRM HLRO HLROI HLROM HLROS 547 00 554 00 555 00 556 00 557 00 504 00 534 00 535 00 536 00 537 00 505 00 506 00 524 00 525 00 526 00 527 00 507 00 514 00 515 00 516 00 517 00 540 00 570 00 571 00 572 00 573 00 541 00 542 00 560- 00 561 00 562 00 563 00 543 00 550 00 551 00 552 00 553 00 133 00 230 00 233 00 231 00 232 00 136 00 134 00 220 00 223 00 221 00 222 00 434 00 437 00 a 00 000000 0 00 000000 0 00 000000 a 00 000000 0 00 000000 0 00 000000 a 00 000000 a 00 000000 0 00 000000 a 00 000000 0 00 000000 a 00 000000 a 00 000000 0 00 000000 a 00 000000 0 00 000000 a 00 000000 a 00 000000 a 00 000000 0 00 000000 a 00 000000 a 00 000000 0 00 000000 0 00 000000 0 00 000000 a 00 000000 a 00 000000 0 00 000000 a 00 000000 0 00 000000 0 00 000000 0 00 000000 0 00 000000 a 00 000000 a 00 000000 0 00 000000 0 00 000000 a 00 000000 a 00 000000 0 00 000000 0 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 . a 00 000000 HLRS HLRZ HLRZI HLRZMHLRZS HRL HRLE HRLEI HRLEM HRLES HRLI HRLM HRLO HRLOI HRLOM HRLOS HRLS HRLZ HRLZI HRLZM HRLZS HRR HRRE HRREI - HRREM HRRES HRRI HRRM HRRO HRROI HRROM HRROS HRRS HRRZ HRRZI HRRZM HRRZS IBP IDlV lDlVB IDIVl IDIVM IDPB lLDB IMUL lMULB lMULI lMULM lOR IORB (Continued on Next Page) C-3 MACRO-DEFINED MNEMONICS Table C-1 (Cant.) Machine Instruction Mnemonics 435 436 255 243 267 254 266 265 264 104 320 324 322 327 325 321 323 326 135 242 246 257 200 201 202 203 214 215 216 217 210 211 212 213 204 205 206 207 224 227 225 226 434 437 454 457 455 456 470 473 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 a 00 000000 IORI IORM a 00 000000 a 00 000000 JFCL a 00 000000 JFFO a 00 000000 JRA a 00 000000 JRST a 00 000000 JSA a 00 000000 JSP a 00 000000 JSR a 00 000000 . JSYS a 00 000000 JUMP a 00 000000 JUMPA a 00 000000 JUMPE a 00 000000 JUMPG a 00 000000 JUMPGE a 00 000000 JUMPL a 00 000000 JUMPLE a 00 000000 JUMPN a 00 000000 LOB a 00 000000 LSH a 00 000000 LSHC a 00 000000 **MAP a 00 000000 MOVE a 00 000000 MOVEI a 00 000000 MOVEM a 00 000000 MOVES a 00 000000 MOVM a 00 000000 MOVMI a 00 000000 MOVMM a 00 000000 MOVMS a 00 000000 MOVN a 00 000000 MOVNI a 00 000000 MOVNM a 00 000000 MOVNS a 00 000000 MOVS a 00 000000 MOVSI a 00 000000 MOVSM a 00 000000 MOVSS a 00 000000 MUL a 00 000000 MULB a 00 000000 MULl a 00 000000 MULM a 00 000000 OR a 00 000000 ORB a 00 000000 ORCA a 00 000000 ORCAB a 00 000000 ORCAI a 00 000000 ORCAM a 00 000000 ORCB a 00 000000 ORCBB 471 472 464 467 465 466 435 436 262 263 261 260 241 245 424 427 425 426 450 453 451 452 460 463 461 462 414 417 415 416 474 477 475 476 400 403 401 402 330 334 332 337 335 331 333 336 360 364 362 367 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 ORCBI ORCBM ORCM ORCMB ORCMI ORCMM ORI ORM POP POPJ PUSH PUSHJ ROT ROTC SETA SETAB SETAl SETAM SETCA SETCAB SETCAI SETCAM SETCM SETCMB SETCMI SETCMM SETM SETMB SETMI SETMM SETO SETOB SETOI SETOM SETZ SETZB SETZI SETZM SKIP SKIPA SKIPE SKIPG SKIPGE SKIPL SKIPLE SKIPN SOJ SOJA SOJE SOJG (Continued on Next Page) C-4 - MACRO-DEFINED MNEMONICS Table C-l (Cont.) Machine Instruction Mnemonics 365 361 363 366 370 374 372 377 375 371 373 376 274 277 275 276 650 654 652 656 610 614 612 616 670 674 672 676 630 634 632 636 641 645 643 647 601 605 603 607 661 665 663 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 a 00 000000 a 00 000000 a 00. 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 SOJGE SOJL SOJLE SOJN SOS SOSA SOSE SOSG SOSGE SOSL SOSLE SOSN SUB SUBB SUBI SUBM TOC TOCA TOCE TOCN TON TONA TONE TONN TOO TOOA TOOE TOON TOZ TOZA TOZE TOZN TLC TLCA TLCE TLCN TLN TLNA TLNE TLNN TLO TLOA TLOE 667 621 625 623 627 640 644 642 646 600 604 602 606 660 664 662 666 620 624 622 626 651 655 653 657 611 615 613 617 671 675 673 677 631 635 633 637 130 256 430 433 431 432 C-5 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 0·0 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 TLON TLZ TLZA TLZE TLZN TRC TRCA TRCE TRCN TRN TRNA TRNE TRNN TRO TROA TROE TRON TRZ TRZA TRZE TRZN TSC TSCA TSCE TSCN TSN TSNA TSNE TSNN TSO TSOA TSOE TSON TSZ TSZA TSZE TSZN UFA XCT XOR XORB XORI XORM MACRO-DEFINED MNEMONICS C.2 I/O INSTRUCTION AND DEVICE CODE MNEMONICS Table C-2 shows MACRO's I/O instruction mnemonics and t~e code each assembles. Note that I/O machine instructions are executable only in executive mode. Table C-2 I/O Instruction Mnemonics 7 000 7 000 7 000 7 000 7 000 00 a 00 000000 10 a 00 000000 24 a 00 000000 20 a 00 000000 34 a 00 000000 BLKI BLKO CONI CONO CONSO 7 000 7 000 7 000 7 000 30 a 00 000000 04 a 00 000000 14 a 00 000000 04 0 00 000000 CONSZ DATAl DATAO RSW Table C-3 shows MACRO's I/O device code mnemonics. Each is assembled with the I/O instruction mnemonic DATAl so that the value of the device code will be in its proper field. In the first table entry, for example, the assembled code is: 7 024 04 0'00 000000 where the 7 and 04 are generated by the DATAl instructiori, and the 024 by the ADC device code mnemonic. NOTE MACRO leaves these device code mnemonics as undefined symbols during Pass 1. At the end of Pass 1, the mnemonics are found in MACRO's tables only if one or more I/O instructions have been found. Therefore, if a device code mnemonic is not assembled in Pass 1, or if no I/O instruction mnemonics were found, MACRO will not have defined the device code mnemonic. C-6 MACRO-DEFINED MNEMONICS Table C-3 I/O Device Code Mnemonics 7 024 7 030 7 000 7 014 7 110 7 114 7 070 7 074 7 000 7 150 7 154 7 200 7 204 7 300 7 304 7 270 7 274 7 270 7 130 7 134 7 060 7 160 7 064 7 164 7 240 7 244 7 250 7 254 7 260 7 264 7 464 7 474 7 170 7 174 7 460 7 470 7 320 7 330 7 324 7 334 7 124 7 234 7 260 7 264 7 220 7 230 7 224 7 010 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 04 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 DATAl ADC, DATAl ADC2, DATAl APR, DATAl CCI, DATAl COP, DATAl CDR, DATAl CLK, DATAl CLK2, DATAl· CPA, DATAl CR, DATAl CR2, DATAl DC, DATAl DC2, DATAl DCSA, DATAl DCSB, DATAl DDC, DATAl DDC2, DATAl DF, DATAl DIS, DATAl DIS2, DATAl DLB, DATAl DLB2, DATAl DLC, DATAl DLC2, DATAl DLS, DATAl DLS2, DATAl DPC, DATAl DPC2, DATAl DPC3, DATAl DPC4, DATAl DSI, DATAl DSI2, DATAl DSK, DATAl DSK2, DATAl DSS, DATAl DSS2, DATAl DTC, DATAl DTC2, DATAl DTS, DATAl DTS2, DATAl LPT, DATAl LPT2, DATAl MDF, DATAl MDF2, DATAl MTC, DATAl MTM, DATAl MTS, DATAl PAG, (Continued on Next Page) C-7 MACRO-DEFINED MNEMONICS Table C-3 (Cant.) I/O Device Code Mnemonics 7 7 7 7 7 7 7 7 7 7 7 7 004 140 144 100 104 340 350 344 354 120 210 214 04 04 04 04 04 04 04 04 04 04 04 04 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 a 00 000000 C-8 DATAl DATAl DATAl DATA! . DATAl DATAl DATAl DATAl DATAl DATAl DATA! DATAl PI, PLT, PLT2, PTP, PTR, TMC, TMC2, TMS, TMS2, TTY, UTC, UTS, MACRO-DEFINED MNEMONICS C.3 KLIO EXTEND INSTRUCTION MNEMONICS Table C-4 shows the KLIO EXTEND instruction mnemonics and the code assembled by each. All of these mnemonics are defined only if MACRO is assembled with the KLIO switch on. See the Supplement to the Hardware Reference Manual for of these EXTEND instructions. a discussion Table C-4 KLIO EXTEND Instruction Mnemonics 002 007 005 001 003 006 012 013 00 00 00 00 00 00 00 00 a 00 000000 a 00 000000 a a a a a 00 00 00 00 00 a 00 000000 000000 000000 000000 000000 000000 *CMPSE *CMPSG *CMPSGE *CMPSL *CMPSLE *CMPSN *CVTBDO *CVTBDT 010 all 004 016 014 017 015 020 C-9 00 00 00 00 00 00 00 00 0 a a a a 0 a a 00 00 00 00 00 00 00 00 000000 000000 000000 000000 000000 000000 000000 000000 *CVTDBO *CVTDBT *EDIT *MOVSLJ *MOVSO *MOVSRJ *MOVST *XBLT MACRO-DEFINED MNEMONICS C.4 JRST AND JFCL MNEMONICS Table C-5 shows mnemonics that assemble both operator and accumulator fields in the machine instruction. The left side of th& table shows the mnemonics and the code they generate7 the right side shows JRST and JFCL mnemonics with accumulators generating the equivalent code. Table C-5 JRST and JFCL Mnemonics Code and Mnemonic 254 04 0 00 000000 255 06 0 00 000000 255 04 0 00 000000 255 02 0 00 000000 254 12 0 00 000000 255 01. 0 00 000000 255 10 0 00 000000 254 02 0 00 000000 254 01 0 00 000000 254 06 0 00 000000 254 05 0 00 000000 254 07 0 00 000000 254 14 0 00 000000 Equivalent Code and Mnemonic HALT JCRY JCRYO JCRYI JEN JFOV JOV JRSTF PORTAL *XJEN *XJRSTF *XPCW *XSFM 254 255 255 255 254 255 255 254 254 254 254 254 254 C-I0 04 06 04 02 12 01 10 02 01 06 05 07 14 0 00 000000 0 00 000000 0 00 000000 0 00 000000· 0 00 000000 0 00 000000 0 00 000000 0 00 000000 O· 00 000000 0 00 000000 0 00 000000 0 00 000000 0 00 000000 JRST 4, JFCL 6, JFCL 4, JFCL 2·, JRST 12, JFCL 1, JFCL 10, JRST 2, JRST 1, JRST 6, JRST 5, JRST 7, JRST 14, APPENDIX D PROGRAM EXAMPLES The following pages contain examples of MACRO programs. Each program has been assembled with the /C (CREF) switch ani this produces a .CRF file for the program listing (instead of the usual .LST file). The /0 switch has been used with the CREF program to produce a .LST file that includes all operators in an operator symbol table. D-l MACROS EXAM20 MACRO %53(1017) 16:17 2-Mar-78 Pa~e 1 MAC 2-Mar-78 16:17 Example One 1 2 3 4 5 6 7 8 9 tj I r-v SUBTTL Example One UNIVERSAL MACROS ;This UNIVERSAL pro~ram contains the macro QUIT, which uses conditional assembl~ to ~enerate a pro~ram exit monitor call. If the TOPS10 switch is on when QUIT is called (or if it is undefined), QUIT ~enerates -EXIT-; if the switch is off, QUIT ~enerates -HALTF-. 10 11 12 13 14 15 16 17 18 DEFINE QUIT < IFNDEF TOPS10,( TOPS10==-1 19 ~:. 20 21 :::. PRGEND ;;Default is TOPS10 ). IFE TOPS10,'::: HALTF :> IFN TOF'S10, < EXIT I'tI l:tI o G1 ~ 3: NO ERRORS DETECTED PROGRAM BREAK IS 000000 CPU TIME USED 00:00.570 34P CORE USED tzl :>< ~ 3: I'tI t'1 tzl rn Second Example of MACRO Program MACRO %53(1017) 16:17 EXAM20 MAC 2-Mar-78 16:17 Example Two t:l I w 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 2-Mar-78 Page 2 SUBTTL Example Two TITLE Second Example of MACRO Program ;This program contains the macros CLEAR, CONCAT, and EXPAND. These can be used to append arbitrar~ text into a buffer, and to recall the text later. Two seauences of calls to the macros show possible uses. ; ;The following points are of interest: 1. The buffer is cleared b~ calling CLEAR. Text is added (on the right side of the buffer) b~ calling CONCAT. EXPAND, when used in a context allowed for macro calls, expands the contents of the buffer into source code. 2. A call to CLEAR defines the text buffer, EXPAND, to contain no text. It also defines the macro CONCAT in such a wa~ that the first call to CONCAT redefines EXPAND to contain the first piece of text, and CONCAT redefines itself so that further calls to CONCAT will call the internal macro CONi. Following the second call to CONCAT, each further call merel~ appends new text to the old. 3. A ke~ feature of EXPAND is that it contains no carriage returns. If it did, then each concatenation of new text would also insert a carriage return into the text. ttl !:t' o Gl ~ 3: t1] :>< ~ 3: ttl t'"1 t1] til 4. The first use of these macros shows that EXPAND can be placed in contexts where more than one argument will result (as in the BYTE pseudo-op). Note that because angle brackets are used internall~ (inside the macros) to delimit text, all concatenated text must contain matched angle brackets. 5. Note that carriage returns, if desired, can be easil~ to the buffer; this is done in the second use of the macros. conc~tenated Second Example of MACRO ProSram MACRO %53(J017) 16:17 EXAM20 MAC 2-Mar-78 16:17 Example Two 62 63 64 65 66 67 68 69 ~ 3 ). DEFINE EXPAND <FTXT> ~~ 71 72 73 74 75 76 77 78 79 80 81 I Pa~e DEFINE CLEAR < DEFINE CONCAT (FTXT) < DEFINE CONCAT (TEXT) < CONl <TEXT),<FTXT) 70 t::I 2-Mar-78 DEFINE EXPAND <> ~:. DEFINE CONl (NTXT,OTXT) < DEFINE CONCAT (TEXT) < CONl <TEXT>,<OTXT'NTXT> :;:. DEFINE EXPAND <OTXT'NTXT> o G) ~ SALL 82 95 96 97 98 99 100 101 102 103 104 ttl CONCAT <10> CONCAT <,> CONCAT <·A·> CONCAT <,«-1,,6>&177» 88 94 ~ CLEAR 83 84 85 86 87 89 90 91 92 93 ~ ~ :::- 000000' 010 101 006 00000 LALL BYTE (7)EXPAND~10,·A·,«-1,,6>&177)~ SALL CLEAR CONCAT <DEF> CONCAT <INE FOO () CONCAT <N» CONCAT «2*N> DEFINE) CONCAT < BAR (N) <3*N) ::.. ~ !):II 3: ""d t'1 ttl til Second Example EXAM20 MAC 105 106 107 108 109 110 111 112 113 114 115 116 117 o~ MACRO ProSram MACRO %53(1017) 16:17 2-Mar-78 16:17 Example Two 2-Mar-78 PaSe 4 LALL EXPAND-DEFINE FOO (N)(2*N> DEFINE BAR (N) (3*N> 000001' 000002' 000003' 000004' 000000 000000 000000 000000 000004 000006 000006 000011 FOO 2-2*2FOO 3-2*3BAR 2-3*2BAR 3-3*3PRGEND NO ERRORS DETECTED PROGRAM BREAK IS 000005 CPU TIME USED 00:00.166 34P CORE USED o I U1 to l:tI o G'l ~ s: tzl :>< ~ s: to t'1 tzl til Third Example of MACRO Pro~ram MACRO %53(1017) 16:17 EXAM20 MAC 2-Mar-78 16:17 Example Three 118 119 120 121 122 123 124 125 126 0 I 0"1 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 2-Mar-78 Pa~e SUBTTL Example Three TITLE Third Example of MACRO 5 Pro~ram ;This pro~ram uses the macros NUMLST and X to tables. ~enerate parallel ; ;This example ~enerates a table that contains ke~words suitable for comparison to user input; the second table ~enerated contains addresses or routines that handle those ke~words; the third table contains useful values. ; ;The ke~word table is arran~ed alphabeticall~ to speed searchin~; the other two tables correspond entr~-for-entr~ to the ke~word table. ; ;Ke~ 1. 2. features of this pro~ram include: the size of the tables is eas~. For example, if a new entr~, FIFTH, is needed, addin~ the word and a dumm~ label to the definition of NUMLST will update both tables; no separate update is reQuired. Chan~in~ The macro NUMLST calls the macro X. Before each call to NUMLST, X is redefined so that the proper kind of table is built. Note that a definition of X need not use both ar~uments in the macrobod~. (However, X should define both ar~uments.) 3. The second definition of X uses concatenation to build mnemonic labels for the table LBLTBL. 4. The pro~ram uses the macro QUIT so that it can be used for either TOPS-l0 or TOPS-20. The SEARCH MACROS statement makes the definition of QUIT available; since the default for QUIT is TOPS-l0, the pro~ram will run on TOPS-l0 if either it defines TOPS10=-1 or does not define TOPS10; the pro~ram will run on TOPS-20 onl~ if it defines TOPS10=0. ItJ ~ o Gl ~ 3: t%j :><: ):01 3: ItJ t"i t%j (J) Third Example of MACRO Pro~ram MACRO %53(1017) 16:17 EXAM20 MAC 2-Mar-78 16:17 Example Three 0 I -.J 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 000000 2-Mar-78 Pa~e 6 SEARCH MACROS,MONSYM TOF'S10==0 .DIRECTIVE SFCOND DEFINE NUMLST < X (FIRST,1) X (FOURTH,4) X (SECOND,2) X (THIRD,3) :> DEFINE X (TEXT, JUNK) <EXP SIXBIT ITEXT/> 000000' 000000' 000001' 000002' 000003' 465162 465765 634543 645051 636400 626450 575644 624400 000004 NAMTBL: NUMLST~ X (FIRST,l)~EXP SIXBIT IFIRST/~ X (FOURTH,4)~EXP SIXBIT IFOURTH/~ X (SECOND,2)~EXP SIXBIT ISECOND/~ X (THIRD,3)~EXP SIXBIT ITHIRD/~ TBLLEN==.-NAMTBL DEFINE X (JUNK,LABL) ($'LABL> 000004' 000004' 000005' 000006' 000007' 000000 000000 000000 000000 000014' 000017' 000015' 000016' LBLTBL: NUMLST~ X (FIRST,l)~$l'"' X (FOURTH,4)'"'$4'"' X (SECOND,2)'"'$2'"' X (THIRD,3)'"'$3'"' DEFINE X (JUNK,VALU) <DEC VALU> 000010' 000010' 000011' 000012' 000013' 000000 000000 000000 000000 000001 000004 000002 000003 VALTBL: NUMLST'"' X (FIRST,l)'"'DEC 1'"' X (FOURTH,4)'"'DEC 4'"' X (SECOND,2)'"'DEC 2'"' X (THIRD,3)'"'DEC 3'"' "tI ~ 0 G'l ~ :J::II 3: tJ] ~ :J::II 3: "tI t"t tJ] til Third Example of MACRO Program MACRO Z53(1017) 16:17 EXAM20 MAC 2-Mar-78 16:17 Example Three 197 198 199 200 201 202 203 204 000014' 000014' 104 00 0 00 000170 000015' 000015' 104 00 0 00 000170 000016' 205 000016' 104 00 0 00 000170 206 207 208 209 000017' 000017' 104 00 0 00 000170 XALL $1: 2-Mar-78 Page 7 aUIT~ HAL ofF $2: aUIT~ HALTF $3: aUIT~ HALTF $4; aUIT~ HALTF PRGEND NO ERRORS DETECTED PROGRAM BREAK IS 000020 CPU TIME USED 00:00.152 34P CORE USED o I co "tI !:t1 a G") $! ::c t%l :>< :J::oI ::c "tI t'1 t%l (Jl Third Example of MACRO ProSram MACRO %53(1017) 16:17 EXAM20 MAC 2-Mar-78 16:17 SYMBOL TABLE HALTF LBLTBL NAMTBL TBLLEN TOP510 VALTBL $1 $2 $3 $4 104000 2-Mar-78 PaSe 5-1 000170 int 000004' 000000' 000004 spd 000000 spd 000010' 000014' 000015' 000016' 000017' ttl ~ o Gl o I \.0 ~ 3: [I] ~ ::t>' 3: ttl t'1 [I] til Fourth Example of MACRO Pro~ram MACRO %53(1017) 16:17 EXAM20 MAC 2-Mar-78 16:17 Example Four 0 I ...... 0 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 2-Mar-78 Pa~e 8 SUBTTL Example Four TITLE Fourth Example of MACRO Pro~ram ;This pro~ram contains a complex and useful macro, COMMON. The macro allows declaration of variable names for a FORTRAN-compatible COMMON block. Note that the pseudo-op .COMMON allows declaration of a COMMON block, but not of variable names within the block. ;The COMMON macro uses two ar~uments: 1. The name of the COMMON block. 2. An IRP-style list of the variable names for the block. The list can contain either variable names onl~ (with an assumed len~th of one word for each variable), or can contain an an~le-bracketed pair ~ivin~ the name and the len~th in decimal. ; ;Key features of the 1. pro~ram include: for variables are ~iven in decimal numbers, so that the definitions look much like those in the FORTRAN lan~ua~e. This is accomplished b~ storin~ the current radix in a created symbol, and restorin~ it at the end of the macro. Len~ths tt1 !:Jj o G'l ~ 3: tzj :>< :J:oI 3: tt1 t"" tzj 2. The macro uses the techniGue of IRPin~ more than once on the IRP list. The first IRP counts the len~th of the entire COMMON block, so that the .COMMON pseudo-op can be used; the second IRP declares variable names for each entry in the block. 3. The pseudo-ops .XCREF and PURGE are used often in the macro; this is to remove references to created symbols from the CREF listin~ and the s~mbol table. 4. Created symbols are used in the macro for symbols that are used onl~ within the macro itself. This minimizes the chance that other definitions will conflict with these symbols. 5. Once the COMMON macro has been called. symbols in the COMMON block may be used mu~h as any other symbols; this is shown in the IFIX and ZERO routines. ttl Fourth Example of MACRO ProSram MACRO Z53(1017) 16:17 EXAM20 MAC 2-Mar-78 16:17 Example Four 0 I ....... ....... 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 2-Mar-78 PaSe 9 DEFINE COMMON (COM,VARS,ZRAD,ZLEN,ZVAL,ZCOM,ZPAS) .XCREF ZRAD,ZLEN,ZVAL,ZCOM,ZPAS < ;;Temp macro to strip one pair of ansle brackets from ;; a macro arSument and pass it to another macro DEFINE ZPAS (A,B) (A B) ;;Temp macro to ~ompute lensth of COMMON DEFINE ZCOM (VAR,LEN(I» (%LEN==%LENtLEN) ;;Save current radix, use 10 ;; so defs read like FORTRAN ;;Set to count lensth of COMMQN ;;Get lensth of this COMMON ;;Allocate the whole COMMON :r.RAD==10 RADIX 10 ZLEN==O IRP VARS(ZPAS ZCOM,VARS) .COMMON COM[:r.LENJ DEFINE :r.COM (VAR,LEN(l» VAR=ZVAL ZVAL==:r.VALtLEN ., .,. ( ;;Set UP another temp macro ;;Define COMMON block entr~ ;;Increment to next entr~ tt:I :;d o Gl ~ 3: trl :>< :J:>I 3: ZLEN==O ZVAL==COM IRP VARS(ZPAS :r.COM,VARS) RADIX %RAD ;;Reinitialize lensth ;;Start to define entries in block ;;Define next COMMON entr~ ;;Restore current radix IF2,(PURGE %LEN,ZRAD,ZVAL,:r.COM,:r.PAS) ;;Keep )* s~mbol table clean tt:I tot trl til Fourth Example of MACRO ProSram MACRO %53(1017) 16:17 EXAM20 MAC 2-Mar-78 16:17 Example Four o I ...... N 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 2-Mar-78 PaSe 10 INTEGER SNGLE,ARRAY,MULTI REAL REAL DOUBLE PRECISION DOUBLE COMMON /AREA/SNGLE,REAL,DOUBLE,ARRAY(10),MULTI(5,10) COMMON AREA,<SNGLE,REAL,<DOUBLE,2>,<ARRAY,10>,<MULTI,5*10»~ ;Sample routine to do SNGLE=IFIX(REAL) 000000' 122 01 0 00 OOOOOOt 000001' 202 01 0 00 000000* 000002' 263 17 0 00 000000 IFIX: FIX 1,REAL MOVEM 1,SNGLE POPJ 17, ;Sample routine to set all elements in ARRAY to 0 000003' 200 000004'402 000005' 251 000006' 263 01 0 00 0 01 0 17 0 00 000007' 00 OOOOOOt 00 OOOOOOt 00 000000 000007' 000007' OOOOOot OOOOOOt ZERO: MOVE 1,[XWD ARRAY,ARRAY+1J SETZM ARRAY BL T 1, ARRAY+,"'D9 F'OPJ 17, LIT "0 ~ o G1 $! 3: I:%] :>c: ):II 3: END "0 t-t I:%] NO ERRORS DETECTED PROGRAM BREAK IS 000010 CPU TIME USED 00:00.232 36P CORE USED til Fourth Example of MACRO Pro~ram MACRO %53(1017) 16:17 EXAM20 MAC 2-Mar-78 16:17 SYMBOL TABLE AREA ARRAY DOUBLE IFIX MULTI REAL SNGLE ZERO 00000 l' 000000000000=1= 000000000000=1= 000000' 000000000000=1= 000000000000=1= 000000* 000003' 2-Mar-78 Pa~e S-2 e;·{t pol pol pol pol to ~ o G"l t:I I I--' W ~ 3: [J:] :>c: ~ 3: to tot [J:] (Jl AREA ARRAY DOUBLE IFIX LBLTBL MULTI NAMTBL REAL SNGLE TBLLEN TOPS10 VALTBL ZERO $1 $2 $3 $4 299+ 299+ 299+ 302+ 182+ 299+ 173+ 299+ 299+ 178+ 161+ 190* 308+ 183 185 186 184 299 308 309 310 202 203 178 302 303 201 204 205 206 207 208 200+ 202+ 204+ 206+ "0 ~ o G) o I ...... ,1:::0. ~ 3: ttl :>< :JlI 3: "0 t"" ttl til BAR CLEAR COMMON CON1 CONCAT EXPAND Faa HALTF NUMLST QUIT X •• 0004 •• 0005 1094 641 2591 741 831 98 831 1081 201 1641 101 1711 194 299 299 114 83 298 86 85 984 851 112 203 173 200 174 115 94 87 851 99 861 113 205 182 202 175 88 86 1001 87:1: 97 861 101 B81 98 87 1024 91 100 871 102 88 881 941 96 961 97 941 961 97t 984 lOOt 1021 108 207 190 204 176 206 177 1801 183 184 185 186 188t 191 192 97:1= 193 2991 ttl ~ o Gl o I ..... U1 ~ 3: [:I:] :><: ):II 3: ttl t'1 [:I:] til BLT BYTE DEC DEFINE t1 1 I-' 0'1 END EXP FIX IF2 IFE IFN IFNDEF IRP LALL LIT MOVE MOVEM POPJ PRGEND PURGE RADIX SALL SEARCH SETZM SIXBIT SUB TTL TITLE UNIVER XALL XWD .COMMO .DIREC 310 91 191 10 108 316 174 302 299 201 202 201 299 90 313 308 303 304 21 299 299 81 160 309 174 1 23 2 199 308 299 162 192 64 109 193 74 164 194 83 171 175 176 177 203 204 203 205 206 205 207 208 207 85 180 86 188 87 259 88 299 94 96 97 98 100 102 107 311 117 209 ftJ !:tJ 0 Gl 93 175 22 1-19 176 118 211 177 210 ~ tr.l >: ~. t"" tr.l til APPENDIX E PSEUDO-OPS FOR SYSTEM COMPATIBILITY The pseudo-ops in this appendix are included for system compatibility; they are to be used only to assemble TOPS-IO programs while running TOPS-20. E-l PSEUDO-OPS FOR SYSTEM COMPATIBILITY HISEG FORMAT HISEG address address = program high-segment origin address. Must be equal to or greater than 400000 and must be a multiple of 1000. FUNCTION Directs the loader to load the current program into the high segment if the program has reentrant (two-segment) capability. HISEG should appear at the beginning of the source program. HISEG does not affect assembler operation. The code produced by HISEG will execute at either relocatable 0 or relocatable 400000, depending on the loading instructions given. The code following HISEG looks as if it to start at relocatable o. was This pseudo-op has been replaced by TWOSEG. E-2 assembled PSEUDO-OPS FOR SYSTEM COMPATIBILITY -I~________R_I_M______~ FORMAT RIM FUNCTION Specifies a format for absolute binary programs (useful only for PDP-6 systems), and consists of a series of paired words. The first word of each pair is a paper-tape read instruction giving the memory address of the second word. The last pair of words is a transfer block; the first is an instruction obtained from the END statement and executed when the transfer block is read, and the second is a dummy word to stop the reader. E-3 PSEUDO-OPS FOR SYS~EM COMPATIBILiTY RIMIO FORMAT RIMIO FUNCTION Causes a program format in which programs are ab~olute, unblocked, and· not checksummed. When the RIMIO statement follows a LOC statement in a program, the assembler punches out each storage word in the object program, starting at the absolute address specified in the LOC· statement. RIMIO ~ritesan arbitary "paper tape"~ if it·is in the format given below, it can be read by the DECsystem-lO Read-In Mode hardware. IOWD n,first where n is the length of the program including the ending word transfer, and first is the first memory location to be occupied. The last location must contain a transfer instruction to begin the program, such as JRST 4,GO For example, if a program with RIMIO output has its first location at START and its last location at FINISH,you can write IOWD FINISH-START+l,START NOTE If the location counter is increased but no binary output occurs (for example, BLOCK, LaC, and VAR pseudo-ops), MACRO inserts a zero word into the binary output file for each location skipped by the location counter. E-4 PSEUDO-OPS FOR SYSTEM COMPATIBILITY RIMIOB FORMAT RIMIOB FUNCTION If a program is assembled into absolute locations (not relocatable), a RIMIOB statement following the LOC statement at the beginning of the source program causes the assembler to write out the object program in RIMIOB format. This format is designed for use with the DECsystem-lO Read-In Mode hardware. The program is punched during Pass 2, starting at the location specified in the LOC statement. If the first two statements in the program are LOC 1000 RIM10B MACRO assembles the program with absolute addresses starting at 1000 and punches the program in RIMIOB format, also starting at location 1000. You can reset the location counter during assembly, but only one RIMIOB statement is needed to punch the entire program. In RIMIOB format, the assembler punches the RIMIOB Loader, followed by the program in 17-word (or less) data blocks, each block separated by blank tape. The assembler inserts an I/O transfer word (IOWD) preceding each data block, and also inserts a 36-bit checksum following each data block. The word count in the IOWD counts only the data words in the block, and the checksum is the 36-bit added checksum of the IOWD and the data words. Data blocks can contain less than 17 words. If the assembler assigns a nonconsecutive location, the current data block is terminated, and an IOWD containing the next location is inserted, starting a new data block. The transfer block consists of two words. The first word of the transfer block is an instruction obtained from the END statement. This first word is executed when the transfer block is read. The second word is a dummy word to stop the reader. E-5 APPENDIX F STORAGE ALLOCATION MACRO allocates storage in two directions: 1. User symbols and macronames are entered in the symbol tables. 2. Macros and literals are entered in free space. A symbol table entry is two words long. The first word is the symbol name in SIXBIT. The second word has flags in the left half, and either the value or a pointer in the right half. The flags indicate symbol type and attributes. The following list shows how symbols and values are stored. Type How Stored IS-bit symbol Value in right half of second word. 36-bit symbol (includes OPDEFs and negative numbers) Value in free symbol table. EXTERNAL symbol Po~nter in symbol table to a 2-word block in free storage. The first word is the value that is the last reference in a chain of references to the symbol; the second word is the symbol name in SIXBIT. Polish symbol The symbol table entry block: word 1: word 2: storage with a pointer points to a in 2-word 0 negative number"address Word 1 is the relocation word and is always zero. Word 2 gives the address of a Polish stack in free storage. The Polish stack is of the form: word word word word word word F-l 1: 2: 3: 4: 5: 6: 0 opcode relocation constant value relocation constant value STORAGE ALLOCATION Words 1 and 4 designate an operand. If the operator is binary, words 5 and 6 designate the second operand; if the operator is unary, the stack contains only four words. If an operand is EXTERNAL, its two and 4, or 5 and 6) are: words (3 word i: pointer to EXTERNAL symbol word i+l: 0 If an operand is itself a Polish symbol, two words are: its word i: Polish pointer word i+l: 0 Inter-PSECT reference Polish stack containing: word 1: word 2: word 3: word 4 : word 5: word 6: 0 15 -2 referenced PSECT index relocation const~nt address Synonym operator (SYN argument) SIXBIT operator riame in. free st6rage with-a pointer in the symbol table. Macroname Value in -free storage with a pointer text string in symbol table. The text string is stored in a of the form: word 1: word 2: word 3: word 4: word 2: word 3: word 4: 4-word the block link to next block (0 last) "two ~haracters five characters five characters five characters However, the first special: word l: to such block if is link to next - block"link to last block to default pointer args of arg."number expected + reference count five characters five characters - The number of args expected is the number dummy-arguments in the macro definition. of The reference count is incremented when the macro is called and decremented when the macro is exited. When this count goes to zero, the macro is removed from free space. F-2 STORAGE ALLOCATION Macro arguments Stored in the same linked block, but not in the symbol table. Repeats (two or more times) are also stored in the same way. The text blocks are removed when the macro exits or the repeat exits, since the reference count has gone to zero. The addresses of the actual argument blocks are stored in a pushdown stack in order of generation. Default arguments are stored in the same way, except that the list is in free core. The pointer to the default arg list is stored in the left half of the second word of the first block of the macro definition. Macros The macrobody is stored as is, except that dummy-arguments are replaced by special symbols. ASCII 177 (RUBOUT) signals that the next character is a special character, as follows: 001. 002 003 004 005 ;end of macro ;end of dummy symbol ;end of REPEAT ;end of IRP or IRPC ;RUBOUT If the character is more than 5 and less than 100, it is illegal. If the character is greater than or equal to it is a dummy symbol; the value of the character is ANDed with 37 to get the dummy symbol number, and the corresponding pointer retrieved from the stack of actual arguments. 100, If the symbol was not specified (that is, has no pointer), and if the 40 bit is on, this symbol requires a created symbol, and one is created; otherwise the argument is ignored. NOTE Verbose macros storage space. F-3 can use too much STORAGE ALLOCATION Literals Four-word block for each word generated word word word word 1: 2: 3: 4: form word relocation bits code pointer to next block Form word is the word used for listing. This word is not checked when comparing literals, so that different forms producing the same code are classed as equal. Relocation bits are 0, pointers. 1, or EXTERNAL Pointer is the address of the zero of the next block. NOTE Long literals slow assembly and ~se storage; they should be written as subroutines or inline code. F-4 word APPENDIX G ACCESSING ANOTHER USER'S FILE MACRO allows you to access another user's file in two ways. The first is to give a logical name in place of the device name; the second is to give a project-programmer number instead of a directory name. You can give either of these in your program or in a MACRO command line. For more information about referencing other users' the DECSYSTEM-20 User's Guide. G.l files, refer to USING LOGICAL NAMES To use a logical name in accessing another user's file, you must: 1. Give the DEFINE command to define a logical name (of no more than six characters) as the other user's directory name. 2. Use the logical name as the device name whenever file specification. G.l.l giving the prints INE Giving the DEFINE Command TO give the DEFINE command: 1. Type DEF and press the ESCAPE key; (LOGICAL NAME) • the system @DEFINE (LOGICAL NAME) 2. Type the logical name, ending it with a colon; directory name in angle brackets and RETURN: then type the @DEFINE (LOGICAL NAME) BAK:<BAKER> @ To check the logical name, LOGICAL-NAMES command. give the @INFORMATION (ABOUT) LOGICAL-NAMES BAK: => <BAKER> @ G-l INFORMATION (ABOUT) ACCESSING ANOTHER USER'S FILE G.l.2 Using the Logical Name You can include the logical name in a command line or in your program. G.l.2.1 Command Lines - To include the logical name line, type the logical name in place of a device name. in a command The following example shows how to compile the file <BAKER>SPEC.MAC. You must have already defined the logical name BAK: as <BAKER>.) @MACRO *SPEC.REL=BAK:SPEC.MAC G.l.2.2 User Programs - After giving the DEFINE command, include logical name within the program to reference the file. The following example shows how to <BAKER>MACROS.MAC with a .REQUEST pseudo-oPe ref~renc~ the the file .REQUEST BAK:MACROS.MAC This command causes LINK to load the file MACROS.MAC directory that has been assigned the logical name BAK. G.2 from the USING PROJECT-PROGRAMMER NUMBERS To use a project-programmer number in accessing anothet you must: user's file, 1. Run the TRANSL program to find "the corresponding project-programmer number for the given"directory name. 2. Include the project-programmer number after the filename. You do not have to define a logical name if. you use a project-programmer. number. Project~programmer numbers," however, sometimes change; therefore, use logical names wherever possible. G.2.1 Running the TRANSL Program To run the TRANSL program, you must: 1. Type TRANSL and press the ESCAPE key. the line as TRANSLATE (DIRECTORY). The ~ystem completes @TRANSLATE (DIRECTORY) 2. Type the directory name and press the RETURN key. prints the appropriate project-programmer number. TRANSLATE (DIRECTORY>(BAKER> PS:<BAKER> IS PS:C4,204J G-2 The system ACCESSING ANOTHER USER'S FILE You can also use the TRANSL program to make sure a project-programmer number is correct. Simply replace the directory name with the project-programmer number. @TRANSLATE (DIRECTORY)[4,204J PS:C4,204J IS PS:<BAKER> G.2.2 Using the Project-Programmer Number You can include the project-programmer number in a command line or in your program. Because project-programmer numbers can change, you should use a logical name. G.2.2.l Command Lines - To include a project-programmer number in a command line, type the project-programmer number after the file specification. The following example shows how to compile the file <BAKER)SPEC.MAC by using a project-programmer number. @MACRO *SPEC.REL=SPEC.MACC4,204J G.2.2.2 User Programs - After obtaining the project-programmer number, you can use it within the program to reference the file. The following example shows how <BAKER)MACROS.MAC from your program. to reference the file .REQUEST MACROS.MACC4,204J This command causes LINK to load directory associated with [4,204] • G-3 the file MACROS.MAC from the INDEX jA, 7-3 Absolute address, 3-38, 3-46 Absolute expression, 2-15 Absolute symbol, 2-12 ' Accumulator, 4-4 Accumulator, implicit, 4-6 Addition, 2-13 Address, 1-3, 4-4 Address, absolute, 3-38, 3-46 relocatable, 3-46, 3-57 starting, 3-17 Address assignment, 4-3 Allocation, storage, F-l Ampersand (&), B-4 AND, 2-13 Angle brackets «», B-7 Apostrophe ('), 6-2, B-5 Argument, concatenating, 5-8 default, 5-8 dummy, 5-1, 5-2 missing, 5-2 null, 5-2 passed, 5-1, 5~2 quoting characters in, 5-4 Argument handling, 5-4 Argument interpretation, 5-11 Argument list, 5-4 Argument storage, macro, F-3 Arithmetic expression, 2-13 Arithmetic operator, 2-13 Arithmetic overflow, 3-16 ARRAY, 3-2 ASCII (pseudo-op), 3-3 ASCII character codes, A-I ASCII characters, 2-1 ASCIZ, 3-4 Assembler output, 6-1 Assembly, conditional, 3-23, 3~24, 3-25, 9-5 .ASSIGN, 3-6 Assignment, address, 4-3 Asterisk (*), 6-2, B-4 ASUPPRESS, 3-7 At-sign (@), B-6 Attributes, symbol, 2-12, 3-23, 3-24 B, B-2 jB, 7-3 . . B, B-2 Backslash (\), B-5 Backslash-apostrophe (\'), B-6 Backslash-quote (\"), B-6 Binary program file, 6-5 Binary shifting, 2-6 Bit 0 (sign bit), 2-2 Bit pattern, querying,,2-6 BLOCK, 3-8, 6-2 Brackets «», angle, B-7 Brackets ([]), square, B-7 BYTE, 3-9 Byte pointer, 3-50 jC, 7-3 Call, macro, 5-2 Character codes, A-I Characters, ASCII, 2-1 MACRO, 2-1 special, 2-2 Code, error, 6-3 relocatable, 1-3 Codes, symbol table, 6-4 Colon, B-3 Colon (:), B-7 Colon (::), double, B-3 Comma (,), B-4 Comma (,,), double, B-4 Command level, MACRO, 7-1 Comment, 3-10, 3-59, 4-2, 4-3 COMMENT (pseudo-op), 3-10 Comment pseudo-ops, COMMENT, 3-10 REMARK, 3-59 .COMMON, 3-11 Compatibility pseudo-ops, E-l Compilation, program, 7-1 Index-l INDEX (CONT • ) Compiler switches, MACRO, 7-3 Complement, one's, 2-14 two's, 2-2 Concatenating argument, 5-8 Conditional assembly, 3-23, 3-24, 3-25, 9-5 Conditional pseudo-ops, .IF, 3-23 • IFN, 3-24 IFx group, 3-25 Counter, location, 2-8, 3-15, 3-38, 3-46, 3-49, 3-57, 3-74, 4-4, B-3 Counter pseudo-ops, .ENDPS, 3-18 LOC, 3-38 .ORG, 3-46 .PSECT, 3-53 RELOC, 3-57 TWOSEG, 3-74 Created symbol, 5-9 .CREF, 3-12 Cross-reference table, 3-12, 3-79, 6-4 CTRL/underscore, B-6 .... D, B-2 DEC, 3-13 Decimal number, fixed-point, 2-3 floating-point, 2-4 Decimal point (.), B-3 Default argument, 5-8 DEFINE (pseudo-op), 3-14 Definition, label, 2-10 macro, 5-1 nested macro, 5-6 symbol, 2-10, 3-70, 4-3 DEPHASE, 3-15 Device code, 4-6 Device code mnemonics, I/O, C-6 Direct-assignment symbol, 2-11, 4-3 .DIRECTIVE, 3-16 Division, 2-13 Dot (location counter), 2-8, 4-4, B-3 Double colon (::), B-3 Double comma ("), B-4 Double equal sign (==), B-7 Double pound-sign (##), B-5 Double quotation marks ("), B-5 Double semicolon (11), B-3 Dummy-argument, 5-1, 5-2 E, 2-5, B-2 IE, 7-3 END, 3-17 • ENDPS , 3-18 Ent code, 6-4 ENTRY, 2-12, 3-19 Equal sign (=), B-7 Equal sign (~=), double, B-7 .EROVL, 3-16 Error code, 6-3 single-character, 8-3 Error messages, MCRxxx, 8-7 Evaluating expressions, 2-14, 2-15 Examples, . program, D-1 Exclamation point (1), B-3, B-4 EXP, 3-20 ExpJ:ession, absolute, 2-15 arithmetic, 2-13 evaluating, 2-15. logical, 2-13 nested, 2-15 Polish, 2-14 re1ocatable, 2-15 Expressions, evaluating, 2-14 Ext code, 6-4 EXTEND, 4-7 EXTEND mnemonics, KLIO, C-9 ,. Extended Instruction, KL-IO, 4-7 EXTERN, 2-13, 3-21 EXTERNAL symbol, 2-12, 2-13, 2-14 EXTERNAL symbol storage, F-l /F, 7 .... 3 . . F, B-2 File, l~sting, 6-1' UNIVERSAL, 6-5, 9-4 Fixed-point decimal number, 2-3 Index-2 INDEX (CaNT.) FLBLST, 3-16 Floating-point decimal number, 2-4 G, 2-3, B-2 /G, 7-3 Global symbol, 2-12, 2-13 /H, 7-3 Halfword, 1-3, 3-82 Halfword notation, 2-15 Hierarchy of operations, 2-14 HISEG, E-2 .HWFRMT, 3-21 Hyphen (-), B-4 I/O device code mnemonics, C-6 I/O instruction format, 4-6 I/O instruction mnemonics, C-6 .IF, 3-23 IFl, 3-25 IF2, 3-25 IFB, 3-25 IFDEF, 3-25 IFDIF, 3-25 IFIDN, 3-25 • IFN, 3-24 IFNB, 3-25 IFNDEF, 3-25 Implicit accumulator, 4-6 Indefinite repeat, 3~30, 3-31, 3-67, 5-10 Index register, 4-4 Indexed addressing, 4-4 Indirect addressing, 4-4 Informational messages, 8-1 Instruction format, I/O, 4-6 primary, 4-4 Int code, 6-4 Integer, 2-2, 3-55 INTEGER (pseudo-op), 3-27 inter-PSECT reference storage, F-2 INTERN, 2-12, 3-28 INTERNAL symbol, 2-12 Interpretation, argument, 5-11 IOWD, 3-29 IRP, 3-30, 5-10 IRPC, 3-31, 5-10 .ITABM, 3-16 JFCL mnemonics, C-lO JRST mnemonics, C-lO K, 2-3, B-2 KAlO, 3-16 KIlO, 3-16 KL-IO Extended Instruction, 4-7 KLlO, 3-16 KLIO EXTEND mnemonicsj C-9 /L, 7-3 "'L, B-2 Label, 4-1, 4-3 Label definition, 2-10 Label in literal, 2-8 Label symbol, 2-10 LALL, 3-32 .LINK, 3-33 Linkage pseudo-ops, .COMMON, 3-11 DEPHASE, 3-15 .DIRECT KAlO, 3-16 .DIRECT KIlO, 3-16 .DIRECT KLlO, 3-16 ENTRY, 2-12, 3-19 EXTERN, 2-13, 3-21 INTERN, 2-12, 3-28 .LINK, 3-33 .LNKEND, 3-37 PHASE, 3-49, 6-2 .REQUEST, 3-61 .REQUIRE, 3-62 • TEXT, 3-72 TWOSEG, 3-74 XPUNGE, 3-81 LIST, 3-34 Listing file, 6-1 Listing format, 6-2 Listing pseudo-ops, ASUPPRESS, 3-7 .CREF,· 3-12 .DIRECT FLBLST, 3-16 .DIRECT LITLST, 3-16 ,DIRECT SFCOND, 3-16 • HWFRMT, 3-21 LALL, 3-32 LIST, 3-34 .MFRMT, 3-39 .NODDT, 3-42 NOSYM, 3-43 Index-3 INDEX (CaNT.) Listing pseudo-ops (Cont.) PAGE, 3-47 SALL, 3-63 SUBTTL, 3-68 SUPPRESS, 3-69 TITLE, 3-73 XALL, 3-78 • XCREF, 3-79 XLIST, 3-80 XPUNGE, 3-81 LIT, 3-35 Literal, 2-7, 3-35, 3-40, 3-41 Literal, Label in, 2-8 Literal storage, F-4 LITLST, 3-16 .LNKEND,3-37 LOC, 3-38 Local symbol, 2-12 Location counter, 2-8, 3-15, 3-38, 3-46, 3-49, 3-57, 3-74, 4-4, B-3 Logical expression, 2-13 Logical operator, 2-13 M, 2-3, B-2 /M, 7-3 Machine instruction mnemonics, 3-83, 4-4, <:-1 MACMPD, 3-16 MACPRF, 3-16 Macro argument storage, F-3 Macro call, 5-2 Macro call format, 5-4 MACRO characters, 2-1 MACRO command level, 7-1 MACRO compiler switches, 7-3 Macro definition, 5-1 nested, 5-6 Macro listing, 5-6 Macro pseudo-ops, DEFINE, 3-14 .DIRECT .ITABM, 3-16 .DIRECT MACMPD, 3-16 .DIRECT MACPRF, 3-16 .DIRECT .XTABM, 3-16 IRP, 3-30, 5-10 IRPC, 3-31, 5-10 PURGE, 3-54 REPEAT, 3-60 STOPI, 3-67, 5-10 Macro table, 2-9, 2-12, 6-4 MACRO-defined mnemonics, 2-16, 4-2, C-l Macrobody, 5-1 Macrobody storage, F-3 Macroname, 5-1 Macroname storage, F-2 MCRxxx error messages, 8-7 Memory, 1-3 . Message pseudo-ops, PRINTX, 3-52 Messages, MCRxxx error, 8-7 .MFRMT, 3-39 Minus sign (-), B-5 Missing argument, 5-2 MLOFF, 3-40 MLON, 3-41 Mnemonics, I/O device code, C-6 I/O instruction, C-6 JFCL, C-lO JRST, C-lO KLIO EXTEND, C-9 machine instruction, 3-83, 4-4, C-lp MACRO-defined, 2-16, 4-2, C-l Multiplication, 2-13 /N, 7-3 Nested expression, 2-15 Nested macro definition, 5-6 NO (with .DIRECTIVE} , 3-16 .NOBIN, 3-16 .NODDT, 3-42 NOSYM, 3--43 NOT, 2-13 Null argument, 5-2 Number, 2~2, 3-55 Number, fixed-point decimal, 2-3 floating-point decimal, 2-4 Number pseudo-ops, .ASSIGN, 3-6 DEC, 3-13 .DIRECT .EROVL, 3-16 .DIRECT • OKOVL , 3-16 EXP, 3-20 OCT, 3-44 RADIX, 3-55 RADIX50, 3-56 SQUOZE, 3-66 Z, 3-83 /0, 7-3 "'0, B-3 OCT, 3-44 . OKOVL , 3-16 Index-4 INDEX (CONT . ) One's complement, 2-14 Op-code table, 2-9 Opcode table, 6-4 OPDEF (pseudo-op), 3-45 OPDEF operator, 4-2 OPDEF storage, F-l Operand, 4-2, 4-3, 4-4 Operation, hierarchy, 2-14 Operator, 4-2, 4-3, 4-4 Operator, arithmetic, 2-13 logical, 2-13 OR, 2-13 .ORG, 3-46 Output, assembler, 6-1 Overflow, arithmetic, 3-16 /P, 7-3 P22, 3-21 PAGE, 3-47 Parentheses, B-6 Pass 1, 3-17, 4-3 Pass 2, 3-17, 4-3 Pass control pseudo-ops, END, 3-17 PASS2, 3-48 PRGEND, 3-51 PASS2 (pseudo-op), 3-48 Passed argument, 5-1, 5-2 Percent-sign (%), B-6 PHASE, 3-49, 6-2 Plus sign (+), B-4 POINT, 3-50 Pointer, byte, 3-50 Pol code, 6-4 Polish expression, 2-14 Polish symbol storage, F-l Pound-sign (##), double, B-5 Pound-sign (#), 6-2, B-5 PRGEND, 3-51 Primary instruction format, 4-4 PRINTX, 3-52 Program, single-segment, 9-1 two-segment, 9-2 Program compilation, 7-1 Program file, binary, 6-5 Program listing file, 6-1 Program name, 3-73 Program segmentation, 9-1 Program with PSECTs, 9-3 • PSECT, 3-53 PSECTs, program with, 9-3 Pseudo-op, format, 3-1 Pseudo-op operator, 4-2 Pseudo-ops, compatibility, E-l PURGE, 3-54 /Q, 7-3 Querying bit pattern, 2-6 Quotation marks ("), double, B-5 Quotation marks ('), single, B-5 Quoting characters in argument, 5-4 Radix, 2-2 RADIX (pseudo-op), 3-55 RADIX50, 3-56 RADIX50 character codes, A-I Register, index, 4-4 RELOC, 3-57 Relocatable address, 3-46, 3-57 Relocatable code, 1-3 Relocatab1e expression, 2-15 Re1ocatab1e symbol, 2-12 REMARK (pseudo-op), 3-59 Repeat, indefinite, 3-30, 3-31, 3-67, 5-10 REPEAT (pseudo-op), 3-60 .REQUEST, 3-61 .REQUIRE, 3-62 RIM, E-3 RIMIO, E-4 RIM10B, E-5 /S, 7-4 SALL, 3-63 SEARCH, 3-64 Segmentation, program, 9-1 Index-5 INDEX (CaNT.) Semicolon (i), B-3 Semicolon (i i) , double, B-3 Sen code, 6-4 Sex code, 6-4 SFCOND, 3-16 Shifting, binary, 2-6 underscore, 2-6 Sin code, 6-4 Single quotation marks ('), B-5 Single-character error code, 8-3 Single-segment program, 9-1 SIXBIT (pseudo-op), 3-6~ SIXBIT character codes, A-I Slash (I), B-4 Spd code, 6-4 Special characters, 2-2 Square brackets ([]), B-7 SQUOZE, 3-66 Starting address, 3-17 Statement format, 4-1 Statement processing, 4-3 STOPI, -3-67, 5-10 Storage, 3-2, 3-8, 3-11, 3-27, 3-35, F-l Storage, symbol, F-l Storage allocation, F-l Storage pseudo-ops, ARRAY, 3-2 BLOCK, 3-8, 6-2 BYTE, 3-9 DEC, 3-13 EXP, 3-20 INTEGER, 3-27 IOWD, 3-29 LIT, 3-35 OCT, 3-44 POINT, 3-50 REPEAT, 3-60 VAR, 3-77 XPUNGE, 3-81 XWD, 3-82 Z, 3-83 Subroutine entry, 3-19 Subtraction, 2-13 SUBTTL, 3-68 SUPPRESS, 3-69 Switches, MACRO compiler, 7-3 Symbol, 2-9 absolute, 2-12 created, 5-9 direct-assignment, 2-11, 4-3 EXTERNAL, 2-12, 2-13, 2-14 Symbol (Cont.) global, 2-12, 2-13 INTERNAL, 2-12 label, 2-10 local, 2-12 relocatable, 2~12 valid, 2-9 variable, 2-11, 3-77 Symbol attributes, 2-12, 3-23, 3-24 Symbol definition, 2-10, 3-70, 4-3 Symbol pseudo-ops, .ASSIGN, 3-6 • CREF, 3-12 DEFINE, 3-14 .DIRECT MACPRF, 3-16 ENTRY, 2-12, 3-19 EXTERN, 2-13, 3-21 INTERN, 2-12, 3-28 .NODDT, 3-42 OPDEF, 3-45 PURGE, 3-54 RADIX50, 3-56 SEARCH, 3-64 SQUOZE, 3-66 SYN, 3-70 UNIVERSAL, 3-75 VAR, 3-77 .XCREF, 3-79 Symbol storage, F-l Symbol table, 2-9, 3-7, 3-43, 3-54, 3-64, 3-69, 3-75, 3-81, 6-4 Symbol table, . user, 2-9, 2-12 Symbol table codes, 6-4 SYN (pseudo-op), 3-70 SYN symbol storage, F-2 IT, 7-4 Table, cross-reference, 3-12, 3-79, 6-4 macro, 2-9, 2-12, 6-4 op-code, 2-9 opcode, 6-4 symbol, 2-9, 3-7, 3-43, 3-54, 3-64, 3-69, 3-75, 3-81, 6-4 user symbol, 2-9, 2-12 TAPE, 3-71 .TEXT, 3-72 Text entry pseudo-ops, ASCII, 3-3 ASCIZ, 3-4 SIXBIT, 3-65 .TEXT, 3-72 Index-6 INDEX (CONT.) TITLE, 3-73 Two's complement, 2-2 Two-segment program, 9-2 TWOSEG, 3-74 /U, 7-4 Udf code, 6-4 Underscore, B-6 Underscore shifting, 2-6 UNIVERSAL, 3-75 UNIVERSAL file, 6-5, 9-4 User symbol table, 2-9, 2-12 Valid symbol, 2-9 VAR, 3-77 Variable symbol, 2-11, 3-77 /W, 7-4 /X, 7-4 XALL, 3-78 .XCREF, 3-79 XLIST, 3-80 XOR, 2-13 XPUNGE, 3-81 .XTABM, 3-16 XWD, 3-82 z, 3-83 Index-7 MACRO ASSEMBLER Reference Manual AA-4l59C-TM '\ READER'S COMMENTS I NOTE: This form is for document comments only. DIGITAL will use comments submitted on this form at the company's discretion. Problems with software should be reported on a Software Performance Report (SPR) form. If you require a written reply and are eligible to receive one under SPR service, submit your comments on an SPR form. Did you find errors in this manual? If so, specify by page. Did you find this manual understandable, usable, and well-organized? Please make suggestions for improvement. Is there sufficient documentation on associated system programs required for use 'of the software described in this manual? If not, what material is missing and where should it be placed? Please indicate the type of user/reader that you most nearly represent. o Assembly language o Higher-level language programmer o Occasional programmer (experienced) [J User with little programming experience o Student programmer progr~mmer I I I, I, I' I' :1 I' ,I )1. ' I' I I , :1 I 1 ., O' Non-programmer interested in computer concepts and capabilities '. ",Name Date _____________ Organization _______________~--~---------------------·Street _____________________________~~-~---------------------------, ci ty _______________________ Sta te _______ Zip Code _____________ or Country .---------------------------------------~--------------------Fold lIere-----------------------------------------------------------. .--------------------------------------------~-- Do Not Tear· Fold Here and Staple ---------------------------------------------.- FIRST CLASS PERMIT NO. 152 MAR LBOROUGH, MA 01752 BUSINESS REPLY MAIL NO POSTAGE STAMP NECESSARY IF MAILED IN THE UNITED STATES Postage will be paid by: • Software Documentation 200 Forest Street MRl-2/E37 Marlborough, Massachusetts 01752
Home
Privacy and Data
Site structure and layout ©2025 Majenko Technologies