Digital PDFs
Documents
Guest
Register
Log In
AA-V027A-TC
March 1983
238 pages
Original
72MB
view
download
OCR Version
35MB
view
download
Document:
PDP-11 MACRO-11
Language Reference Manual
Version 5
Order Number:
AA-V027A-TC
Revision:
0
Pages:
238
Original Filename:
OCR Text
PDP-11 MACRO-11 Language Reference Manual AA-V027A-TC March 1983 This document describes how to use the MACRO-11 relocatable as- sembler to develop PDP—-11 assembly language programs. Although no prior knowledge of MACRO-11 is required, the user should be familiar with the PDP-11 processor addressing modes and instruction set. This manual presents detailed descriptions of MACRO—-11’s features, including source and command string control of assembly and listing functions, directives for conditional assembly and program sectioning, and user-defined and system macro libraries. The chapters on operating procedures previously were found in two separate manuals (the PDP-11 MACRO-11 Language Reference Manual and the IAS/RSX MACRO-11 Reference Manual). This manual should be used with a system-specific user’s guide as well as a Linker or a Task Builder manual. This manual supersedes previous editions, Order Numbers AA-5075B-TC, published 1980, AA-5075A-TC, published 1977, and DEC-11-OIMRA-B-D, published 1976. Operating System: VAX/VMS Version 3 RSTS/E Version 8 RSX-11M Version 4 RSX-11M-PLUS Version 2 Software: MACRO-11 Version 5 To order additional documents from within DIGITAL, contact the Software Distribution Center, Northboro, Massachusetts 01532. To order additional documents from outside DIGITAL, refer to the instructions at the back of this document. digital equipment corporation - maynard, massachusetts First Printing, August 1977 Revised, January 1980 Updated, December 1981 Revised, March 1983 The information in this document is subject to change without notice and should not be construed as a commitment by Digital Equipment Corporation. Digital Equipment Corporation assumes no responsibility for any errors that may appear in this document. The software described in this document is furnished under a license and may be used or copied only in accordance with the terms of such license. No responsibility is assumed for the use or reliability of software on equipment that is not supplied by DIGITAL or its affiliated companies. © Digital Equipment Corporation 1977, 1980, 1981, 1983. All Rights Reserved. Printed in U.S.A. A postage-paid READER’S COMMENTS form is included on the last page of this document. Your comments will assist us in preparing future documentation. The following are trademarks of Digital Equipment Corporation: dlilgliltiallM DEC MASSBUS UNIBUS DECmate DECsystem—10 PDP P/OS VAX VMS DECSYSTEM-20 DECUS DECwriter Professional Rainbow RSTS VT Work Processor DIBOL | RSX M19400 o CONTENTS Page ix PREFACE 2 NN NN MACRO-11 w N~ & s o * ] N . SET SYMBOLS Permanent Symbols User-Defined and Macro * . * MACRO-11 L * EXPRESSIONS Separating and Delimiting Characters Illegal Characters Unary and Binary Operators LOCAL ASSIGNMENT SYMBOLS L L - LOCATION TERMS EXPRESSIONS AND ADDRESSING MODES W B CURRENT * Symbols STATEMENTS SYMBOLS NUMBERS » LANGUAGE LINKING REGISTER MODE REGISTER DEFERRED AUTOINCREMENT COUNTER MODE MODE AUTOINCREMENT DEFERRED AUTODECREMENT MODE AUTODECREMENT DEFERRED INDEX MODE INDEX DEFERRED IMMEDIATE Y DWW 0D TNNBWN NN . CHARACTER . L] AND ASSEMBLY =00 IN CONTROL == FORMAT wwwmw%:wuwwm N I | I I I WA [] » | |] L ] Field Field Operand Field Comment Field REGISTER @ CONVENTIONS Label DIRECT & AND Operator SYMBOLS |J STANDARDS FORMAT L WWWW FORMAT wn WWWWWLWWWWWW PROGRAM MODE MODE iii MODE MODE YN S R WNN L N N 1 PASS PROGRAMMING s CHAPTER PASS RELOCATION Lot in CHAPTER ASSEMBLER ASSEMBLY STATEMENT 3 5 CHAPTER FORMATTING ASSEMBLY PROGRAMMING s II L] PART AND MACRO-11 SOURCE * NRONNDNOMNND CHAPTER ASSEMBLY THE 1 b CHAPTER MACRO-11: OO I ] PART DEFERRED BRANCH 5.14 USING MACRO-11 DIRECTIVES 6 GENERAL ASSEMBLER LISTING CONTROL . . |] DO~ WN - - 6-4 Directives 6-9 6-15 DIRECTIVES Radix 6-23 Characters Control 5-28 6-29 Control Operator Unary Radix Control Directives FACILITIES Control Operators and Operators Unary NN » s e D Y s S & + N » e » s s 8 & &8 = .PSECT Directive Creating Program = ® o s N DN W » et e » s . s & s M * ® s " b "N = & ® DIRECTIVE: Memory or o b » D Zxs W * & DIRECTIVES Data .END 5-38 6-38 6-39 DIRECTTIVE Sections 6-45 6-41 Sharing 6-47 Considerations 6-48 6-49 DIRECTIVES ASSEMBLY 6-51 6-51 6-52 DIRECTIVES 5-53 Conditional Assembly Block Directives Subconditional Assembly Block Directives FILE Conditional CONTROL .LIBRARY . INCLUDE DIRECTIVES Directive Directive 1V 6=-47 5-49 .GLOBL Directive .WEAK Directive Immediate 6-40 H-4¢ .ASECT and .CSECT Directives .SAVE Directive .RESTORE Directive CONTROL 6-37 6-38 DIRECTIVES Allocation CONDITIONAL & ® 6-36 CONTROL SECTIONING Code 6-35 Operators: .EVEN Directive .ODD Directive .BLKB and .BLKW Directives .LIMIT Directive SYMBOL 6.10.2 Directives Control °F COUNTER PROGRAM .10.1 Storage Temporary Numeric TERMINATING 6-33 h-34 Floating-Point “C and 6-32 6-32 6-32 Control Operators LOCATION 5-31 h-31 CONTROL and 6-25 6-26 .RADIX Directive Temporary 6-19 6-23 NUMERIC Numeric h-18 6-24 Conversion AND 6=17 6-22 DIRECTIVES .ASCII Directive .ASCIZ Directive .RAD5@ Directive Temporary Radix-50 .PACKED Directive RADIX 6-15 6-16 6-18 .NOCROSS STORAGE ASCII N * ] |4 * ] . 9 » * s s @ s B WWwwWwwwwww DS DIRECTIVES .BYTE Directive .WORD Directive » o DATA s e DIRECTIVES . ENABL and .DSABL Directives Cross—-Reference Directives: .CROSS » N s . s ¢+ o * « & . * . * * FUNCTION & Doy B ADDRESSING INSTRUCTIONS .SBTTL Directive .IDENT Directive .PAGE Directive/Page Ejection .REM Directive/Begin Remark Lines ¢ e+ MODE INSTRUCTION TRAP and (o) o) 16) Ne) JN) Bie) Je) Jo) o) IU)Te) BEG) JRG) BES) TM .LIST and .NLIST .TITLE Directive L] a RELATIVE 5.13 NN e e MODE £ CHAPTER MODE RELATIVE * III ABSOLUTE 5.11 5.12 o) o) Tie ), BEa ) NG ) UG ) Ws ) Wi ) e ) We ) ke ) Wie 2 WRo ) Be) lEe) T ) @) JEG) JE6) JEo) JFe ) o) JE6 ) PART 5.10 Assembly Directive 5-53 65-56 6-59 6-64 6-60 6-61 CHAPTER 7 MACRO DIRECTIVES 7-1 7.1 7.1.1 DEFINING MACROS .MACRO Directive 7-1 7-1 7.1.2 7.1.3 7.1.4 7.2 7.3 7.3.1 .ENDM Directive .MEXIT Directive MACRO Definition Formatting CALLING MACROS ARGUMENTS 7.3.4 7.3.5 7.3.6 7.3.7 7.4 7.4.1 7.4.2 7.4.3 7.5 7.6 7.6.1 7.6.2 7.7 7.8 7.9 1V CHAPTER OPERATING MACRO 7-4 7-4 DEFINITIONS AND MACRO 7-4 7-6 Macro Nesting Special Passing Characters in Macro Arguments Numeric Arguments as Symbols 7-7 7-7 7-8 7-8 7-10 7-11 Number of Arguments in Macro Calls Creating Local Symbols Automatically Keyword Arguments Concatenation of Macro Arguments MACRO ATTRIBUTE DIRECTIVES: .NTYPE .NARG Directive .NCHR Directive .NTYPE Directive . ERROR AND .PRINT DIRECTIVES INDEFINITE REPEAT BLOCK .NARG, .NCHR, DIRECTIVES: .IRP AND . IRPC .IRP Directive .IRPC Directive | REPEAT BLOCK DIRECTIVE: .REPT, .ENDR MACRO LIBRARY DIRECTIVE: .MCALL MACRO DELETION DIRECTIVE: AND .MDELETE 7-12 7-12 7-13 7-14 7-16 7-17 7-17 7-18 7-20 7-20 7-21 PROCEDURES 8 IAS/RSX-11M/RSX-11M-PLUS OPERATING PROCEDURES 8-1 8.1 8.1.1 RSX-11M/RSX-11M-PLUS OPERATING PROCEDURES Initiating MACRO-11 Under RSX-11M/ RSX-11M-PLUS | Method 1 - Direct MACRO-11 Call Method 2 - Single Assembly Method 3 - Install, Run Immediately, and Remove On Exit Method 4 - Using the Indirect Command Processor Default File Specifications MCR Command String Format 8.1.1.1 8.1.1.2 8.1.1.3 8.1.1.4 8.1.2 8.1.3 8.1.4 8.1.5 8.2 8.2.1 8.2.2 8.2.3 8.2.4 8.3 8.4 8.5 CHAPTER IN CALLS 7.3.2 7.3.3 PART 7-2 7-3 DCL Operating Procedures MACRO-11 Command String Examples IAS MACRO-11 OPERATING PROCEDURES Initiating MACRO-11 Under IAS IAS Command String JAS Indirect Command Files IAS Command String Examples CROSS-REFERENCE PROCESSOR (CREF) IAS/RSX-11M/RSX-11M-PLUS MACRO-11 FILE SPECIFICATION ERROR MESSAGES UNDER IAS/RSX-11M/ RSX-11M-PLUS 9 RSTS/RT-11 9.1 MACRO-11 9.1.1 ‘ OPERATING UNDER RSTS RT-11 Through RSTS PROCEDURES | 8-1 8-2 8-2 8-2 8-2 8-3 8-3 8-4 8-8 8-13 8-14 8-14 8-14 8-16 8-16 8-17 8-19 8-20 9-1 9-1 9-1 APPENDIX Error | Messages CHARACTER CHARACTER SET RADIX-5@ CHARACTER MACRO-11 ASSEMBLY SET LANGUAGE PERMANENT SYMBOL CODING LINE STANDARDS b . o+ General W N Registers e W iwWwWwww N et e ¢ & s 2 s 6 & e * & NAMING Hardware Registers Registers Device Registers Processor Priority Symbols Symbol Local Global Macro Symbols Names General Symbols Y MODULES ] LW BN Examples Symbols PROGRAM oD B Purpose Module Module Preface Example Modularity Calling Conventions (Inter-Module/ Intra-Module) | Success/Failure Module L] L] . e & ¢ o e+ s Exiting e & DoHmOoEHDEEEmEm@m | WO WY T =t FORMAT Module L STANDARD COMMENTS The The | (PST) DIRECTIVES SAMPLE B BB R DR DWW WWWWWWWWWWN - TABLE SYNTAX CODES MACRO-11 MESSAGES OECEoRC oo Ec oo oo oo RO R NoNo ol | s 9 « s s & e & e @ * 2 ¢ » s s s s o MODE O O~ ] ADDRESS O OO0 N OP OF m . ASSEMBLER NN » D s www A DIRECTIVES 0O SUMMARY ASSEMBLER SN D APPENDIX AND SPECIAL CHARACTERS ERROR | APPENDIX RT-11 SETS DIRECTIVES APPENDIX | Under mmmmr;:mmmmm I AR d S D WWNDNDN APPENDIX ASCII ve) g N MACRO-11 a Cross-Reference Table Cross-Reference Table Files vy MACRO-11 GENERATION o (VI I o L |J OO O L4 L * (LRGN0, Handling | TABLE OPTION Obtaining BN - OPTIONS (CREF) (I SPECIFICATION %| FILE CROSS-REFERENCE RT-11 - RT-11 O W W RSTS MACRO-11 UNDER COMMAND STRING N Jur Through WO WY N . » s ¢« O W WWLY bW - & RSX INITTATING CODE Checking Indication Routines FORMAT Program Flow Common Exits Code Code with in Interrupts System State INSTRUCTION Inhibited USAGE Forbidden Instructions Conditional Branches PROGRAM SOURCE FILES vi PDP-11 1 2 APPENDIX APPENDIX VERSION NUMBER STANDARD Displaying the Version Identifier Use of the Version Number in the Program F ALLOCATING VIRTUAL MEMORY F.l GENERAL F.2 MACRO F.3 OPERATIONAL G WRITING HINTS AND SPACE-SAVING DEFINITIONS AND GUIDELINES EXPANSIONS TECHNIQUES POSITION-INDEPENDENT CODE G.1 INTRODUCTION G.2 EXAMPLES APPENDIX H SAMPLE APPENDIX I OBSOLETE MACRO-11 DIRECTIVES, SYNTAXQ AND ASSEMBLY LINE POSITION-INDEPENDENT AND CROSS-REFERENCE CODE LISTING OPTIONS I.1 OBSOLETE DIRECTIVES 1.2 OBSOLETE COMMAND J RELEASE NOTES J.1 CHANGES -- J.2 J.3 CHANGES CHANGES AND SYNTAX OPTIOCN Pt LINE ww =~ COMMAND APPENDIX TO ALL VERSIONS OF MACRO-11 -- MACRO-11/RSX VERSION ONLY -- MACRO-11/RT VERSION ONLY FIGURES FIGURE 3-1 Assembly 3-2 Sample Assembly Results 6-1 6-2 Example of Line Printer Assembly Listing Example of Teleprinter Assembly Listing 6-3 Listing Listing Showing Produced with Local Listing Symbol Block Control Directives 6-4 6-5 6-6 6-7 7-1 7-2 Assembly Listing Table of Contents Example of .ENABL and .DSABL Directives Example of .BLKB and .BLKW Directives Example of .SAVE and .RESTORE Directives Example of .NARG Directive Example of .NCHR Directive 7-3 Example 7-4 8-1 G-1 Definition : Example of .IRP and .IRPC Directives Sample CREF Listing Example of Position-Dependent Code of .NTYPE Directive in Macro G-2 Example of Position-Independent Code TABLES TABLE 3-1 Special Characters Used in MACRO-11 3-2 3-3 3-4 3-5 5-1 Legal Separating Characters Legal Argument Delimiters Legal Unary Operators Legal Binary Operators Addressing Modes vii of Listing Symbolic Arguments Directives of Function Symbolic of .PSECT for File Specification Values Specification Options File /C Option Arguments and New Directives viil D | B W0 B D Qualifiers Default N R B Switches NN N Parameter Specification Qualifiers NN R ] D ‘DCL I WN Command O0ld HaN o pd 0 - Conditional Directives File O Directive Values N Tests Control DCL I 0N Default Control MACRO-11 N | 5 6 Subconditional Assembly Block Directives File Specification Default Values W N QOO W0 Arguments Section Condition Assembly Chapter Chapter D WH 00D HUtu (¥8) ~J] Legal in in O WOWW O N b Program Used and Syntax H N I N = N Symbolic Arguments Directives | W N W Directives N D N Symbols PREFACE .1 MANUAL OBJECTIVES AND READER ASSUMPTIONS This manual is intended to enable the MACRO-11 assembly language. users to develop programs coded in No prior knowledge of the MACRO-11 Relocatable Assembler 1is assumed, but the reader should be familiar with the PDP-11 processors and related terminology, as presented in the PDP-11 Processor Handbooks. The reader 1is also encouraged to become familiar with the linking process, as presented in the applicable system manual (see Section #.3), because 1linking is necessary for the development of executable programs. If a terminal some that find of feature examples may also Part IV for It available examples illustrate the that working confusing The is the can be in be in concepts with a of a this wused new the reader, manual were done IAS/RSX-11M, STRUCTURE This manual Part I OF has THE four introduces Chapter 1 Chapter 2 standards Part I1 lists assembly Chapter 3 on operating all references advised few simple to try programs programmers understand a an RT-11 of system. and RSTS MACRO-11 systems (see procedures). to those RSX-11M also in Chapter 8, apply to which deals DOCUMENT parts the and key identifies and presents a eight appendices. MACRO-11. features of MACRO-11. the conventions MACRO-11 source MACRO-11 1is write RSX-11M-PLUS about that he/she to covered. Even experienced simple program helps them to RSX-11M-PLUS with the exception with each system individually. #.2 or language. manual on information assumed to the advantages and of describes following the format programming used in coding programs. general information essential to programming with the language. lists the character terms, and expressions instructions. set that ix form and the describes elements the symbols, of MACRO-11 Chapter 4 describes essential to the the Chapter 5 describes manipulated using hardware. Part of IIT describes source the statements Chapter 6 7 MACRO-11 during Part IV presents and directives that directives used presents concepts of modules. object control directives for used the processing operating generalized in macros. the and linking assembly. discusses of MACRO-11 stored in memory can be accessed and addressing modes recognized by the PDP-11 the discusses Chapter of relocation how data functions. expansion output proper procedures for the MACRO-11 definition assembling and MACRO-11 programs. Chapter 8 covers the IAS, Chapter 9 covers the RSTS/RT-1]1 Appendix A MACRO-11 programs. Appendix B lists the lists summarizes the the and alphabetical order,. Appendix C lists defined for use ASCII and special syntax processors, RSX-11M, of briefly the Radix-50# character characters describes the systems. the sets recognized addressing MACRO-11 permanent D lists alphabetically the error 1identify various types of errors used by modes in MACRO-11, used in PDP-11 directives symbols that have MACRO-11. Appendix to RSX-11M-PLUS systems. various alphabetically with and codes produced detected during in been by MACRO-11 the assembly process. Appendix E preparing Appendix space contains MACRO-11 F for a discusses wusers coding methods of small systems who MACRO-11 Appendix G is Appendix H contains an Appendix I contains obsolete line Appendix J is recommended practice conserving may dynamic experience discussion describes of position-independent assembly the and code cross-reference MACRO-11 directives, differences from in (PIC). listing. syntax, the 1in memory difficulty programs. options. MACRO-11. that several of assembling a standard programs. 1last and command release of .3 ASSOCIATED DOCUMENTS For descriptions of documents associated with this the applicable documentation directory listed manual, vrefer to below: IAS Doculmentation Directory RSX=11M-PLUS Information Directory and ITndex Guide to RT-11 RSTS/E .4 The Documentation Documentation Directory DOCUMENT color Index Information Directory and RSX-11M/RSX-11S red CONVENTIONS is used in command string examples to 1indicate user type-in. The symbols defined below are used throughout Symbol [] this manual. Definition Brackets 1ndicate that the enclosed argument is optional. .o Ellipsis list in indicates the UPPER-CASE Upper-case CHARACTERS that must form optional of the characters be used last specified indicate exactly as elements an argument argument. of the language of the language shown. lower-case Lower-case characters that (n) In some instances the symbol (n) is used following a number to indicate the radix. For example, 100 (8) indicates that 100 is an octal value, while 100(10) indicates a decimal wvalue. are characters continuation of supplied by X1 indicate the elements programmer. Ly CHAPTER THE MACRO-11 provides the and MACRO-11 following 1. Source command 2. Device and 3. Error 4. Alphabetized, 1 ASSEMBLER features: string control of filename specifications listing on command output formatted cross-reference listing Relocatable 6. Global 7. Conditional 8. Program sectioning directives 9. User-defined 19. Comprehensive 11. Extensive symbols input and output files table 1listing; optional symbols 5. object for functions device symbol of assembly modules for linking assembly macros object directives and macro system macro source modules and libraries library command string control of 1listing functions. MACRO-11 assembles one statements into of MACRO-11 consists table of a or of contents, cross-reference A assembly 1.1 ASSEMBLY During pass libraries, program, In and the first impure data ASCII containing binary object file and a listing, and the listing is of symbols provided in object and file. file Appendix output containing symbol macros MACRO-11 The 1is table. the An available. H. | 1 MACRO-11 locates and symbol tables performs of areas used internally dynamic storage files binary builds step source relocatable assembly listing PASS 1, a the optional sample more single for and a rudimentary assembly (areas pass reads all program section assembly each and 1, containing the assembly buffer areas MACRO-11 both process. used of required as code source statement. initializes and These file macros from for the tables data) areas storage that all will 1include regions. the be all THE MACRO-11 MACRO-11 then calls a system ASSEMBLER subroutine which transfers a command into memory. This command 1line contains the specifications of files to be used during assembly. After scanning the command line proper syntax, MACRO-1l initializes the specified output files are opened to determine if been passed in the command line. valid MACRO-11 routine which retrieves file open, source as case input of now 1If assembly, command first the to end program linking the assembly program then writes symbols. This process On pass the PASS both program. A assembly assembly pass final with linking the associated The and with executable user pass 1, from the the beginning specified 1in statements. object for the object each file out the that records done the output them files the object module name, the symbol directory (GSD) for each the to the MACRO-11 then assembles three words. or reopens writing to the symbol to the program be used later GSD for tables to particular 2 records listing and listing consists of that all except in a given find all program object section. file for these section. to the may the output symbol table also the same source be file while listing for generated. steps performed statements in containing errors relocation records object file. may manual object global absolute body wish description. system is assembly The information in the Linker, enables the an GSD lines are flagged with an error code as the file is created. The object file that is created as consequence of pass 2 contains all the object records, together for out at have as through bound cross-reference Basically, the scans These specifications file source words, global to are writes the MACRO-11l-detected assembly 1listing input MACRO-11 the the files. all for 2 2 MACRO-11 generating 1, file instructions, two After MACRO-11 that the is the information modules. symbols ASSEMBLY pass and MACRO-11 1.2 of output object next word, are section, global the number, section the one Such is assembling length as above. version program opens starts length of a input and determines described the no MACRO-11 line according At initiates file. output line (see of to or that hold the file, when passed symbols in the virtual memory familiar with information to the Task Builder object modules to addresses, code. become This Section information #.3 in the 1is the necessary macro presented thereby objéct in the file or be forming format applicable Preface). s Mot CHAPTER SOURCE 2.1 PROGRAMMING Programming (or also STANDARDS standards and 2 PROGRAM FORMAT AND CONVENTIONS conventions group) to be easily understood make the program easier to: allow code by other written people. by a These person standards Plan Comprehend Test Modify Convert The actual standard used must meet local user requirements. A sample coding standard 1is provided in Appendix E. Used by DIGITAL and users, this coding example simplifies both communications and continuing task of software maintenance and improvement. 2.2 A its the STATEMENT FORMAT source program is composed of assembly-language statements. Each statement must be completed on one line, Although a line may contain 132 characters (a longer line causes an error (L) 1in the assembly listing), a line of 8@ characters 1is recommended because of constraints lines, A MACRO-11 are imposed although statement 1identified separating MACRO-11 by legal, no have their characters [Label:] format significance in the may by statement listing have as many the as terminal four line size. source Blank program. fields. These fields within the statement and/or by fields. The general format order between and of the a is: Operator Operand [;Comment (s) ] The label and comment fields are optional. The operator and operand fields are interdependent; in other words, when both fields are present in a source statement, each field is evaluated by MACRO-11 1in the context of the other. A statement not true. illegal and may contain one. assembly data no operand, but the reverse is operand with no operator is an is interpreted by MACRO-11 during (see Section and statement process words. and containing interprets Each operator statement .WORD directive MACRO-11 an A or to assembly as an implicit 6.3.2). processes causes generate source MACRO-11 one or program either to more statements one by perform a specified binary instructions or SOURCE 2.2.1 A Label label is current a user-defined location table. The addresses during symbolically a is location the assembly section source is a is absolute, specific value assigned the into user-defined used value MACRO-11 statements Thus, a label of to as is a the value of an the current the symbol assign they are means of statement. references address the by program process. to its is entered counter the absolute; which and to referring program symbol counter current encountered Counter FORMAT Field memory When PROGRAM location absolute virtual memory program section is (such as location 10¢). Similarly, when a relocatable, the value of the current location counter is relocatable; a relocation bias calculated at link time is added to the apparent value of the current location counter to establish its effective absolute virtual program sections If present, must be current a address and label must execution ABCD: be the first by a colon (:). counter is absolute MOV the time. attributes, terminated location assigns at their see field More a discussion of source statement and of the A,B value were If the location counter ABCD would be 147 (8)+K, the program section, as of link time. than one label may appear within a single 1label field. Each so specified is assigned the same address value. For example, value of the current location counter is 100(8), the multiple in the following statement are each assigned the value 133 (8) : label if the labels ABC: Multiple SDD: labels A7.7: may also MOV appear on successive SDD; | A7.7: MOV second positioning the program method colon example, the of (::) defines are the to all three 1labels. the 1label as a MOV the of a to global symbol. For | A,B label global ABCD this linked as symbol a global symbol. is that can it be The distinguishing referenced from within module in which the symbol is defined independently assembled object modules. label in other modules are resolved when the as a composite executable image. object module other than (see Section 6.8) or by References assighed assigning statement an modules example, multiple labels is preferred because the fields consistently within the source program makes easier to read (see Section 2.3). A double establishes For A,B likewise cause the same value to be attribute lines. | ‘ABC: ABCD:: e “"”“‘*’W\W A,B statements This in a 6.7.) For example, if the value 10#(8), the statement: 108(8) to the label ABCD. relocatable, the final value where K represents the relocation bias of calculated by the Task Builder or Linker at value (For Section the ey SOURCE PROGRAM FORMAT TheVlegal characters for defining labels are: A through @ through . $ Z 9 (Period) (Dollar Sign) NOTE By convention, the dollar sign period (.) are reserved for defining DIGITAL system symbols. should not MACRO-11 - A label may be significant Ssource any and, listing if length; An the error first programs. however, therefore, program. and wuse 1in software these characters defining labels in Therefore be used in source must code six ($) only the be unique (M) 1is first among six all generated characters in two or characters the labels in the more in are the assembly labels are the same. A symbol used program. definition the assembly program (D) in 2.2.2 The the of Furthermore, references Operator macro label must not be redefined within the source symbol is redefined, a 1label with a multiple causing MACRO-11 to generate an error code (M) in assembly operator a a 1listing. which consist or as If the results, any multi-defined statement label listing. the specifies instruction call. Chapters and follow. When actions the the an the action to (op 6 describe and 7 evaluates code), a significance; field from the operator 1is character*, as in A,B MOV A,B MOvVeA,B Appendix assembler these It may directive, three by operator the macro is A.2 machine a of types during macro instruction the MACRO-11 operations the a operands performs the of MACRO-11 operator field is which certain assembly of call, the inserts expansion. the such characters serve only to preceding and following fields. An * performed. an addresses directive processing When generated is mnemonic, the Leadihg and trailing spaces or tabs in MOV be mnemonic instruction operator or program. code is MACRO-11 control source the source error code | operator generated an | operators. When 1in generates Field field an a terminated by a space, the following examples: ;The space ;The tab ;The @ character contains a table terminates terminates of 2-3 tab, the the or operator the the any operator terminates Radix-50 separate have non-RAD50 MOV. MOV. operator MOV. characters. no operator SOURCE PROGRAM FORMAT Although the statements above are second statement MACRO-11 2.2.3 When coding Operand the field 1is the all equivalent recommended form is an instruction program variables by the operator. The operand MACRO-11 directives and macro mnemonic that field calls, are (op to be expressions used or in symbols, the When should be is preceded treated operator the by field expressions, MOV On other to as hand, ALPHA the determine directive. by an contains when as tab and a in an an op the the and a The end comment are the operator. MACRO-11 statement if it 1is be An not, the .WORD directive (see code, associated operands are statement: field contains operands are a MACRO-11 normally symbols, the MACRO-11 of by a A terminates the a the field. the in when following 7) to issuing the field |is the statement: field field; terminates the (Chapter required semicolon in ;Comment operand directive operands operator comma field separates operand field and the and defines operands defines When no comment field follows, of the source line. by A the the end Field normally begins line. This except null, or field, as MOV and field checked listing field; following example, the comment terminated vertical-tab comment For is the characters each number A,B of Comment of on a implicit operator terminated semicolon beginning of operand field 2.2.4 is MOV between of and comment. beginning B; of ©SYM1l,SYM2 type field by LABEL: the field operator MACRO-11 shown description the operand followed the to 7, R@A ,A+2 (R1) .MACRO The operand evaluated/manipulated symbols similarly used may comma, tab, and/or space). directive or a macro call, associated as shown in the following statement: Refer to 6.3.2). the always be depending operand must be separated by a comma; multiple delimited by any 1legal separator (a Section the | expressions statement the conforms may also supply arguments as described in Chapters 6 and respectively. operand <code), it Field operator Multiple ‘function, conventions. contains Operands may in because even special for ASCII appear in in is column All legality source and and extends may through contain carriage-return, other characters the 33 optional RUBOUT, form-feed. only they field characters reserved and then text. for included line-feed, appearing use in in the any ASCII the in the MACRO-11, assembly SOURCE All comment comments comment fields extend may be a leading be continued A comment within must semicolon, in the 1line the code of and <can a it following is FORMAT semicolon the be line. line Such that position included (;). source suggested columnar also a the in which as body. an When 1lengthy (column 80), line body must of the the comment comment entirely the contain began. separate line | do not affect comments are 2.3 a end same However, or with the in Comments debugging, begin beyond resumed PROGRAM assembly necessary documentation processing in source or program listings for execution. later analysis, purposes. FORMAT CONTROL Horizontal formatting of the source program is controlled by the space and tab process characters. unless they These are characters embedded within have a no effect symbol, on the number, text string, or unless they are used as the operator field Thus, the space and tab characters can be used to provide and readable source program. DIGITAL's standard source line format is shown assembly or ASCII terminator. an orderly below: Label - begins in column 1 Operator - begins in column 9 Operands - begin in column 17 Comments These - begin formatting permissible. in the example in column conventions However, below: note 33. are not the increase REGTST:BIT#MASK,VALUE; COMPARES Page BITS IN 17 33 REGTST: BIT #MASK,VALUE ;Compares 6 in accomplish sample coding and the assembly context desired of listing MACRO-11 formatting standard. is formatting (columns) bits considerations directives operations. coding after OPERANDS. 9 formatting free-field readability 1 Chapter to mandatory; in operands. are that Appendix discussed may E be in specified contains a .gg CHAPTER 3 SYMBOLS AND EXPRESSIONS This chapter describes the components of MACRO-11 instructions: set, the conventions observed in constructing symbols, use of numbers, operators, terms and expressions. character the CHARACTER SET 3.1 The following 1. The are characters are legal to upper-case (see Section The digits 6 through 9. 3. The characters . (period) and $ characters are reserved for wuse Corporation system program symbols. 4. The special characters listed Table Character source 6.2.1, 2. Special Characters Designation programs: Double Equal in Table sign 3-1. in MACRO-11 Function equal terminator. Label terminator; label as Direct macro Double sign LC). 3-1 Used Label colon .ENABL (dollar sign). These as Digital Equipment | Colon e in MACRO-11 letters A through Z. Both upper- and lower-case letters acceptable, although, upon input, lower-case letters are converted e the and defines a global assignment keyword Direct defines the label. operator and indicator. assignment the symbol as operator; a global ] . symbol. Equal sign colon Direct assignment operator; macro keyword indicator; causes error (M) in an attempt 1is made the value the of (continued listing to if change symbol. on next page) SYMBOLS AND Table Special Character Designation == Double sign 3-1 Characters EXPRESSIONS (Cont.) Used in — MACRO-11 Function equal colon Direct assignment defines the symbol; causes listing to if operator; symbol an change as a error attempt the global (M) is value of symbol. % Percent sign Register term indicator. Tab Item or field terminator. Space Item or field terminator. # Number @ At ( Left ) Right . Period Current location ’ Comma Operand fie1d separa£or; : Semicolon Comment field Left Initial argument < > sign sign Deferred parenthesis parenthesis angle Initial register Terminal Right Terminal angle indicator. indicator. counter. | indicator. or argument expression or expression indicator. sign Minus o indicator. register indicator. Arithmetic or - addressing bracket Plus the Immediate expression indicator. - bracket + in made sign addition autoincrement Arithmetic operator operator o indicator. subtraction or autodecrement indicator. * . Asterisk Arithmetic multiplication operator. / Slash Arithmetic & Ampersand Logical AND operator. ! Exclamation Double quote point Logical division inclusive Double ASCII indicator. OR operator. operator. character (continued on next page) o SYMBOLS Table AND EXPRESSIONS (Cont.) 3-1 Special Characters Used Character Designation ' Single in MACRO-11 Function quote Single ASCII character indicator; or concatenation indicator. ~ Up \ 3.1.1 Universal unary circumflex argument indicator. Backslash Macro call indicator. Separating arrow or operator numeric or argument and Delimiting Characters Legal separating characters and legal in Tables 3-2 and 3-3 respectively. Legal Chara cter Definition Space One or more and/or tabs argument delzmlters are defined Table 3-2 Separating Characters Usage spaces Spaces is a legal separator instruction fields and symbolic arguments the operand field. within expressions are ignored (see A is A space between between within Comma comma Section a legal 3.9). separator between symbolic arguments "within field. the operand Multiple expressions used in the operand field must be separated by a comma. Illegal 3’1'2 A character 1. If Characters is illegal for one a character is not character mark, and it set, an error listing. The when detected, of two reasons: recognized an element of the is replaced in the listing by a code is printed 1in the (I) exception terminates to the this scan If a legal MACRO-11 character is questionable with 1illegal or printed in the assembly listing. is of an embedded the current used in syntax, a an source error MACRO-11 question assembly null which, line. statement code (Q) 1is SYMBOLS Table 3-3 Argument Delimiters Legal Character AND EXPRESSIONS Definition Condd Paired Usage angle Paired brackets used angle brackets anywhere enclose an treatment Paired used as to a con- struction, where the up-arrow followed by is an argument is that 3.1.3 Legal Unary and MACRO-11 unary operators operands) assem ' bly. Binary to 1in indicate Because to contain that an element of a also macro when contains characters (see construction equivalent 1in paired angle described function used argument itself the brackets above generally is to = and is only where contains the angle brackets. are described connection an action to in single with be performed Table terms on 3-4, Unary (arguments or that term a term preceded by a unary operator operator, an term. are Operators operators used to 7.3). This bracketed by any paired printing characters (x). be for particularly separating (unary single brackets argument Section Up-arrow may program enclose that operator) a expression angle argument, “X.ooX in a term expression. Legal so specified can be is used | Table 3-4 Unary Operators during considered alone or Unary Operator Explanation + Plus - Minus sign sign Example +A -A Effect Produces the value A, of Produces (2's value of (continued the positive negative complement) A. on next page) SYMBOLS AND EXPRESSIONS Table Legal 3-4 (Cont.) Unary Operators Unary Operator Explanation = Up-arrow, unary Example universal Effect “Cc24 Produces operator. the complement (This usage is described 1in 1's wvalue of 24 (8) . detail in Section 6.4.) "D127 Interprets 127 decimal number. “"F3.0 Interprets 3.0 as a as a l-word, floating-point number. "034 Interprets octal “B11@P@111 Interprets as “RABC a operators involving can be used adjacent multiple terms, as shown -"D50 “"C"012 (Equivalent (Equivalent to other an 11p@g111 Evaluates each as binary number. Radix-50 Unary 34 number. or ABC in form. in constructions below: to -<"D5@>) to “C<"012>) Legal MACRO-11 binary operators are described in Table 3-5. contrast to unary operators, binary operators specify actions to performed on multiple items or terms within an expression. Table Legal 3-5 Binary Operators Binary‘ Operator Explanation + Addition - Subtraction * Multiplication / | Example A+B | A-B A*B Division A/B (signed 16-bit product returned) (signed 16-bit quotient & Logical AND ! Logical inclusive A&B OR A!B returned) In be W SYMBOLS All binary operators brackets are from.left to 3.2 right, as . WORD 1+2*3 1+<2*%3> MACRO-11 EXPRESSIONS priority. in remaining the examples the maintains a symbol be defined Table (PST), the by are angle performed below: ;Equals 11(8). 7(8). table in a for each of the three symbol MACRO-11 source program: Table (UST), and the types the Permanent Macro Symbol User Symbol (MST). The PST contains all the permanent symbols defined (and thus automatically recognized by) MACRO-11 and is part of MACRO-11 image. The UST (for user-defined symbols) and MST (for symbols) 3.2.1 are Permanent Permanent C) enclosed operations ;Equals Table within macro Terms and SYMBOLS may Symbol equal first, shown .WORD MACRO-11 that have evaluated AND and constructed as the source program is assembled. Symbols symbols consist MACRO-11 of the directives These symbols are a be defined before source statement 3.2.2 User-Defined instruction (see permanent part of being used in (see Section and Macro mnemonics Chapters the the 6 and MACRO-11 operator 7 (see and image field Appendix Appendix B). and need not of a MACRO-11 2.2.2). ’ Symbols User-defined symbols are those symbols that are equated to a specific value through a direct assignment statement (see Section 3.3), appear as labels (see Section 2.2.1), or act as dummy arguments (see Section 7.1.1). These encountered Macro symbols during symbols are those They are added during assembly. The following are added to the User Symbol as macro names Table assembly. to rules symbols the govern used Macro the Symbol creation Table of as (see they 2. Symbols composed signs periods The in 3. The can be ($), and of (.) user-defined alphanumeric only (see Note first six can characters be but written of a with the seventh and subsequent for ASCII 1legality and are recognized by MACRO-11. 4. Spaces, tabs, and within a symbol. in Section 3.1. symbol more than and be six legal characters not illegal characters The legal MACRO-11 are otherwise 7.1). macro characters, below). must are encountered dollar | first character of a symbol must not be a number the case of local symbols; see Section 3.5). symbol they Section are symbols: 1. as (except unique. A characters, checked evaluated only or must not be embedded character set is defined SYMBOLS AND EXPRESSIONS NOTE The dollar sign characters are defining Digital system software READS is a ($) and reserved Equipment symbols. file-processing period (.) for use 1in Corporation For example, system macro. The user 1is cautioned not to employ these characters in constructing user-defined symbols or macro symbols in order to avoid possible <conflicts with existing or future Digital Equipment Corporation system software symbols. The value of a symbol depends upon its use in the program. A symbol in the operator field may be any one of the three symbol types described above; permanent, user-defined, or macro. To determine the value of an operator-field in the This following 1. Macro 2. Permanent 3. User-Defined search symbol, MACRO-11 searches the symbol tables order: Symbol Table Symbol order Table Symbol allows Table permanent symbols to be wused as macro symbols. But the user must keep in mind the sequence in which the search for symbols 1is performed 1in order to avoid incorrect interpretation When a symbol of the appears symbol's use. in the operand 1. User-Defined Symbol 2. Permanent Symbol Table Depending on their use have either a 1local attribute. Normally, their the search order is: Table in the source program, user-defined symbols (internal) attribute or a global (external) | MACRO-11 definition However, field, treats all 1is symbols can be through one of 1limited user-defined to explicitly the three methods: 1. Use of the .GLOBL directive 2. Use of the double colon (::) symbols as local, module declared to that is, 1in which they appear. be | global symbols (see Section 6.8.1). in defining a label (see Section 2.2.1). 3. Use of the double equal sign (==) or double equal colon sign (==:) in a direct assignment statement (see Section 3.3). All symbols within a module that remain undefined assembly are treated as default global references. at the end of SYMBOLS AND EXPRESSIONS NOTE Undefined symbols are assigned into the undefined at a the end value user-defined default of statement Global symbols modules containing is in assembly the provide within the flagged as 1If in effect, 6.2.1) the the an undefined error code (U) listing. linkages task with placed table references. .DSABL GBL directive is however, (see Section symbol assembly and symbol global the of @ between image. independently~-assembled A global symbol defined as a object label, for example, may serve as an entry-point address to another section of code within the image. Such symbols are referenced from other source modules in order to transfer control throughout execution. These global symbols are resolved at link time, ensuring that the resulting image is a logically coherent and complete body of code. 3.3 The DIRECT ASSIGNMENT general format for STATEMENTS a direct assignment statement is: symbol=expression or ,vx""w‘wwfl-y symbol==expression where: expression - - The colon format for a can have only one (see 5. Dbelow). cannot direct contain an assignment level of undefined statement forward reference global reference. is: symbol=:expression or symbol==:expression where: All expression the symbol direct with entered into a - can have (see 5. — cannot assignment specific the statements After User-Defined Symbol (= direct assignment statements. or ==:) any attempt (=: generate an ==) error contain value. used or only one below). the (M) value in of the the an allow symbol Table. symbol of undefined above the level If may be the forward reference global reference. user to has been the general changed in assembly as global (see Section 6.8.1). it format a is is subsequent 1If, however, the colon format is to change the value of the symbol used will listing. A direct assignment statement embodying either the double sign or the double equal colon (==:) sign, as shown above, symbol equate defined equal (==) defines the SYMBOLS The following examples AND EXPRESSIONS illustrate the coding of statements. Example direct 1: A=10 ;Direct assignment B==30 ;Global assignment A=15 ;Legal reassignment L=:5 ;Equal colon M==:A+2 ;Double ;M L=4 | Example assignment assignment equal becomes colon equal to assignment 17 ;Illegal reassignment ;M is error generated 2: C: D=, E: MOV #1 ,ABLE ;The symbol D is ;the labels C and ;value ;of that the is MOV code in the second example above would not shown only to 1illustrate the performance situations. See Section 3.6 for a description current location The following counter conventions symbol. apply to the E are equal to to the Spaces preceding and/or although be used and is MACRO-11 1in such of of coding following permissible, resulting value. The being assigned in the label field. symbol placed 3. a location the of period direct (.) as assignment An equal sign (=), double equal sign (==), equal colon sign (=:) or double equal colon sign (==:) must separate the symbol from the expression defining the symbol's value. operators, 2. and usually statements: 1. ., assigned instruction. The the equated Only in one symbol can be a defined the have direct in a no direct assignment significance assignment single direct in the statement is | assignment statement., 4. A direct assignment comment field. 5. Only one 1level of forward referencing 1is allowed. The following example would cause an error code (U) in the assembly listing on the line containing the 1illegal forward statement may be reference: X=Y (Illegal Y=2Z (Legal Z=1 forward forward reference) reference) followed only by a SYMBOLS AND EXPRESSIONS Although one 1level of forward referencing is allowed for local symbols, no forward referencing 1is allowed for global symbols. In other words, the expression being assigned to a global symbol can contain only previously defined symbols. A forward reference in a direct assignment error code (A) to 3.4 The REGISTER eight through statement defining a global be generated in the assembly cause an numbered 0 SYMBOLS general 7 symbol will listing. and registers can be of the expressed PDP-11 in the processor source are program in the following a 1location. manner: 30 31 » 37 where % indicates a reference to a register The digit specifying absolute term that can The register and remain the register can be evaluated during definitions listed wvalid all for below are register rather be the than replaced by any legal, first assembly pass. the normal references default within values the source program. RO=%0 ;Register ¢ definition. R1=%1 R2=%2 R3=%3 R4=%4 | ;Register ;Register ;Register ;Register 1 2 3 4 definition. definition. definition. definition. R5=%5 ;Register 5 definition. SP=%6 PC=%7 ;Stack pointer definition. ;Program counter definition. Registers 6 and 7 are system functions. registers, as listed given DIGITAL-supplied PDP-11 advised A to follow these register symbol may appearing in the special The symbolic above, are the be system names because of their default names assigned conventional names used programs. For this reason, unique to 1in the all you are conventions. defined ©program. in The a direct defining assignment expression of statement a register symbol must be a legal, absolute value between ¢ and 7, inclusive, an error code (R) will appear in the assembly listing. Although can reassign the standard register symbols through the wuse of .DSABL or you the REG directive (see Section 6.2.1), this ©practice 1is not An attempt to redefine a default register symbol without first specifying the .DSABL REG directive to override the normal register definitions causes that assignment statement to be flagged with an error code (R) in the assembly listing. All non-standard recommended. register source symbols program. must be defined before they are referenced 1in the SYMBOLS AND EXPRESSIONS The % character may be used with any 1legal term specify a register. For example, the statement CLR is equivalent clears in function to the the contents CLR 3.5 Local to ’ statement %4 of register In contrast, the statement clears expression $3+1 CLR and or 4. | 4 the contents of virtual memory location 4. LOCAL SYMBOLS symbols are specially formatted symbols used as labels within a block of coding that has been delimited as a local symbol block. Local symbols are of the form n$, where n is a decimal integer from 1 to 65535, inclusive. Examples of local symbols are: 1S 27$ 595 104$ A local 1. symbol The block is delimited range of a local in one symbol of block three ways: usually consists of those but does statements between two normally-constructed symbolic labels (see Figure 3-1). Note that a statement of the form: ALPHA=EXPRESSION is a direct assignment statement (see Section 3.3) not create local 2. label and thus does not delimit the range of a block. The range of a local symbol block is normally terminated upon encountering a .PSECT, .CSECT, .ASECT, or .RESTORE directive in 3. symbol a The the source range of program a (see Figure local symbol MACRO-11 directives, as follows: Starting delimiter: .ENABL LSB 3-11 3-1). block 1is delimited (see Section 6.2.1) through SYMBOLS Ending AND delimiter: EXPRESSIONS .ENABL LSB or one of the following: Symbolic label .PSECT (see (see Section 6.7.2) (see Section 6.7.2) (see encountered symbols multiple the use labels, a convenient symbol blocks. 1in other 1local symbols do symbol table not appear in space than be defining generated symbols Be sure are wuseful to avoid two more represents causes in the in use of .DSABL generating an times as a LSB (see labels for error source the different code of (P) local be symbols program, i same address to see of if and of 1S 1local symbol value. Such local symbol 1local assembly (see 10$ the blocks defined each symbol symbol listing.,. as 3-1. same is multi-defined assembly can Such block, the is first. inclusive, within symbol 1less use 299998 during a name Local require to symbols local same Their MACRO-11. local in and 65535$, macros the generated Figure from of the conflict. symbols. through expansion of without listings feature example, symbols of range 30008$ definitions For within local blocks types the range the multiple block. a examples a symbols, within Thus, symbol 7.3.5). symbol or means other automatically local For local symbols Section a 6.2.1). cross-reference recommended. Local after 6.7.4) and other such references within local symbol symbols reduces the possibility of symbols with local appear When Section 2.2.1) definitions appearing within a user program. In addition, of local symbols differentiates entry-point labels from 1local since 1local symbols cannot be referenced from outside their respective can provide instructions Using local 6.7.1) .CSECT Section branch blocks. Section -ASECT -RESTORE Local (see Section they appear it 2 i 3 4 3 by F - S 6 000000 7 8 000004 000006 ? 000012 Simrle the 012700 XCTPRG! 0000006 005020 1% 020027 0000006 001374 i? illustration label of loczl sumbols; the XCTFPAS. $IMPURESsRO tPoint CLR CMP (RO)+ ROs #IMPURT iClear 3 iTest if BNE 1% ilterate if not iFall in to rerform to to 000014 012700 XCTPAS: $IMPPASsRO iFoint 13 000020 0000006 005020 MOV 14 000022 1% 020027 CLR (RO)+ RO 15 000028 0000006 001374 CMP sClear 16 000030 BNE 000207 1% RTS tlterate PC ‘Return 3-1 block MOV 12 Figure second Assembly #IMPPAT Listing iTest Showing imrure word at tor rass the ares if at tor of if is ares of aresa rass storade of initiaslizstion area area not so Local delimited Symbol Block SYMBOLS 3.6 The CURRENT period used in address example is the operand symbol field an of in Az the second Mov (The for of the first word of below. When wused directive, it represents the shown EXPRESSIONS LOCATION COUNTER (.) the AND example the of the current 1in the the represents as shown in (#) is field (.) MOV When period current period ;of sign the counter. the operand of ;The number location instruction, address below. #.,R0O function the instruction, of byte refers a or to the first the MACRO-11 word, the as address instruction. explained in Section 5.9.) SAL=0 .WORD 177535,.+4,SAL ;The operand .+4 in the .WORD ;directive represents a value ;that is stored as the second ;of three words during ;assembly. Assume that assembly, (see the Section .+4 177535 1s value the stored of value the is the 4, the beginning thus in stored in location location of SAL, of storage previously this the 3-2 illustrates the Figure At the beginning counter, byte of of Normally, object counter following can data be 508. The is now 502), 5806 in of @, the is CONTENTS 500 177535 502 506 504 Y each Sample assembly changed pass, However, through a The so value derived operands stored. The represented by as the current plus the absolute location 502. Finally, in 1location the location deposited Assembly Results consecutive memory generated. During example. LOCATION 3-2 50¢. .WORD directive 5¢4. value to is the values is equated result the value 504. Figure to location determine (which depositing counter response location 502; counter location in with .WORD directive thereby value value reserves 6.3.2), accompanying value current MACRO-11 MACRO-11 resets locations are the direct form: value assignment assigned of the to each 1location statement of the absolute or .=expression The current relocatable, section. 1location depending counter on the symbol (.) attribute 3-13 1is of either the current program SYMBOLS The attribute through the of .RESTORE), as counter an the current program expression current program section assembly listing. forward an The (a user must Section will an 6.7. be to to the error that may that the than <code counter symbol changed to that (A) not is only .CSECT assigning different an a sure be .ASECT, Therefore, generate assigned can (.PSECT, attribute reference also counter directives having expression reference defined). in EXPRESSIONS location sectioning described Furthermore, AND the of 1in the the contain not and a previously expression assigned will not force the counter into another program section, even if both sections involved have the same relocatability. Either of these conditions causes MACRO-11 to generate incorrect object file code, and may cause statements following the code (P) in the assembly listing. The following coding illustrates error the to be use flagged of the with an current error 1location counter: .ASECT . =500 FIRST: ;Set location counter ;absolute 508 (octal). MOV .+10,COUNT ;The label "FIRST" has the value ;58N (octal) . ;++1@ equals 51¢(octal). The ;contents of the location ;510 (octal) will ;in the location .=520 ;The ;now MOV . » INDEX be deposited "COUNT". assembly location has a value of ;absolute SECOND: to 528 (octal). ;The label : The contents ;value "SECOND" 528 (octal). ;520 (octal), :code counter for of the location that the has is, the binary instruction ;itself, will be deposited ;location "INDEX". in the . PSECT =.4+20 | THIRD: .WORD A Storage areas may counter. For 1008, each of ;Set location counter ;The label ;value be reserved to srelocatable 2 of the ;unnamed program section. in the of "THIRD" has relocatable program example, if the current value the following statements: by of the 20. advancing the the location location counter is =.+40 or .BLKB 47 or .BLKW reserves 40 (8) 20 bytes of storage space .BLKB and .BLKW directives, however, storage space (see Section 6.5.3). 1in are the the source preferred program. ways to The reserve SYMBOLS 3.7 AND EXPRESSIONS NUMBERS MACRO-11 assumes that interpreted 1in octal all numbers in the source program radix, unless otherwise specified. are to be An exception to this assumption is that operands associated with Floating Point Processor instructions and Floating Point Data directives are treated as decimal (see Section 6.4.2). This default radix can be altered with the .RADIX directive (see Section 6.4.1.1). Also, individual numbers can be designated as decimal, binary, or octal numbers through temporary For is radix control operators (see Section every statement in the source program not 1in the current radix, an error that code 6.4.1.2). contains a digit that (N) is generated in the assembly listing. However, MACRO-11 continues with the scan of the statement and evaluates each such number encountered as a decimal value. Negative numbers must be preceded by a minus translates such numbers into two's complement form. may (but need not) be preceded by a plus sign. A number containing 177777(8)), (T) in the Numbers are 1is than from assembly listing. always considered are never more truncated 16 the to be significant left and sign; MACRO-11 Positive bits (greater absolute values; 14 6 Sign Bit 8-bit Exponent 7-bit Mantissa the appropriate floating-point 3.8 A code therefore, they relocatable. 15 to than flagged with an error Single-word floating-point numbers may be generated with operator (see Section 6.4.2.2) and are stored in the following Refer numbers PDP-1l1 number format. component of the °F format: 4 Processor Handbook expression and for details of the of the wvalue 1is TERMS term is a an may be one following: 1. A number, as defined in Section 3.7, as defined in Section 3.2. whose 16-bit used. 2. A as A. symbol, Symbols are evaluated follows: A period of the (.) specified current location in an expression causes the counter to located in the value is used. be value used. B. A defined symbol is Table (UST) and its User-Defined C. A permanent symbol's basic wvalue 1is substituted for the addressing modes. all op codes and their values.) used, with (Appendix C Symbol zero lists SYMBOLS D. An undefined inserted in symbol the default AND EXPRESSIONS is assigned User-Defined a value Symbol Table of as =zero an and undefined global reference. If the .DSABL GBL directive (see Section 6.2.1) is in effect, the automatic global reference default function of MACRO-11 is inhibited, and the statement containing the undefined symbol is flagged with an error code (U) in the assembly listing. 3. A single double quote quote expression An by by construction 6.3.3‘ 4. followed followed expression 1in enclosed term the remainder used 1is to is evaluated. alter the ASCII explained enclosed so before single is expression appears a two ASCII character, or characters. This type in angle of the and expression evaluation in A*B+C versus A*<B+C>), or to apply entire expression (as in -<A+B>).* >. 3.9 A unary Expressions are (see evaluation of a symbol or Expressions 1later complex are contain before are of terms Expressions or joined reduce use treated in this except A term from operator. in as may section): 1left that unary preceded by a (Terms expressions.) to the relocatable. evaluated that their 3-5). expression includes resultant expression value hierarchy rules, binary operators. and by an A described external, combinations Table attributes. to followed a of to in a Any single which example, it may eXpressions unary operator be (as to an number. EXPRESSIONS operators (as operator for Section (<>). reduced brackets, left-to-right in brackets evaluated Angle detail a of to together a be any one of relocatable, right with are evaluated, unary follows:* binary value. determination operators take unary operator Multiple by 16-bit no The of its four types absolute, operator precedence over 1s considered where operators necessary, are wvalid -+-2 is equivalent to: =-<+<-A>> * The maximum assembler's assembler's (E) error, depth of an expression maximum and expression stack expression processing is space. depth, continues. 3-16 governed If the an by the MACRO-11 expression exceeds statement is marked with the an SYMBOLS A missing zZero. A analysis, assembly For term, example, the evaluated or the B EXPRESSIONS external illegal symbol operator (A) on 1is interpreted terminates and/or (Q), to be context of the the the generated expression expression: as a expression 1in the itself. | 177777 as A+ because or causing error codes 1listing, depending A+ is expression, missing AND B first legal binary operand field non-blank operator, terminator character following an expression (a semicolon or the symbol separator the end of (a the B is not a comma), or an source line). NOTE Spaces within delimiters other words, A + expressions only can between the serve as symbols, in expressions B and A+B are the same, but the symbols B17 and B are not 17 (B 17 is not a single symbol). At assembly time the value of an external (global) expression is equal to the wvalue of the absolute part of that expression. For example, the expression EXTERN+A, where "EXTERN" is an external symbol, has a value at assembly time that 1is equal to the value of the internal (local) symbol A. This expression, however, when evaluated at 1link time takes on the resolved value of the symbol EXTERN, plus the value of symbol A. Expressions, when evaluated relocatable, absolute, following distinctions are 1. An to expression the base appears; Terms it that sections will by MACRO-11], external, important: or is relocatable if address of the will have contain have a an offset 1labels are of four relocatable. types: The its value program value defined relocatable one complex value; is fixed relative section in which it added at 1link time. 1in relocatable program similarly, a period (.) 1in a relocatable program section, representing the value of the current location counter, will also have a relocatable value. 3-17 SYMBOLS 2. An expression expression characters 1is AND EXPRESSIONS absolute whose terms will reduce to expression or term if its minus a is section subtracted MACRO-11 it can to Terms also 3. a have not assembly external (plus or the within the is only must be bias. in as resolved of an - It contains a - It contains more It contains program - The link symbols of program An operation a if any single value) Thus, an following one relocatable global reference. relocatable terms belonging of the symbol. to different the expression has more For example, 1if the in terms of the relocation bias section. other global than operation other complementation is than that can be specified in a maximum size of the object (decimal) . | at addition, specified relocatable, completed addition is symbol. An of will than one relocatable TAG2, associated with the same program specified 1in the expression TAG1+TAG2, two relocation will be introduced, since each symbol the 1is scan. time. and evaluated evaluation expressions zero. reduce section defined a are is undefined - and is contains a expression one from relocation. TAGl section, - than resulting of levels reference in term eXxpression program. partially term one and sections., value level global the both section, bias absolute current at where When absolute (or global) if it minus an absolute defined and term, resulting completion expression A An conversion relocatable program because every An expression is complex relocatable following conditions applies: - The upon is fixed. same expression labels defined absolute value. is reference is the the relocation another, treat term An expression that same contain an external the from then single that global 4. has 1is ASCII relocatable elements being evaluated belong to is an absolute expression. This program wvalue are numbers and an absolute value. for external, link complex record. time. relocatable and The The complex maximum expression maximum is effect specified subtraction, a in on negation, for an or value. relocatable number of terms 1limited by the number of terms is 20 CHAPTER RELOCATION The output of MACRO-11 is an 4 AND object LINKING module that must be processed linked before it can be loaded and executed. Essentially, fixes (makes absolute) the values of relocatable or external in the object module, thus transforming the object module, or object modules, into an executable image. To allow the value of an expression to be fixed at link time, or linking symbols several MACRO-11 outputs required certain instructions in the object file, together with other parameters. For relocatable expressions in the object module, the base of the associated relocatable program section is added to the value of the relocatable expression provided by MACRO-11. For external expression values, the value of the external term in the expression other (since object added to the the external symbol must being 1linked together) modules absolute portion of the be external defined is one of the determined in and then expression, as provided by MACRO-11. All the instructions assembly apostrophe (') that require 1listing, as following modification 1illustrated the octal at in link time the example expansion of are the flagged below. in The instruction indicates that simple relocation is required; the letter G indicates that the value of an external symbol must be added to the absolute portion of an expression; and the letter C indicates that complex relocation analysis at link time is required in order to fix the value of the expression. EXAMPLE: d05065 CLR RELOC (R5) goonan’ ;Assuming ;symbol ;the ;will p@5065 POOOAAG CLR EXTERN (R5) that the value "RELOC", 40, relocation bias be added to is this of the relocatable value. ;The value of the symbol "EXTERN" ;assembled as zero and is ;resolved at link time. is RELOCATION gp5865 CLR EXTERN+6 (R5) ;The gROOA6G ;1s ' #A5865 AND CLR value of to resolved added absolute ; the expression. ;This a to the complete description applicable system of object manual (see because negation of contains ;reference time portion expression ;jrelocatable ;that symbol link ;and ;the For the at ;the —<EXTERN+RELOC> (R5) g30a08aC LINKING and an "EXTERN" (+6) is it of complex requires expression a global a relocatable records output by Section #.3 the in "EXTERN" term. MACRO-11, Preface). refer CHAPTER ADDRESSING 5 MODES To understand how the address modes operate and how they assemble, the The key rule to the program counter must be understood. action of remember | is: "whenever the processor implicitly uses the program counter fetch a word from memory, the program counter is to (PC) 1is automatically incremented by 2 after the fetch operation completed.” The PC always contains the address of the next word to be fetched. be either the address of the next instruction to be This word will executed, or the second or third word of the current instruction. the symbols Each mode of operand address in the chapter is illustrated using either the single instruction CLR or the double operand instruction MOV. 1lists Table 5-1 lists the address modes, and Table 5-2 to describe the address modes. chapter in this used Table 5-1 Addressing Modes Section Register mode* R Autoincrement deferred mode¥* Autodecrement mode* Autodecrement deferred mode* Index mode** | Index deferred mode** Immediate mode** Absolute mode** Relative mode** Relative deferred mode** ‘Branch @ (ER)+ - (ER) @- (ER) E (ER) @E (ER) #E Q#E E QE Address Register deferred mode* Autoincrement mode* * ** Reference Form Mode @R or (ER) + (ER) 5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.8 5.9 5.10 5.11 5.12 5.13 DpDoes not increase the length of an instruction. Adds one word operand of this to the form. instruction length for each occurrence of an ADDRESSING Table Symbols Used 5-2 in Symbol Chapter 5 Explanation E Any R A expression, register sign (%) term, as or a symbol shown R2=1+%1 ER A symbol range in other preceded previously words, by equated register register 1. ;General register 2. 7, or an any percent such a ¢. represent any of definitions (see Section inclusive. a to also expression to 3. term ;General may @ a Chapter ;General register register the in below: R1=RO+1 This defined containing RO=%0 default as expression; expression 5.1 MODES absolute the normal 3.4). eXxpression 1in REGISTER MODE Format: R The register itself instruction. (R) contains the operand to register 3. be manipulated by the Example: CLR 5.2 R3 REGISTER ;Clears DEFERRED MODE Format: @R or The by (ER) register the (R) contains instruction. the address of the operand to be Examples: CLR @R1 CLR ;All these (R1) CLR ;the word (%1) ;contained instructions at in the clear address register 1. manipulated ADDRESSING 5.3 MODES AUTOINCREMENT MODE Format: + (ER) The contents of the register (ER) are incremented immediately being used as the address of the operand (see Note below). Examples: ;Each instruction clears ;the word at the address (RG) + (R4) + CLR CLR ;contained (R2) + CLR in the specified ;register and increments ;that register's contents ; by two, NOTE Certain special instruction/address mode combinations, which are rarely or never used, do not operate the same on all PDP-11 processors, as described below. In the autoincrement mode, both the JMP and JSR instructions autoincrement the register before its use on the PDP-11/490 but not on the PDP-11/45 or 11/14. In double operand instructions having the addressing form Rn, (Rn)+ or Rn,-(Rn), where the source and destination registers are the same, the source operand 1is evaluated as the autoincremented or autodecremented value, but the destination register, at time it is used, still contains the the originally intended effective address. In the following example, as executed on the PDP-11/40, Register @ originally contains MOV 100(8): R#, (RA) + ;The quantity 102 ;to MOV RO ,-(RO) location is moved 100. ;The quantity 76 is moved ;to location 100. The use of these forms should be avoided, since they are not compatible with the entire family of PDP-11 processors. An error code (2Z) is printed 1in the assembly 1listing with each instruction which 1is not compatible among all members of the PDP-11 family. after ADDRESSING 5.4 AUTOINCREMENT MODES DEFERRED MODE Format: @ (ER)+ The register (ER) The contents of pointer,. contains the a pointer to the address of register are incremented after the operand. being used as Example: CLR @(R3)+ iThe contents ;to 5.5 the of register address of ;Cleared before the jregister are a 3 word point to be contents of incremented by the two. AUTODECREMENT MODE Format: - (ER) The contents the address of of the the register operand (ER) are decremented before (see Note in Section 5.3). being used as Examples: CLR - (RA) CLR -(R3) CLR -(R2) ;Decrement the ;fied register ‘ contents (@, ;before using ;as address the its 3, AUTODECREMENT the 2) by specitwo to be contents of ;Cleared. 5.6 of or the word DEFERRED MODE Format: @- (ER) The a contents pointer to of the the register address of (ER) the are decremented before operand. being Example: CLR @-(R2) ;Decrement the jregister 2 by ;using ;to the its contents address ;Cleared. contents two of of before as the a pointer word to be used as ADDRESSING 5.7 MODES INDEX MODE Format: E (ER) An expression effective offset base. third (E), plus address of the of the the contents operand. instruction, and of 1In the a register other contents (The wvalue of the expression word of the instruction.) (E) (ER), words, the yields value E is of register ER form is stored the second as the the the or Examples: CLR = X+2(R1l) ;The ;to effective be cleared ;contents MOV R@,-2(R3) ;The of ;destination 5.8 INDEX DEFERRED of is plus X+2, register effective ; the address contents of word the 1. address location the of is the -2, register plus 3. MODE Format: @E (ER) An expression pointer value ER to E is form second or (E), plus the contents the address of offset of the the the base. third (The word of a operand. instruction, value the of the of the register As and (ER), ylelds expression (E) is stored instruction.) Example: CLR @114 (R4) ;If register ;value, plus ;the pointer ;contains ;20403 4 contains the offset 214, the would be 1If address 10¢, this 114, yields location 2@0@, cleared. NOTE The expression @(ER) may be used, but it be assembled as if it were written @3 (ER), and a word will be used to store will the @. a in index mode above, the the contents of register 214 location as the ADDRESSING 5.9 IMMEDIATE MODES MODE Format: $E Immediate second mode or allows third addressing mode character specifies MACRO-11 word. that This the word operand of the indicator. the mode the Appearing immediate operand is itself itself assembled (E) instruction. 1in an be stored number sign the operand addressing immediately as to The mode, follows autoincrement the is field the an this indicating the of as (#) to 1instruction PC. Examples: MOV #100,R0 MOV #X,R0P ;iMove the ;iMove value the 100 value into of symbol ;register The operation of MOV #100,R#, which The mode can assembles @ 1 2 7 @ 0 Location 22: @ 9 ¢ 1 @ 0 Location 24: Next (the value operand word. fetches the first that points to the source After through the first example, words: 100) is assembled execution of immediately the word (MOV) and second word, location following instruction, increments 22, the which PC by the next into so contains the fetch and register @, increment leaving cycle, the the pointing PC source operand to (10d) location instruction). 5.10 the 2 operand. moved next 4. into instruction Upon processor X 0. shown two 20: instruction 1t be as Location source the this register ABSOLUTE 24 is (the MODE Format: Q#E Absolute mode address expression as the value is the equivalent @#E of specifies an immediate mode absolute address second or third word of the instruction. immediately following the instruction absolute address of the operand. Absolute mode autoincrement deferred of the deferred. which 1In other word 1is is is words, taken assembled PC. Examples: MOV C#100,R0 ;Move the ;location CLR @#X ;Clear ;iwhose ;the contents of 10f register into absolute R{. the contents of the location address is specified by symbol X. The stored the as the as an ADDRESSING MODES The operation of this mode can be shown through MOV @#100,R8, which assembles as two words: Location 20: ©0 1 3 7 @ 0 Location 22: 0 0 @ 1 0 0 Next Location 24: the first example, instruction The absolute address 109 1is assembled immediately following the instruction word. Upon execution of the instruction, the processor it that fetches the first word (MOV) and increments the PC by 2 so second word, location 22, which contains the absolute the to points increment fetch and After the next address of the source operand. contents of absolute address 100 (the source operand) are the cycle, (the 1location 24 to moved into register @, leaving the PC pointing next instruction). RELATIVE 5.11 MODE Format: E Relative mode is the normal mode for memory references within your as index mode, using the PC as the index assembled is It program. the address calculation is assembled as the for offset The register. This value is added to the third word of the instruction. or second contents of the PC to yield the address of the source operand. Examples: CLR 100 ;Clear absolute location 100 :Move the contents of register @ RO,Y MOV ;to location The operation of relative mode can be MOV 100 ,R3, which assembles as two words: Location 20: @0 1 6 7 0 3 Location 22: 0 0 ¢ 0 5 4 Location 24: NEXT The offset, the constant 54, instruction word. Upon fetches the first word Y shown with the statement INSTRUCTION is assembled following immediately execution of the instruction, (MOV) and increments the PC by 2 the the processor so that it points to the second word, location 22, containing the value 54. After the next fetch and increment cycle, the processor calculates the operand by taking the contents of source effective address of the to the current value of the PC, it adding and offset) (the 22 location Thus, the location 24 (the next instruction). to now points which calculation the of result the is address operand source OFFSET+PC = 54424 = 10@(8), causing the contents of location 1@ to be moved into register 3. ADDRESSING The index mode MOV is statement: 100-.-4(PC ,R3 ) equivalent MOV to the relative mode is the offset for the location counter (.) holds instruction (20, in this case) reach 1location as 24 160-20-4 Therefore, for PC(24(8)) yields (the or the both next index the statements index mode statement. The current address of the first word of the the PC has to move down 4 bytes to the and instruction). So, 54(8). mode, the effective operand. Thus, statement: 100 ,R3 130-.-4 written MODES move 3. the offset address contents of the (54(8)) (54 + 24 location = offset could added to 100 100 (8)) into of be the the register NOTE The addressing form @#E differs from in that the second or third word of the instruction contains the absolute address of the operand, rather than the relative distance between the operand form E and the the PC (see instruction Section absolute location instruction is moved which it was CLR 1@@#, from 5.14). e#100 Thus, clears even 1if the point assembled. the at See the description of the .ENABL AMA function in Section 6.2.1, which causes all relative mode addresses to be assembled as 5.12 RELATIVE absolute mode addresses. DEFERRED MODE Format: QE The relative deferred mode is similar in above, except that the expression address of the operand. 1In other words, mode instruction to the word address is of added the to the contents operand. operation E is to used as a operand the of the PC to the relative pointer to the following the yield a , Example: MOV @X,R0O ;Relative ;the PC, ;location ;jto by to move the current the whose location address X value contents into is of of the pointed register 4. pointer ADDRESSING 5.13 The BRANCH branch MODES INSTRUCTION ADDRESSING instructions are l-word instructions. The high-order byte and the low-order byte contains an 8-bit signed offset (seven bits, plus sign), which specifies the branch address relative to the current value of the PC. The hardware calculates the branch address as follows: contains the operator, 1. Extends 2. Multiplies than 3. MACRO-11 the a result by 2, through creating to the reverse offset is Hence following = (E-PC)/2 added the -2 offset = to in Branching 2. Branching (global) from to truncated generate an Since the range TRAP the a EMT and more applicable 1location eight error code (A) section to that 1is to to word form the offset from next word bits. to the bits. in the assembly an external another defined a branch address that is branch offset is a value as out of that does +127(10). TRAP instructions word, information byte. 1If the do is range, meaning not within lie EMT or not use TRAP of the expression Expressions greater than an error information on traps system manual code the low-order transferred value listing. the program -128(10) the byte of the word. eight bits, and For eight PC rather INSTRUCTIONS the 1instruction in the low-order expression, one to the offset PC, the PC is moved to following calculation. symbol Specifying that the USING the the truncated (E-.-2)/2 conditions 1. 5.14 form 8-15. byte of address. offset the operation bits a offset. listing: an offset performs Word 3. the value (PC=.+2). The the word of the result to the current effective branch address. Word the sign Adds specified When the (T) see the (see Section byte of to the trap handlers instruction is followed by 1is is stored in the low-order 377(8) are truncated to generated in the assembly PDP-1l1 .3 Processor In the Handbook Preface). and G G CHAPTER 6 GENERAL ASSEMBLER A MACRO-11 directive is placed in Only one directive 1is allowed have a blank operand field or one differ with each directive. General assembler directives the DIRECTIVES operator field of a source line, per source line. Each directive may or more operands. Legal operands are divided into the following categories: l. Listing 2. Function 3. Data 4, Radix 5. Location 6. Terminator 7. Program 8. Symbol 9. Conditional 1#. Each 1is for an section File control control storage and numeric counter control control sectioning and boundaries control assembly control described in its alphabetical own section 1listing of of this the chapter directives (see and the Table 6-1 associated reference). Table 6-1 Directives in Chapter Six Section Directive Function Reference .ASCII Stores delimited string as a of the 8-bit ASCII code characters. .ASCIZ Same as followed .ASCII by a except zero the sequence of their string 6.3.4 |is 6.3.5 byte. (continued on next page) GENERAL ASSEMBLER DIRECTIVES Table 6-1 (Cont.) Directives in Chapter Six Section Directive Function Reference .ASECT Similar to .PSECT. . BLKB Allocates bytes of data storaqge. 6.5.3 . BLKW Allocates words of data storage. 6.5.3 .BYTE Stores of 6.3.1 .CROSS Enables cross .CSECT Similar to .DSABL Disables successive 6.7.2 bytes data. reference. 6.2.2 .PSECT. 6.7.2 specified assembler functions. . ENABL . END « ENDC Enables specified assembler £.2.1 functions. Indicates end of source Indicates end of conditional 6.2.1 input. 6.6 assembly 6.9.1 block. . EVEN Ensures that location counter current is value of the 6.5.1 even. .FLT2 Generates 2 words of storage for floating-point number argument. each 6.4.2.1 .FLT4 Generates 4 words of storage for floating-point number argument. each 6.4.2.1 .GLOBL Defines . IDENT Provides an .IF listed symbols additional object means global, 6.8.1 of labeling 6.1.4 condi- 6.9.1 module. Assembles block tions met. are as if specified | .IFF Assembles false. block if condition tests 6.9.2 .IFT Assembles block if condition tests 5.9.2 whether 6.9.2 conditional 6.9.3 true. . IFTF .IIF Assembles block regardless condition tests true Permits writing assembly block. . INCLUDE. Includes another . LIBRARY Adds file to MACRO-11 list. a one or of false. line | MACRO-11 source library file. 6.10.2 search 6.10.1 (continued on next page) GENERAL ASSEMBLER DIRECTIVES Table 6-1 Directives (Cont.) in Chapter Six Section Directive .LIMIT Function Allocates two words for storage. At link puts the lowest address of time the .LIST Reference load 1image saved first words free in second. the Increments certain 1in and word the of count Decrements listing count certain types of code. .NOCROSS Disables . ODD Ensures that location . PACKED or 1lists 6.1.1 or suppresses H.1.1 reference. the current counter Generates digits per the code. .NLIST cross of the address of the following the image listing types first 6.5.4 is packed 6.2.2 value of the 6.5.2 two 6.3.8 odd. decimal data, byte. . PAGE Starts a new listing page. 6.1.5 . PSECT Declares names and establishes 6.7.1 . RAD5S0 Generates for program sections their attributes. data 1in Radix-5@¢ packed h.3.6 format. .RADIX Changes radices portions of . REM Delimits a .RESTORE Retrieves a previously the throughout source section of or in 6.4.1.1 program. comments. .SAVEd 6.1.6 program 6.7.4 section. . SAVE Places top the of current the program program section section on 6.7.3 context stack. . SBTTL Produces a table immediately listing and page .TITLE in Assigns the a name puts the assembly .WORD Generates the to the headings Defines 6.1.3 on object each module page 6.1.2 of listing. listed object contents listing. and .WEAK of preceding the assembly puts subheadings on each symbols successive module. as WEAK. words of 6.8.2 data in 6.3.2 GENERAL ASSEMBLER DIRECTIVES 6.1 LISTING CONTROL DIRECTIVES Listing control of line all directives printer (see control Figure the 6-1) content, and assembly listing output. On the first line prints the following (from left to right): 1. Title of the object module, as directive (see Section 6.1.2). 2. Assembler 3. Day of 4, Date. 5. Time of day. 6. Page number, The second text the line of specified version In the 1line In the is no the printer generating generating explicit each established pagination Figure page, through 6-2) MACRO-11 the .TITLE identification. each assembly listing 1in teleprinter statements of and (see week. 6.1.3). statements format, teleprinter page contains last-encountered .SBTTL format (Figure 6-1) one are more than format more truncation word (Figure than one of output 6-2) word to 80 are the directive binary listed binary listed characters subtitle (see Section extensions for horizontally. extensions vertically. by the for There assembler. ASSEMBLER DIRECTIVES 1344Nq [OQWAS JO PuUd 3€ JT 3534 JB3UIBMOY9ID4OS pTJ73OuQUTWNAUOI5R}S T 34 NOW $1 “NMTWON OO 1d3N81%3S N3O4W " " TM 292000 2¢1010 L9LIT0 1v0500 Pr1000 I¥0500 ¥51000 100 £V 2571000 2921000 241000 ?2L1000 1Sv£00 +¢09000 202000 292000 ZAAV]Y| 922000 LE2T1020 c,0v000 +¢9200 ,C9¥00 +C9C00 104210 LES98T I£vE£0 0 £90 1 0910 2 10 0 ?2£100 cv10 0 ¢10 0 9210 0 ¥?2100 $C $ 4H3139 dn0W 374 sy aav dnou 374 4HJI139 dW g181 194 NOW N3iNyL i 9¢¥000 (54)27d110 $E 1 09 0 TvE£0 120 90 LPET0 04520 v020 0 c1c0 0 2120 0 c c0 0 T1AYR)A 9£20 0 0vrZ00 tvr200 ?2¢200 €520 0 9000 vrS2000 WAS139 At FIHIFS (THTOL4HMS)Y (TH)4(0Y)CH108Y 0¥4(SY)C8LD F+10dHASETY T(d4S+) 0T4dKAS ELE: ‘QJuTS0e&q(4QOduRV0gsYS SMsuTdya}s g8A01N -(1Y) i NOW NOW 471J a1 4 oy <0y +(TY) ¢9I3NdJWYAHSI 4HJI139 04FIXTIS (d45)~-¢Ty TH¢P+10dUAS -t ou 41 uUlIepe 09 g@anbtI-9o1dwexyJo2uTuwcflumATquasybutistT GENERAL ooz 00c 00< ?£0 002 010 002 00¢ =2anbtdT-9(*3uo) o1dwexdjoaurTa23uTridATquassybutr3st 0LOC¢4P00C¢450024¢v00CE¢£00C¢4C0L0¢T1L04¢0E0C A e 00c 00c 002 002 00c 000 6-6 OLy 100 I10 I£0 ?2¢0 100 W 120 $ L9SHETTOS ¢ NWINFCIH 943009 O¢MANLSNDG ¢ s4apoqe R 002 0t 002 W {EO &EFPE: EFDN: &EFWR: 3lAg 3iig’ 31A9" c1dl11d MENDR: LSTITIN® <4110 00¢ &EFWY: L Rl erqel 0341 ST 00c - 002 00c 00¢e 002 LA c?¢000 cLe00o0 c0£000 cI1£000 cCE000 cEL000 cbL000 c9£000 cIv000 cctv000 Y j I m £ 3 1 Q I J S Y a n i e A 0 } 3 5 B U I P U O 4 S 3 L I 0 D 0 G O Y a N T e A o u a y f a d e d s 4 T [ T 0 U B Y 3 0 U F 0 S A Y V Y J 4 B Y 3 S 3 T Q * P B A J 3 S A L 0 C 4 0 C ¢ 0 Z ¢ 0 2 4 0 2 4 0 C 4 0 2 ¢ 0 8 ¢ 0 2 0 2 4 0 2 4 0 C 4 0 2 4 0 2 0 0 C Z C ¢ “ C “ E L O ¢ C 0 C “ Y E 0 Z ¢ 0 4 0 4 0 2 4 0 2 ¢ 0 S Y O ‘ P r O E t O C H “ T V O C O V O “ L E D 9 E 0 4 0 C 4 0 4 0 C 0 C “ 0 C Y 0 4 ¢ €L200 LI£O0EC¢OP9FT0CO“0¢4STOC“0YVTFICO0‘ELZTO04CZTIO04C¢TCI0O4S0OCT02O X34 Xapujy ¢0 240 240 240 20 240 20 20 2 GENERAL ASSEMBLER DIRECTIVES 68 SZAX &EFR : JLAg? &EJO: JLag’ 3LA9° T c00 c1o0 cZo AR ¢00 0c0 Qg0 00c cS5£00 cov0 0 GENERAL ASSEMBLER DIRECTIVES anoqe se 31 a[pueH{ 0y (SY)CELLD Jeyd YsTy a3yl peoqé (TH)(0Y)TILOSN Jrjaqey4re Joj Jeyd 3sdTy 3sal! 4V L4/ (58)T14LLD dA0H NOW d114 . WAS139 A I W G S T L9L910 9000 9000 104210 9v000 Iv050 T¥050 0 0 0 0v0 0 £10V I£v£0 0 £90 29 0 0 920 0 12v£0 1 09 0 2 10 0 0£10 0 2£10 0 vr10 0 t510 0 c?10 0 cL10 0 ¥020 0 2020 0 v1010 - - NN 0N O T £1 vi 6-7 21 81 1é p12A-oJsTuir3qdtauw9noaedsbaxtrysaTgyl 12000 005911 212000 +C?220 00 Cec00o TTv¥£0 0 vCCo000 IC0090 ?2¢200 cEc000 a¥0000 £C10800 ?£2000 LVETO 0 ov¥coo0o0 S9L(501 /292000 v¥200 0 0LEE00 ?2¢2000 €520000 004910 109210 ¥5200 092000 900000 020000 $1 ANL13S (dS)0dUHT+AS QM T NiN13y g1S1 $¢ 194 NOW $C cd e 6-8 A A A LISITIN® X34 AOKW 8rqey 21491 0 - dW3J JNd ERE 040yY4(+(TM)SY)>ZT9L D deys pue 359 1 P(S4)27+I0dW49112ASE¢TY M0Y43S2O599NN34TS44u¢lE3e9U4g150Ie3MO3MepTJOuT[UOpd4uO4UdJ3OPJ4B40Y0[ODQ[1W08AQR4SWDS4T1S384RNq M4931O0544Sa7uYeydsJsTYOI0UO7M[2OQ2UW3OAURSSTjEpuPLeulUNqOyJ24d Jx41apuByYO}IWmAyl£34T8Q3e4IsISYT1a7NTeOAU0B}Ys3n83i50eUSpU£T0ePSUAUOYTLSA3JLyaI}YOINMQDOTS03S41AuQYeyd‘3PNadATlL8u3AsSAapLe133UT04 @2anbtg z-9 (*3uod) o1dwexy Jo isjuriadsral ATqus sy butystT YHJ139 374 aav MHJ139 JNAOK GENERAL ASSEMBLER DIRECTIVES o AW P GENERAL ASSEMBLER 6.1.1 .LIST and .NLIST DIRECTIVES Directives l— Formats: .LIST LLIST arg +.NLIST .NLIST where: arg arg represents arguments As indicated above, the one or defined listing more in control of the Table 6-2. directives optional may be symbolic used without arguments, in which <case the 1listing directives alter the listing level count. The listing level count is initialized to zero. At each occurrence of a .LIST directive, the 1listing 1level count is incremented; at each occurrence of an .NLIST directive, the 1listing level count listing 1is 1is decremented. suppressed (unless Conversely, when the level When the count is the level count is line contains greater than zero, negative, the an error). the listing is generated regardless of the context of the line. Finally, when the count is zero, the line is either listed or suppressed, depending on the listing controls currently in effect for the program. The following macro selectively list definition portions employs of the the .LIST and .NLIST directives macro body when the macro to is expanded: .MACRO ; ; ; LTEST A-this line should .NLIST B-this line should .NLIST C-this ;List list not list test ;Listing ;Listing level level count count is is @. -1. ;Listing level count is -2. ;Listing level count is -1. level count level count level count level count should not list ; line .LIST D-this line should not 1list ; ; ; E-this F-this G-this .LIST line line line | should should should list 1list 1list ;Listing ;Listing ;Listing ;Listing is is is is 4. @. @. 0. 1list list 1list list ;List macro expansion. :Call the macro ;Listing level count is ;Listing level count is ;Listing level count is ;Listing level count is 0. @. @. @. . ENDM ; ; ; ; .LIST LTEST A-this line E-this line F-this G-this Note that ME line line should should should should the lines following line level <count remains 4@. If a beginning of a program, all macro .NLIST directive is encountered. E will 1list because .LIST directive expansions will be the 1listing 1is placed at the listed unless a GENERAL An important to be purpose 1listed restored to the When used with listing level used to of the selectively value ASSEMBLER level and existing DIRECTIVES count yet is exit prior to to allow with the the macro macro listing expansions level count call. arguments, the listing directives do not alter the count. However, the .LIST and .NLIST directives can be override current listing control, as shown 1in the example below: .MACRO XX .LIST ;List .NLIST ;Do next line. X=. . not list remainder of macro ;expansion. . ENDM .NLIST ME ;Do not list macro expansions. XX X=. The symbolic arguments described in Table combination with each listing directive, space. For statement, any the allowed 6-2. other. each argument for argument not associated use with must be default Table Argument SEQ¥* Arguments of by 1included assumption directives are a comma, 1in the (List or No tab, or control list) is The default assumptions in Table 6-2. for 6-2 Listing Control Default List listing separated specifically applicable throughout the source program. the listing control directives also appear Symbolic the These arguments can be used singly or in 1If multiple arguments are specified in a Directives Function Controls the numbers assigned listing If this through number an .NLIST MACRO-11 generates of the sequential to the source lines. field 1is suppressed a SEQ tab, directive, effectively allocating blank space for the field. Thus, the positional relationships of the other fields in the listing remain undisturbed. process, line for During MACRO-11 the examines assembly each source possible error conditions. For any line in error, the error code is printed preceding the number field. * If the the same listing line is .NLIST arguments SEQ, LOC, BIN, and SRC are in effect at time, that 1is, if all four significant fields in the are to be suppressed, the printing of the resulting blank inhibited. (continued on next page) GENERAL ASSEMBLER DIRECTIVES Table 6-2 (Cont.) Symbolic Arguments of Listing Control Argument Default Directives Function MACRO-11 does not assign line files that have had such assigned by other programs (an numbers to LOC* List for Controls the listing of the current counter field. Normally, this the does instance). field However, is if it LOC not suppressed. is suppressed through directive, MACRO-11 NLIST not generate allocate space for a tab, the nor current location effectively subsequent 1is described of (LOC) (while relationships) the field all preserving to by occupied the the field. the 1listing of code. If this generated field suppressed through directive, 1left-justification source field occurs described above for listing of code manner it as left-justifies normally Controls binary counter fields positional position counter's does field, the case with the SEQ field above. Thus, the suppression List editor program, location BIN¥* numbers an 1is .NLIST in BIN of the the same the LOC field. BEX List Controls the binary eXxtensions (the locations and contents beyond those that will the source subset SRC* List COM List of Controls Controls statement the the BIN This is a argument. listing the line). binary fit on of source 1listing of lines. comments. This 1is a subset of the SRC argument. The .NLIST COM directive reduces listing time and space when comments are MD List not desired. Controls the listing definitions and of macro repeat range expansions. MC * If the List the .NLIST same time, to arguments listing are line inhibited. is Controls the listing of macro and repeat range expansions. be that SEQ, LOC, 1if all is, suppressed, the BIN, four printing and SRC are significant of the in effect fields resulting (continued on calls next in at the blank page) GENERAL ASSEMBLER Table Symbolic Argument Arguments of DIRECTIVES 6-2 (Cont.) Listing Control Default ME No Directives Function list Controls the listing of macro the listing of macro expansions. MEB No list Controls expansion directive binary 1lists code. A .LIST MEB only those macro expansion statements that generate binary code. This is a subset of the ME CND List argument. Controls the 1listing of wunsatisfied conditional coding and associated .IF and .ENDC directives 1in the source program. only LD No list A .NLIST satisfied Controls the CND directive conditional listing of lists coding. all 1listing directives having no arguments, in other words, the directives that alter the TOC List listing Controls level the contents count. listing during of the assembly table pass 1 of (see Section 6.1.3 describing the .SBTTL directive). This argument does not affect the printing of the full assembly 1listing during assembly pass 2. S YM List TTM No Controls list of the table resulting from the source program. the 1listing the assembly Controls the 1listing The default 1is set format. Figqgure 6-1 output line printer output 6-2 illustrates the to symbol of format. line printer 1illustrates the format. Figure teleprinter output format. Any argument specified in a .LIST/.NLIST directive listed 1in code (A) in Table 6-2 causes the directive the assembly listing. The control listing through Section switches 8.1.3 options can also included in the and/or the appropriate be to system 6-3 shows reflecting the program the output. and wuse a 1listing, of effects the such produced .LIST and directives at string than with error assembly time to MACRO-11 The control (.LIST 1line ©printer in directives on the those an manual). .NLIST have other flagged specified command switches overrides all corresponding listing directives specified in the source program. Figure be use in of or (see these .NLIST) format, the assembly source 1listing SO, GENERAL ASSEMBLER DIRECTIVES X3g4 1SITIN' | 81 -4 L I 9684 G516 EB-UEBM-B0O AEBPJ4NIES 00°"S0M OHIYW 3ITdWUYX3 TOYINOI ONILSIT 6-13 0c ?1 1 8 14 L- M G Cd 050 0 Lo 6C 6-14 |$X 0t 18I7° LSITIN® X34 100000 JVKWLIST 040000 100000 JVKLST b3s 10 0 0 83s B3s 090000 c00000 100000 ¢?0000 F?200000 ¥0000 £000000 ?2000 15171° X394W0D 15I7° JVH1ST Jyonm* 1817 Wil 1SITN'® Pegelet qyom:* £0 0 0 0920000 JVHLST 1S5I7IN® ¢W03 EAR X349LD WoJ W0J 8¢ Jys qyom:1SITIN® AR R W£S3o0X3TU3JA9yN4VWA0SITG>H€S.}43S83Q9uNU}JJUUUI1aIW5WM9W7OOOINT4SSI3AUUTIl]p1P5U8E7PAPUIXAAUSUTQ1587 a21Inbhtd€-9(°3u0d)DBuilsITpSRaIT[EdYqUnJeTp4uIodYiSsSaTdSMU&OJOYUI3IS5TBU3MYIEDNJUBDUTB}TW1SI5ISO9]TDTO0I3U0DSOAT3D21TQ 0v0000 0v¥0000 ¥00000 c00000 ?¢¥0000 050000 100000 c00000 £00000 181I71° GENERAL ASSEMBLER DIRECTIVES X34 0£0 0 ARNL|EALN X34 qyonm: 18I IN3* £e R GENERAL ASSEMBLER 6.1.2 DIRECTIVES |.TITLE | L.TITLE Directive Format: .TITLE where: string string represents characters. an identifier of 1 or more Radix-50 Appendix A.2 contains a table of Radix-50 characters. The .TITLE directive assigns a name to the object module. The name assigned is the first six non-blank, Radix-5@ characters following the .TITLE directive. All spaces and/or tabs up to the first non-space/non-tab character following the .TITLE directive are by MACRO-11 when evaluating the text string. the first six are checked for ASCII legality, part of the object module name. For example, .TITLE causes the PROGRAM assembled TO PERFORM object DAILY module ignored Any characters but they are not the directive: beyond used as ACCOUNTING to be named PROGRA. This 6-character name bears no relationship to the filename of the object module, as specified in the command string to MACRO-11]. The name of an object module (specified in the .TITLE directive) appears in the load map produced at link time. This is also the module name which the If Librarian will the recognize. .TITLE directive is not specified, MACRO-11 assigns the default name .MAIN. to the object module. If more than one .TITLE directive is specified in the source program, the last L.TITLE directive encountered during assembly pass 1 establishes the name for the entire object module. If .TITLE directive if the the is specified without first non-space/non-tab character not Radix-50¢ character, the directive (A) in the assembly listing. is an object module name, in the object module name flagged with 6.1.3 L.SBTTL Directive an -error or is code l'SBTTLl Format: .SBTTL where: string string represents an characters. identifier of 1 or more printable ASCII GENERAL The .SBTTL immediately following the page until altered .SBTTL in the the by the a 1is wused to ©produce a table of contents the assembly 1listing and to print the text directive on the second line of the header of listing. Conditional to be printed listing. as assembly sequence subheading in .SBTTL directive the text in the will be listed program. For assemblies text Conditional During The subsequent directive: .SBTTL causes DIRECTIVES directive preceding each example, ASSEMBLER assemblies the pass number, second 1, the a 1line table page in the of header contents number, and the of the containing text assembly the 1line accompanying each -SBTTL directive is printed for the assembly listing. The listing of the table of contents is suppressed whenever an .NLIST TOC directive is encountered in the source program (see Table 6-2). An example of a table of contents MTTEMT - TABLE OF RT-11 is shown MULTI-TTY EMT SE in MACRO Figure V0S5.00 6-4,. Saturday 08-Jan-83 10:00 CONTENTS S50~ S51- i 1 +MTOUT - Sindle character outrut +MTRCTO - Reset CTRL/0 EMT 92— i +MTATCH - Attach o4 1 +MTDTCH - Detach 1 +MTPRNT S6~ 57 1 +MTSTAT - Print message EMT Return multi-terminal 1 MTTIN Single S859~ 60~ 1 1 1 MTTGET TTRSET MTTPUT 62~ 1 MTRSET 63~ 1 ESCAFE LJIDENT 6-4 - - EMT to terminal EMT from a terminal 55— Figure 6.1.4 listing EMT sustem status Get & character from the ring Reset terminal status bits Sindle character outeut buffer Stor SEQUENCE character and detach all terminals TEST SUBROUTINE Assembly EMT inrut Listing Table of attached to a3 Job Contents |.IDENT| Directive Format: .IDENT where: /string/ string represents characters or version a string of six or which establish the number. This string global symbol printed in the directory link map and of fewer Radix-50 program identification is included in the the object librarian module listing. and is GENERAL / / represent be any equal delimiting paired sign semicolon the (;), as In addition to label object An the example of not match, The if assigned with .IDENT an angle as the the text If the illegal to the the the directive is more the 1last which The RT-11 string one such 1is converted to .IDENT directive directive part linker of the is encountered object allows linker wuses the pass to establish all of the object The the the or the character is delimiting module version character with with the allows the an is error .TITLE user to number. below: /V@1.00/ than forms than (<), string itself (see Note delimiting characters do object shown other delimiting .IDENT directive program delimiters may bracket Radix-50 included in the global symbol directory of character string also appears in the link map and the Librarian directory listings. When These characters, L.IDENT directive is flagged the assembly listing. 6.1.3), module the character name Section . IDENT long contained within Section 6.3.4). the (see left not in or characters. printing (=), used, the code (A) in directive ASSEMBLER DIRECTIVES only one encountered establishes module representation and the object module. produced at 1link in a the given This time program, character string identification. .IDENT string in a first .IDENT directive encountered the character string that will be program. The during the identified first with modules. RSX-11M task builder allows an .IDENT string for each module in program. The TASK Builder uses the first .IDENT directive in each module to establish the character string module. Like the RT-11 Linker, the that .IDENT directives 5.1.5 J.PAGE encountered Directive/Page on the that will be RSX-11M Task first identified with Builder uses the pass. [PAGE] Ejection Format: . PAGE The .PAGE page directive eject arguments at used within points the the causes a It also counter causes the page to be cleared. appear listing. When used during the within the a macro assembly of skip in encountered. line sequence in and is desired to the definition, the macro source program listing. top This of the to perform directive next takes page when number to be incremented and The .PAGE directive does the .PAGE definition. operation is performed as the macro itself the page number is also incremented. is directive 1is a no the not ignored Rather, the page eject expanded. 1In this case, GENERAL ASSEMBLER Page ejection 1. is accomplished in DIRECTIVES three other ways: After reaching a count of 58 lines in the 1listing, MACRO-11 performs a page eject to skip over page perforations on 1line printer paper and to formulate automatically 2. teleprinter changed. output A is page eject encountered. macro into pages. performed If the when The a form-feed definition, a page definition, eject page number form-feed character occurs 1is not character is appears during the within assembly a of the macro but not during the expansion of the macro itself. A page eject resulting from the use of the form-feed <character causes the page number to be incremented and 3. A the page line sequence eject is counter performed file. In this <case line sequence count is h.1l.6 .REM Directive/Begin to when cleared. encountering the page reset, Remark be number is a new incremented source and the | .REM | Lines Format: .REM where: comment-character comment-character represents a character end of the comment character The .REM into lines directive a programmer number characters of lines. 1is For . TITLE Remark . REM All the & to be found. CLR text Any as the the to insert comments. a block of comments to precede the comment between the specified The comments may span example: example that comment treated marks when reoccurs. a MACRO-11 source program without having with the comment character (;). The text delimiting any allows that block resides lines until character may here is interpreted another ampersand be in used place by MACRO-11 character is of the ampersand.& PC . END 6.2 The FUNCTION DIRECTIVES following function directives are included in a source program to invoke or inhibit certain MACRO-11 functions and operations incidental to the assembly process itself. GENERAL ASSEMBLER DIRECTIVES [.ENABL] .ENABL and 6.2.1 [.DSABL] .DSABL Directives Formats: . ENABL arg .DSABL arg where: represents arg one arguments defined of more or in Table 6-3. optional the symbolic Specifying any argument in an .ENABL/.DSABL directive other than those listed code (A) in Table 6-3 causes that directive to be flagged with an error in the assembly listing. Table 6-3 Symbolic Arguments of Function Control Directives Argument Default ABS Disable AMA Disable produces absolute Enabling this function causes all relative Enabling this CRF Disable ' Enable function To format. FILES-11 in output binary Binary Formatted to output convert this Absolute the by required (as format Loader), use the FLX utility. addresses (address mode 67) to be assembled as absolute addresses (address mode 37). This function is useful during the debugging CDR Function | phase of program development. function this Enabling source causes from 73 to the end of the line, to columns be treated as a comment. The most common this feature is to permit sequence of use numbers in card columns 73-84. inhibits function this Disabling generation of cross-reference output. meaning has only function cross-reference output generation specified in the command string. causes LC Enable this Enabling point causes disabling this floating-point Disabling convert before function truncation; if is floating- function rounding. this function causes MACRO-11 to all ASCII 1input to upper-case processing it. (continued 19 | Disable o) FPT the This on next page) GENERAL Symbolic ASSEMBLER Table Arguments of Argument Default LCM Disable 6-3 (Cont.) Function Control This argument, -.IF if enabled, <conditional IDN and case .IF are DIF to be By not causes assembly sensitive, directives Disable Directives Function MACRO-11 LSB DIRECTIVES case alphabetically default, by encountering a new label, a .PSECT directive or a directive 1in the source program, LSB directive symbol (1) block another (2) The basic regard function instances where followed the by Attempts to error An example program, symbols declares or symbol, Enable and 6.7.4). 1local in the .ENABL in encountered LSB the in a of this If opcode GBL within field the a an a this finds an it symbol external .ENABL/.DSABL (described same of field, undefined L.ENABL the for undefined MACRO-11 function an LSB source default, symbol on a MACRO-11 any opcode (U) the .DSABL in libraries By the listing. causes matches in an with 6-5. macro that and used be in flagged assembly enabled, declares until are Figure depending setting symbols section disabled. Disabling output 6.7.3 statement. either option Sections .RESTORE appearing is original dismissal also known symbol a data, and if unknown leave store temporary section those may shown option error, the to with to to LSB .SAVE definition MACRO-11 is .DSABL directive typically all or .PSECT directive paired return the argument, search label, the as is local until encountered, to (P) of directives, .ENABL new desirable program .RESTORE an 1limited This symbolic terminated this is define code a temporarily program an a 1is through (see alternate PNC a current directives macro it section. accompl ished This of .PSECTS section program not following to program is LSB is. symbolic .RESTORE or directive, to which .ENABL encountered of establishes another directive Disable these sensitive. This argument permits the enabling or disabling of a local symbol block. Although a local symbol block is normally established MCL the directives below) . inhibits PNC binary statement is module. (continued on next page) GENERAL ASSEMBLER DIRECTIVES Table 6-3 (Cont.) Symbolic Arguments of Function Control Directives Argument Default REG Enable Function When specified, the .DSABL REG directive inhibits the normal MACRO-11 default register definitions; 1if not disabled, the definitions listed below remain default in effect. RO=%0 R1=%1 R2=%2 R3=%3 R4=%4 R5=%5 SP=%6 PC=%7 The .ENABL REG statement may be used as the logical complement of the .DSABL REG directive. The use of these directives, however, 1is not recommended. For logical consistency, use the normal default register definitions listed above. GBL Enable This argument, if disabled, causes MACRO-11 to mark all undefined references in the 1in error (U) assembly pass 2 with a assembly listing. The default for this option is enabled, which causes MACRO-11 to treat all wundefined symbol references as global, allowing the 1linker to resolve them. FPase 1 MACRO V05.00 Saturday 08-Jan-83 10.26 .ENABL/.DSABL i +.TITLE LJENABRL/.DSABL - 3 i+ 5 y - 4 + ILLUSTRATE é 7 .ENABL/.DSABL LC +ENABL LC 8 9 +MACRD 11 +ENDM 10 12 13 14 15 16 000000 17 000000 124 150 151 i8 19 20 000033 000033 21 22 tSTORE MACRO IN LOWER CASE . 124 110 111 000001 Figure 6-5 TEXT $%¢ L IST +NLIST ME BEX +ASCII TEXT /This $%% a3 lower case string/ +ASCII /This is a8 lower case string/ is i Invoke macro in lower case +DSARL LC iNow disable lower case TEXT +ASCITI iRE-INVOKE MACRO IN UPPER CASE WAS /THIS WAS A LOWER CASE STRING/ +END Example of .ENABL and .DSABL Directives GENERAL ASSEMBLER DIRECTIVES | .CROSS | | .NOCROSS | 6.2.2 Cross-Reference Directives: .CROSS and .NOCROSS Formats: .CROSS nCROSS Symlysymzp..usymfl - NOCROSS -NOCROSS where: syml,sym2,...symn syml, represents sym2,... symbols symn legal The .CROSS and the included in the assembler. /CROSS - These qualifier legal are symbolic specified, separator (comma, directives was have wused an in default, all the cross-reference listing to user references When the list listing of The Any definition .CROSS the the that cross-reference The .NOCROSS of all reference without is used the a with the In the LOC1l following and LOC2 example, are not the a the in the the the and module. The in the a list or symbol without the module symbol a is list. .NOCROSS the excluded 1list, symbols. next from disables When cross-reference a disabled. before is for 1list, is after and list, symbol 1listed or select definition module appears are MACRO-11 /C[R] the a any symbols symbols the used symbol definition included in symbol without used for all by the to the symbols is that a directive is used with a symbol list, the listed symbols is reenabled. to multiple tab). the in without symbols listing. 1listing for directive or if 1line includes used the wused directive, cross-reference 1is only symbol disabled all .CROSS is directive of listing when that be directive cross-reference symbol can 1listing reenabled directive every symbols. .NOCROSS Cross-reference and/or command By cross-reference When separated space, effect the capability. specified are .NOCROSS directives control which <cross-reference listing produced by cross-reference the names. they the the .CROSS listing of of LABEL1 and the reference cross-reference listing. Example: .NOCROSS LABEL1: MOV LOCl,L0OC2 .CROSS In the LOC2 not next are cross ;Copy data ;Reenable example, included ;Stop in the definition the cross included. of cross LABEL2 reference, reference and but the reference the reference reference to Example: LABEL2: .NOCROSS LoOC1 MOV LOC1,L0OC2 .CROSS ;Copy LOC1 sReenable ;of LOC1. - ;Do 6-22 not cross data reference cross LOC]1 reference LOCIl to is GENERAL ASSEMBLER DIRECTIVES The .CROSS directive, used without a symbol list, cannot reenable the cross-reference listing of symbol 1list of a .NOCROSS directive. 1listing cross-reference of be wused to a symbol specified in the the if addition, In all the symbols in a module is disabled, the .CROSS directive used with a symbol list will have no effect until the cross-reference listing is reenabled by the .CROSS directive used without list. symbol a The .CROSS directive, with no symbol list, is equivalent to the .ENABL the and .NOCROSS directive, with no symbol list, is CRF directive, 6.3 DATA STORAGE DIRECTIVES equivalent to the A wide range of directives, data ASCII and data can types be generated with the conversion characters, and radix-control operators in the following sections. described .3.1 .DSABL CRF directive. [.BYTE]} .BYTE Directive Format: .BYTE exp .BYTE expl,exp2,expn ” where: exp, ;Stores the binary value of the ;expression byte. ;Stores the binary values of the list :of expressions in successive bytes. represent expressions that must be reduced to 8 bits expl, . Each expression will be read as a of data or less. expression, the high-order byte to be 16-bit word exXpn Multiple expressions must be separated by commas. . . truncated. The high-order byte must be either all error results. (T) a truncation or Zeros The .BYTE directive is used to generate data in the next in the object module. successive bytes of binary Example: SAM=5 .=410 .BYTE “D48,SAM ;The value 060 (octal equivalent of 48 sdecimal) is stored in location 4140. ;The value @5 is stored in location ;411. The construction "D in the first operand of the .BYTE directive above illustrates the use of a temporary radix-control operator. The function of such special unary operators 1is described in Section 604'1‘2‘ - GENERAL At link in a time, value or linker question. it is having issues a For likely more .BYTE 23 .BYTE A A: that than a eight truncation example, possibility: ASSEMBLER relocatable bits, (T) the DIRECTIVES in error for following ;Stores If an expression following interpreted as a zero: the case the octal 23 in value builder module create next A result task object truncation .BYTE will the statements ;Re'locatable ;Cause expression which in such a byte. will probably error. directive is null, it 1is =420 .BYTE Note that .BYTE in ' the ;Zeros above directive. implicit other declaration by (@), are 6.3.2 example, The three of four stored and 423, four bytes of commas null a comma. Hence, four reserved in the object are ;422, in the in storage operand values, each bytes, each module. bytes 42¢, result field from a the represent an from the separated containing 421, value _.WORD Directive of zero LWORDI Formats: .WORD exp ;Stores the jexXxpression «WORD exXpl,exp2,expn ;Stores ;list the of exp, represent expl, data . by or expressions less. equivalent in next the binary that of must in of the successive reduce to Multiple eéxpressions must be generate successive words of the 177535, commas. the word. equivalents expressions ;words. where: binary 16 bits of separated expn The the .WORD directive object module. is used to data in Example: SAL=0 =500 .WORD 177535,.+4 ,SAL ;Stores i@ in words values 509, jrespectively. 502, and 586, and 504, i GENERAL ASSEMBLER DIRECTIVES If an expression following the .WORD directive contains a null it is interpreted as a zero, as shown in the following example: .=500 ;:Stores the values f, 5, and @ in Ly .WORD value, :location 56¢, ;respectively. 502, and 504, A statement with a blank operator field (one that contains a symbol an instruction mnemonic, a MACRO-1l1 than a macro <call, other 1is interpreted during assembly as an directive, or a semicolon) implicit .WORD directive, as shown in the example below: .=440 LABEL: :Stores the value 1@ in location 440 100,LABEL ;and the value 440 in location 442. NOTE to technique this wuse You should not generate .WORD directives because it may PDP-11 future in included be not assemblers. 6.3.3 ASCII Conversion Characters The single quote (') and the double quote (") <characters are unary Used in operators that can appear in any MACRO-11 expression. value expression 16-bit a cause characters these s, MACRO-11 expression to be generated. When the single quote is used, MACRO-11 takes the next character in the expression and converts it from its 7-bit ASCII value to a 16-bit expression value. The high-order byte of the resulting expression The 16-bit wvalue 1is then used as an (0). value 1is always zero For example, the statement: expression. the absolute term within MOV #'A,R0O moves the following 16-bit expression value into register 9: [oooooooo|01000001| -—Binary Value of ASCII A Thus the expression 'A results in a value of 101(8). by followed be character must not (') The single quote carriage-return, null, RUBOUT, line-feed, or form-feed character; it is, an error code (A) is generated in the assembly listing. a 1if GENERAL When in the double quote is expression and the value as from an their 7-bit absolute ASSEMBLER used, MACRO-11 takes converts them to a ASCII term values. within moves the This the statement: MOV DIRECTIVES the next two 16-bit binary 16-bit value expression. For characters expression is then used example, the #"ABR0 , following 16-bit expression value into register 0: |01000010|01000001| Binary Value Binary Value Thus the The double must not form-feed assembly The ASCII 6.3.4 expression quote be "AB (") results chaeracter, followed by character; a 1if set in a like ASCII value the it is, an is listed error ASCII A B of f41191(8). single carriage-return, listing., character of of quote null, code in Appendix (') RUBOUT, (A) is character, line-feed, generated in or the A.1l. .ASCII Directive "ASCfi] Format: -ASCII where: /string string is 1/.../string a string n/ of printable ASCII characters. The line-feed, RUBOUT, and all other non-printable ASCII characters, except carriage-return and form-feed, cause an error code (I) if used in an .ASCII string. The carriage-return and form-feed vertical-tab, null, characters are flagged with an error code characters end the scan of the line, these MACRO-11 end / / of from the detecting character the matching string. sign semicolon the string match, used, code the (A) in the the delimiters other than may the left angle bracket (<), or the Note at end of section), as long as character is not contained within the itself. or at (see delimiting text not (=), (;) because preventing delimiter represent delimiting characters. These be any paired printing characters, equal (A) if an .(ASCII the If the illegal directive assembly delimiting delimiting is listing. flagged characters do character is with an error GENERAL ASSEMBLER DIRECTIVES The .ASCII directive translates character strings 1into their 7-bit ASCII equivalents and stores them 1in the object module. A non-printing character can be expressed only by enclosing its equivalent octal wvalue within angle brackets. Each set of angle brackets so used represents a single character. For example, 1in 'the following statement: .ASCII the <15>/ABC/<KA+2>/DEF/<5><4> expressions non-printing eight bits <15>, of absolute Angle brackets can character string, usual significance example, the <A+2>, characters. data <5>, and Each or <4> represent bracketed the wvalues expression must less. of reduce to be embedded between delimiting characters 1in the but angle brackets so used do not take on their as delimiters for non-printing characters. For statement: .ASCII /ABC<Kexpression>DEF/ contains a single ASCII character string, and performs no evaluation of the embedded, bracketed expression. This use of the angle brackets is shown in the third example of the .ASCII directive below: .ASCII /HELLO/ ;Stores the binary representation ;of the letters HELLO ;consecutive bytes. .ASCII .ASCII /ABC/<K15><12>/DEF/ /A<K15>B/ ;Stores ;of the the A,B,C,carriage ;return,line feed,D,E,F ;consecutive bytes. ;Stores ;of the ;and B the six A, semicolon (;) and equal sign (=) can used as delimiting characters in the string, but care must be exercised in so doing because of their significance as a comment indicator and assignment operator, respectively, as illustrated .ASCII examples below: ;ABC;/DEF/ ;Stores the binary ;representation of ;the characters ;A, ;F B, in C, D, ;not E, and six ;consecutive bytes; recommended ;practice., <, consecutive The be the in eight binary representation characters in five binary representation characters NOTE in in 1, 5, >, bytes. GENERAL ASSEMBLER .ASCII /ABC/;DEF; DIRECTIVES ;Stores the binary ;jrepresentations of ; the characters A, ;B, and C in three ;jconsecutive bytes; characters D, ;the ;E, F, and ;treated ; as are a ;comment. .ASCII /ABC/=DEF= ;jStores the binary ;representation of ;the A, ;B, ;F characters ¢, in D, E, and six ;consecutive ;hot bytes; recommended ;practice. An equal sign is treated as an assignment operator when the first character in the as illustrated .ASCII by the =DEF= it appears as ASCII string, following example: ;The direct ;assignment ;operation ; .ASCII=DEF 1is ;performed, and ;syntax ;1s error generated ;encountering ;second 6.3.5 .ASCIZ = a (Q) upon the sign. |.ASCIZ [ Directive Format: .ASCIZ where: /string string 1/.../string n/ is a string of printable ASCII characters. The vertical-tab, null, 1line-feed, RUBOUT, and all other non-printable ASCII characters, except carriage-return and form-feed, cause an error code (I) if used in an .ASCIZ string. The carriage-return and form-feed characters are flagged with an error code (A) because they end the scan of the 1line, preventing MACRO-11 from detecting the matching delimiter. GENERAL ASSEMBLER DIRECTIVES / / represent delimiting characters. These delimiters may other than the characters, printing paired any be the or (<), bracket equal sign (=), the left angle semicolon (;) (see Note in Section 6.3.4), the delimiting character is not contained as long as the within text string itself. If the delimiting characters do not match or if an illegal delimiting character is directive is flagged with an error .ASCIZ the used, code (A) in the assembly listing. LASCII directive described the to The .ASCIZ directive is similar except that a zero byte is automatically inserted as the final above, character of the string. Thus, when a list or text the last byte can effectively determine the reflected by string has the string, been an .ASCIZ directive, a search for the null character in with created the coding end of as below: CR=15 LF=12 JASCIZ HELLO: <CR>XLF>/MACRO-11 V@5.08/<CR>XLF> ;Introductory message . EVEN 18S: MOV MOV #HELLO,R1 #LINBUF ,R2 ;Get address of message. ;Get address of output buffer. BNE 18S ;If not null, move another byte. MOVB .3.6 (R1)+, (R2)+ .RADSO ;Move a byte to output buffer. [.RADS50] Directive Format: .RADS@ where: /string string 1/.../string n/ represents a series of characters to be packed. The string must consist of the characters A through Z, 0 through 9, dollar sign ($), period (.) and space ( ). An illegal printing character causes an error flag (Q) to be printed in the assembly listing. If fewer than three characters are to be packed, string is packed left-justified within the word, trailing spaces are assumed. the and GENERAL ASSEMBLER DIRECTIVES As with the .ASCII directive (described in Section 6.3.4), the vertical-tab, null, line-feed, RUBOUT, and all other non-printing characters, except carriage-return and if used in form-feed because form-feed, preventing MACRO-11 from delimiter. / / cause a .RAD50 string. The characters result in these characters end the an error code (I) carriage-return and an error code (A) scan of the line, detecting the represent delimiting characters. These be any paired printing characters, matching delimiters may other than the equal sign (=), the left angle bracket (<), or the semicolon (;) (see Note in Section 6.3.4), provided that the delimiting character is not contained within the text string itself. 1If the delimiting characters do not match or if an illegal delimiting used, the .RADS5@ directive is flagged code (A) in the assembly listing. The .RADS5@ packed directive format. into sixteen be stored in shown allows the Radix-50 user form to below: .RADS5@ /ABC/ .RADS@ .RADS® /AB/ /ABCD/ .RADS50 /ABCDEF/ character in the 1is (SPACE) ; Packs translated ABC 1into Radix-50 into first second word, word. into 1its Radix-50 equivalent, as (C1,C2,C3) are Equivalent 33 35 36-47 equivalents for characters follows: Radix-50 1 through 3 | Value = ((Cl*54)+C2)*50+C3 Value of ABC example: Radix-50 to DEF 34 (undefined) -9 Refer can are A . For packed 1-32 S as Radix-50 be word. Octal (space) Radix-50 (SPACE) into table: A-Z combined in to ABC into one word. ; Packs AB (SPACE) into one word. ; Packs ABC into first word and following Character The data characters ; Packs ;second indicated three is error an bits (one word); therefore, any 6-character symbol two consecutive words. Examples of .RADS5@ directives ;D Each generate allows character with Appendix A.2 for a = table ((1*50)+2)*50+3 of Radix-5¢ = 3223(8) equivalents. GENERAL ASSEMBLER DIRECTIVES Angle brackets special codes example below: .RADS@ (<>) must are to be be used in inserted /AB/<K35> the in ;Stores .RAD5¢ the 3255 text in directive string, as whenever shown in the one word. CHR1=1 CHR2=2 CHR3=3 - .RAD50 6.3.7 <CHR1><CHR2><CHR3> Temporary Radix-50 ;Equivalent Control to .RAD50 /ABC/. Operator Format: “"Rccc where: ccc represents a converted to maximum a three characters third character specified, it is are The "R operator specifies format. This The following used pack to a characters value. are specified, are ignored. 1If assumed that the If to be more than any following the fewer than three are trailing characters that an argument is to be converted to allows up to three characters to be stored example shows how the "R operator might 3-character file type specifier (MAC) into in be single a word. MOV #"RMAC,FILEXT The three Radix-50 blanks. Radix-50 one word. l16-bit of 16-bit number assembled characters sign (#) is directly MAC are to stored in f.3.8 L.PACKED location ;Store used to RADS0 MAC as indicate file immediate extension data (data into object code). "R specifies be converted to Radix-50. This value to that 1is be the then FILEXT. | [.PACKED] Directive Format: . PACKED decimal-string[,symbol] where: decimal-string : represents 31(19) the range sign, counted symbol is a @ it as of long. to but a assigned number decimal digits 9. number Each The 1is not digit from must @ to be in number may have a required and is not digit. a value decimal equivalent digits in the to string. the GENERAL ASSEMBLER The DIRECTIVES .PACKED directive generates packed decimal data, 2 digits Arithmetic and operational properties of packed decimals to those of numeric strings. Below 1is an example of byte. similar per are the .PACKED directive. .PACKED -12,PACK ; PACK . PACKED +500 ; 500 gets is 1is value of 2 packed .PACKED @ ;0 .PACKED -@,SUM ;SUM packed .PACKED 1234E6 ;Illegal gets value of packed 1 decimal number ;E6 will be treated as a ;and given a value of 4 6.4 RADIX AND NUMERIC 6.4.1 Radix Any numeric as an Control or octal radix would below, a and by useful. programmer program depending on FACILITIES Unary Control expression wvalue be CONTROL value in a default. By variable declare his needs. MACRO-11 source Occasionally, using may Operators the a MACRO-11 radix to program however, an facilities affect a term is read alternate described or an entire NOTE When two or more unary operators appear together, modifying the same term, the operators right to are applied to the term from left. 6.4.1.1 .RADIX Directive l.RADlX] Format: +.RADIX where: n n represents Any value one of the other three than radices: null or one 2, of 8 and the 10. three acceptable radices will cause an error code (A) in the assembly listing. If the argument n is not specified, the octal default radix is assumed. The argument (n) Numbers used in is always a MACRO-11 read as source a decimal program value. are initially considered be octal wvalues; however, with the .RADIX directive you alternate radices applicable throughout the source program specific portions of the program. can or to declare within GENERAL ASSEMBLER Any alternate directive such radix remains directive, .RADIX declared in effect until in for In general, 10 radix Where macro it ;Reverts radix. with is expression values described below. 6.4.1.2 through the occurrence of definitions established program, program by the ;Begins a section ;decimal radix. to should the octal not .RADIX of another wused within exists within recommended that temporary Temporary Radix Control the having a rely on or directive. using the code contain .RADIX control operators should be a possible radix conflict source source altered example: .RADIX settings the DIRECTIVES a a user Rather, radix temporary macro definition. macro definition or specify radix numeric control or operators Operators Formats: "D"number" “0"number" "B"number"” ("number" ("number" ("number" These three radix for macro definitions). unary is evaluated is evaluated is evaluated operators allow the as a decimal number) as an octal number) as a user binary number) to establish an alternate a single term. An alternate is useful because after you have specified a radix for a section of code or have decided to use the default octal radix, you may discover a number of cases where an alternate radix is more convenient or desirable (particularly within for example, radix. might Creating best be Thus an alternate radix localized requirement in control operator effect or operator used affects anywhere associated during The with assembly expressions temporary may other radix be only a the as the up-arrow the radix are control and the control (used through to the check use bit of status), a binary time regardless within immediately value radix 1is of the program. following legal. control the The it, term operator (or will radix in Because the it may be expression) be evaluated entity. representative of the methods of specifying operators: Decimal Radix Octal Radix Binary Radix Octal Radix radix operator separated by spaces multi-element term alternate radix the last of the term 16-bit below word be declared temporarily to meet a source program. The temporary radix any temporary a mask declarations numeric "D123 "0 47 "B A0001101 “0<A+13> The can the used radix a accomplished or control and the operator may not be separated, but following term or expression can be tabs for legibility or formatting purposes. or expression that is to be interpreted in should be enclosed within angle brackets, as shown four temporary radix control expressions above. A an in GENERAL ASSEMBLER DIRECTIVES The following example also illustrates the use of angle brackets to delimit an expression that is to be interpreted in an alternate radix. When using the temporary radix control operator only numeric wvalues are affected. with respect Any to the symbols radix in .RADIX 10 .WORD “O0O<KA+10>*10 used with the effect at their operator in the will be evaluated declaration. A=10 When the temporary evaluated, 180 also allows number, above expression the a immediately 100 . 1376. 128. The radix yields .WORD MACRO-11 a it following temporary followed Equivalent Equivalent Equivalent expression forms .WORD equivalent radix change by a decimal to to to are directive above 1is statement: to decimal point (.), as function to: by specifying shown below: 144(8) 2540 (8) 20@(8) equivalent in "D1oa "D137A "D128 6.4.2 Two to Numeric Directives storage directives simplify the use These facilities program, and and two of allow and numeric floating-point numbers. Unary Control Operators numeric the control floating-point floating-point values to be A floating-point number is represented The string (which can be a single data operators are hardware on to The number may not contain <created or 1in treated the as by a string of decimal digits. digit in length) may contain an optional decimal point and may be followed by indicator in the form of the letter E and a exponent. be complemented available the PDP-11. embedded an optional exponent signed decimal integer blanks, tabs or angle brackets and may not be an expression. Such a string will one or more errors (A and/or Q) in the assembly listing. result The distinct, list valid of numeric representations representations of the same below contains floating-point seven in number: As can be inferred, the list could be extended indefinitely (3000E-3, .P3E2, and so on). A leading plus sign is optional (3.0 is considered to be +3.4). A leading minus sign complements the sign bit. No other operators are allowed (for example, 3.0+4N is illegal). GENERAL ASSEMBLER All floating-point numbers are DIRECTIVES evaluated format: as 64 bits in the following | 63 62 S 55 54 EEEEEEEE Y MMM.... .MMM Mantissa Exponent (55 bits) (8 bits) Sign (1 bit) MACRO-11 returns a value of the appropriate size and precision via one of the truncated floating-point or rounded (see Floating-point numbers floating-point number to be the if stored, the low-order the are number needed unretained is field are normally exceeds high-order bit to directives. The Section 6.2.1). to of the be the bit stored express 1its is to added in the a of as 2-word least retained field (see illustration below). to enable floating-point truncation; to floating-point rounding Bit Bit 32 (see Table added For but more than highest bit bit to example, 32 (32) (@) is bits of of the the is to 6-3). Bit ) TN Retained field 1is a it The .ENABL FPT directive .DSABL FPT 1is used Bit 0 32 T word be when in which below. significant used return the may 1is, field shown field, value, returned That the unretained word, exact the rounded. limits of retained values Unretained field All numeric operands associated with Floating Point Processor instructions are automatically evaluated as single-word, decimal, floating-point values unless a temporary radix control operator is specified. the must For example, to of floating accumulator contents be (floating) zero, the the octal constant following 41040 to instruction used: ADDF where: add F@ #°041040,F0 is assumed Floating-point ~applicable to numbers represent are PDP-11 Processor floating described in accumulator greater zero. detail 1in the Handbook. [.FLT2] 6.4.2.1 Floating-Point Storage Directives Formats: .FLT2 argl,arg2,... .FLT4 argl,arg2,... I'FLT4I GENERAL where: argl,arg2,... ASSEMBLER represent numbers DIRECTIVES one or more described 1in arguments must be floating-point as Multiple Section 6.4.2. separated by commas. -.FLT2 causes while .FLT4 two words the .WORD directive, stored in the object 6.4.2.2 unary complemented the as with it the control example, TAG4: Because the generated for for each each evaluated argument, argument. and the “"C and As results in are to Operators: specify evaluated to an during specify an "F argument assembly. eéergument - that The is °C to be The “F unary is a 1l-word that control ("C) operators can be used described anywhere in above, the the source construction before being numeric program that 1is evaluated complemented. by For statement: “C151 1's wvalue are value is legal. Such a a 16-bit binary value .WORD the storage Control vyou 1is following 16-bit form is be number. radix the to of module. vyou operator an expression MACRO-11 as words arguments allows allows floating-point causes storage four Temporary Numeric operator operator As of generates complement 1in the of the program. value The 151 (octal) resulting to value be stored expressed as in a octal 177626(8). argument "C construction are regarded may be applied construction: to as a is a a unary operator, term. single Thus, term. more For the than operator one unary example, the and its operator following “C"D25 causes the resulting decimal value binary value, 25 to be when complemented expressed during 1in octal assembly. form, reduces The to 177746 (octal) . The term created operator can elements. through be For the used example, use alone the or of in following the temporary combination numeric with other control expression construction: “C2+6 is equivalent in function to: <"C2>+6 This expression plus the resulting significant As shown argument is evaluated during assembly as a 1's complement of 2, absolute wvalue of 6. When these terms are combined, the expression value generates a carry beyond the most bit, leaving above, when the are coded as should be used readability. as 000@@3(8) temporary a term delimiters as the reduced value. numeric within to control an ensure operator expression, ©precise angle and its brackets evaluation and GENERAL ASSEMBLER DIRECTIVES is a unary operator “F, as stated above, you allows specify to For example, number. A MOV the numeric for which control argument that is a l-word floating-point an statement: following $"F3.7,R0 the creates a l-word floating-point number at location A+2 containing value 3.7 formatted as shown below. 9] 6 7 14 BIT 15 S EEEEEEEE MMMMMMM Sign (1 bit) Exponent (8 bits) Mantissa (7 bits) The importance of ordering with respect to unary below. operators 1is shown | "Fl1.0 = "F-1.0 = -"Fl.0 = = -"F-1.0 040200 140200 137600 037600 like 1is, The value created by the "F unary operator and its argument an in or itself by used be can that “C and its argument, a term expression. For example: "C"Fbh.2 is equivalent to: “"C<"F6.2> Again, the use of angle brackets 1is advised. Expressions wused terms or arguments of a unary operator must be explicitly grouped. 6.5 LOCATION COUNTER CONTROL DIRECTIVES The directives used counter described and in in the in controlling the value of the reserving following Several MACRO-11 statements bytes as to be storage space current location in the object program are sections. (listed below) may cause an odd number of allocated: l. .BYTE directive 2. .BLKB directive 3. .ASCII or 4, .0DD directive 5. .PACKED directive 6. A direct assignment statement of the form .=.+expression, which results in the assignment of an odd address value. .ASCIZ directive 6-37 GENERAL In cases that instruction value, but assembly yield an odd address automatically that ASSEMBLER ‘value, forces instruction is listing. DIRECTIVES the flagged the 1location with an next word-boundaried counter error code to (B) an even in the . 6.5.1 LEVEN Directive I'EVENI Format: . EVEN The an .EVEN directive even value by ensures adding 1 that if the the current current location value is odd. location counter is already even, no action is taken. following an .EVEN directive are flagged with an error assembly The listing. .EVEN directive .ASCIZ is /This used is a as 6.5.2 contains If current the Any operands code (Q) in the follows: test/ . EVEN -WORD counter sEnsures that the next statement ;begin on a word boundary. XYZ will .0DD Directive Format: .0DD The an .ODD odd directive value by ensures adding 1 if that the the current current location value is counter even. 1If contains the current location counter is already odd, no action is taken. Any operands following an .0DD directive are also flagged with an error code (Q) in the assembly listing. [.BLKB] 6.5.3 .BLKB and .BLKW Directives | Formats: .BLKB exp « BLKW exp 6-38 I'BLKWI GENERAL ASSEMBLER DIRECTIVES where: exp represents the specified number of bytes or words to be Any expression that is reserved in the object program. an to reduces that and time assembly at defined absolute value 1is legal. assembly 1listing. 1If the expression specified in either of these directives is not an absolute value, statement is flagged with an error code (A) in the the incorrect object following phase Furthermore, (P) the file errors. .BLKB and 1 and may cause However, if no argument is assumed. .BLKW directives. ; -i 000000 ‘g 000000 ; 000002 ig 000122 statements with | object is present, module; the Figure 6-6 illustrates the use ;+Illuntratn use of +BLKB and +BLKW directives . +PSECT IMPURE,D»GBLRW COUNT! +BLKW 1 iCharacter counter , MESSAG: +BLKE CHRSAV! .BLKB 2% 000123 14 000124 Figure 6-6 .BLKB directive following expression These directives should not be used directive reserves word blocks. of the The code .BLKB directive reserves byte blocks in the .BLKW the .BLKB/.BLKW directive to be flagged without arguments. a default value of The 1if forward reference (a reference to a symbol previously defined), MACRO-1l1 generates a contains that is not FLAG!? +BLKB MSGPTR! +BLKW Example of 80. iMessade text buffer iSaved character iFlag bute iMessage buffer rointer .BLKB and .BLKW Directives in a source program has the same effect as the statement: .=.+expression which value causes of the value the of the location expression to be added counter. The easier to interpret in the context of the appears and is therefore recommended. to the current .BLKB directive, however, source code 6.5.4 JLIMIT Directive in which 1is it l-L'M'Tl Format: .LIMIT To know the upper and lower address boundaries of the image 1is often desirable. When the J.LIMIT directive 1is specified in the source program, MACRO-11 generates the following instruction: . BLKW causing at 2 two storage words to be reserved 1link time, in the object module. the lowest address in the load image 6-39 Later, (the initial value GENERAL ASSEMBLER of SP) the is inserted first free reserved the first reserved following the image word, linking, 2-word boundary. the TERMINATING size of the DIRECTIVE: image is and the address of inserted into the second is word. During 6.6 into word DIRECTIVES rounded upward to the nearest .END | .END DIRECTIVE Format: . END where: [exp] exp represents present, the an expression the wvalue program-entry which, point, is a valid occurrence of the .END directive, assembly pass. Any text beyond this point or in additional source files identified be ignored. in in address where the program begins. MACRO-11 encounters terminates the current the current source file, the command line, will |if which transfer When optional 1indicates it When creating an image consisting of several object modules, only one object module may be terminated with an .END exp statement (where exp is the starting address). All other object modules must be terminated with an L(END statement (where .END has no argument); otherwise, an error message specified location 1 addressing will be issued 1in any of of the image the at and code used, (0) in however, the in assembly an If the an error source code 6.7 PROGRAM The for MACRO-11 program section program (E) input results SECTIONING listing. in is not the If no The .END terminated statement statement with an .END (see is begin at an odd a macro eXpansion or used, it is flagged with may a an be Section directive, listing. DIRECTIVES program sectioning directives are used to sections (p-sections) and to establish attributes address execution will fault because of conditional assembly starting image used within if it is so immediate 6.9.3). time. modules, immediately error. The .END statement must not be conditional assembly block; error link object essential to linking. 6-40 declare names certain program GENERAL ASSEMBLER DIRECTIVES [.PSECT| J.PSECT Directive 6.7.1 Format: .PSECT where: name,argl,arg2,...argn represents name the symbolic name of section, as described in Table 6-4. program the and/or represents any legal separator (comma, tab ’ . space) represent one or more of the legal symbolic with the .PSECT use for defined arguments The slash directive, as described in Table 6-4. arqgl, arg2,... argn separating each pair of symbolic arguments listed in the table indicates that one or the other, but Multiple arguments not both, may be specified. g character. separatin legal a by must be separated Any symbolic argument specified in the .PSECT directive other than those 1listed 1in Table 6-4 will cause that statement to be flagged with an error code (A) in the assembly listing. Table 6-4 Symbolic Arguments of .PSECT Directive Argument Default Meaning NAME Blank Establishes the program section name, which is one to six Radix-50 characters. as specified comma must a is omitted, If this argument in place of the name parameter. The appear Radix-50 character set is listed in Appendix A.2. RO/RW RW Defines which type of access is the program section: permitted | to RO=Read-0Only Access RW=Read/Write Access NOTE RSX-11M and RT-11 use only Read/Write access. (continued on next page) GENERAL ASSEMBLER Table Symbolic Argument 6-4 DIRECTIVES (Cont.) Arguments of Default I1/D Defines the contents attribute calls to through If and If a body D=Data. If all calls a a to code regardless will the be scope in has the on whether of the interpreted attribute, referenced has on byte the 1link I even D program at the are concatenated of I all referenced p-section is the stored concatenated even, Defines has are code has the p-section the section: overlaid, p-section 1is concatenated attribute, it is p-section directly. byte p-section program of overlay code bytes. or a concatenated attribute, If the program p-section the a of the root, LCL Directive Meaning I=Instructions. GBL/LCL &‘MV‘“W% .PSECT the D the next 1is odd section, time: as NOTE The GBL/LCL case arguments of single-segment the the total program segment of LCL=Local. local 1If the an program allocation the memory will go only in nonoverlaid arguments have GBL/LCL because apply overlays; in the building programs, the meaning, no allocation into the for root image. object module section, then contains the a storage for that module will remain in segment containing the module. Many modules this can contribute Same program allocation either segment, argument (allocate section; memory) for each contributing concatenated or overlaid depending of below) . the on program the section (continued 6-42 the module is within the allocation (see on to memory CON/OVR next page) T GENERAL ASSEMBLER DIRECTIVES Table 6-4 (Cont.) .PSECT Directive Symbolic Arguments of Argument Meaning Default GBL=Global. If a global program section is used 1in more than one segment of a program, all references to the p-section are collected across segment boundaries. The program sections are then stored 1in the segment (of those originally containing the p-sections) that is nearest the root. NOTE RT-11 the ABS/REL REL stores the collected p-sections Defines the relocatability program argument treat module; required. and attribute section: ABS=Absolute to in root. (non-relocatable) . causes the The the ABS the linker or task builder p-section as an absolute is relocation no therefore, The program section is assembled loaded, address of starting at absolute virtual 0. The location of data 1in absolute program sections must fall within the virtual memory limits of the segment containing the program section; otherwise, an error results at link time. For example, the following code, although valid during assembly, may generate an error message (A) 1if wvirtual 1location 10000A@ 1is address space: outside the segment's .PSECT ALPHA,ABS -WORD X virtual .=.+100000 REL=Relocatable. The REL argument causes the linker or task builder to treat the p-section as a relocatable module and a relocation bias 1is added to all location references within the program section making the references absolute, (continued on next page) GENERAL ASSEMBLER DIRECTIVES Table 6-4 (Cont.) Arguments of .PSECT Symbolic Argument Default CON/OVR CON Meaning Defines the program section: allocation CON=Concatenated. program OVR=0verlaid. section space argument If example, the it in The equaling memory forced the linker 1is program section .PSECT omitted, Save. The section normally. directive a comma 1linker that must is be used to to image. blank Table the always root allocates of the position-dependent in its name argument 6-4) are assumed arguments. may be directive allows Section 6.7.1.1) created (see (also program total p-section. The used 6.7.1.1). .PSECT one for place. For ,GBL .PSECT directive Section to the to needed SAV=Save. shows a .PSECT directive with a argument. Default values (see The references directive: .PSECT unspecified space storage the is memory allocates program only one Determines where the linker for the program section: NOSAV=No NAME. to largest, the is the the allocate The of concatenated overlaid; needed individual NOSAV All are references are the total p-section. the requirements All section determine SAV/NOSAV Directive and to a user share to code Section 6.7.1.2). p-sections), vyou called without name create and In a data or declaring the the GBL all other arguments program among and for the (see sections sections (see he has program sections attributes of the may declare the This allows you to control memory allocation and at the same time increases program modularity. (For a discussion of memory allocation, refer to the applicable system manual - see Section #.3 in the Preface.) p-sections. MACRO-11 * In provides for 256(10) program sections, program section 1. One default absolute 2. One default relocatable RT-11 this program section program is section unnamed. 6-44 (. as listed ABS.) (. BLK.) * below: GENERAL ASSEMBLER DIRECTIVES Two-hundred-fifty-four named program sections. 3. For each program section specified or implied, MACRO-11 maintains following information: the : 1. Program section name 2. Contents of the current location counter 3. Maximum location counter value encountered 4. Program section attributes (described in Table 6-4 above). 6.7.1.1 Creating Program Sections - The first statement of unnamed program a source this causes MACRO-11 program is always an implied .PSECT directive; to begin assembling source statements at relocatable =zero of the section. The first occurrence of a .PSECT directive with a given name assumes that the current location counter is set at relocatable zero. The scope of this directive then extends until a directive declaring a different program section is specified. Subsequent .PSECT directives cause assembly to resume where the named section previously ended. For A: B: C: example: .PSECT @ .WORD @ .WORD ) .WORD Xz .PSECT .WORD ALPHA ) D: .WORD 4 Y: @ .WORD .PSECT :Declares unnamed relocatable program ;section assembled at relocatable ;addresses @ through 5. ' ;Declares relocatable program section :named ALPHA assembled at relocatable ;addresses @ through 3. ;Returns to unnamed relocatable ;program section and continues assem- ;bly at relocatable address 6. A given program section may be defined completely wupon encountering Thereafter, the section can be referenced its first .PSECT directive. its name only, or by completely respecifying 1its by specifying For example, a program section can be declared through attributes. the directive: .PSECT ALPHA,ABS,OVR and later referenced through the equivalent directive: .PSECT ALPHA If arguments are specified, they must be which requires no arguments. If the to the ones previously declared for the p-section. identical arguments differ, the arguments of the first .PSECT will remain effect, and an error code (A) will be generated as a warning. 1in GENERAL ASSEMBLER By maintaining MACRO-11 sequential shown in A separate allows but the that SEC1,REL,RO ¢ -.WORD ¢ @ CLR A CLR B CLR C .PSECT SECA,ABS .WORD .+2,A .PSECT SEC1 INC A BR ST labels in counter in a labels -CSECT) the first A: the A it the on of not iStart an ;named SECA. a (or 22 program code are 27(8). absolute; relocatable. absolute the section relocatable at through section other) program 21(8). program section Assemble code at addresses ¢ through 3. containing line assigned In the followin§ The when likewise, current a referenced .PSECT value of directive is: (or the takes into to relocatable during loaded, all address assembly effect. relative example, references to references .PSECT ENT,ABS CLR X JMP Y .PSECT SEN,REL relative the to the SEN,. of MOV RA,R1 JMP A X: .WORD . relocatable to the base symbols base ;Assembled as CLR base ;relocatable section + ;Assembled as ;relocatable ;Assembled ¢ 6-46 as JMP base section JMP the relocatable to references named HALT in a .ASECT current zero where references as section Y: all location respectively. of X the .=.+1000 A section absolute relocatable or as | relocatable at Assemble are assembly, relocatable 5. through a known be sections are assembled referenced section. program 6 section, .PSECT assigned will translated ;addresses at section, physically or location Thus, if ALT,REL is is code not program through program section. sections ;Assemble program are following assembled @ Program each that relocatable saddresses relocatable are statement label program Since is appearing .PSECT a SECl1 section absolute before sStart snamed ;addresses directive counter sequentially ;SECl. (.) or loaded ;jabsolute an absolute symbol for statements ;Resume relocatable relocatable Any be counters write example. . PSECT .WORD labels can .WORD C: All location to following B: ST: you DIRECTIVES + 1000. of 12(8). of 6(8). and unnamed program program of the Y are relocatable GENERAL ASSEMBLER DIRECTIVES NOTE In the preceding constant in example, conjunction using with the a current location counter symbol (.) in the form .=1000 would result in an error, because constants are always always associated .ASECT (. were used, ABS.). absolute and the program's the form .=1000 If a program section incompatibility would be Section dicussion current 3.6 for location are with a detected. See of the counter. Thus, MACRO-11 provides the linker or task builder with the necessary information to resolve the linkages between various program sections. Such information 1is not necessary, however, when referencing an absolute program section, because all instructions in an absolute program section 6.7.1.2 Code are or associated Data with Sharing - an absolute Named relocatable with the arguments GBL and OVR operate COMMON, that is, program sections of the GBL and OVR from different at argument CON) A single section. symbol could name both Considering FORTRAN necessary link to COMMON where the the 6.7.1.3 are All /X/ other concatenated. accommodate symbol fourth time. the X element an represents of error section CON/OVR), odd modules be to linked program data from each sections (see are program all loaded sections sections as FORTRAN arguments at (those | an internal symbol using the same and again, following that the same with the a symbolic program name is statement: when the module the length modules the starting at ends the object at To (except - at program section The an assembler odd location. end of code contributions concatenate unexecutable. other and place Table of Considerations a having linked base and also section. therefore, place odd length data when several modules contain program program A,B,C,X Memory Allocation generate address. in the same manner same name with the assemblies location virtual a module. attribute the last) may (see cause does not You can, However, to the Table same 6-4; succeeding odd locations, thereby making avoid this problem, separate code them in separately named the and program 6-4; 1I/D). The linker or task builder can then begin each program section on an even address. Refer to the applicable system manual for further information on memory allocation of tasks (see Section #.3 in the Preface). GENERAL ASSEMBLER DIRECTIVES |.ASECT| 6.7.2 JASECT and .CSECT Directives ICSECTl Formats: .ASECT .CSECT .CSECT symbol where: sypbol represents IAS RSX-11M assembly-language and one or more of the .ASECT all the PDP-11 will accept both .ASECT but assembles them as though they were default attributes listed in Table 6-5. other MACRO-11 programs Task Builders also directives with the and the the .PSECT 6-4. and MACRO-11 use in Table directives exclusively, because the .PSECT directive provides capabilities of the .CSECT directive defined for other assemblers. programs arguments and .CSECT IAS/RSX-11M Task Builders, treat the .ASECT and .CSECT directives default values listed in Table 6-5. Table Program Section directives, .PSECT directives with the Compatibility exists between because like the .PSECT 6-5 Default Default Values Value Attribute .ASECT . ACCESS .CSECT (unnamed) . RW RW RW ‘Type I I I Scope GBL GBL LCL Relocation ABS REL Allocation OVR OVR In Note is RT-11 that this the program section has | ~ BLK.* RELV CON no default name. statement: LCSECT JIM identical to .PSECT ABS. (named) name * Name .CSECT the statement: JIM,GBL,OVR because the .CSECT default named program section. values GBL and OVR are assumed for the GENERAL ASSEMBLER 6.7.3 J.SAVE DIRECTIVES [SAVE] Directive Format: . SAVE .SAVE stores the current program section context on the top program section context stack, while 1leaving the current section context in effect. If the stack is full when .SAVE is an error (A) occurs, The stack can handle 16 .SAVEs. The section context includes the values of the current 1location and the maximum value assigned to the location counter in the program to the program issued, program counter current section. See Figure 6-7 for an example of .SAVE. 6.7.4 .RESTORE Directive l REST.RE Format: .RESTORE The .RESTORE directive retrieves the program the program section context stack. .RESTORE is issued, an error (A) occurs. section from If the stack When .RESTORE program section, 1t restores the current location counter it had when the program section was saved. See Figure 6-7 for an example of .RESTORE. 6-49 the top of 1is empty when retrieves a to the value *NIUW® 000000 {21010 000000 200000 10£990 ¥10000 L9T010 020000 vi MM So¢4o0ey -4 IO +IWYN- OO L b N S ASNYD T NM{13Y ejep WASAND Ll +¥000 9000 104910 ¥0 0 0 010 0 6-50 L Y JSuZUTT[OL4¢TF3TsUeLdY aJayj3uUaT10qde3}03 871qe} AZIg# 40 <a[qe} S31AQ SaTJ43uad £020 0 ¢c0 0 &C0 0 3[F0JOU[QTgW}%A0eSJRT}dS A, g i LM0SS + NONW 14088 T H Y 4 d O L H A S ¢ [EUOTRIP Y BpPOI s¢+ SZISHASdVOLWASH AS NOW NOW aay ¢c0000 104910 100000 +¢ HAN3* ASNVIS + NOW TH4SVEHAS WASHN D“TY TH¢ZISHAS 3WJ53I80YJaJgO[+1480Y3USTI334N005L 3aa3asfg5eq¢4qeslsp0u}Sastap4Ju0pa4peaaS1suqSJeaeOlJd}ps[eOQ1E4IAOXR3Sa1aqreq}e} ¢ autjaq 71 48 JOLWASTY €20000 €c0000 QordwexyJFoFAYS®UBJpUuNTeS[FOIQOULASSHYJ*3®QUTS0O4ABTUITOJDNPITUUEDS 3401S3¥°/3AVS*9VSN uedg|J ay13M[3ML0gIy81OsdS]°e3y¥°A.8T3NZ19d1QI44eSud}T434305Ny241d0pN3Ir8iea3J8a1484nae90egj¢¢g3ud5a4aasppye¢uaiyqdsea}yJSOea}yqaleua4}ppfYgaaeelJu}dtenddsay1J3984dn4e,I1354 ONIVW0°'S0NREPUOW g-uer-/L1$5180OINnJv9YsFN*eWd® aSrduwex]JJOZISJ“Y3OLHSYINaY'e/g7y3NaYySjy*}ajpueasdnNno138d 31dWvX3 40 GENERAL ASSEMBLER DIRECTIVES . am, ¥ /2000 aN3* * @La-nb91d Y, i i N D GENERAL ASSEMBLER DIRECTIVES 6.8 SYMBOL CONTROL DIRECTIVES The symbol control directives are used to set the type of a given symbol. $.8.1 |.GLOBL| .GLOBL Directive Format: .GLOBL where: A syml,sym2,...symn syml, sym2,... symn represent legal symbolic names. When multiple symbols are specified, they are separated by any legal separator (comma, space, and/or tab). .GLOBL directive may also embody a 1label field and/or a comment field. The .GLOBL directive is provided to define (and thus provide 1linkage to) symbols . not otherwise defined as global symbols within a module. In defining global symbols the directive .GLOBL A,B,C is similar to: ==:expression ==3exXpression C==:expression ==expression B==expression C==expression or Because object modules are vital to a program. processing of a program global's linked or by global The following from assembly A:: B:: Cs:: symbols, these symbols are paragraph, describing to 1linking, explains the the role. In assembling a source program, MACRO-11 produces a relocatable object module and a listing file containing the assembly listing and symbol table. The linker or task builder joins separately assembled object modules 1into a single executable image. During 1linking, object modules are relocated relative to the base of the module and linked by global symbols. Because these symbols will be referenced by other program modules, they must be singled out as global symbols in the defining modules. As shown above, the .GLOBL directive, global assignment operator, or global label operator will define a symbol as global. All internal symbols appearing within a given program must be defined at the end of assembly pass 1 or they will be assumed to be default global references. Refer to Section 6.2.1 for a description of enabling/disabling of global references. GENERAL ASSEMBLER DIRECTIVES In the following example, A and B are entry-point symbols. The symbol has been explicitly defined as a global symbol by means of the .GLOBL directive, and the symbol B has been explicitly defined as a global label by means of the double colon (::). Since the symbol C 1is not defined as a label within the current assembly, it is an external (global) reference if .ENABL GBL is in effect. g a subroutine external subroutine with 2 entry points which calls an WE Define TME WS A .PSECT .GLOBL A: X: B:: ;Declare ;iDefine MOV A @(R5)+,R0A MOV ;Define #X,R1 entry JSR PC,C ;Call RTS R5 ;Exit. ;Define MOV (R5)+,R1 CLR R2 BR X External symbols MACRO-11 can directive appear in direct a CLR unnamed a entry the program global point A. subroutine point operand C. B. field reference, section. symbol. of as an shown instruction in the or examples EXT .WORD EXT CLR @EXT External symbols shown as external as below: ~ the A may also appear as a term within below: CLR an expression, as EXT+A .WORD EXT-2 CLR An @EXT+A (R1) undefined direct external assignment assembly directive symbol cannot statement or (see Sections be as 3.3, used an in the argument 6.9.1 6.8.2 .WEAK Directive and evaluation in a of a conditional 6.9.3). | l 'WEAKI Format: .WEAK where: syml,sym2,...sSymn syml represents sym2,... symbols symn legal .WEAK SUB1,SUB2 are legal symbolic specified, separator (comma, names. they are space, When multiple separated and/or by any tab). Example: The .WEAK field. directive may also embody a label field and/or a comment WM,WWWW% GENERAL ASSEMBLER~DIRECTIVES The .WEAK directive "externally module. specified in is another used to module specify or symbols defined This directive suppresses external symbols. object that are globally library either defined in the current searches for When the .WEAK directive specifies a symbol that 1is externally defined, it 1is <considered a global symbol. TIf the linker finds the symbol's definition in another module, it uses that definition. If the linker does not find an external definition, the symbol is given a value of #. The linker does not search a library for the global symbol, but if a module brought in from a library for another reason contains the symbol's definition, the linker uses that definition. If a symbol that is defined in the current module is specified by the .WEAK directive, the symbol is considered globally defined. However, if the current module is inserted in an object library, the symbol is not inserted in the library's symbol table. Consequently, the module is not found when the library is searched at link time to resolve the symbol. NOTE The .WEAK directive the RT-11 V5.8 is only supported LIBRARIAN (LIBR) by and LINKER (LINK). Support 1is not yet implemented in the RSX-11 taskbuilder (TKB) or librarian (LBR). 6.9 CONDITIONAL ASSEMBLY Conditional DIRECTIVES assembly directives allow you to include or of source code during the assembly process, based on the stated condition tests within the body of the program. exclude blocks evaluation of |.IF $.9.1 Conditional Assembly Block Directives I”ENDcl Format: .IF cond,argument(s) ;Start conditional assembly block. range ;Range of conditional assembly block. .EfiDC ;End of conditional assembly block. G ENERAL ASSEMBLER where: cond represents a DIRECTIVES specified met condition that must be if the block is to be included in assembly. The conditions that may be tested the conditional in Table 6-6. represents and/or arg ument (s) any legal represent(s) condition « ENDC condition argument, line to be a other null flagged than those argument with an Condition Tests for defined (comma, space, argument (s) or of code or condition that excluded, is is either depending met. conditional assembly block. This be present to end the conditional listed specified error by are specified conditional test. thus a function of the tested (see Table 6-6). assembly, the block. symbolic the are body the code Table Legal be terminates the directive must test or separator the the in whether assembly A to represents included upon directives tab). expression(s) of These arguments range assembly the in Table 6-6, an 1illegal in an .IF directive causes (A) in the assembly listing. that 6-6 Conditional Assembly Directives Conditions Positive EQ Complement NE Arguments Expression Assemble Block If: Expression (or 1is equal equal to 7). not GT LE Expression Expression is than @ (or less equal to g). LT GE Expression EXpre$sion (or to DF B NDF NB greater @ greater than or is less than to or than 0 equal A4). Symbolic Symbol argument defined). Macro-type Argument argument non-blank). is defined is (continued (or blank on next not (or page) Ty GENERAL ASSEMBLER DIRECTIVES Legal Condition Tests for Conditional Assembly Directives Conditions Positive Two macro-type | DIF IDN Assemble Block If: Arguments Complement arguments are Arguments (or different). The .IF conditional DIF IDN/.IF identical directives are not case alphabetically sensitive by default. The user may enable these case be to directives the using by sensitive (.ENABL option . ENABL LCM). NOTE (which is A macro-type argument of symbolic is enclosed with denoted within (as described form a argument), as shown below, an angle brackets or up-arrow construction in Section 7.3). <A,B,C> ~/124/ An example of a conditional assembly directive follows: .IF EQ :Assemble block if ALPHA+1=0 ALPHA+1 - . ENDC The two operators & and ! have special meanihg within and NDF symbols SYM1 DF conditions, in that they are allowed in grouping symbolic arguments. & Logical AND operator ! Logical For example, .IF DF inclusive OR operator the conditional assembly statement: SYM1 & SYM2 » » . ENDC results in the assembly of the conditional block if the and SYM2 are both defined. GENERAL ASSEMBLER Nested conditional Conditional Conditional directives take the Assembly Directive Assembly Directive DIRECTIVES form: - . ENDC « ENDC For example, the .IF DF SYM1 .IF DF SYM2 following conditional directives: » . ENDC « ENDC can govern outermost nested whether assembly condition conditional Each conditional directive. An assembly block listing. MACRO-11 is assembly .ENDC occur. within block with nesting Any statement flagged with an the deeper the program example level of above, if the evaluation of occurs. an be terminated with an L(ENDC encountered outside a conditional error depth that error In no must directive flagged a to unsatisfied, statements is permits levels, depth is 1is of code 16(10) (0) in the assembly conditional assembly attempts to exceed this nesting code (0) in the assembly listing. level IFF IFT 6.9.2 Subconditional Assembly Block AFTF Directives Formats: . IFF «IFT .IFTF Subconditional blocks to 1. The - 2. 3. directives may indicate: of assembly the block of an tests be placed alternate within body false. of conditional code when The assembly of a non-contiquous body of conditional assembly block, depending upon conditional test in entering the block. The unconditional assembly conditional assembly block. of a body of the code the assembly condition within result code of within the the a GENERAL ASSEMBLER DIRECTIVES The subconditional directives are described in detail 1in Table 6-7. If a subconditional directive appears outside a conditional assembly block, an error code (0) is generated in the assembly listing. Table Subconditional 6-7 Assembly Block Directives Subconditional Directive .IFF Function If the condition conditional following tested assembly upon block this directive, 1is and entering false, continuing the up the code to next occurrence of a subconditional directive or the end of the conditional assembly block, is to included in the program. .IFT to be If the condition tested upon entering the conditional assembly block 1is true, the code following this directive, and continuing up to the next occurrence of a subconditional directive or to the end of the conditional assembly block, is to be .IFTF included in The code following to the or to to next the be result implied argument of the program. this directive, occurrence of the 1included 1in of end the conditional The the a of the and continuing subconditional conditional condition assembly a assembly program, tested up directive block, 1is regardless of the wupon entering the block. subconditional directive 1is the condition test specified upon entering the <conditional assembly block, as reflected by the initial directive in the conditional coding examples below. Conditional or subconditional directives in nested conditional assembly blocks are not evaluated if the previous (or outer) condition in the block 1is not satisfied. Examples 3 and 4 below illustrate nested directives that are not evaluated because of previous unsatisfied conditional coding. EXAMPLE Assume symbol 1: .IF DF . SYM that SYM is defined. ;Tests TRUE, SYM is defined. ;the following code. .IFF . ;Tests FALSE. ;assemble the .IFT . ;Tests TRUE. SYM is defined. ;ble the following code. . IFTF ;Assemble . ;ally. SYM is defined. following code. following code Assemble Do not Assem- uncondition- GENERAL +IFT ASSEMBLER ;Tests ;ble ;bly TRUE. DIRECTIVES SYM remainder block. is of defined. conditional Assem-— assem- . ENDC - EXAMPLE 2: Assume that symbol X defined, is .IF DF X ;Tests TRUE, .IF DF Y ;Tests FALSE, iTests TRUE, . IFF ;assemble .1IFT ;Tests ;Do defined symbol X symbol symbol the Y symbol assemble the that is Y is Y symbol Y is not defined. is following FALSE, not and not not defined. defined, code. is not defined. following code. . ENDC . ENDC EXAMPLE 3: ‘ - Assume that symbol A +.IF DF MOV A defined and that symbol B is not ;Tests TRUE. A is defined. ;Assemble the following code. A,AR1 .IFF ;Tests FALSE. ;assemble MOV .IF is defined. the R1,R@ NDF B iNested A is defined. following conditional ;evaluated. Do not code. directive is not « ENDC « ENDC EXAMPLE 4: Assume that symbol X ;Tests FALSE, defined. .1F DF X ;Do .IF DF Y not ;Nested is not Symbol assemble sNested X and is that not following directive subconditional subconditional evaluated. symbol defined. code. is not directive is directive is evaluated. ;Nested ;hot the conditional ;evaluated., ;hot defined Y is GENERAL ASSEMBLER DIRECTIVES 6.9.3 Immediate Conditional AF Assembly Directive Format: IIF where: cond,arg,statement cond represents for , one represents and/or arg the legal condition assembly blocks in any legal separator the argument tests Table defined 6-6. (comma, space, tab). represents , of conditional immediate symbolic <conditional argument, or described 1n represents argument Table the and associated directive; macro-type the 6-6. separator the with an expression, argument, as between the field. If statement conditional the preceding argument is an expression, then a comma must used; otherwise, a comma, space and/or tab may be be used. statement represents if the the specified condition is statement to be assembled satisfied. An immediate conditional assembly directive provides writing a 1l-line conditional assembly block. The a means use of for this directive requires no terminating .ENDC statement and the condition to be tested 1is completely expressed within the line containing the directive. For example, the .IIF generates DF the BEQ if the As with Table immediate FOO,BEQ conditional statement: ALPHA code ALPHA symbol FOO is defined the .IF directive, 6-6, an 1illegal .JIF directive results in a within the condition argument, or an error code source test a other null (A) program. in than argument the those listed specified in assembly listing. in an GENERAL ASSEMBLER 6.1 FILE The MACRO-11 CONTROL file DIRECTIVES control macro library 1lists being currently used, 6.10.1 LLIBRARY DIRECTIVES directives and to insert are a used source to add file file into the names source to file | .LIBRARY | Directive Format: .LIBRARY where: string string represents a delimited specification The .LIBRARY directive is searched. undefined libraries which If A opcode that they were any .LIBRARY . was are is name to that 1is the file 1list that library. a macro searched library whenever a .MCALL or an within a MACRO-11 program. The are searched in the reverse order in the MACRO-11 omitted is string macro from The assembler. the macro default and for other used as follows: 1library file systems argument, specification it is for SY:.MLB. /DBl: [SMITH]USERLIB/ ?DK:SYSDEF.MLB? \CURRENT .MLB\ searches the opcode field by .ENABL MCL. to a 1is assumed. directive LIBRARY file 1list DK:.MLB, . LIBRARY . LIBRARY MACRO-11 a encountered up the list specified wvalues MACRO-11/RT-11 The is make information default adds library of all and macro the libraries auto-mcall if it option finds has an been unknown symbol previously in enabled NOTE If you are operating the using MACRO-11 system, following you two with an RT-11 should be aware of restrictions. The device driver for the specified device that the .LIBRARY file resides on must already be loaded, either explicitly with the KMON LOAD command, or implicitly by reference to the device on the original second limit on that may twelve MACRO-11 restriction the number be minus specified there files on & .(LIBRARY there The The is a files limit is of files line. can be a maximum of MACRO-11/RT-11 command eight line, the number MACR0O-11 there least for files. are at .LIBRARY of specified. the line. that command 1in Since command 1is four available slots e GENERAL ASSEMBLER DIRECTIVES l ‘lNCLUDE I 6.10.2 LJ.INCLUDE Directive Format: . INCLUDE where: string string represents a delimited string that 1is specification of a macro source file. the file The .INCLUDE directive is used to insert a source file within the source file currently being used. When this directive is encountered, the current source file is stacked and the source file specified by the directive is read into memory. When the end of the specified source file is reached, the original source file is popped from the stack and assembly resumes at the line following the directive. A source file can also be inserted within a source file that has already been specified by the .INCLUDE directive. 1In this case the original source file and the first source file specified by the .INCLUDE directive are stacked and the second specified source file is read into memory. When the end of the second source file is reached, the first specified source file 1is popped from the stack and assembly resumes at the line following the directive, and when the end of the file is reached, the original source file is source specified first popped from the stack and assembly of that file is started again at the line following the .INCLUDE directive. The maximum nesting of source files specified by the .INCLUDE directive is five. If any information is omitted from the source file argument, level default values are assumed. The default file specification for MACRO-11/RT-11 is DK:.MAC, and for other systems it is SY:.MAC. The .INCLUDE directive .INCLUDE is used as follows: /DR3:[1,2]MACROS/ ?DK : SYSDEF? . INCLUDE . INCLUDE :File MACROS.MAC \CURRENT.MAC\ NOTE If you are using MACRO-11 with an RT-11 operating system, the device driver for the specified device that the .INCLUDE file resides on must already be loaded, either explicitly with the KMON LOAD command, or implicitly by reference to the device command line. on the original MACRO-11 CHAPTER MACRO 7.1 By DEFINING using of DIRECTIVES MACROS macros sequence 7 a programmer lines into A macro definition a can source is headed use a single 1line to 1insert a program. by a .MACRO directive (see Section 7.1.1) followed by the source lines. The source lines may optionally contain dummy arguments. If such arguments are used, each one 1is 1listed 1in the .MACRO A macro to call call name directive. (see the followed arguments Section macro by used into the in 7.3) the real the is the source statement program. arguments used It needed by to program. arguments Macro directives Only one provide the 1is means allowed to is manipulate per source the MACRO macro dummy lines the line. into replacement macro of the the expansions. Each directive have a blank operand field or one or more operands. differ with each directive. The macros and directives are detailed in this chapter. 7.1.1 the any macro. Included 1in this insertion by the real arguments. directive programmer of replace Macro expansion is the insertion of the macro source main dummy the consists may Legal operands their associated | .MACRO| Directive Format: [label:] where: label name .MACRO dummy represents an represents the macro. be ; name, used This as a represents and/or tab). argument optional statement user-assigned name label any may be any elsewhere legal list label. symbolic legal in the separator name symbol of the and may program. (comma, space, MACRO where: dummy represents argument 3.2.2) list macro a that can a comment may error code follow the dummy ABS A,B as first statement of a 1in legal or to (see the in of the program directive illegal The symbol scan and the dummy Multiple this the Section body These separator. an be argument macro in label. elsewhere terminates (A) a with dummy may be detection in a dummy causes an generated. list in below: .MACRO The any list symbols definition. duplicate argument shown used of by legal anywhere even specified separated of of appear be conflict arguments A number may definition, symbols no DIRECTIVES a .MACRO with ;Defines macro ABS definition must be a label a directive, two as arguments. .MACRO directive. NOTE Although it is 1legal appear on a .MACRO practice 1is the case because to be directive, discouraged, of nested invalid constructed character for will the cause ignored. This NOTE .REPT. also the or macro may of applies in definitions, labels concatenation This improper termination definition, and especially macro labels with to this to directive result in the macro .IRP, .IRPC, 7.1..2 .ENDM Directive l'ENDM__l Format: . ENDM where: [name] name represents name of an the optional macro argument being directive. specifying terminated by the the Example: . ENDM ;Terminates ;macro . ENDM ARS the current definition. ;Terminates ;jmacro the current definition named ABS. A MACRO I1f specified, the macro name in DIRECTIVES the .ENDM statement must match the name specified in the corresponding .MACRO directive. Otherwise, the statement is flagged with an error code (A) in the assembly 1listing. In either case, Specifying the macro to detect the name missing current macro definition 1is terminated. in the ,ENDM statement thus permits MACRO-11 .ENDM statements or improperly nested macro definitions. The .ENDM directive must not have attached, it will be ignored. directive will be ignored. The .ENDM directive may be a 1If label, If a an illegal label followed by a comment legal label is attached, field, is the as shown an .ENDM below: -.MACRO TYPMSG JSR R5, TYPMSG MESSGE .WORD MESSGE ;Type . ENDM The final ;End statement of every a message. of TYPMSG macro macro. definition must be directive. The .ENDM directive is also used to terminate indefinite repeat blocks (see Section 7.6) and may be used to terminate repeat blocks (see Section 7.7). 7.1.3 .MEXIT Directive !-MEX'TI Format: +MEXIT The .MEXIT directive may be used to terminate a macro expansion before the end of the macro is encountered. This directive is also legal within repeat blocks (see Sections 7.6 and 7.7). It is most useful in nested macros. The .MEXIT directive terminates the current macro as though an .ENDM directive had been encountered. Using the .MEXIT directive bypasses the complexities of nested conditional directives and alternate assembly paths, as shown in the following example: In an -.MACRO ALTR .IF N EQ N,A,B | ;jStart conditional .MEXIT . ENDC ;Terminate macro ;End conditional . ENDM ;Normal assembly where the dummy symbol N end is assembly block. expansion. assembly block. of macro. replaced by zero (see Table 6-6), the .MEXIT directive would assemble the conditional block and terminate the macro expansion. When macros are nested, a .MEXIT directive causes an exit to the next higher level of macro expansion. 7-3 MACRO A .MEXIT with an 7.1.4 A directive error encountered code (0) in the DIRECTIVES outside a assembly macro is flagged | MACRO Definition Formatting form-feed character used within a macro eject during the assembly of the macro however, is not performed when the macro is Conversely, when the .PAGE directive is ignored during the assembly of eject is performed when that macro is 7.2 definition listing. CALLING is definition causes definition. expanded. used in the macro expanded. a A macro a page page eject, definition, definition, but a it page MACROS Format: [label:] where: name label real arguments represents name real an optional represents the the directive .MACRO represent name of symbolic statement the (see macro, dummy arguments listed | When multiple arguments as Section arguments arguments label. in specified which the replace .MACRO occur, they by A macro definition directive expanded When a symbol (see within macro in determined must be Section the name the is the 7.3 before by the in means macro ;ABS 1is defined BR ABS ;ABS is considered ABS #4 ,ENT,LAR ;ABS is a Multiple arguments separated by 3.1.1. one MACRO DEFINITIONS within of a the macro their usage of can the be .MACRO called and a user label, the appearance of the designates the symbol as a macro call; the operand field designates it as a (R@) ,R1 IN separated the definition. MOV ARGUMENTS Section as field the appearance of the symbol label, as shown below: ABS: macro program. same operator the established 7.1.1) source by the directive. are any legal separator. Arguments to call are treated as character strings, is 1in 7.1.1). macro legal AND macro MACRO definition as a label. to be a label. call. CALLS or separating macro call characters must described be in MACRO Macro definition arguments DIRECTIVES (dummy) and macro call arguments (real) normally maintain a strict positional relationship. That is, the first real argument in a macro call corresponds with the first dummy argument in a macro definition. Only the use of keyword arguments in a macro call can override this correspondence (see Section 7.3.56). For example, the following macro definition and its call contain multiple .MACRO REN associated macro arguments: A,B,C - - REN ALPHA,BETA,<C1,C2> Arguments which themselves contain separating enclosed in paired angle brackets. For example, REN causes the <MOV entire MOV to replace all up-arrow part used of in the the X,Y>,#44 ,WEV expression occurrences the within treated a as of the symbol A in the macro definition. macro call are considered to be character a single entity during the macro expansion. () construction allows angle brackets to argument. This construction, for example, above macro call, as follows: REN causing be X, Y Real arguments strings and are The characters must the macro call: be passed as could have been “/<MOV X,¥Y>/,#44 ,WEV entire character string <MOV X,¥> to be passed as an argument. Because when of the passing use of the up-arrow "R, "F ...). These arguments must shown below) or MACRO-11 will up-arrow as a delimiter. REN The <°0 following shown argument above, care must ("0, be taken "D, "B, be enclosed in angle read the character brackets following (as the and (see because the and it is not call: #44 ,WEV~/MOV X,Y/ contains only two arguments (#44 up-arrow 1is a unary operator As shown 411>,X,Y macro REN preceded (") an argument beginning with a unary operator by an in the argument separator. examples constructions WEV /MOV X,Y/), Section 3.1.3) to above, spaces can be used increase the legibility of within bracketed such expressions. MACRO 7.3.1 Macro Nesting Macro nesting occurs to another. dynamic memory To an pass macros, angle depth used by argument enclose brackets, where The in expansion nesting source containing the each the .MACRO LEVEL1 LEVEL2 <DUM1> LEVEL2 <DUM2> program the macro being of the a call amount of assembled. definition below. nesting includes upon delimiters macro sequence 1level macro one depends argument 1in coding of allowed legal argument shown in brackets for not the the as definition, the of DIRECTIVES to nested within angle This extra set of required in the macro is call. DUM1,DUM2 . ENDM .MACRO LEVEL2 DUM3 DUM3 ADD #10,40 MOV RA, (R1)+ . ENDM A call to the LEVEL1 ‘LEVELl causes the macro shown below, for example: R2,R0G> expansion to occur: X,R0O #10,R0 MOV R#, (R1)+ MOV R2 ,R0 ADD #10 ,R0 MOV RA, (R1)+ definitions wuntil example, as X,RO>,<MOV ADD When macro called <MOV! following MOV macro, in the the are outer following -MACRO LV1 A,B .MACRO LV2 C nested, macro the has inner been definition called coding: and cannot expanded. be For » - . ENDM . ENDM the LV2 macro cannot be called and expanded until been expanded. Likewise, any macro defined definition cannot be called and expanded until expanded. | the LVl macro has within the LV2 macro LV2 has also been MACRO Special Characters 7.3.2 DIRECTIVES in Macro Arguments If an argument does not contain spaces, tabs, semicolons, or commas it may special characters without enclosing them in a bracketed include For construction. example: ARG .MACRO PUSH MOV ARG,-(SP) . ENDM X+3(%2) PUSH causes following the code to be generated: X+3(%2),-(SP) MOV Passing Numeric Arguments as Symbols 7.3.3 If the unary operator backslash treats argument, (\) precedes an the macro that argument as a numeric value in the current program radix. The ASCII characters representing this value are inserted in the macro and expansion, resulting code, CON A,\B INC A,B . ENDM .MACRO CON A,B .MACRO B=B+1 .WORD A'B: their function 1is defined 1in as shown in the following example: 4 the context of the :B is treated as a number in current ;program radix. ;A'B is described in Section 7.3.7. « ENDM X,C INC C=0 The above macro call would thus expand to: 4 .WORD X0 (INC) the concatenation results from In this expanded code, the label X@: The single quote (') character in the label arguments. real of two passed as they are concatenates the real arguments X and @ A'B: This type of argument construction during the expansion of the macro. is described in more detail A subsequent call .WORD X1: and so on, in Section 7.3.7. to the same macro would generate the following code: 4 for later calls. The two macro definitions are necessary because the symbol associated with dummy argument B (that is, C) cannot be updated in the CON macro definition, because the character 0@ In the CON macro in the argument string (INC X, C). C replaced has (Where definition, the number passed is treated as a string argument. the value passed to of the the macro real argument is @, only a single @ character is expansion.) MACRO Passing numeric listings. conditional through the coding ID in source in this example, assemblies such the symbol values For program to of a that the manner single call IDT . IDENT /V@1.'SYM/ ;jon macro 7.3.4 A is macro (Q) is call in the NB be defined in the macro than Table The Creating is can number of (Section often as an in the noted symbols 30000 or without than in the the update program. be conditional used arguments within can an Section 3.5, the n$, form 65535, numerical 300005 300018 » » 655348 655358 also expanded subsequent in macro be .IF to B and detect determined macro. a macro calls MACRO-11 where inclusive. as n is can a In the label call. to the can be unique macro. order, code .IF missing using the Automatically each of directives the 7.4.1). with expanded arguments error 1If fewer arguments appear definition, missing arguments are described, an If more definition, an macro in argument ID. listing. macro The Symbols in in takes value. arguments. far issuing through MACRO-11 the the ID in Calls duplicating labels. This concern feature of MACRO-11 that creates a As symbol 2-digit is of symbol thus avoid required the that elsewhere to: required facilities specified in 6-6) Local of assembly values. 7.3.5 careful the call directive label in null be expand in Macro with call to -NARG macro value macro (see then of Arguments can arguments. A would numeric generated assumed V@1 equated identified example, /V01.6/ the Number appear that be for through \ID . IDENT 6 been source created can Assume, unique ;jversion IDT where a iWhere . above has ;Assume identifying program 6. SYM in programs below. (IDT) . ENDM The useful of source shown value .MACRO is versions as the macro DIRECTIVES conventional must The same be macro eliminated symbol Such local shown below: integer symbols be to through a is a label create within are must order in where automatically decimal explicitly user the 1local range created by MACRO DIRECTIVES This automatic generation is invoked on each call of a whose macro definition contains a dummy argument preceded by the question mark (?) character, as shown in the macro definition below: .MACRO ALPHA, A,?B TST A BEQ B ADD #5,A ;Contains dummy argument B preceded by ;question mark. B: . ENDM A local symbol is created automatically by MACRO-11 only when the of argument macro call a real is either null or missing, as shown in Example 1 below. 1If the real argument is specified in the macro call, however, MACRO-11 inhibits the generation of a local symbol and normal argument replacement occurs, as shown in Example 2 below. (Examples 1 and 2 are both expansions of the Alpha macro defined above.) Create a Local Symbol for the Missing Argument: EXAMPLE 1: ALPHA R1 TST R1 ADD #5,R1 ;Second argument is missing. ;Local symbol is created. 3000058 BEQ 30000S: Do Not Create a Local Symbol: EXAMPLE 2: ALPHA R2,XYZ sSecond argument XYZ is specified. XYZ ;:Normal argument replacement occurs. TST R2 ADD #5,R2 BEQ | XYZ: Automatically created local symbols are restricted to the first 16(10) arguments of a macro definition. Automatically created local symbols resulting from the expansion of a macro, as described above, do not establish a local symbol block in their right. own When a macro has several arguments earmarked for automatic 1local symbol generation, substituting a specific label for one such argument argument risks assembly errors because MACRO-11 constructs its substitution 1list at the point of macro invocation. Therefore, the appearance of a 1label, the .ENABL LSB directive, or the .PSECT directive, in the macro expansion will create a new local symbol block. The new local symbol block could leave local symbol references in the previous block and their symbol definitions in the new one, Furthermore, a later causing error codes in the assembly listing. in the new block may symbols local «creates that expansion macro duplicate one of the symbols in question, causing an additional error code (P) in the assembly listing. MACRO 7.3.6 Keyword DIRECTIVES Arguments Format: name=string where: The name represents the dummy string represents the real keyword argument unless delimited Macros may be a keyword definition, the of a call. macro argument whether match A keyword list of argument. real the string a keyword dummy the the real A the separators keyword arguments. with, appears specified argument in that matches was entire argument specification argument may list of a macro ordering of the 1 anywhere also 3 ; ;i 4 Define ; list a of be real with is but, in arguments, argument becomes the a real specified name, keyword. as If the 8 9 10 in the dummy argument the positional ordering of this anywhere case, does in not macro having keywords in dummy argument -MACRO TEST .WORD CONTRL . WORD .WORD BLOCK ADDRES CONTRL=1,BLOCK,ADDRES=TEMP 12 13 - 14 ; 15 000000 000000 several 000A00G TEST A,B,C .WORD A times 00802 QOAOGAG Bo0AN4 .WORD QORAGOG B «.WORD C TEST .WORD ADDRES=2¢ ,BLOCK=30,CONTRL=40 40 18 20 21 invoke ; 16 19 Now 000006 Po0006 @AO0040 00001¢ QO0O30 00a012 .WORD 000020 30 .WORD 20 TEST BLOCK=5 000014 | 000014 0@0oR01 P0P016 000020 .WORD GOOGAS5 1 .WORD 5 TEMP 00000AG .WORD the affect ME . ENDM 11 a next ; 7 17 list the treated specified call .LIST 2 defined part the string argument argument. 5 6 argument 7.3. dummy keyword positional embedded called argument may be specified a macro definition and is argument argument. in the dummy argument list of a macro becomes the default real argument at argument however, the fails, positional specified symbolic Section and/or appears call, not with, contain in argument When for or not described defined When macro may as argument, MACRO DIRECTIVES 22 23 000A22 25 .WORD @0PRO5 00P026 00O000G .WORD BO0OG0 0AGB24 24 TEST 00GG22 BABG30 .WORD TEST .WORD 00AB01 AAGA30 000032 pOGR34 0G40 000042 5 VARIAB 1 0A00AD 0OABBOG .WORD .WORD TEMP 00e0n1 TEST .WORD OROPOQ NEFOROC .WORD .WORD ADDRES=JACK!JILL 1 ApA0e1 . END 26 27 0A0B36 0peG36 CONTRL=5,ADDRES=VARIAB | JACK!JILL 28 29 39 Concatenation of Macro Arguments 7.3.7 (') The apostrophe or single quote character delimiting character in macro definitions. operates as a legal A single quote that precedes and/or follows a dummy argument in a macro definition 1is removed, and the substitution of the real argument occurs at that point. .MACRO A'B: in the following statements: For example, .ASCIZ .BYTE DEF A,B,C, /C/ ''A,''B . ENDM when the macro DEF is called through the statement: X,Y¥Y,<{MACRO-11> DEF as it is expanded, XY : In .ASCIZ /MACRO-11/ 'X,'Y .BYTE expanding terminates follows: the upon first 1line, the scan for the first finding the first apostrophe (') character. argument Since A The scan then is a dummy argument, the apostrophe (') is removed. The two argument. dummy another as noted also is B resumes with B; real arguments X and Y are then concatenated to form the 1label XY:. The third this field. dummy argument is noted in the operand field of the .ASCIZ directive, causing the real argument MACRO-11 7-11 to be substituted in MACRO When of evaluating the character. argument, then the second Since this argument it the and is 1is upon (') apostrophe 7.4 (') MACRO ATTRIBUTE MACRO-11 has attributes three of the comma followed (,). is likewise in the in The 7.4.1 are the macro DIRECTIVES: .NARG by a (') dummy apostrophe that .NCHR, allow .NARG, the AND user .NCHR, to is in by apostrophe generate two .NTYPE to and arguments below. (Four definition expansion.) .NARG, arguments: described third discarded. macro these directives permits selective modifi cations depending on the nature of the directives expansion apostrophe @ dummy argument and again remain s (and last) apostrophe is followed and directives macro nor during first in necessary characters the the macro expansion. The scan which is followed by a dummy discarded. The scan of argument A is followed by The fourth argument directive with preceded remains therefore were .BYTE begins apostrophe, encountering dummy characters the scan neither second neither preceded nor the macro expansion. another of the apostrophe encounters terminated arguments 1line, DIRECTIVES determine .NTYPE. of a macro being The certain use of expansion, passed. These |-NARG| Directive Format: [label:] where: -NARG symbol label represents symbol an represents any legal equated the number the to macro symbol call is .NARG directive arguments in the -NARG directive appears listing. An can elsewhere, example of the is used macro appear an .NARG to an only error error currently within a code (0) directive label. symbol. This of non-keyword being specified, the determine call statement currently not flagged with listing. The optional is 7-12 shown is in expanded. .NARG code (A) the number being symbol arguments in If a directive is the of expanded. assembly non-keyword Hence, macro definition; is generated in the in Figure 7-1, the if it assembly MACRO DIRECTIVES NARG VONOCUADUEMN- +TITLE +ENABL +LIST LC ME it $} Examrle of the .NARG directive - +MACRO NULL + NARG «IF EQ +MEXIT «IFF NUM SYM +REPT NOP +ENDM +ENDC NUNM SYM +ENDM NULL 000000 + NARG +IF EQ +MEXIT + IFF +REPT 000000 SYM SYM NOF + ENDNM +ENDIIC 21 22 000000 NULL + NARG 000001 +IF EQ +MEXIT « IFF +REPT NOP +ENDM NOFP 000006 000000 000002 000004 000006 000010 000012 23 24 000240 000240 000240 000240 000240 000240 SYM 6 NOP NOP NOP NOP NOF +ENDC +END 000001 Figure 7-1 SYM .NARG Directive Example of [.NCHR]} .NCHR Directive 7.4.2 Format: [label:] where: .NCHR symbol,<string> label represents an optional statement label. symbol represents , legal any This symbol. symbol characters of number the to equated symbol If a specified character string. specified, the error (A) code represents and/or tab). any .NCHR directive in is in 1is 1is the not flagged with an the assembly listing. legal separator (comma, space, MACRO <string> represents DIRECTIVES a string the character (comma, space, be enclosed up-arrows not If or 1f detected because character string evaluation), an error printable within (7). match of I1f angle Dbrackets (<>) delimiting characters the the of the code characters. string contains a legal separator and/or tab) the whole string must ending delimiter a (thus syntactical prematurely .NCHR directive (A) in the cannot be error in terminating the its flagged with is assembly or do listing. The .NCHR directive, which can appear anywhere in a MACRO-11 is used to determine the number of characters in a specified string. This directive is useful in calculeting the length program, character of macro arguments, An example of the .NCHR directive is 1 shown in Figure +TITLE NCHR +ENABL +LIST LC ME 7-2. 2 3 4 ] é i+ i Illustrate ;- 7 the | .NCHR directive 8 STRING MESSAG 10 9 +« NCHR $$$,MESSAG 11 +WORD $$¢ 12 13 14 +ASCII +EVEN /MESSAG/ 15 16 +MACRO +ENDM 000000 MSG1¢ 000005 000000 000002 000003 0000095 110 145 000004 00000% 154 154 000006 157 STRING + NCHR $$$:Hello <Hello> +WORD +ASCII $%38 /Hello/ + EVEN 17 18 000001 Figure 7.4.3 NTYPE 7-2 +END Example of .NCHR Directive [ .NTYPE] Directive Format: [label:] where: label symbol .NTYPE symbol,aexp represents an represents equated any legal statement label. symbol. This symbol to following specified, error optional code the 6-bit addressing mode expression (aexp). If a symbol the .NTYPE directive (A) in assembly the is flagged listing. of 1is with is the not an MACRO DIRECTIVES any represents , and/or legal separator space, (comma, tab). as used represents any legal address expression, If no argument is specified, an with an opcode. assembly 1in the appear will (A) error code aexp listing. The .NTYPE directive is used to determine the addressing mode of a specified macro argument. Hence, the .NTYPE directive can appear only if it appears within a macro definition; with an error code (0) elsewhere, in the assembly listing. it flagged 1is An example of the use of an .NTYPE directive in a macro definition shown 1is in Figure 7-3. 1 2 3 4 S5 é it 8 ;- +TITLE NTYPE +ENABL +LIST LC ME $ Illustrate the «NTYPE directive 7 9 +«MACRO ~ 10 11 12 +IF EQ 13 SAVE +NTYPE $$8%70 MOV ARG~ (SP) iSave in redister mode MOV $ARG» - (SP) $}Save in non-redister wmode SAVE R1 + IFF 14 is +ENDC +ENDM 16 17 18 19 000000 000000 000001 0101446 +NTYFE +IF EQ ARG $$$,AR0G $%$$870 $$$,R1 MOV Ri»-(SP) $iSave in redgister wmode MOV $R1,»~-(SP) $iSave in non-redister mode +IFF +ENDC 20 21 000002 000002 22 000067 000006 000000 29 000001 Figure 7-3 For additional Chapter 5 +NTYPE +IF EQ $3$%70 TEMP $$$>TEMP MOV TEMP»~-(SP) $Save in redister mode MOV $TEMP»-(SP) iSave in non-redister wmode +WORD 0 « IFF 0127446 23 000006 24 SAVE +ENDC TEMFP! +END Example of .NTYPE Directive in Macro Definition information and Appendix B.2. concerning 7-15 addressing modes, refer to MACRO 7.5 .ERROR AND DIRECTIVES .PRINT DIRECTIVES . ERROR [expr] ['ERROR] Format: [label:] where: label expr represents an optional statement label. represents an optional expression whose output when during ; the .ERROR directive is value is encountered assembly, denotes text ;text the represents beginning the of message the text associated directive. string. with the .ERROR The .ERROR directive is used to output messages to the listing file during assembly pass 2. A common use of this directive is to alert the user to a rejected or erroneous macro call or to the existence of an 1illegal set of conditions in a conditional assembly. 1If the listing file is not specified, the .ERROR messages are output to the command Upon output encountering MACRO-11 For outputs an a .ERROR single directive line anywhere in a source pProgram, containing: 1. An 2. The sequencé number of the .ERROR directive statement 3. The 4. The value of 5. The error example, .ERROR causes P device. a code value of source the A line (P) the current the expression, line containing following ;Invalid in the location Loc,. Exp. No. No. Value 512 0R5642 Q00AA76 if one the is specified .ERROR directive. directive: macro following Seq. counter argument form to be output to the listing file: Text .ERROR 7-16 A ;Invalid macro argument MACRO DIRECTIVES [-PRINT] The .PRINT directive is identical in function to the .ERROR directive, except that it is not flagged with the error code (P). 7.6 INDEFINITE REPEAT BLOCK DIRECTIVES: .IRP AND .IRPC An indefinite repeat block is similar to a macro definition with only At each expansion of the indefinite repeat range, one dummy argument. real ~of a elements this dummy argument is replaced with successive the repeat directive and its associated range Since 1list. argument are coded in-line within the source program, this type of macro definition and expansion does not require calling the macro by name, previously macros conventional the as required in the expansion of described in this chapter. An indefinite repeat block can appear either within or outside another macro definition, indefinite repeat block, or repeat block. The rules for specifying indefinite repeat block arguments are the same as for specifying macro arguments (see Section 7.3). ,lRP 7.6.1 J.IRP Directive Format: [label:] .IRP sym,<argument (range of indefinite list> repeat block) -» . ENDM where: label represents an optional statement label. NOTE Although it is legal for a label to appear on a8 J.MACRO directive, this practice is discouraged, especially 1in the ~case of nested macro definitions, because invalid labels or labels constructed with the concatenation character will cause macro directive to be ignored. This result in improper termination of macro definition. This NOTE also applies to .IRPC and the may the .REPT. MACRO sym represents DIRECTIVES a dummy argument that is replaced with successive real arguments from within the angle brackets. If no dummy argument is specified, the .IRP directive 1is flagged with an error code (A) in the assembly listing. ’ represents and/or {argument list> any legal separator (comma, space, tab),. represents a 1list of real arguments enclosed within angle brackets that is to be used in the expansion of the indefinite repeat range. A real argument may multiple separator must (comma, arguments range consist arguments are represents of one be separated space, specified, the block of or and/or no more tab). action code to characters; by any is be If 1legal no repeated for each occurrence of a real argument list. The range may contain other definitions, repeat ranges and/or the directive (see Section 7.1.3). . ENDM real taken. indicates the end of the indefinite once in the macro .MEXIT repeat block range. The .IRP directive real arguments process occurs is used to specified during the replace 1in an a dummy argument expansion of an argument string. with This 1indefinite successive replacement repeat block range. An example of the use of the .IRP directive is shown in Figure 7.6.2 JIRPC Directive 7-4. IlRPCl Format: [label:] .IRPC (range of sym,<string> indefinite repeat block) . ENDM where: label sSym represents an in 7.6.1). Section represents successive brackets. a optional dummy real If no statement argument arguments dummy 7-18 that is from argument .IRPC directive is flagged in the assembly listing. label with (see replaced within is an Note the with angle specified, error code the (A) MACRO DIRECTIVES ’ any represents and/or <string> legal separator (comma, enclosed within represents a list of characters, angle brackets, to be used in the expansion of the angle the Although range. repeat indefinite brackets contains are required separating recommended for only characters, when the their string is use legibility. represents the block of code to be range space, tab). repeated once of a character in the list. macro definitions, repeat The range may contain the .MEXIT directive (see Section and/or ranges occurrence each for 7.1.3). - ENDM indicates the end of the indefinite repeat block range. character single permit to available 1is .IRPC directive The iteration of each On substitution. argument than rather substitution, the indefinite repeat range, dummy the argument successive characters in the specified string. is replaced with An example of the use of the .IRPC directive is shown in Figure 7-4. 1 2 3 4 i+ 7 - 8 REGS? ? 000000 10 000000 000002 000004 0000086 000010 000012 000014 000016 REGS2: 13 000020 14 16 17 +LIST ME 000020 000022 000024 000026 000030 000032 000034 000036 + IRP +RADS0O +ENDR +RADSO 0462170 074500 072770 072720 072650 072600 072530 0724460 12 ) §+1 1IRPTST 3 Illustrate the .IRP and .IRPC directives } by creating a rair of RADSO tables o] é 11 +TITLE /REG/ +RADSO +RADSO +RADSO +RADS0 «RADS0 +RADSO0 +RADS0O /PC/ /SP/ /RS/ /R4&/ /R3/ /R2/ /R1/ /RO/ +IRPC +RADSO NUM»<76543210> /R/NUM/ 073110 073040 072770 072720 072650 072600 072330 0724460 + ENDR +RADSO «RADS0O +RADSO +RADS0O +RADSO +RADSO +RADSO +RADS0 000001 +END Figure 7-4 REG»<PCsSP»RS/R4»RI»R2sR1,RO> Example of /R?7/ /Ré&/ /RS/ /RA/ /R3/ /R2/ /R1/ /RO/ .IRP and .IRPC Directives 7-19 MACRO DIRECTIVES |.REPT 7.7 REPEAT BLOCK DIRECTIVE: .REPT, .ENDR | l'ENDR‘ Format: [label:] .REPT exp L L (range of repeat block) . ENDR where: label represents in an optional 7.6.1). Section represents exp controls to be any the statement legal number assembled label expression. of times within the the (see Note This block of program. value code When is the expression value 1is less than or equal to zero (6), the repeat block is not assembled. If this expression 1is not an absolute value, the .REPT statement is flagged with an error code (A) in the assembly listing. represents range the block repeat indefinite and/or .MEXIT the of code to be repeated. The contain macro definitions, may repeat the indicates . ENDM block end blocks, directive of the other (see repeat repeat Section block blocks 7.1.3). range. or . ENDR The .REPT directive number 7.8 of MACRO times, in LIBRARY is used line to with duplicate other DIRECTIVE: a block source code. of <code, a <certain [.MCALL] .MCALL Format: .MCALL where: argl,arg2,...argn arqgl, represent the arg2,... definitions required argn program. The separator (comma, symbolic names in must space, names of the assembly of be separated and/or tab). by the the any macro source legal MACRO The DIRECTIVES .MCALL directive allows you to indicate in advance those system user-defined macro definitions that are not defined within the and/or The the program. source program but which are required to assemble to call a of occurrence first the before appear .MCALL directive must any externally defined macro: @ Auto-Mcall mode is disabled (the default) or @ The name of the macro being called symbols or directives, such as SUB, is one of MACRO's permanent .ERROR, or .PRINT. The /ML switch (see Section 8.1.3) under RSX-11M and the /LIBRARY (see Section 8.2.2) under IAS and RT-11, used with an input qualifier macro a 1is file the file specification, indicate to MACRO-11 that searched may also be to be 1libraries macro Additional library. .LIBRARY itself, using the MACRO-11 for a description of the .LIBRARY program, source the is encountered in specified in the MACRO-11 program directive. See Section 6.10.1 When a macro call directive. user macro library for the named macro the searches first MACRO-11 system the definitions, and, if necessary, continues the search with macro library. Any number of such user-supplied macro files may be designated. For multiple 1library files, the search for the named macros begins with the last such file specified. The files are searched in reverse order until the required macro definitions are found, necessary, with a search of the system macro library. If any named macro .MCALL statement is not found upon completion 1is flagged of the with an error code (U) finishing, 1if search, the in the assembly program source the 1in Furthermore, a statement elsewhere listing. such an undefined macro is flagged with an expand to attempts that error code (0) in the assembly listing. The command strings to MACRO-11, through which file specifications are supplied, are described in detail in the applicable system manual (see Section #.3 in the Preface). 7.9 MACRO DELETION DIRECTIVE: .MDELETE | l 'MDELETE l Format: .MDELETE where: namel,name2,...,namen namel, name2, ... namen The .MDELETE represent legal macro names. When multiple names are specified, they are separated by any legal separator directive deletes (comma, space, and/or tab). definitions the of the specified macro(s), freeing wvirtual memory. If references are made to deleted macros, the referencing line is flagged with an opcode (0) error. An example of the .MDELETE .MDELETE directive .EXIT,EXITSS is shown below. - b R e CHAPTER IAS/RSX-11M/RSX-11M-PLUS MACRO-11 assembles statements object file one or more 1into a single contains the is ASCII and the symbol table symbols and macros is provided in Appendix H. 8.1 RSX-11IM and available: the Language (DCL). MCR DCL or language By is typing explicit > When as CTRL/C prompt log in ("C) your MACRO-11 from two and system, you the command from one command optional cross-reference sample assembly listing (MCR) the account the A PROCEDURES command for An Routine onto default contained containing systems, Console you the PROCEDURES files available. OPERATING RSX-11M-PLUS Monitor source listing. of RSX-llM/RSX—llM~PLUS On OPERATING relocatable binary object file. This binary table of contents 1listing, the assembly listing, listing 8 command language. languages the DIGITAL are Your are Command given either default command file. monitor prompt, language you language to are vyou can currently see the using. “C MCR> > “C DCL> You can DCL to switch MCR, DCL> To switch MCR> type SET following TERMINAL from SET the MCR to other. To switch from other, you MCR DCL, type the following command: /DCL=TI: In addition to switching can type DCL command from a a the command: terminal set to from from DCL, MCR> DCL cmd-string DCL> MCR cmd-string one a as command terminal shown language set below: to MCR, to the and an MCR command IAS/RSX-11M/RSX-11M-PLUS 8.1.1 The 1Initiating following that apply Language. MACRO-11 PROCEDURES RSX-11M/RSX-11M-PLUS sections describe those MACRO-11 to both the Monitor Cconsole Routine Any one of methods shown initiate MACRO-11. 8.1.1.1 Method MCR Under OPERATING 1 - the four Direct MACRO-1l1l operating and the procedures DIGITAL below may be Command employed to Call Format: MCR>MAC MAC>cmd-string The Monitor Console Routine MACRO-11 to be activated. the MCR line, MACRO-11 then (MCR) accepts MAC as 1input, causing Since a command string is not present with solicits input with the prompting sequence MAC> and waits for command string input. After the assembly of the indicated files has been completed, MACRO-11 again solicits command string input with the MAC> prompting sequence. This process will be repeated until CTRL/Z ("Z) is entered. DCL Format: DCL> MACRO[/qualifier(s)] File(s)? DCL accepts filespec[/qualifiers]... MACRO as qualifiers <contained included in the File(s) prompt. files plus any DCL MACRO-11 8.1.1.2 Method MCR Single no vyou may file MACRO-11 solicits enter the name listed in Table of include the specifications input one 8-4. with are the or more source When you press assembly. Assembly cmd-string MACRO cmd-string 2, no prompting input is included method string the the Since Format: DCL> In - then qualifiers performs 2 line, <can addition, 8-3., Format: MCR>MAC DCL the In Table command You of RETURN, 1input. 1in source 8.1.1.3 files Method in 3 - Format: >RUN SMAC MAC>cmd-string the from in the command Install, Run MACRO-11 command string occurs, line. and exits Immediately, since MACRO-11 and when the then command assembles finished. Remove On Exit IAS/RSX-11M/RSX-11M-PLUS This method is used installed in the this of call type MACRO-11 the MCR it is If the the MACRO-11 On RSX=11M, MAC command string input. from DCL even if removed system has is needed. 8.1.1.4 not Method the 4 - run a from "flying Using is run the system from 18 not must be the permanently generated system The command terminal. When for directory. string must have MACRO-11 exits, system. install" the PROCEDURES assembler the support. automatically format MCR when system. solicits format OPERATING feature, Indirect Command the RUN § calling Processor Formats: MCR>MAC MAC>@filespec or @filespec MCR>MAC or MAC>RUN SMAC[/UIC=[g,m]] MAC>@filespec These forms use accomplishes input employed command in as file 1indirect command substitution of methods processor specified this the the 1s "@filespec" 1is 1 opened, and DCL DCL> These command 1In to are nested which for these MACRO-11 lines Three the formats, the read from of the indirect assembler. command levels effectively "cmd-string" The strings. the file indirect file After until files the are Format: @filespec forms use the indirect command command indirect language. This 1is the command file "@filespec" lines initiate to 3. commands contains end-of-file is detected. permitted in MACRO-11. MCR through passing processor, "@filespec" MACRO-11 as processor only must listed form you contain in methods to pass commands to the can use with DCL. The one of the command 1 through 3. NOTE MACRO-11 8.1.2 Default MACRO-11 default device, 8-1 command string accepts When lists the be ("Z) File files. can CTRL/Z as using terminated at any input time is by a entering request a for present. Specifications input the directory, default or creates MACRO-11 name, values for as output assembler, and types each file you up to should listed in six types of mind the keep in Table 8-1. specification. Table IAS/RSX-11M/RSX-11M-PLUS OPERATING PROCEDURES Table File 8-1 Specification Default Default Values Values File Device Directory Filename Type Object Your Current None .OBJ File volume Listing Device Directory None .LST File for None .MAC None .MLB [1,1] RSXMAC . SML Current None .CMD default used object used file in Object Source Your Files volume default file Current; used for source or 1] device of last source file speci- fied user Your Macro volume default Current, macro Library if file is specified first; if not, directory last of source file System Library Macro device Library Indirect Your Command volume default File 8.1.3 MCR Command In response to the output and the String MAC> input Format prompting file sequence specifications printed in the by form MACRO-11, shown below: MAC>object,listing=srcl,src2,...,sSrcn where: object listing represents represents the binary the assembly containing = listing, the and the separates output file object table symbol file (output) 1listing file. (output) of contents, table. the specifications assembly from specifications. srcl, represent SIC2, ... containing srcn user-supplied the the ASCII source MACRO-11 macro (input) source library files program files to be or the assembled. IAS/RSX-11M/RSX-11M-PLUS OPERATING PROCEDURES Only two output file specifications in the command string recognized by MACRO-11; any more than two such files No limit is set on the number of source input files. command string is longer than 132 characters, a hyphen can a continuation character. 80 be characters placed at and the less end of will be will If be ignored. the entire than or equal to first line as the A null specification in either of the output file specification fields signifies that the associated output file is not desired. A null specification in the input file field, however, 1is an error condition, resulting in the error message "MAC -- Illegal filename" on the command output device (see Section 8.5). Note that the absence of both the device name (dev:) and the name of the file (filename.type) from a file specification is the equivalent of a null specification. NOTE When no listing file is specified, any errors encountered in the source program are printed on the terminal from which MACRO-11 was 1initiated. When the /NL switch 1is.- used 1in the 1listing file specification without an argument, the errors and symbol table are output to the file specified. Each file specification filespec where: contains /switch:value the the following information: ... filespec is standard /switch represents an ASCII name identifying a switch option. This switch option may be specified in three forms, as shown below, depending on the function file specification. desired: /switch Invokes the specified switch the specified switch action. /noswitch Negates /=switch action. Also negates switch action. In addition, accompanied by ASCII character the any switch number of strings, numbers. The default value is octal. Decimal by a decimal point (.). the specified identifier may be the following values: octal numbers, assumption values must for be or decimal a numeric followed Any numeric value preceded by a number sign (#) 1is regarded as an explicit octal declaration; this option is provided for documentation purposes and ready Also, identification of octal values, any numeric value can be preceded by a plus sign (+) or a minus (=) sign. The positive specification is the default assumption. If an IAS/RSX~ 11M/RSX-11M-PLUS explicit octal if All switch values must The switch specifications syntax output detec ted error the error syntax MAC -- Command followed by a of the (#), the precede the be preceded are 8-2 command to the by a colon interpreted (:). 1in the they apply. MACRO-11 The are below. string causes command output MACRO-11 to device: error entire command string. appearing information time, vyo u may want to override in the source program or establis hing how certain files certain MACRO-11 directives to provide MACRO-11 with are to be handled during assembly. You more can do selectively 1invoked specification. The specifications under so through one or RSX-11M/RSX-11M-PLUS are MACRO-11 File Table 8-2 Specification Switch /LI:arg /NL:arg switches, as ° additional parameters available switches for wuse in in listed which may each MACRO-11 be file file in Table 8-2. Switches Function ‘W%W\WM& assembly copy the must program to which applicable to Table message specified Listing control switches; these options accept ASCII switch values (arg) which are equivalent in function and name to and override the arguments of the .LIST and .NLIST directives specified in the source program (see Section 6.1.1). This switch overrides the arguments and /EN:arg /DS:arg remains process. in effect Function control for switches; the | entire these assembly options accept ASCII switch values (arg) which are equivalent in function and name to and override the arguments of the .ENABL and .DSABL directives specified in the source program (see Section 6.2.1). remains This in switch overrides effect for the the arguments and entire assembly process., /ML (see Note) The /ML switch, which takes no accompanying switch wvalues, indicates to MACRO-11 that an input file is a macro library file. As noted in Section 7.8, any macro that 1s defined externally must be identified 1in the .MCALL directive before it <can be retrieved from a macro library program. MACRO-11 file and assembled with the wuser In locating macro definitions, 1initiates a fixed search algorithm, (continued on next page) R— At in following in is 1included, | of the options described PROCEDURES declaration sign indicator, number sign. context switch A OPERATING IAS/RSX-11M/RSX-11M-PLUS Table MACRO-11 File 8-2 OPERATING (Cont.) Specification Switch /ML PROCEDURES Switches Function (Cont.) beginning with specified, continuing such file not with file. found error code last in specified, necessary, library the 1If upon (U) This means be specified search a required of in user the macro completion a macro file order with terminating, and a results that user reverse of the macro system each if macro definition the search, assembly library is an 1listing. file must in the command line or by using the MACRO-11 .LIBRARY directive (see Section 6.10.1) prior to the source file(s) that wuse macros defined in the library file. MACRO-11 macro does not pre-scan libraries; when needed;, it parses specification. If the a command new the line source next for file input is file that file specification switch, it is appended to the front of the library file list. As a result, a user macro library file must be specified in the contains the command line prior require 1it, in /ML to the order source to files resolve which macro definitions. /SP | Spool /NOSP Do /CR:[arqg] listing output spool output. not Produce (default value). a cross-reference listing (see Section 8.3). Switches for specified, options for /NOSP. object Switches the option option so are the they apply the listing also for applicable occurrences must avoided, below: /LI:SRC:MEB to files of subsequent the because switch specification such switch values shown input are limited /ML applies only to the file specified, whereas the /EN and Multiple be file are 1limited to /EN and /DS; when throughout the entire command string. Switch file are limited to /LI, /NL, /SP, /CR, and same the files switch in the /ML, command following accompanying to immediately /DS options, values /EN, and /DS: preceding the as noted above, string. a file of a specification subsequent like override any previously-specified values. If two are desired, they can be specified in the form IAS/RSX-11M/RSX-11M-PLUS 8.1.4 DCL Operating indicates prompting DCL prompt. command string the in PROCEDURES Procedures R5X-11M/RS5X=11M~PLUS with OPERATING one of the its readiness In to response formats shown accept to the a command prompt, enter by t he below: >MACRO| /qualifiers] FILE? filespec|[/qualifier(s]][,filespec|[/qualifier[s]]...] or [DCL] >MACRO [/qualifiers] where: qualifiers filespec[/qualifier(s]][,filespec[/qualifier[s]]...] affect either (command (parameter entire 8-4 command or stri ng the filesp ec qualifiers). description Table the qualifiers) of for See Table 8-3 for a command qualifiers a nd the a description of the paramet er qualifiers. filespec is the standard Section You use the comma concatenates all (,) the to files separate and then Table DCL file Command file shown specifications. performs the in MACRO-11 assembly. 8-3 Qualifiers Qualifier /[NO]CROSS REFERENCE specification 8.4. Function Suppresses or cross-reference 8.3). When generated, generates 1listing the a (see a Section <cross-reference 1listing generated, whether qualifier 1is file or not present 1is the 1in the 1is also /LIST command string. /NOCROSS REFERENCE /DSABLE: arg Overrides /ENABLE: arg assembler /DSABLE: (arg,arg...) /ENABLE: (arg,arg...) program. is in the is the .DSABLE directives When entered, default. more source one argument be enclosed must and .ENABLE the than arguments parentheses or 1in separated by commas. You can specify arguments with any of the /DSABLE the qualifier. following or /ENABLE Argument ABSOLUTE Enabling this function relative addresses 67) assembled to be addresses causes (address as (address mode (continued on all mode absolute 37). next page) IAS/RSX-11M/RSX-11M-PLUS Table DCL 8-3 Command OPERATING (Cont,) Qualifiers Qualifier Function ABSQLUTE AUTO PROCEDURES (Cont.) MCALL By is default, the ABSOLUTE argument disabled. Enabling causes known the macro definition undefined the AUTO MCALL MACRO-11 to libraries that symbols opcode argument search for a all macro matches appearing field of a any in MACRO-11 statement, By default, disabled this and unknown if symbol field, it undefined CARD FORMAT error, external symbol, symbol Enabling absolute this FILES-11 format. default, is disabled. or an depending upon described the BINARY argument when enabled, function, treats columns 73 of line comments. as default, argument is Enabling causes (U) function produces binary output in By the a as argument through the end CARD FORMAT disabled. the the CASE MATCH MACRO-11 assembly directives DIF be to the argument conditional ,IF IDN/.IF alphabetically case sensitive. | By default these directives not case sensitive. GLOBAL Disabling MACRO-11 symbol code this to function flag references (U) an opcode symbol the This the declares declares By CASE_MATCH in is finds either the GLOBAL below. BINARY option MACRO-11 all are causes undefined with an error on the assembly listing. By default, the GLOBAL argument is enabled all the symbols that are undefined end of assembly pass 1 default and global MACRO-11 treats at as references. (continued on next page) IAS/RSX-11M/RSX-11M-PLUS 8-3 Command (Cont.) Qualifiers Qualifier LOCAL PROCEDURES L Table DCL OPERATING Function Enabling the causes the assembler symbols as local enabled, all flagged with symbol) error By LOCAL default, argument to treat symbols. global the symbols U message. the Enabling this MACRO-11 to ASCII LOCAL argument Disabling By DEFINITIONS register TRUNCATION to function upper-case. the this function 1ignore the causes normal definitions. register definitions enabled. When this function this function MACRO-11 rounding. performs The LOWER CASE to MACRO-11 performs truncation. When causes lower-case is enabled. default, are causes lower-case <convert default, Disabling MACRO-11 By this to input argument REGISTER function accept is input. MACRO-11 ASCII are (undefined disabled. LOWER_CASE all When TRUNCATION disabled is enabled, floating-point 1s disabled, floating-point argument is by default. (continued on next page) IAS/RSX-11M/RSX-11M-PLUS Table 8-3 Command OPERATING (Cont.) Qualifiers DCL Qualifier /[NOJLIST[:filespec] PROCEDURES Function Specifies whether or should <create and file. You qualifier file can for not the assembler print a 1listing 1include either a /LIST as command or specification. If a a /LIST qualifies the command, the 1listing file is both entered in your directory and printed on the line printer. If you do not include a file specification, the listing file has a .LST file last type file The listing file. (The language and named is in file LINK commands file use in printed listing on file qualifies. The default is name of the the directory file is but is /NOLIST. the default 1is not The file qualifier. Indicates whether or not the assembler should create an object module, If you do not include specification in the assembler creates an the same and an file .0OBJ /OBJECT /[NO]SHOW:arg /{NO}SHSW:(argfarg@,‘) the the 1line ©printer. is named after the it /NOLIST /[NOJOBJECT[:filespec] your the command. the command as the TIf /LIST qualifies specification, entered after MACRO cannot be a 1library command and all other first file named in default file name.) a named the is use any with the file as the source file extension. the Overrides assembler included name a command line, the object file with default the qualifier. .LIST and directives that 1in the source file. of the /SHOW following .NLIST may You be can arguments qualifier. Argument BINARY CALLS Controls expansion binary Controls listing and the repeat 1listing code. range of macro macro calls expansions. (continued 8-11 of on next page) IAS/RSX-11M/RSX-11M-PLUS Table 8-3 DCL Command OPERATING PROCEDURES (Cont.) Qualifiers Function Qualifier COMMENTS Controls CONDITIONALS Controls listing of conditional coding. CONTENTS Controls listing contents during Controls listing counter COUNTER location DEFINITIONS listing of comments. of unsatisfied the table assembly pass of the field., Controls listing definitions and of 1. current of repeat macro range of macro expansions. EXPANSIONS Controls listing expansions. EXTENSIONS Controls listing of listing of binary expansions. LISTING DIRECTIVES Controls control arguments, that listing directives alter that without is, the directives 1listing level counter. Controls listing code. of Controls listing of sequence numbers. SOURCE Controls listing SYMBOLS Controls listing of table resulting assembly. OBJECT BINARY the generated binary SEQUENCE_NUMBERS /[NOJWIDE of source 1line source lines. the from symbol the When set to WIDE, the 1listing 1is printed in 132 column format. When set to /NOWIDE, the listing is printed in 8¢ column format, /NOWIDE is the default qualifier. IAS/RSX-11M/RSX-11M-PLUS OPERATING PROCEDURES Table DCL 8-4 Parameter Qualifier Function /LIBRARY Specifies The file MACRO-11 1. The cannot input MAC DCL> MACRO a file be reverse the last is the a files order. file macro library 1listed Therefore, in the file. 1in a the library command line. the source Examples command into MCR> DCL> in String following FILE? The an ©processes line Command FILNAM.MAC 2. that assembler command 8.1.5 Qualifiers strings relocatable assemble object module named file FILNAM.OBJ. FILNAM=FILNAM FILNAM MACRO FILNAM following FILNAM.MAC command and strings produce an assemble object the file source with file the name TESTA.OBJ. 3. The MCR> MAC DCL> MACRO/OBJECT:TESTA following source 4. TESTA=FILNAM command files named FILNAM strings concatenate FILNAM.MLB, and TESTA.MAC, SHELL.MAC and create MCR> MAC SHELL=FILNAM/ML,TESTA,SPAN3,SHELL DCL> MACRO The following assembly the command command file has format. no object file named the and SHELL.OBJ. FILNAM/LIBRARY,TESTA,SPAN3,SHELL 1listing. source an assemble SPAN3.MAC, strings Any are .LIST ignored. comments produce TTM The or an listing included object .LIST and MCR> MAC DCL> MACRO/LIST/NOSHOW:COMMENTS/WIDE COM module and an directives in produced is printed FILNAM,FILNAM/NL:TTM:COM=FILNAM FILNAM by in this wide IAS/RSX-11M/RSX-11M-PLUS 8.2 The IAS MACRO-11 following that apply 8.2.1 OPERATING sections 1Initiating to the MACRO-11 PROCEDURES PROCEDURES describe exclusively OPERATING those IAS Under MACRO-11 operating procedures system. IAS The MACRO command, used under IAS, causes MACRO-11 to assemble one or more ASCII source files <containing MACRO-11 statements 1into a relocatable binary object file. The assembler will also produce an assembly listing, followed by a symbol table 1listing. A cross-reference 1listing can also be produced by means of the /CROSSREFERENCE qualifier (see 8.3, below). You can input a MACRO-11 program either (interactive mode) or from a batch file mode use Program the MACRO command Development signified by the System appearance directly from the terminal (batch mode). For interactive be 1issued whenever the 1IAS which can of prompt: (PDS) the 1is at command level, a condition PDS> For batch mode use the $MACRO command. When the assembly is completed, returns control information 8.2.2 IAS to about PDS. interactive Command MACRO-11 (Refer and to terminates the batch IAS mode User's operations Guide for and further operations.) String Formats: Interactive Mode input PDS> MACRO qualifiers filespec /LIBRARY +... or PDS> MACRO qualifiers input FILES? Batch filespec /LIBRARY +... Mode | input SMACRO qualifiers filespec /LIBRARY +... where: input is filespec (see the specification Section source program consists (+) 8.4) must of that code. multiple be used specification from card" form of a not allowed. 8-14 to of an input contains When files, the a separate file MACRO-11 program plus each sign file the next. The "wild file specification 1is IAS/RSX-11M/RSX-11M-PLUS OPERATING /LIBRARY PROCEDURES specifies that an input file is library file. Library files definitions of externally macros. As externally identified it can be noted 1in a macro hold the defined Section 7.8, an defined macro must be in an .MCALL directive before retrieved and assembled the user encounters program. When an .MCALL directive, begins for listed. the The order search definitions of the is important have two library files macro might definitions in with MACRO-11 a search macros because a different LIB1 and LIB2. For example, 1if vyou need the definition in LIB1l, then you must place LIB1 after LIB2 1in the command line because MACRO-11 searches the last file specified in the command 1line first, then given I1f moves backwards until all through have been the files searched. a macro's definition is not found 1in of the files named by the user, MACRO-11 automatically searches the system macro library; 1if the definition is still not found, an error code (U) is generated in the assembly listing. any specifies qualifiers output /OBJECT[:filespec] one or produces specified more an by of the object filespec 8.4). The default the same filename as source file /OBJECT 1is condition. /NOOBJECT does output /LIST[:filespec] an always an as Section is a file with the last named and produce file (see .OBJ extension. the default object file. produces an assembly 1listing file according to filespec (see Section 8.4). If filespec is not specified, the listing 1is ©printed on in in /NOLIST not following: the 1line printer. The default interactive mode is /NOLIST and batch mode is /LIST. does not The default produce /NOLIST and in in a batch mode NOTE When no listing file is specified, any errors encountered in the source program are displayed at the terminal MACRO-11 was initiated. 8-15 from 1listing interactive which is file. mode is /LIST. IAS/RSX-11M/RSX-11M-PLUS OPERATING PROCEDURES J/CROSSREFERENCE[:argl...argd] produces a cross-reference listing. through argd are described in Argl Section 8.3. abbreviated This qualifier may be to /C. A MACRO-11 command string can be specified using any one of the three In shown above for the interactive and batch modes. formats interactive mode, if the input file specification (filespec) does not begin on the same line as the MACRO command and its qualifiers, PDS prints the following prompting message: FILES? then waits for the user to specify the input file(s). In batch mode, the $MACRO command and its arguments must appear on the same line unless the PDS line continuation symbol (-) is used. IAS Indirect Command Files | 8.2.3 Format: @filespec where: the that name that an 1is follows @ specifies filespec a of is the file specification (see Section 8.4) The default that contains a command string. file indirect extension file. for the file name is .CMD. wused with MACRO-11 is used in a MACRO-11 command string, the contents of file are taken as all or part of the command string. the specified The indirect command file facility of PDS can be This is accomplished by creating an ASCII file that strings. command the in thereof) portions (or contains the desired command strings When an indirect command file reference forms shown in Section 8.2.2. An indirect command file reference must always be the rightmost (see Section 8.2.4 in the command IAS Command String Examples 8.2.4 The entry for examples). following 1. PDS> examples show typical MACRO FILES? /NOLIST assembled listing command strings. A+BOOT.MAC;3 In this example, be PDS MACRO-11 will to be the source files A.MAC and produce an object produced. BOOT.MAC;3 file called BOOT.OBJ. will No IAS/RSX-11M/RSX-11M-PLUS OPERATING PROCEDURES 2. Where the indirect command file TEST.CMD contains the command string: MACRO/OBJECT:MYFILE the A+4B command: PDS>@TEST causes MACRO-11 into 3. an Where object the command to assemble file called indirect string the two files A.MAC and B.MAC MYFILE.OBJ. command file IND@2.CMD contains the segment: ATEST/LIBRARY+BTEST+SRT1.021 the command: PDS>MACRO/LIST:DK1:TST causes MACRO-11 using file on 4. the assemble the files BTEST.MAC and SRT1.021 macro library file ATEST.MAC to produce an object named disk to @IND@2 SRT1.0BJ. unit A listing file named TST.LST is placed 1. SMACRO/LIST:DK@:MICR/NOOBJECT - LIB1/LIBRARY+MICR.MAC; 002 In this example, MICR.MAC; @02. placed on disk 8.3 CROSS-REFERENCE the The unit library program 4. PROCESSOR file is assembled listing file with named the file MICR.LST is (CREF) The CREF processor is wused to produce a 1listing that includes cross-references to symbols that appear in the source program. The cross-reference listing is appended to the assembly 1listing. Such cross-references are helpful 1in debugging and 1in reading long programs. A cross-reference listing 1. User-defined 2. Macro 3. Register 4, Permanent can symbols symbols symbols symbols include up to four sections: IAS/RSX-11M/RSX-11M-PLUS To generate MACRO-11 The form a cross-reference command of the string. switch e OPERATING listing, Optional PROCEDURES specify the arguments /CR can switch also be 1in the specified. is: ——— SYM /CR|: | MAC REG PST SEC __\ERR/J _| where: SYM specifies user-defined MAC specifies macro REG specifies register PST specifies permanent symbols symbols (default) (default) symbols symbols e SEC specifies program ERR specifies error If you wish to only, use /CR. However, 1f sections lines (default) generate listings for user-defined No argument is necessary. an cross-reference argument listing is is specified, generated. For and macro symbols | only that type of symbols only. No example: /CR:SYM produces a cross-reference listing of user-defined listing of macro symbols is generated. Thus, to produce all six types of cross-reference listings, you must specify all six arguments (the order in which they are specified is not significant). Use a colon to separate arguments. For example: /CR:REG:SYM:MAC:PST:SEC:ERR The CREF processor Reference Manual Figure 8-1 listing, listing (CRF) illustrates references more 1s supplied more with fully your a complete are made informative the <cross-reference 1in CREF # in the Utilities form 1listing. page-line. uses the To following In the make the signs: Meaning somewhere defined * the processor Sign = described system. in by a the source direct program assignment destructive reference; at the processor the value of the previous contents destroyed). at the listed colon line 1is sign referenced by ©processor double a referenced by symbol 1is changed assignment (:) 1listed line the by or symbol direct defined a the is statement. colon sign the the (its symbol statement, a (::). R IAS/RSX-11M/RSX-11M-PLUS OPERATING PROCEDURES RSOUNP Cross MACRD V05.00 Saturday 08-Jan-83 reference RSOUNP SYMBOL table 2~16# 2~17 (CREF 2=23% 2=-32% 2=-33% 2=30% 2-31% 2-352 Z2—18% 2-23 R1 R2 2-32% R3 2-19% 2-21% 2-33 R4 2-16 2-17#% 2-18 SP 2-16# 2-27 11:47 Pase R-1 2~43 2-4B% 2=25 2-27% 11:47 Pase 2-49% C~1 0-0 2-14 Figure 8.4 S-1 2-43 RSOUNP MACRO V05.00 Saturday 0B-Jan~-83 Cross reference table (CREF V05.00) « ABS. PUREI Pase 2=-23 RSOUNP MACRO VO05.00 Saturday 08-Jan-83 Cross reference table (CREF VY05.00) RO 11.:47 VY05.00) 8-1 Sample IAS/RSX-11M/RSX-11M-PLUS FILE CREF Listing SPECIFICATION Format: dev:[g,m] name.ext;ver where: dev: is the name resides. of A the device device name where the consists of desired two file characters followed by a and a colon 1- or 2-digit device unit number (octal) (for example, DPl:, DK@:, DT3:). The device is specified in Table 8-1. The default default device under IAS manager for each SET (g,m] is is established initially user and can be changed by the system through the command. the User consists of File a owner (member) ({]). An Directory group number number example of a (UFD) (octal), (octal) all UFD code code. This a (,) comma enclosed is: in [200,30]. code and an brackets IAS/RSX-11M/RSX-11M-PLUS The default Identification IAS, the OPERATING UFD is Code (UIC) be changed UFD can PROCEDURES equivalent given at to the log-in time. through the SET command. name is the filename alphanumeric and consists characters. of There one 1is is a 1- to 3-alphanumeric character DEFAULT through no filename. .ext User Under nine default filename for a extension or is type that is preceded by a period (.). An extension normally used to identify the nature of the file. Default values depend on the context of the file specification and are as follows: .CMD = Indirect .LST = A command (input) file (print format) file listing .MAC = MACRO-11 source module (input .0OBJ .CRF = MACRO-11 object module (output file) = Intermediate CREF input file created file) by MACRO-11. sver is an octal number differentiate number For is For files, number output version If prefixed input version no between between by a the of the files, the 1 and versions 77777 of semicolon default file default is file. the highest wvalue 1is the highest exists increased value 1 is used. by 1. file specification information is provided in in for a Detailed the applicable Section .3 in guide or UNDER IAS/RSX-11M/RSX-11M-PLUS 8.5 MACRO-11 MACRO-11 ~one of system user's the an error error command MAC prints that -- Error command during messages with assembly. procedures manual (see command the .J.INCLUDE below command or a output is line device detected. that caused .LIBRARY directive both the when MACRO-11 the error. file error, source line and should and the message MACRO-11 error the the error message caused the error. source confused message to described below line MACRO-11 These message conditions prints below the error If the error is a MACRO-11 operating Preface). ERROR MESSAGES outputs to This 1is is the general form IAS/RSX-11M/RSX-11M-PLUS systems. the used exists. of the file that number exists, the This that same (;). value that number version the the line line reflect error operational codes (see problems Appendix D) produced not be by MACRO-11 IAS/RSX-11M/RSX-11M-PLUS OPERATING PROCEDURES exception the with below, listed messages All the error the of "MAC -- Command I/0 error" message, result in the termination of the restart by reading then attempts to MACRO-11 current assembly; In the case of a command I/0 error, however, 1line. command another command MACRO-11 exits, since it is unable to obtain additional line input. MAC -- Command file/open MAC -- Command I/0 error failure Either the file from which MACRO-11 is reading a command could or the indirect not be opened initially or between assemblies; command in the MACRO-11 command file specified as "@filename" See "OPEN FAILURE ON INPUT FILE". line could not be opened. the by returned An error was attempt to read a command line. causing error, attempted when to MACRO-11 MACRO-11's during system file This is an unconditionally fatal exit. this message appears. No MACRO-11 is restart error MAC -- Command syntax MAC -- Illegal filename An error was detected in the syntax of the MACRO-11 command line. Neither the device name nor the filename was present in the input file input file specification was null), or a (the specification was wild card convention (asterisk) output employed an in or input file specification. (*) options Wildcard are not permitted MACRO-11 in file specifications. MAC -- switch Illegal An illegal switch was specified for a file, an illegal value was wuse of a switch was or an invalid specified with a switch, detected MAC -- by MACRO-11. .INCLUDE directive The file specified exist or is file error in the invalid, .INCLUDE statement the device specified either does is specified in not available, or the .INCLUDE stacking depth exceeds five. MAC -- Indirect command syntax error The name of the indirect command file not in the command line (@filename) the MACRO-11 command line is syntactically incorrect. MAC -- Indirect file depth exceeded An attempt to exceed the maximum allowable number of nested (Three levels of indirect files has occurred. indirect command command files are permitted in MACRO-11.) MAC -- Insufficient dynamic memory available for MACRO-11 to The library file has been corrupted, or it was not produced by There is not enough physical memory page its symbol table. or see Appendix MAC -- Invalid format Reinstall MACRO-11 in a larger partition, F.3. in macro library the Librarian Utility Program (LBR). IAS/RSX-11M/RSX-11M-PLUS MAC -- I/0 In error on reading file, a the file containing message either with MAC -- I/O MAC error macro -- I/0 input an characters indicate or a file error; that macro a was device library macro as on library I/0O error on file and not output the MAC may device also is -- I/0 error A read or -- on library a has exists been line This or that corrupted input file, a source except input that the file is file. file indicate that a device file the or file problem the 1listing system. This exists or that ) work write .LIBRARY problem full. file error occurred This is symbol table. the device or by MAC macro example, file In writing a record to the object output output file, an error was detected by message or for encountered. file data. library error source detected 132(10) file on meaning a system also source PROCEDURES file from than incorrect Same a more may a input record OPERATING error attempting directive file on the work file used to store the most likely caused by a problem on write to a device that is full. to error The file specified in the L.(LIBRARY statement either does not exist or is invalid, the file specification in the .LIBRARY directive is for a non-random access device, the device specified in the depth MAC -- Open 1. 2. 3. failure A Specified ©Specified User does the Open available, or the file does directory file does not exist. file does not exist. not have access privilege to the file failure Specified itself. on output device not have access privilege . The to volume is full or device . There write * directory does file insufficient storage directory. not exist. is not mounted. exists with the device. User 64K file or file A problem Specified is directory does . volume file , The W .LIBRARY stacking allowed. . ~NSN O -- input device not depth not exist. volume is not mounted. problem exists with the device. 5. h. 1. MAC on is maximum The 4. -- 1line the ©Specified to MAC command exceeds limit the does space not for exist. is File the protected. Control Blocks. exceeded 64K words of work file memory are available to MACRO-11. This message 1indicates that the assembler has generated so many symbols (about 13,000 to 14,0@0) that it has run out of space. Either contains macro the source a condition expansion terminating program that that condition. 1is leads to too 1large excessive recursively calls to start size, itself with, or such as a without a | it CHAPTER RSTS/RT-11 9.1 The MACRO-11 only way either the 9.1.1 RT-11 There are UNDER a or RSX program RSTS ways run to can run-time Through two OPERATING PROCEDURES RSTS MACRO-11 RT-11 9 a run on a RSTS system 1s through systems. MACRO program under the RT-11 run-time system: 1. Use the RT-11 Emulator. This 1s done by typing: SW RT11l. The terminal will respond with the RT-11 prompt (a dot printed by the keyboard monitor). You can then use the RT-11 2. commands (see Type the command: with an string Section RUN $MACRO.SAV. asterisk of the 9.2). (*) prompt. The You terminal will can then enter a respond command form: OBJFIL,LSTFIL=SRC...SRC6 where: OBJFIL 1is an object extension LSTFIL 1is a listing extension SRC... are SRC6 extension in 9.1.2 RSX To run a command: Through MACRO file with the default (output) file with the default .LST. source this (output) .OBJ. (input) .MAC. Six files input answer the are default allowed command. RSTS RUN program SMAC.TSK. you enter under the RSX run-time The terminal will respond MAC> In with files a command OBJFIL,LSTFIL=SRC...SRCN string of the form: system, with: type the RSTS/RT-11 where: OBJFIL is OPERATING an object extension PROCEDURES (output) file with the default with the default .O0OBJ. LSTFIL is a listing (output) extension .LST. file SRC... are SRCN files extension source (input) with .MAC. the default NOTE There are used to site other call commands RT-11 dependent and and so are here. 9.2 INITIATING The following that To apply call system R When 9.3 sections only the to (a UNDER RT-11 printed be they are not mentioned those MACRO-11 operating procedures system. assembler dot can but RT-11 describe the MACRO-11 prompt from by the with an the system keyboard device, monitor) respond by to the typing: MACRO the accept MACRO-11 that RSX assembler command RT-11 responds string COMMAND asterisk (*), it is ready to input. STRING Format: [dev:obj,dev:list,dev:cref/s:arg]=dev:srcl,srcz,...,dev:srcn/s:arg where dev obj list cref is any legal file-structured is the file that the this file RT-11 device device for input specification assembly should is the file produces. cross-reference is a (see set of Table file 9-2). binary produces; be LP TT or of the process specification file (Omission the output; process is the file specification listing that the assembly cross-reference /s:arg not of for of listing, dev:cref object the assembly produces of that the the and CREF not file device for symbol temporary assembly does any process preclude a however.) specification options and arguments RSTS/RT-11 srcl, represent src2,... srcn MACRO-11 source program or the wuser-supplied macro library files to be assembled. You can specify as many as The following source BINF.OBJ file and a the OPERATING PROCEDURES ASCII six source files. command string calls plus the 1listing. source for (input) an assembly system MACRO library to The 1listing files goes containing that the uses one produce an object file directly to the 1line does not printer. *DK:BINK.OBJ,LP:=DK:SRC.MAC All output file produce an specification specifications output for that file file. are optional. wunless the The command system string contains a The system determines the file type of an output file specification by its position 1in the command string, as determined by the number of commas in the string. For example, to omit the object file, you must begin the command string with a comma. The following command produces a listing, including cross-reference tables, but not binary object files. * LP:/C=(source Notice that you specification Table 9-1 in lists need the the file specification) not include command default a values Table Default comma after File for each DK: Listing Same file Cref First source Additional System source MACRO file output file specification. Values Default Device Object final 9-1 Specification Default File the string. File Name Default File Type Must specify . OBJ Must specify .LST DK: Must specify . TMP DK: Must specify .MAC Must specify .MAC Same as as for for object preceding source file System device SY: SYSMAC .SML Must .MLB Library User MACRO Library DK: if first file, otherwise same as for preceding source file specify RSTS/RT-11 OPERATING PROCEDURES NOTE Some assemblies space than When need this called symbol can a to system temporary provide The default device cause the device, for WRK.TMP system to enter the where: dev: dev is is DK. assign a following command : ASSIGN work extended space. To table contain. the creates WRK.TMP table different symbol memory occurs automatically file more available WF the file-structured device that will hold WRK.TMP. 9.4 FILE At assembly SPECIFICATION appearing time in MACRO-11 on satisfy these you the the OPTIONS may need source handling needs by of override certain using File to programs. the files switches Table 9-2 Specification Option /L:arg Listing switch and control values name Section of the entire switches; (arg) which to directives /D:arg may during MACRO also directives need to assembly. described in direct You Table can 9-2. Options Usage /N:arg /E:arg certain You the arguments specified 6.1.1). directives assembly these options are equivalent This in of the the .LIST source switch and process. and control switches; these options values (arg) which are equivalent name to directives Section of the entire the arguments specified 6.2.1). This directives assembly of the the source switch overrides and remains in (see arguments for the and .DSABL program the effect process. (continued .NLIST accept ASCII in function .ENABL in and program overrides the remains in effect Function switch accept ASCII in function on (see arguments for next the page) RSTS/RT-11 File OPERATING PROCEDURES Table 9-2 (Cont.) Specification Options Option Usage /M Indicates assembler input file is MACRO library file. When encounters an .MCALL directive 1in source code, their order When it it searches of locates macro appearance a macro libraries 1in record the the according to the command string. whose name matches that given 1n the .MCALL, it assembles the macro as indicated by that definition. Thus, if two or more macro libraries contain definitions of the same macro name, the macro command string Consider the library takes following * (output file that appears rightmost in the precedence. command string: specification)=ALIB/M, BLIB/M,XIZ Assume and that different a includes appears the of the contain two a definitions. contains If each BLIB.MLB, macro the in Then, call definition the command macro macro of libraries, called 1f source (MCALL .BIG, .BIG the macro library string does in ALIB.MLB .BIG, but with file XIZ the system program as it BLIB. not 1include the standard system macro library SYSMAC.SML, the automatically includes it as the first source the command string. Therefore, 1f macro system file 1in 1library ALIB.MLB contains a definition of a macro called .READ, that definition of .READ overrides the standard .READ macro definition in SYSMAC.SML. /C:arg The /M The other 9.5 A a Controls switch affects options only affect CROSS-REFERENCE cross-reference source contents (CREF) (CREF) program, the the of cross-reference source entire TABLE table to which command string. GENERATION OPTION lists 1identifying file the all or a listing. it subset statements of that 1is the appended. symbols define in and use symbols. 9.5.1 To Obtaining obtain a CREF command string. assembly listing a Cross-Reference table Table you must include the /C:arg option in the Usually vyou 1include the /C:arg option with the file specification. RSTS/RT-11 If the command string does OPERATING not include system automatically generates a need to have a device other than you must A include complete l. 2. 3. CREF the listing reference program and A cross reference R1, R3, A R2, cross in the the program of specification, and MACRO command six sections: an used 1in the symbols are R#, defined by operator. symbols. These PC. symbols--those symbols .MCALL directives. A cross mnemonics 5. A cross reference of program sections--the names as operands of .CSECT or .PSECT directives. 6. A cross can /C include option. reference of and assembler permanent directives. reference of errors--the errors from the assembly cross-reference the string. symbols--labels by register SP, of file following followed R5, cref 4. flagged the R4, reference and field of symbols a temporary file on device DK:. If you DK: contain the temporary cref file, contains A cross .MACRO You dev:cref PROCEDURES any or 1listing These all by arguments /C of are you six the listed sections appropriate and described specify lists on all the arguments with in Table 9-3. Table 9-3 Option Arguments Argument CREF defined operation system groups and by error type. these specifying symbols--all Section S User symbols R Register M MACRO P Permanent symbols including C Control E Error symbols symbolic and code names program instructions and directives sections grouping NOTE Specifying /C with no arguments equivalent to specifying /C:S:M:E. special case exXcepted, you explicitly including request its is That must each CREF section by arguments. - No cross-reference file occurs 1if the /C option is not specified, even 1if the command string specification. includes a CREF file RSTS/RT-11 9.5.2 Handling When you you cause the If device DK: for file. To command still Cross-Reference request space a 1is include also The system deletes then in the uses following command temporary CREF a string file, of contains allocate a the option, device output and ignored the /C the in the (You must of the option is content if free for file specification. form is /C insufficient another third dev:icref the DK:CREF.TMP. string.) dev:cref after by means specify control command the the to it can specification automatically The if you include dev:cref Files temporary device, the /C option present it is, PROCEDURES listing a or file, another that The not generate write-locked allocate listing. to temporary string; Table cross-reference system the OPERATING file producing causes the instead of the listing. CREF system to DK:CREF.TMP use and RK2:TEMP.TMP as file. * ,LP: ,RK2:TEMP.TMP=SOURCE/C Another to way enter to the « ASSIGN This method relieves assign is preferred from command string. include a cref command The system assembly If you string prevails prints where to P is the appears, A number sign (#) that begins and to next operation MACRO-1l1 MACRO-11 outputs one the prints If below the MACRO-11 command R symbol assembly L a is on a CREF.TMP file is MACRO: Error an which the line alters the error 1is prints below line Messages that a message L.INCLUDE the caused ?MACRO-s-Error error the message MACRO-11 source MACRO-11 command tables following 1listed Under in the MACRO control sections, left margin of the on lists symbol, number the later page. system the and specification on the same references control the page. contents of 1line, in the section, definition. destructive the addressed RT-11 message <conditions error the reference indicates a symbol to a reference 1indicates a that error error command, only. new are The in CF string, location. of the symbol values, beginning at the page. page next (*) dev: command cross-reference table the code reference-—-an for each error 9.5.3 for entering ASSIGN a and also applicable, 1if or asterisk the in symbols codes, page. References to left-to-right across An enter Each error device intend to do several assemblies, as it include the dev:cref specification in each specification requested system prior you to lists and P-L; if having listing. The form alternative command dev:CF you the an following 1line 1line to the command output device when described below is detected. MACRO-11 the or command a message error. line that caused .LIBRARY directive both source the the error. file error, line and the RSTS/RT-11 The the s in the error severity level message represents of the error. These error messages confused with the during OPERATING PROCEDURES the letter code that indicates reflect operational problems and should not be error codes (see Appendix D) produced by MACRO-11 assembly. Error Message ?MACRO-F-Device Meaning full DEV: The output volume does room for an output command string. ?MACRO-F-File not found ?MACRO-F-.INCLUDE not file have sufficient specified in the DEV:FILNAM.TYP An input file in the command 1line exist on the specified device. directive file does not error The file specified in the .INCLUDE statement either does not exist or 1is invalid, the device specified in the command line 1is not available, or the LJ(INCLUDE stacking depth exceeds five. ?MACRO-F-Insufficient memory MACRO does memory ?MACRO-F-Invalid not (l1AK have words) the minimum necessary to amount of run. command The command line contains a syntax error specifies more than six input files. ?MACRO-F-Invalid device A device specified in the not exist on the system. ?MACRO-F-Invalid ?MACRO-F-Invalid ?MACRO-F-I/0 macro library option: error on The not produced /X The the specified program. library hardware read from specified error on command 1line does file has been corrupted or it was by the RT-11 librarian, LIBR. option was not recognized by DEV:FILNAM.TYP A ?MACRO-F-I/0 or error or occurred write while to the read, or attempting device on to the file. work file MACRO failed to open, work file, WRK.TMP. write to its RSTS/RT-11 ?MACRO-F-.LIBRARY directive OPERATING PROCEDURES file The error file specified in the .LIBRARY statement either does not exist or is invalid, the file specification in the L.LIBRARY directive is for a non-random access device, the device specified in the command line is not available, or the .LIBRARY stacking depth exceeds the maximum depth allowed. ?MACRO-F-Protected file already exists DEV:FILNAM.TYP An attempt was made the same name as an ?MACRO-F-Storage limit exceeded to create a file existing protected having file. (64K) MACRO's Virtual Symbol Table can store symbols and macros up to 64K in any combination. Your program contains more than 64K worth of one or both of these elements. ?MACRO-W-I/0 | error on CREF file: MACRO ran CREF out aborted of device the <cref file, or occurred. The cref assembly continues. a space while writing hardware error file 1is aborted has but APPENDIX A MACRO-11 A.1 ASCII CHARACTER CHARACTER SETS SET Even 7-Bit Parity Bit Octal Code Character ) agn NUL Null, tape 1 ag1 SOH Start of | 1 Aa2 STX ) ga3 ETX | of Remarks feed, message, Start of address, End of of also SOM, start CONTROL/A. text; also CONTROL/B. text; also message, End CONTROL/SHIFT/P. heading; CONTROL/C. transmission EOA, end of EOM, end of 1 pg4a EOT (END); shuts A gas ENQ TWX machines, CONTROL/D. Enquiry (ENQRY) ; also CONTROL/E. Y 206 ACK Acknowledge; 1 na7 BEL Rings 1 210 BS Backspace; HT LF effector. backspaces some machines, CONTROL/H. Horizontal tab. CONTROL/I. Line feed or Line space (new line); off @ Y A11 g12 also RU, CONTROL/F. bell. CONTROL/G. the advances duplicated also FEO, paper to 1 @13 VT @14 FF Vertical tab (VTAB). Form Feed to top 1 315 CR Carriage line; 1 A g16 @17 SO SI return Shift out; red. CONTROL/N. in; changes Shift to beginning by CONTROL/M. changes ribbon ribbon @20 DLE Data 21 DC1 Device control transmitter (READER) 1 @ color color link escape. @ @22 CONTROL/P 1; 324 DC3 DC4 to to (DC#). turns on, CONTROL/Q Device control DC2 2; turns punch or auxiliary CONTROL/R (TAPE, AUX ON). @23 of CONTROL/O. @ ON). 1line, CONTROL/K. of next page 1 (X next CONTROL/L. duplicated black. format by CONTROL/J. Y (PAGE). WRU, Device control transmitter (READER) (X OFF). Device control 4; auxiliary off. OFF) . 3; off, turns on. turns CONTROL/S punch or CONTROL/T (AUX ' | MACRO-11 CHARACTER Even Parity Bit 7-Bit Octal Code Character 1 @25 NAK ~ Remarks Negative ERROR. 1 926 SYN g B27 ETB SETS acknowledge; Synchronous End of transmission logical end ERR, | file CONTROL/V. LEM, also < CONTROL/U. (SYNC) . Dblock; of also medium, Cancel (CANCL). CONTROL/X. End of medium. CONTROL/Y. Substitute. CONTROL/Z. Escape. CONTROL/SHIFT/K. File separator. CONTROL/SHIFT/L. @35 g36 337 GS RS Group separator. CONTROL/SHIFT/M. Record separator. CONTROL/SHIFT/N. Unit separator. CONTROL/SHIFT/O. p52 NS53 054 #55 T e N P56 357 A60 g61 gs2 @63 @64 T T g65 067 870 a71 372 373 T T I Y I R I n74 a75 876 377 100 161 102 193 104 195 106 107 110 111 e Space. IO = O N . g51 G @46 p4a7 Asa -~ S N el Lk P42 @43 g44 @45 | B 341 O O~JAUTHBWN H N 040 = oem 0nCc o CAN EM SUB ESC FS HZQTMWEO QW@ WV A Rl - TR Wy CONTROL/W. Aa30 A31 @332 #33 A34 "Accent acute or apostrophe. MACRO-11 Even Parity Bit CHARACTER SETS 7-Bit - Octal Code Character 115 116 X E<CHNOUOUWOZIrXU S 113 T S S TR I 112 114 R i B B 123 124 125 B 122 o 117 120 121 130 Remarks 127 143 144 146 147 151 152 153 154 R Rl 161 R 155 163 R SRR - R 171 175 176 177 Appears X< 166 167 170 172 173 Appears oot 164 165 N R N 162 grave. | QU OB HRWWHITOMODOOOALO DD 142 156 157 ** Accent 141 O~ S S I T | 140 150 R ** ° * 137 160 * shift/k. shift/1. shift/m. Yt S 134 135 136 145 IR N 132 133 S I IR S T BRI S TR T 131 174 as as < # This code generated This code generated (if present). DEL or on *~ on Delete, some machines. some machines. Rubout. by ALTMODE. by prefix Kkey MACRO-11 A.2 CHARACTER SETS RADIX-5¢ CHARACTER SET ASCII Character Space 49 A-Z 191-132 $ | . Unused g-9 The \ Octal Equivalent Radix-50 Equivalent | 9 1-32 44 33 56 34 K 35 60-71 maximum Radix-50 value is, 36-47 thus, A7%50%*2+47*50+47=174777 The following table provides a convenient means of translating between the ASCII character set and its Radix-50 equivalents. For example, given the ASCII string X2B, the Radix-50 equivalent is (arithmetic is performed in octal): X=113000 2=002400 B=000@a72 X2B=1154092 Single Char. or First Char. Second Third Character Character Space 000000 Space aneean Space BOR000D A PR3109 A 200050 A B BO6200 B doR120 B go00al 200002 C 711300 C daR170 C d000a33 D 014400 D 0AR249 D G000a4 E 317500 E AgR310 E da00a5 F 22600 F d03360 F 200006 G 25700 G 200430 G da0aa7 H 331000 H 203500 H I 334100 I 20@550 I go0a19 330011 J K L B37200 42300 45400 J K L d00620 00670 00740 J K L ped@14 M 250500 M 201010 M gadA1Ss N 53600 N 001060 N a00016 0 P 0 356700 62000 365100 0 P 0 31130 AR1200 A01250 9] P Q do00017 P00a20 200021 R S T 70200 373300 376400 R S T 231320 201370 gnl1440 R S T d0a022 @30023 Ao0a24 U 191500 U 1510 U AOPB25 A00@312 200013 MACRO-11 CHARACTER SETS Single Char. or First Char. Second Character Third Character A4 W 104600 107700 \'4 W PB1560 PRA1630 A% W Ao00A26 200@27 X 113000 X AOAB30 116100 X Y 31700 Y 31750 Y goee31 Unused 132500 Unused 002210 Unused @00035 @ 135600 ) PR2260 4} d00@36 1 2 3 4 5 140700 144000 147100 152200 155304 1 2 3 4 5 @02330 202400 @A2450 g@2520 2a2570 1 2 3 4 5 pag@37 P00B40 000041 do0042 gaeR43 7 8 163500 166600 7 8 302710 Aa2760 7 8 Aaa@a45 gogg46 9 171700 9 203030 9 aa0a47 y/ S . 6 121200 124300 127400 160400 VA S . 6 gA2020 0a2070 @A214¢0 ANn2640 Z S . 6 200032 A00@33 d00034 pooR44 e y APPENDIX MACRO-11 B.1 SPECIAL ASSEMBLY LANGUAGE B AND ASSEMBLER CHARACTERS Character Function : Label terminator Direct assignment operator = % Register tab space # Immediate ( Initial Terminal (comma) Operand Comment | % 2= 2N YV A e | field indicator separator indicator addition in the n is an R is a E is an ER is is either in the Logical OR operator Double ASCII character indicator Single ASCII character indicator or concatenation indicator Assembly location counter Initial argument indicator Terminal argument indicator Universal unary operator or indicator Macro call numeric argument Source line terminator | tab SUMMARY OF ADDRESS used indicator register field indicator indicator Logical AND operator vertical Symbols register terminator terminator operator or auto increment indicator Arithmetic subtraction operator or auto decrement indicator Arithmetic multiplication operator Arithmetic division operator (apostrophe) B.2 field field expression Arithmetic + \ indicator Deferred addressing ) : term Item terminator or Item terminator or Q@ , DIRECTIVES MODE argument indicator SYNTAX table: integer, register @ to 7, representing a register number expression expression a register expression or range @ to 7. B-1 an expression whose value MACRO-11 ASSEMBLY Address LANGUAGE AND ASSEMBLER DIRECTIVES Address Mode Mode Format Name Number R Register @n @R or Register (ER) deferred 1n (ER)+ Autoincrement Meaning Register operand, Register dress 2n R of R contains the operand. The contents specified incremented as @ (ER) + Autoincrement 3n Deferred the The Autodecrement 4n Autodecrement Deferred 5n Index Index the operand. (ER) ©pointer to the operand; 1is (ER) the the incremented The contents of the register specified as (ER) are decremented before being used the The address of contents of the the operand. register specified as (ER) are decremented before being used as the pointer to the address 6n Deferred of use. the The operand. expression contents @E (ER) the ad- registér specified as register of E (ER) address the of as @- (ER) the of the register as (ER) are after being used contains address after - (ER) contains 7n of E, plus the the register specified as (ER), form address of the operand. the The the expression contents of E, the plus register specified as (ER), vyield a pointer to the address of the operand. $E Immediate 27 The expression operand Q#E Absolute 37 The expression address E Relative 67 : The follows QE Relative Deferred 77 of the address relative of to is the E is the the the operand E, instruction, instruction. pointed to by relative to the operand. the The address of follows E itself,. the operand is E whose address, the instruction, instruction. MACRO-11 B.3 ASSEMBLER ASSEMBLY LANGUAGE AND ASSEMBLER DIRECTIVES DIRECTIVES The MACRO-11 assembler directives are summarized in the following ‘table. For a detailed description of each directive, the table contains references to the appropriate sections in the body of the manual. Section Form Reference ' Operation 65.3.3 Followed 7.3.7 a single quote (apostrophe) generates a word which contains the 7-bit ASCII representation of the character in the low-order byte and zero in by one ASCII the high-order character byte. This a the character is also used concatenation indicator in expansion of macro arguments. " = 6.3.3 | Followed by two ASCII as characters a double quote generates a word which contains the 7-bit ASCII representation of the two characters. The first character is stored in the low-order byte; the second character high-order byte. “Bn “Cexpr | is temporary radix stored 1in 6.4.1.2 A 6.4.2.2 A temporary numeric control, the wvalue n binary number. the control, to expression's be causes treated value to the be as a causes ones- complemented. “Dn “Fn | | “0On 6.4.1.2 A temporary radix 6.4.2.2 A temporary numeric control, causes 6.4.1.2 A temporary radix causes the wvalue n to decimal number. the wvalue sixteen-bit control, be causes treated the wvalue n octal number. to control, be treated Converts ccc to Radix-50 form. .ASCII /string/ 6.3.4 Generates the a the character delimiting character block ASCII string of an byte. data equivalent (enclosed characters), per as | 6.3.7 containing a n to be treated as a floating-point number. “"Rccce | as of 1in one MACRO-11 ASSEMBLY LANGUAGE AND ASSEMBLER DIRECTIVES Section Form Reference .ASCIZ /string/ 6.3.5 Operation Generates a block of data containing the ASCII equivalent of the character string (enclosed in delimiting characters), one character per byte, byte terminating with a zero the specified string. .ASECT .BLKB exp Begins or program section. Reserves whose by .BLKW exp resumes a block length the in of a absolute storage bytes specified Reserves the is space determined expression. block of storage space whose length in words is determined by the specified expression. .BYTE expl,exp2,.. Generates each byte successive bytes of data; contains the value of the corresponding .CROSS syml,sym2,... specified Enables the cross-reference listing for the specified symbol list. If a symbol 1list 1is not specified, this directive reenables the cross-reference symbols .CSECT [name] expression. in the listing for Begins or resumes named or unnhamed relocatable program section. This directive is provided compatibility with for other PDP-11 assemblers, .DSABL arg Disables the . ENABL .END arg [exp] Indicates to the specified logical program. address [name] function Enables (invokes) the specified by the argument. argument . ENDM the argument. source . ENDC all program. specifies where Indicates the block. the end of end block, or macro of transfer execution if identical to name the a is conditional the current repeat definition. name, macro the the indefinite optional the of optional | assembly repeat block, function The program begin. Indicates end by definition. wused, must specified The be 1in e MACRO-11 ASSEMBLY LANGUAGE AND ASSEMBLER DIRECTIVES Section Reference Form Operation Indicates « ENDR repeat the end block. of the This current directive provided other . ERROR exp;text A for compatibility PDP-11 assemblers. user-invoked causes or error output the to the command is with directive, listing output file device containing the optional expression and the statement containing the directive. . EVEN Ensures that counter contains adding .FLT2 argl,arg2,... 1 if the it is floating-point argl,arg2,... even 1location address .4.2.1 by odd. Generates successive floating-point equivalents numbers arguments. .FLT4 current an 2-word for the specified as | Generates successive floating-point floating-point 4-word equivalents numbers for the specified as specified as arguments. .GLOBL syml,sym2,... Defines the symbol(s) global symbol(s). . IDENT /string/ Provides a means of labeling the object module with the program version number. The version number is the Radix-5# string appearing between the paired delimiting characters. .IF .IFF cond,arqgl Begins a conditional assembly block of source code which is included in the assembly only 1if the stated condition 1is met with respect to the argument(s) specified. 6.9.2 Appears only within assembly block, a conditional indicating the beginning of a section of code to be assembled if the condition upon entering the block tests false. .IFT Appears only assembly beginning be assembled entering within a conditional block, indicating of a section of code the if the block condition tests true. the to upon MACRO-11 ASSEMBLY LANGUAGE AND ASSEMBLER DIRECTIVES Section Form Reference .IFTF Operation Appears only assembly beginning be .IIF cond,argqg, of assembled specified. .IRP string 6.10.2 Inserts a within the being used. the symbol with real angle .IRPC sym,<string> conditional condition argument statement is the <condition the repeat beginning of an block in which specified 1is value Adds replaced successive elements of the argument list enclosed within brackets. Indicates the beginning indefinite repeat block the specified symbol takes 6.10.1 to specified source file source file currently of successive optionally brackets, .LIBRARY string the the the true. Indicates indefinite sym, argl,arg2,...> conditional 1l-line where for The only 1f assembled tests a indicating a section of code unconditionally. Acts as a assembly block is tested statement .INCLUDE within block, a enclosed specified macro an characters, within file library of in which on the angle name list to that a is searched. Reserves two words into .LIMIT Task high .LIST [arg] Builder addresses Without an argument, directive increments level count argument, according specified. .MACRO name,arqgl, arg2,... by this alter the formats the LLIST the 1listing With an 1. directive does not listing level count, but the assembly listing to the argument Indicates the definition having name which‘ the 1inserts the low and of the task image. and start the of the a macro specified following dummy arguments. .MCALL argl,arg2,... Specifies the user system or required in current user not defined symbolic the the of the definitions assembly program, within names macro but of the which are program. MACRO-11 ASSEMBLY LANGUAGE AND ASSEMBLER DIRECTIVES Section Form Reference -.MDELETE namel,name2,... 7.9 Operation Deletes the definitions of the specified macro(s), freeing virtual memory. <MEXIT 7.1.3 Causes an macro repeat +.NARG symbol 7.4.1 exit from expansion the or block. Appearing only within definition, equates the symbol to the number of in current indefinite the macro call a macro specified arguments currently being expanded. «NCHR symbol,<string> .NLIST [arg] 7.4.2 6.1.1 Appearing anywhere a source program, equates the specified symbol to number in Without argument, an that Disables by of the of string. decrements 1. directive portion by specified count this specified H.2.2 the 1level argument, syml,sym2,... the characters listing .NOCROSS 1in the With an suppresses the listing argument. the cross-reference listing for the listed symbols. 1If a symbol 1list 1is not specified, this directive disables the cross-reference symbols .NTYPE symbol,aexp 7.4.3 in the Appearing 1listing for all program. only within a macro definition, equates the symbol to the 6-bit addressing mode of the specified address expression. . 0ODD 6.5.2 Ensures that counter . PACKED f.3.8 . PAGE 6.1.5 even. 1 if Causes a decimal digits digits or per 7.5 it is odd number 1less byte. to location address of be by 31(19) packed 2 Causes the assembly listing to skip the top increment exp;text current an adding to .PRINT the contains of the the page User-invoked causes next page message output to and to count. the directive; listing file or the command output device containing the optional expression and the statement containing directive. .PSECT attn name,attl,... 6.7.1 Begins or unnamed program specified B-7 resumes section attributes, a the named or having the MACRO-11 ASSEMBLY LANGUAGE AND ASSEMBLER DIRECTIVES Section Reference Form .RADIX n 6.4.1.1 Operation Alters n, .RADS@ .REM /string/ comment-character 603’6 the where exp is delimiting Allows block a of source program precede the Begins or radix programmer to comments into a repeat or having lines block; up L.ENDR with causes to number to of a previously . SAVEd section from the top of the section context stack leaving the current program section Stores the current program the top of the program section section context stack current program section effect. is of collected contents at expl,exp2,.. the effect. .SBTTL 1into the Assigns the a beginning first 1in module six the name directive table the Radix-50 string and of of as causes an the string to appear on the assembly listing. each Specifies defined module or are either in another globally in the .WORD each listing. object syml ,sym2,... in assembly characters .WEAK leaving Causes the specified string to be printed as part of the assembly listing page header. The string component string be times exp. on .TITLE the program program in string to the the next directive the Retrieves insert a MACRO-11 (;). code as a without comment of specified .SBTTL to 10. characters. character section .ENDM . SAVE program 8, within repeated - RESTORE 2, Generates a block of data containing the Radix-5@ equivalent of the <character string enclosed comment .REPT current n symbols that externally are defined current of module. Generates successive each contains word page corresponding words the specified of value data; of the expression. APPENDIX PERMANENT The mnemonics assembler The PST for the directives contains the SYMBOL PDP-11 are in the that a detailed description of the op Handbook. C.1 OP (PST) (op) codes Permanent are MACRO-11. For TABLE operation stored symbols C and Symbol automatically codes, see the MACRO-11 Table PDP-11 Octal Mnemonic Value Operation ADC @d05500 Add Carry ADCB 195500 Add Carry (Byte) ADD 260000 Add Source To ASH B372000 Shift Arithmetically ASHC 73000 Arithmetic Shift Combined ASL A6300 Arithmetic ASLB ASR 106300 Aa6200 Arithmetic Arithmetic Shift Shift Left Left Shift Right ASRB 106200 Arithmetic BCC 103000 Branch If Carry BCS Is Clear 103400 Branch If Carry Is BEQ Set pR1400 Branch If Equal BGE 2A2000 Branch If Greater Than BGT 03000 Branch If Greater BHI Than 1010600 Branch If Higher BHIS BIC 103000 240000 Branch If Bit Clear Higher BICB 140000 Bit Clear (Byte) BIS 50000 BISB 150000 Bit Bit Set Set BIT 30000 Bit Test Test Destination Shift (Byte) Right Or (Byte) Or Equal Same (Byte) BITB 130000 Bit BLE AA3400 Branch If (Byte) Less BLO 103400 Branch If Lower Than Or Same BLOS 101400 Branch If Lower Or BLT BA2400 Branch If Less Than BMI 106400 Branch If Minus BNE 0B1000 Branch BPL If Not 100000 Branch If Plus BPT 200003 Breakpoint BR P03400 Branch Equal Trap Unconditional Equal by Processor CODES Instruction (PST). recognized PERMANENT Instruction Mnemonic SYMBOL TABLE Octal Value (PST) o Operation BVC 102000 Branch If Overflow Is Clear BVS 102400 Branch If Overflow Is Set CALL A34700 Jump CALLR goR100 Jump To Subroutine (JMP addr) (JSR CCC Aa@257 Clear All CLC agag241 Clear C Condition Code Bit CLN deB250 Clear N Condition Bit CLR A05000 Clear Destination CLRB 105000 Clear Destination CLV 00pG242 Clear V Condition Code Bit CLZ Agp244 Clear CMP 320000 Compare CMPB 120000 Compare Z Condition PC,XxXX) Condition Source Codes Code (Byte) Code Bit To Destination Source Destination To (Byte) COM @p5100 Complement Destination COMB 105100 Complement Destination DEC A05300 Decrement Destination DECB 105300 Decrement Destination DIV 371000 Divide (Byte) (Byte) EMT 104000 Emulator Trap FADD @75000 Floating Add FDIV A75030 Floating Divide FMUL @d75020 Floating Multiply FSUB @75010 Floating Subtract HALT P0003a Halt INC Aa5200 Increment Destination INCB 105200 Increment Destination (Byte) p— I0T PRoea4 Input/Output JMP ARB10a Jump JSR MARK A04000 AR6400% Jump Mark MEDG6X A76600 PDP-11/6M Maintenance MED74C A76601 PDP-11/74 CIS MFPI A36500 Move Previous To Trap Subroutine From Maintenance Instruction MFPS 106700 . Move from (Ls1-11, o Space PS LSI-11/23, aooaa7 Move From MOV g10009 Move Source To Destination MQVB 110000 Move Source To Destination MTPI G660 Move (Byte) To Processor LSI-11/2) MFPT Previous Instruction to Type Space MTPS 106400 Move PS MUL 370000 Multiply NEG gas5400 Negate Destination NEGB 105400 Negate Destination NOP Ag@a240 No (Ls1-11, LSI-11/23, LSI-11/2) (Byte) Operation RESET AAABASsS Reset RETURN pan207 ROL gR6100 Return Rotate ROLB 176100 ROR 06000 RORB 106000 External Bus From Left Subroutine Rotate Left (Byte) Rotate Right Rotate Right C-2 (Byte) (RTS PC) PERMANENT Instruction Octal Mnemonic Value RTI P00 SYMBOL TABLE (PST) Operation 2 Return From (Permits Interrupt a trace trap) RTS do@200 Return From Subroutine RTT go0006 Return From (inhibits SBC aa5600 105600 Subtract Carry Subtract Carry aaa277 Set SEC SEN SEV SEZ SOB SUB gag261 geR270 gAd262 pP0264 @77000 160000 Set C Condition Code Bit Set N Condition Code Bit Set V Condition Code Bit Set Z Condition Code Bit Subtract One And Branch Subtract Source From SWAB PAG300 Swap SXT pa6700 Sign Extend TRAP 104400 Trap TST TSTB TSTSET WAIT WRTLCK AG5700 105700 AQ7200 ARRaa1 go7300 XFC XOR 76700 B74000 Test Destination Test Destination (Byte) Test Destination And Set Low Bit Wait For Interrupt Read/Lock Destination. Write/Unlock R@ Into Destination Extended Function Code Exclusive OR SBCB SCC All Interrupt trace trap) (Byte) Condition Code Bits Destination COMMERCIAL INSTRUCTION Every operation listed SET in (CIS) OP Bytes CODES the CIS table has two instruction mnemonics. The suffix "I", attached to every second mnemonic, indicates that the addresses are inline. The inline instructions require two arguments; the other instructions (excepting L2DN and L3DN) require no arguments. Instruction Octal Mnemonic Value ADDN 376050 Add Numeric ADDNI 276150 Add Numeric ADDP ADDPI ASHN ASHNI 76370 76170 376356 @76156 Add Packed Add Packed Arithmetic Shift Numeric Arithmetic Shift Numeric ASHP B76076 Arithmetic Shift Packed ASHPI @76176 Arithmetic CMPC CMPCI CMPN CMPNI A76044 #76144 376052 376152 Compare Compare Compare Compare Shift Packed Character String Character String Numeric Numeric CMPP A76072 Compare Packed CMPPI 376172 Compare Packed CVTLN 76057 Convert Long To Numeric CVTLNI 76157 Convert Long To Numeric CVTLP B76077 Convert Long To Packed Operation PERMANENT * SYMBOL TABLE (PST) Instruction Octal Mnemonic Value CVTLPI 76177 Convert Long CVTNP A76855 Convert Numeric CVTNPI To Packed @76155 Convert Numeric To Packed Operation To Packed CVTPN A76054 Convert Packed To CVTPNI Numeric 76154 Convert packed DIVP To Numeric @76075 Divide DIVPI @76175 Divide Decimal Decimal LOCC A76040 Locate Character LOCCI 976140 Locate L2DN* L3DN* @7602N Load 2 Character @76@36N Load 3 MATC @76045 Match MATCI 376145 Match Character Move Character Descriptors @ (RN)+ Descriptors @(RN)+ Character MOVC A76030 MOVCI 376130 Move MOVRC B76031 Move Reverse Justified MOVRCI Character 376131 Move Reverse Justified MOVTC Character 76032 Move MOVTCI P76132 Move Translated Translated MULP 76074 Multiply Decimal MULPI 76174 Multiply Decimal SCANC p76042 Scan Character Character SCANCI A76142 Scan Character SKPC p76041 Skip SKPCI 376141 Skip Character Character SPANC 76043 Span Character SPANCI 76143 Span Character SUBN 376051 Subtract Numeric SUBNI 376151 Subtract Numeric SUBP A76071 Subtract Packed SUBPI 376171 Subtract Packed where FLOATING Character Character N=¢0...7 POINT Instruction Mnemonic PROCESSOR OP CODES Octal Value Operation ABSD 170600 Make Absolute Double ABSF 170600 Make Absolute Floating ADDD 172000 Add Double Floating ADDF 172000 Add CFCC 170000 Copy Floating Condition Codes CLRD 1704060 Clear Double CLRF 170400 Clear Floating CMPD 173400 Compare CMPF 173400 Compare DIVD 174400 Divide Double DIVF 174400 Divide Floating LDCDF 177400 Load Double Floating And Double LDCFD 177400 Load And Convert To Convert Floating LDCID 177000 Load And Double From Floating To From Double Convert Integer To PERMANENT Instruction Octal Mnemonic Value LDCIF 177000 SYMBOL TABLE (PST) Operation Load And Convert Integer To Floating LDCLD 177000 LDCLF 177000 Load And Convert Long Integer To Double Load And Convert Long LDD LDEXP 172400 176400 Load Load Double Exponent LDF 172400 Load Floating LDFPS MFPD 170100 106500 Load Move FPPs From MODD 171400 MODF 171400 MTPD MULD 106600 171000 Integer To Floating Program Status Previous Data Space MULF 171000 NEGD 170700 NEGF SETD SETF 170700 170011 170001 SETI 170002 Multiply And Integerize Double Multiply And Integerize Floating Move To Previous Data Space Multiply Double Multiply Floating Negate Double Negate Floating Set Double Mode Set Floating Mode Set Integer Mode SETL SPL STAQ STB? STCDF 170012 300230 170005 170006 176000 Set Long Integer Mode Set Priority Level Diagnostic Floating Point Diagnostic Floating Point Store And Convert From STCDI 175400 Double To Floating Store And Convert From Double To Integer STCDL 175400 STCFD 176000 STCFI 175400 Store And Convert From Floating To Integer STCFL 175400 Store And Convert From Floating To Long Integer STD 174000 Store Double STEXP 175000 Store Exponent STF STFPS 174000 170200 Store Store Floating FPPs Program STST 170300 Store FPPs SUBD SUBF TSTD TSTF 173000 173000 17500 170500 Subtract Double Subtract Floating Test Double Test Floating Store And Convert From Double To Long Integer Store And Convert From Floating To Double Status Status PERMANENT C.2 The MACRO-11 MACRO-11 Appendix SYMBOL TABLE (PST) DIRECTIVES directives Ny that follow are described in greater detail in B. Directive Function .ASCII Translates character string to ASCII +ASCIZ Translates character string to ASCII .ASECT .BLKB Reserves .BYTE specified Generates specified .CROSS Enables symbols; .CSECT Begins word block . END . ENDC - ENDM . ENDR in argument. successive accordance byte data in relocatable program other LFLT2 Causes each .GLOBL . IDENT .IF .IFF . IFT .IFTF .IIF two words of floating-point storage to for of of with for specified for all symbols. (provided for assemblers). Disables specified function. Enables specified function. Defines logical end of source program. Defines end of conditional assembly block. Defines end of macro definition, repeat block, indefinite repeat block. Defines end of current repeat block (provided compatibility with other PDP-11 assemblers). . EVEN .FLT4 wvalue accordance section PDP-11 Outputs diagnostic message to command output device. Word-aligns the current location . ERROR with arguments. cross-reference 1listing enables cross-reference compatibility with .DSABL equivalents; inserts zero byte as last character. Begins absolute program section (provided compatibility with other PDP-11 assemblers). Reserves byte block in accordance with wvalue specified argument. . BLKW . ENABL equivalents. listing file counter. be generated or for or for argument. Causes four words of storage to be generated for each floating-point argument. Declares global attribute for specified symbol(s). Labels object module with specified version number, Begins conditional assembly block. Begins subconditional assembly conditional assembly block test is Begins subconditional assembly conditional assembly block test is block false). block Assembles immediate conditional assembly (if specified condition is satisfied). source file (if (if true). Begins subconditional assembly block conditional assembly block test is true specified program within or (whether false). statement . INCLUDE Inserts . IRP currently being used. Begins indefinite repeat block; replaces specified symbol with specified successive real source file arguments. . IRPC Begins indefinite specified symbol . LIBRARY Adds a that is characters repeat block; with value of replaces successive in specified string. file name to a searched. specified macro library list PERMANENT SYMBOL TABLE Function Directive .LIMIT Reserves two .LIST addresses Controls of task 1listing words of image. 1level assembly listing. definition. +.MCALL (PST) Identifies storage for <count and .MACRO required denotes macro high and low format start of of macro definition(s) for assembly. +MDELETE +MEXIT Deletes the definitions Exit from current macro repeat . NARG - NCHR +NLIST . NOCROSS of the specified macro(s). definition or indefinite block. Equates specified symbol to the number of non-keyword arguments in the macro expansion. Equates specified symbol to the number of characters in the specified character string. Controls 1listing 1level count and suppresses specified portions of the assembly listing. Disables cross-reference 1listing for specified symbols; disables cross-reference listing for all symbols. . 0ODD Equates specified symbols to the of the specified argument. Byte-aligns the current location . PACKED Generates +NTYPE . PAGE Advances packed decimal form to . PSECT Prints Begins .RADIX attributes. Changes current . PRINT .RADS@ . REM specified specified top of data, next addressing mode counter. 2 digits per byte. page. message on command output device. program section having specified program radix to specified radix. Generates data block having Radix-50 equivalents of specified character string. Inserts a block of comments into a MACRO-11 source program without having to precede comments lines .REPT with the comment character (;). Begins repeat block and replicates it according the value of the specified expression. . RESTORE Stores the current program section context on top of the program context . SAVE . SBTTL . TITLE Retrieves the section program section from to the stack. the program section context stack. Prints specified subtitle text as the of the assembly listing page header. top of second Prints specified title text as object module in the first 1line of the assembly listing the 1line name page header. . WEAK .WORD Specifies symbols that are either defined externally in another module or are defined globally in the current module. Generates successive word data in accordance with specified arguments. R T g APPENDIX ERROR An error code is printed as the D MESSAGES first character in a containing an detected during error. This error code identifies the the processing of the line. Example: 0 010102 26 090236 line condition MOV R1,R2,A The extraneous argument A in the MOV instruction above to be flagged with a Q (syntax) error. Error Code A source error causes the line Meaning Assembly error. Because many different conditions produce this may yield a error message, the directives general assembly error have which been categorized below error to reflect these conditions: CATEGORY 1: ILLEGAL .RADIX -- A specified as value a new ARGUMENT other (see than 2, 8, or 10 1is radix. .LIST/.NLIST -- Other argument SPECIFIED. Table than 6-2) a is 1legally specified defined with the directive. .ENABL/.DSABL -- Other argument (see Table than $6-3) is a legally specified defined with directive, or the attribute arguments previously declared program section. of the a .PSECT -- Other than a legally defined argument (see Table 6-4) is specified with the directive, or the attribute arguments of a previously declared program section change (see Section 6.7.1.1). .IF/.IIF -- Other than a legally defined conditional test (see Table 6-6) or an illegal argument expression value is specified with the directive. .MACRO -- An illegal or in dummy argument list. duplicate symbol found ERROR Error MESSAGES Code Meaning (A A (cont.) . TITLE -- Program name is directive, or first following the directive character, .IRP/.IRPC the -- No dummy not specified in the non-blank character is a non-Radix-50 argument is specified in directive. .NARG/ .NCHAR/ .NTYPE in the directive. IF/.IIF -- No specified in CATEGORY 3: -- No symbol 1is conditional the specified argument is directive. UNMATCHED DELIMITER/ILLEGAL ARGUMENT CONSTRUCTION. .ASCII/.ASCIZ/.RAD50/.IDENT -- Character or argument string delimiters an illegal character an illegal argument is used do as not a construction used in -- Character string delimiters do or an 1illegal <character is used delimiter in the directive. This 4: GENERAL type possible 1. or the ) .NCHAR match, CATEGORY or delimiter, is directive, string match, of ADDRESSING error results not as a ERRORS. from one of several conditions: Permissible (from range -128(10) of to a branch +127(19) instruction words) has been of the exceeded. 2. A statement current makes location ".=expression" 1invalid counter. statement the current location program section (.PSECT) 3. A statement contains an use For example, a attempts to force counter to cross boundaries. 1invalid address expression: In cases where an absolute expression is required, specifying symbol, a relocatable value, or a relocatable in an value (see invalid address address a Section 3.9) expression. global complex results If an undefined symbol is made a default global reference by the .ENABL GBL directive (see Section 6.2.1) during passl, any attempt pass 2 will expression. to redefine result in an the symbol invalid during address ERROR MESSAGES Meaning Error Code A (cont.) In cases where is expression relocatable or a relocatable address a either required, absolute value is permissible, but a global symbol or a statement complex relocatable value in the results in an invalid address expression. For example: .BLKB/ .BLKW/.REPT -- Other than an absolute or an expression which reduces to an value absolute value has been specified with the directive. 4., Multiple expressions are not separated by a comma. to symbol current 5. SAVE -- The is stack is issued. .RESTORE -- The stack .RESTORE directive CATEGORY 5: 1s full when the empty 1is .SAVE when the of two issued. from either A - global assignment statement (symbol==expression or symbol==:expression) contains a forward reference to another 2. the ILLEGAL FORWARD REFERENCE. This type of error results possible conditions: 1. next expression. directive 6. of part as evaluated be the causes condition This symbol, An expression defining current location counter the wvalue contains of a the forward reference. B Bounding error. Instructions or word data are being assembled at an odd address. The location counter is incremented by 1. D Doubly-defined symbol referenced. Reference was made to a symbol which is defined more than once. E End directive not found. When the end-of-file |is reached during source input and the .END directive has not yet been encountered, the point where MACRO-11 dgenerates and 1, pass assembly ends code, error this proceeds with assembly pass 2. Also caused by assembler-stack overflow. In this case MACRO-11 will place a question mark (?) into the 1line at the overflow occurred. ERROR Error MESSAGES Code Meaning Illegal which character are question is then Input detected. Illegal characters non-printable are replaced by a also mark (?) on line is greater length. Currently, during macro only arguments, line to which characters) to a a Opcode of assemblies which Phase from one that The been was first not is out exceeded. label the is depth unidentified six of for the as context., conditional Attempt after 1in evaluated to .MCALL expand a search. A label's definition of value varie s assembly pass to another or a multiple a local block. by the defined symbol has Also, when L(ENABL has program section other effect when block occurred the appears also if to than was Questionable syntax. arguments was not are error. reference a to has register a that entered. an . ERROR Arguments are specified, or An symbol which an in was a in An error directive code missing, too the invalid register been symbol made has to without is instruction error. in a word, 8 significant directive or A use been of made, redefine first directive. Truncation directive, local completed. Register-type attempt occurred within a in a local symbol LSB define assembled. -BYTE a encountered. number level attempt bits than cause error. block REG A (in previously Directive was definition of local symbol scan arguments, 1label. digit nesting has macro many when dummy a radix. error. in is caused longer real value. Permissible P characters condition equivalent label a character characters. was contains program decimal the The 132(1¢) error expansion definition number than 132(10) encountered current listing. this replacing exceed Multiple A the ignored. a issuing or or an standard the .DSABL number or an bits trap generated more than 16 expression generated more during the use of the (EMT or TRAP) instruction. ERROR Error MESSAGES Code Meaning Undefined symbol. encountered expression; a value of result in macro names An undefined symbol was during’ the evaluation of an such an undefined symbol is assigned zero. Other possible conditions which this in error the direct assigment symbol=:expression) forward reference to also list code of include .MCALL unsatisfied arguments and a (symbol=expression or statement which contains a a symbol whose definition contains a forward reference; also, a local symbol may have been referenced that does not exist in the current local symbol block. Instruction not error. compatible family. See The among Section 5.3 instruction all for so members details. of flagged the is PDP-11 APPENDIX SAMPLE Local user requirements CODING must be E STANDARD met in a coding standard, but following this model as closely as possible helps you and DIGITAL by simplifying communication and software maintenance. Remember that this is a sample and may not entirely apply to your system. E.1 LINE FORMAT Source lines are from following format: to eighty characters 1. Label Field - if present, begins in should be coded in uppercase only. 2. Operation field - begins field should be coded in 3. Operand should 4, E.2 one field be - coded begins in in in column uppercase column uppercase 17 1in 1length column 9 (tab only. (tab stop 1. with the This field stop 1). This 2). This field only. Comment field - begins in column 33 (tab stop 4). If the operand field extends beyond column 33 (tab stop 4) leave a space and start the comment. This field should be coded 1in uppercase and lowercase to increase readability. COMMENTS To make the program easier to understand, comments should be used to explain the logic behind the instructions. In general this will consist of a comment per line of code. However, 1if a particularly difficult or obscure section of code is used, precede that section with a longer explanation. Comments that are too the following 1line. long for the comment field Begin the new line with a may be continued on semicolon, space over to the column the comment began in and continue writing. should be written in uppercase and lowercase to increase All comments readability. SAMPLE If a a 1line lengthy containing needed only each only the begin for the characters with a an explanation, characters ;-. The semicolon and ;+ lines a begin and the end between space. For comment with with line it these a delimiters example: invert routine accepts list of random numbers and applies the Kolmogorov Algorithm to alphabetize them, s ws is STANDARD + ‘ws a wWe The wWs W should text containing CODING E.3 NAMING E.3.1 STANDARDS Registers E.3.1.1 General Purpose Registers - Use the RA=%0 ;:REG 0 R1=%1 ;REG 1 R2=%2 ;REG 2 R3=%3 ;:REG 3 R4=%4 :REG 4 R5=%5 ;REG SP=%6 5 ;Stack PC=%7 ; Program default pointer name: (REG counter 6) (REG 7) NOTE . These register the assembler; names must be put in the program. E.3.1.2 Hardware example, PS E.3.1.3 Device the control E.3.2 which or are Status Registers status Processor Testing Registers (Program a - file Use defined symbols 1linked with and the Register) within standard hardware and SWR - Use the hardware register for the RK disk definition. (Switch Register). notation. For is For example, RKCS. Priority altering equated are other to the processor their priority corresponding is done priority using bit the symbols pattern. SAMPLE E.3.3 The CODING STANDARD Symbols¥* following chart diagrams the syntax of the 5 major types pos-1 pos-2 pos-3 pos-4 pos-5 pos-6 letter a-num/ a-num/ a-num/ a-num/ a-num/ null null null null null S/. a-num a-num/ a-num/ a-num/ a-num/ k% % null null null null null letter S/. a-num a-num/ a-num/ a-num/ null null null a-num/ a-num/ null of symbol names: symbol non-global symbol global symbol global offset * k% global bit pattern letter a-num local symbol number * % $ where: a=-num E.3.3.1 Symbol Non-Global is $/. * %k a-num/ null length >=1 >=1 >=3 >=4 >=2 an alphanumeric character. Examples Symbols AlB ZXCJd1 INSRT Global Address Symbols $JIM . VECTR SSEC Global Absolute Offset Symbols ASJIM ASXT A.ENT * GSymbols always use ** Number *** The are the term is use software. that in of the $ or branch targets "symbol". range . for are also called labels, reserved for but we will @<number<65535, global names is DEC-supplied SAMPLE Global Bit Pattern CODING STANDARD Symbols Al$20 B3.6 JI.M Local Symbols 37% 27158 65 E.3.3.2 for Local Symbols positional - Target reference will symbols use local for branches symbols of that the exist solely form <num>S: Local down symbols the page are formatted such and from to E.3.3.3 Global reason, to the A page Symbols those - cases Use where that the numbers of global reference symbols to the code. program never contains a proceed sequentially page. .GLOBL statement is code without restricted, within occurs external showing cause. to E.3.3.4 Macro Names - In a macro name the last two characters (last character possibly being null) have special significance; the next to last character is a $, the last character specifies the mode of the macro. For example, in the three the 1in-line form has p-section a <C>. Thus macro forms no suffix, the Queue in-line, stack, and p-section, the stack has an <S> suffix, and the I/0 macro can be written as any of QIOS QIOSS QIOSC depending on the form required. E.3.3.5 General Symbols carriage return (CR) are needed. These are - Make frequently and line feed (LF) not used reserved bit letters. patterns conventional symbols such as as they SAMPLE E.4 STANDARD PROGRAM MODULES There are memory no 1. creating 2. writing a program size. computer is However, finite them for a single areas be are different read-only read-write explanatory The each or than data data. Both with areas. read-write; program since the programs the Code read-only areas, as wvirtual compact memory is as allocation read-only data should and data, code comments, Module keep function them in accordance guidelines in Appendix F. can E.4.1 on of by: Code from limits capacity possible Put CODING be but data segregated should have reference the Preface module in a separate file. For easy file name should be similar to the name of the module. The file type is of the form 'NNN' where 'NNN' is the edit or the version number (see Section E.8). The availability of File Control Services and File Control E.4.2 Primitives The Below is MACRO-11 The a list module The of is first information Section as six appear items statement .TITLE module Several maintenance. included in on the same page and has a .SBTTL inserts this .IDENT module appended specifies more than statements number to it statement copyright the one name of routine, the module. .SBTTL in the table of be uppercase. that specifies the contents version the This <correctly, and a disclaimer, copyright, insures even on even that a the a function, for by comment, copyright terminal that If directive number followed though the statements the name, general module. The .SBTTL E.8). statement, Note uppercase. the that Section have specifying giving of information feed. all not “ (see presented do by any . ENABL/.DSABL or are relevant to the assembly of matching .LIST statement. The comment that contains version example followed level. statement the follows: that by a reference. A is used. and 6. that formatted edit a An number headings. A are 5. version E.4.3). .NLIST statement, -.NLIST/.LIST options this module, followed .NLIST 4. simplify A module 3. the (see explicit 2. greatly Module information 1. will quick of the a form should will only be has SAMPLE CODING The name of the facility, The name of the author. The date of module A one or two line A description one per line, of in STANDARD that the is a part of. creation. abstract of the all external alphabetical function(s) references order. A chronological edit trail of that includes the following: Edit module of the by the made modifications to module. the module, module number Editor's Edit identification date Description of the modification made NOTE Items same 13. Any references 6 through 12 should appear on the page. to external files, wusing the LIBRARY and .INCLUDE directives. 14. 15. .MCALL's A list module. to of any externally defined macros. the alphabetical 16. All definitions of These definitions 1local all equated should symbols appear one per used in line and the in order. macro definitions, preferably 1in alphabetical order. 17. 211 e e local data. The comments in this section should include: Description of each element (type, size, and so forth) Organization (functional, alphabetical, adjacent, and so forth) e Adjacency 18. A form feed, routine that 19. A routine Routine requirements followed follows. header, (if by an giving the any) .SBTTL statement following describing information: name Description Inputs Calling sequence Outputs Side effects, register usage, and so forth NOTE Items 18 and 19 are repeated routine within the module. for every the SAMPLE E.4.3 Module CODING STANDARD Example .NLIST . ENABL GBL .LIST MEB .LIST .TITLE MACINI - Once-only code for the MACRO-11 assembler .SBTTL «. SBTTL MACINI - Once-only code for the MACRO-11 assembler .SBTTL .IDENT /Y05.01/ «.SBTTL .IDENT /Y05.01/ ;************************************************************************** ; % COPYRIGHT ;% ;% BY DIGITAL (c) 1982, 1983 EQUIPMENT CORPORATION, ALL RIGHTS RESERVED. * MAYNARD, MASS. * * « % * ;* ;* THIS ONLY SOFTWARE IS FURNISHED 1IN ACCORDANCE WITH ;* TINCLUSION ;* ;* ;¥ COPIES THEREOF OTHER PERSON. TRANSFERRED. e OF UNDER THE A LICENSE TERMS OF AND MAY BE USED AND COPIED SUCH LICENSE AND WITH THE THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR ANY OTHER MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY NO TITLE TO AND OWNERSHIP OF THE SOFTWARE IS HEREBY * ;* THE INFORMATION IN ;* AND SHOULD BE ;* CORPORATION. NOT * * * * * * THIS SOFTWARE CONSTRUED IS AS A SUBJECT TO CHANGE COMMITMENT BY WITHOUT NOTICE DIGITAL EQUIPMENT * * * ?* * ;* ;* DIGITAL ASSUMES NO RESPONSIBILITY FOR THE GSOFTWARE ON EQUIPMENT THAT IS NOT SUPPLIED USE OR RELIABILITY BY DIGITAL. OF ITS . * * * * ;************************************************************************** <FF> ;++ ; Facility: MACRO-11 The PDP-11 macro assembler for RT/RSX/VMS and RSTS/E ; ; Author: Joe Worrall ; ; Created: 21-Aug-82 ; ; Abstract: ; H ; ; ; H Externals SLIBID SPOSID SSTABF MACINI contains code only executed once per task invocation. Description File-ID of the system library account File-ID of the P/0S library account Workfile statistics buffer ; Edit Who Date Description : - ———— TN WS RN e R ; ; Pa1 B2 Jrw Jrw 25-Aug-82 #5-Sep-82 ; 3a3 Jrw 10-Nov-82 | N SR A D S O S RIS (LB:[1,1]) (LB:[1,5]) of S RO S modification AINE R NS N . WA SR SN RN O W . Handle P/0S .PARSE module. Allow recursive FINITS's. Setup statistics buffer. ;—u—- <FF> ; External . LIBRARY . INCLUDE file references /MACLIB/ /MACPRE/ ;Add MACLIB.MLB to macro library ;Include MACPRE.MAC in assembly list CODING STANDARD ma SAMPLE library ".MCALL's" for this module Wy WE External .MCALL Equated symbols g ws ue FINITS Equated symbols ... Local macros G e WS ... LOCal macros Local data ... Local data Wy WE R .. ... ... <FF> Handle only code for MACRO-11 assembler Wy S$INIT This once routine is in any one here because: a collection of all run of the MACRO-11 the code, only executed task. 1It's collected WE Wwg once + SINIT - W ug ‘wy .SBTTL WE ME o) o It's logical It keeps the INPUTS: ‘n/a CALL: CALL assembler SMALL. . SINIT OUTPUTS: wo My TMD e We TMS WME WE the to keep it in one place code out of the root, keeping WE point DIV and to MUL the statistics, and FCS buffers system contains EIS support, routine hardware vectors are setup to instructions. EFFECTS: R@ - R5 Destroyed! e e ME the W ey we Record management, are setup. If the ... E.4.4 Begin module code ... Modularity No other characteristic has more impact on the wultimate success of a system than does modularity. Adherence to a and return conventions helps achieve this modularity. engineering set of call SAMPLE E.4.4.1 Calling Conventions Transfer of Control CODING STANDARD (Inter-Module/Intra-Module) Macros exist for call and return. The actual transfer is via a JSR PC instruction. For register save routines, a JSR RN,SAVE 1is permitted. The CALL macro CALL is: subr-name The RETURN macro is: RETURN Register Conventions On entry, a subroutine minimally saves all registers it intends to alter except result registers. On exit it restores these registers. (The preservation of the register state 1is assumed across calls.) Argument Passing Any registers may be used, but their use should follow a coherent pattern. For example, if passing three arguments, use R@, Rl and R2 rather than R@, R2, R5. Saving and restoring occurs in one place. E.4.4.2 Exiting - All subroutine exits occur through a single RETURN macro. E.4.4.3 Success/Failure Indication - The C bit is used to return the success/failure 1indicator, where success equals @, and failure equals 1. The argument registers can be used to return values or additional success/failure data. E.4.4.4 Module Checking Routines - Modules are responsible for verifying the wvalidity of arguments passed to them. The design of a module's calling sequence should aim at minimizing the validity checks by minimizing invalid combinations. Programmers may add test code to perform additional checks during checkout. All code should aim at discovering an error as close (in terms of instruction executions) to its occurrence as possible. SAMPLE E.5 CODE E.5.1 even at and jump these to be For STANDARD FORMAT Program Programs CODING are the Flow organized cost of an on the extra instructions should instructions to stand traced more easily. listing branch be so or that jump. followed out in the by they All a source flow blank line. code, example: PROCESS V BBB appears on the listing TST BNE BBB * . » » - - oW ow BR CMN BBB: . » 0 » * * » 8 CMN: L I I L AAA: . 5 " » » & » » . ® » » . & 9 » as: RS AAA COMMON down the unconditional page, branch This causes allowing the code SAMPLE rather TST | BNE BBB » . O » », ® » » * *« » » » * % & & % & LI " CMN: a * B o . BBB: - » B " » " 5 ® & LI B . » » . 2 & @ 8 » @ . a8 » . B & » L I .« B » L I L » * 8 exit flow 5 & @ * & & » .- % & » I CMN Common common . L BR the & N . * A Exits appears on pRl: * % ® » . ®« & » & . 5 " » . ® » » » B * » the BR " » . &% & @ " 5 & @ * * & » " * ® 5 » LI " * » S EXIT * & ® @ . % 9 » * " > ., ¥ % ® * & & . . " » & BR de: listing EXIT BR PRB: as the last code > EXIT sequence chart: appears PRZ: STANDARD than: AAA: E.5.2 CODING EXIT " * ® » . 8 » @ . & % @ ®« & » - " » 9 . % 5 & as: IA I on the listing. Thus SAMPLE CODING STANDARD EXIT: and not as: PR].: . o & LI T EXIT: LI " . 5w PR2: . s 8 “- s 0w BR EXIT LI LI T BR EXIT LN I . 88w BR EXIT PR3: PRd: E.5.3 Code Y Code that semicolon is with Interrupts executed (;;;) o, with comment Inhibited interrupts delimiter. . .ERTZ: BIT #PR7,PS #PR7,2(SP) BEQ 108 E.5.4 RSX-11M ;;; ;3 iInhibit C interrupts c s e s oo A ceee ceove c e 073 Code in System executive a three O m m ::; ceee by returning subroutines, Pii c e by system M ceen flagged ; by iii RTT is example: ;Enable BIS 10S$: inhibited, For e W n t Pii S State subroutines executed 1in system state delimiter. For example: is and other flagged ; by Switch ©privileged a to i ’ and exit. two code semicolon system state, (;;) ... that is comment B SAMPLE CALL CODING SSWSTK,EXIT ; ;; EXIT: E.6 HH o e i RETURN ;; Go cee ; User The use to of instructions instruction. MOV @PC ,REGISTER BIC SRC,DST the be bit a clear very a problem, will the The it use to to state user state of not 1In the transfer using case as a is a if D bank instead control to of MOV may seem what about compound space is the enabled reference. a JMP another instruction location. For #ALPHA,PC transfers control to execute use of MOV to (2.3 instead someone take the but To I/D of This word trick? properly @PC 1literals literal. save this instruction program a to execute this MOV way as example: up (EXIT) code index words example: instruction program 11/45. or For "neat" maintaining on back Instructions previous uses context switching in system state USAGE Forbidden 1‘ Inhibit Return .o INSTRUCTION El6.1 STANDARD else's place. of it if of ALPHA. for JMP program What the execution a more general from PC should location microseconds a one makes and tell would program (a Besides MOV vs. nearly where for to get move trace longer JMP) impossible transfers like issue, other operations be discouraged. taking 1.2 to of the pick control a Jjump trace of is unheard of)? As and SUB such as ADD The seemingly "neat" use of all single word instructions where one double-word instruction could be used and would execute faster and would not consume additional memory. Consider the following instruction sequence: The CMP -(R1) ,-(R1) CMP -(R1) ,-(R1) intent register of Rl this (not accomplished 1in instruction (9.4 in memory space. Self-relative be approximately vs. 3.8 1/3 is to subtract codes). This the microseconds) at time no wvia 8 from can be a additional SUB cost address arithmetic (.+n) is absolutely 1in branch instructions; its use in other contexts avoided if at all possible and practical. forbidden must instruction sequence to set <condition SAMPLE E.6.2 Conditional When wusing the imperative unsigned A the conditional correct choice branch be made instructions, between the signed it is and the branches. SIGNED UNSIGNED BGE BHIS BLT BLO BGT BHI BLE BLOS common pitfall comparing two have STANDARD Branches PDP-11 that CODING to use signed branch addresses. until of them goes one the BGT) two when addresses 16K across program. PROGRAM Source 1is, example, works from size E.7 that (for This the the signs; a (BCS) (100000 (8)) bound. This type of coding error usually results re-linking the program at different addresses and/or changing the of opposite is memory (BCC) SOURCE creation FILES and maintenance is done in base levels. A base level is the point at which the program source files have been frozen. From the freeze point to the next base level, corrections are not made directly to the base 1level itself, rather a file of corrections is accumulated source for file each 1is file in desired, the the base level. Whenever correction file is proceeds until an applied updated to the %fi% fileThe accumulation point has has been applied of files E.8 VERSION PDP-11 PDP-11 files, the are Version complete PDP-11 milestone version started NUMBER or Number of all and released, is are the Standard Development number identification for be Version improved Identifier <version> where: as breaking point are and level. applies effort. need to It is pre-released, in Future all which that modules, are used and only written to parameter as part provide in-house six software. characters 1implementations of of unique the of Macro provide for at 1least nine is expected that this standard arises. Format: <edit> <version> base libraries 1limited used. the logical implementation accumulated corrections to create a new base level new Assembler, linker, and librarian should characters, and possibly twelve. It will a significant STANDARD programs, Software identification The (a reached). At this time all to the ©previous base 1level correction The corrections occurred base <patch> consists of represent the two decimal release The version number starts incremented to reflect the changes in the program. E-14 digits number of which a program. at @@ number and is of major SAMPLE These CODING <edit> consists of two decimal digits which represent the number of alterations made to the source program. The edit number begins at @1 (is null if there are no edits) and is incremented with each alteration. <patch> is a the fields <patch> letter between B and Z which represents number of alterations made to the binary form of the program. The patch number begins at B (is null if there are no patches) and changes alphabetically with each patch. are and interrelated. <edit> must be When reset to <edit> is incremented, then <patch> the various bugs have been fixed. E.8.1 The STANDARD Displaying visible the Version output of the <version> nulls. will be It is re-set 1is changed, intended to then that when null, because Identifier version identifier should appear as: Program Name where <key-letter> the <version> following Key Letters X in-house Y field A released 'X'" corresponds and 'V' to The dot <edit> as part <edit> have test, or <patch>, been experimental roughly to company . identified: version pre-release, or in-house release version frozen version individual support, 'Y' to group support, support. (.) which separates <version> from <edit> is not used if both and <patch> are null. When a version identifier is displayed of program identification, then the format 1is: Program Name <space><key-letter><version> . <edit><patch> Examples: PIP V@a5.00 LINK MACRO E.8.2 All In V@8.40d V05.00 Use of the Version Number in the Program sources must contain the version number in an L.IDENT directive. programs (or libraries) which consist of more than one module, each module must or library have 1is a version number. The version necessarily related to the not constituent modules; it the first version of a SIN routine, say V@5.01. number version is perfectly reasonable, new FORTRAN library, V@@, E-15 of the program numbers of the for example, that contain an existing SAMPLE Parameter files are .IDENT directive. parameter files also which consist example, the FORTRAN ;OTS the precede Entities first position. identification., required Because must CODING of a to STANDARD contain assembler the the records version the number last in .IDENT program. collection Library) An identification For example: have of an module modules or programs identification exists solely module to an seen, (for in the provide identification .TITLE FTNLIB .IDENT /V0@2.00/ . END is an identification module. . APPENDIX ALLOCATING This appendix problem Users of is intended for F VIRTUAL MEMORY the MACRO-11 user who wants to avoid the of thrashing, by optimizing the allocation of virtual memory. smaller systems should become thoroughly familiar with the conventions discussed herein. This appendix discusses the following topics: The l. General 2. Macro 3. Operational user is hints and space-saving definitions assumed and guidelines expansions techniques. to have pursued as advised in Appendix E. code that are small, distinct a policy of modular which presents many advantages, one can usually avoid insufficient dynamic memory during assembly. F.1 GENERAL HINTS AND Work-file memory is which 1is allocated storage are In SPACE-SAVING entry to sizes l. User-defined 2. Local 3. Program 4. Macro names 5. Macro text Af. Source - - files - nine The Expression 2. Object code tables each of pageable and their five words. words. six words. five - - of follows: words. words. six scratch words. pad tables are used process, l. problem GUIDELINES assembler). as three sections - the are symbols symbols addition, several as follows: the shared by a number of MACRO-11's tables, space on demand (64K words of dynamically available corresponding programming, Modular programming results in bodies of and highly functional. Using such code, analysis - generation five - words. five words. during the assembly ALLOCATING The 3. Macro 4. .MCALL above argument processing argument information storage VIRTUAL - processing can requirements serve and three words. five words. - as a for MEMORY guide for determining requirements, For example, the encouraged, use since of local their less dynamic storage symbols. The wusage symbols internal whenever that local required symbols of 1local symbol directives see extending the scope LSB MACRO-11 for can blocks Sections to requires regular often be and such 1is highly 25 percent the .ENABL user-defined maximized by through 3.5 dynamic reduce possible representation than of LSB/.DSABL estimating ways 6.2.1). Since MACRO-11 does not support a purge function, once a symbol is defined, it permanently occupies its dynamic memory allocation. Numerous instances occur during conditional assemblies and repeat loops when a temporarily assigned symbol is used as a count or offset indicator. TIf possible, the symbols so used should be re-used. In keeping with the same principle, special treatment should be given to the definition of commonly used symbols. Instead of simply appending a prefix file which defines all possibly wused symbols for each assembly, users are encouraged to group symbols into logical classes. Each class can then become a shortened prefix file or a macro in a library (see Section F.2 below). 1In either case, selective definition defined An of (but example standard several symbolic of this macros and DRERRS - used to is achieved, resulting in fewer symbols. idea is The RSX symbols. groupings assignments unreferenced) seen system define in the definition of IAS/RSX-11M macro library, for example, supplies distinct classes associated macro names as Directive return status are of symbols. These follows: codes FILIOS - File-related I/O function codes F.2 IOERRS - I/0 SPCIOS - Special MACRO Dynamic Upon entire part storage macro is used AND is For the macro most this codes EXPANSIONS heavily or stored, body codes function definition definition. of status I/0 DEFINITIONS macro macro return for the the issuance including all reason, text. A storage of macro text. of an .MCALL directive, the comments appearing in the comments librarian should not function be switch included as (/SZ) is available to compress macro source text by removing all trailing blanks and tabs, blank lines, and comments. The system macro library (RSXMAC.SML) has already been compressed. User-supplied macro libraries (.MLB) and macro definition prefix files should also be compressed. tasks, (see For consult Section additional the #.3 in applicable the information RSX-11M Preface). F-2 or regarding RSX-11M-PLUS these two Utilities utility Manual ALLOCATING It often seems definitions in undesirable macros. macro This practical each arguments in call, Certain waste the useless of .MACRO VAL] SYM2 = VAL?Z2 valuable of memory MCL, macros can OFF1 = SYMBOL OFF2 = OFF1+S17Z1 OFF3 = OFF2+S1IZ2 OFFN = OFFM+SIZM .MACRO The dynamic be storage avoided (see Section enabled (see redefined to be be file of commonly used macro practice, however, may produce the practice for unnecessary by making macro library file (see desired macros must directive must a can user-supplied the names of .MCALL macro. = of This practice not the overhead and the mainly to those example below. follows: SYM1 a .ENABL types invoked. eliminates to include assembly. This allocation This definitions means that MACRO VIRTUAL MEMORY 7.8), Section null or the file of Table 8-1). be listed as the automatic 6.2.1). after they have been only frees storage space, it also dynamic memory wasted by calling a of that define symbolic The redefinition redefining macros assignments, process may as be to null applies shown 1in the accomplished as DEFIN DEFIN ;Define symbolic assignments. ;Define symbolic offsets. ;Macro null redefinition. . ENDM . Macros read ENDM DEFIN exhibiting via the this redefinition (MCALL definition and/or .MCALL efficient use of dynamic FF.3 When, still taken OPERATIONAL despite directive) processing, property should be defined (or and invoked before all other macro a practice that ensures more memory. TECHNIQUES adhering to the guidelines discussed above, performance falls below expectations, several additional measures may be to increase dynamic memory. ALLOCATING VIRTUAL MEMORY The first measure involves shifting the burden of symbol definition from MACRO-11 to the 1linker or task builder. 1In most cases, the definition of system I/0 and File Control Services (FCS) symbols (and user-defined symbols of the same nature) is not necessary during the assembly process, since such symbols are defaulted to global references (Appendix D.1l, category 4 of error code A). The linker or task builder attempts to resolve all global references from user-specified default 1libraries and/or the system object library (SYSLIB). Furthermore, by applying the selective search option for object modules consisting only of global symbol definitions, the actual additional burden to the linker is minimal. The second way is to produce only listing), as opposed to two. support the second output file is memory at the start of each one output file The additional allocated from assembly. (either object or memory required to available dynamic APPENDIX G WRITING G.1 INTRODUCTION TO POSITION-INDEPENDENT CODE POSITION-INDEPENDENT CODE The output of a MACRO-11 assembly is a relocatable object module. The Task Builder or Linker binds one or more modules together to create an executable task image. Once created, if the program is to run it must be loaded at the wvirtual address specified at link time. This is because the Task Builder or Linker has to modify some instructions to reflect the memory locations in which the program is to run. Such a body of code 1is considered position-dependent (dependent on the virtual All addresses PDP-11 to which processors it offer is bound). addressing modes that make it possible to write code that does not depend on the virtual addresses to which it is bound. Such code is termed position-independent and to run can be loaded at any virtual address. Position-independent code can improve system efficiency, both in wuse of virtual address space and in conservation of physical memory. In multiprogramming important that common code, for of a task's systems many tasks example, a virtual like IAS, be able library address RSX-11M to share routine. space, and RSX-11M-PLUS, a single To make shared it is physical copy of the optimum use code should be position-independent. Position-dependent code can also be shared, but it must appear in the same virtual locations in every task using it. This restricts the placement of such code by the Task Builder or Linker The and can result construction of in the loss of virtual position-independent code addressing space. is closely linked to the proper usage of PDP-11 addressing modes. The remainder of this Appendix assumes you are familiar with the addressing modes described in Chapter 5. All addressing modes involving position-independent. These modes R (R) (R)+ references are mode register deferred mode autoincrement mode autoincrement deferred mode - (R) autodecrement using register follows: register @(R)+ @-(R) When only are as mode autodecrement deferred these addressing position-independence, provided been supplied such that they are virtual memory location. mode modes, the not you are contents of the dependent upon guaranteed registers have a particular WRITING POSITION-INDEPENDENT The relative addressing modes are relocatable address 1is referenced These modes are as follows: A relative mode @A relative deferred Relative modes (that 1is a instruction. make the Index 1In modes not this reference according If are can to be their case, absolute position-independent the in mode deferred X, is addressing use index the when an absolute referenced either index base, is from (@#A) position-independent. X (R) the mode address) @X (R) offset), position-independent when a from a relocatable instruction. position-independent non-relocatable CODE an program. These or are be wused to as follows: mode value (for example, position-independent. For is may address relocatable position-dependent, modes absolute reference a a control example: MOV 2(SP) ,R@ ;Position-independent MOV N(SP) ,R% ;Position-independent block N=4 If, however, X 1is position-dependent. CLR Immediate its a relocatable For ADDR (R1) mode usage. can be Immediate #N address, the reference example: is ;Position-dependent either mode immediate position-independent references are or not, according formatted as follows: mode When an absolute expression defines the wvalue of N, the code position-independent. When a relocatable expression defines N, code is position-dependent. That is, immediate mode references position-independent only when N is an absolute value. Absolute mode addressing is position-independent only in where an absolute virtual location is being referenced. addressing references are formatted as follows: @#A An absolute example of to the For example: a MOV G.2 The that is the are those cases Absolute mode mode position-independent directive to status word @# SDSW, RO absolute ($DSW) from ;Retrieve a reference is relocatable directive a reference instruction. status EXAMPLES RSX-11M library establishes Trap (AST) AST entry entry point user-specified executes an routine, or point that entry AST PWRUP, removes saves is user address. point, exit a a Imbedded all The G-2 all callable failure within registers, restores directive. FORTRAN power the routine effects registers following subroutine Asynchronous on examples a System 1is call to return, are the the and excerpts WRITING POSITION-INDEPENDENT CODE from this routine. The first example, Figure G-1 has been modified to illustrate position-dependent references. The second example, Figure 1s position-independent version. + Position derendent code R WS W the FPWRUF:¢ » CLR Perform examrle -{SP) further MOV FASSUmME $0TSVsR4 (SP)+sR2 10s CLR BR MOV -(SP) 20% R2+F.PF(R4) MOV $BAY-(SP) 10%: sFoint R4 at obJect time # the above reference to t derendent fPush save ares rosition- is address to BA is rosition- srocessing.,.. + AST service routine E W WS our AST service the above reference derendent # 3 Continue sustem $0TSY ‘Retrieve AST entry point address iBranch if one was srecified #If noner specify no rower fail routine sBurass AST setur iSet the AST entry roint 20¢: s SUCCesS initislization... MOV ENE BA: * MOV Rest of ROy—-(SP) routine RE W Figure Fosition PWRUP:!: # iPreserve follows... G-1 Example inderendent CLR Perform code of FASSUME Code 10s: @#$0TSV,R4 MOV BNE (SP)Y+sR2 10¢ CLR BR MOV MOV 20% R2:F.PF(R4) FPCs—-(SP) ADD $BA- .+ (SP) -{SP) 20¢ ¢ Continue SUCCEeSS initialization... iFoint R4 at ob.Ject time sustem save ares above reference to $0TSV is rosition¢ inderendent iRetrieve AST entrw roint address iBranch if one was srecified iIf nones srecify no rower fail routine i g Position-Dependent exsmrle -{SP) necessarw MOV + RO + -E G-2, the sByrass AST setur iSet the AST entru rpoint our PC to relocate our AST service addr Relocate our AST service address now H the above reference to BA is rositioni inderendent’ this costs one word to relocate iPush processing... ' t AST service H BA? ' MOV Rest of routine RO»-(SP) routine Figure G-2 iPreserve RO followS... Example of Position-Independent Code WRITING POSITION-INDEPENDENT CODE The position-dependent version of the subroutine contains a relative an absolute symbol ($OTSV) and a literal reference to a to reference Task the by bound are references Both relocatable symbol (BA). Builder to fixed memory locations. Therefore, the routine will not execute properly as part of a resident 1library if its location in virtual memory is not the same as the location specified at link time. been In the position-independent version, the reference to $O0TSV has 1In addition, the necessary code has changed to an absolute reference. been added to compute the virtual location of BA based upon the value In this case, the value is obtained by adding of the program counter. the value of the program counter to the fixed displacement between the Thus, execution of the the specified symbol. location and current in the 1image's modified routine is not affected by 1its 1location virtual address space. 1is The MACRO-11 Assembler provides a way of checking whether the code In an assembly listing, MACRO-11 inserts a ' position-independent. the Task character following the contents of any word which requires therefore, and, operation relocation a perform to Linker Builder or may not be position independent code. The cases which cause apostrophe to be inserted in the assembly listing are as follows: 1. an Absolute mode references when the reference 1is relocatable. For are absolute. they when flagged not are References example: MOV 2. address relative specified MOV ADDR1,R1 MOV @ADDR1,R1 |is :Non-pic if ADDR is relocatable. ;Non-pic if ADDR is relocatable. ADDR (R1) ,R5 @ADDR (R1) ,R5 Relative and offset example: For program section. 4, ;Pic only if ADDR is absolute. Index and index deferred mode references when the relocatable. MOV MOV 3. @#ADDR,R1 1is deferred mode relocatable For example: references with ;Non-pic when ADDR1 when the respect to another is absolute. Immediate mode references to relocatable addresses. MOV ;Non-pic when ADDR is relocatable. $#ADDR,R1 position-dependent potential a flag In one case, MACRO-11 does not reference is made to an relative a occurs where This reference. MOV absolute virtual location from a relocatable instruction (see the SOTSV,R4 instruction in Figure G-1). References requiring more than simple relocation at 1link time are global references are Simple 1listing. in the assembly indicated Statements which contain multiple global flagged with the letter G. or require complex relocation, are flagged with the letter references to positively 1is difficult It C (see Section 3.9 and Chapter 4). not a C-flagged statement is position-independent. or state whether However, in general, position dependence can be decided by applying in this Appendix to the resulting the guidelines discussed earlier address value produced at link time. P APPENDIX H SAMPLE ASSEMBLY AND CROSS REFERENCE >RSOUNP TABLE MACRO V05.00 Saturday 08-Jan-83 11:47 OF CONTENTS RADSO urrack routine 11247 RSOUNF +IDENT /02/ MEEOWE SR R KR s R EE YR s R WSRO W MR R MR s R e R e +TITLE 0o NS e MACRO VO05.00 Saturday OB-Jan-83 D bR R3SOUNP LISTING Pase 1 COPYRIGHT DIGITAL THIS EQUIPMENT (c) 1979 CORPORATION, BY MAYNARD, MASS. SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED WITH THE TERMS OF SUCH LICENSE AND WITH THE THE ABOVE COFYRIGHT NOTICE. THIS SOFTWARE OR ANY OTHER COFIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY OTHER FERSON. NO TITLE TO AND OWNERSHIF OF THE GSOFTWARE IS HERERY TRANSFERRED. ONLY IN INCLUSION THE AND ACCORDANCE OF INFORMATION SHOULD IN NOT THIS BE SOFTWARE CONSTRUED IS SUBJECT AS A CORFORATION. [IGITAL ASSUMES SOFTWARE UFDATE ON NO RESFONSIBILITY EQUIFMENT WHICH IS HISTORY: DWN. CUTLER 10-FEB-73 NOT FOR TO CHANGE WITHOUT NOTICE COMMITMENT BY DIGITAL EQUIFMENT THE USE SUPPLIED BY OR RELIARILITY DIGITAL. OF ITS SAMPLE ASSEMBLY AND CROSS MACRO V0S5.00 Saturday 08-Jan-83 11.47 Page 2 UNFACK ROUTINE RADSO unrack +SETTL routine i+ RSOUNP UAD # i Unrack 8 &6 char RADS0 sumbol to ASCII ; Enter with R2 -» Outerut ASCII string } GO N RADSO R RSOUNP REFERENCE LISTING i SYMBOL, SYMBOL+2 = RADSO sumbol to unrack i $ Return with R2 -> Past output string R3 Destroued R1ir ROs» 3 ;... 012704 000002 0000006 iGet next RADSO word 004767 CaLL 10¢ iUneack and store the character 000020 012703 MOV $50+R3 tNow set divisor for middle character 000024 004767 CALL 10% sUnrack and store the character 000030 000032 010100 004767 MOV CaLL RisRO 11% i Corw remaining character ;Translate and store it 000036 020427 CMF R4s$#SYMEBOL+4 sTest if last word done 001341 012604 000207 BENE MOV RETURRN is (SF)Y+sR4 siBranch if no tRestore RA4 tReturn to caller MOV 142 003100 000030 000050 000020 0000146 00000406 000042 000044 0000446 29 iSet divisor for high character i Divide RADSO word and convert char to ASCII 30 33 tPoint at RADS0 sumbol buffer (R4)+sR1 000014 32 tSave R4 $50%50sR3 012703 000010 31 R4s-(SP) $SYMBOL sR4 MOV MOV 012401 000006 27 28 RSOQUNF:IMOV 0104446 000000 26 PUREI»1I +FSECT 000000 071003 34 RO CLR 10%:3 005000 000050 000052 R3sRO DIV i Translate RADSO character code to ASCII 35 36 37 38 39 40 41 42 000054 000056 A5 0000460 43 44 0 1-32 33 = y 24 = s i 35 = 36-47 11%:3 005700 001412 (020027 000033 002405 46 0000464 001402 47 000066 062700 48 000070 000011 RSOUNP space = i 3 ¥y = A-Z $ ¥ unused = 0-9 code TST BEQ CMFP RO 23% RO,233 BLT BEQ ADD 22¢ 21% $22-11sRO MACRO V05.00 Saturdavy O0B-Jan—83 11:47 RADS0 UNFPACK ROUTINE iTest if srace tBranch if so iTest if middle sBranch if aslerhabetic sBranch if dollar sidn t;Dot or digits 0-9 . i Pamse 2-1 shollar 21%: ADD $11-100+RO 50 000100 062700 2243 ALD $100-40+RO tAlrhabetic ADD $40sRO iSrace 49 000074 062700 177711 000040 51 000104 062700 =3 000112 000207 55 000001 000040 52 000110 110022 54 23%1 MOVE RETURN +END RO+ (R2)+ ) iStore ASCII char in buffer * SAMPLE ASSEMBLY AND RSOUNP Symbol RSOUNP . ABS. PUREI Errors #%% MACRO V05.00 Saturday 08-Jan-B3 OOOOO0OORG 000000 000000 000114 detected. file reads: Work file writes. Size of work 002 SYMBOL= ##%#xx 7936 HWords 2-16# 2-17 ( 2-23% 2-32% 2-33% 2~-30% 2-S1% 2-52 2-18% 2-52% 2-23 2-19% 2-21% 2~-33 2-16 SP 2-17% 2—-16#% 2-18 2-27 PUREI Paase R-1 Pases) Pases) 2-43 2-4%5 2-25 2-27% MACRO VO05.00 Saturday 0OB-Jan—-83 reference table (CREF V05.00) 0-0 ABS. 11:47 1 (72 2-25 R3 » S-1 O file: R4 Cross Pase O RSOUNP MACRO V05.00 Saturday 08-Jan-83 Cross reference table (CREF V05.00) RSOUNP 11:47 0-0 2~14 GX O RSOUNP MACRO V05.00 Saturday 08~Jan-83 Cross reference table (CREF VY05.00) R2 2-2 000 001 002 Size of core pPool.: 16158 Words Orerating system. RT-11 Elarsed time:. 00:00:04.34 DK :RSOUNP DK IR5S0OUNP/C=DK : SUM R1 Page statistics Work RO 11:47 REFERENCE Table Assembler R3OUNP SYMBOL CROSS 11:47 2-4B#% Pase C-1 2-49% LISTING Sy, APPENDIX OBSOLETE MACRO-11 I.1 OBSOLETE The following release DIRECTIVES, DIRECTIVES SYNTAX, AND COMMAND SYNTAX and syntax, although supported in this assembler, will NOT be supported in future assembler following table shows the old directives and syntax, syntax to use. All MACRO-11 code that contains the old syntax should be updated to use the new syntax. releases. The the new directives and 0ld no longer and Table I-1 New Directives and Syntax supported New . EOT XXX IF Z,xXxXx «IFNZ or xxXX «IF NZ,xxx xXX «IF L,xXxx . IFG xxx .IF G,xXX or xxx . IFDF xxXx XXX .IFNE .IFLT or .IFLE . IFNDF .IFEQ or +IFL .IFGT .IF xxx xxX xXxX Xxx OBSOLETE MACRO-11 DIGITAL. some COMMAND command This cases by LINE line use only switch switch. the All assembly updated syntax by of the command /P[ASS]:n line, no SPRs documentation for command containing removing «IF NE,xxx .IF LT,XxXx +IF LT,xXxx +IF GT,xXxx .IF GT,xxx .IF LE,XXX .IF DF,xxx .IF NDF ,xxx option Although MACRO-11 NE,xxx was switch has documented a EQ,xxx .IF OPTION It has been found that the /P[ASS]:n has caused more problems than can be Any to EQ,xxx .IF /P[ASS]:n is no longer originally created to speed up scanning a given file with one switch assembler. on syntax None «IFZ The OPTIONS the and I.2 LINE directives of Syntax AND I files this the switch. will is be /P[ASS]:n the supported assemblies pass of many side effects, reasonably. still allowed accepted switch /P[ASS]:n has to relating been switch by in the and appear to the removed. should be I Y APPENDIX RELEASE J NOTES This appendix explains the changes that have been made to since the last version release. The new features mentioned documented in chapters one through nine of this manual. CHANGES -- ALL VERSIONS 1. opcode, The permanent the JMP CALLR complement (Call-Return), table opcode. the MACRO-11 addr symbol addr OF CALL MACRO-11 are fully The addr (PST). This CALLR addr opcode has been opcode opcode -- which is added is to the equivalent was added equivalent to to to the JSR PC,addr The for previous version of MACRO-11 used a range of 64$ to 127$ automatic 1local symbol generation. MACRO-11 now uses a range of Most opcode. 30000S$ to assembler . SBTTL or of when generating generated upper/lowercase. readability 65535$ This MACRO-11 the listing change code. L.TITLE was local text made Lines of directive is to code are symbols. now in increase the that not include the converted to uppercase. Lines the of code that include the .SBTTL directive are table of contents of an assembly listing, .NLIST are the statement is encountered. TOC argument to in effect You may prevent at the printed. The symbol if the All page the specify time the table of the .NLIST listed in even if a .SBTTL directive contents from lines with being table is printed at the end of an assembly, even .NLIST directive is in effect. You may specify the -.NLIST directive with the SYM argument to prevent the symbol table from being printed. headers include the day of the week. RELEASE The assembler of the statistics assembly following information listing additional NOTES file has that been appears updated Total number of virtual work file reads e Total number of virtual work file writes e Maximum amount ¢ Size physical e Operating system running under ¢ Total e MACRO-11 elapsed of The PSECT synopsis the symbol table, The maximum record MACRO-11 128. and end the memory used freespace (in environment that (in words and words pages) and the pages) assembler 1is time line number has to memory that is includes expression that virtual assembly command the include information: ¢ of at to of been printed in the listing psect attributes. the relocatable changed. can The produce was terms maximum file, 1in a size after complex an .OBJ from 42, bytes increased of bytes. Do not compare versions of .0OBJ files that MACRO-11 when have been verifying created by whether different vyour code generation is correct. Changes that have been made for this version of MACRO-11 (mentioned above) will invalidate a direct comparison of assembler .0OBJ output. Verify code generation by linking or taskbuilding the .0BJ files involved and then comparing the .SAV or the .TSK image files. NOTE Because the .0BJ files produced by this new of MACRO-11 are different, users of the PAT file patch utility) are warned that checksums 19. The the for LC argument been changed options have been l. .ENABL LCM/.DSABL 2. .ENABL MCL/.DSABL MCL The new following directives have directives are documented L . CROSS . INCLUDE TM | . following . LIBRARY . NOCROSS .REM . WEAK assembled has The +.MDELETE patches (object must be with from this .DSABL LC. |] .ENABL . 12. default to . 11. on any object of MACRO-11l. SN W - LC recomputed new version version .ENABL/.DSABL added: LCM been added to MACRO-11. in this manual. These RELEASE J.2 NOTES CHANGES -- MACRO-11/RSX VERSION ONLY l. cross-reference SEC The options and ERR have been added. NOTE The RSX-11 CREF include program support cross-reference version (V2) RSX-11M-PLUS (CRF) for has these been updated two new options. Only the new RSX-11] distributed with RSX-11M V4.1 V2.1 should be used with this to macro CRF and version of MACRO-11. 2. J.3 The default for modified from the /SP by the system in the MACRO-11/RSX command to /-SP. manager CHANGES -- MACRO-11/RT-11 1. message: The Errors has been detected: removed. RSX-11 RSX-11 the 4, VERSION TKB GBLPAT command option described file. ONLY 0 errors prints have this message been detected in the on the module If the first character in a MACRO-11/RT-11 command line is a semicolon (;), the 1line 1is treated as a comment and is ignored. This change was made to maintain compatibility with the 3. the build MACRO-11 terminal only if being assembled. 2. using task 1line option /[-]SP has been The new default may be modified version of style command one-character MACRO-11. line switches may be used in addition to switches: /M may be represented as /M[LIB] /E /D /P /L /N may may may may may be be be be be represented represented represented represented represented as as as as as /E[NABL] /D[SABL] /P[ASS] JLIIST] /N[LIST] The default file extension for macro 1libraries has changed to .MLB, to conform with RSX-11l. The RT-~-11 V5 program defaults 1its macro library output to the extension also. been LIBR .MLB RELEASE Prior one to this .MLB release file on of a NOTES MACRO-11, command if you 1line, specified and more each file assembler now than had a definition of the same macro, the first macro library specified would be used for the macro definition if called in the source program. This has been modified to work like the RSX-11 .MLB macro files assembler. from the MACRO-11 command the file first system The default to macro for .ENABL line or the GBL. by library, GBL RT-11 file specified. default GBL The 1last using The macro specified the (either .LIBRARY assembler in scans directive) then scans the to the SY:SYSMAC.SML. argument has been changed from .DSABL INDEX A error, 3-10, 3-13, 5-10, 6-15, 6-25, 6-26, 6-28, 6-29, 6-33, 6-47, 6-38, 6-56, 6-40, 6-42, 6-44, 7-2, 7-12 to 7-14, 7-16, 7-17, 7-20 Absolute address, D-2 Absolute binary output, Absolute Absolute B-2, 6-32, expression, 3-17 mode, 5-1, 5-7, G-2, G-4 BCS BEQ BGE BGT to ASCIT character set, A-1 conversion characters, 6-23 to 6-26 directive, 6-28, 6-36, .ASCIZ directive, 6-36, 6-1, 6”21, 6“26 B-3 6-1, 6-28, B-4 .ASECT directive, 3-11, 3-13, 3-14, 6-2, 6-44 to 6-47, B-4 Assembler directives. See Permanent symbol table version number, 8"2' BCC directive ADD instruction, E-12, G”Bg H-2 Addition operator, 3-2, 3"5' B-1 Address boundaries, 6-39 Addressing modes, 5-1 Apostrophe, G-4 to Autoincrement Base 6-19 Absolute module, 6-42 Absolute program section, 6-42 6-45, B-4. See also .ASECT .ASCII Autoincrement BHI indicator, mode, 5-1, E-13 E-14 H-2 E-13 E-14 BHIS instruction, E-14 instruction, E-13 BIC instruction, E-13 Binary operator, 3-4, BLE 5-3, G“l level, E-14 instruction, instruction, instruction, instruction, instruction, Blank 3-2 line, 3-5, 3-16 2-1 instruction, E-14 .BLKB directive, 3-14, to 6-38, B-4, D-3 6-2, 6-36 .BLKW directive, 3-14, 6-2, 6-38, 6-48, B-4, D-3 BLO instruction, E-13 BLOS instruction, E-13 BLT instruction, E-13, H-2 BNE instruction, E-10, G-3, BR instruction, E-10, E-11, Branch instruction addressing, 5-9, D-2 use of, E-13 .BYTE directive, 6-2, 6"23' B-4, 6-4 6-36, H-2 G-3 6“36' D-4 Assembly error., See listing pass 1, 6-16, symbols, 4-1 1-1, 1-2, 6-12, 6-15, 6-49, 8-19, 8-12, A error C bit, E-9 CALL instruction, D-3 ASCII, pass 2, 1-2, 6-12, 6-21, 7-15, D-3 Assignment operator. See Direct assignment operator Assignment statement. assignment Autodecrement See Direct statement deferred 5-5, B-2, G-1 Autodecrement indicator, Autodecrement mode, 5-1, B-1, B-2, 5-1, 3-2 5-4, G-1 Autoincrement deferred 5-4, B-2, G-1 mode, 5-1, A-1 to E-8 A-3 legal, 3-1 to 3-3 Radix-50, A-5, A-6 CLR instruction, G-3, CMP instruction, Coding standard, Comment, mode, H-2 Calling convention, Character set E-1, E-13, E-1 G-3, H-2 H-2 E-5 delimiter, 3-2, B-1, E-12 fielda, 2-1, 2-4, 2-5, E-1 Commercial instruction set, C-3 Common exit, E-11 Complex relocatable 3-18 expression, Complex 4-1, Index-1 relocation, G-4 INDEX Concatenation B-1, indicator, 3-3, .ENDR directive, B-3 Conditional assembly, 6-56, 7-8, 7-16, immediate, 6-56 Conditional B-4, 6-51 to Entry D-4 assembly block, 7-3, directive, B-4, C-5 listing, 8-8, 8-9, 8-14, 8-18, 9-2, 9-3, 9-5 8-16 to location counter, 2-2, 6-2 6-23 addressing 6-29, B-3 to Device register, 3-3, B-5, E-2 B-8 3-1, 3-2, 3-9, statement, 3-6 See 3-9, 6-17, indicator, processor, B-3 3-14, 6-19, truncation, 6-35 .FLT2 directive, .FLT4 directive, 6-19, 6-2, | 6-35, B-5 6-2, 6-35, B-5 instructions, control, Forward E-13 2-5 reference, 3-13, Function 3-8, 3-9, D-4 control Switches, switches. function directive, See control 6-18 Permanent Global expression Global Global label, 6-51 reference, 6-21, F-4, 6-2, 8-8, 6-19 9-4, to Global B-4, Global argument, 7-2, 7-11, 6-51, G-4 symbol, D-2, D-1 evaluation, 3-17 B-1 8-6, B-5. directive Floating-point B-1l table .DSABL directive, Dummy directives, .FLT2 3-19, 3-13, illegal, D-3 instruction, H-2 Division operator, 3-2, 3-5, B-1 Double ASCII character indicator, 6-21, B-1 Floating-point DIV 3-2, 3-2, Formatted binary, 6-19 FORTRAN, 6-47, E-15, G-2 6-37 See also 6-19 also Function to 3-16 symbol terminator, Format assignment operator, symbol Field FILES-11, 6-19 Forbidden indicator, B-1 | Delimiting characters, 6-38, FLX, 3-2, Directives. of, B-1 expression, 3-17 symbol, 6-52. See Floating-point 6-45 directives, D-4 immediate, 6-34, 6-35, C-4 Floating-point rounding, 6-32 Default radix, 3-14 Default register definitions, 3-19, 6-21 Deferred 6-29, evaluation Floating-point 5-8, to Data storage 6-2, B-5, D-5 to 2-3 storage, to 9-7 3-2, 3-12 to 3-14, 3-17, 6-11, 6-36 to A-38, 6-43 6-44, B-5, B-7, D-2, D-3 sharing, D-1 B-5, 6-52 7-16, indicator, Global directive, 3-11, 3-13, 6-2, 6-44 to 6-47, 9-6, B-4 Direct directive, 3-12, 6-19, error, 7-20, B-5 3-2, External External .CSECT D .EVEN Expression Copyright statement, E-5 .CROSS directive, 6-2, 6-22, Current messages, Expression, 6-49 Cross-reference symbol, Error | assembly point . ERROR directive, B-5 Conditional 7-19, B-8 D-3, 1-2, 3-7, B-5, E-4 symbol definition, 2-2, 3-2, 3-8, 6-51. See .GLOBL directive 3-1, also 7-17 Global E error, symbol directory, 1-2 .GLOBL directive, 3-7, 6-2, 6-51, 6-4¢ EMT instruction, 5-9, D-4 .ENABL directive, 6-2, 6-19 to 6-21, 8-6, 8-8, 9-4, B-4, D-1, D-2, D-4, «.END directive, D-3, .ENDC to B-5, F-2 6-2, 6-40, Hardware register, I 6-28, E-2 B-4, H-2 directive, 6-56, 6-2, 6-59, 6-12, 7-3, 6-53 B-4 .ENDM directive, 6-13, 6-21, 7-2, 7-3, 7-6 to 7-8, 7-1¢, 7-11, 7-17 E-4 to 7-19, B-4, B-8, error, IAS, 6-48, 8-19 to 6-30 7-21, 8-14 8-22, .IDENT directive, F-3 Index-2 D-2, E-5, E-7, to | 8-17, G-1 6-2, 6-16, E-15, H-1 B-5, INDEX .IF directive, 6-2, 6-12, 6-59, 7-8, B-5, 7-3, .IFF directive, 6-58, 6-2, 6-56 to D-2 6-58, 8-13, Listing 6-2, 6-56 to 6-2, 6-56, 6-57, B-6 .IIF directive, Illegal Illegal 6-2, 6-59, B-6, D-2 characters, 3-3, D-2, D-3 forward reference, D-3 Immediate conditional assembly, 6-59 Immediate expression indicator, 3-2, B-1 Immediate mode, 5-1, 5-6, B-2, G-2, G-4 Implicit .WORD directive, 2-4, 9-8, B-6, C-6 Indefinite repeat Repeat block, deferred B-2, Index G-2, mode, Initial Local 5-1, Local argument 5-7, B-2, 7-19, indicator, B-1 error, 2-3, 3-1, 3-2, 7-15, 7-17, 7-18, also .MACRO 7-2, 7-17 7-2, 7-17 to keyword D-2 indicator, B-1 name, JMP JSR instruction, instruction, 5-3, 5-3, E-13 E-9 numeric argument, redefinition, F-3 symbol, 3-6 B-6, Macro Macro 6-12. 1-2, 6-47, Linking, See 6-39, to See 7-2, 3-1 7-4, 7-3, D-4, 7-6, E-4 7-17 7-7 also 2-2, 6-17, F-4, 6-40 B-6 6-5, Listing 6-43, G-1, call call argument, 7-4 numeric argument, 7-9, 7-19¢, 3-3 6-13, 6-21, 7-1 7-11, 9-6, B-6, D-1, F-3 Macro library directive. See «.MCALL directive Macro format, | 6-51, 4-1, 6-3, listing control Linker, 7-2, .MACRO directive, C-6 +LIMIT directive, Line format, E-1 6-6, 7-4. Macro call, 7-1, 7-4 to 7-11, 7-12, 7-20, B-1, B-6. See also .MCALL directive 2-1 printer 7-1, nesting, Label field, 2-1 to 2-3, E-1 multiple definition, 2-3 terminator, 3-1, B-1l .LIBRARY directive, 6-2, 6-60, Line B-4, D-4, F-2 expansion listing, 6-9, 6-12 keyword argument, 7-4, 7-10 to 3-2, 9-9, 7-26, expansion, 7-1, 7-3, 7-5 to -7, 7-9, 7-11, 7-17, B-7, terminator, error, 3-8 directive Item L Current B-6, B-7, E-6, F-2 directive, 7-1, 7-2, D-2 B-6, 3-12, attribute directive, 7-12 definition, 6-33, 7-1 to 7-13, E-12 .IRPC directive, 7-19, 3-11, F-2 argument, 7-7, 7-14, 7-15, B-3 argument concatenation, 7-11 3-2, C-1 B-6, block, D-4, 7-8, Macro Instruction set commercial, C-3 .IRP directive, 3-12, F-2 Location counter control, 6-34 to 6-36 Logical AND operator, 3-2, 3-5, B-1 PDP-11, symbol E-4, Location counter. See location counter expression indicator, 3-2 register indicator, 3-2, Interrupts, 3-11, D-4, 6-20, M 5-5, 6-14. 5-5, G-4 5-1, to directive, Logical inclusive OR operator, 3-2, 3-5, 6-55 Logical OR operator, B-1 6-61, block. See indefinite mode, D-1 6-4 .LIST symbol, 7-9, B-1 Initial Initial also 6-55, 6-2, B-6, .NLIST directive Listing control switches. See Switches, listing control Listing level count, 6-9, 6-10, 6-12, B-6, B-7 6-25 .INCLUDE directive, Index 2-1, 9-4, control, See B-5 directive, D-1, .LIST directive, 6-3, 6-9 to 6-14, 6-21, 8-6, 8-11, to B-5 .IFT directive, .IFTF 6-53 D-1, symbol table, MACRO-11 character Character set, .MCALL directive, 8-15, G-4 D-4, 9-5 F-1 to to 7-20, 9-6, 3-7 8-6, B-6, F-3 .MDELETE directive, Index-3 3-6, set. See legal 7-21, B-7, C-7 INDEX Memory Page allocation, 6-42, 6-47, F-1, F-2 conservation, F-1 .MEXIT directive, 7-20, B-7 Modularity, 6-44, 7-18 to E-8, E-15 Permanent F-1 Module E-9 preface, console E-5 routine, 8-1, .PRINT Multiple label, 2-2 Multiple symbol, 2-4 Multiplication operator, M table, 8-2 to error directive, Processor B-1 7-17, priority, G-1 to B-7 E-2 Program counter, Program counter Program development Program module, E-5 Program section directive. 5-1, E-2, G-4 definition, 3-1¢0 system, 8-14 See 6-41 Program section table, Program version number. Version to code, .PSECT directive Program section name, 3-2, C-1 3-7 G-4 instruction, 3-13, 3-14, 6-37, 6-58, D-1, E-13, G-2 G-4, H-2 | MOVB instruction, H-2 Multiple definition. See Multiple expression, 2-4 symbol 3-6, Position-independent routine, 3-5, 6-17 c-3, checking MOV 6-4 number, Patch, 7-3, Module Monitor header, 1-1 See identifier, program Programming N error, standard, E-1 .PSECT directive, 3-12, 3-14, 6-2, 6-3, 6-28, 6-41 to 3-15 Naming standard, .NARG directive, B-7, E-2 7-8, 7-12, 7-12, 7-13, B-7, D-2 conditional directive, 6-55, 6-58, 7-3 .NLIST directive, 6-3, 6-9 to 6-14, 6-16, 6-21, 8-6, 8-11, 8-13, 9-4, B-7, D-1 .NOCROSS directive, 6-3, 6-22, B-7, .NTYPE directive, 7-12, R operator, temporary, directive, error, Radix D-1, 6-40, 7-12, 3-15, 6-31, Radix-5¢, B-5, 6-34 6-57, 3-5, 6-3¢, set, operator, 6-38, symbol, eXpression, E-1 B-1 B-2, Register Relative B-2, Relative B-2, P directive, B-7 6-3, B-3 B-3, A-4 6-31 6-31, 6-17, E-9 7-4, | default, 5-2, 3-1¢, B-1 | 3-2, B-1 mode, G-1 5-1, 5-2, . mode, 5-1, 5-2, B-2, G-1 deferred mode, 5-1, 5-8, G-2, mode, G-2, G-4 5-1, 5-7, 5-8, G-4 Relocatable expression, Relocatable module, 3-17 6-43 section, Relocatable program to 6-47, B-4 Relocation, 4-1, 6-43 Index-4 3-14, D-4 term indicator, Register deferred Operand field separator, 3-2, Operation field, E-1 Operator field, 2-1, 2-3, 2-4 Overlay, 6-42, 6-44 error, 6-20, 7-16 .PACKED directive, 6-3, 6-37, B-7, C-7 6-34, 6-3, 6-41, temporary definitions, 6-21 B-7 2-4, 6-33, character 7-4, 7-21 2-1, 6-32, B-8 Register conventions, 7-15, 6-29, Read-only access, 6-41 Read/write access, 6-41 module name, 1-2 .0ODD directive, 6-3, 6-37, field, control, temporary, B-3 6-56, 6-3, H-2 .RADIX directive, 3-15, 6-32, B-8, D-1 Object .PAGE B-7, 3-10 directive, B-8, 6-33 6-36, error, .RAD5@ 7-14, D-2 of arguments. See .NARG directive Numeric argument indicator, B-1 Numeric control Operand 9-6, B-8 Number O 7-9, H-2 Q error, 6-29, 6-34, 6-38 C-6 B-7, Numeric D-2, D-2 .NCHR directive, Nested c-48, 7-13, 6-44 INDEX Relocation bias, 2-2, 3-17, 3-18, 4-1, 6-43 .REM directive, 6-3, 6-18, B-8, T Cc-7 Repeat block Task builder. See Linker Teleprinter listing format, 6-13. See also Listing control directive. See .REPT directive indefinite, 7-3, 7-17 to 7-24, B-4, B-6 7-2, 7-17, symbols, 2-3, .RESTORE directive, 6-20, 6-49, 3-1, 3-11, 3-14, B-8, C-7, RSTS, 9-1 to E-12, H-2 to 8-22, G-1 8-1 to 8-13, 8-19 .SAVE directive, 6-3, 6-20, 6-50, B-8, C-7, D-3 .SBTTL directive, 6-3, 6-4, B-8, H-2 expression 3-2, register indicator, 3-2, B-1 Terminating directive. See .END 6-49, u 6-15, Unary 7-7 6-21, error, 3-8, 7-21, 6-3, 6-4, 6-13, D-2, E-5, B-8, 3-9, 8-7, 3-15, 8-9, operator, D-4 E-11, H-2 6-21, 8-15 3-4, 3-16, 7-5, 7=7 control, 6-32, universal, 6-34 3-3, 3-5, B-1 Unconditional assembly, 6-56 Undefined symbol, 3-8, 6-21, D-4., See also U error Universal Unary D-2, unary operator. See operator, universal Upper—-case ASCII, User-defined 6-19 3-6 to 3-8 User-defined symbol table, 2-2, 3-6 to 3-8, 3-15 2-1 SUB instruction, E-13 Subconditional assembly, 6-56 to 6-59 operator, 6-31 indicator, E-7, E-16, H-1 TRAP instruction, 5-9, TST instruction, E-1¢, Stack pointer, E-2 definition, 3-10 Subtraction Terminal 3-2 Terminal 6-15, Separating characters, 3-3 Sequence number, 6-19 Single ASCII character indicator, 3-3, B-1, B-3 Source line format, 2-5 Source line terminator, B-1 Special characters, 3-1 to 3-3, format, See temporary radix control. See control, temporary directive Thrashing, F-1 .TITLE directive, G-1 rRT-11, 6-17, 6-41, 6-43, 7-21, 9-1 to 9-9 RT-11 run-time system, 9-1 Statement control. control, 6-7, B-1 9-9 F-3, 6-16, Radix-50 operator, Term, definition of, 3-15 Terminal argument indicator, RSX run-time system, 9-1, 9-2 RSX-11mM, 6-17, 6-41, 6-48, 7-21, 8-1 to 8-13, 8-19 to 8-22, RSX-11M-PLUS, 6-12, Temporary D-3 .RETURN directive, numeric Numeric Temporary Radix 3-7 6-24 contents, B-8 7-20, D-3 6-3, 3-15, of Temporary .REPT directive, B-8, Reserved error, Table 3-2, Version 3-5, B-1 Success/failure indicator, E-9 Switches file specification, 8-6 function control, 8-6, 9-4 listing control, 8-6, 8-7, symbol, identifier assembler, 6-4 file, 8-29 | program, 6-17, B-5 standard, to E-14 E16. See also .IDENT directive 9-4 Symbol name Symbol table, syntax, E-3 1-1, 1-2, Symbolic argument, SYSLIB, F-4 6-41 | Cc-7 F-1 System macro library, 8-4, 8-14, 9-3, 1-1, also .MCALL directive 9-5. 7-24, 6-24, 6-34, also Implicit See Z Index-5 error, 5-3 6-36, B-8. See .WORD directive Ty e HOW TO ORDER ADDITIONAL DOCUMENTATION From Call Write Chicago 312-640-5612 Digital Equipment Corporation Accessories & Supplies Center 8:15 AM. t0 5:00 PM. CT 1050 East Remington Road Schaumburg, IL 60195 San Francisco 408-734-4915 Digital Equipment Corporation 8:15AM. 10 5:00pP M. PT Accessories & Supplies Center 603—884—6660 Alaska, Hawaii 8:30 AM. t0 6:00 PM. ET or 632 Caribbean Drive Sunnyvale, CA 94086 408-734-4915 8:15 AM. t0 5:00 PM. PT New Hampshire 603-884-6660 Digital Equipment Corporation 8:30 AM. t0 6:00 PM. ET Accessories & Supplies Center Rest of U.S.A., 1-800-258-1710 Puerto Rico* 8:30 AM. 10 6:00 PM. ET P.O. Box CS2008 Nashua, NH 03061 *Prepaid orders from Puerto Rico must be placed with the local DIGITAL subsidiary (call 809-754-7575) Canada British Columbia Ottawa—Hull Elsewhere 1-800-267-6146 Digital Equipment of Canada Ltd 8:00 aM. to 5:00 P.m. ET 940 Belfast Road 613-234-7726 8:00 aAm.t0 5:00 PM. ET Ottawa, Ontario K1G 4C2 Attn: A&SG Business Manager 112-800-267-6146 8:00 Am. 10 5:00 PM. ET Elsewhere Digital Equipment Corporation A&SG Business Manager* *c/o0 DIGITAL's local subsidiary or approved distributor PDP-11 MACRO-11 Language Reference Manual AA-V027A-TC READER’S COMMENTS NOTE: This form is for document comments only. DIGITAL will use comments submitted on this form at the company’s discretion. If you require a written reply and are eligible to receive one under Software Performance Report (SPR) service, submit your comments on an SPR form. Did you find this manual understandable, usable, and well organized? Please make suggestions for improvement. Did you find errors in this manual? If so, specify the error and the page number. Please indicate the type of user/reader that you most nearly represent. — Assembly language programmer — Higher-level language programmer — Occasional programmer (experienced) — User with little programming experience — Student programmer — Other (please specify) Name Date Organization Telephone Street City State Zip Code or Country mmmmmw mmmmmm m No Postage Necessary if Mailed in the United States BUSINESS REPLY MAIL FIRST CLASS PERMIT NO.33 MAYNARD MASS. POSTAGE WILL BE PAID BY ADDRESSEE SSG/ML PUBLICATIONS, MLO5-5/E45 DIGITAL EQUIPMENT CORPORATION 146 MAIN STREET MAYNARD, MA 01754 wmmmmmmm mmmm“mmm | mmmmm | Do Not Tear — Fold Here Cut Along Dotted Line A | - mwmwmw
Home
Privacy and Data
Site structure and layout ©2025 Majenko Technologies