Digital PDFs
Documents
Guest
Register
Log In
XX-60DA3-1C
June 1972
140 pages
Original
5.4MB
view
download
OCR Version
5.1MB
view
download
Document:
02 1973AsmRef macro
Order Number:
XX-60DA3-1C
Revision:
0
Pages:
140
Original Filename:
02_1973AsmRef_macro.pdf
OCR Text
-197DEC-10~AMZC-D MACRO-10 ASSEMBLER B PROGRAMMER’S REFERENCE MANUAL DIGITAL EQUIPMENT CORPORATION ¢ MAYNARD, MASSACHUSETTS MACRO -198- Copyright The (:) The Edition April 1967 Printing October 1967 Edition (Rev) August 1968 Edition (Rev) June 1969 Edition (Rev) October 1969 Edition (Rev) August 1970 Edition (Rev) April 1972 1967, 1968, 1969, 1970, 1971, 1972 by Digital material purposes l1st 2nd 3rd 4th 5th 6th 7th and in this is subject to following Corporation, are manual is for information change without trademarks Maynard, DEC FLIP Equipment Corporation of Digital Equipment Massachusetts: PDP CHIP DIGITAL FOCAL COMPUTER notice. LAB -199- MACRO CONTENTS CHAPTER INTRODUCTION 1 205 1.1 MACRO-10 LANGUAGE - STATEMENTS 206 1.2 INSTRUCTION WORD FORMATS 206 1.2.1 Primary Instruction Format 207 1.2.2 Input/Output 208 1.3 COMMUNICATION WITH MONITORS 209 1.4 OPERATING PROCEDURES 209 1.5 MACRO 209 1.5.1 Symbols 209 1.5.2 Labels 210 Instruction Format STATEMENTS 1.5.3 Symbolic Addresses 210 1.5.4 Operators 211 1.5.5 Symbolic Operators 211 1.5.6 Operands 212 1.5.7 Symbolic Operands- 212 1.5.8 Comments 213 1.6 STATEMENT PROCESSING 213 1.6.1 Order of Statement Evaluation 1.6.2 Order 214 214 1.7 USER-DEFINED SYMBOLS 215 1.7.1 Direct Assignment Statements 215 1.7.2 chél and Global Symbols 216 1.7.3 Deleted Symbols 217 1.8 NUMBERS 218 1.8.1 Arithmetic and Logical Operations 1.8.2 Evaiuating Expressions 219 219 1.8:3 Numeric Terms 220 1.8.4 Binary 1.8.5 Left Arrow Shifting 1.8.6 Floating Point Decimal Numbers of Expression Evaluation Shifting 221 222 222 1.8.7 Fixed Point Decifial Numbers 222 1.9 ADDRESS 223 1.9.1 Setting and Referencing ASSIGNMENTS Counter the Location 224 1.9.2 Indirect Addressing 224 1.9.3 Indexing 224 1.10 LITERALS 225 Version 47 June iii 1972 -200- MACRO MACRO-10 ASSEMBLER STATEMENTS - PSEUDO-OPS CHAPTER 2 227 RELOCATABLE OR ABSOLUTE 2.1 ADDRESS MODE: 2.1.1 Relocation Before Execution - PHASE and DEPHASE 227 229 Statements 2.2 NAMING PROGRAMS 230 2.2.1 Program Subtitles 231 2.3 PROGRAM ORIGIN 231 2.3.1 HISEG Statements - The HISEG Pseudo-Op 232 Statement 2.3.2 TWOSEG Statements 232 2.4 ENTERING DATA 233 2.4.1 RADIX Statements 233 2.4.2 Entering Data Under the Prevailing Radix 234 2.4.3 DEC and OCT Statements 234 2.4.4 Changing the Local Radix for a Single 235 Term Numeric 2.4.5 50 Statement RADIX 236 2.4.6 EXP Statement 236 2.4.7 Z Statement 236 2.5 INPUT DATA WORD FORMATTING 236 2.5.1 BYTE Statement 236 2.5.2 POINT Statement - Handling Bytes 237 Formatting I/0 239 2.5.3 2.5.4 IOWD Statement: Transfer : Entering Two Half-Words XWD Statement: of 2.5.5 Words 239 Data 240 Text Input ASCIZ, 240 and SIXBIT Statement 2.5.5.1 ASCII, 2.5.6 Reserving Storage 241 2.5.6.1 Reserving a Single Location 242 2.5.7 VAR Statements 243 2.5.8 BLOCK Statements 243 2.5.9 END Statements 243 2.5.10 LIT Statements 244 2.5.11 Multi-Program Assembly 244 2.5.12 PASS2 Statements 245 2.5.13 PURGE Statements 245 2.5.14 XPUNGE Statements 245 Linking Subroutines 246 2.5.15 2.5.15.1 EXTERN Statements 246 2.5.15.2 INTERN Statements 247 2.5.15.3 ENTRY Statements 247 June Version 47 iv 1972 -2012.6 SUPPRESSION OF SYMBOLS 2.6.1 SUPPRESS SYMBOL Statement 248 2.6.2 ASUPPRESS Statement 248 248 2.6.3 Listing Control Statements 249 2.7 CONDITIONAL ASSEMBLY 252 2.8 ASSEMBLER CONTROL STATEMENTS 253 2.8.1 REPEAT Statements 253 2.8.2 OPDEF 2.8.3 SYN ' Statements 254 Statements 255 2.8.4 Extended 2.9 MULTI-FILE ASSEMBLY 257 2.9.1 UNIVERSAL 257 2.9.2 " SEARCH Name Instruction 256 Statements Name 258 w CHAPTER MACRO MACROS DEFINITION OF 259 MACROS 259 MACRO CALLS 260 MACRO FORMAT 261 CREATED SYMBOLS 262 CONCATENATION DEFAULT 263 ARGUMENTS 264 INDEFINITE REPEAT NESTING ASCII CHAPTER CHAPTER CHAPTER AND . 265 REDEFINITION 266 Interpretation 268 ERROR DETECTION 4 269 4.1 SINGLE-LETTER 4.2 ERROR MESSAGES 275 4.2.1 LOOKUP- Errors 277 4.2.2 MACRO I/O 5 ERROR Error CODES 269 Messages 278 279 RELOCATION 6 ASSEMBLY 283 OUTPUT 6.1 ASSEMBLY 6.2 BINARY 6.2.1 Relocatable Binary Programs LISTING PROGRAM 283 OUTPUT 284 - LINK 284 Format Version 47 June 1972 MACRO CHAPTER APPENDIX -2026 .2:1.1 LINK 6 .2.2 Absolute Formats 6 .2.2.1 RIMIOB 6 .2.2.2 RIM10 for Binary the Block Types 285 Programs 288 Format 288 Format 289 6 .2.2.3 RIM Format 290 6 .2.2.4 END Statements 290 7 EXAMPLES 293 CODES, PSEUDO-OPS, 307 MONITOR I/0 COMMANDS PROGRAMMING A OP AND A.l ASSEMBLER PSEUDO-OPS AND MONITOR CO 307 COMMANDS A.2 APPENDIX B MACHINE MNEMONICS SUMMARY OF OCTAL CODES 309 311 PSEUDO-OPS B.1l PSEUDO-OPS 311 B.1l.1 Conditional Assembly Statements 313 APPENDIX C APPENDIX D APPENDIX E APPENDIX F APPENDIX G SUMMARY OF CHARACTER STORAGE RADIX 50 INTERPRETATIONS 315 319 ALLOCATION TEXT 323 CODES REPRESENTATION SUMMARY DEFINING Version AND OF AND RULES 325 327 FOR CALLING MACROS G.1 ASSEMBLER INTERPRETATION G.2 CHARACTER HANDLING G.2.1 Blanks G.2.2 Brackets 327 G.2.3 Parentheses 328 G.2.4 Commas 328 327 327 327 G.2.5 Semicolons 328 G.2.6 Carriage 328 Return G.2.7 Back-Slash 328 G.3 CONCATENATION 328 47 June vi 1972 MACRO -203- APPENDIX H OPERATING 331 INSTRUCTIONS H.1 REQUIREMENTS 331 H.2 INITIALIZATION 331 H.3 COMMANDS 332 H.3.1 General Command Format 332 H.3.2 Disk H.4 SWITCHES Version 47 File Command Format 332 334 June vii 1972 -205- | MACRO Chapter 1 Introduction MACRO-10 ates in is the symbolic a minimum PDP-10 systems. of for for input assembled output This the program plus 1K and output symbolic program files. source by program, program, and a easier, processes the translating gram assigning instructions program which DECtape line and oper- in all ‘ It is completely a terminal for printer functiqns, faster, PDP-10 mnemonic and more can output can of be used be used the to relocatable and data, includes or and operation efficient. preparing of source codes to Basically, program the binary relating symbols to numeric absolute notification making machine programmer's codes needed in machine ihstructions, values, PDP-10, listing. programming statements the core memory ’For_example, assembler performs many useful assembler for impure allowing the user to select standard peripheral binary. object the language the input of assembly pure MACRO-10 is é two-pass assembler. device independent, devices 7K core an any addresses output errors for listing detected pro- of the during the assembly process. "MACRO-10 also contains powerful macro capabilities which allow the programmer to create new language elements, VERSION 47 thus expanding and JUNE 1972 1-1 MACRO -206- adapting the programming 1.1 MACRO-10 MACRO-10 of a 1s riage LANGUAGE programs text ment format in editing to perform - STATEMENTS usually program, normally written free; feed that columns are four separated by the or delimiting, order Statements rigidly assembler and translates the oriented of a single functions of a in terminal, of line for with statements. and terminated statements statement controlled each are spacing state- by car- in elements, in in the the a MACRO-10 These statement, follows general or statement elements and are by precedes which statements are identified the the separating, elements. form: operand,operand;comments (carriage converts a virtually placed between aid Each are not the assemblers. character which written a MACRO-1l0 elements appearance on sequence characters. operator The on a elements types of are label: by specialized prepared sequence. is, specific by as with punched-card There used are return-line numbered as assembler job. written in the foregoing them into machine instruction words. machine instructions are described return-line in The the feed) form formats following paragraphs. 1.2 INSTRUCTION There are two WORD types and input/output. The PDP-10 machine FORMATS of machine instructions System Reference Manual this manual. the same fully described listed alphabetically in primary the PDP-10 in Appendix A of (See monitor manuals.) instruction statements may have accumulator address and may be modified by VERSION U7 are formats: Monitor I/O commands, or programmed operators have formats. The primary and instruction word (2) two operands: a memory address. (1) an A memory address indexing and indirect addressing. JUNE 1972 -207- | MACRO l.fi.l»_Primaty Instruction Format Aftef brdceséing primary instruction statements, the assembler produces machine instructions in the geheral 36-bit word format shown below: 0 : [b 1t 0o+ 1t 8 o 1 0 0 O |1 to ©42'13 14 1718 : 35 l1 IO‘ o 1t ]o 6 00 00O OC OO0 OO 1 00 00 O oJ . INSTRUCTION _/ INDIRECT PART ADDRESS BT ACCUMULATOR . PART INDEX REGISTER - 10-0062 Inh general, the mnemofiic,bperation code, or operator, in the sympolic statement is translated'£0 its binary equivalent and placed in‘bits‘o—é of the chhineiinStfuctiénu The addréss operand is evaluated and,placed‘in the address pért (bits 18-35 of the machine instruction. The assemBlex-asSigns séqugntial binary addresses to each statement as it,is prbcesSed by meéns of the loCation counter. Labels are given the currénfi-value of the location counter and are stored in the d ssembler's stbol tabi¢7 where the corresponding binary addresses can be found if another instruction uses the same symbol as an address reference. Any one of 16 pOSsible acCfimdlators may be specified in an instruction by identifyifig them 9ymbolically dr numerically as operands in the statement folloWéd by a-comma. The indirect address bit is set to l.when the character @.bfefixés~a @embry reference. Indexing is-specified by wrifiing thefiindéx reqister used in parentheses immediately following the memoty reference. (All PDP-10 accumula- tors, except accumulator O, may be used as index registers.) Actu- ally, expression§ encloéed in parentheses. (in the index register position) are eva1uated as 36-bit quantities; their halves are ex- changed, and then each half is added inté'the COrrespondihg half of the binaty,Word being assembled. For example, the statements MOVSI AC,(1.9) MOVSI AC, (SIXBIT /DSK/) are equivalent to MOVSI AC,2¢01L4g@ MOVSI AC,4U46353 VERSION 47 ;MOVE 1.4 TO AC) ;MOVE 1.4 TO AC) ‘ June 1972 -208- MACRO To illustrate this general view of assembler processing, typical symbolic instruction. defined symbols, with values of This [ like ) v 9 12 A — I 13 14 17 18 178. TEMP, then to _ INDE X 10-0061 REGISTER ADD, has been translated to its octal and stored in bits 0-8. The first operand specifies The effective memory address will be taking points 35 * cution time by adding the contents of address a binary machine ADDRESS PART instruction code, accumulator of stored as e ACCUMULATOR 270, is a respectively. INDIRECT BIT “equivalent, here and XR are ; STATEMENT EXAMPLE ) the assembler and INSTRUCTION PART The mnemonic and 3, TEMP this: 8 N 100, ADD AC17,@TEMP(XR) is processed by instruction 17, that ACl1l7, O LABEL: Assume this value the word as to be index register the address added to ACl7. of 3 found at exe- to the value the word whose A comment following a semicolon does not affect the program in any but 1.2.2 it is printed Input/Output is listing. Instruction Format There are eight PDP-10 operand in the ocutput I/O statements; either a peripheral device in each statement the number or a device mnemonic (see PDP-10 System Reference Manual for complete list). operand is a memory address. READ: requests at the The that data be o) 2 R for 3 170 INSTRUCTION VErs1onN 47 read in indexed, 9 Y example, from a paper-tape reader, address DEVICE SELECTION 10 12 13 |1 14 17 INDIRECT 8T INSTRUCTION PART to be stored given. I/0 instruction words 1 e The second DATAI PTR,@NUM(4)) indirect, format For first | is shown below: 18 a5 hd ADDRESS PART INDEX REGISTER SR way, -/ ) 10-0063 JuNe 1972 -2091.3 Programs trol I/0 of assembled with a monitor must services. tion codes and CLOSE. This 040 MACRO-10 exercise is memory allocatlon, operate facilities 077) over and such are CALL. processor services, trapping, which Monitor listed 'in Appendix A. 1.4 LOOKUP, to allow the manuals. are executive for device INIT, available central other as monitor programmer's commands under are con- independent done by meanof s programmed operators through control which use monitor Additional monitor commands to MACRO COMMUNICATION WITH MONITORS IN, (opera-~ OUT, user program to modify described in its the OPERATING PROCEDURES Commands fbr'lbading and executing MACRO-10 are contained in Appen- dix H. 1.5 MACRO As previously a label, The STATEMENTS an stated (paragraph 1.1) operator an , operand assembler interprets and macro statements and‘optional processes these consist of comments, statements, generating one or more binary instructions or data woxrds, assembly or performaing an A least process. statement must contain elements and may contain all four types. at one ten with only one operand; but others may have many statement on the echoed ++ is (« ¥ as or )). Figures 7-1 follow1ng used Examples and and replaces 1.5.1 or before the control carriage (CTRL) To continue a left return-line of program statements are arrow feed given («), sequence in Chapter 7, operators and operands may be represented elther symbolically. them with a The numeric assembler (binary) interprets all symbols wvalue. Symbols The programmer may create as the these 7-3. Statement labels, numerlcally line, of Some statements are writ- operators VERsI1ON 47 and as symbols to use as operands. A symbol -5 may statement consist of labels, any June 1972 -210- MACRO combination of from one to six characters of the following set: The 26 letters, Ten digits, 0-9 A-Z Three special characters: §$ (Dollar Sign) % . (Percent) (Period) The foregoing character set is the Radix-50 character set. Any statement character which is not in the Radix-50 set is treated as a symbol delimiter when encountered by the assembler. If the first characters of a symbol are numeric, the symbol is treated as through the numeric characters were not present. If the first character is a period, it must not be followed by a digit. Spaces must not be embedded in symbols. A symbol may actually have more than six characters, but only the first six are meaningful to MACRO-10. MACRO-10 accepts programs written using both upper and lower case letters and symbols (e.g., programs written using thé Teletype Model 37). Lower case letters are treated as upper case in symbols; additional special characters, and lower case letters elsewhere, are taken without change. 1.5.2 Labels A label is the symbolic name created by the source programmer to identify a statement. If present, the label is written as the first item in a statement and is terminated by a colon (:). (Refer to paragraph 1.5.1 for a description of how symbolic names are formed.) 1.5.3 Symbolic Addresses A symbol used as a label to specify a symbolic address must appear first in the statement and must be immediately followed by a colon (:). When used in this way, a symbol is said to be defined. A defined-symbol can reference an instruction or data word at any point in the program. A label can be defined with only one value; if a programmer attempts ! to redefine a label with a different value, the second value is VERsION 4/ June 1972 1-6 _211- ignored and an error | Isages). The following are legal labels: is indicated (see Chapter 4 for MACRO error mes- $SUM: ABC: DEF: (Both FOO The following are too many characters given recognized by Labels used 1.5.4 An are the instructions, are used used. For assembler & in a label, example only the the label first six ABCDEFGH: is being ABCDEF:. for programmer reference as addresses for jump for loops and for debugging. Operators operator may be one (see DECsystem-10 or pseudo- operation a legal) (Flrst character must not be a digit.) (Colon must immediately follow label.) : characters are are illegal: TABC: LAB If labels ' assembly of the mnemonic machine System Reference Manual), pseudo-op code codes which are instruction a command dlrects assembly descrlbed in codes to Monitor, processing.. this manual, and llsted | with all other assembler defined operators in Appendix A. Programmers own An may pseudo-operators operator may instruction. but, be a the (see power OPDEF macro of name, Like pseudo-ops, the assembler by creating their pseudo-op). which macros calls a user-defined direct macro assembly processing; because of their unique power to handle repetitions and to extend and separately or extend These adapt (see the assembly Chapter 3). language, Operators macros are are considered terminated with a space tab. 1.5.5 sSymbolic Symbols used as Operators operators must be predefined by by the'programmer. If a statement has no label, appear statement, tab, or first in carriage the return. The and must be following "VERSI1ON 47 are the assembler or the operator may terminated examples by of a space, legal operators: June 1972 * 1-7 -212- MACRO MOV LOC ZIP 1.5.6 (A mnemonic machine instruction operator.) (An assembler pseudo-op.) (Legal only if defined by the user.) Operands Operands are usually the symbolic addresses of the data to be accessed when an instruction is executed, or the input data or argu- ments or a pseudo-oOp Or mMacro instruction. In each case, the in- terpretation of operands in a statement depends on the statement Operands are separated by commas, and terminated by a operator. semicolon (;) or by a carriage return-line feed. In the mnemonic machine instruction and UUO call set, if an operand is followed by a comma (spaces in the line are ignored) then the operand is identified as an accumulator (see instruction format If an operand is not followed by description in paragraph 1.2.1). a comma, then it is viewed as an address (either indexed or indirect if negative). 1.5.7 Symbolic Operands symbols used as operands must have a value defined by the user. These may be symbolic references to previously defined labels where the argument to be used by this instruction are to be found, or +he values of symbolic operands may be constants or character If the first operand references an accumulator, it must strings. be followed by a comma. TOTAL: ADD AC1,TAG) The first operand, ACl, specifies an accumulator register, determined by the value given to the symbol ACl by the user. The second oper- and references a memory location, whose name or symbolic address is TAG. If the user has equated ACl to 17, and the assembler has assigned TAG to the binary address, 000537, then the assembler inserts 17 in the accumulator field (bits 9-12) and 000537 in the address field (bits 18-35) of this instruction.l If an accumulator is not specified, but the operator requires one, accumulator 0 is assumed by default. If an accumulator is specifies by the value >l78, the four least significant bits are used. VERsION H7 June 1972 -913- 1.5.8 The programmer may Such MACRO Comments comments tion, but do are add not useful or debugging. notes to a statement affect assembly in program the following processing listing The use of angle'brackets or for (<>) a semicolon. program later execu- analysis should be avoided in comments because they may affect the,assembly. Each line of a program may contain a comment which explains purpose of the line and any special action it causes. also consist of only .a comment;‘this is usually done the A line may at the begin- ning of each routine or major program section to explain.the major flow of control, entry and exit points and any other pertinent information. 1.6 The STATEMENT PROCESSING assembler routines. are The searched 1. has several symbol symbol tables tables arranged corresponding the order search in which they are: Macro Table - This symbol user—-defined table contains macros, operator definitions (op-defs) 'and (refer to the description of the SYN synonyms pseudo-op, initially items. 2. and in paragraph empty; ' it 2.8.3). grows The macro as the table user defines is : Op-Code Table - This symbol table contains all of the operator-codes (op-codes), the UUO calls and the assembler pseudo-operators (pseudo-ops). Lists of the foregoing items are given in Appendices A and B. and by 3. The op-code is of fixed table is generated by the assembler length; it cannot be changed except reassembling MACRO. User Symbol Table user~defined - symbols Placed This symbol other in the Macro Table. empty; it grows as the user 4. Mnemonic for the table Any is than table contains those which all are This table is initially defines items. - Table - This table contains the mnemonics MTAPE and TTCALL UUO's. The mnemonic searched only if all other measures fail. CALLI, symbol found in this table is put into the by this table macro table as an op-def as though the user had defined it. Examples-of a) b) c) ~ Verston 47 the mnemonics contains are RESET as defined by the CALLI #,g EX as IT defined in CALLI #,12 OUTSRT_as‘defined in TTCALL 3,8 D June 1972 MACRO -214the macro table and the user symbol table occupy the same Internally, space; however, the entries of each table are easily distinguishable so no confusion takes place. 1.6.1 Order of Statement Evaluation The following table shows the order in which the assembler searches each statement field: Label Field 1. Operator Field Symbol suffixed by colon. If colon is not found, no label is present. 1. 2. 3. 4, 5. 6. Number Macro/OPDEF Machine operator Assembler operator Symbol CALLl mnemonic A single symbol could be used as a label, depending on where Operand Field 1. 2. 3. 4, 5. Number Symbol Macro/OPDEF Machine operator Assembler operator an operator, or an operand, it is used. The assembler first checks the operator field for a number, and if found, assumes that no.operator is present. Likewise, if a symbol is not a macro, OPDEF, machine operator or assembler operator, the assembler will If a defined symbol is found, no operator is. search the symbol table. present. If a defined operator appears in an operand field, least one word of data. it must generate at Statements that do not generate data may not be used as part of operand expressions. If a statemeht'used in an operand expressions generates more than one word pf'data,-dnly the first word generated is meaningful. 1.6.2 | Order of Expression Evaluation Expressions are evaluated in the following order: ~ (Unary operator) *p, to, B Shift, *B, *F, <« Shift *tL Logical operators . Multiply/Divide Add/Subtract At each level, operations are performed left to right. VERsSION 47 JUNE 1972 -2151.7 MACRO USER-DEFINED SYMBOLS User~defined are symbols generated by (e.g., TAG:). ferent value are of entering two a typesi symbol labels followed and assignments. immediately by a Labels colon Symbols used as labels cannot be rede fined with a dif- once they have been defined. The value of a label is the value of the location cofinter at the time that the label is defined. Assignments are used to represent, symbolicaliy, numbers or bit patterns. Assignments ease the doding task in that only one line has to be changed (that éontaining the assignment) in orde r to change é number or bit pat- tern which changed given at is any to the 1.7.1 used throughout time, symbol the the current progrgm:' value of Assignment an statements assignment is the may last value used. Direct Assignment be Statements The macro inserts new symbols with their assigned values directly into the symbol table by using a direct assignment statement of the form, symbol=value) where must the A direct same value 5) BETA= 17) assignment value as a GAMMA= The new symbol, value VERSION 47 number the or expression. symbol. statement may For also defined Note that the equal sign example, be used to give a symbol table with new symbol the symbol: 17) BETA) GAMMA, assigned the a previously ALPHA= changes be follow ALPHA= BETA= The may immediately value to is a entered symbol into may be the the value 17. changed: 7) assigned in the first example from 5 to 7. June 1972 -216- MACRO Direct assignment statements do not generate instructions or data in the object program. These statements are used to assign values so that symbols can be conveniently used in other statements. 1.7.2 Local and Global Symbols User-defined symbols may be used as local and global symbols in addition to beging used as label and assignment symbols. Local symbols are symbols which are known only to the program in which | they are defined. Two separately assembled macro programs may contain local symbols which have the same mnemonic but different definitions; these programs, however, may be loaded and executed without conflict since the symbols are defined as local to each program. Global symbols are symbols which can be recognized by programs other than the one in which it is defined. The manner in which a global symbol is written or defined depends on where it is located: in the program in which it is defined or the program in which it is a reference to a symbol defined elsewhere. Global symbols located in the program in which they are defined must be declared as available to other programs by the use of the pseudo-ops INTERN or ENTRY (see paragraphs 2.5.14.1 and 2.5.14.3) or by the use of the delimiter =: in their definition statement. For example, the symbol FLAG may be declared a global symbols by: a. b. c. INTERN FLAG (the symbol FLAG is declared internal), ENTRY FLAG (identifies the entry point of a library subroutine) , FLAG=: 2¢¢ (FLAG is given the value 200 and is declared internal). NOTE The statement in item ¢ of the foregoing examples (i.e., FLAG=: 2@@) is equivalent to the series INTERN FLAG= FLAG 208 Global symbols located in a program in which they are references to symbols defined in other programs must be declared as external symbols by the use of the EXTERN pseudo-op (see paragraph 2.5.14.1) or a ## suffix. For example, the statement VERSTON 47 EXTERN FLAG .. June 1972 -217declares the symbol MOVE also is EXTERN a Manual). reference. an external a. such may out a by want DDT case, to define (refer the b. C. This is available Available were to then a the programmer for value in 200 statement symbol in MACRO DDT Programmer's should define that but not have Reference symbol with type-in with for the Unavailable for type-out equivalent and will be MACRO. loaded FLAG= and this 2¢p ) assigned the . Fully reference; Symbols FLAG== be statement series: a double equal Sign: FLAG will The FLAG typed In exterfial FLAG as the programmer symbol an @ ,FLAG Deleted Sometimes that symbol equivalent of MOVE 1.7.3 as @ ,FLAG## declares the the FLAG MACRO program by DDT - (assuming containing that symbols FLAG). DDT. to defining FLAG by: 204) typing FLAG$K - (the. symbol $ represents ALT MODE) with declared to DbT . A symbol may manner be defined ‘ == and internal in the following FLAG==:2QE). VERs1ON 47 June 1972 -218- MACRO is equivalent to INTERN FLAG) FLAG==20¢J The programmer may also want to define a label in MACRO but have the outThe following constructions may be put of the label suppressed in DDT. used: LABEL:! LABEL: :! 1.8 LABEL is a suppressed local symbol. LABEL is a suppressed internal symbol. NUMBERS Numbers used in source program statements may be signed or unsigned, and are interpreted by the assembler according to the radix specified by the programmer, where 2<radix<10 The programmer may use an assembler pseudo-op, RADIX, to set the radix for the numbers which follow. If the programmer does not use a RADIX statement, the assembler assumes a radix of 8 (octal) except in the case of the POINT pseudo-op (see paragraph 2.5.2). The radix may be changed for a single numeric term, by using the gualifier followed by a letter, D (for decimal), O (for octal), B (for binary), Note that these are not control or F (for fixed-point decimal fractions). characters. Thus, 1219 1848 2314 is stored as is stored as is stored as +D1Q2 +01d +B1lg The qualifier +L is used for bit position determination of a numeric value. +Ln generates an octal value equal to the number of 0 bits to the left of the leftmost 1, if the numeric value n were stored in a computer word. ExXpression Resultant Value 448 +Lg VErRs1ON U4/ 44 zZzexro bits 0000000000. . . .0000000000 JuNe 1972 -219Expression ~ Resultant Value 418 The bits 41 0000000000. . . .0000000101 +L-1 0 1111111111, . . .1111111111 suffixes K, the meaning each of M and G may number of suffix a) K, M, add six zeros ¢) G, add nine add three operators. defined added to which are numbers to as a shorthand method follow the given number. of The ' zeros (e.g., 5K = 5000), (e.g., 5M = 5000000), zeros Arithmetic and and be zeros is: b) Numbers Zzero +L5 specifying 1.8.1 MACRO (e.g., Logical symbols 5G = 5000000000). Operations may be combined using arithmetic and logical The following arithmetic and logical operators may be used. Operator ' |+ Add ¥ Meaning Multiply —_e N\ Subtract The assembler computes the Integer Divide AND Inclusive 36-bit value of a series OR of numbers and ‘defined symbols connected by arithmetic and logical operators, truncating from the left, if nécessary. The following examples show how these arithmetic and logical operators arelwritten in statements. B= AC1+7,RHO/31) MOVE A+3,BETA-5) Combinations operators 1.8.2 65+X11-3) MULI of are numbers called Evaluating and defined symbols operations VERSTON 47 are arithmetic and logical Expressions When combining elements of an expression, unary operations using expressions. (leading + then done or from -), left the assembler first performs then binary to right, 1-15 shifts. The logical followed by multiplications JUNE 1972 MACRO ~220- and divisions, tional part. to right. For from left to right. Finally, example, first operand field, and subtractions in the statement: TRO 3,1+A&C) operand field is evaluated first; indicates the the Division always and truncates the frac- are performed, left All arithmetic operations are performed modulo 235. TAG: the additions that this logical AND is sum is placed in is the an accumulator. performed first, In the the memory address comma terminating the result this second operand is added to one, field of the machine instruc- tion. To change delimit must the normal expressions order and of operations, indicate the angle order of brackets may computation. be used to Angle brackets always be used in pairs. Expressions may be nested to a pair of angle brackets. the outermost is any The level, with each expression enclosed in innermost expression evaluated last. The following are is evaluated legal first, expressions: A+B/5 <<(C=-D+B-29>%<p-U41>>4+] | A=<B=<C=10>> 1.8.3 Numeric Terms A numeric term may be a digit, a string of digits, closed assembler reduces numeric in angle brackets. 36-bit value. or an expression enterms to a single This is useful when specifying operations such as local radix changes and binary For example, The the shifts, which require 4D operator changes the numeric term that follows it. The number single values. local radix to decimal for the 23lo may be represented by +D23 +D<5%¥2+13> +D<TEN#¥*2+THREE> but 23 10 may not be written, +D18B-T7 VERSTON 47 June 1972 -221because and in this radix, The B andis The the +D operator affects example second which shift is the following is the numeric is another are legal: term term which taken under follows the it, prevailing ' preceded by MACRO (77) normally octal. operator followed only term ‘ by (the a numeric bit term position (the number the assumed of to be shifted) point). +F167B17 +B14g¢11B8 566B5 <MARK A bracketed 1.8.4 may letter B, which the n, may left shifted is be preceded by a + or a right by following logically by shifted a numeric left term, or n, representing sign. the the position, starting with zero used, is is (decimal) If left three left n the 31 bit is not number +D1l0 number B35 is binary positions positions, so should be assumed; stored and that as stored as its n 000000 rightmost shifting is a The and taken 000012; 000000 bit it bit placed. stored as 240000 000000. Binary - any Thus, shifted be right-hand bit of right. decimal. term may Shifting followed be to SIGN>B<PT-XXV> numeric Binary A number + with in numeric term, numbering from as modulo 256 but 4D10B32 000120; is the position in bit and 4 is D10B4 and | logical operation, rather than an arithmetic one. " The following are legal binary shifts: 1BJ 400000 000000 1B17 000001 000000 1B35 000000 000001 -1B35 777777 777777 -1B53 000000 777777 -1B792 Note that the Version 47 explanation below) 000000 000001 following '10B32 (see 4010B32 expressions = 10B are <42-10>= equivalent: 10B< 4D <U42-10>>= 10B<4 DL2- 4D10> JUuNe 1972 -222- MACRO The unary operators preceding a value are interpreted first by the asA leading plus sign has no effect, sembler before the binary shift. assembler to shift and then to the causes but a leading minus sign store the 2's complement. in Section 1.3.2. Binary shifting may operate on numeric terms, as defined 1.8.5 Left Arrow Shifting If two expressions are combined with the operator "<«", i.e., <m>+<n>, the 36bit value of expression m is shifted V bits (where V is the value of expression n) in the direction of the arrow (left) if V is positive or against the arrow if V is negative. The effective magnitude of V is that of the address of an LSH instruction. 1.8.6 Floating-Point Decimal Numbers If a string of digits contains a decimal point, it is evaluated as a floating point decimal number, and the digits are taken radix 10. For example, the statement, 17.4 is stored as 205420 000000. Floating-point decimal numbers may also be written, as in FORTRAN, with the number followed by the letter E, followed by a signed exponent repreThe following examples are valid: senting a power of 10. NUM1: NUM2: NUM3: 1.8.7 17.2E-4) 3.85E2) =567.825E33) Fixed-Point Decimal Numbers As shown in Section 1.8, 4D followed by a numeric term, is used to enter decimal integers. Fixed-point decimal numbers (mixed numbers) are preceded by *F followed by a number (not a numeric term, defined below) which normally contains a decimal point. The assembler forms these fixed-point numbers in two 36-bit registers, the integer part in the first and the fractional part in the second. The value is then stored in one storage word in the object program, the integer part to the left of the assumed binary point, the fractional part to the right. VERs1ON 47 1-18 JUuNE 1972 -9293The binary number shift (B) operator is formed +F123.45B8 000000 346314 000173 631462 is in used two (the (the MACRO to position the assumed point. The registers: integer part) fraction part, left-justified) The B operator sets the assumed poiht:after bit 8,:so fhe integer part is placed in bits 0—8,.and'the fraction part in bits 9-35 of the storage word. In this case, the ihteger part is trun¢ated from the left to fit the 9-bit integer field. the assumed The fraction part is moved into the 27-bit field following point 173346 and is truncated on the right. The result is, 314631 + (assumed point) If a B shift assumed to Fixed-point the operator follow does bit numbers 35, are not and the assumed a fixed-point fractional to be part positive 000000 000173 AF123.45 000173 346314 346314 631462 +F123.45B17 4F123.45B-1 777777 777604 777604 431463 -+F123.45B17 is number, the point is lost. unless a minus sign precedes 431463 146316 -4F123.45B-1 fixed-point -4F123.45 numbers, if they were positive numbers, As in qualifier: Negative 1.9 appear such as the example above, complemehted, are assembled as and then logically shifted. ADDRESS ASSIGNMENTS source memory This statements addresses is location done is by to are processed, the instruction incrementing the assigned. A the assembler assigns and'data words location counter of each statement which generates a storage word increments the location'cdunter by one. may generate six The mnemonic instruction storage word. pseudo-ops do storage However, not WOrds,'incréménting.the and monitor direct generate 1The terms monitor command synonymous. VERsION 47 command! assighment storage words, the consecutive object time single location statements program counter by six. generate a single and and affect not object Another statement Statements do program. a memory some assembler the loecation (as used here) and programmed operator are 1-19 . ~ June 1972 -224- MACRO counter. Other pseudo-ops and macros may generate many words in the object program. 1.9.1 Setting and Referencing the Location Counter The MACRO-10 programmer may set the location counter by using the _ pseudo-ops, LOC and RELOC, which are described in Chapter 2. He may reference the location counter directly by using the symbol, point (.). For example, he can transfer to the second previously assigned storage word by writing: .-2) JRST 1.9.2 Indirect Addressing The character @ prefixing an operand causes the assembler to set bit 13 in the instruction word, indicating an indirect address. For an ex- planation of indirect addressing and effective address calculation, see the PDP-10 System Reference Manual. 1.9.3 1Indexing s T1f indexing is used to increment the address field, the addresof the index register used is entered in parentheses, as the last part of the memory reference operand. This is normally a symbolic name defined by a direct assignment statement, or an octal number in the range 1-17, specifying 1 of the 15 index registers. However, the address of the index register may be any legal expression or an expression element. This is a symbolic, indirect, indexed, memory reference: A: ADD U4,@NUM(17)) NOTE The parentheses cause the value of the enclosed expression to be interpreted as a 36-bit word with its two halves interchanged, e.g., (17) is effectively 000017000000_.. The 36-bit value is added to the in- struction ang may modify it. This is often used to generate right half values from left half expressions; for example, the statement TLO AC, (1Bd) which sets the sign bit. VERs1ON 47 1-20 June 1972 ~2251.10 | MACRO LITERALS In a MACRO statement, a symbolic data référence may be replaced by a direct ([1). sembler signs literal more data an address in than of the data direct representation stores address A representation This the to found the machine within is called a brackets first word of in the only consist of more one word data. direct pseudo-ops Literals may bracketed The (such assignments be data) following are is to a than A one literal statement must, (POINT is a literal as RADIX) (i.e., 18 which simple bracketed example LDB 4,BP,) POINT 1@,A+3,14) used generate at Literals which consist do not generate data or data within to other sets of levels. pseudo-op which can be as- that and may generate however, of the user instructions must reference by a byte pointer BP: table, inserts illegal. nested up The as- Literal data and least one word but no more than 18 wofds. of literal. a instruction.. may of enclose in d sgquare brackets sets insert example up a byte the POINT ' of literals. Byte in this manner: pointter word.) A stafement directly. For ! LDB 4,[POINT 10,A+3,14]) Literals are often used as a) PUSH 17,([#) b) MOVE L. constants as, for example: (note that @ generates 6ne word of zero). [3,14] The following is an example of a multi-line literal: GETCHR: SOSG IBUF+2 PUSHJ P,[IN | VERSION 47 3ANY CHARS 3;NO, READ 3sNO UNUSUAL LEFT? SOME IN FOPJ P, STATZ JRST N,T74gg20 sCHECK FOR ERRORS [MOVEI E, [SIXBIT /INPUT ERROR / ] JRST ERRPNT] ;PUBLISH ERROR MESSAG E JRST ' N, ILDB AC,IBUF+1 POPJ P, ENDFIL] 1 CONDITIONS ;END OF FILE HANDLER sPICKUP NEXT CHAR ' ~June 1972 -226- MACRO NOTE The closing right square bracket does literal The excessive use if placed after the of especially literals, not terminate the semicolon. for small subroutines, is not recommended since they use up assembler space at the rate of four locations more per data word difficult and may virtual memory The PDP-6 tain one Two version the of macro Use page faults it (MACRO-6) permitted right bracket pseudo~-ops grams. cause Literals in also make the KI-1l0 debugging processor allocation. statement but Dropping generated. MLON and of these is MLOFF not only the right permitted provide pseudo-ops permitted is literals bracket to be to dropped. by MACRO-10. compatibility with old required con- pro- since MOVE AC,[SIXBIT/TEXT/) is the legal in MACRO-6, literal has even though been omitted. such an unterminated the In literal. closing right normal mode, bracket (]) MACRO does not of allow The pseudo=-op MLON is set at the start of consider all code until such time Thus, carriage-return, rather each assembly following a as the to cause the assembler left bracket as part of assembler processes a matching line-feed does not end the programmer must insert a a a right bracket. literal, right bracket. to literal, but The pseudo-op, MLOFF set by the switch /0, which The places MACRO into the compatibility mode in literals may occupy only a single line. symbol literals. . (current location) is not changed by the use of It retains the value it had before the literal was entered. VERs1ON 47 June 1972 =227~ MACRO Chapter 2 MACRO-10 Assembler Statements—Pseudo-Ops Assembler certain statements assembler or pseudo-ops processing direct operations, the assembler such as to perform converting data to binary under a selected radix, or listing selected parts of the assem-~ bled object program. operations are In this chapter, these assembler processing fully described. NOTE The pseudo-op for constructing name must a follow the symbol (refer rules to Para1.5.1) and must be terminated by a character other than those listed in Para- graph graph 1.5.1 as valid symbolic characters. (Normally, a space or tab is used as a terminator.) 2.1 ADDRESS MODE: MACRO-10 so a that normally the function assembles program of what RELOCATABLE can has be been OR ABSOLUTE programs located with relocatable anywhere previously binary in memory loaded. When for addresses, execution desired, the as assem- bler will also assign absolute location addreéses, either for the entire program or for RELOC and VERSION 47 selected parts. Two pseudo-ops control the address mode: LOC, ' June 1972 ~228- MACRO RELOC N& This statement sets the location counter to n, which may be a number or an expression, and causes the assembler to assign relocatable adSince most redresses to the instructions and data which follow. locatable programs start with the location counter set to 0; the implicit statement, RELOC @0 begins all programs, and need not be written by the programmer who wants his program assembled with relocatable addresses, LOC NJ This statement sets the location counter to n, a number or an expres- sion, and causes the assembler to assign absolute addresses, begin ing If the entire prowith n, to the instructions and data which follow. must precede statement LOC a locations, gram is to be assigned absolute all instructions and data. If n is not specified (LOCJ) zero is assumed initially. If only a part of the program is to be assembled in absolute locations, the LOC statement is inserted at the point where the assembler begins assigning absolute locations. For example, the statement, LOC 2¢¢.0 causes the assembler to begin assigning absolute addresses, and the next machine instruction or data word is stored at location 2008. VErs1on 47 | June 1972 MACRO -229- To change the statement tinue is address mode required. assigning back If the relocatable to relocatable, an programmer wants addresses explicit the sequentially, RELOC assembler to con- he writes, RELOC J To switch back to the next sequential absolute assignment, he writes, LOC J Thus, the programmer value in either is not a LOC or required RELOC to insert statement, a location and unless he counter does, both the relocatable coding and the absolute coding will be assigned sequential addresses. The This single quote mark identify relocatable is shown geeaThH" gel1eep | ga1@34 2F1@34 the whether each location skeleton coding. listings, to ADD 1,X ;RELOC ¢ IS IMPLICIT. LOC 190p SUB 5,TOT ;CHANGES TO ABSOLUTE, STARTING sWITH gg100g. E RELOC 3 SETS LOCATION COUNTER TO T4. ADD 2,XAT LOC geagTL! 2eaaT5! in following Pfogram gegEge: operating the and in MACRO-10 addresses. Location Counter When in is used here, 3 SWITCHES LOCATION COUNTER EXP A-X+7 3BACK TO ABSOLUTE SEQUENCE. relocatable mode, in the the assembler object program is determines relocatable or absolute, using an algorithm described in Chapter 5, 2.1l.1 Relocation Part of This feature a Before program can or iterative to execution. is Execution be‘moved into often used loop, into to - PHASE other relocate fast memory a and DEPHASE Statements locations for frequently used (accumulators 0—178) execution. subroutine, just prior ) VERsION U7 | June 1972 ~230- MACRO To use this feature, the subroutine is assembled at sequential re- locatable or absolute addresses along with the resfi of the program, but the first statement before operator, PHASE, the block into which the subroutine is All address subroutine contains followed by the address of assignments in the the assembler the first location of the to be moved prior to execution. subroutine are in relation to the argument of the PHASE statement. The subroutine is terminated by a DEPHASE statement, no operands, location which requires and which restores the counter. In the following example, which is the central loop in a matrix inversion, a block transfer instruction moves the subroutine LOOP into accumulators 11-16, MOVE [XWD LOOPX,LOOP] BLT LOOP+4 | Relocatable Address LOOPX: JRST LOOP PHASE 11 L.OOP: MOVN A FMP (X) MPYR Absolute FADM A Address SOJGE X, .-3 JRST MAIN (Y) DEPHASE The label LOOP represents accumulator 11, and the point in the SOJGE instruction represents accumulator 14. 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 cannot, in general, be executed until it has been moved to the address for which it was assembled. 2.2 NAMING PROGRAMS Normally the first statement in a program gives the name of the program using the TITLE pseudo-op. This pseudo-op has the form TITLE NAME J) in which the single operand (i.e., NAME) may contain up to 60 characters. VERs10ON 47 JuNe 1972 _93]- | ~ MACRO 'The name given will be printed at the top of each page of the program listing; The first 6 characters of the given title will appear in the assembled program as the program name. assembler inserts the name .MAIN. If no title is given, the The program name given in the TITLE statement is used when debugging with DDT in order to gain access to the program's symbol table. Only one TITLE pseudo-op is~permittéd in a program; it can appear anywhere in the program but is normally the first line on the first page. Remember that a name may be longer than 6 characters, however, only the first 6 symbol combinations (within the radix-50 set) will be used for the program name, 2.2.1 Program Subtitles After the first page of a program listing, the first data line en- countered on a pade may be a subtitle, the pseudo-op SUBTTL. Subtitles are génerated using This pseudo-op has the form SUBTTL SUBTITLE) in which the single operand (SUBTITLE)-may-contain up to 40 characters, A subtitle is printed as the first data line.on a page and all succeeding pages until the end of the listing or until the subtitle is changed. If the current subtitle is changed by another SUBTTL state- ment which is the firsf data line on a page, the new subtitle appears on the new page and all subsequent pages., If the SUBTTL statement is not the first statement on a page, the new subtitle appears on the next page and all subsequent pages. subtitles can be changed as often as required; they do not generate data and they do not affect the binary procedure only the listing. They are used for informational purposes only. 2.3 PROGRAM ORIGIN Initially all programs start with an implicit RELOC § which sets the mode to be relocatable and the first address to be @. wise changed, VERSION 47 Unless other- the code generated will be a single-segment program. JUNE 1972 -232- MACRO The programmer using a LOC or High~-segment one change statement to diagnostics) spaces; can the generate to generate (or at @§ programs) and 2,3.1 High or HISEG two-segment Statements This pseudo-op does (two-segment) Segment, op at the have two the Pseudo-Op logical other for address starting at that directs (Refer Statement assembly operations the high segment capability. appear HISEG affect the paragraph 6.2.1.,1, should (normally used Two pseudo-oés, HISEG and TWOSEG con- The cept to generate information current program into the program by program operation. - not code of code. increasing, 400000 (128K) and increasing. trol nature absolute high-segment two-segment starting relocatable if the Loader for additional of the to 3 Load reentrant Into The information.) source any way ex- load the the program has to Block Type beginning in High This pseudo- program. NOTE Whenever possible the pseudo-op TWOSEG should be used instead of HISEG. This pseudo-op provides functions which are superior to those of HISEG, HISEG may be followed by an optional argument which represents the program high-segment origin address. must This argument, when used, be equal to or greater than 4Q@@@F and must be a K-bound of 2000) value. (even multiple The code produced by HISEG will execute at either relocatable @ or relocatable 4p@@@F depending on the loading instructions given. HISEG must not be used if the programmer wishes to reference data in the low segment since locations in the low segment are referenced by absolute addresses only. 2.3.2 TWOSEG Statements The TWOSEG pseudo-op generates code that directs MACRO and LOADER to assemble and load a two-segment program in one file. outputs a block type 3 (refer to Paragraph LOADER to expect two segments. VERSION U7 This pseudo-op 6.2.1.1) which signals the An optional argument may be present JuNe 1972 MACRO -933which is the first address in the high segment. present, 400000 is If no argument is assumed. The high segment code must be preceded by RELOC Mflfiéfifl or greater; the low segment code by RELOC @ or an argument‘indicating the low segment., switches the Each RELOC pseudo-op relocation. The listing prdducéd by the TWOSEG'pseudo-op shows high segment addresses as greater than 400000 or the argument of the pseudo-op, and low segment addresses as less than 400000 or the argument of the pseudo-cp. All relocatable 2.4 ENTERING DATA 2.4.1 RADIX addresses are flagged with a single quote. Statements When the assembler encounters a numerical value in a statement, it converts the number to a binary representation reflecting the radix indicated by the programmer. The statement, RADIX NJ) where n is a decimal number, numerical values that follow, 2 < n < unless the prevailing radix or a local radix For example; 10, sets the radix to n for all another RADIX statement changes change occurs (see below). if the programmer wants the assembler to interpret his numbers as decimal quantities; then the prevailing radix must be set to decimal before he uses decimal numbers, RADIX 18J The statement, VERSION 47 RADIX 2, sets the prevailing radix to binary. - June 1972 -234- MACRO The implicit statement, RADIX 8, begins every program; if the pto— grammer 2.4.2 wants to Entering Data is by a carriage enter Data octal Under entered under the numbers, the this Prevailing prevailing statement is ndt necessary. Radix radix by typing the data, followed return: 765432234567 ) Data may be labeled also contain expressions: U456+A+BA C+D>) LAB: Data may and be entered by first using a direct assignment statement to place a symbol with an assigned value in the symbol table, then using the symbol gram. For example, to insert the the direct assigned value assignment and in the object pro- statements, A=D 2 B=5J cause the two entries sum of address The radix a the assigned A+BJ can also be single value, restored, 2.4.3 the symbol values table. in The following statement enters the object program at symbolic REX. REX: or in DEC To change changed after which as described and OCT REX contains 000000 000007 locally, that is, for the prevailing radix in Section a is single statement automatically 1.3, Statements to a local radix for a single statement, the programmer writes: DEC N,N,N,...NJ where all of the numbers and expressions are to be interpreted as decimal numbers. VERs1ON 47 The numbers or expressions following the operator June 1972 ~235are separated by commas, and each will MACRO generate a word of storage. OCT N,N,N,...N« changes the local radix to octal for this statement only, and generates a word of memory for each humber or expression. The statement, DEC 1#,4.5,3.1416,6.93E-26,3 five decimal words generates 2.4.4 To If data. Changing the Local Radix for a Single Numeric Term change term of J is an the radix for prefixed with expression is a 4D, used, single *0, number or expression, 4B, or 4F, as explained it must be enclosed in the in angle numeric Chapter 1. brackets, +D<A+B-C/222> ) These The prefixes may generate TOTAL2:MOVE causes When the the contents assembler representation radix. cated For or part of an instruction word. in of 4D1@,ABZ ABZ to be moved encounters a 36-bit J) to accumulator a numeric term, register under it the fit example, in MOVE register, required the accumulator 8. assembler the 128. forms the binary prevailing or If the quantity is a part of an instruction, to range 0-17 the a word, statement, local it is trun- field. field must have a final value in the Ih the statement, 4D6g,ABZ first forming interprets the integer the accumulator 000000000074: address but takes in a only 36-bit the rightmost four bits and places them in the accumulator field of the instruction, which results in the selection of accumulator 148. VErRsioN U7 JUNE 1972 2-9 MACRO -236- 2.4.5 RADIX Another in symbolic PDP-10 0-3. This EXP Several is SQUOZE This Loader, expressions mnemonic statement programming. assembler, 2.4.6 Statement radix changing systems bits 50 DDT, into 32 be used available, RADIXS50 and bits explained may is is other and place it is used primarily n,sym) which is used by systems add in Appendix in of but a F programs 4-bit of code this to field manual. the pack n in (The RADIX50.) Statement numbers and EXP X,4, expressions may be entered by using the EXP state- ment: which generates generated one word 7 A word generates can a be entered expression; five words were ‘ forms and other by using the operator, 2. 2 ) full word assembler field each Statement LABEL: the for ) for the above example. 2.4.7 zero +D65,HALF,B+362-4 of a all zeros primary unknown at LABEL. machine fields If operands instruction, zeroed. In the with follow the the 2, operator statement, Z 3, 2 the assembler generates 2.5 To an accumulator machine instruction: DATA WORD BYTE BYTE in but 000140 no address field, and 000000. FORMATTING it is useful Bytes of any length, to store data in from 1 to 36 bits, less than full 36-bit may be entered by using statement. BYTE The field, Statement conserve memory, words. a this INPUT 2.5.1 finds (N) first operand the range X,X,X J (n) 1-36, is the byte size and must be enclosed following are separated by commas, an operand from the is left an expression, to the in bits. is in parentheses. a decimal number The operands and are the data to be stored. it is evaluated anhd, specified byte It size. VERSION 47 Bytes if necessary, truncated are packed 2-10 If into words, June 1972 starting at bit 0, tions. If, and the words are assigned sequential storage loca- during the packing of a word, into the remaining bits, the unused bits a byte is In the following statement, This too large to fit are zeroed and the byte is stored left-justified in the next sequential LABEL: MACRO | -257- location. three 12-bit bytes are entered: BYTE (12)5,177,N J assembles at LABEL as, 0005 0177 0316, where N=31l6. The byte size may be altered by inserting a new byte size in parentheses immediately following any operand. as delimiters, inserted. The following BYTE Notice that the parentheses serve so commas must not be written when a new byte size is are legal: (6)5(14)NT(3)6,2,5 ) where 6 is entered in a 6-bit byte, NT in the following l4-bit byte, 6 in the following 3-bit byte, followed by 2 and 6 in 3-bit bytes. BYTE statement can be used to reserve null fields of any byte size. A If two consecutive delimiters are found, a null field is generated. BYTE (18),5 J When the assembler finds two delimiters, it assembles a null byte. this caSe, 000000 000005. In To enter ASCII characters in a byte, the characters are enclosed in quotation marks. BYTE (7)"A" ) Text handling pseudo-ops are discussed in paragraph 2.5.5. 2.5.2 POINT Statement —'Handling Bytes Five machine instructions are available for byte manipulation. These instructions reference a byte pointer word, which is generated by the assembler from a POINT statement of the form, LABEL:POINT s, address, b J (s and b are decimal) where the first operand s is a decimal number indicating the byte size, the second operand is the address of the memory location which contains the byte, and the third operand, b, is the bit position in the word of the right-hand bit of the byte (if b is not specified, the bit position is the nonexistent bit to the VErRs10N 47 2-11 JuNe 1972 MACRO left be -238- of bit 0). indirect and MACRO-10 In the assumes into with three to an like is specified in the size is 1If the byte an LDB (load-a and an ILDB statements. The example, AB, then the same. does a load ILDB are instruction byte; the effect AA BYTE (615 POINT 6,AA55 NACAB2* 440620 QBOORO' AC: POINT 65AA NovvV3r' 135140 Q0VPOO1*' START: LDB 35AB AAQ0D 4 134140 @OA0O2" ILDB 35AC enters AA which the is quantity 0. The 5 goes In to case, in located the byte is in looks other byte pointer bit position The increment 5. like word The increment string byte finds size, that a byte AA, and The byte is then specified byte of by (the load instructions an third at is for address, byte the size into and bit 6 bits, bit of is right-hand loaded instructions The deposit accumulator pointer (IBP) byte two accumulator 3, 000005. ways. the pointer bytes, and from 6-bit statement its the word 000000 a the When the LDB is executed, the similar wbrd) by the byte size. a it this: in indicator ing the manipulation mnemonic takes the for this is it AB in second along "increments" of AB: statement loca- used, V00000 byte (IDPB) memory QOQ00D' the position a B52000 position. struction from 3609690 the machine byte byte PABNB1' address may specified, instructions reference by the load byte instruction. The not operand DOPVRD first where second bits. assembler look symbolic address accumulator) instructions The 36 following tion AC The indexed. and word, in instruction operand in the reference byte (DPB) deposits the in- it, in a memory word. increments the referenced POINT bit This is useful when loading or depositusing the byte (ILDB) increment same the and byte byte pointer increment pointer word. and word deposit by the byte byte size before loading or depositing. VERSION 47 2-12 JUNE 1972 -2392.5.3 The IOWD Statement: assembler MACRO Formatting I/0 Transfer Words generates I/0 transfer words in a special format for use in BLKI and_BLKO and all four pushdow n instructions. The general statement IOWD where two N,MJ operands, the IOWD operator. The left half of the value first of is, which This of the sécond be numbers statement assembled operand n, the may and operand m, expressions, one contains the word the or generates right minus half-word one. For data 2's follow word. complement contains the example, IOWD 6,4D256 < assembles 2.5.4 The It XWD XWD is as 777772 Statement: statement written in WD where left word. bits the half-word, are enters the are placed is second the in half-words. the 36-bit in a Data single storage word. START,END) used Block the left to set specifies registers The and specifying the the the high-order up pointer words transfer pointer words half is be moved, and the right A,,B expression Three examples follow: SUM+2,DES+5) are or operand in XWD statements symbol formed A,BJ destination. XWD a XWD addresses: half-words and XWD instructions. to two of form, operand operand are ignored. XWD Entering Two Half-Words LHW,RHW < first Both 000377. may also the starting half is the be used to 18 for bits two of 18- of each the 18-bit the location of duplicate half- order block transfer contain location first right low block the results of A,B. VErsion 47 | JUNE 1972 -2h0- MACRO 2.5.5 Text Input The assembler translates text written in full 7-bit ASCII or 6-bit compressed ASCII. It will also format 7-bit ASCII with a null character at the end of text, if desired. These codes are listed in Appendix E. are In all three text modes, the printing symbols in the code set translated to their binary representation. To translate and store a single word containing as many as five are 7-bit ASCII characters, right-justified, the input characters enclosed in guotation marks. "AXETM) is stored as 0 0000000 0000000 1000001 1011000 1000101 0 null E X A null Notice that characters are right-justified, and bit 0, which is not used, is set to zero. Up to six 6-bit ASCII characters may be translated and stored, right-justified, in a single word by enclosing the input charac ters in single quotation marks. '7TABLES' is stored as 110100 100001 100010 101100 100101 110011 T A B E L S NOTE The quotation marks (single or double) may To only be used to assemble a single word. input strings of text characters, the fol- lowing three pseudo-ops must be used. ' of 2.5.5.1 ASCII, ASCIZ, and SIXBIT Statement - To enter strings used. are text characters, the operators ASCII, SIXBIT, and ASCIZ The delimiter for the string of text characters is the first nonor blank character following the character that terminates the operat (refer to the note on page 2.1). The binary codes are left-justified. Unusea character positions are set to zero (null). Text is termi~nated by repeating the initial delimiter. If the initial delimiter is a symbol constituent, the pseudo-op must be followed by a space or a tab. JunNe 1972 VErRs1oON 47 914 -24]1The MACRO statement ASCII "AXE" where the quotation marks 1000001 1011000 1000101 0000000 A 0000000 X O E null null O The operator the end of five, ASCIZ text. another (ASCII If all are the Zero) delimiters, guarantees a assembles null the number of characters zero word is added. For is as character at a multiple of example, ASCIZ/"AXE"/) assembles followed as, 0100010 1000001 1011000 1" 1000101 A 0100010 X E n 0000000 0000000 by another 0000000 word of 0000000 When thefull 6-bit 7-bit subset may ters are the SIXBIT SIXBIT ASCII be zeros. 0000000 null code entered, left-justified statement is in set is using the sequential the same as Convert lower case ASCII characters. The not required, O the 64-character SIXBIT operator. storage words. for ASCII Six charac- Format statements. of To derive code: a. 2.5.6 O b. Add ¢. Truncate 408 Reserving programmer locations VERSION 47 to the value result of to the the to upper case character. rightmost six bits. Storage can for use the characters reserve during single execution locations, of his | or blocks of many program. JUne 1972 -242- MACRO 2.5.6.1 Reserving a Single Location - The number sign fixing a symbol in an operand field, location. The symbol is defined, (#), suf- is used to reserve a single entered in the assembler's symbol table,and can be referenced elsewhere in the program withcut the number sign. i \AB: ADD For example, 3,TEMP# ) reserves a location called TEMP at the end of the program, may be used to store a value entered at some other point program. This feature is useful for storing scalars, which in the and other quantities which may change during execution. The pseudo-op INTEGER may be used to reserve storage locations at the end of the program on a one-per-given name basis. example For statement the INTEGER TEMP,FOO,BAR) will reserve 3 locations identified as TEMP, assignment of the FOO and BAR. The locations to the names given is performed on an alphabetical basis by the assembler rather than on the order in which the names are given. For example, the order of the loca- tions reserved by the foregoing INTEGER statement would be BAR, FOO then TEMP. Multiple word locations may be reserved by the ARRAY pseudo-op. For example, the statement ARRAY FOO[2*3]) reserves a 2-word by 3-word array in memory which is identified by the name FOO, NOTE If the pseudo-op TWOSEG reserved signed by to pseudo-op the low an the is array low is segment required used, statement only; after a the must variables be thus, RELOC asa VAR back to segment. June 1972 o VErRSION 47 -16 -20432.5.7 VAR | MACRO Statements VAR ) This statement causes symbols which have been defined with the # sign (array and'integer pseudo-ops) ments to be assembled subsequent symbol If and the LIT literals 2.5.8 as statements. This definitions of the same statements do not appear VAR and variables BLOCK block are stored at the by suffixing in previous statehas no effect in the end of program, the all program. Statements To reserve a block of locations, the BLOCK.operator is used. is followed pression be in by a single the current reserved. the value The of the operand, radix, assembler operand. BLOCK block of N*M dimensions are M BLOCK is reserve data words whose a used to should be which may indicating increments For MATRIX: reserves on type. be a number the the number location or of It an ex- words counter to by example, N¥M ) words and starting at MATRIX for an array N. words stored in in a the specific low order; segment in remember that two-segment pro- grams. 2.5.9 The END END Statements statement must single operand of first the given only the main in may be the last follow the END instruction to be the pass 1 operator executed. to in every specify Normally the main program; Since‘subprograms program, they need specify END START) When statement assembler and -VERSIbN 47 . begins start is first pass not 2. the encounters The END a label an also END starting at the A address this operand is are called from address. starting address statement, terminates program. the it pass terminates 2, after which JUNE 1972 -244- MACRO the assembler automatically assembles all previously defined vari- ables and literals starting at the current location.! The following processing operations can be performed at any point in the 2.5.10 program. LIT Statements J LIT This statement causes literals that have been previously defined to If n literals have be assembled, starting at the current location. been defined, the next free storage location will be at location counter plus n. Literals defined after this statement are not af- | ' fected. If a LIT statement does not appear before the END statement, the If the output literals are XLISTed (refer to paragraph 2.6.3 ). of literals is desired, the LIT pseudo-op should appear immediately before the END statement. NOTE In a in the also two-segment high be literals 2.5.11 program segment. given in the will go to LIT The high the must END segment low be given statement or must the segment. Multi-Program Assembly The pseudo-op PRGEND is used to compress many small files into one This pseudo-op has the large file to save space and disk lookups. form PRGEND) . PRGEND allows multiprogram assemblies, and is used for assembling library files short. (LIB40) in which all programs are very PRGEND takes the place of all but the last END statement. The output is a binary file which can be loaded in search mode. The use of PRGEND costs assembler space since the symbol tables, iiteral tables and titles of each of the small files (i.e., programs) involved Also, since PRGEND is functionmust be saved at the end of pass 1. ally an END statement, macros cannot be used over it (i.e., macros cannot generate PRGEND as part of their expansions). l7he END statement is also used to specify a transfer word in some (See Section 6.2.2.4.) output file formats. VErRsION 47 June 1972 2-18 ~245If the LIT literals 2.5.12 and VAR.statements and variables PASS2 are do not MACRO appear in the programs, stored at the end of the assembler to pass pProcessing all Program. Statements PASS2 ) This statement switches remaining coding; processed by pass 1 only. such as testing macros 2.5.13 PURGE The PURGE form is: PURGE each call which statement age and is to is used the to is be a delete (refer deletes PURGE the to used the symbols uses also from the for DDT. same 2.8.2) or the PURGE first SOLV The XPUNGE has the the for debugging, portion. of symbol the operator, Its general for a symbol both label, For of or macro tables. programs A repeat label. symbols. L) label, and for OPDEF. purges defined Purged purges the macro call; | XPUNGE for to The conserve table space PURGE storis a macro call a statement the PURGE symbol example, the in and/or the following SOLV,SOLV W label. 2.5.14 1 assembler's end statement purges both: The primarily pass symbol at the call delete user-created used Section macro statement to deleted normally programmer OPDEF is in symbol, reused by the assembler. If This defined symbol, operand is 2 Statements statement where the Coding preceding this stat ement will have been the second SOLV purges the pass it Statements pseudo-op form: deletes all local symbols during 2; XPUNGE) VERSION 47 June 1972 246~ MACRO 1The use of this pseudo-op reduces the size of the REL file an speeds up loading (especially of DDT). XPUNGE should be placed just prior to the END statement. 2.5.15 Linking Subroutines Programs usually consist of subroutines which contain references to symbols in external programs. Since these subroutines may be_: assembled separately, the loader must be able to identify "global" symbols. For a given subroutine, a global symbol is either a symbol defined internally and available for referehce by other subroutines, or a symbol used internally but defined in another subroutine. Symbols defined within a subroutine, but available to others, are considered internal. symbols which are externally defined are considered external. These linkages between internal and external symbols are set up , or declaring global symbols using the operators EXTERN, INTERN ENTRY. by The double colon (::) may also be used. 2.5.15.1 EXTERN Statements - The EXTERN statement identifies symbols which are defined elsewhere. The statement, EXTERN SQRT, CUBE,TYPE) declares three symbols to be external. vExternal symbolsrmust not be defined within the current subroutine. These external references may be used only as an address or in an\éxpression»that is to bé used‘as an address. For example, the square root routine declared above might be called by the statement, P,SQRT J PUSHJ External symbols may be used in the same manner as any other locatable symbol. Examples: EXTERN A GPDEF WwixWD B+3sA=-5) oUA3NGM NONAN3* MOVE WAGRE3* NANRYB* XWD A NR ks = i 77 TT4% TT7TTTT3% U VERSsION 47 re- 6sA+3 A+35A A= JunNe 1972 -247The external restrictions a. symbols are flagged with asterisks. for use of the external b. The is use g of c. Globals ing are alternative pound more than one not permitted. external) An There are three symbols: Externals may not be used in LOC and RELOC state- ments. double MACRO is external A+B only illegal be additive; -A -EXP-A 2¥A 2% A-A (##) eliminates specifying in (where an expression A and B illegal. may method sign Thus, _ for generating following the EXTERN the are both therefo the followre, external symbols is to symbol name. This statement. For example, use a method MOV @,JOBREL## is equivalent to EXTERN JOBREL MOVE #,JOBREL 2.5.15.2 INTERN Statements - To make internal program symbols avail- able to other programs or ENTRY are used. assembly of as external symbols, the program, but will make a available to other programs at load time. INTERN makes symbol by the direct is by other ment, symbol equivalences The statement, MATRIX defined available within the to other program as a programs. label, An internal variable, or assignment. 2.5.15.3 it be list of MATRIX ) subroutine must the operators INTERN These statements have no effeét on the actual ENTRY Statements convenient to programs, place these - Some them in library subroutines have a 1In order library. subroutines must common usage, to contain be the and called state- o ENTRY NAME VERSION 47 J S | JUNE 1972 -243- MACRO where "name" is the symbolic name of the entry point of the library subroutine. ENTRY is equivalent to INTERN with the following additional feature. All names in a list following ENTRY are defined as internal symbols and are placed in a list at the beginning of the library of subrou1If the loader is in library search mode, a subroutine will tines. be loaded if the program to be executed contains an undefined global symbol which matches a name on the library ENTRY list. If the MATRIX subroutine mentioned before is a library subroutine, it must contain the statement, ENTRY MATRIX J) Since library subroutines are external to programs using them, the calling program must list them in EXTERN statements. 2.6 SUPPRESSION OF SYMBOLS When a parameter file is used in assemblies, many symbols get Unused defined symbols take up space defined but are never used. in the binary file and complicate listings of the file. Unused and unwanted symbols may be removed from symbol tables by the use These pseudo-ops of a pseudo-op, either SUPPRESS or ASUPRESS. if control a suppress bit in each location of the symbol table; a suppress bit is on, the symbol in that location is not output. The suppréss bit is used in the file S.MAC so that if a bit is on and the symbol in that location is not used later, the symbol is not output in the CREF table. 2.6.1 SUPPRESS SYMBOL Statement The SUPPRESS statement turns on the suppress bit for the specified symbols, 2.6.2 ASUPPRESS Statement The ASUPPRESS statement turns on the suppress bit for all the symbols in the symbol table. VERSION 47 June 1972 _oug2.6.3 - Listing Control MACRO Statements Program listings are normally printed on a line printer or a terminal depending printed A on as sample the the listing source listing is file program shown device specified. statements in Chapter are Listings processed are durlng pass 2. 7. From left to right the standard columns of a-listing contain a) the b) the instruction c) the symbollc location counter, or data in 1nstructlon or addresses are octal data form, and followed by comments, Relocatable mark (') Data is object-code which may displayed ment format. occur in one in either suffixed the of several left modes or by a single right half. depending on quotation the state- The possible statement formats are: 1) Halfword 2) Instruction - two 18-bit bytes = ' a 9-bit op-code, accumulator 4-bit code, indirect bit, and an 18blt l-bit 4-bit index, address seg- ment 3) Input/Output , - ' ‘ 3-bit I/0 I/0 indicator, device 3-bit operand, address an 4) Byte pointer : ~ 7-bit specification, bit, l-bit indirect 4-bit 18-bit address index and segment 6-bit byte position, 6-bit size, 1 unused bit, l-bit indirect address bit, 4-bit index and an 18-bit byte address segment 5) ASCII . . - 5 seven-bit bytes ‘6) SIXBIT S - _ 6 six-bit bytes. NOTE Refer to the DECsystem-lo System Reference Manual for a complete description of word formats. The Iisting function is suppressed within macro expansion, therefore only the macro VERSION 47 ¢all and any succeeding lines that generate code are June 1972 ~250- MACRO listed. Line printer listings always begin at the top of a page and up to 55 lines are printed on each page. Consecutive page numbers are printed in the upper right-hand corner of each page. Each page also contains a title and a subtitle. The standard listing operations can be augmented and modified by using the following listing control statements. DESCRIPTION STATEMENT PAGE This statement causes the assembler to skip (A form feed to the top of the next page. character in the input text has the same effect and is preferred. XLIST J This statement causes the assembler to stop listing the assembled program. The listing printout actually starts at the beginning of pass 2 operations. Therefore, to suppress all program listing, XLIST must be the first If only a part of statement in the program. the program listing is to be suppressed, XLIST is inserted at any point to stop listLiterals are XLISTed ing from that point. if no LIT statement is seen before the END statement. LIST & Normally used following an XLIST statement to resume listing at a particular point in The LIST function is implicitly the program. contained in the END statement. LALL J This statement causes the assembler to list everything that is processed including all text, macro expansions and list control codes suppressed in the standard listing. XALL 2 Normally used following a LALL statement to J SALL This causes suppression of all macro and repeat expansions and their text; only the in- resume standard listing. put file and the binary generated will be SALL can be nullified by either XALL listed. or LALL and the /M switch can be used instead of NOSYM J SALL. The assembler normally prints out the symbol table at the end of the program, but the NOSYM statement suppresses the symbol table printout. VErRSION 47 June 1972 -251STATEMENT TAPE ) MACRO DESCRIPTION This pseudo=~op causes the assembler to begin assembling the program contained in the next gsource file in the MACRO command string. For example, «R MACRO " ¥DSK:BINAME,LPT:«TTY:,DSK:MORE PARAM=6 ‘ TAPE sTHIS COMMENT WILL BE IGNORED +Z would set the symbol PARAM equal to 6 and then assemble the remainder of the program from the source file DSK:MORE. Since MACRO is a 2-pass the TTY: file would probably be re- assembler, peated for pass 2. OF PASS 1 END PARAM=6 - TAPE +Z Note that all is ignored. text after the TAPE pseudo-op PRINTX MESSAGE‘)This statement, when encountered, causes the single operand following the PRINTX operator to be typed out on the TTY. This statement is frequently used to print out conditional information. PRINTX statements are also used in very long assemblies to report the progress of the assembler through pass 1. REMARK COMMENTS)On pass 1 the message is printed on both the list device and TTY. on the TTY, but only device. On pass if it is 2 it is printed not the list : The REMARK operator is used for statements which contain only comments. Such statements may also be started with a semi-colon. COMMENTW This pseudo-op treats the text first non-blank character between the (delimiter) and the next occurrence of the same character as a comment. If the first occurrence of the delimiter is a right (left) angle bracket, the next occurrence of the delimiter must also be a right (left) angle bracket. The text may include the carriage return, line feed sequence. For example, COMMENT/THIS IS A COMMENT THAT THAN IS MORE ONE LINE LONG / Internally, the pseudo-op functions as ASCII, but no binary is produced. VERSION 47 June 1972 MACRO 2.7 -252- CONDITIONAL ASSEMBLY Parts of basis depending The a program may be general on form IFN, where the first operand, The IF assembled, conditions or not defined by an assembler N, meets angle brackets the operators statement and their Operator is Assemble N, <...> N=0, N, <...> N>0 <...> N=0, N<O N=0, IFL N, <...> IJFLE N, <...> IFN N, <...> IF1l, <...> IF2, <...> the following not a brackets symbol is IFDEF conditional has been assembled SYMBOL, IFNDEF statement. only if the are listed below: angle-bracketed coding or blank or N>0 or N<O N#0 encountered during pass 1 encountered during pass 2 statements, defined. The assembly coding depends enclosed in IF: on whether angle if, <...>» SYMBOL, assembled conditions IFE In optional requirement. IFG or IF an is, within statement N, on <.cuo...-ot-..> coding IFGE assembled, <...> this symbol is defined this symbol is not pseudo-op as defined NOTE SYMBOL well The following Arguments are as can be a user conditional an op-code statements interpreted as the assembler makes a the character IFIDN IFDIF VERSION 47 the logical strings <A-Z> <A-Z> third operate 7-bit ASCII to determine if the condition The coding within or symbol. comparison, character strings. strings, and character-by-character is met. set of angle brackets enclosed by the <A=7>,<...> <A-I>,<...> on character first two (1) (2) are are is sets assembled of angle if brackets: identical different June 1972 MACRO -253- These statements, IFIDN and IFDIF, are usually used in macro expan- sions (see Chapter 3) where one or both arguments are dummy vari' ables. An alternate form is to use delimiters as in ASCII. For example: IFDIF/A=Z/"A=Z" y<===> This allows the use of > inside the character string. If the first non-blank (space or tab) character is a < character, then the < > method is used; otherwise, the character is used as a delimiter. N is followed by a single " The last pair of conditional statements blank or not blank, either is _bracketed character string, which and which is followed by conditional coding in brackets. The codihg enclosed in the second set of angle brackets is as' sembled if, the first operand is blank the first operand is not blank IFB <i0e>,<000e> IFNB <.v:e23<000s.> A blank field is either an empty field or a field containing only the ASCII characters space (408) or tab (118). Again, delimiters can be used as in IFB / / 1 Sevees? ASSEMBLER CONTROI. STATEMENTS 2.8 2.8.1 The weee REPEAT Statements statement REPEAT N, <...>J) causes the assembler to repeat the coding enclosed in angle If more than one instruction or data word is brackets n times. by a carriage return. to be repeated, each is delimited ‘ example, ADDX: VERSION 47 For REPEAT 3, <ADD 6,X(4)d ADDI 4,1> 2-27 | | June 1972 MACRO -254- assembles as, ADDX: ADD 6,(h) ADDI 4,1 ADD €,X(L) ADDT k4,1 ADD 6,X(4) ADDI 4,1 Notice line any that of the the level. REPEAT label of assembled The a coding. following statement is REPEAT statement REPEAT simplified is placed statements example may shows on be how the first nested a to nested interpreted. REPEAT 3,<A ) REPEAT 2,<BJ C> D> assembles as, C | 2.8.2 NOTE D OPDEF Brackets indicate repetition. Statements The programmer can define his own operators‘using an OPDEF statement, which is written OPDEF where is the defined brackets. VErRsION 47 first SYM second second the form: {[STATEMENT ] operand by the The in is defined as operand, which operand is an operator, is evaluated enclosed as a whose in function square statement, and the JuNE 1972 MACRO -255result is stored in a 36-bit word. ' OPDEF CAL1 defines CALl may [@39080 280284] as an operator, now be used as a equivalent with the value statement #3014g @g@1234 which is For example, 030000 CALl operator. CAL1 3,1234 to, @g3g1hg gg1234 7 3,1234(39029) When MACRO-10 encounters a user-defined operator, single object-program storage word in the struction word 000000. (see Chapter 1). fied by accumulator, indirect, it assembles a format of a primary in- The defined 36-bit value is modi- memory address and index fields as specified by the user-defined operator. For example, OPDEF CAL [MOVE 1,@SYM(2)]. CAL 1,BOL(2))) The CAL statement is equivalent to: MOVE 2,@SYM+BOL(4) In this modifiication the accumulator fieids are added, the indirect bits are logically ORed, the memory address fields are added, and the index register addresses are added; >2.8.3 SYN Statements The statement SYN symbol, symbol defines the second ope;and as synonymous with the first operand, which must have been previously defined. symbol or a macro name. Either operand may be a If the first operand is a symbol, the . second is defined as a symbol with the same value. VERSION 47 | ~ If the first is JuNe 1972 -256- MACRO a macro name, cally. 1If tor, the first second becomes is a machine, second will be interpreted name assembler, in the a SYN statement has been label and as an operator, the second with the which operates identi- or user-defined same manner. in a previously operand If defined is opera- the as synonymous label. following are legal SYN statements: SYN K,X JIF K=5, X=5 SYN FAD,ADD) SYN 2.8.4 a macro first operand both The the the END,XEND ) Extended Instruction Statements For programming convenience, some extended operation codes are provided in place those the MACRO-10 Assembler. DECsystem-10 Primarily, instructions instruction mnemonic and accumulator single For example: instruction. where field these the is are used to combination of used to denote re- a JRST 4 is equivalent to replace certain commonly used to a halt instruction. 1In I/0 addition, they are instruction-device used number combinations. The extended instruction instruction statements they may not have The field must operator an statements or I/O exactly instruction accumulator have are field one of or the JRST 12, the statements, device primary except that field. following Equivalent Extended Machine Instructions | Instructions JEN like extended mnemonics: Meaning Jump and enable the PI system (priority HALT JRST 4, Halt JRSTF JRST 2, Jump JOV JFCL 14, JFCL 4, Jump on overflow and clear JCRY1 JFCL 2. Jump JCRY JFCL 5, Jump on CRYZ or CRYl and clear JEOV JECL 1, Jump on RSW DATAI 2 Read the console switches JCRYZ and restore interrupt) flags Jump on CRY@ and clear on CRY1l and clear floating overflow JUNE 1972 2-30 -2572.9 2.9.1 MACRO | MULTI-FILE ASSEMBLY UNIVERSAL Name UNIVERSAL files may be used to generate data, however, they are normally used to'generate symbols, macros and opdef's (user- defined operators). The symbolS'géneratéd.by UNIVERSAL files need not be declared as INTERNAL symbols since all local symbols in files of this type are made available to all programs permitted access to the file. UNIVERSAL files used to generate data can save time by being set up for a one-pass operation since symbol definition needs to be assembled on one pass only. This one-pass operation can be ac- complished in either of two ways: 1) UNIVERSAL NAME PASS 2 END 2) UNIVERSAL NAME IF 2, <END> END The first generates a listing; the second does not. 1f the UNIVERSAL pseudo-op is seen in a program, the NAME is stored in a table and a flag is set. When the END statement is seen, the ‘symbol table is moved to just after the pushdown stacks and buffers; therefore, the pushdown stacks and buffers cannot be increased during assembly. The first assembly should use the maximum of I/0 devices to be used later. The free core pointer is moved to after the top of ‘the moved symbol table, and pointers are stored to enable the table to be scanned. When assembling is done from indirect files, the universal files must be recompiled by the /COMPIL switch. Otherwise if a REL file later than the source exists, the universal file will not be conpiled, and the symbol table will not be available. In addition, if the universal routine is modified, all routines which use it must be recompiled by either using /COMPIL or deleting all REL files. VERSION 47 JUNE 1972 MACRO -258- 2.9.2 The to SEARCH Name SEARCH scan if table. with of statement the Multiple commas; ten MACRO. When the SEARCH found, with the sequence the is is in the order specified. specified since each searched be maximum may pseudo-op is the is seen, table. in the specified be the If symbol an table. expense Universal or by symbol them A maximum requires redefined with names specified MACRO separating name specified the for current the are names symbol com- cannot be all tables files may names is cleared on responds with the an symbol procedure search list is have table, a table the symbol is to been it time but searching not searched. When moved future files is not into the in the a symbol current references as The symbol found until is on is of universal continue assembled. START, a search universal been each RUN or found, to search saves other have are whenever This core. search names table. This in name sequence specified auxiliary names VERSION 47 This of the UNIVERSAL specified order found in FIND built. in the found symbol the If current symbol be found the message output. tables may UNIVERSAL CANNOT is table tables This in symbol not core. .UNIV specified is may words of are the symbol tables four pared symbol they symbol opens required at long as all table of universal cleared when MACRO asterisk. JUNE 1972 -259- MACRO Chapter 3 Macros When writing a program, certain coding sequences are often used several the ent To if do times entire this, the ~a macro name, with the only sequence coding instruction. along with a arguments sequence A single list changed. of is statement real so, referring arguments, it single defined with dummy is conveni- statement. arguments to generates sequence. 3.1 If can be generated by a as the macro by the correct | DEFINITION OF MACROS The first statement of a macro definition must consist of the opera-~ tor DEFINE followed by the symbolic be constructed by the rules name may be entheses. followed by a name of the macro. for constructing symbols. string of dummy arguments The name must The macro enclosed in any symbols that are convenient--single letters are sufficient. comment may The follow the character delimited by of a group VERSION 47 par- The dummy arguments are separated by commas and may be of sequence, dummy which angle brackets. complete argument constitutes the The the macro body A list. of body of the macro, normally is consists statements. JUNE 1972 -260- MACRO For example, this macro computes the length of a vectors: DEFINE VMAG (A,B) ;ROUTINE FOR THE LENGTH OF A VECTOR FMP @ :GET THE SECOND COMPONENT <MOVE @,A {GET THE FIRST COMPONENT {SQUARE IT MOVE 1,A+1 FMP 1,1 1SQUARE IT FMP 1,1 {SQUARE IT .ADD THE SQUARE OF THE SECOND .GET THE THIRD COMPONENT FAD 1 MOVE 1,A+2 .ADD THE SQUARE OF THE THIRD FAD 1 {USE THE FLOATING SQUARE ROOT ROUTINE JSR FSQRT .STORE THE LENGTH> MOVEM B NOTE Storing comments in a macro takes up space. If the comments start with a double semi- colon (;;) the comment will not be stored; therefore, it lists in the original definition but does not list when the macro is expanded. 3.2 MACRO CALLS A macro may be called by any statement containing the macro name followed by a list of arguments. The arguments are separated by commas and may be enclosed with parentheses. If parentheses are used (indicated by an open parenthesis following the macro name), the argument string is ended by a closed parenthesis. If there are n dummy n, arguments in the macro definition, all arguments beyond the first nt if any, are ignored. If parentheses are omitted, the argume tions defini string ends when all the dummy arguments of the macro have been assigned, or when a carriage return or semicolon delimits an argument. be The arguments must be written in the order in which they are to substituted for dummy arguements. That is, the first argument is substituted for each appearance of the first dummy argument; the d second argument 1is substituted for each appearance of the secon dummy arguemnt, etc. For example the appearance of the statement: VMAG VEC, LENGTH in a program generates the instruction sequence defined above for the macro VMAG. The character string VECT is substituted for each ter occurrence in the coding of the dummy argument A, and the charac string LENGTH is substituted for the single occurrence of B in the coding. VERSION H7 3-2 JUNE 1972 MACRO -261- fields. The value of the gtatements with a macro call may have label ion generated. 1abel is the location of the first instruct CAUTION ed only by COMMA, MACRO arguments are terminat CLOSE PARENor N COLO CARRIAGE RETURN, SEMI string was ment argu re enti the n (whe IS THES These . sis) nthe pare open an started with ments argu in uded incl characters may not be Spec es or spac , ally ific . used are <> unless will they s; ment argu e inat tabs do not term itself. d part of the argumentment pe treateas s, it argu e inat term not does ol The symb to be ols symb r othe and: as just permits comm used as part.of an argument. 3.3 MACRO FORMAT commas. However, arguments must be separatedForby exam a. Arguments cont ple: as. comm ain may also DEFINE JFQ(A,B,C) <MOVE [A] CAMN B JRST C> tion B is equal to A (a literal), the Tf the data in toloca C. TIf A is to be the instruction ADD 2,X%, program jumpsmacro instruction would be written the calling JEQ<ADD 2,X>,B,INSTX ) ] surrounding thed.argument are removed, The angle brackets and the proper coding is generate as, semiment contains comm is: If an argu The general ruleothe ment must argu the rs, mite deli ment colons, or any anglre argu nesting, of l leve y ever brackets. For be enclosed in e brackets pass to e, efor ther ved; remo igs one set of angl ment argu the os macr ed nest to ng commas arguments containi each for kets brac e by one set of angl should be enclosed argument, jevel of nesting. The > does not terminate the a comma must be used. b. A macro need not have argfiments. The instruction: DATAO PIP,PUNBUF(4) ster 4, of PUNBUF, indexed dbyby regi which causes the contents macro: the rate gene be may , tape r to be punched on pape DEFINE PUNCH ‘ <DATAO PIP,PUNBUF(L4)> The calling macro instruction could be written: PUNCH VERSION 47 | . JUNE 1672 MACRO -262PUNCH of ¢. calls the The macro brackets of the name argument and without for an three words to first To load an can be is within are of symbols the arguments, within exactly the and B is register as of each the with it is often them in items address the A of table convenient the call, body. If the macro, what the for are macro and labels the used that form..hijk, user points. The first is are. labels for sign (%), called, by symbol it all created the calling assigned to overruled Null is this into that advised created it is to for not there address the last item. in a time the generate no list that the dummy dummy string: macro to symbol macro. These two the some to is decimal use not example, if of a ..0001, Created are there the of the is considered to a refer to be different is is sym- called. called, next is of macro the are form be the form are in %X, the in same been by %X a as a are perczant is replaced arguments percent normal missing defined two a macro position the four ..0002, by When sufficient assigned has preceded symbol symbols starting with the is a followed symbol. arguments argument suppose to generated points symbols statement that arguments stated are be symbols symbols reason macro the definition considered However, For the where purpose. symbol symbols. arguments macro a -table example, is created not arguments ments. the the necessary a is, missing and appear in etc. dummy body is length, Nevertheless, each requires inserted The a may replaces item. follows: stating the digits. If the angle example: number store macro used a the to outside be time For from bols generated definition for used index called, to is of string in SYMBOLS as Each list contained X,L(FIRST,LAST) concerned Created a The string. item, called labels must macro are the explicitly these by statement. expression of labels instruction L(A,B)<3%<B-A+1>> gives macro DATAO followed a CREATED a name, in MOVEI When the anywhere DEFINE 3.4 for macro. with in to be sign is manner. arguthe (A,%B,%C) VERSION 47 gl | JUNE 1972 063If the macro were ~ called with the MACRO argument string: (OPD,) or OPD,, The second argument would be considered to have been declared as null string. This would override the % prefixed to thé second dummy argument and would substitute the null string for each appearance of the second dummy argument in the statement. gument is missing. 3C. For example: DEFINE <JSR Héwever, the third ar- A label would be created for each occurrence of | TYPE(A,%B) TYPEOUT JRST %B SIXBIT/A/ #B:> This macro types Teletype. the TYPEOUT text is an string substituted output routine. for A on Labeling the the console location lowihg the text is appropriate since A may'be text of indefinite length. A created symbol is appropriate for this label programmer would not normally reference this location. might be fol- since the This macro called by: TYPE HELLO which would result in typing HELLO when the assembled macro is executed. If the call had been: TYPE HELLO,BX the effect would 8B, overruling the effect of the percent sign. 3.5 be the same. However, catenation operator. Rather, or macro expression when definition. strings to be <JUMP'A bol. for (') is defined as the con- it may be a string of characters which form a complete sym- DEFINE When substituted A macro argument need not be a complete symbol This joined to characters joining, called already called, If the VERsION 47 the call so joined. As an contained concatenation, by the assembler when the programmer writes the be CONCATENATION The apostrophe character or single quote bol BX would is in the performed an apostrophe between example, the macro: J(A,B,C) B,C> argument A is suffixed to JUMP to form a single sym- were: | June 1972 -264- MACRO J (LE,3,X+1) the generated code would be: JUMPLE 3,X+1 The concatenation (') may be used in nested macros. The assembler removes one operator when it performs concatenation if it is next to 3.6 (before or after) a dummy argument. DEFAULT ARGUMENTS Missing arguments in macros are generally replaced by nulls. example, For the macro DEFINE FOO EXP (A,B,C)> A,B,C> when called by FOO(l) would generate three words of 1, @, and #. Default arguments may be supplied to override missing arguments. When supplied, default arguments are written within angle brackets (<>) after each argument. For example, the addition of default arguments 222 and 333 to arguments B and C of the foregoing example macro would be written as DEFINE FOO (A,B<222>, <<333>) EXP A,B,C> If the foregoing macro is called by FOO(1l) it would generate the number 1,222,333. The following example program illustrates the use of defined default arguments. VErRSsION 47 JUNE 1972 -265- .MAIN MACRO MACRO 47(113) 1¢:1h4 28-MAR—72 PAGE 1 FOO MAC ' 28-MAR-72 o 1¢:13 ' DEFINE FOOl (A,B,C)< DEFINE (A<111>,B<222>,C<333 EXP A,B,C> FO0O2 > )< PUOgan' E9EPE pEgaEL" pRamg2' @APPPl gAdNIE GOURRE BPIgID BORUET gEARE3 0AB0RY POPPP1 goggel pgepags’ pgages 2peaes ERRORS A,B,C> FOO1L (1)4 EXP1,,+ Loon (1), EXP 1,222,3334 pppE222 @9¥333 ‘ NO EXP END DETECTED PROGRAM BREAK 2K CORE USED 3.7 . IS g@ggge INDEFINITE REPEAT It is often convenient to be able to repeat a macro one or more times for a single call, each repetition substituti . successive ng arguments in the call statement for specifiéd arguments in the macro. This may be done by use of the indefinite'fepeat operator, IRP. The operator IRP is followed by a dummy argument, which may be enclosed‘in paren- theses. ment's This argument must also be contained in the DEFINE.statelist. This argument is broken into subarguments. When the macro is called, the rangé of the IRP is assembled once for each subargument, the successive subarguments being substituted for appearance of the dummy argument within the range of the IRP. each For example, the single argument: <ALPHA,BETA, GAMMA> consists of the subarguments ALPHA,BETA, and GAMMA. The macro de- finition: DEFINE <IRP DOEACH(A), A <A>> and the call: DOEACH<ALPHA,BETA, GAMMA> produce the following coding: ALPHA BETA Vers1on 47 GAMMA 37 June 1972 MACRO An ~266- opening angle bracket must follow the argument of the IRP state- ment to delimit the range of the IRP since the argument is one argument to the macro. 2 closing angle bracket must terminate the range ter a of at the a time; program It is IRP. IRPC is each character that uses sometimes an IRPC desirable depending on conditions operator STOPl. finishes expanding and terminates When A<IFE CONV1 A>> that the STOPl only a complete argument. in Chapter the is of takes an IRP for An example of Figure 7-4. indefinite assembler. encountered, the 7, one charac- This is done by the the macro the present repeat processor argument An example: (A) K-A,<STOPI value CONVERT it stop processing range CONVERT <IRP except given given by the the is is to IRP the repeat action. DEFINE Assume like of K is 3: then the call: for the first code is @,1,2,3,4,5,6,7 <IRP IFE K-@,<STOPT CONV1 @> IFE K-1,<STOP1 1> CONV1 IFE K-2,<STOPI CONV1 IFE 2> K-3,<STOPI 3> CONV1 The assembly the macro. condition Therefore, fourth argument, the STOPI code arguments. 3.8 is NESTING an AND the 3, action i.e., of of further scanning of for the current the macro CONV1 the argument (defined 3. REDEFINITION that is, The macros may be defined within other levels may be outermost macros, the macro processor, VERSION 47 for arguments When the condition is met, continues a call three not encountered until the number 3. For ease of discussion, nested macros. to the argument Macros may be nested; macros. is processed which prevents CONV1 with not met the STOPI which However, and generates elsewhere) is may be called i.e., first assigned to these those defined directly level macros. Macros June 1972 -267defined within macros level defined within macros; macros may second level be called macros may second be level macros; called third level etc. At the macro first MACRO beginning processor second and of processing, and higher may be level first called macros in are level the macros normal not yet are known manner. defined. to the However, When a first level macro containing second and higher level macros is called, all its second after, the level level macros of become defined to definition called in the normal manner. is irrelevant, Of coufse, macros contain third level macros, defined until the second the processor. and macros may Therebe if these second level the third level macros are hot level macros containing them have been called. When a macro of level n contains a macro of level n+l, calling the macro results in generating the body of the macro into the user's program in the normal manner until the DEFINE statement is encountered. The level it does not appear complete, to the n+l the macro user's macro is then in the ueer's processor program until, defined program. resumes to the macro generating or unless, processor; When the definition the is the macro body entire macro has in- been generated. If a macro another ginal The definition first may be name which definition is example rewritten has a macro to EXP VMAG VL: 4C:> appears redefined, and within the ori- both of the length nesting and redefinition. of a vector (A,B,%C) VMAG (D,E) C,E> (A,B) JRST %C HRRZ 2, (SJ) MOVE (2) FMP @ MOVE 1,1(2) FMP 1,1 FAD 1 FMP - defined is SJ,VL MOVE VERSION 47 calculation illustrate DEFINE VMAG <JSP previously the macro eliminated. of <DEFINE been statement, 1,2(2) 1,1 FAD 1 JSR FSQRT MOVEM @1 (SJ) JRST 2(3J) 3-9 JUNE 1972 -268- MACRO The procedure to find the length of a vector has been written as a closed subroutine. It need only appear once in a user's program. From then on it can be called as a subroutine by the JSP instruction. The first time the macro VMAG is called, the subroutine calling se- quence is generated followed immediétely by the subroutine itself; Before generating the subroutine, the macro processor encounters a This new macro is deDEFINE statement containing the name VMAG. Henceforth, fined and takes the place of the original macro VMAG. However, when VMAG is called, only the calling sequence is generated. the original definition of VMAG is not removed until after the expansion 1is complete. Another example of a nested macro is given in Chapter 7, Figuré 7-4. 3.8.1 ASCII Interpretation If the reverse slash (\) is used as the first character of an argument in a macro call, the value of the following symbol is converted to a 7-bit ASCII character in the current radix. MAC and if A=500 character VErRs1ON 47 If the call is \A (in the current radix), this generates the three ASCII "500". JUNE 1972 -269- MACRO Chapter 4 Error Detection MACRO-10 makes statements. many error an apparent If checks as error it processes is detected, source the language assembler prints a Singie letter code in the left-hand margin of the progra m listing (and on as the The the programmer the or should not no listing error however, is described all in listing examine correction code are the a is on each error required. total the TTY), on the same line s of errors indication At the found; to determine end of the this is printed listing, even requested. indicates caused by the a general illegal preceding three 4.1 SINGLE-LETTER ERROR CODES Table 4-1 lists is in question. assembler prints Each as unless statement whether if TTY, the single-letter class usage of of errors. chapters error These the MACRO-10 codes of this output errors, language, manual. by the assem- bler. VERSION 47 | | June 1972 -270- MACRO TABLE 4-1 Error Codes Error Code Meaning A Argument error in pseudo-op Explanation This is a broad class of errors. which may be caused by an improper argument in a pseudo-op. The following represent the majority of the conditions which would cause an A code error. a. Symbol used is improperly For example AB?CD formed. would result in an A code since the character ? is not in the Radix 50 character b. set. IFIDN comparison string is too ~ large. c. OPDEF of macro is SYN,. d. OPDEF, e. Invalid SIXBIT character in SIXBIT/TEST Tab/ no code generated. f. Byte size too big in byte (>4D36) . g. Radix 50 code not absolute, Radix 50 FOO,BAR that is where FOO is not @-74 absolute. h. End of : line on IFx SYM reached before an < character is seen. i. Assignment made in an address field (e.g., MOVE A=10). j. Assignment of a label (e.g., TAG: TAG=1). k. Missing symbol in SYN SYM1,. 1. Unknown symbol in SYN,. m. Missing right parenthesis ()) in index ll(zooo)p (e.g., MOVE n. Missing left parenthesis in BYTE statement VERSION 47 (e.g., o. No comma after repeat count p. IRP not in a macro. .JUNE 1972 -271TABLE 4-1 (Cont) Error MACRO Meaning Code Explanation q. Argument dummy for DEFINE FOO IRP(B), r. IRP IRP symbol; is for (A) not a example < <>> argument is a created symbol. S. Multiply-defined symbolic error This reference : STOP1l ' not in IRP. statement contains which refers to defined symbol. bled with the a tag a multiplyIt is assem- first value de- fined. External symbol Improper usage error symbol. The sent of an external following the majority of repre- the tions which will cause code error. a. Attempting to use both an symbol as internal and an For example, EXT: EXTERN attempts an condi- an E the same external symbol. the statement TXT,BRT,EXT to use EXT external and an as both internal symbol. b. Using for c. Using for d. e. f. HISEG or TWOSEG an external the A literal an is symbol improper. generate is The message symbol 1 A to CODE typed out words. GENERATED retains and 1lit- 18 defined more symbol M is in count. first definition, _VERSION_47. symbol of IOWD. external [SIXBIT //]1;NO cnce. pass pseudo-op. left half REPEAT eral must symbol symbol an external symbol an ARRAY size statement. Using a Multiply-defined external IFx. Using g. EXP symbol index. Using in A an or an external symbol a LOC, RELOC, PHASE, in error external Using in Literal an an AC than its the error during 1. If this type of error occurs during pass 2, it is a phase error (see below). JuNeE 1972 -272- MACRO TABLE 4-1 Error Code Meaning (Cont) Explanation If a symbol is first defined as a #-sign suffixed tag, and later as a label, it retains the label definition. Examples: A: ADD 3,X; A: ADD 3,X#; A: MOVE ,C; M ERROR X: MOVE-,C; X IS ASSIGNED THE CURRENT VALUE OF THE LOCATION ’ ’ COUNTER Multiple appearances of the TITLE pseudo-op (which generates both a title line and program name) are flagged as "M" (Multiple definition) Number error N errors. A number is improperly entered. The following represent the ma- jority of the conditions which would cause an N-type error. a. The number exceeds the permitted range (e.g.. +F13.33E38). b. A number does not follow a B shift operator (e.g., . 4+D15BZ) c. The number exceeds the cur- rent radix (e.g., if radix is 8 the single character 9 is acceptable but the number 19 is not acceptable). d. The binary shift given does not represent an absolute For example, numeric. 4B<sym> is illegal if sym is relocatable. e. The character given after an up arrow F, (t+) is not B, O, L or D. £. The expression given after E was not a signed (+) number. 0 Operation code un- P Phase error defined The operation field of this state- ment is undefined. It is assem- bled with a numeric code of #. A symbol is assigned a value as a label during pass 2 different from that which it received during pass 1. In general, the assembler should generate the same number of program locations in pass 1 and pass 2, and any discrepancy causes a phase error. VERSION 47 JuNe 1972 -273~ TABLE Error Code 4-1. MACRO (Cont) Meaning Explanation For example, if an assembly conditional, IF1l, generates three instructions, sults such gram Q Questionable unless a phase error another re- conditional, as IF2, generates three prolocations during pass 2. This is a broad errors in which finds ambiguous class of possible the assembler Q-errors may may correct code; the attempt to do what intended. The mer language. or not generate assembler will the program- following re- present the majority of the ditions which would cause a Q~type a. error. More than 5 ASCII characters are detected bler before symbol by a the is detected "ABCDEFG" or more 5 than More than ters are 6 "ABC " (e.g., ). When characters the before are first SIXBIT detected assembler assem- closing detected, only are stored. b. con- 5 characby a the closing " symbol is detected. As in item a, only the first 6 characters are stored when more than 6 are detected. c. A given number is in such cases, the order are d. bits number E in a number is followed by something other than a signed (+) numeric (e.qg., — An illegal is detected ASCII f. the big; high- lost. 1.9EX) . e. of too control in characters not permitted LF, VT, A a comma EF, is statement character line: @-40 except CR and detected after all are for HT, ESC. in a of the required fields have been filled (e.g., MOVE 1,2,) g. Relocatable ated by fore either HISEG the VERSION 47 or the code is generassembler be- the pseudo-op TWOSEG is found by assembler. JUNE 1972 4-5 MACRO -274TABLE Error Code 4-1 (Cont) Explanation Meaning h. Relocation error R An instruction address pointer is detected by the assembler which does not have either all @#'s or all 1's in the left half of its word location. A LOC or RELOC pseudo-op is used improperly. All of the following conditions will cause an R-type error. a. An expression or assignment is made in which relocation is not # or 1 (e.g., A+B, A*7Z, 1/B, or X=3*B where a and B are relocatable). b. A BLOCK statement is written with a relocatable size (e.g., BLOCK: A where A is . relocatable) c. A relocatable variable is used to specify an accumu- lator A is (e.g., MOVE A,l where relocatable). U Undefined symbol A symbol is undefined. \ Value previously undefined A symbol used to control the assembler is undefined prior to ‘the point at which it is first Causes error message in used. pass 1. For example, BLOCK:A where A is undefined. Macro definition X error An error occurred in defining or calling a macro. The page Error messages printed during pass 1 consist of two parts. and sequence number, if used, plus the most recently used label is This material is then followed by +n, printed on the first line. where n is the (decimal) number of lines of coding between the labeled statement and the statement containing an error. The second line of the error message is a copy of the erroneous line of coding, with a letter code in the 1eft—hénd margin to indicate the type of error. If more than one type of error occurs on the same line, more than one letter is printed; but if the same type of error occurs more than once in the same line, a single letter code is printed. VErsion 47 JUNE 1972 -275During pass rors are printed 4,2 2, as marked at the the by end listing is printed letter codes, of listing. the MACRO and a out, total lines of containing errors found er- is ERROR MESSAGES The following error messages may be typed out on Any error meSsage preceded by a question mark (?) fatal error when running under minated by END OF PASS 1 This 2. message required message is This NEXT FILE This is ter- is paper that manual to start pass issued when tape, cards or message indicates that manual required when the files to be input are on paper tape, cards or being input from the terminal. loading ERROR This ‘ is message error was mand ?INSUFFICIENT CORE ?.PDL run indicates is input keyboard. ?COMMAND (the BATCH). the THE user's. terminal. is treated as a the BATCH processor loading LOAD the indicates found string in the that an last com- input. Not enough core is available. OVERFLOW,TRY/P This message indicates pushdown list use /P of a is too switch size that the small. The increases the of the pushdown list by 80 locations. As many /P switches ?DEV NOT AVAILABLE may be The specified used as desired. device initialized because is using it. ?N ERRORS ?1 ERROR NO ERRORS DETECTED DETECTED These » the DETECTED three number END STATEMENT ENCOUNTERED ON INPUT - the errors run indicate detected by is terminated. FILE This message of VERSION 47 statements of user MACRO during assembly (errors marked by letter codes on the listing. Under BATCH if any error occurs, ¢NO cannot be another the is followed by one following: IN LITERAL IN DEFINE IN TEXT IN IN CONDITIONAL CONDITIONAL IN MACRO OR REPEAT CALL JUNE 1972 MACRO 276- and ON PAGE xxx AT yyy where xxx = a page number and yyy a sequence number Or TAG+offset. NOTE The foregoing type of message usually indicates some error other than a missing END state- ment. For example: ASCIZ/TEXT END where TEXT has not been closed or JRST [statements END where the literal has not been closed. ?PRGEND ERROR that This error message indicates the the macro failed to restore prosymbol table for one of the . grams ?2T00 MANY UNIVERSALS that This error message indicates have too many universal programs The number of been assembled. permitted is a rams prog universal this Macro parameter; to prevent user error from reoccurring, the must reassemble macro with a new parameter which will permit the desired assembly. ?2CANNOT FIND UNIVERSAL xxX This message indicates that a L search has been made for UNIVERSA found program xxx but it was notd). To (i.e., it was not assemble clear this error the program XXX must be assembled. L xxx UNASSIGNED DEFINED AS IF EXTER NA This message indicates that an undefined symbol was found and that it has been treated as if it was an external symbol. PROGRAM BREAK IS XXX Wwhere xxx is the length of the low HI-SEG BREAK IS xxX Where xxx is the length of the VErRSION U7 segment. relocated high segment. June 1972 ~277ABSOLUTE BREAK IS xxx Where : xK CORE MACRO xxx address USED - Message low MUST HAVE FILES SAME the highest over indicates segment source PUNIVERSAL PROGRAM(S) is seen used absolute 144. the size of the assemble the to program. OUTPUT SPECIFICATIONS AS OTHER This error message indicates universal program was found that which a did not have either a binary or a listing device specified but all of the following fications. files For had example such the speci- sequence ¥ <UNIV ¥pel,List<«file is illegal. would The legal be sequence *¥rel, LIST<«UNIV ¥REL,LIST«FILE ?ERROR WHILE EXPANDING Xxx This the nal error message indicates that assembler experienced an intererror while expanding the macro identified as xxx. type are curs the user macro 4.2.1 The LOOKUP following RENAME ? or error messages request filename.ext FILE WAS enter on then should involved. can occur during a monitor disk. one of NOT FOUND errors (1) NO (2) PROTECTION DIRECTORY The the or (@) only) FOR form of of if this it rewrite oc- the the error LOOKUP, messages is: following ILLEGAL FILE NAME PROJECT-PROGRAMMER (used for NUMBER FAILURE (3) FILE WAS (4) RENAME FILE NAME ALREADY EXISTS (5)‘ Errors rare; Errors ENTER (9) extremely BEING MODIFIED ILLEGAL SEQUENCE OF UUOS (6) BAD UFD OR BAD RIB (7) NOT A SAV FILE (1) NOT ENOUGH (11) DEVICE (12) NO SUCH DEVICE CORE NOT AVAILABLE (13) NOT TWO RELOC REG. (14) NO ROOM OR (15) WRITE LOCK ERRCR VERSION 47 QUOTA CAPABILITY EXCEEDED JUNE 1972 -278- MACRO (16) NOT ENOUGH MONITOR TABLE SPACE (17) PARTIAL ALLOCATION ONLY (29). BLOCK NOT FREE ON ALLOCATION CAN'T SUPERSEDE (22) CAN'T DELETE (RENAME) (23) SFD (24) SEARCH (25) SFD (26) NO-CREATE ON FOR SPECIFIED SKFD PATH NOT ?2(V) A NON-EMPTY DIRECTORY FOUND LIST NESTED If the error code is (ENTER) AN EXISTING DIRECTORY (21) (V) EMPTY TOO DEEPLY ‘ is greater than 268’ LOOKUP,ENTER, the error message: OR RENAME ERROR printed. 4.2.2 MACRO I/O Error Messages The following error messages are generated for error conditions found during input or output operations with peripheral devices. messages are The self-explanatory. ?20UTPUT WRITE-LOCK ERROR DEVICE xxX ?0UTPUT DATA ERROR DEVICE xxx 20UTPUT CHECKSUM OR PARITY ERROR DEVICE xxX ?0UTPUT QUOTA EXCEEDED ON DEVICE xxx ?0UTPUT BLOCK TOO LARGE DEVICE xxXx ?MONITOR DETECTED SOFTWARE INPUT ERROR DEVICE xxx ?INPUT DATA ERROR DEVICE xxXx ?INPUT CHECKSUM OR PARITY ERROR DEVICE xxx ?INPUT BLOCK TOO LARGE DEVICE xxx VERs1ON 47 June 1972 - -279- MACRO Chapter 5 Relocation The MACRO-10 This of assembler will program may what has address been field of added to it. PDP-10 be loaded previously some create into a any relocatable part loaded. To instructionsvmust of object memory as accomplish have a a program. function this, the relocation constant This relocation cohstant, added at load time by the Loader, equals the difference between the memory location ‘an instruction is actually loaded into and the location it is assembled into. If a program is loaded into cells beginning at locationAl4008,-the’relocation constant k~would be 14008. Not all instructions Con51der the two must be modified by the relocation constant. instructions: MOVEI 2,.-3 MOVEI 2,1 The first is used in address manipulation and must be modified; the second probably should not. To accomplish the relocation, the actual expression modification by and the not modified. VERSION 47 forming an address Linking Point Loader. elements (.) is evaluated and marked Integer are for elements are absolute relocatable and are | always June 1972 -280- MACRO modified.! Symbolic elements may a be either absolute or relo- catable. If symbol is defined by it may be relocatable or absolute depending (=). a following the it is equal replaced by sign the string If and a direct symbol the Finally, is string If it is defined as a label or a variable assignment on the defined itself (#), statement, expression as is a macro, evaluated. it is relocatable.1 references to literals are relocatable.! To evaluate the relocatability of an expression, consider what happens at locatable load time. element and A constant, the k, must be added expression evaluated. to each Consider re- the expression: X where A,B,C, constant. - A+2%B-3%C and D are Adding XR = This + D relocatable. this to each Assume relocatable k is the term we relocation get: (A+K)+2%¥(B+K)-3*¥(C+K)+(D+K) expression may be rearranged to separate the k's, yielding: in = A+2%¥B-3%¥C+D+K This expression addition of a arranged to is if for relocation 1In general, result in J*K The expression is 1¥K N¥K Finally, suitable single k. the the expression the addition if since the it involves the expression can be re- of legal and fixed. The expression is legal and relocatable, Where n is any positive or negative integer than 0 or 1, the expression is illegal. expression is illegal. involves This k to leads any power to the other than other 1, following conven- tions: a. Only two values of relocatability expression are allowed element may (e.g., b. An not be divided c. Two relocatable d. Relocatable elements may for a complete nK where n = @ or +1). by a relocatable element. elements may not be multiplied together. not be combined by the Boolean operators. lExcept under the LOC code or PHASE code which specifies absolute addressing. VERSsION U7 5-2 ‘ JUNE 1972 -281If any of these rules is broken, assembled code is flagged. If A, C, and B are relocatable A+B-C A-C A+2 A storage VERSION 47 symbols, relocatable is fixed illegal and the then: is relodatable is 2&A-B is illegai word may XWD the.expression is is 2%A-B ~the right half,. MACRO be relocatable relocatable in the left half as well as in For example: A,B JUNE 1972 ~283- MACRO Chapter 6 Assembly Output There are listing. two MACRO-10 The llstlng ops, which were 6.1 ASSEMBLY outputs, is a binary-program controlled by described in Chapter the and listing a program control pseudo- 2. LISTING All MACRO-10 progréms begin with an implicit LIST statement. : , Each page name, the begins with assembler assembly and Form-Feed or a page PAGE a TITLE line; this line version, the time of number. The page number contains assembly, is the the program's date of incremented by a pseudq-op. If the code.listed requires more than one page, the basic page number given on the title line does not change but is added and incremented for each additional page 6-3, etc.). ‘ | The line second line contains creation date printed on the program and any each page is fllename and glven the a (e.g., SUBTITLE extensions, subpage number 6-1, 6-2, 11ne. This creation time, subtitle. VERSION 47 June 1972 6-1 284~ MACRO From left to right, the columns on a listing page contains: a. The 6-digit address of each storage word in the These are normally sequential binary program. In the case of a location counter assignments. block statement, only the address of the first An apostrophe followword allocated is listed. ing the address indicates that the address is relocatable. b. The assembled instructions and data words shown in one of several forms for easier reading (see paragraph c. 2.6.3). The source program statement, programmer, as written by the followed by comments, if any. If an error is detected during assembly of a statement, an error code is printed on that statement's line, near the left edge of If multiple errors of the same type occur in a partithe page. cular statement, the error code is printed only once; but if several errors, each of a different type, occur in a statement, code is printed for each error. an error The total number of errors is printed at the end of the listing. This The program break is also printed at the end of the listing. is This one. is the highest relocatable location assembled, plus the first location available for the next program or for patching. 6.2 BINARY PROGRAM OUTPUT The The assembler produces binary program output in four formats. choice depends on whether the program is relocatable or absolute, and on the loading procedure to be used to load the program for execution. 6.2.1 Relocatable Binary Programs - LINK Format Most binary programs are output in LINK format. Like the RELOC statement, the LINK format output is implicit and is automatically _ produced for all relocatable MACRO-10 programs unless another format (RIM, RIM10, RIM1OB) is explicitly requested. The LINK format is the only format that may be used with the Linking Loader. The Linking Loader loads subprograms into memory, properly relocat- ing each one and adjusting addresses to compensate for the relocation. VERSION 47 JUNE 1972 -285It also links tion between external and internal symbols independently assembled Linking Loader loads required MACRO to provide subprograms. subroutines while Mode. communica- Finally, in the Library Search ' Data for the Linking Loader an identical forflat. two halves. right half The is a is formatted left half count of is a code the number for of data'words are grouped in sub-blocks word sub-block is preceded by a word consists 18 blocks. the of relocation 2-bit‘bYtes. block data words The of in All blocks The first word of a LINK bloc k consists of Each 18 and the items. word. byte type, in the block. Each This have 18- relocation corresponds to one word in the sub-bloék, and contains relocation information regardin g that word. O is: no = byte value the right NN the the left half w If both halves relocation occurs half is is are relocated relocated relocated These relocation words are not included in the count; appear before each sub-block relocation. All and on disks. programs paper tape, This format may LINK Formats Absolute Programs is for and WORD 1 WORD The 2 A . WORD N VERSION 47 or be DECtape, or less to they always ensure proper stored in LINK magnetic tape, totally independent format, including punched of cards, logical divi- It is also independent of the bloc k type. or words | sions in the input medium. 6.2.1.1 18 | relocatable programs of the Block Types - Block Type 1 Relocatable Data location of contiguous less) the block first data of program word or in data the block words (18 (N, from 1 to 18, must be less than 2000,000 octal) JUNE 1972 -286- MACRO Block Type 2 Symbols Consists of word pairs 1ST WORD Bits 0-3 code bits OND WORD CODE @L4: 2ND WORD Data (value or pointer) Global (internal) definition Bits 0-35 value of symbol Local definition Bits 0-35 value of symbol symbol 1ST WORD Bits 4-35 radix 50 representation of CODE 1@: SND WORD CODE 6g: (see below) Chained global requests: Bits 0-17=0 of chain pointer to first word OND WORD Bits 18-3g5 defi L.OADER the to er (ref n ntio OND WORD requirin manual) CODE 6¢: Global symbol additive request: (refer to the LOADER manual) Block Type 3 Load Into High Segment ry program, the When block type 3 is present in a relocatable bina the system has Loader loads the program into the high segment ,if bloc k type 3 apre—entrant (two-segment) capability. When used pears immediately after the name block (type 6). The first word is XWD 3,,2 The second word is the relocation word 209900, .8 The third word is YWD HISEG BREAK,,TWOSEG ORIGIN where twoseg origin is 400000 by default. d word is negaWith the TWOSEG pseudo-op, the left half of the thir pt to set a tive. On a two-segment machine,this is ignored exce erence is assumed to LOADER flag. On a one-segment machine, the diff assembler be the maximum length of the high segment. A one-pass e efor does not know this legth at the start of pass 1, ther VERSION 47 6-4 June 1972 MACRO -287- | XWD L@@ped, ,4o089d is used to signal two segments to a two-segment machine. On a one-segment machine, this instruction gives the error message TWO SEGMENTS ILLEGAL since the LOADER does not know how much space to reserve for the segment. high Block Type 4 Entry Block This block contains a list of Radix 50 symbols, each of which may contain a 0 or 1 in the high-order code bit. Fach represents a input is ignored until the néxt end block. This block must be the series of logical AND conditions. If all the globals in any series are reqdested,'the following program is loaded. Otherwise, all in a progranm. first block Block Type 5 End Block a program. It contains two words, the This is the last block in first of Which'is the program break, that is, the location of the first free register above the program. (Note: This word is relocatable.) It is the relocation constant for the following program loaded. The second word is the highest absolute location seen (if greater than 140); In a two-segment program, the two words are: 1) the high segment break followed by '2) the low segment break. Block Type 6 Name Block The first word of this block is the program name RADIX 50). It must appear before any type 2 blocks. The second word, if it appears, defines the length of common. The left half of the second word 1is used to describe the compiler type that produced the binary file, 0 in the case of MACRO. N Version H47 | June 1972 MACRO -288- Block Type 7 Starting The first word The starting means of Block Type Each program. this address the data of Address block for a is bits. Internal Request word is The right one request. half starting relocatable relocation 10 the is The the address program may left value. half if Either of be the the program. relocated pointer quantity may by to be the re- locatable., 6.2.2 Three Absolute output binary Binary formats programs. Programs are These available are for requested absolute (non-relocatable) by the is assembled RIM, RIM10, and RIM10B statements. 6.2.2.1 RIM1OB locations (not statement at sembler format The to is the write specified is in - If a relocatable), beginning out designed program program Format the program a of RIM10B the object use with punched out during LOC source program for the statement the statement. 2, the causes RIM10B PDP-10 pass If program in into the the format. hardware starting first absolute following two This read-in at LOC as- the feature. location statements in the are: LOC 148¢) RIM1gB )’ the assembler ing at 1000, starting at assembles and punches location duringassembly ment needed In RIM10B out the word (or to format RIM10B less) The his out program program, the 6-1 (Figure 6-2), The assembler inserts block, also an I/0 inserts each in but entire Figures blocks, absolute programmer Loader data VERS1ON 47 the (see data and of punch program with out 1000. counter is the and also reset the only one RIM10B 6-2), the by 36-bit start- location state- program, assembler the separated transfer word a format, may followed block addresses RIM10B (IOWD) checksum by punches program blank preceding following in 17- tape. each each data * JUNE 1972 -289- blogk as shown in only data words the 36~bit Data Figure 6-1. in the added checksum of blocks may contain MACRO The word count 'in block, and the therchecksum IOWD is includes the simple the‘IOWD and the data words. less than signs a non-consecufive loca tion, 17 words. If the assembler as- the current data block is termi- nated, and an IdWD containing the next location is inserted, starting The a new data transfer transfer (see block block is block. consists two words. The from Section 6.2.2.4) read. The 6.2.2.2 lute, second RIM10 follows a LOC each storage address RIM10 is a and is stop the in RIM10 When the a program, object specified in the LOC arbitrary read the format RIM10 are abso- statement assembler punches out starting at the absolute If in the format statement. "paper in by the program, of statement reader. checksummed. in END transfer block. is not the can be to Binary programs statement an the - in it first word executed when the dummy word word writes below, and Format unblocked, of an'instruction-obtained the tape". PDP-10 it is Read-In-Mode hardware. IOWD N,FIRST) where n is the tion at the Pied. The length end, last the program, of the program including and FIRST is the location must such the transfer first memory location be a transfer instruction instruc- to be occuto as: begin JRST 4,00) For at example, START and if a program with its IOWD last location RIM10 at output FINISH, has the its first programmer location may write \ FINISH-START+1,START) NOTE VERSION 47 In cases but no where binary the location output LOCn, and LIT word pseudo-ops), into the tion binary skipped by the counter occurs (such MACRO output location o file is as increased with inserts for BLOCK, a each counter. 6~7 Zero loca- June 1972 -290- MACRO 6.2.2.3 RIM Format - This format, which is primarily used in PDP-6 systems, consists of a series of paired words. The first word of each pair is a paper-tape read instruction giving the core address of the second word. DATAI memory The second word is the data word. PTR,LOC DATA WORD an The last pair of words is a transfer block. The first word is instruction obtained from the END statement (see Section 6.2.2.4) and .is executed when the transfer block is read. The second word ' is a dummy word to stop the reader. The loader that reads this format is: LOC A: 24 CONO PTR,68 CONSO PTR,1# JRST .-1 DATAI PTR,B CONSO PTR,1d B: JRST ¢ JRST .~-1 A This loader is normally toggled into memory and started at location 20. 6.2.2.4 END Statements - When the programmer wants output in either RIM or RIM10B format, he may insert an instruction or starting address as the first word in the two-word transfer block by writing the instruction or address as an argument to the END statement. The second word of the transfer block is zero. 1In RIM10 assemblies, this argument is ignored. If bits 0 through 8 of the instruction are zero, MACRO will insert the instruction JRST 4,0, causing a halt when executed. The END statements END SA) OR END JRST SA) will start automatically at address SA. VERsTON U7 June 1972 Some other MACRO | -291examples: l1st Transfer Block Word END@XCT 1234 END ZU,SA END XCTel23k JRST 4,SA JRST 4,0 RIM 198 LOADER . . tOWD Xy, ADDRy X1<€1710= NUMBER OF WORDS IN 15t DATA BLOCK ADDRy=ADDRESS OF 1st DATA BLOCK 18t BLOCK OF PROGRAM DATA CHECKSUM IOWD IS INCLUDED {N -CHECKSUM IOWD Xq, ADDRp, nth BLOCK OF PROGRAM DATA CHECKSUM //////////// BLANK TAPE (6 FRAMES) JRST START TRANSFER BLOCK ¢ 10-0060 Figure VERSTON 47 - 6-1 General | RIM10B Format JunE 1972 MACRO -292- XWD -1650 ST: CONO PTRs60 ST1 HRRI A,RD+1 RD: CONSO PTR»10 JRST DATAI PTRs @TBL1-RD+1(A) XCT TBL1-RD+1CA) XCT A TBL2-RD+1 (A)D S0JA TBL1 : A, CAME ADD CKSMs»ADR CKSMs1 SKIPL TBL2: JRST AOBJN ADR: JRST (ADR) CKSM,ADR 4,ST ADRsRD ST1 CKSM=ADR+1 Figure VErRsION 47 6-2 RIM10B Loader June 1972 -293- MACRO Chapter 7 Programming Examples. This chapter example contains (Figure 7-1) four examples presents a of MACRO-10 the logarithm of a complex argument. ENTRY statement Logarithm and identifying Function) and this uses programs. routine for routine as CLOG external routines, (Figure 7-2) used which contains is conditional KAl0 or KI10 mode. macros to which simulate assembly the KI10 (Complex ATAN2 is the universal parameter file produce It defines first ALOG, CABS. DEF40.MAC The calculating This routine begins with an library three The second example It macro the KA-10 switches the to version select accumulator hardware of LIB40. either a PDP-6, conventions and operations on the KAl0 processor. Example its 3 (Figure accumulators macro FLADD which generate shown. is 7-3) and uses the DEF40 macros expanded twice text no but (via for to DMOVE, show binary. the the The SEARCH pseudo-op) DMOVEM and effect effect of of for FLADD. LALL SALL on is The lines also ) Example 4 desired operation VERSION 47 (Figure 7-4) is to shows take nested an macros ASCII 7-1 text which string use and IRPC. store The the JuNe 1972 - MACRO ~294- characters four per word, left-justified, with the character count stored in the first nine bits of the first word. The TEXT macro counts the string characters and invokes the CODE macro to store the characters four per word. last The CODE macro invokes a SHIFT macro which left-justifies the word if it is not already left-justified. The first part of the example shows the normal listing, then SALL is set to show what code the macros are generating. VERSION 47 JUNE 1972 MACRO -295- IMYd TYEY HIIM YHMSNY JVMS© INILNOY DOT HOd SSIUAAYS 0°Y v HOXH axd 9T 1880808 T1828¢ 9TgZa8 10@8108 118889 T=4d g1=9 9T=0 .ASOdHLHENLEHEJ eTiyygip) LOB30d STA0YL L9z Nofuyayiygil 12 83081\COBPD PW238 NPB88 0\8 0 89 Figure VERSION 47 7-1 RN} 19182084 MACRO Program CLOG JUNE 1972 DDayDL¥gSon])Y0OgOo1vTIZo0YDoNY OYVHIOVH(ETTgO1h2,o9T10ToT0A128)09P1g0l.382808-L008P9Hd88a38g90a0d4v4.-#GfII:XXN€HHTEEGIE2T.-Hav-f DVTdOGW¢A ASdT1dYIS MACRO VERSION 47 -296- June 1972 -297- 'MACRO UNIVERSAL DEF4@ PARAMETER FILE FOR FORTRAN IV LIBRARY SUBTTL V32(343) 23=-NOV-T71 /TWE IFNDEF PDP6.<IFNDEF KAl#,<IFNDEF KI1f,<KAlg==1>>> IFNDEF PDP6,<PDP6==g> ; CONDITIONAL ASSEMBLY IFNDEF KAl#,<KAlg==g> IFNDEF IFN PARAMETERS KI1J,<KIl@==g> <PDP6!KA1¢!KI1@-PDP6-KA1@-KI1g>, <PRINTX MACHINE PARAMETERS DEFINED WRONG> ; ACCUMULATOR ASSIGNMENTS A=g B=1 c=2 D=3 E=1 F=5 G=6 H=7 Q=16 ;FOR JSA AND ARG ADDRESS FOR PUSHJ P=17 ;PUSH DOWN POINTER IFE KAld,< DEFINE DOUBLE (A,B)< A B> > IFN KAlf,< DEFINE DOUBLE 451 ,==A% (A,B)< 777000, ,0> IFL %%1l.,<33l.==-3%3%1.-<1000, ,0>> #%1 ,==%21.-<@#3300%,,9> IFE B,<%%1l.,==¢> ' Z22,==B%1, +<<B+20@>«-B>&<@PBTT ,TTTTTT> T, IFL Z%1l.,<%%2.==g> A BRE2 SUPPRESS DEFINE , 231, ,%%2.> DMOVE (AC,M)< IFL <& M>-<@>,< MOVE AC,M MOVE AC+1,1+M> IFGE <& M><@>,< MOVEL AC+1,M MOVE AC, (AC+1) MOVE AC+1,1(AC+1)> > DEFINE DMOVN(AC,M)< DMOVE DFN DEFINE AC,M AC,AC+1> DMOVEM(AC,M)< MOVEM AC,M MOVEM AC+1,1+M Figure VERSION 47 7-2 Universal Parameter File _ DEF40.MAC JUNE 1972 _298- MACRO DEFINE FLMUL (AC,M,%0V)< MOVEM AC,AC+2 FMPR AC+2,1+M JFCL (2) FMPR AC+1,M JFCL (2) UFA AC+1,AC+2 JECL FMPL AC,M JOV %0V UFA AC+1,AC+2 FADL AC,AC+2 %OV > DEFINE FLDIV(AC,M,%0V)< FDVL AC,M JOV %0V MOVN FMPR AC+2,AC AC+2,1+M JFCL (2) UFA AC+1,AC+2 FDVR AC+2,M JFCL FADL AC,AC+2 0V > DEFINE FLADD(AC,M,%0V)< UFA AC+1,1+M FADL AC,M JOV %0V UFA AC+1,AC+2 FADL AC,AC+2 ;END OF Z0V:> > IFN KI1g,< OPDEF OFDEF OPDEF FLADD FLMUL FLDIV DEFINE DFN IFN KA1lg CONDITIONAL [DFAD] [ DFMP ] [DFDV] (A,B)< A DMOVN A, <<A+1>&17-<B>>,<PRINTX "DMOVN A,A" CAN'T REPLACE "DFN A,B"> > > sEND OF KI1@ CONDITIONAL END VERSION 47 JunNe 1972 (“H®A)ON°WVAY (HBA)+OTH+V (9‘AO®WvA) v(HITA+OVHYW) VERSION 47 Figure OeN SHHYO0Y0¥dE sJnALOELEd 122880 "R 7-3 Test ASESRSR SRS a|aunmw® 297 28 B020827 1 29 cepenz IHVIS TIVS ¥ aNd ‘cpes” TIVT 1WVYHOEdVV2A0NY08STg€d2z@PgBfP HAONA q°Yy VLS 1.t,P92o3P3p8@a9388 1@@cz 1g98 2080881888yogddig]080 - IFAOW ‘T+V () STIIHHLWSISENdOTIQ9INX0HdEAJNATOW q.SPP0B2I8F9P 2Bd@8g2zz 122388 po20e120028g WIACHWAAONWCFAOW (T+Y) T + Y A°Y Y 9721QL190908028920083390y0 GTSP2ESE2TT 12IB18T9% a3l1eP8SPBEgy8BYeTy Aav1WOdaICnvvArdiO¢aHWT+gT#@°+8TqTgy°+°éVTy+Y HYOLS OL AYOWHW STQ088 THT 288 ceeaed v1danvd22+Y+YY°T+Y ISITS HONTHIAYIAT 4gL9SHT1e1118gG8@pZPg88aEp97gDg TPTGBnEhEl2TTT 921Bg7981 4ycPo281clpapSPBeP8ey 1 nvTTvaadaodANvnvrvddiadJTcYq°Y2+V++gYTe°g:T2#cH+°VVY TIVD¢ ANV ZMYNIG ATINO 8 29 ho e e gy 1% ZL=¥dv-S IISSHHELL HKWO9DS2Y3S0O8YD9V8INg2cL-0¥8dV-GOMBDrV€HT(£T).Ly 84:€T ¢l-THH1¥AOTdCMLvOVIE-HILNSES°SVLDS(VHFT)¥LH%dd9d¢Td dWLO-S¥avSO-H9OVIW ¢HF -299- MACRO Some Macros JUNE 1972 -300- dDVd ¢ MACRO PB8880 12820 TP 0 N €SHLOMSHWOHVLSHT2lO-9Eu¥YWTdAvL¥S-§ LSHL "198@ cggg:°” OV goese VERSION 47 LHYLS JUNE 1972 MACRO -301- e J2XH T7v71 < < &"“Z T+N= T+N= PP088 W Yy 180800 COP080i\ THIHTH €PT2PT 288889 100889 2pepse 384} oy < e <ZZdXH e 0dyT >0 1% 2L-4dv-4 QIUANLOVOHYDH©S: OVIN Figure VERSION 47 7-4 Store Text Character by Character JuNe 1972 -502- T+N= N T+N= N 118029 Lppaae T+N==N T+N==N T+N= N Yfuf ufi] T+N== MACRO Z1oape VErsION 47 JuNe 1972 7-10 ~303- MACRO - 2% JXd gyc1go o =Z 47 VERSION JuNE 1972 7-11 < P = 2 Z N A I > ‘ 0 d L L 3 8 % d X H 2 % SPTHAT dXH zZ7 NAI >°0dl).3% MACRO -304- VERSION 47 June 7-12 1972 gOZNTT Z1TPeg CITIT 6+2F==2% <LJAIHS < VERSION 47 7-13 | pFRR==2F .9S07P0800d9GTPITTZHTAITTLCPTITTOeZTT T% cL-¥dv-§ -305- MACRO <LATHS JuNE 1972 OHDVHL(tETIT)S:hT2l-Hd¥=-G39Vd€-T 1y o 4 € 1] 4 o< 0 = fx] I% cL-4dv-S R Y] ¥ dH0 d sn LWOFNVXYHIOLLSOSHMOJYIXHHHAOAVLVIdY4HELI0L4SOILVIMdgV2THLPO-2¥8dA@v9-6HALhOiVhHTVHO LPERew. B ENT BeEPEB MA(.RO -306- VERSION 47 7-14 June 1972 -307- MACRO Appendix A Op Codes, Pseudo-Ops, and Monitor 170 Commands This appendix contains a complete list of assembler defined including machine instruction mnemo nic codes, monitor programmed programmed a operators, operator, or and FORTRAN unimplemented programmed user operation operators. code is uuo. A.l The operators assembler pseudo-ops, A called ASSEMBLER PSEUDO;OPS AND MONITOR COMMANDS notes Pseudo-ops address specify that operand which Pseudo-ops generate data may generate be used data, within and which literals, do and not. in fields. The initial values given by MACRO~10 to I/0 instructions and FORTRAN UUO's and are ARRAY, ARG, for which useful pseudo~op, 320, no-op the in octal Op checking generates (same as code is not shown, data JUMP) CALLI, 047, monitor UUO 070, monitor UUO pseudo-op, generates data ASCIZ, pseudo-op, COMMENT, generates data DATA, BLOCK, pseudo-op, pseudo-op, BYTE, pseudo-op, CALL, 040, no - data data generated generated DEC, DEC., generates data monitor VERSTION 47 no given CLOSE, ASCII, ASUPPRESS, are in the notes listings. 033, DEPHASE, | A-1l data generated FORTRAN pseudo-op, DEFINE, UUO no 020, UUO generates FORTRAN pseudo-op, pseudo-op, data UUO no no data data generated generated June 1972 MACRO ENC., ~-308034, FORTRAN UUO END, pseudo-op , no data generated RELOC, pseudo-op, no data generated REMARK, pseudo-op, no data generated 077, monitor UUO RENAME, 055, monitor UUO EXP, pseudo-op, generates data RERED., 030, FORTRAN UUO RESET., 015, FORTRAN UUO ENTER, ENTRY, pseudo-op, no data generated EXTERN, pseudo-op, no data generated FIN., 021, GETSTS, FORTRAN UUO 062, monitor UUO HISEG, pseudo-op, no data generated IFl, conditional pseudo-op IF2, conditional pseudo-op IFB, conditional pseudo-op IFDEF, conditional pseudo-op IFDIF, conditional pseudo-cp IFE, conditional pseudo-op IFG, conditional pseudo-op IFGE, conditional pseudo-op IFIDN, conditional pseudo-op IFL, conditjonal pseudo-op IFLE, conditional pseudo-op IFN, conditional pseudo-op IFNB, conditional pseudo-op IFNDEF, conditional pseudo-op IN, 056, monitor UUO IN., 016, FORTRAN UUO INBUF, 064, monitor UUO IN., 026, FORTRAN UUO INIT, 041, monitor UUO INPUT, 066, monitor UUO INTEGER, pseudo-op, generates data INTERN, pseudo-op, no data generated IOWD, pseudo-op, generates data IRP, pseudo-op, no data generated IRPC, pseudo-op, no data generated 1ALL, pseudo-op, no data generated LIST, pseudo-op, no data generated LIT, pseudo-op, generates data 1..0C, pseudo-op, no data generated LOOKUP, 076, monitor UUO MTAPE, 072, monitor UUO MLOFF, pseudo-op, no data generated MLON, pseudo-op, ho data generated REPEAT, pseudo-op, no data generated RIM, pseudo-op, no data generated RIM10, pseudo-op, no data generated RIM10OB, pseudo-op, no data generated RTB., 022, FORTRAN UUO SEARCH, pseudorop, no data generated SETSTS, 060, monitor UUO SIXBIT, pseudo-op, generates data ' SLIST., 025, FORTRAN UUO SQUOZE, same as RADIXS50 STATO, 061, monitor UUO STATUS, 062, monitor UUO STATZ, 063, monitor UUO sTOPI, pseudo-op, no data generated SUBTTL, pseudo-op, no data generated SUPPRESS, pseudo-op, no data generated SYN, pseudo-op, no data generated TAPE, pseudo-op, no data generated TITLE, pseudo-op, no data generated TTCALL, 051, monitor UUO TWOSEG, pseudo-op, no data generated UGETF, 073, monitor UUO UJEN, 100, monitor UUO UNIVERSAL, pseudo-op, no data generated USETI, 074, monitor UUO USETO, 075, monitor UUO VAR, pseudo-op, generates data WIB., 023, FORTRAN UUO XALL, pseudo-op, no data generated XLIST, pseudo-op, no data generated XWD, pseudo-op, generates data 7, pseudo-op, generates data .CREF, pseudo-op, no data generated .XCREF, pseudo-op, no data generated .HWFRMT, pseudo-op, no data generated .MFRMT, pseudo-op, no data generated MTOP., 024, FORTRAN UUO NLI., 031, FORTRAN UUO NLO., 032, FORTRAN UUO NOSYM, pseudo-op, no data generated OCT, pseudo-op, generates data OPDEF, pseudo-op, no data generated OPEN, 050, monitor UUO ouT, 057, monitor UUO ouT., 017, FORTRAN UUO OUTBUF, 065, monitor UUO QUTF., QUTPUT, 027, FORTRAN UUO 067, monitor UUO PAGE, pseudo-op, no data generated PASS2, pseudo-op, no data generated PHASE, pseudo-op, no data generated POINT, pseudo-op, generates data PRINTX, pseudo-op, no data generated PURGE, pseudo-op, no data generated RADIX, pseudo-op, no data generated RADIX50, pseudo-op, generates data RELEAS, 071, monitor UUO VERSION 47 JUNE 1972 ~309- A. 2 MACHINE MNEMONICS The following MACRO AND OCTAL CODES are machine mnemon ics and corresponding oct al codes: ADD 270 ADDB CAMGE 273 315 CAML FSBRI 165 313 156 572 CAMLE FSBRM HRREM 271 311 HRRES HLL HRRM MOovMm 400 254-4, 541 CLEAR HALT - HRRI MOVES 316 132 573 CAMN FSC .. 500 542 HRRO MOvMI 560 215 MOvMM SETOB 477 216 TLN SETOI 601 475 TLNA 605 ADDI| ADDM 272 AND 404 MOVEM 202 214 SETMI 415 SETMM TLCA 645 416 SETO TLCE 643 474 TLCN 647 ANDB 407 ANDCA CLEARB 410 403 HLLE 476 400 SETZB 607 7-20 533 211 TLNN HLLES MOVN!I SETZ 603 563 210 TLNE HRROS MOVN 7-24 532 562 SETOM HLLEM HRROM 217 402 631 MOVMS CLEARM HLLE! HRROI 413 401 530 ANDCAB CLEARI HLLI 501 ANDCAI 411 ANDCAM CONI 412 CONO | ANDCB 440 ANDCBB CONSO 443 7-34 CONSz HLLM 7-30 502 HLLO 520 561 HRRS 543 MOVNM TLO MOVNS. SETZI 661 550 212 403 HRRZ 401 213 TLOA SETZM 665 402 TLOE 663 HRRZ! 551 MOovs 562 204 - MOvsi SKIP 205 330 667 MOvsm SKIPA TLON 206 334 SKIPE 332 TLZA SKIPG 224 337 625 SKIPGE TLZE 335 623 TLZN 627 HRRzZM ANDCB} 441 ANDCBM DATAI 442 7-04 HLLOI DFN HLLOM HRRZS 420 7-14 521 ANDCM DATAOQ 131 522 HLLOS 18P 523 133 IDIV MOvVSS 230 MuUL ANDCMB 423 Div 234 HLLS ANDCM! 421 ANDCMM Divs 422 237 Divi HLLZ 235 HLLZ! +603 511 1DIvB 233 iDIVI 231 MuLs 227 MuULI SKIPL MULM SKIPLE 226 333 640 232 225 TRC IDIVM SKIPN TRCA 336 644 TRCE AND/{ 405 ANDM DIVM 206 236 DPB HLLZM 137 b12 HLLZS 1DPB 513 136 ILDB 134 AOQOBJN 253 AQBJP EQV 252 444 HLR AQJ EQvVB 340 447 HLRE AQJA EQvV) 344 445 AQJE EQVM HLRE! 342 EXCH 250 HLRES AQJG 347 FAD AQJLE FADB FADL HLRI AOQJL 345 341 140 343 FADM 346 FADR AOQOJGE AOJN AQS 350 AQSA 364 FADRI 352 AOSG FADRM 357 AOSGE FDV 355 FDVB AOSL 351 AQOSLE FDVL 353 AOSN FDVM 366 ASH FDVR 240 ASHC FDVRB 244 FDVRI BLKI 7-00 BLKO FDVRM 7-10 FMP BLT * 251 CAl FMPB 300 FMPL 304 FMPM CAIA CAIE 302 HLREM HLAM HLRO HLRO! 144 FADRB AQSE CAIG 307 FMPRB 305 FMPRI CAIL 301 FMPRM CAILE 303 FSB HLROM HLROS HLRS HLRZ HLR2I HLRZM HLRZS HRL HRLE HRLE! HRLEM HRLES HRLI HRLM HRLO HRLOI FMPR CAIGE HRLOM HRLOS HRLS HRLZ 150 HRLZI CAIN 306 CAM FSBB 310 163 FSBL HRLZM CAMA 314 161 FSBM HRLZS 1652 HRR CAME 312 CAMG FSBR 317 154 FSBRB HRRE 157 HRREI VERSION 47 644 577 621 331 642 OR 434 ORB S0J 437 360 SOJA TRCN 364 646 TRN 600 IMUL 220 IMULB ORCA 223 IMULI 221 ORCAB 457 SOJG ORCB 470 361 606 434 SOJL TRNN I0R 456 365 602 ORCAM SOJGE TRNE 222 455 367 IMULM ORCAI SOJLE 363 TROA 664 SOJE TRNA 660 IORB A37 I0RI. ORCBB 435 473 SOJN TROE 436 471 366 I0ORM ORCBI ORCBM S0s 472 370 TRON SOSA 374 666 SOSE TRZ - 372 620 TRZA SOSG 377 624 TRZE 622 JCRY .255-6, JCRYO ORCM 256-4, ORCMB 467 ORCMI 465 JCRY1 255-2, JEN 264-12, JFCL JFFO 243 JFOV 255-1, Jov ORCMM ORI QRM POP 255-10, POPJ JRA JRST 254 PUSH. PUSHJ JRSTF 254-2, JSA ROT 266 ROTC Jsp 265 RSwW JSR 264 Jump 320 - SOSGE 376 SOSL TRZN an 626 SOSLE TSC 373 651 TSCA 376 TSCE 274 653 TSCN 657 SUBB 277 SUBI TSN 611 275 TSNA 615 276 ‘TDC TSNE 650 613 TDCA TSNN 654 617 TSO 671 TDCE 662 TSOA 656 TSOE 673 610 TSON 677 182 612 631 TSZA 635 SETA 424 SETAB TDCN 427 TDN JUMPA 324 JUMPE SETAI 322 425 SETAM TONA 426 TDNE JUMPG 327 JUMPGE 325 JUMPL 321 675 SETCA 450 SETCAB TDNN 453 616 TDO TSZE 451 670 633 SETCAI TDOA TSZN 674 637 UFA 130 256 JUMPLE 323 JUMPN SETCAM 326 452 SETCM TDOE 460 672 TDON XCT 676 XOR LDB 655 SOSN suB SUBM 7-04 662 135 LSH SETCMB 242 463 SETCMI TDZ 433 SETCMM TDZA XORB 246 461 630 LSHC 462 634 TDZE XORI 431 632 XORM 432 MOVE 200 MOVEI 201 SETM 414 SETMB TDZN 417 636 TLC 641 JUNE 1972 -311- MACRO Appendix B Summary of Pseudo-Ops B.l1l PSEUDO-OPS A list of pseudo-ops and_their'functions follows: ARRAY Reserve ASCIT Seven-bit ASCIZ - multiple ASCII of storage. test Seven-bit ASCII at words test, end with null character guaranteed , ASUPPRESS Turns BLOCK Reserves BYTE Input COMMENT No binéry‘produced; éame as seven-bit ASCII DEC Input DEFINE Defines DEPHASE Terminates END Last ENTRY Entry point EXP Input expressions EXTERN Idenfifies éxtérnal symbols VERSION 47 on suppress bit block storage bytes of of decimal length for all symbols cells 1-36 bits numbers macro PHASE statement relocation mode of for the program subroutine B'fl library June 1972 ~312- MACRO HISEG Load INTEGER Reserve INTERN Define internal IOWD Set I/0 IRP Indefinite repeat of macro IRPC Indefinite repeat of one LALL List all; LIST List in LIT Assemble LOC Assign MLOFF Turn off multiline MIL.ON Turn on multiline NOSYM Suppress ocT Input OPDEF into up high one segment word of storage argument symbols transfer expanded normal per word arguments character listing of macros mode literals absolute symbol octal addresses literal literal table feature feature listing numbers Defines user-created operator; generates only one word PAGE Start a new PASS?2 Terminates cessed listing page pass pass 2 1, remaining statement are pro- only PHASE Following coding relocated at execution time POINT Sets PRGEND Allows multiprogram assemblies, PRINTX Output on terminal or up byte pointer word end one such program listing device the rest of the line PURGE Remove RADIX Sets RADIX5Y Compresses RELOC Implied first statement; REMARK Comments only statement REPEAT Repeat times RIM Prepare RIM1g Absolute, unblocked, RIM12B Absolute, blocked, VERSION 47 symbol from prevailing n table radix to 36-bit words, output in 2-10 primarily assigns RIM paper-tape output for system use relocatable addresses format format; no checksummed output checksums format JUNE 1972 MACRO -313- Suppress listing of macros; SALL binary generated lists only call and " SEARCH Opens symbol SIXBIT Input text SQUOZE Same STOPI Stop indefiinite repeat of macro arguments SUBTTL Subtitle on listing SUPPRESS Turns on suppress bit fpr épecified symbols SYN Make synonymous TAPE . Stop processing as tables in Title TWOSEG- Assembles UNIVERSAL Makes VAR Assemble on 50 and 6-bit program ASCII above | the listing symbol universal compressed RADIX TITLE of current and loads table to file DDT two segment available variables programs to other programs suffixed with # or ARRAY or INTEGER XALL Stop expanded XLIST Stop listing XPURGE Purges XWD Input two 18-bit Z Input zero word .CREF Resume « XCREF Stop output of CREF . HWFRMT List binary in half word . MEFRMT List binary in multi-format B.l.1 These Conditional conditional sembled if the local conditions symbols outout Assembly assembly listing, pf resume on pass words CREF information information format statements in the in second the (new) first 1 IF2 Encountered pass 2 IFB Blank IFDEF Defined. iFDIF Different during column are as- column exist. pass | (old) Statements Encountered during IFE list mode 2 half IF1 VErRsION 47 normal Zero | June 1972 MACRO -314IrG Positive IFGE Zero, IFIDN Identical IFL Negative IFLE Zero, IFN Non-zero TFNB Not blank IFNDEF Not defined VERSION 47 or or positive negative June 1972 -315- MACRO Appendix C Summary of Character Interpretations The characters indicated. appear in listed below have These text special meaning interpretations strings, or in Character do in not apply when Immediately labels. Semicolon. all all LABEL: comments. Point. Has current value of the location counter or indicates floating point number. Comma. General References comma is Delimits Inclusive AND operand or argument : Accumulator VERSION 47 these characters Example- follows Precedes delimiter. OR contexts comments. Meaning Colon. & the : field delimiter. accumulator 0. optional. macro The sTHIS IS Z A COMMENT JRST .+5 FIVE LOCATIONS JUMP FORWARD 1.9 DEC 14,5,6 EXP A+B,C-D MOVEI 1,TAG MOVEI ,TAG MACRO (A,B,C) : arguments. Logical Operators June 1972 -316- MACRO * / + Example Meaning Chatacter Multiplication Arith- Division metic Operators (+A outputs the value of A) Add Subtract lst character of text string B In ASCII, ASCIZ and SIXBIT comment text strings, the first non-blank character is the delimiter. Follows number to be shifted and precedes binary shift count. Exponent. ponent in () ASCII/STRING/; Precedes decimal exfloating-point numbers. Enclose index fields. Parentheses. Enclose the byte BYTE size in 7B2 F22.1E5 EXPONENT IS 5. MOVEI A, (SIXBIT/ABC/) BYTE statements. (7) ADD AC1,X (6) 8, 8, 7 DEFINE MAC(A,B,C) Enclose the dummy argument string in macro DEFINE statements. In an expression, Angle brackets. enclose a numeric gquantity. In conditional assembly state- ments, contain a single argument, and the conditional <A-B+5¢@/C> IFl, TAX MOVE AC@, coding. In REPEAT statements, con- tain coding to be repeated. enclose the macro In macros, Square brackets. Delimit literals. it i In OPDEF statement, contain new operator; in ARRAY the size. Equal sign. Direct assignment. Equal sign. Direct assignment but no output to 3, DEFINE PUNCH DATAQO PTP, definitinn. L] <SUB REPEAT DDT. Direct asEqual sign and colon. signment but automatically made 17, TAG> PUNBUF ADD 5,[MOVEI 3,TAX] OPDEF CAL [MOVE] ARRAY FOO[212] SYM=6 SYM-A+B¥D SYM==6 FLAG=:200 internal. Colon and exclamation point. assignment of DDT, VErRs1ON 47 label, Direct no output ! LABEL: to and automatically made internal. June 1972 (4) MACRO -317- il Il Character Meaning Equal sign ment, no and ically made Double Direct put to colon. output Direct DDT, and assign- colon and exclamation point. assignment of DDT, and label, NAME: :! no out- automatically made Quotation marks enclose 7-bit ASCII text, right justified, from one to five characters. ‘ "ABCDE" Single quotation marks enclose 6bit ASCII text, right justified, '"TABLES' from one Number as a to six sign, tag. characters. Defines a symbol used ADD ex- MOVE @ ,JOBREL## of generating symbols. Apostrophe or single quote. Concate- nation character, used within macro definitions or SIXBIT data. Reverse first a slash. If used character of macro call, the as value of the Control left ation. Left arrow. right) M bit arrow. Line DEFINE MAC (A,B,C); <JUMP'A B, IF A=5g@g, in GENERATES fol- ASCII THREE continu- left (or Indicates indirect addressing. the indirect bit in an instruction to be set. 100+3=1004 1p@«+3=10 MOV AC,@ADDR JuNE 1972 THIS T7-BIT CHARACTERS, ASCII/528/ : N M shift N positions, C> 'SIXBIT! MAC \ A the an argument lowing symbol is converted to an ASCII symbol in the current radix. Causes 3,TAG# Variable. Alternate method ternal VERSION U7 LOOP==:32 automat- internal. internal. ## to Example -319- MACRO Appendix D Storage Allocation MACRO allocates 1) the All is the and Most symbols a in symbol half sented either by the symbol). The a and the a top etc., table SIXBIT. value less words -1) two low segment grow upward two words in the right 18 free 1dng. is (.JBREL) The flags bits symbol and so table. can valfie stored in a to this value stored in the in free storage, be the 1 is the sixbit name word left of the repre- in symbol first symbol. with word last referencé_in'a chain of refer ences second first in Symbols the words space half. so that additive global fixups can be output. VERSION 47 from second word than in the have pointer have of are pointer two symbols and macro names) The or (e.g., symbols value (i.e., in directions: (user symbol value have just storage External the two from literals, name 36—bit va%ue free downward Macros, entries in symbol table grows 2) storage is table. the. to the This is JUNE 1972 -320- MACRO . Opdefs tend to have 36-bit values and are stored like other 36bit value symbols. er Macro names are stored in the symbol table, the value is a point to the stored text string. s The text string is stored in four (assembly parameter) word block which have the general form 1) 1link to next block, [¢ if last] ,, 2 characters 3) 4) 5 characters 5 characters 2) 5 characters However, the first such block is special 1) 2) 3) 4) 1link to next block ., link to last block ference pointer to default arg; ,. <number or args expected><+9+re count cters chara 5 5 characters e The number of args expected is the number of arguments in the defin statement. The reference count is incremented when the macro is called and decremented when exiting from the macro. When this count goes to zero the macro is removed from free space. block, The actual arguments to a macro are stored in the same linked are also pbut are not in the symbol table. Repeats (2 or more times) macro stored the same way. The text blocks are removed when the to gone has exits or the repeat exits since the reference count zero. own The addresses of the actual argument blocks are stored in a pushd stack in order of generation. free Default arguments are stored the same way except the list is in left core. The pointer to this default arg list is stored in the . half of the second word of the first block of the macro definition ents are re- The text body is stored as is, except that dummy argum placed by special symbols. VERsION 47 JuNe 1972 MACRO -321- The ASCII character RUBOUT (177) is used to signal a special character text. These characters are 291 gg2 293 a4 ;end of macro ;end of dummy symbol ;end of Repeat send of IRP or IRPC If the character is 4<ch<77 it is illegal. If the character is <100 then it is a dummy symbbl, the value of the character is ANDed with 37 to get the dummy symbol number and the corresponding pointer retrieved from the stack of pointers. If th- symbol was not specified (i.e., no pointer) then if the 40 bit is on this is to be a created symbol and one is created, otherwise the argument is ignored. Verbose macros can eat up a lot of storage space. Literals are stored in four words/block per word generated (three words if old format used). Words are -3 -2: -1:. g form word relocation bits code pointer to next The pointer points to the g word of the next block. the generated code. The code is Relocation is either the relocation bits f# or 1 per half word or external pointers if externs used. Form word is the word used for listing, this word is not checked when comparing literals so that different forms that produce the same code are classed as equal. Long literals are both slow and take up extra storage, they should be written as subroutines or inline. Single quotes can also be used to indicate SIXBIT words, however, one pair of single quotes is removed by the assembler if the pair encloses a dummy argument. VERSION 47 For example, in the macro D-3 JuNe 1972 MACRO B A, is ~322- not DEFINE SXBT MOVSI 1,"A" MOVSI 2,"B" a dummy however, is a quotes since by assembler. the VErRsION 47 one argument dummy pair (A)< so it can be argument and must of quotes (the enclosed be inner in single quotes. enclosed pair) will in double be removed June 1972 ~323- MACRO Appendix E Text Codes This appefidix contains a summary of MACRO=-10 text codes. SIXBIT Character ASCII 7Bit* ASCII 7 Bit* Character ASCII 7Bt 00 Space 040 40 01 l 041 41 @ 100 b 140 A 101 a 02 03 " # 042 42 141 43 B C 102 b 142 04 $ 044 44 D 104 d 144 043 SIXBIT . - Character 103 c 143 05 % 045 45 E 105 e 145 06 & 046 46 F 106 f 146 07 ' 047 47 G 107 g 147 10 ( 050 50 H 110 h 150 11 ) 051 51 ! 11 i 151 152 12 * 052 52 J 112 i 13 + 053 53 K 113 k 153 14 , 054 54 L 114 | 154 15 - 055 55 M 115 m 155 16 . 056 56 N 116 n 156 17 / 057 57 o) 117 ) 157 160 20 0 060 60 P 120 p 21 ] 061 61 Q 121 q 161 22 2 062 62 R 122 r 162 23 24 3 4 063 064 63 64 S T 123 124 s t 163 164 25 5 065 65 U 125 u 165 26 6 066 66 \' 126 v 166 27 7 067 67 w 127 w 167 170 30 8 070 70 X 130 X 31 9 071 71 Y 131 y 171 32 : 072 72 z 132 z 172 33 ; 073 73 [ 133 i 173 34 < 074 74 \ 134 | 174 35 = 075 75 ] 135 } 175 36 > 076 76 t 136 ~ 176 37 ? 077 77 -— 137 Delete 177 *MACRO=-10 also accepts five of the 32 control codes in 7-bit ASCII: Horizontal Tab Line Feed VERSION 47 011 012 Vertical Tab Form Feed 013 014 Carriace Return arriag v 015 JuNe 1972 -325- MACRO Appendix F Radix 50 Representation Radix into 508 32 representation bits. scending order is used Each character from left to of condense a to right; code for 6-character symbols subscripted in de- symbols of the symbol is i.e., the ’ radix are form LLLLLL 6 45321 If C is generated by denotes the octal the L the 50 8 representation following ((C((C #5040, a* ) 50 50%C ) )+ #5040, C5 ) *5p+C ) where The all code numbers numbers are octal. corresponding Code to the characters (Octal) Characters 00 01-12 Null 13-44 . 46 47 top octal four number VERSION 47 bltS character 0-9 A-Z 45 The are: S % are (i.e., taken from the four leftmost bits of a 6- bit g4-74). F-1 | June 1972 MACRO ~327- Appendlx G Summary of Ruies for | | Defmlng and Calling Macros G.1 ASSEMBLER INTERPRETATTION MACRO-lO/assembles‘macros by direct and immediate character substitu- tions. When a macro call is encountered, _in any field, the character substitution is ‘made, continues its last the characters are processed, scan w1th argument, the except when character it is can appear any number of times on a G.2 G.2.1 following delimited by a the and the assembler delimiter semicolon. of the Macros line. CHARACTER HANDLING Blanks A macro symbol is delimited by one blank or onefitab; the character following the delimiteis r the start of the argument string even if it is also a blank or tab. Other than the first delimiter, blanks and tabs are treated as standard characters in the argument string. G.2.2 Angle Brackets brackets are only significant in the argument fields first character of any field is a left angle bracket. VErRs1ON 47 if the 1In this case, JUNE 1972 G-1 -328- MACRO no terminator or parenthesis tests are made between the left angle bracket and its matching right bracket. The matching brackets are removed from the string but the scan continues until a standard delimiter G.2.3 is found. Parentheses Parentheses serve only to terminate an argument scan. They are significant only when the first character following the blank or 1In this case, the left parentab delimiter is a left parenthesis. thesis is removed and, if it matching right parenthesis is encoun- tered prior to the normal termination of theargument scan, it is removed and the G.2.4 scan discontinued. Commas When a comma is encountered in an argument scan, it acts as the delimiter of the current argument. If it delimits the last argument, the character following it will be the first scanned after the subsitution is processed. G.2.5 Semicolons When a semicolon is encountered in an argument scan, the scan is If an argument has not been satisfied, the remainder discontinued. It is saved, however, and will be the first is considered null. character scanned after the substitution is made, normally acting as a comment G.2.6 flag. Carriage Return A carriage return, except when pre-empted by angle brackets (see Section G.2.2), will terminate the scan similar to the semicolon. This can be circumvented, if desired, by the control left arrow key described elsewhere. G.2.7 Back-Slash If the first character of any argument is a back-slash, it must be directly followed by a numeric term., The value of the numeric term is broken down into a string of ASCII digits of the current radix, just the reverse of a fixed-point number computation. VERSION 47 The value is June 1972 -329- MACRO considered to be a 36-bit positive number having a value of 0 to 777777 777777. Leading zeros are suppressed except in the case of 0, in which case the result is one ASCII 0. The ASCII string is substituted and the scan continued in the normal manner (no implied . terminator) The default listing mode ‘is XALL, in which case the initial macro call and all lines within its range that produce binary code are listed. The pseudo-op LALL will cause all lines to be listed. Substituted arguments are bracketed by *'s by the assembler. G.3 CONCATENATION The rule for concatenation is as follows: For each string of apostrophes, one is removed if and only if it is next to (either before or after) a dummy argument to that macro. VERSION 47 - June 1972 -331- MACRO Appendix H Operating Instructions H.1 The REQUIREMENTS following are MACRO-10 Minimum Core Additional operating 7K pure plus Core from the input device output and is Reference DIS additional timesharing two output The impure One output H.2 1K Automatically requests ments Equipment requirements: (source devices program (machine core monitor as assign-~ needed. input); language up to program listing output). If the listing to be used as input to the Cross (CREF) program, it must not be TTY, or ' LPT. INITIALIZATION following are VERSION 47 commands and corresponding indications: R MACRO) Loads the MACRO-10 Assembler into core.. * The Assembler | is ready to receive | a command. June 1972 -332- MACRO H.3 COMMANDS H.3.1 General MACRO-10 Command Format general commands are as follows: objprog-dev:filename.ext,list~dev:filename.ext source-dev:filename.ext,...... source-n) objprog-dev: The device on which the object program is to be written. MTAn: DTAn: PTP: DSK: list~-dev: (magnetic tape) (DECtape) (paper-tape punch) (disk) The device on which the assembly listing is to be written. MTAn: (magnetic DSK: (disk) TTY: (Teletype) of these if input to CREF! (paper-tape punch) PTP: from which the source-program The device(s) input Must be one (line printer) LPT: source-dev: tape) (DECtape) DTAn: to assembly MTAnN: CDR: is to be read. (magnetic tape) (card reader) (DECtape) DTAn: DSK: (disk) (paper—-tape reader) PTR: TTY: (Teletype) If more than one file is to be assembled from a magnetic tape, card reader, or paper tape reader, dev: is followed by a comma for each file beyond the first. Input via the Teletype is terminated by typing CTRL Z (4%Z) to enter pass 1l; the entries must be retyped at the beginning of pass 2. filename.ext (DSK: and DTAn: The filename and filename extension of the object only)program file, the listing file, and the source file(s). The object program and listing devices are separated from the source device by the left arrow H.3.2 symbol. Disk File Command Format MACRO-10 disk file commands DSK:filename.ext are as follows: [proj,prog] 11f /C switch is given, but no list-dev: Version 47 He2 is specified, DSK:CREF.CRF is assumed. June 1972 MACRO -333- the d@sk Project-programmer number assignede to file(s) if [proj,prog] area to be searched for the sourc other than the user's project-programmer number. The installation standard protection is assigned to any disk file specified as output. NOTE If object coding output is not desired (e.g., a program is being scanned for source language errors), objprog-dev: is omitted. TIf an assembly listing is not desired, list~dev: is omitted. If device is not specified, DSK is assumed. Examples: .R MACRO) ¥DTA3:0BJPRG,LPT: CDR ) Assemble one source program file from the card reader; write the object code on DTA3 and call the file OBJPRG; write the assembly listing on the line printer. ‘ END OF PASS 1) The source program cards must be manually re- 22 ERRORS DETECTED) PROGRAM BREAK IS ##2537) Number of source errors; size of object pro- ¥ C) Return to the monitor. .R MACRO) Assemble the next three source files located NO ERRORS DETECTED) PROGRAM BREAK IS @#3552) MTA2 for later printing. 2K CORE USED) FMTA3: ,MTA2: MTAl:, ) — fed for pass 2. gram; core used by assembler. at the present position of MTAl; write the object program on MTA3; write the listing on 2K CORE USED) e il ¥ LPT: DTAl:FILE1l,FILE2,FILE5) Assemble the source files named FILEl, FILEZ2, and FILES5 from DTAl; produce no object coding; — NO ERRORS DETECTED) PROGRAM BREAK IS #@1427) 2K CORE USED) | ____f_,*—DSK:FILEl.MAC[lM,lZ]) NO ERRORS DETECTED) PROGRAM BREAK IS @@@5hi 2K CORE USED) { write the listing on the line printer. . Scan the source program called FILE1l.MAC, located in area 14, 12 on the disk, for source language errors; produce no object coding or assembly listing; print all error diagnostics on the terminal. Return to the monitor. f_+C> .R MACRO ¥MTAL: ,2ITTY: TTY :) : R) JMP AOS R: JFCL) G: G) END) ' VErs1oN 47 JMP the object code program on MTAl and print the assembly listing on the terminal. Terminate input. ‘l‘Z) END OF PASS Assemble a source file from the terminal; write R Reenter terminal input. Type first statement again. He3 June 1972 MACRO -334- .MAIN MACRO 0 poA808 E: AOS 18:14 BIBOIE BELIBL! JMP G 208881 G: 2@-DEC-67 PAGE1) Page heading. R) First assembled. : 350008 @epdp2’ R: A0S Reenter second. G) Second agssembled, JFCL) Reenter third. geges2 255200 200099 G: JFCL) Third END)) assembled. Reenter END) fourth. Fourth assembled. e s e ?1 ERROR DETECTED) PROGRAM BREAK .MAIN MACRO ¢ gagea2"y) SYMBOL R IS . Typeout of symbol gg#gs3) table. 14:14 ° 2@-DEC-67 PAGE2) TABLE) 200891') L_2K CORE USED) 21C) H.4 Return to the monitor. SWITCHES (NI © PREN 0 B NI o) Switches . are used Magnetic Macro to tape call Listing Pushdown specify options as: control expansion suppression list expansion Cross-reference file All switches are preceded and usually occur prior VERSION 47 such to by output. a the slash (/) left arrow or enclosed (see Table in parentheses, H-1). JUNE 1972 -335- MACRO Table H-1 MACRO-10 Switch Options Switch - Meaning Advance magnetic tape reel by one file. Backspace magnetic tape reel by one file. Produce listing file in -a format acceptable as input to CREF; unless the file is named, .CRF 1is appear CREF. CRF is assigned; between assigned as the filename; if no list-dev: is specified, the conmma List macro expafisibns and the if no extension is given, DSK: is assumed. /C must left-arrow. (same function as LALL pseudo—oé). New format for output binary listing (.MFRMT pseudo-op) . 0ld format for output binary listing Print Help text (i.e., (.HWFRMT pseudo-op) . this list of switches and explanations). Reinstate listing‘(used after list suppression by either the XLIST pseudo-op or 5 switch). List only call, no binary, in macro expansion (same .SALL pseudo-op). Suppress Sets error printouts on the terminal. the pseudo-op MLOFF which allows literals tb occupy on line. a single This means literals may be terminated with a carriage return, line feed instead of a right bracket. Increase the size of .the pushdown list. many times as locations; each /P desired (pushdown increases its list is This switch may appear as initially set to a size of 8010 size by 8010). left of the left arrow. /P must appear on thé Suppress Q (queétionable) error indications on the listing; Q messages indicate assumptions made during pass of the l. /Q must appear on the left left-arrow. Suppress listing (same function as XLIST pseudo-op). Skip to the logiéal end of the magnetic tape. Rewind the magnetic tape. Suppress all macro expansions (same function as XALL pseudo-op). Zero the DECtape directory. NOTE Switches A through C and T, W, X, and 2 must immediately follow tle device or file to which the individual switch refers. VERSION 47 JUuNe 1972 -336- | MACRO Examples: .R MA(H%O) . ¥MTALl:,DTA3: ,/C«PTR:) END OF PASS 1) bssemble one source file from the paper tape reader; write the object code on MTAl; write the assembly listing on DTA3 in crossreference format and call the file CREF.CRF. The paper tape must be re-fed by the operator for pass —9?3 ERRORS DETECTED) PROGRAM BREAK IS @@g4gl) 2. End-of-assembly messages. __ 2K CORE USED) ¥DTA2:ASSEMB.ONE/Z,LPT: MTAL:/W,) - NO ERRORS DETECTED) PROGRAM BREAK IS #@5231) __3K CORE USED) *MTALl:/W,LPT:«MTA3: /W, (AA),(BB)) 21 ERROR DETECTED,) Rewind MTA4 and assemble the first two source files on it; write the object code on DTAZ2, after zeroing the directory, and call the file ASSEM.ONE; write the assembly listing on the line printer. Rewind MTAl and MTA3 and assemble files 1, 4, and 3 (in that order) from MTA3; print the assembly listing on the line printer; write the object code on MTAL. PROGRAM BREAK IS p@@655) __2K CORE USED) ¥F00,/C FOO) NO ERRORS DETECTED) PROGRAM BREAK IS @@@765) Assemble source file FOO on DSK:; write the assembly listing on DSK in cross-reference 2K CORE USED) ject code on DSK calling it FOO.REL. ¥4C) Return to the monitor. VERSTON 47 format calling the file CREF.CRF. Write ob- June 1972
Home
Privacy and Data
Site structure and layout ©2025 Majenko Technologies