Digital PDFs
Documents
Guest
Register
Log In
AA-5075A-TC
August 1977
182 pages
Original
66MB
view
download
OCR Version
30MB
view
download
Document:
PDP-11 MACRO-11
Language Reference Manual
Order Number:
AA-5075A-TC
Revision:
0
Pages:
182
Original Filename:
OCR Text
~ Order No. AA-5075A-TC August 1977 To order additional copies of this document, contact the Software Distribution Center, Digital Equipment Corporation, Maynard, Massachusetts 01754. digital equipment corporation - maynard. mossachuwtts First Printing, August 1977 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. Digital Equipment Corporation assumes no responsibility for the use or reliability of its software on equipment that is not supplied by DIGITAL. Copyright (:) 1977 by Digital Equipment Corporation The postage prepaid READER'S COMMENTS form on the last page of this document requests the user's critical evaluation to assist us in preparing future documentation. The following are trademarks of Digital Equipment Corporation: DIGITAL DEC DECsystem-10 DECtape MASSBUS OMNIBUS DECUS UNIBUS COMPUTER LABS EDUSYSTEM FLIP CHIP FOCAL PHA RSTS RSX PDP COMTEX DDT DECCOMM DIBOL INDAC LAB-8 DECSYSTEM-20 0S/8 TYPESET-8 TYPESET-10 TYPESET-11 11/78-15 CONTENTS Page ix PREFACE 1 MANUAL OBJECTIVES AND READER ASSUMPTIONS 3 ASSOCIATED DOCUMENTS 4 DOCUMENT CONVENTIONS STRUCTURE OF THE DOCUMENT = STATEMENT FORMAT Label Field Operator Field Operand Field Comment Field FORMAT CONTROL L) Illegal Characters Unary and Binary Operators & . L2 & ] DIRECT ASSIGNMENT STATEMENTS REGISTER SYMBOLS LOCAL SYMBOLS CURRENT LOCATION COUNTER L] L MACRO~11 SYMBOLS Permanent Symbols User-Defined and Macro Symbols L 1 2 EXPRESSIONS ADDRESSING MODES e s M U CHAPTER e RELOCATION AND LINKING WN CHAPTER U W - O 2 3 NUMBERS TERMS L4 | Separating and Delimiting Characters . L L - * CHARACTER SET 1 WHWWWWWWWWWwWwWwWw LI I | | Pl I | HHHEOITOUTOEA, WD N e SYMBOLS AND EXPRESSIONS CHAPTER i - PROGRAMMING IN MACRO-11 ASSEMBLY LANGUAGE D PART II oo 4 REGISTER MODE REGISTER DEFERRED MODE AUTOINCREMENT MODE iii P 3 a I PROGRAMMING STANDARDS AND CONVENTIONS 1 2 - P N i st SOURCE PROGRAM FORMAT CHAPTER N OVERVIEW OF MACRO-11l Assembly Pass 1 Assembly Pass 2 NN N 1 2 e INTRODUCTION TO MACRO-1l1l MACRO-11 FEATURES CHAPTER ix ix MNM?&&M 1 PART I A (S0 2 CONTENTS AUTODECREMENT DEFERRED DEFERRED IMMEDIATE MODE MODE ABSOLUTE MODE RELATIVE MODE RELATIVE DEFERRED MODE INSTRUCTION USING TRAP o) PART AU aWN BB BB WWWWWWWWN P R e & & & ® & = 3 [] L L & L] s & & DATA STy W N . ol b b . NN N . CONTROL and Unary Control Operators .FLT2 and .FLT4 - Floating=-Point Storage Directives Temporary Numeric Control Operators: “C and COUNTER CONTROL DIRECTIVES .EVEN Directive .ODD Directive .BLKB and .BLKW Directives DIRECTIVES (SR .END Directive .EOT Directive L] - N o W ] » . L] |] * - L PROGRAM SECTIONING DIRECTIVES * “R "B TERMINATING L ,DSABL FACILITIES PROGRAM BOUNDARIES L] AND Radix Control and Unary Control Operators .RADIX Directive Temporary Radix Control Operators: "D, "0, LOCATION W + LTI e .ENABL DIRECTIVES L L] DIRECTIVES: STORAGE & - DIRECTIVES .NLIST Directives Numeric Directives & HOOOOOWOOOO~IJOon and RADIX AND NUMERIC N B> b .« o . UL b o OO o - ASSEMBLER DIRECTIVES .BYTE Directive .WORD Directive ASCII Conversion Characters .ASCII Directive .ASCIZ Directive .RAD50 Directive Temporary Radix-50 Control Operator: . &8 E 5 s € = s OGO O O O O O S s GO 5 & 3 GG = & S s & & & AN & FUNCTION & ] L] L4 DIRECTIVES Page Headings .TITLE Directive .SBTTL Directive .IDENT Directive .PAGE Directive/Page Ejection and NN NAN MACRO-11 LISTING CONTROL .LIST FORMS ADDRESSING INSTRUCTIONS III GENERAL O & s & s & INDEX BRANCH L4 MODE INDEX MODE SUMMARY OF ADDRESSING - MODE bbdwWwww * MODE RSOSSN = DEFERRED AUTODECREMENT WO ooNOYU AUTOINCREMENT e Gttt Ut J o Q o (Cont.) DIRECTIVE: +LIMIT .PSECT Directive Creating Program Sections Code or Data Sharing Memory Allocation Considerations .ASECT and .CSECT Directives SYMBOL CONTROL DIRECTIVE: CONDITIONAL ASSEMBLY iv .GLOBL DIRECTIVES F CONTENTS (Cont.) Page 6.10.2 Subconditional Assembly Block Directives: 6.10.3 .IFF, .IFT, .IFTF Immediate Conditional Awsambly Directive: 6-43 .IIF 6.10.4 PAL-11R Cmndxtimnal Asm&mbly mmr@etlves 6-46 6-46 CALLING MACROS IN MACRO DEFINITIGMS AND ‘MACRO CALLS ARGUMENTS - «NARG, i AND i .NARG Directive .NCHR Directive ~J 7-11 .NTYPE Directive .PRINT DIRECTIVES .ERROR AND INDEFINITE REPEAT _ BLOCK DIw@CTIqu~ 7-13 7-14 .IRP AND 7-15 .IRP Directive .IRPC Directive REPEAT BLOCK 7-15 DIRECTIVE: MACRO LIBRARY DIRECTIVE: .REPT, .ENDR +MCALL 7-16 7-17 7-18 MACRO=-11 CHARACTER SETS A-1 ASCII A-1 A-4 CHARACTER SET RADIX-50 CHARACTER SET MACRO-11 ASSEMBLY LANGUAGE AND ASSEMBLER APPENDIX B-1 - SPECIAL CHARACTERS W N SUMMARY OF ADDRESS MODE QO PERMANENT SYMBOL TABLE Q00 & OP CODES MACRO-11 DIRECTIVES U (PST) DIAGNOSTIC ERROR MESSAGE MACRO-11 ERROR CODES - B-1 B-1 B-2 O N SYNTAX ASSEMBLER DIRECTIVES & L Y . oDww DIRECTIVES - N i - s BRE o -NCHR, ~J BIRECTIVES* I Macro Nesting Special Characters in Mamxm Arguments Passing Numeric Arguments as Symbols Number of Arguments in Macro Calls Creating Local Symbols Amtmmmtmcmlly Keyword Arguments Concatenation of Macro Argumentw MACRO ATTRIBUTE W ¢« VI * . . . NN da - i .MACRO Directive .ENDM Directive +MEXIT Directive MACRO Definition Foxmattlmg «IRPC APPENDIX QQQQQ\Q\Q&NQMMHH ~ I - & . R . > W L = e & o & 8 e DEFINING MACROS ~J]OY UT o W N = BPWWWWWWWWNR , NTYPE APPENDIX 6-41 ~J MACRO DIRECTIVES APPENDIX vIF" +ENDC | ~J Conditional Assembly Block Directives: NN NN NSNSNSNSNNNNNA S L4 L4 » L |] * L & [ L] L [] s L L] CHAPTER 6.10.1 c-1 Cc-1 c-4 SUMMARY D-1 D-1 (Cont.) O o O o CONTENTS APPENDIX WN » . * B [ ] a2 * ® & ® = & & B $ a8 & » bhWNKHE & ® ® & & &b s Register Standards General Purpose Registers Hardware Registers Device Registers Processor Priority Other Symbols Using the Standard Symbmllca Symbols Global Symbols Symbol Examples Program-Local Symbols Macro Names PROGRAM MODULES General Comments on Prmgrams The Module Preface Formatting the Module Preface Modularity Calling Conventions (IntarmMmdule) Exiting Intra-Module Calling Conventions Success/Failure Indication Module Checking Routines & # =a WNHE FORMATTING STANDARDS : Program Flow Common Exits Code with Interrupts Inhlblted PROGRAM SOURCE FILES FORBIDDEN INSTRUCTION USAGE RECOMMENDED CODING PRACTICE S s Conditional Branches PDP-11 VERSION NUMBER STANDARD Displaying the Version Identifier Use of the Version Number in the Program ALLOCATING VIRTUAL MEMORY GENERAL HINTS AND MACRO DEFINITIONS OPERATIONAL APPENDIX 4 i = FORMAT COMMENTS NAMING STANDARDS OO O & - APPENDIX mmmmmmmmmmmmmm?mwmmmmmmmmmmmm BN LINE HFOWVLWVWVWYWWVWRONVUTUINERWWWWWNNNDNDNDN M "INTRODUCTION UV WN HHMOOOJOAOOAUVIUTUTUIUIUIUTUT UL OB 8B D D0 B D DD DD WA SAMPLE CODING STANDARD TECHNIQUES WRITING POSITION INTRODUCTION SPACE-SAVING GUIDELINES AND EXPANSIONS TO INDEPENDENT POSITION CODE G-1 INDEPENDENT CODE G-1 G=~2 REFERENCE LISTING H-1 EXAMPLES APPENDIX SAMPLE ASSEMBLY AND vi CROSS CONTENTS (Cont.) Page . FIGURES FIGURE - 3-1 Assembly Listing Showing Local Symbol Block 3-11 3=-2 Sample Assembly Results 3=-12 6-1 Example of Line Printer Assembly Listing 6-6 6-2 Example of Terminal Assembly Listing 6-7 6-3 6-4 6-5 6-6 Listing Produced With Listing Control Directives | Assembly Listing Table of Contents Example of .ENABL and .DSABL Directives Example of .BLKB and .BLKW Directives 7-1 Example of .IRP and .IRPC Directives 6-9 6-12 6-16 6-30 7-17 TABLES TABLE 3-1 3-2 3-3 3-4 3=-5 6-1 6=-2 6-3 6-4 6-5 6-6 Special Characters Used in MACRO-11l Legal Separating Characters Legal Argument Delimiters Legal Unary Operators Legal Binary Operators Symbolic Arguments of Listing Control | Directives Symbolic Arguments of Function Control Directives Symbolic Arguments of .PSECT Directive Non-IAS/RSX-11 Program Section Default Values Legal Condition Tests for Conditional Assembly Directives Subconditional Assembly Block Directives vii 3-1 3-3 3-3 3-4 3-5 6-3 6-14 6-33 6-39 6-41 6-44 PREFACE | 0.1 MANUAL OBJECTIVES AND READER ASSUMPTIONS The intent of this manual is to enable users ta davelmp pragrams coded in the MACRO-11aaaembly language. No prior knawlaflge of the MACRO-11 Relocatable Assembler is assumed. Although the descxiptimn, of the asgembly l&nguage is wholly self-contained within this manual, the reader is assumed to be familiar with the PDP-11 processors and related t@f%lflfllQQYr as presented in the PDP-ll Processor Handbooks. No attempt is made in this document to describe the PDP-11 hardware or the functions of the various PDP-1l1l instructions. Since the development of programs necessarily involves 1linking to create an executable image, the reader 1is encouraged to become familiar with this process, as present@d ;in the applmgable system manual (see Sectlon 0. 3) | ik gia | In presenting MACRO-11l, a tutorial bias has been adopted to enlarge upon the reference material. This posture is reflected in the examples and the accompanying commentary describing'MACRO-11 language elements 1in typical applications. Portions of text that are shaded indicate that a particular MACRO-11 feature is not avmxlabl@ in the 8K version of MACRO-11l. 0.2 | ‘ , STRUCTURE OF THE DOCUMENT This manual contains three parts. Part I, consisting of two chapters, briefly introduces MACRO-1ll. Chapter 1 1lists the key features of MACRO-11l, and Chapter 2 identifies the advantages of following programming standards and conventions. Also described is the format used in coding MACRO-1ll source programs. Part II, consisting of three chapters, presents general information essential to programming with the MACRO-1ll assembly language. Chapter 3 describes the symbols, terms, and expressions that form the elements of MACRO-1l instructions. The character set is listed, and the types of programming symbols that may be defined by the user are discussed. Chapter 4 describes the output of MACRO-1ll and presents concepts essential to the proper relocation and 1linking of object modules. Chapter 5 briefly describes how data stored in memory can be accessed and manipulated using the addressing modes recognized by the PDP-11 hardware. | ix Part III, <consisting of two chapters, describes the MACRO-11 directives that control the processing of source statements during assembly. Chapter 6 discusses directives which accomplish generalized MACRO-11 functions, while Chapter 7 deals with directives used in the definition and expansion of macros. Finally, several appendixes are provided, supplying information of interest to the MACRO-1l1l programmer. Appendix A lists the ASCII and Radix-50 character sets additional that may be used in MACRO-1ll programs. Appendix B lists the special characters recognized by MACRO-1l1l, summarizes the syntax of the various addressing modes used in PDP-11 processors, and briefly describes the MACRO-11l directives have been defined Appendix C. in alphabetical order. The permanent symbols that for use with MACRO-1ll are listed alphabetically in The diagnostic error codes produced by MACRO-1ll to identify various types of errors detected during the assembly process are listed alphabetically in Appendix D. Appendix E contains a sample coding standard that is recommended practice in preparing MACRO-11l programs. Appendix F discusses several methods of conserving dynamic memory space for wusers of small systems who may experience difficulty in assembling MACRO-11l programs. o | Appendix G is a discussion of position independent code 0.3 (PIC). ASSOCIATED DOCUMENTS The reader should refer listed manual. below for to the applicable descriptions of documentation directory documents associated with this IAS Documentation Directory 'RSX-11D Documentation Directory ‘RSX-11M/RSX-11S Documentation Directory RT-11 0.4 Documentation Directory F Y DOCUMENT CONVENTIONS ‘The symbols defined b&lmw‘are used throughout this manual. Symbol Definition [] | “ n | | Ceee o Brackets argument is Vertical bars indicate that a single choice must be optional. | | made from a list Elllpgls list indicate in of indicates the form of that | the enclosed arguments. optional the last | | | - ) continuation of an argument spaaifmed argument. TM UPPER-CASE CHARACTERS lower—case characters (n) Upper-case characters indicate elements of the language that must be used exactly as shown. Lower-case characters indicate elements of the language that are supplied by the programmer. In some instances the symbol (n) is used following a For example, 100(8) number to indicate the radix. indicates that 100 is an octal value, while 100(10) indicates a decimal value. x1i o4 PART 1 INTRODUCTION TO MACRO-11 ~ CHAPTER 1 ;nacammll,mfikru?%Sf;w The MACRO-11 Assembler provides the fallowimg f®mgug@az 1. swurme'and command'mtring contrai mf“amaambly'fiunctians . 2 O '¢3;<;Err0r llfitmng on camm&nd mmtput fi@vama 4 . Alphabetlzed, symbml tabl@ lm&tlmg,, formatted cross-reference listing of &ymbwla 5. Relocatable object modules 6. Global symbols for ‘ fiptional e e linking object modules 7. Cdnditional assembly directives 8. | i angram aaafiiqming,diréative$' 9. User-defined maprofi and?mamro libfiafiigé . 10. Comprehensive system macro library of listing ive source | and , commandS stringe icontrol | 11. Extens functions. 1.1 OVERVIEW OF MACRO-1l The fiunctioma anw,mperatlmns m&lavant MACRO-11 is a 2-pass assembler. to each assembly pass are described in thefollowing sections. 1.1.1 Assembly Pass 1 The main purpose of assembly pass 1 is to locate and read all required macros from libraries; to build symbol tables and program section while also performing a rudimentary assembly tables for the program; of each source statement. The first stage of asaambly pass 1 is the initialization of all impure uses internally for the assembly process. data areas that MACRO-1l1l These areas include all dynamic storage areas and buffer areas used as file After storage regions. initializing memory areas, subroutine which MACRO-1ll issues a call transfers a command line into memory. 1-1 to a system This command MACRO-11 line contains assembly. the After specifications scanning the FEATURES of command the files line for initializes the specified output files. These determine if valid output file specifications command line. They are active file space. then closed to to proper be used syntax, during MACRO-11 files are opened have been passed in minimize requirements to the for As the assembly process begins, retrieves source 1lines from MACRO-11 initiates a routine which the input file. If no such file is currently open, as is the case at the beginning of assembly, MACRO-11 opens the next input file specified in the command line previously read and begins to assemble the source statements. MACRO-11 determines as one the word, length of each two words, or instruction and assembles three words. it accordingly At the end of assembly pass 1, MACRO-11 described above and writes out information reopens the output files that is to be used later in linking the object modules. Such information as the object module name, the program version number, and the global symbol directory (GSD) entries for each program section are output to the object file. After writing out the GSD entries for a given program section, MACRO-11l scans through the symbol tables to find all the global symbols that are bound to that particular program section. MACRO-11 then writes out GSD records to the object file for these symbols. This process continues for each program section, bringing to a close assembly pass 1. 1.1.2 As an Assembly Pass integral part 2 of pass 2, MACRO-11 simultaneously writes the object records to the output file and generates the assembly listing, followed by the symbol table listing for the program. A cross-reference listing may also be generated. | Basically, assembly pass 2 consists of the same steps performed 1in assembly pass 1, except that all source statements containing "MACRO-ll-detected errors are flagged with an error code as the assembly 1listing file is created. The object file that is created as the final consequence of pass 2 contains all the object records, together with relocation records containing information necessary for subsequent linking of the object file. The information thus passed enables the global symbols in the object modules to be associated with absolute or virtual memory addresses, thereby forming an executable body of code. | | The and user may wish description. system manual (see to become This Section familiar with information is 0.3 in the the macro object file format presented in the applicable Preface). - | ' ;;;;; St Wy CH&PTER 2 SOURCE PRQGR&M FOR%AT 2.1 PROGRAMMING STANDARDS AND CONVENTIONS Assembly level programming deals directly with the host hardware. Hence, great care must be exercised 1in establishing programming standards and conventions to enable code written by one group to be interchanged easily with another group. ‘Standards provide a number of advantages. When applied to the pr»gram "“w@valmpment standards make the programming effort easier to: process, Plan Comprehend Test Modify Convert Even though aspects of standards must applicability. the The program accommodate develapm&nt standarda common local Vrmqumr@memtw, pr&wfiww to all “have many uniwwraal of l%GITAL’ PDP-11 software products are preaanted in %wpemw%~fi~f~**~ model forusers. Observance of these standards is beneficial to DIGITAL and its users, by simplifying both communications and the continuing task of software maintenance and enhancement. 2.2 STATEMENT FORMAT A source program is composed of a sequence of source coding lines. Each 1line contains a single assembly-language statement. MACRO-1l will accept a source line of 132 characters, but 80 characters is the recommended langth, because of congtralnts imposed by Iistlng format and terminal line size. A MACRO-1l1l statement may consist of as many as four fields. These fields are identified by their order of appearance within the statement and/or by specified separating characters between fields. The general format of a MACRO-1ll statement is: Label: The Operator Operand label and comment ;Comment(s) fields are optional. The operator and mperand fields are interdependent, i.e., when both fields are present in a source statement, each field is evaluated by thntwll in the context of the other. “ A statement may contain an operator field and no operand field, but the reverse 1is not true. A statement containing an operand with no operator does not conform to established MACRO-1ll coding conventions; such a statement is currently interpreted by MACRO-1l1l during assembly as an implicit .WORD directive (see Section 6.3.2). 2-1 SOURCE PROGRAM FORMAT MACRO=-1l1l interprets and processes source program statements one by one, generating one or more binary instructions or data words, or performing a specified assembly process. Blank lines, although legal, have no significance in the source program. An assembly~language statement must be completed on one no continuation lines are allowed in MACRO-1l1l. The tab character fields into can be aligned source program format, Label = begins Operator in = begins used in the source columns in as below: shown column statement source to 1line; format the accordance with DIGITAL's standard 1 in column 9 Operand(s) = begin(s) in column 17 1Cmmment(s) - begin(s) in column 33 o For @mampla, the follmwing statement should be farmatted in. thm source program into specific assembly listing: columns, increasing REGTST:BIT#MASK,VALUE ; COMPARES BITS its readability | P IN OPERANDS. 1 9 17 33 REGTST: BIT #MASK ,VALUE ; COMPARES BITS IN OPERANDSaif;~ The above (columns) formatting conventions are programs (free-field coding in the is not mandatory in coding permxasmble).. MACRlel ‘However, it ~recommended that source programs be prepared in accmrdance wmth the&e conventions for confimstancy and clarity. ; ~ | 2.2.1 Label Field A label is a means of symbolically referring program. to a 1location o in a A label is a user-defined symbol which is assigned the value of the current location counter and entered into the user-defined symbol table. The current location counter is the means by which MACRO-11 ~assigns memory addresses to the . source program statements as they are encountered during the assembly process. The address value of the label 1is absolute or relmcatable. depending on whether the current ‘program section being assembled is absolute or relocatable. (The concept of program sections and the attributes that may be . fip&filfl@d for them are discussed in detail in Section 6.8.) In the case of an absolute program section, the value of the current location counter is likewise absolute, i.e., itsvalue references an absolute virtual memory address (such as location 100). Similarly, ;th&._value_ of ~section isalso the current location counter in a relocatableprogram relocatable; however, a relocation bias calculated at ‘link time will be added to the apparent value of the current location counter to establish execution time. its effective absolute virtual address at =, I1f present, a label always appears as the first field in a source %tatemgwt and mumt be tarminated by a amlmnfif Emw;emw 1@, if the e& 00 ABCD: Iuav' ~ A,B assigns the value 100(8) to the label ABCD. Subsequent references to this label would then yield a value mfi absolute 100(8). 1In this wmampl@,,mf the lmcatzan cmunt@r value value of ABC w&rw sr««*~~ ble, thw final . represents the r location ,biamof the mmwgmww ,fieatiwm, as a&lcul&te« 'bg thw ;mmk%uilfiwm atlink time. , | , | fi &0re than one labwl may agpwar thhmn a ;minqlwIab@l fxalfl* label so specified is assigned the same address value. if the current location counter value is 100(8), the in the following statement: ABC: $DD: A7.7: MOV Each For example, multiple 1labels A,B t value 10&(3); uhe are each assigne Multiple labels may also appear on successive lines. statements ABC: $DD: A7.7: | MOV , , For‘&x&mpler the , A,B likewise cause the same current lwcmtxon amumt&x walue to be afiflmqm@d to all three labels. By - ROy Of the two methods of assigning multiple 1labels mhwwm abmvm#, the second is preferred, because consistency of field ww&mtmanmnq within the source program improves readability. A double colon (::) defines the label as a glmbal m;wywlw label can be rmfietencwa Such a by imdwpandwnhly“awwwwwle%,flbjeat wwwulawfi References to this label in other modules will be resolved when the nodules are linked as a composite executable iwwqu For wxawwla, the SEateront ABCD:: , MOV St ot ol A,B establishes the label ABCD as a global symbol. The distinguishing attribute of a global symbol is that it can be referenced from within an object module other than the module in which the symbol is defined (see Section 6.9). The 1@@&1 charaat&r@ for defifiingglabalfi are: A through 2 0 through 9 . (Period) $ (Dollar Sign) NOTE By convention, are reserved software should the dollar sign ($) and period (.) for use in defining DIGITAL system symbols. Therefore these characters not be used in defining labels in MACRO-11 fimumaa;praqmaM$, | 2=3 SOURCE PROGRAM FORMAT source pmgramw all 1abels are termxnatdby a colmn (2 }, whlch is not considered part of the label. It is a mandatory delimiter. An error code (M) is generated in the assembly 1listing if the first six characters in two or more labels are the same (see,Appendifo) A symbol used as a program. If the label must not be redefined within the source symbol is redefined, a 1label with a: multiple definition results, causing MACRO-1l to generate an error code the assembly listing (see Appendix D). the source program which references a multi-defined label an additional diagnostic message; in this case, an error 'qenerated in the assembly listing (see Appendxx D) Lok 2.2.2 Operator (M) Furthermore, any fitat@ment,xn results in code (D) is Field The operator field specifies the action to be performed. It may consist of an instruction mnemonic (op code), an assembler directive, or a macro call. The operator field follows the label Chapters 6 and 7 describe When the operator is an specifies the machine these field three in types of a source operator statement. field entries. instruction mnemonic, the mnemonic op code instruction to be generated. MACRO-1l1l then continues with the evaluation of the address(es) of the operand(s) which follow(s). When the operator is a directive, the directive causes MACRO-11l to perform certain control actions or processing aperatlona during the assembly of the source program. When the operator is a macro call, MACRO-1ll inserts th@ code generat@d by the macro expansion. The operator preceded by field need not be preceded by a label; but it may be one or more labels and followedby one or more operands and/or a comment. Furthermore, leading and trailing spaces or tabs in the operator field have no significance; such characters serve only to separate the operator field from the preceding and following fields. ”‘ ~ 7 An operator is terminated by a space, tab, as in the following examples: MOV A,B v | dony MOV ;THE SPACE TERMINATES THE opERhToR o A,B MOV@A,B or any non-RAD50 character, s MOV . N ;THE TAB TERMINATES THE OPERATOR MOV . JTHE @ CHARACTER TERMINATES THE ;OPERATOR MOV. Although the statements above are all second statement is the recommended MACRO-11l coding conventions. o 2.2.3 equivalent in function, form because it conforms the to Operand Field When the operator field contains an instruction mnemonic¢ (op code), the operand field specifies those program variables that are to be 2-4 L Wi, SOURCE PROGRAM FORMAT evaluated/manipulated by the operator. The operand field may also used to supply ~arguments to MACRO-1ll directives and macro calls, desarlbad in Chapterfi 6 and 7, respectively. | Operands may be expressxong or $ymb011c argum&ntm (within the be as context of the specxfx&fl operation). Multipl@ expressions u%flfl in the operand field of a MACRO-11 statement must be &epar&ted by a aaqu; multmple symbolic arguments sxmxlarly used may be delmmit,d” by any legal separator, i.e., a comma, tab, and/or apaaafi An 0p&rand should be preceded by an operator field; if it is not, the statement is treated by MACRO-11 as an implicit .WORD directive (see Section 6.3.2). ‘When the aperatmr field ammtaxna an op g@fi@, afiamfilat@d mp&zands are always expressions, RO,A+2(RL) MOV On the other directive ‘arguments, as shown in the following stat&;@mt, hand, when the operator field contains a MACRO-1l1 or a macro call, associatedoperanfi% arenmrmally &ymballc as shawn in the fallmw1ng statem&mt. . Ve e ~ .MACRO ALPHA ARG1,ARG2 Refer to the descrlptlmn of each MkCRO*lldmramtmvw tm determine type and number of operands required in 1$$umng the fiixamtlve~ The operand field is terminated by followed by a comment. For example, LABEL: MOV A,B a semicolon when the ‘the fl field 'is in the following statement: ; COMMENT FIELD the tab between MOV and A terminates the operator field and defines the beginning of the operand field; a comma separates the operands A and B; and a semicolon terminates the operand field and defines the beginning of the comment field. When no comment field follows, the operand field is terminated by the end of the source line. 2.2.4 Comment Field The comment field normally begins in column 33 and extends through the end of the line. This field is optional and may contain any ASCII characters except null, RUBOUT, carriage-return, line-feed, vertical-tab or form-feed. All other characters appearing in the comment field, even special characters reserved for use in MACRO-1ll1, are checked only for ASCII legality and then included in the assembly listing as they appear in the source text. All comment fields must begin with the semicolon character(;). When lengthy comments extend beyond the end of the source line (column 80), the comment may be resumed in a following 1line. Such a 1line must contain a leading semicolon, and it is suggested that the body of the comment be continued in the same columnar position in which the comment began. A comment line can also be included as an entirely separate line within the code body. Comments do not affect However, comments are debugging, assembly processing or program execution. useful in source listings for later analysis, or documentation purposes. Horizontal fmrm@ttlng of the source program is controlled by ‘the spaue and tab characters. These characters have no effect on process unless they are embedded within a symbol, the assembly number, or ASCII text string, or unless they are used as the operator field terminator. Thus, the space and tab characters can be used to prmvad@ ‘an orderly mmd readable fimwxww program, as rafl&ctafi by tha fmllmwmng statem@nts‘ LABELammv(S@}%WT&G,PQP VALUE OFF STACK. No spaces or ‘statement. tabs have Note been used to separate the fields in this the dafflaulty in recmgnizing wh&re ane fleld ends and the next begins. LABEL: Phis MOV @tat&%fmt (SP)+,TAG conforms ; POP to the VALUE OFF STACK. standard horizontal formatting conventions, i.e., the statement elements are aeparated distinct fields and are therefore easily discernible. intm four Page fntmattlng and assembly listing considerations are discussed 1in ,Chapter 6 in the context of MACRO-1l1l directives that may be specified accomplish desired formatting operations. Appamflxx E describes the coding conventions used in all DIGITAL PDP-11 0perat1ng system software. F 2-6 W, PART 11 PROGRAMMING IN MACRO-11 ASSEMBLY LANGUAGE CHAPTER 3 SYMBOLS AND EXPRESSIONS This chapter describes the components of MACRO-1ll instructions. The character set, the conventions observed in cmmatructmng symbols, and the use of numbers, operators, terms and expresaxmns are discussed as they relate to MACRO-1ll programming. | 3.1 CHARACTER SET The following characters are legal in MACRO-1l1 source programs: 1. The are letters A through Z. Both upperm and lower—-case letters acceptable, although, upon input, lmwarficmsa letters are converted to upper-case (see Section 6.2, .ENABL LC). 2. The digits 0 thraugh 9. 3. The,@h@ractara . (period) 4. The special charactars listed in Table 3-1. Table ~ - afidi $ characters are reserved for use Corporation system program symbols. (&ollar as sign). Digital 3-1 Special Characters Used in MACRO-11 Character Designation : Colon Label Double colon Label terminator; :: | . = Equal sign | Function label Direct terminator. as a global assignment and macro keyword = == % e These Equipment defines the label. operator; indicator. Double equal Direct assignment operator; sign defines the fiymbml as a global symbol. Percent sign Register term indicator. Tab Item or field terminator. Space Item or field terminator. (Continued on next page) SYMBOLS AND EXPRESSIONS Table 3-1 Special Characters (Cont.) Used | / Character Designation # Number sign @ At ( Left ) Right parenthesis . ‘Period Current location counter , Comma Operand field separator. ? Semicolon Comment field indicator. < Left angle Initial argfifient’ar'expression bracket 1ndlaatmr* Right angle bracket Terminal Plus sign Arithmetic > | + Function Immediate expression indicator. sign \Defe;red parenthesis Initial sion Minus sign i - * ' B Asterisk | addressing register | Terminal or - . in MACRO~11 p h indicator. indicator. # register indicator. argum&nt or 1nd1cator. N . | | expres- addltxan operator autoincrement indicator. ~Arithmetic subtraction operatmr or autodecrement indica- {0) Arlthmetlc multlpllcatlon op- | erator. | / Slash Arithmetic division operator. & Ampersand Logical AND ! Exclamation point | Logical " Double quote operator. inclusive OR operator. Double ASCII character U indica- tor. ' - Single SR - A\ | 3.1.1 Legal quote Single ASCII tor; or indicator. character indicaconcatenation * ‘Up arrow or Universal unary operator or circumflex argument ' Backslash indicator. Macro call numeric argument indicator. B Sepa:ating,and Delimiting Characters separatlng characters and legal argument below inTables 3- 2 and 3-3 respectively. delimiters are defined w LS AND EXPRESSIONS SYMBO Table 3-2 Legal Separating Characters One or more Space Usage Definition Character ceae fi. Sp aaa is spaces o alegal separator between 1n%trumt10n fleldm and ~and/or tabs between symbolic mrgum&ntg field. ~within the mperand Spaces within expreammmms mx@ kiqnmr@d (a&@Sactlmn 3.9). B Comma separatmr A~mammarifl“a arguments symbolic between field. operand within the used in expressions Multiple be must field - the operand ~ separated by a comma. Table 3-3 Legal Argument Delimiters Definition ‘Usage Paired angle brackets may be Paired angle brackets anywh@r@ in a program to used Character for an @H@K@&filmn ' enclose ‘single term. treatfi.n&~?aw Pair@& mngf@~braaketa are also macro a to enclose used when particularly argument, argument contains separthat Section ating characters (see 7.3). "XeooX Up=arrow ator) where (unary oper- construction, the up-arrow is by an argufollowed ment that is bracketed by any paired printing characters This construction 1is equiva- lent in function to the paired angle brackets described above only used generally 1is and where the argument itself contains angle brackets. (x). 1I1 legal Characters 3.1.2 A character is determined to be 111egal far an& mf two r@asmns~ 1. racognmzed MACRO-11 th@ mf element is not an A character of this kind is r&placed in the 'Wlmsting by a question mark, and an error code (I) is pxmnt@d in the assembly listing (see &ppandix D). ‘The exception to "this is an embedded null whlch, wh@n G@tected, terminates the scan of the current line. A character charaater set. 3-3 2. 3.1.3 A legal MACRO-1l1l character is illegal in the context of its usage within the source statement, 1i.e., its syntax is illegal or questionable. Such a character causes an error code (Q) to be printed in the assembly listing. Unary and Binary Operators Legal MACRO-ll unary operators are described in Table 3-4. Unary operators are wused 1in connection with single terms (arguments or operands) to indicate an action to be performed on that term during assembly. A term preceded by a unary operator is considered to contain that operator. The term so specified thus becomes a value which can be used alone or as an element of Table Legal Unary Operator 3-4 Unary Operators | Explanation + Plus an expression. | Example sign Effect +A Produces value - ~ Minus sign -A ,"Upwarrawr;uniVQr” { ~sal unary operator. (This usage. is | described in detail ‘in S@ctlon 6.4.) | - the positive of A. Produces the (2's complement) negative value of ~c24 | Produces the l's comple- “D127 Interprets 127 as a ment value of 24(8). im ~034 Interprets 34 as an octal number., "B11000111 | Interprets 11000111 as binary number. “"RABC Unary operators can be involving multiple used terms, as adjacent | to each shown below: a Evaluatéfi ABC in Radix-50 other or | | in constructions o e g950 - (Equivalent to =-<"D50>) “c 012 (Equivalent to "C<"012>) Legal MACR@wll binary operators are described in Tabla‘ 3-5. In ~contrast to unary operators, binary operators sp&clfy actions to be performed on multiple items or terms within an expression. Table 3-5 ~shows the relationships that can be establmfihed betwe@n-expression terms through the use of binary operatmrs.~n n ey SYMBOLS AND EXPRESSIONS Table 3-=5 Legal Binary Operators Binary Operator All Explanation Example + Addition - A+B - Subtraction * Multiplication A*B (l6-bit product returned) / Division A/B & Logical AND A&B ! Logical A!B | A-B (l6-bit gquotient returned) inclusive OR binary operators have equal priority. Items or terms can be grouped for evaluation within an expression by enclosing them within angle brackets. Terms so enclosed are evaluated first, and remaining operations are performed from left to right, as shown in the examples below: . WORD - WORD 3.2 1+2%*3 14+<2%*3> ;EQUALS 11(8). ; EQUALS 7(8). MACRO-11l SYMBOLS Three types of symbols may be defined for use within MACRO-1ll source programs: permanent symbols, user-defined symbols, and macro symbols. MACRO-11 maintains three types of symbol tables: the Permanent Symbol Table (PST), the User Symbol Table (UST), and the Macro Symbol Table (MST). The PST contains all the permanent symbols defined within (and thus automatically recognized by) MACRO-11 and is part of the MACRO-11l image. The UST and MST are constructed as the source program is assembled. 3.2.1 Permanent Symbols Permanent symbols consist of the instruction mnemonics (see Appendix C) and MACRO-11] directives (see Chapters 6 and 7 and Appendix B). These symbols are a permanent part of the MACRO-1ll image and need not be defined before being used in the operator field of a MACRO-1ll source statement (see Section 2.2.2). 3.2.2 User-Defined and Macro Symbols User—-defined symbols are those symbols treated by the programmer as labels (see Section 2.2.1) or that are equated to a specific value through a direct assignment statement (see Section 3.3) or appear as macro names or dummy arguments. These symbols are added to the User Symbol Table as they are encountered during assembly. Macro symbols are those symbols used as macro names these symbols are added to encountered during assembly. the Macro 3-5 (see Section 7.1). Symbol Table as Similarly, they are SYMBOLS AND EXPRESSIONS User-defined characters, character is and macro symbols dollar signs ($), illegal. can be composed and periods (.) of alphanumeric only; any other NOTE The dollar sign ($) and period (.) characters are reserved for wuse 1in defining Digital Equipment Corporation system software symbols. For example, READS is a file-processing system macro. The user is cautioned not constructing in order to following rules govern the these symbols to avoid possible or future Digital software symbols. The employ user-defined characters or macro in symbols conflicts with existing Equipment «creation Corporation of system user-defined and macro symbols: l. The in 2. The 3. A first character of a symbol must not be a number the case of local symbols; see Section 3.5). first symbol six can characters of a be written with symbol more must than be six (except unique. legal characters, but the seventh and subsequent characters are checked only for ASCII legality and are not otherwise evaluated or recognized by MACRO-11l. 4. Spaces, tabs, and illegal characters within a symbol. The legal MACRO-11l in Section 3.1. must not be embedded character set is defined The value of a symbol depends upon its use in symbol appears in the operator field, it may the program. When a be any one of the three symbol types described above i.e., permanent, user-defined, macro. To determine the value of an operator-field symbol, MACRO-1l1l searches the symbol tables in the following order: 1. Macro Symbol Table 2. Permanent Symbol 3. User-Defined Symbol Table Table This search order allows redefinition of Permanent Symbol Table entries as macro symbols. That is, permanent symbols may be used as macro symbols. But the user must keep in mind the sequence in which the search for symbols 1is performed in order to avoid incorrect interpretation of the symbol's use. When a symbol appears in Table is searched first, the operand field, the User-Defined Symbol then the Permanent Symbol Table is searched. Depending on their use in the have either attribute. a local through symbols one 'program, attribute or user~defined a global symbols (external) ; Normally, MACRO-11l their definition However, source (internal) of treats all user-defined symbols as local, that is, is 1limited to the module in which they appear. can be explicitly three methods: 3-6 declared to be global symbols SYMBOLS AND EXPRESSIONS l. Use of the 2. Use of .GLOBL directive the double colon (see Section 6.9). (::) in defining a label (see Section 2.2.1). 3. Use of the double equal (== statement (see Section 3.3). sign in a direct All symbols within a module that remain undefined assembly are treated as default global references. at assignment ~ the end of NOTE Undefined symbols at the assigned a value of 0 user—-defined symbol table end of assembly are and placed into the as wundefined default global references. If the .DSABL GBL directive is ~in effect, however, (see Section 6.2), the automatic global reference default function of MACRO-11] is inhibited, causing the statement containing the undefined symbol to be flagged with an error code (U) in the assembly 1listing (see Appendix D). | Global symbols provide linkages between independently-assembled object modules within the task image. A global symbol defined as a 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 DIRECT ASSIGNMENT STATEMENTS A direct assignment statement allows you to equate a for a direct assignment statement is: symbol to a specific value. When a direct assignment statement is first used to define a symbol, that symbol is entered into the User-Defined Symbol Table. A symbol defined in this manner may be redefined in a subsequent direct assignment statement by assigning a new value to the previously-defined symbol. The general format symbol=expression or symbol==expression where: expression , = can have only one level of forward .(see 5. below). reference - cannot contain an undefined global reference. A direct assignment statement embodying the double equal (==) shown above, defines the symbol as global (see Section 6.9). sign, as SYMBOLS AND EXPRESSIONS The following examples illustrate the coding of direct assignment statements: A=]1 ;THE SYMBOL A IS EQUATED TO THE : VALUE B=A-1&MASKLOW ;THE 1. SYMBOL B IS sVALUE OF THE sWHICH FOLLOWS. EQUATED TO THE ENTIRE EXPRESSION C: D=. E: MOV #1 ,ABLE ;THE SYMBOL D IS ;THE LABELS C AND ; VALUE ;OF THAT THE IS MOV EQUATED TO ., AND E ARE ASSIGNED EQUAL TO THE A LOCATION INSTRUCTION. The last of the three examples above is provided only to illustrate the performance of MACRO-1l in such situations. See Section 3.6 for a description of the period (.) as the current location counter symbol. The following conventions apply to the coding of direct assignment statements: l. An equal sign symbol from (=) the or double equal sign (==) must separate the expression defining the symbol's value. Spaces preceding and/or following the operators, although permissible, have no resulting value. 2. The symbol being assigned in placed in the label field. 3. Only one symbol can be a direct defined in a direct assignment significance in the ~ assignment single direct statement is assignment statement. 4. A direct assignment comment field. 5. Only the statement one level of forward following example: X=Y (Illegal Y=2 (Legal be referencing forward forward may followed is allowed, only as by a shown in reference) reference) z=1 The above example would result in the assembly 1listing on reference. in the generation of an error code (U) the line containing the illegal forward Although one 1level of forward referencing 1is allowed for 1local symbols, a global symbol defined in a direct assignment statement must not contain a forward reference, i.e., the global assignment expression must not itself contain an undefined reference to another symbol. Such a forward reference is illegal, causing an error code (A) to be generated in the assembly listing. SYMBOLS AND EXPRESSIONS 3.4 REGISTER SYMBOLS The eight general registers of the PDP-1ll1 processor are numbered 0 through 7 and can be expressed in the source program in the following manner: 30 3l ® 37 where % indicates a reference to a register rather than a location. The digit specifying the register can be replaced by any legal, absolute term that can be evaluated during the first assembly pass. Use standard symbolic names for all register references. The register definitions listed below are automatically assigned MACRO-11, i.e., these definitions are the normal default values remain valid for all register references within RO=%0 R1=%1 R2=%2 R3=%3 R4=%4 R5=%5 source program. sREGISTER 0 DEFINITION. ;REGISTER 1 DEFINITION. ;REGISTER 2 DEFINITION. ;REGISTER 3 DEFINITION. ;REGISTER 4 DEFINITION. sREGISTER 5 DEFINITION. SP=%6 PC=%7 Note the by and ~ that unique registers ;STACK POINTER DEFINITION. ; PROGRAM COUNTER DEFINITION. 6 and 7 are given special system functions. names because of their | A register symbol may be defined in a direct assignment statement appearing 1in the program. The defining expression of a register symbol must be a legal, absolute value. Although you can reassign the standard register symbols through the use of the .DSABL REG directive (see Section 6.2), this practice is not recommended. 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 1listing. The symbolic default names assigned to the registers, as listed above, are the conventional names used in all DIGITAL-supplied well advised to PDP-1l follow system programs. these All non-standard register symbols must referenced in the source program. A or greater listing. The % than character specify a is may register. CLR CLR flagged with be used with For example, in function an error any the to the register 3-9 4. code legal (R) term statement statement %4 the contents of this reason, vyou are be defined before they are register expression less than 0 %$3+1 is equivalent and clears 7 For conventions. in or the assembly expression to SYMBOLS AND EXPRESSIONS In contrast, the 4 CLR clears 3.5 the statement contents of virtual memory location 4. LOCAL SYMBOLS Local symbols are specially formatted symbols used as labels within a block o0f 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: 1$ 279 59§ 1045% A local symbol block is delimited in one of three ways: 1. The range of a local symbol block usually consists of statements between two normally-constructed symbolic (see Figure 3-1). Note that a statement of the form: those labels ALPHA=expression is a direct assignment 2. statement not <create a label local symbol block. and The symbol range of a local thus block encountering a .PSECT, .CSECT, source program (see Figure 3-1). 3. The range of a 1local MACRO=-11 directives, as not is or symbol block follows: Starting delimiter: .(ENABL Ending .ENABL delimiter: (see Section does LSB delimit normally 3.3), but the range terminated .ASECT directive 1is does delimited (see Section 6.2) (see Section 6.2) in of a upon the through LSB or .DSABL LSB followed by one of: .PSECT .CSECT .ASECT (see Section (see Section (see Section Symbolic label 6.8.1) 6.8.2) 6.8.2) 10 I W Local symbols provide a convenient means of generating 1labels for branch instructions and other such references within a local symbol block. Using local symbols reduces the possibility of symbols with multiple definitions appearing within a user program. In addition, the use of local symbols differentiates entry-point labels from local labels, since 1local symbols cannot be referenced from outside their respective local symbol block. Thus, local symbols of the same name can appear. in other 1local symbol blocks without conflict. Local symbols do not appear in cross-reference listings. SYMBOLS AND EXPRESSIONS Local symbols require less symbol table space than other types of symbols. Their use is recommended. When defining local symbols, use the range from 1$ to 63% first, then the range from 1285 to 655358. Local symbols within the range 64$ through 127%, inclusive, can be generated automatically as a feature of MACRO-1ll. Such local symbols are useful in the expansion of macros during assembly and are described in detail in this context in Section 7.3.5. Be sure to avoid multiple definitions of local symbols within the same local symbol block. For example, if the local symbol 10§ is defined two or more times within the same 1local symbol block, each symbol represents a different address value. Such a multi-defined symbol causes an error code (P) to be generated in the assembly listing. For examples of local in a source program, symbols 121 ) 123 124 125 ooveen 0ARPR4 128 Q200NR6 129 Qo012 130 symbol blocks as they appear PROGRAM INITIALIZATION CODE ) 126 240200 131 local 3-1. ) 122 127 and see Figure o0o00pe 21270¢ oQe2000! @22709 121374 QReoeer! 005720 LPSECTY XCTPRGreMOV | 181 - CLR XCTPRG,GBL #IMPURE ,RD ‘ +PSECT XxCTPAS,GBL 012700 opo0oR! XCTPASt MOV HIMPRPAS,RD 134 PPORRE 135 9neas2 P227¢0 121374 PAPARO! CMp Bml BIMPPAT,RD 1% 212700 eeopo@! 136 137 ee0ape 138 2000232 139 200004 140 20206 141 200012 142 Q05020 Q05020 P22702 141374 Figure 3.6 181 3-1 CLR PSECT 18 CLR cMp Bml INITIALIZATION ' JPASS INITIALIZATION (RP) XCTLINIIMQV eRRRAR! | HIMPURT,RQ 1% 132 ooveed 133 200024 JIMPURE DATA (RBY)s CMP Bml : XCTLIN,GBL : fl BRIMPLIN,RD JLINE INITIALIZATION (RRYe BIMPLIT,RD 1% V Assembly Listing Showing Local Symbol Block CURRENT LOCATION COUNTER The period (.) is the symbol for the current location counter. When used in the operand field of an instruction, it represents the address of the first word of the instruction, as shown in the first example below. When wused in the operand field of a MACRO-1ll directive, it represents the address of the current byte or word, as shown in the second example below. A: (The - #.,R0 MOV function of the ;THE PERIOD (.) REFERS TO THE ADDRESS ;OF # symbol THE MOV INSTRUCTION. is explained in Section 5.9.) SAL=0 .WORD 177535,.+4,SAL ;THE OPERAND .+4 ;DIRECTIVE IN THE REPRESENTS ;THAT IS STORED AS THE ;OF THREE WORDS DURING .WORD A VALUE SECOND ;ASSEMBLY. Assume that the current value of the location counter assembly, MACRO-11l reserves storage in response to the (see Section 6.3.2), beginning with 1location 500. accompanying the .WORD directive determine the values 3-11 is 500. During .WORD directive The operands so stored. The SYMBOLS AND EXPRESSIONS value 177535 is thus stored in location 500. The value represented by .+4 is stored in location 502; this value is derived as the current value of the location counter (which is now 502), plus the absolute value 4, thereby depositing the value 506 in location 502. Finally, the value of SAL, previously equated to 0, is deposited in 1location 504. Figure 3-2 illustrates the Figure result of the example. LOCATION CONTENTS 500 177535 502 506 504 0 3-2 Sample Assembly Results At the beginning of each assembly pass, MACRO-1ll resets the 1location counter. Normally, consecutive memory locations are assigned to each byte of object data generated. However, the wvalue of the 1location counter can be changed through a direct assignment statement of the following form: .=expression Similar to other MACRO-1ll symbols, the current location counter (.) has an attribute of relocatability associated with it: symbol it is either absolute or relocatable, depending on the specific such attribute of the current program section. (A program section and its attributes are defined through the wuse of the .PSECT directive described in Section 6.8.1.) The existing attribute (or mode) of the current location counter cannot be changed by specifying a defining expression having a different attribute. Furthermore, such a defining expression must not force the 1location counter 1into another program section (.PSECT area), even though the program sections so involved may both be absolute or relocatable. The expression defining the 1location counter value must not contain a forward reference, i.e., the expression must not contain a reference to a symbol that 1is not previously constitute a general assembly error, the assembly Thus, the defined. Such violations resulting in an error code (A) the attribute attribute of (or mode) the of the current location counter current program section. takes on Therefore, attribute from program section to program section can be changed through the program sectioning directives (.PSECT, .ASECT, .CSECT), as described in Section 6.8. The following coding counter: in listing. illustrates the | 3-12 wuse of the current 1its only and 1location SYMBOLS AND EXPRESSIONS .ASECT .=500 ; SET LOCATION COUNTER TO ; ABSOLUTE FIRST: MOV .+10,COUNT 500 (OCTAL). ; THE LABEL "FIRST" HAS THE VALUE ;500 (OCTAL) . THE 3.+10 EQUALS 510 (OCTAL). ; CONTENTS OF THE LOCATION ;510 (OCTAL) WILL BE DEPOSITED ;IN THE LOCATION "COUNT." ; THE ASSEMBLY LOCATION COUNTER .=520 | SECOND: MOV . , INDEX ;NOW HAS A VALUE OF | ; ABSOLUTE 520 (OCTAL) . ; THE LABEL SECOND HAS THE ; VALUE 520 (OCTAL). ; THE CONTENTS OF LOCATION 3520 (OCTAL), THAT IS, THE BINARY ;CODE FOR THE INSTRUCTION ; ITSELF, WILL BE DEPOSITED ; LOCATION "INDEX." .=.+20 .PSECT IN THE ;SET LOCATION COUNTER TO ; RELOCATABLE 20 OF THE ; UNNAMED PROGRAM SECTION. THIRD: .WORD 0 ; THE LABEL THIRD HAS THE ;VALUE OF RELOCATABLE 20. Storage areas may be reserved in the program by advancing the location counter. For example, if the current value of the location counter is 1000, each of the following statements: — | | =.+40 or .BLKB 40 or .BLKW 20 reserves 40(8) bytes of storage space 1in the source program. The .BLKB and .BLKW directives, however, are recommended as the preferred ways to reserve storage space (see Section 6.5.3). 3.7 NUMBERS MACRO-11 assumes that all numbers in the source program are to be 1nterpreted in octal radix, unless otherwise specified. An exception to this 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 radix control operators (see Section 6.4.1.2). For every statement in the source program that contains a digit that is not in the <current radix, an error code (N) is generated in the assembly listing. However, MACRO-1ll continues with the scan of the statement and evaluates each such number encountered as a decimal value. 3-13 SYMBOLS AND EXPRESSIONS Negative numbers must such numbers translates may (but need not) be be preceded into two's preceded by by a minus complement a plus sign; form. in the Numbers not assembly listing. always considered are to be absolute values, greater than an error code i.e., they are relocatable. Single-word floating-point numbers may be generated with operator (see Section 6.4.2.2) and are stored in the following 15 14 7 Sign Bit 8-bit Exponent 6 to the appropriate PDP-11 floating=point number format. A the °F format: 0 7-bit Mantissa Refer 3.8 numbers sign. A number contalnlnq more than 16 significant bits, i.e., 177777(8), is truncated from the left and flagged with (T) MACRO-11 Positive Processor Handbook expression and for details of the of the value is TERMS term is a component of an may be one following: 1. A number, as defined in Section 3.7, as defined follows: in Section 3.2. whose 1l6-bit used. 2. A symbol, as a. are A period (.) specified in an expression causes of the current location counter to be used. b. A defined Table c. symbol (UST) A permanent substituted all op codes d. - 3. Symbols and is its symbol's for and located value is basic in the evaluated the User-Defined value Symbol used. value the addressing their values.) 1is modes. wused, with zero (Appendix C lists An undefined symbol is assigned a value of =zero and inserted in the User-Defined Symbol Table as an undefined default global reference. If the .DSABL GBL directive (see Section 6.2) 1is in effect, the automatic global reference default function of MACRO-1l1l is inhibited, in which case, the statement containing the undefined symbol is flagged with an error code (U) in the assembly listing. A single quote followed by a single ASCII character, or a double quote followed by two ASCII characters. This type of expression construction is explained in detail in Section 6.3.3. 3-14 SYMBOLS AND EXPRESSIONS 4., A term may also be an expression enclosed in angle brackets (<>). Any expression so enclosed is evaluated and reduced to a single term before the remainder of the expression in which it appears is evaluated. Angle brackets, for example, may be used to alter the left-to-right evaluation of expressions (as in A*B+C versus A*<B+C>), or to apply a unary operator to an entire expression (as in =<A+B>). 5. 3.9 A unary operator followed by a symbol or number. EXPRESSIONS Expressions are combinations of terms J@lned together by binary operators (see Table 3-5) and which reduce to a 1l6-bit expression value. The evaluation of an @Xpt&fifil@fi includes the determination of its attributes. A resultant expression value may be any one of four types (as described later in this section): absolute, relocatable, external, or complex relocatable. bt : | | Expressions are evaluated from left to right with no operator hierarchy rules, except that unary operators take precedence over binary operators. A term preceded by a unary operator 1is considered to contain that operator. (Terms are evaluated, where necessary, before their use in expressions.) Multiple unary operators are valid and are treated as follows: o -\ to: is equivalent =<L+L=A>> A missing term, expression, or external symbol Zero. A m1351ng or illegal analyala, causing an error code in the itself. assembly 1listing, For example, ! TAG 1is interpreted as a operator terminates the expression (A) or (Q),or both, to be generated dep@milng on the cant@xt of the expression the expression: LA 177777 is evaluated as ! TAG LA because the first non-blank character following the symbol LA is not a legal binary operator, an expression separator (i.e., a comma), or an operand field terminator (i.e., a semicolon or the end of the source line). It should be noted that spaces within expressions are ignored. The value of an external expression is absolute part of that expression. equal For to the example, wvalue the of the expression EXTERN+A, where "EXTERN" is an external symbol, has a value at assembly-time that is equal to the value of the internal symbol A. This expression, however, when evaluated at link time takes on the resolved value of the symbol EXTERN, plus the value of symbol A. Expressions, four types: relocatable. l. when evaluated by MACRO-11l, are determined to be one of absolute, relocatable, external (or global), or complex The following distinctions are important: An expression 1is absolute expression whose terms are 3-15 if its wvalue 1is fixed. An numbers and ASCII conversion SYMBOLS AND EXPRESSIONS characters will expression or reduce to an absolute value. term minus a relocatable A relocatable term, where both elements being evaluated belong to the same program section, are also absolute, since such an expression is reduced to a single term by MACRO-1l upon completion of the expression scan. 2. For expression absolute expression. Terms absolute section will have defined in the where program section, that an contain absolute labels both TAGl is defined an in an value. expression is relocatable if its value is fixed relative to the base address of the program section in which it appears, but it will have an offset value added at link time. Terms that contain labels defined 1in relocatable program sections will have a relocatable value; similarly, a period (.) in a relocatable program section, representing the value current An expression location counter, is external will also (or global) have a relocatable if it contains a single global reference (plus or minus an absolute expression value) that is not defined within the current progranm. Thus, an assembly An expression and must be is complex applies: = It contains a = It contains more - It contains program = is only partially defined resolved at link time. expression conditions The global relocatable reference than relocatable terms belonging from introduced, = An since each bias operation in = An evaluation is of at has link symbol. to different more for than is evaluated the than one in addition external, time. terms of the program section. is specified than addition, subtraction, specified for a relocatab}e relocatable, completed symbol symbol. operation other complementation is expressions expression following For example, 1if the relocatable associated with the same program in an expression construction in the levels of relocation would be effect other undefined global the following the relocatable reference. resulting relocation a any of global sections. value and if one level of relocation. symbols TAGl and TAG2 section are specified form TAGl+TAG2, two The TAG2-TAGl, same An external 4. the are of the value. -3. example, and TAG2Z and complex on an negation, or value. relocatable CHAPTER 4 RELOCATION AND LINKING The output of MACRO-1l1l is an object module that must be processed or linked before it can be loaded and executed. Essentially, linking fixes (i.e., makes absolute) the values of external or relocatable symbols in the object module, thus transforming the object module, or several such object modules, into an executable image. To allow the value of an expression to be fixed at link time, MACRO-1l outputs certain directives 1in the object file, together with other required parameters. In the case of relocatable expressions in the object module, the base of the associated relocatable program section is added to the value of the relocatable expression provided MACRO-11l. 1In the case of external expression values, the value of external term in the expression (since the external symbol must by the be defined in one of the other object modules being linked together) is determined and then added to the absolute portion of the external expression, as provided by MACRO-1l. | All instructions that require modification at link time are flagged in the assembly 1listing, as 1illustrated in the example below. The apostrophe (') following the octal expansion of 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: 005065 CLR 000000G EXTERN (R5) ;THE VALUE OF THE SYMBOL "EXTERN" ;ASSEMBLED AS ZERO AND IS ;RESOLVED AT 005065 G CLR . | EXTERN+6 (R5) LINK IS TIME. ;THE VALUE OF THE SYMBOL "EXTERN" ; IS RESOLVED AT LINK TIME ;AND ADDED TO THE ABSOLUTE ; PORTION (+6) OF THE EXPRESSION. 005065 000040" CLR RELOC (R5) ;ASSUMING THAT THE VALUE OF THE ; SYMBOL "RELOC" IS RELOCATABLE ;40, THE RELOCATION BIAS ;WILL BE ADDED TO THIS VALUE. 005065 CLR 000000C -<EXTERN+RELOC> (R5) ;THIS EXPRESSION IS COMPLEX s RELOCATABLE BECAUSE IT REQUIRES ;THE NEGATION OF AN EXPRESSION ; THAT CONTAINS A GLOBAL "EXTERN" ; REFERENCE AND A RELOCATABLE TERM. For a complete description of object records output by MACRO-11l, refer to the applicable system manual (see Section 0.3 in the Preface). 4-1 i CHAPTER 5 ADDRESSING MODES The program counter (PC) always contains the address of the next word to be fetched, i.e., the address of the next instruction to be executed, or the second or third word of the current instruction. In order to understand how the address modes operate and how assemble, the action of the program counter must be understood. key rule to remember they The is: "whenever the processor implicitly uses the program counter (PC) to fetch a word from memory, the program counter is automatically 1ncrem@ntad by 2 after th@ fetch operation completed." In the case of 2- or 3-word instructions, fetch the following words as well. The following symbols are throughout this chapter: is any expression, used in the processor uses the PC to describing addressing in Chapter modes l. E 2. R is a register expression, i.e., any expression containing a term preceded by a percent sign (%) or a symbol previously equated to such a term, as shown in the examples below: RO=%0 R1=R0+1 R2=1+%1 as defined is ;GENERAL REGISTER 0. ;GENERAL REGISTER 1. ;GENERAL REGISTER 2. The symbol R may also represent any of register definitions (see Section 3.4). 3. the normal default ER is a register expression or an absolute expression in range 4. 3. 0 to 7, A is a general inclusive. the | addressing specification which produces a 6-bit mode address field, as described in the PDP-l1l Processor Handbooks. The addressing specification, A, is described in terms of E, R, and ER, as defined above. Each addreflsxng specification within this section is illustrated using either the single operand instruction CLR or the double operand instruction MOV. 5.1 REGISTER MODE The register itself (R) contains the operand to be manipulated by instruction. 5-1 the ADDRESSING MODES - Format for A: R Example: CLR 5.2 The by R3 ;CLEARS REGISTER 3. REGISTER DEFERRED MODE register the Format (R) contains the address of the operand to be manipulated instruction. for A: @R or (ER) Examples: | CLR @R1 CLR CLR 5.3 sALL THESE INSTRUCTIONS CLEAR (R1) (1) s THE WORD AT THE ADDRESS s CONTAINED IN REGISTER 1. AUTOINCREMENT MODE The contents of the register being used as Format for A: the address of (ER) are the incremented operand (see Note immediately below). (ER) + Examples: CLR (RO) + CLR CLR (R4) + (R2)+ | s EACH INSTRUCTION CLEARS : THE WORD AT THE ADDRESS s CONTAINED IN THE SPECIFIED +REGISTER AND INCREMENTS ; THAT REGISTER'S CONTENTS +BY TWO. NOTE Certain special combinations, not which operate processors, ifistruction/address are exactly as rarely the described same or never on mode used, all do PDP-11 below. In the autoincrement mode, both the JMP and JSR instructions autoincrement the register before its use on the PDP-11/40, but not on the PDP-11/45 or 11/10. 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 is evaluated as the autoincremented or autodecremented value, register, at the time the originally-intended following example, as Register 0 originally but the destination it is used, still contains effective address. 1In the executed on the PDP-11/40, contains 100(8): after ADDRESSING MODES MOV RO, (RO) + ; THE QUANTITY 102 IS MOVED MOV RO,-(RO) ; THE QUANTITY 76 IS MOVED ; TO LOCATION 100. ; TO LOCATION 100. The use of these forms should they be avoxded, - since are not compatible with the entire family of PDP-11 processors. An error code with listing (2) 1is printed 1in the aasembly not 1is which instruction each compatible among all members of the PDP-11 family. 5.4 AUTOINCREMENT DEFERRED MODE the operand. The register (ER) contains a pointer to the address of The contents of the register are incremented after being used as a pointer. Format for A: + @ (ER) Example: CLR | 5.5 @ (R3)+ ; THE CONTENTS OF REGISTER 3 POINT :TO THE ADDRESS OF A WORD TO BE ; CLEARED BEFORE THE CONTENTS OF THE ; REGISTER ARE INCREMENTED BY TWO. AUTODECREMENT MODE The contents of the register (ER) are decremented before being used as the address of the operand (see Note above in Section 5.3). Format for A: - (ER) Examples: 5.6 CLR - (RO) CLR CLR - (R3) - (R2) : DECREMENT THE CONTENTS OF THE SPECIsFIED REGISTER (0, 3, OR 2) BY TWO :BEFORE USING ITS CONTENTS :AS THE ADDRESS OF THE WORD TO BE : CLEARED. AUTODECREMENT DEFERRED MODE The contents of the register (ER) are decremented before being used as a pointer to the address of the operand. Format for A: @- (ER) Example: CLR @- (R2) s DECREMENT THE CONTENTS OF sREGISTER 2 BY TWO BEFORE sUSING ITS CONTENTS AS A POINTER ;TO THE ADDRESS OF THE WORD TO BE ; CLEARED. 5-3 ADDRESSING MODES 5.7 The INDEX MODE value of an expression (E) is stored as the second or third word of the instruction. The effective address of the operand is calculated as the value of E, plus the contents of register ER. The value E is the offset of the instruction, and the contents of register ER form Format the for base. A: E (ER) Examples: CLR X+2 (R1) MOV RU, -2 (R3) ;THE EFFECTIVE ADDRESS OF THE WORD ;TO BE CLEARED IS X+2, PLUS THE ; CONTENTS OF REGISTER 1. ; THE EFFECTIVE ADDRESS OF THE ;DESTINATION ;THE 5.8 LOCATION CONTENTS OF IS -2, REGISTER PLUS 3. INDEX DEFERRED MODE An expression (E), plus the contents of a register (ER), vyields a pointer to the address of the operand. As in index mode above, the value E is the offset of the instruction, and the contents of register ER form Format the base. for A: @E (ER) Example: CLR @114 (R4) ; IF REGISTER ;VALUE, PLUS 4 CONTAINS THE OFFSET 100, THIS 114, YIELDS 214. IF LOCATION 214 ; CONTAINS THE ADDRESS 2000, LOCATION ;2000 WOULD BE CLEARED. ;THE 5.9 POINTER IMMEDIATE MODE Immediate mode allows the operand itself second or third word of the instruction. autoincrement of the PC. Format for A: (E) to This mode be is stored as the assembled as an #E Examples: MOV MOV The #100, R0 #X,R0 :MOVE THE VALUE 100 INTO REGISTER O. ;MOVE THE VALUE ;REGISTER 0. OF SYMBOL X INTO number sign (#) in the MACRO-11 character set has special significance as an addressing mode indicator. When this character appears in the operand field, as shown above, it specifies the immediate addressing mode, indicating to MACRO-1l1l that the operand itself immediately follows the instruction word. ADDRESSING MODES The operation of this mode can be shown through MOV #100,R0, which assembles as two words: Location 20: 01 2 7 0 0 Location 22: 0 0 01 Location 24: Next instruction the first example, 0 O Note that the source operand (the value 100) is assembled immediately following the instruction word, i.e., as the second word in the instruction. Upon execution of the instruction, the processor fetches the first word (MOV) and increments the PC by 2 so that it points to location 22 (which contains the source operand). After the next fetch and increment cycle, the source operand (100) moved into register next instruction). 5.10 ABSOLUTE MODE 0, is leaving the PC pointing to location 24 (the Absolute mode is the equivalent of immediate mode deferred. The address expression @#E specifies an absolute address which is stored as the second or third word of the instruction. In other words, the value immediately following the instruction word is taken as the absolute address of the operand. Absolute mode 1is assembled as an autoincrement deferred of the PC. Format for A: Q#E Examples: MOV @#100,R0 CLR Q#X ;MOVE THE CONTENTS OF ABSOLUTE ; LOCATION 100 INTO REGISTER RO. ;CLEAR THE CONTENTS OF THE LOCATION ;WHOSE ADDRESS ;THE SYMBOL X. IS SPECIFIED BY The operation of this mode can be shown through MOV@#100,R0, which assembles as two words: Location 20: 01 3 7 0 0 Location 22: 0 0 0 1 Location 24: Next instruction the first example, 0 O Note that the absolute address 100 is assembled immediately following the instruction word, i.e., as the second word in the instruction. Upon execution of the instruction, the processor fetches the first word (MOV) and increments the PC by 2 so that it points to location 22 (which contains the absolute address of the source operand). After the next fetch and increment cycle, the contents of absolute address 100 (the source operand) are moved into register pointing to location 24 (the next instruction). 5.11 0, leaving the PC RELATIVE MODE Relative mode is the normal mode for memory references within your program. It is assembled as index mode, using the PC as the index register. 5-5 ADDRESSING MODES Format for A: E Examples: CLR 100 ;CLEAR ABSOLUTE MOV RO, Y sMOVE ; TO THE LOCATION CONTENTS LOCATION OF 100 REGISTER O Y In relative mode, the offset for the address calculation is assembled as the second or third word of the instruction. This value is added to the contents of the PC (the base register) to yield the address of the source operand. The MOV operation of 100,R3, which Note that relative mode can be as two words: assembles Location 20: O 1 6 7 0 3 Location 22: 0 0 0 0 5 4 Location 24: Next the constant 54 shown and increments the statement instruction is assembled immediately instruction word, 1i.e., as the second word execution of the instruction, the processor (MOV) with the PC by 2 so that following in the instruction. fetches the first it points to the Upon word location 22 (containing the value 54). After the next fetch and increment cycle, the processor calculates the effective address of the source operand by taking the contents of location 22 (the offset) and adding it to the current value of the PC, which now points to location 24 (the next instruction). Thus, the source operand address is the result of the calculation OFFSET+PC = 54+24 = 100(8), causing the contents of location 100 to be moved into register 3. Since MACRO-11l considers the contents of the current location counter (.) as the address of the first word of the instruction, an equivalent index mode statement is shown below: MOV 100-.-4 (PC) ,R3 This instruction has a relative addressing mode because address 1is calculated relative to the current value of counter. The offset is the distance (in bytes) between and the current value of the location counter. the the the operand location operand 5.12 RELATIVE DEFERRED MODE The relative deferred mode is similar in operation to the relative mode above, except that the expression E is used as a pointer to the address of the operand. 1In other words, the operand following the instruction word is added to the contents of the PC to yield a pointer to the address of the operand. Format for A: QE Example: MOV @X,R0 ;sRELATIVE sTHE PC, s LOCATION ;TO BY TO THE MOVE CURRENT VALUE THE WHOSE LOCATION CONTENTS ADDRESS X INTO IS OF OF THE POINTED REGISTER 0. ADDRESSING MODES 5.13 SUMMARY OF ADDRESSING FORMS Each PDP-11 instruction takes at least one word. listed below do not increase the length of Form Operands of the form instruction. Meaning R Register mode @R or (ER) Register deferred mode (see Note below) (ER) + Autoincrement mode @(ER) + Autoincrement deferred mode - (ER) Autodecrement mode @- (ER) Autodecrement deferred " ) Operands of for occurrence each an the following of Form The syntax Additional an forms add operand one word of | that Index mode QE (ER) Index #E Immediate mode Q#E Absolute E Relat{;e mode QE Relative the addressing discussion of applicable PDP-11 to the instruction deferred mode mode (see Note deferred modes 1is addressing below) mode summarized in Appendix modes 1is provided in Processor Handbook. NOTE An alternate form @(ER) equivalent > form 1is to for only the @R is (ER). logically, but expression However, the not physically @0 (ER) . The addressing form Q#E differs from form E 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 and the PC. Thus, the instruction CLR @#100 clears absolute location 100, even if the instruction 1is moved from the point at which it was assembled. See the description of the .ENABL AMA length - form: Meaning E (ER) of mode function 1in Section relative mode addresses absolute mode addresses. 6.2, which causes to be assembled all as B. the ADDRESSING MODES 5.14 BRANCH INSTRUCTION ADDRESSING The branch instructions are l-word instructions. The high-order byte contains the operator, 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: 1. Extends 2. Multiplies than 3. the sign the a word of the result by offset 2, through creating bits a 8-15. byte offset rather offset. Adds the result to the current effective branch address. value of the PC to form the MACRO-11 performs the reverse operation to form the word offset from the specified address. Remember that when the offset is added to the current value of the PC, the PC is pointing to the word following the branch instruction; hence, the factor -2 in the following calculation: Word Since the value Word In using offset of the offset branch following error (E-PC)/2 PC = = .+2, truncated to eight we have: (E-.-2)/2 truncated to eight instructions, you bits. must exercise bits. care to avoid the conditions: l. Branching from one 2. Branching to a 1location (global) symbol; or 3. Specifying a branch address that is out of range, i.e., the branch offset 1is a value that does not lie within the range -128(10) to +127(10). The above conditions assembly listing for 5.15 = TUWSING TRAP program section that 1is cause an error code (A) the statement in error. to another; defined to be as an generated external in the INSTRUCTIONS The EMT and TRAP instructions do not use the low-order byte of the instruction word, allowing information to be transferred to the trap handlers in the low-order byte. If the EMT or TRAP instruction is followed by an expression, the value of the expression is stored in the low-order byte of the word. However, if the expression is greater than 377(8), it 1is truncated to eight bits and an error code (T) is generated in the assembly listing. 5-8 PART MACRO-11 III DIRECTIVES Chapters 6 and 7 describe all the directives used with MACRO-11. Directives are statements that cause MACRO-1l1l to perform certain operations during assembly. Chapter 6 describes several types of directives, including those which control symbol interpretation, listing header material, program sections, data storage formats, and assembly listings. Chapter 7 describes those directives concerning macros, MACRO-11 macro arguments, directives can and repetitive be preceded coding by a sequences. label restrictions associated with specific directives) comment. A MACRO-1ll directive occupies the operator statement. Only one directive can be included in (subject to any and followed by a field of a source any given source line. The operand field may be occupied by one or more operands left blank; 1legal operands differ with each directive specified. or CHAPTER 6 GENERAL ASSEMBLER DIRECTIVES This category of directives 1. Listing 2. Function control 3. Data 4, Radix and 5. Location counter 6. Terminators 7. Program boundaries 8. Program sectioning 9. Symbol includes: control storage numeric control control control 10. Conditional assembly 11. PAL-11R conditional assembly. Each is described in its own section of this chapter. 6.1 LISTING CONTROL DIRECTIVES Listing control directives control the content, format, and pagination of all 1line printer and teleprinter listing output generated during assembly. Facilities also exist for creating object module names and other identification information in the listing output. 6.1.1 .LIST and Listing control program through of the form: .NLIST Directives options can be specified in the the .LIST and .NLIST directives. .LIST .LIST .NLIST .NLIST arg arg text of a MACRO-11 These directives are GENERAL ASSEMBLER DIRECTIVES where: arg represents one or more of arguments defined in Table the 6-1. optional symbolic As indicated above, the listing control directives may be used without arguments, 1in 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 level count 1is incremented; at each occurrence of an .NLIST directive, the 1listing level count is decremented. When the listing level count is negative, the listing 1is suppressed (unless the 1line <contains an error). Conversely, when the 1listing 1level count is greater than zero, the listing is always generated. Finally, when the count 1is zero, the line is either listed or suppressed, contingent upon the other listing controls currently in effect for the program. For example, the following macro definition employs the .LIST and .NLIST directives to selectively list portions of the macro body when the macro is expanded: 7 7 A-THIS B-THIS .MACRO LTEST LINE SHOULD LIST ;LIST TEST ; LISTING LEVEL COUNT IS O. NLIST ; LISTING LEVEL COUNT IS -1. ; LISTING LEVEL COUNT IS -2. ; LISTING LEVEL COUNT IS -1. ; LISTING LEVEL COUNT ; LISTING LEVEL COUNT IS O. IS BACK TO LINE SHOULD NOT LIST SHOULD NOT LIST SHOULD LIST NLIST ; C-THIS ; D-THIS ; E-THIS LINE +LIST LINE NOT .LIST LINE SHOULD LIST 0. . ENDM .LIST ME s LIST LTEST ; ; A-THIS E-THIS LINE LINE MACRO ; CALL. THE SHOULD SHOULD LIST LIST EXPANSION. MACRO ; LISTING LEVEL COUNT ; LISTING LEVEL COUNT IS IS 0. BACK TO An important purpose of the level count is to allow macro to be listed selectively and yet exit with the listing restored to the value existing prior to the macro call. 0. expansions level count | When used with arguments, the listing directives do not alter the listing 1level count; however, the .LIST and .NLIST directives can be ‘used to override current listing control, as shown 1in the example below: .MACRO XX .LIST :LIST NEXT LINE. .NLIST . :DO NOT LIST REMAINDER OF MACRO s EXPANSION. X=. . ENDM .NLIST ME :DO NOT LIST MACRO EXPANSIONS. XX xm' The symbolic arguments allowed for use with the listing directives are described 1in Table 6-1. These arguments can be used singly or in combination with each other. If multiple arguments are specified in a listing directive, each argument must be separated by a comma, tab, or 6-2 GENERAL ASSEMBLER DIRECTIVES space. control For any argument not specifically 1included in statement, the associated default assumption (List a 1listing or No list) is applicable throughout the source program. The default assumptions the listing control directives also appear in Table 6-1. for Symbolic Arguments Argument SEQ* Table 6-1 of Listing Control Default List » Directives Function Controls the sequence 1listing numbers. of source MACRO-11 1line assigns sequence number 1 to the first source line in a file, and increments the sequence in number the for file. suppressed each additional If this through an line field .NLIST 1is SEQ directive, MACRO-1l1] generates a tab, effectively allocating space for the field, but fills the field with blanks. Thus, the inter-positional relationships of subsequent fields in the 1listing remain undisturbed. During the assembly process, MACRO-1ll examines each source line for possible error conditions. For any line in error, an appropriate error flag is printed preceding the line sequence number field (see Appendix D). MACRO-11 does not assign sequence numbers for files that have had sequence numbers assigned by other programs, such as an editor. LOC* List the 1listing of the current counter field. Normally, this not suppressed. However, if it is suppressed through the .NLIST LOC directive, MACRO-1l1l does not generate a tab, nor does it allocate space for the field, as is the case with the source line sequence number field (SEQ) described above. Thus, the suppression of the current 1location counter (LOC) field effectively left-justifies all subsequent fields (while preserving inter-positional relationships) to that position otherwise normally occupied by this field. BIN* List Controls Controls location field is the listing of generated binary code. If this field 1is suppressed through an .NLIST BIN directive, left-justification of the source code field occurs in the same = manner described above for the current location counter (LOC) field. - BEX List Controls the listing of binary extensions, i.e., the locations and binary contents beyond those that will fit on the source statement line. This is a subset of the BIN argument. | SRC* List Controls the listing of source lines. (Continued on next page) 6-3 GENERAL ASSEMBLER DIRECTIVES Table 6-1 (Cont.) Symbolic Arguments of Listing Control Argument COM Default List Directives Function Controls the listing of comments. This is a subset of the SRC argument. The .NLIST COM directive reduces 1listing time and space when comments are not desired. MD List Controls the definitions and MC List Controls the repeat range ME No list Controls the expansions. MEB No list Controls the listing of macro expansion binary code. A .LIST MEB directive causes only those macro expansion statements that generate binary code to be listed. This is a subset of the ME listing of macro repeat range expansions. listing of macro expansions. listing calls of and macro argument. CND List Controls the 1listing of unsatisfied conditional c¢oding and associated .IF and .ENDC directives 1in the source program. This argument permits conditional assemblies to be listed without including unsatisfied conditional coding. LD No Controls the 1listing of all 1listing directives having no arguments, i.e., those listing directives that alter the listing level count. TOC List Controls the listing of the table of contents during assembly pass 1 (see Section 6.1.4 describing the - SBTTL directive). This argument does not affect the printing of the full assembly listing during assembly pass 2. SYM List Controls the listing of the symbol table resulting from the assembly of the list source TTM List program. Controls the listing output format. The default can be set by the system manager. If the system manager does not set a default, it is set to line printer format. Figure 6-1 illustrates the 1line printer output format. Figure 6-2 illustrates the teleprinter output format. * If the .NLIST arguments SEQ, LOC, BIN, and SRC are in effect at the same time, i.e., if all four significant fields in the listing are to be suppressed, the printing of the resulting blank line is inhibited. 6-4 GENERAL ASSEMBLER DIRECTIVES An example of an assembly 1listing, as sent to a 132-column line printer, is shown in Figure 6-1. Note that binary extensions for statements generating more than one word are formatted horizontally on the source line. An example of an assembly listing, as sent to a teleprinter (in the Notice that binary extensions for statements generating more than one same format as for an 80U-column line printer), is shown in Figure 6-2. word are printed on subsequent lines. There is no explicit truncation of output to 80 characters by the assembler. Any argument specified in a .LIST/.NLIST directive listed code (A) in other than those Table 6-1 causes the directive to be flagged with an error in the assembly listing. The listing control options can also be specified at assembly time through switches included in the command string to MACRO-11 (see the appropriate system manual). The use of these switches overrides all corresponding 1listing control (.LIST or .NLIST) directives specified in the source program. v98c9/vgvc1ieee229v99pO02(s//G92ct1t1itl0P0eo8eeLI9BpPpVgE9oRTtTR020Vd 1i31g518Vd01§§1A323IOdv88vWA)]l 8¥)2(yNLOd3IIENS2VNT)8AI32=37R+?0(I@W82)"29+QI914W°3odL2)FIILNBNVSIiNSHCmIV’NNAS(OOIN2LI8LOH4)NTSO00dLH8!I¥HN33OIS43NIIH2NO1LN84S30DSH#J10I88LL3NIL3ON/V7W1¥3II7QWSvQi3v3LSN¥IgVNdI¥1SNI g6(p2@Z2.i(L1¢e0c0i9cLto2e0€det@couvRe12002 3g48Nlg1e 1(I3@69H4)wdL]lVIS*I'HOW"SOL‘wS39I¢AST¥Y3INHLOILNIVNQYOADVOINVWL[WINOMADNILIAN£AI8NTJ3dN8VIS “61t2(v¢@6B9gp0c1¢p£¢f22€v2Zm22e2p@92z9eP02pvA52€9EaOp/G9ilLeo9S96scvrcpvYp1Il1ti8l020Re0ovegIu®d@0QQ®e8de2Z©©L6(0Q20@9oVG99/9Cr2L/9L@Tl5102G9F2e@p1¢90f01T0Q029292Q0l011v0020o0@802RL8¢890Al00Y081c2Y0Ee2Poe09Qp2Lg0o0Tee2ant11I§53Nb20gTt1HLvId9Tl-91g1a2WV98wTiWgJ3$aNiE3LdI18SniQIAgvvldNO]isgdv1Wl)gIASW8AIL5oL)l92ydu38l(Bei2L(NT)$4O(rY(SNNEdP2rT@1R0@(eDd'I44‘EHLaNPv8IxX))RvN3n)])V¥M(x0PdLIA0Od9QbS2)eL0ET*33V0vEiST2+8LWL®‘+wQ.D2J)I’SoTQIj"70L®.oA%7*1Q*I2wLN24‘WdM7°4'aNI2E"(2H°ONuRa702D(r*WN(3°2P°*@(dHS)AH0WIoT)yLI‘Od“234¥AOLNnt10)8IIMFN3SW394I2¥3L9(LI8HINA°*4I3¢SPS7VvNEd2QH°tH3T4U‘¥ISN¢1%!J)Y5TIIQDISL04XN3iNvNv1ID4LW3IVSJaNMdLT“@LI2II8gNALEOrO3dvvOV/NTNSA#H4LYNIOInLQS0NAIIDAt(AWwNTAOT3NV0TSJ9INHqSq3!4V7tON43M¥WWS3Iw0IHNLQ2WedNSEL2IT9WgOl9vS1IV3svnI1NNd8SA94MN393B0vIT9NLS3i4SsVETO3ILNH0ty809NSATJOI4V38NdI0LSm3AILO$pN4S4WN8ON0JuIL/0VVXWT7S39Wt7LOIVId84N6a7aSNLESMYvNlvyOSIu)INTsJldvSOW3N34Tud8IS¥Tl¥TdyL4Vvu01ddv¥dVIdNINLS 0f3>MwM<mB=2OoHx)z L22 o012 LQv5iiIlySs2<6g98£2110Q22NY=9p29g€rcvo3e2EcSLttliWS1e0V3e]@ewdLA40Ng9POVeTRWdp1Ac9Ee6ORt21DTSOPINYONIBTR2YIeS3OMIVW(B/OW PL=7Sg31TN20Nd$§L[8gA1=l8IA62XS83*(W(Q%$Pv21dID3GSI8TN)1(OB8ON3MHV0)V128d3+76180ST9Y'Wd9SI$*%iO12Nd*H#°VIW3(Ox2W8dNs1SV3tO)9H¢D+S!%41L7SI8O4Fx1NON7L3I32vTSIO0HNH90I2¥TLH+YvNO0¥M3L¥GI3LWSIL¥Q2AI3O4N13ILTl1¥34v0dL40SHI4NI¥LuSvd e GENERAL ASSEMBLER DIRECTIVES T CSITS»= READ AND TESY PARSE OF CSI1 COMMAND AND CS12 LINES 211 212 213 214 215 216 201230 201244 201246 po1254 201300 2m1324 217 201326 218 291332 - 219 291336 220 221360 221 2014P4 222 201412 MB707 B9=JUL=74 15159 PAGE 5 JSBYTL READ AND PARSE COMMAND LINES GCMLS BCC EXITSS TYPE CS1sy BCC #GCLBLK 13 166016 suB C.CMLD*2(RB), (SP) Q2004 V 209 2102 MACRO 1023003 GETLNS 181 123064 ©16046 MOV e00R20 TYPE TYPE Q66060 ADD ‘200@16 200020 JGET LINE VIA GCML JSKIP IF NO ERROR JELSE, EXIT G,CMLD+2(R2),G,CMLD(R®),»'0 JSEND OUT THE INPUT LINE #CSIBLK,GCLBLK+G,CMLD*2,GCLBLK*G,CMLD 23 JBRANCH IF NO ERROR DETECTED C.,FILDe2(RR),~(SP) | JIPUT STRING ERROR ADDR IN STK JCALCULATE LENGTH OF FIRST PARTY , | C,FILD(RO),C,FILDe2(RB) JCALC ADDR OF (AST PART OF STRING ~ 162660 | C,CMLDe2(RB),(SP),#'S JSEND OUT FIRST PART OF STRING C.FILD#2(RQ),C,FILD(RB),n'S JSEND QUT SECOND PART ; suB (SPY+,C,CMLD(RA) JDEDUCT LENGTH OF FIRST PART sus C,FILD(RO),C .CMLD(RD) JCALC LENGTH OF LAST PARTY TYPE C.,FILD#2(RD)Y,C,CMLD(RB), %40 STX,42 GETLN JSEND SYNTAX ERROR MESSAGE JTRY FOR MORE 18T C.CMLD(RD) JCHECK LENGTH OF LINE BEG GETLN JIF NULL, SKIP BACK FOR NEXT LINE | , 220002 223 201416 224 701424 225 001450 226 PR1474 227 228 AM1476 229 201502 238 201504 231 Q01512 166060 eaQeR16 eoee0?2 TYPEM BR ©AR6ESS @AS5768 281 200002 Q81652 112767 MOVB e2R0N60 176432 BITR 132760 #'@,EQUBIT JSEND OUY LAST PART | - JASSUME EQUAL SIGN NOT FOUND #CS,EQU,C,STAT(RA)Y JCHECK STATUS 200n4R 232 201520 233 v21%22 220001 @142 176416 234 271526 1081 235 231852 236 2A1576 237 22a16@2 238 201620 239 02021622 240 201626 241 242 243 244 245 246 221634 221636 001662 201666 Q21704 201706 247 BA1712 BEQ 185267 OPARSE: 108 INCB EQUBIT TYPEM EOQU, 40 TYPEM Call CsIs2 OPT,42 INIT2 +OUTPUT,#SWTBL JSKIP IF EQUAL SIGN NOT SEEN JELSE, INDICATE EQUAL SIGN FOUND JSEND EGUAL SIGN STATUS MESSAGE JSEND OQUTPUT SCAN MESSAGE JINIT LOCNS FOR CSI2 CALL/TEST JPARSE OUTPUT SPEC ISKIP ON ERROR 1P344y BCS CS2ERR 1327680 BITB BCS,MOR,C,STAT(R@) BNE TYPEM CALL CsIs2 BCS CALL OPARSE 1IPT,d¢ INITZ » INPUT, #SWTBL CS2ERR EVALUB JYES, CONTINUE WITH QUTPUT SCAN JSEND INPUT SCAN MESSAGE JINIT LOCNS FOR CSI2 CALL/TEST BNE IPARSE PYES, CONTINUE wWITH INPUT SCAN CaLL eReV20 PoRRB! Q201360 IPARSE: 103407 1327680 8178 EvaLUB JEVALUATE RESULTS OF SEMANTIC PARSE jADDITIONAL OUTPUT SPECS? IPARSE INPUT SPEC )ISKIP ON ERROR JEVALUATE RESULTS OF SEMANTIC PARSE #CS,MOR,C,8TAT(R®) JADDITIONAL INPUT SPECS? 2ee20 248 001720 200001 201360 Figure 6-2 Example of Terminal Assembly Listing GENERAL ASSEMBLER DIRECTIVES Figure ©6-3 reflecting program and shows a 1listing, produced in 1line printer format, the use of the .LIST and .NLIST directives in the source the effects such directives have on the assembly 1listing output. 6.1.2 Page Headings MACRO-11l prints Figure ©6-1 or each assembly page in the Figure 6-2, depending on Table 6-1). On the first line following (from left to right): of each N W Date. Time-of-day. Page . Assembler > Title of the object module, as directive (see next section). Ul l. . . version format shown in either the listing mode (see TTM, page, MACRO-1ll established through prints the the .TITLE identification. number. The second line text specified 6.1.4). of each in the assembly listing page contains the subtitle last-encountered .SBTTL directive (see Section w02 w03 GENERAL ASSEMBLER DIRECTIVES X398 Qyom* X3g X38 03¢ Wil 013s 03s quom’® JVWiET x38°'W02 X38'wW02 1Y 6-9 LKL 68 piioee togae vénoe gaie 0 9ate0e 21 0 0 gt £€ 14Y ‘NIvVW® 4% 100000 conoee vioeee 1eeeaeo it (2 8e roe e v¢(o uo vid0 0 ot 1eeee0 JYWiST 1y l1evoe ecie e e O Y @ WD O N 0D O 61 12 6-10 lege e 9ce or vs0000 t£odeee " foveee NIg aceave vo0oee100000 9cQ000 14" &4 vcoeae Zlo e ez { 1e29e veeeee9 500200 bUT3lsSIpeonpoxdUYITMBUTISTTOIUODS®AT309ITd wan3* wil SIWLE ST Vv INIW OD ISvNImWMTLOt] ca'ypiogime’*liMs1Y9* J2vw0iE7" Li1sS1I®N® X38¢ SAvNIWILOHD Javyyowmi*ST X¢3'8pig2’l 39vd I *NIVW® vL=N[=60 62161 QHIVW’ JVYWLIET 94y GENERAL ASSEMBLER DIRECTIVES & o, o { 20vevY ve 8l §co0 0 2anbTJg GENERAL ASSEMBLER DIRECTIVES 6.1.3 .TITLE Dixective The .TITLE directive is used to assign a name to the object module as the first entry in the header of each page in the assembly listing. The name so assigned is the first six non-blank characters following the .TITLE directive. This name should be six Radix-50 characters or less in length; any characters beyond the first six are checked for ASCII 1legality, but they are not used as part of the object module name. For example, the directive: .TITLE PROGRAM TO PERFORM DAILY ACCOUNTING causes the assembled object module to be named PROGRA. Note that this 6-character name bears no relationship to the filename of the object module, as specified in the command string to MACRO-11l. 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 Librarian will recognize. | If the .TITLE directive is not specified, MACRO-1l1l assigns the default name .MAIN. to the object module. If more than one .TITLE directive is specified in the encountered establishes source program, the last .TITLE directive the name for the entire object module. All spaces and/or tabs up to the following the .TITLE directive are the text string. If the .TITLE directive is first non-space/non-tab character 1gn0r&d by MACRO-11 when evaluating specified without an object module name, or if the first non-space/non-tab character in the object module name is not a Radix-50 character, the directive 15 flagged with an error code (A) in the assembly listing. Section A.2 of Appendix A contains a table of Radix-50 6.1.4 The characters. .SBTTL Directive .SBTTL directive 1is wused to produce a table of contents immediately preceding the assembly 1listing and to further identify each page in the 1istingm In the latter case, the text following the .SBTTL directive 1is printed as the second line of the header of each page in the listing, continuing until altered by a subsequent .SBTTL directive in the program. For example, the directive: .SBTTL causes the CONDITIONAL ASSEMBLIES text CONDITIONAL ASSEMBLIES to be printed as the listing. second 1line in the header of the assambly During assembly pass 1, a table of contents is printed for the assembly 1listing, containing the 1line sequence number, the page number, and the text accompanying each .SBTTL directive. The 1listing of the table of contents 1is suppressed whenever an .NLIST TOC directive is encountered in the source program (see Table 6-1). An example of a table of contents listing 6-11 is shown in Figure 6-4. GENERAL ASSEMBLER DIRECTIVES CSITST TABLE == OF TEST 2= 55 Je 74 4=153 5-209 6-255 7=345%5 CSI1 AND CS12 MACRO M@787 0@9=JUL=74 15147 MACRO DEFINITIONS MESSAGE STRINGS MISCELLANEOUS ODATA READ AND PARSE COMMAND LINES EVALUATE THE SEMANTIC ANALYSIS SUBROUTINES Figure 6.1.5 OF CONTENTS 6-4 Assembly Listing Table of Contents LJIDENT Directive The .IDENT directive provides an additional means of labeling the object module produced by MACRO-11l. 1In addition to the name assigned to the object module with the .TITLE directive (see Section 6.1.3), a character string up to six Radix-50 characters can be specified between paired printing delimiters to label the object module with the program version number. This directive takes the following form: .IDENT where: ” /string/ string represents six or fewer legal Radix-50 characters which establish the program identification or version number. This number is included 1in the global symbol directory of the object module; the first four characters are printed in the load map and librarian listing. / represent delimiting characters. These delimiters may be any paired printing characters, other than the equal sign (=), the left angle bracket (<), or the semicolon (;), as 1long as the delimiting character is not contained within the text string itself. If the delimiting characters do not match, or if an illegal delimiting character 1is used, the .IDENT directive 1is flagged with an error code (A) in the assembly listing. An example of .IDENT / the .IDENT directive is shown below: /VO05A/ The character string VO5A is converted to Radix-50 representation and included in the global symbol directory of the object module. This character string also appears in the load map produced at 1link time and the Librarian directory listings. When more than one .IDENT directive is encountered in the 1last such directive encountered establishes the which forms part of the object module identification. 6-12 a given program, character string GENERAL ASSEMBLER DIRECTIVES .PAGE Directive/Page Ejection 6.1.6 Page ejection is accomplished in one of four ways: 1. MACRO-11 After reaching a count of 58 lines in the 1listing, page skip over eject to a page automatically performs formulate to and perforations on 1line printer paper is not The page number into pages. teleprinter output changed. 2. source the In addition, the .PAGE directive is used within in the points desired at eject page a perform to program The format of this directive is: listing. . PAGE This directive takes no arguments and causes a skip to the It also causes the the next page when encountered. top of sequence counter page number to be incremented and the line to be listing. <cleared. The .PAGE directive does not appear in the When used within a macro definition, the .PAGE directive ignored during the assembly of the macro definition. is Rather, is the page eject operation is performed as the macro itself In this case, the page number is also incremented. expanded. 3. is A page eject is performed when a form-feed character If the form-feed character appears within a encountered. macro definition, a page eject occurs during the assembly of but not during the expansion of the the macro definition, the wuse of A page eject resulting from the macro itself. the -page number to be causes likewise form-feed character incremented and the line sequence counter to be cleared. 4. 6.2 Encountering a new source file causes the page number incremented and the line sequence count to be reset. FUNCTION DIRECTIVES: to be .ENABL AND .DSABL Several function control options are provided by MACRO-1l through the These directives are included in a .DSABL directives. .ENABL and functions and source program to invoke or inhibit certain MACRO-11 These itself. process assembly the to incidental operations directives take the following form: .ENABL .DSABL arg where: arg arg represents one or more of the arguments defined in Table 6-2. optional symbolic Specifying any argument in an .ENABL/.DSABL directive other than those e be flagged with an error listed 1in Table 6-2 causes that directivto code (A) in the assambly listing. 6-13 GENERAL ASSEMBLER DIRECTIVES Symbolic Arguments Argument Default ABS Disable AMA Table 6-2 of Function Control Directives Function Enabling this function produces absolute binary output in FILES-11 format. To Disable convert format this (as Loader), use Enabling output to Formatted Binary required by the Absolute the FLX this utility. function causes all relative addresses (address mode 67) to be assembled as absolute addresses (address mode 37). This function is useful during the debugging phase of program development. CDR Disable | Enabling this function causes source columns 73 and greater, i.e., to the end of the line, to be treated as a comment. The most common use of to permit sequence columns 73-80. CRF Enable Disabling this generation of This function LC Disable Disable Disable 1in is card inhibits the command generation is in Enabling this point function truncation; disabling this causes floating-point rounding. Enabling this accept the output specified to LSB function feature <cross-reference output. only has meaning if cross-reference FPT this numbers function function causes floating- causes instead of converting it to upper-case. function 1is not enabled, all converted to upper-case. If this text is argument ASCII MACRO-11 input This lower-case string. permits the enabling or disabling of a local symbol block. Although a 1local symbol block is normally established by encountering a new symbolic label or a .PSECT directive in the source program, an .ENABL LSB directive establishes a new local symbol block which is not terminated until (1) another .ENABL LSB 1s encountered, or (2) another symbolic 1label or .PSECT directive 1is encountered following a paired .DSABL LSB directive. Although the . ENABL LSB directive permits a local symbol block to cross .PSECT boundaries, local symbols cannot be defined in a program section other than the one that was in effect when the block was entered. The basic function of this directive with regard to .PSECT's 1is 1limited to those instances (Continued on next page) GENERAL ASSEMBLER DIRECTIVES Table Symbolic - Arguments Argument LSB (Cont.) of 6-2 (Cont.) Function Control Default Directives Function where it is desirable to leave a program section temporarily to store data, followed by a return to the original program section. Attempts to define local symbols in an alternate program section are flagged with an error code Disable (P) in the assembly listing. An example of the .ENABL LSB and .DSABL LSB directives, as typically used in a source program, is shown in Figure 6-5. PNC Enable Disabling output this until function encountered within REG inhibits binary an .ENABL PNC statement the same is module. When specified, the .DSABL REG directive inhibits the normal MACRO-11 default register definitions; if not disabled, the default definitions 1listed below remain in effect. Enable 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, is not recommended. For logical consistency, use the normal default register definitions 1listed above. T GBL When Enable* the .ENABL w GBL directive is specified, MACRO-1ll treats all symbol references that are undefined at the end of assembly pass 1 as default global references; when the .DSABL GBL directive 1is specified, MACRO-1ll treats all - * The default is Disable such references as undefined symbols. In assembly pass 2, if the .DSABL GBL function is still in effect, these undefined symbols are flagged with an error code (U) in the assembly listing; otherwise, they continue to be regarded by MACRO-11 as global references. for RT-11 MACRO programs. GENERAL ASSEMBLER DIRECTIVES TM ¢ 2d’ty 4. 1124 p3e AOW 03d CELE BdWd INT L] 338 39vd 1502 1§0¢ v dnW 4PIWSON e 038 §1 T8YN3* I8dS dW3l 2u’ly 1¥'2H ) £1719 Y-AT TH'EN N3¥NL 18vsg’ 180v cacge iv2oe g2 062 262 £62 962 6-16 get cet tec 842 162 2(2 vi2 L2 cvitce 182 reigee 1egoco 19ceae civoe Zotese Zivioe viZcee iévoee tecage Zocelo lecece e GENERAL ASSEMBLER DIRECTIVES 6.3 DATA STORAGE DIRECTIVES A wide range of data and data types can be generated with the following directives, ASCII conversion characters, and radix-control operators: .BYTE .WORD L] .ASCII These MACRO-11l facilities are described in the following sections. 6.3.1 .BYTE Directive The .BYTE directive is used to generate successive bytes data in the object module. The directive is of the form: of binary .BYTE exp ; STORES THE BINARY VALUE OF THE 3;EXPRESSION "EXP" IN THE NEXT BYTE. .BYTE expl,exp2,expn ;STORES THE BINARY VALUES OF THE LIST ;OF EXPRESSIONS IN SUCCESSIVE BYTES. A legal expression must reduce to eight bits of data or less. The operands of a .BYTE directive are evaluated as word expressions before being truncated to the low-order eight bits. The l6-bit value of the specified expression must have a high-order byte (which is truncated) that is either all zeros (0) or all ones (l). Each expression value is stored in the next byte of the object module. Multiple expressions, which must be separated by commas, are stored 1in successive bytes, SAM=5 .=410 .BYTE - as described below: "D48,SAM | ;sTHE VALUE 060 (OCTAL EQUIVALENT OF 48 ;DECIMAL) IS STORED IN LOCATION 410. s THE VALUE 005 IS STORED IN LOCATION +411., If the highmorder byte of the expression reduces to a value other than 0 or =1, the value 1is flagged with an error code truncated to the low-order eight bits and (T) in the assembly listing. 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 wunary operators is described 1in Section 6.4.1.2. At link time, it is likely that a relocatable expression in a wvalue having more than eight bits, 6-17 will in which case the result linker GENERAL ASSEMBLER DIRECTIVES issues a truncation diagnostic for the object module in question. following statements create such a possibility: example, For the .BYTE 23 :STORES OCTAL 23 IN NEXT BYTE. .BYTE A : RELOCATABLE VALUE A: ~ A WILL PROBABRLY : CAUSE TRUNCATION :DIAGNOSTIC. If an expression interpreted as a following zero, the .BYTE as described directive 1is null, it 1is below: .=420 .BYTE Note that .BYTE in vy the ; ZEROS above directive. example, The three ARE STORED 7422, AND 423, four bytes of commas in the implicit declaration of four null values, other by a comma. Hence, four bytes, each (0), are reserved in the object module. 6.3.2 The the IN BYTES storage operand 420, result 421, from the field represent an each separated from the containing a value of zero .WORD Directive .WORD directive is used to generate object module. The directive is of .WORD .WORD exXp ; STORES expl,exp2,expn successive of data form: THE BINARY EQUIVALENT ; EXPRESSION EXP ;STORES BINARY ;LIST words the THE OF IN THE NEXT OF IN THE WORD. EQUIVALENTS EXPRESSIONS in OF THE SUCCESSIVE : WORDS. A legal expression must result in 16 bits of data or less. Each expression is stored in the next word of the object program. Multiple expressions must be separated by commas and stored in successive words, as shown in the following example: SAL=0 .=500 .WORD 177535, .+4,SAL ;STORES THE VALUES 177535, 506, AND ;0 IN WORDS 500, 502, AND 504, s RESPECTIVELY. If an expression it is interpreted following as a the zero, as .WORD shown directive in the contains following a null value, example: .=500 .WORD 'y ; STORES THE VALUES 0, 5, AND ; LOCATION 500, 502, AND 504, 0 IN s RESPECTIVELY. A statement containing a blank operator not recognized by MACRO-1l1l as a macro MACRO-11 directive, or a semicolon is an implicit .WORD directive, as shown .=440 LABEL: 100,LABEL ; STORES ;AND field, i.e., a symbol that is call, an instruction mnemonic, a interpreted during assembly as in the example below: THE VALUE THE VALUE 440 100 IN IN LOCATION LOCATION 440 442. GENERAL ASSEMBLER DIRECTIVES CAUTION You should not use this technique to generate .WORD directives because it may not be included in future PDP~-11 assemblers. 6.3.3 ASCII Conversion Characters The single quote (') and the double quote (") characters are unary operators that can appear in any MACRO-1l1l expression. When so used, these characters cause a 16-bit expression value to be generated. When the single quoteis used, MACRO-1ll takes the next character in the expression and converts it from its 7-bit ASCII value to a 1l6-bit expression value. The l6-bit value is then used as an absolute term within the expression. For example, the statement: MOV #'A,RO results in the fallnwing l6-bit register 0O: expression value being moved into 00000000/01000001 ImmBinary Value of ASCII A Thus, in the example above, the expression 'A results in a value 101(8). Note that the high-order byte 1is always zero (0) in resulting expression value when the single quote unary operator used. The ' character must not RUBOUT, 1line-feed, or (A) is generated in the be fallmwed by a carriage-return, form—-feed character; assembly listing. if it is, an error of the is null, code When the double quote is used, MACRO-1ll takes the next two characters in the expression and converts them to a 1l6-bit binary expression value from their 7-bit ASCII values. This 1l6-bit value is then used as an absolute term within the expression. For example, the statement: MOV results in the register O: #"AB,RO following 16-bit expression value being moved into 0100001001000001 ] 1ww&inary Value of ASCII A ——Binary Value of ASCII B Thus, in the example above, the expression "AB results in a 041101 (8). 6-19 value of GENERAL ASSEMBLER DIRECTIVES The " character also must not be followed by a carriage-return, null, RUBOUT, line-feed, or form—-feed character; 1if it 1is, an error code (A) is likewise generated in the assembly listing. The ASCII 6.3.4 character .ASCII set is listed in Section A.l, Appendix A. Directive The .ASCII directive translates character strings into their 7-bit ASCII equivalents and stores them in the object module. The format of the .ASCII directive is as follows: .ASCII where: /string string 1/.../string n/ is a string of printable ASCII characters. All printable ASCII characters are legal. The vertical-tab, null, line-feed, RUBOUT, and all other non-printable ASCII characters, except carriage-return and form-feed, are illegal characters. Such an illegal non-printing character is flagged with an error code (I) in the assembly listing. The carriage-return and form-feed characters terminate the scan of the source line. This premature termination of the .ASCII statement results in the generation of an error code (A) in the assembly 1listing, because MACRO-11 1is wunable matching delimiter at string. / / to the complete end of the the scan of the character represent delimiting characters. These delimiters may be any paired printing characters, other than the equal sign (=), the left angle bracket (), or the semicolon (;), as 1long as the delimiting character is not contained within the text string itself. If the delimiting characters do not match, or if an illegal delimiting character is used, the .ASCII directive 1is flagged with an error code (A) in the assembly listing. A non-printing character can be expressed in an .ASCII statement by enclosing its equivalent octal value within angle brackets. set of angle brackets so used represents a single character. example, in the following statement: L,ASCII only Each For <15>/ABC/<A+2>/DEF/<5><4> the expressions <15>, <A+2>, <5>, and <4> represent the values of non-printing characters. Furthermore, the expressions must reduce to eight bits of absolute data or less, subject to the same rules for generating data as with the .BYTE directive (see Section 6.3.1). Angle brackets can be embedded between delimiting characters in the character string, but angle brackets so used do not take on their usual significance as delimiters for non-printing characters. For example, the 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: 6-20 GENERAL ASSEMBLER DIRECTIVES ; STORES THE BINARY REPRESENTATION .ASCII /HELLO/ .ASCII /ABC/<15><12>/DEF/ ;STORES THE BINARY REPRESENTATION ;OF THE LETTERS HELLO IN FIVE ; CONSECUTIVE BYTES. ;OF THE CHARACTERS A,B,C,CARRIAGE ;RETURN,LINE FEED,D,E,F IN EIGHT ; CONSECUTIVE BYTES. .ASCII ; STORES THE BINARY REPRESENTATION /A<K15>B/ ;OF THE CHARACTERS A, <, 1, 5, >, ;AND B IN SIX CONSECUTIVE BYTES. The semicolon (;) and equal sign (=) can be used as delimiting characters in an ASCII string, but care must be exercised in so doing because of their significance as a comment indicator and assignment operator, respectively, as illustrated in the examples below: .ASCII ;sSTORES THE BINARY REPRESENTATION OF ;ABC;/DEF/ A, B, C, D, E, AND F CHARACTERS ;THE | NOT ;IN SIX CONSECUTIVE BYTES; ; RECOMMENDED PRACTICE. ; STORES THE BINARY REPRESENTATIONS OF .ASCII /ABC/;DEF; .ASCII ; THE CHARACTERS A, B, AND C IN THREE ; CONSECUTIVE BYTES; THE CHARACTERS D, ;E, F, AND ; ARE TREATED AS A COMMENT. /ABC/=DEF= ‘ ;STORES THE BINARY REPRESENTATION A, B, C, D, E, AND ;OF THE CHARACTERS sF IN SIX CONSECUTIVE BYTES; NOT ; RECOMMENDED PRACTICE. An equal sign is treated as an assignment operator when it appears the first character following example: .ASCII 6.3.5 in the =DEF= ASCII string, as as illustrated by the ; THE DIRECT ASSIGNMENT OPERATION ; .ASCII=DEF IS PERFORMED, AND A Q ; (SYNTAX) ERROR IS GENERATED UPON ; ENCOUNTERING THE SECOND = SIGN. .ASCIZ Directive The .ASCIZ directive is equivalent to the .ASCII directive described above, except that a zero byte is automatically inserted as the final character of the string. Thus, when a list or text string has been created with an .ASCIZ directive, a search for the null character in the last byte can effectively determine the end of the string, as reflected by the coding below: CR=15 LF=12 HELLO: 10S$: .ASCIZ <CR><LF>/MACRO-11 VO1lA/<CR><LF> MOV MOV MOVB BNE #HELLO,R1 # LINBUF ,R2 (R1)+, (R2) + 109 .EVEN ;INTRODUCTORY MESSAGE ; GET ADDRESS OF MESSAGE. ; GET ADDRESS OF OUTPUT BUFFER. ;MOVE A BYTE TO OUTPUT BUFFER. ;IF NOT NULL, MOVE ANOTHER BYTE. L » » 6-21 GENERAL ASSEMBLER DIRECTIVES The .ASCIZ directive is subject legality and proper character for the 6.3.6 The .ASCII directive. to the same checks for character string construction as described above .RADS50 Directive .RAD50 directive allows the user to generate data in Radix-50 packed format. Radix=-50 form allows three characters to be packed into sixteen bits (one word); therefore, any 6-character symbol can be stored in two consecutive words. The form of the directive is: .RAD50 where: /string string 1/.../string n/ represents a series of characters to be packed (three characters per word). 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. I1f fewer than three characters are to be packed, the string 1is packed 1left-justified within word, and trailing spaces are assumed. As with ©6.3.4, the the .ASCII directive described in vertical-tab, null, line-feed, Section RUBOUT, and all other non-printing characters, carriage-return and form-feed, are characters, resulting in an error code (I) except illegal in the assembly / / the the carriage-return and form-feed characters result in (A) because these characters end line, preventing MACRO-11] from terminating matching delimiter. listing. Similarly, an error code the scan of the detecting the represent delimiting may the the be any paired equal sign semicolon characters. printing These delimiters characters, other than (=), the left angle bracket (<), or (;), provided that the delimiting character is not contained within the text string itself. If the delimiting characters do not match, or if an illegal delimiting character is used, the .RAD50 directive 1is flagged with an error code (A) in the assembly listing. Examples of .RADS50 directives .RAD50 .RAD50 .RAD50 /ABC/ /AB/ /ABCD/ .RAD50 /ABCDEF/ are shown below: s PACKS ABC INTO ONE WORD., s PACKS AB (SPACE) INTO ONE WORD. ; PACKS ABC INTO FIRST WORD AND ;D (SPACE) ; PACKS ABC i SECOND (SPACE) INTO WORD. INTO SECOND FIRST WORD, DEF WORD., INTO GENERAL ASSEMBLER DIRECTIVES Each character is translated into indicated in the following table: its Radix-50 Character Radix-50 Octal Equivalent (space) A-Z $ . (undefined) 0-9 0 1-32 33 34 35 36-47 , The Radix-50 equivalents for characters 1 through combined as follows: Radix~50 Value = For Section example below: .RAD50 are A.2 in ((1*50)+2)*50+3 = 3223 Appendix ~ equivalents. Angle brackets special codes (Cl1,C2,C3) 3 | Radix-50 Value of ABC = to as ((C1l*50)+C2)*50+C3- example: Refer equivalent, A for a , table of Radix-50 (<>) must be used in the .RAD50 directive whenever are to be inserted in the text string, as - shown in the PRy | /AB/<35> ; STORES 3255 IN ONE WORD. CHR1=1 CHR2=2 CHR3=3 » .RAD50 6.3.7 <CHR1><CHR2><CHR3> ;EQUIVALENT TO .RADS0 /ABC/. Temporary Radix-50 Control Operator: 'R The "R operator specifies that an argument 1is to be converted to Radix-50 format. This allows up to three characters to be stored in one word. The "R operator is coded as follows: | "Rccce where ccc represents a maximum of three characters to be converted to a 16-bit Radix-50 value. If more than three characters are specified, any following the third character are ignored. specified, If fewer following example shows how the "R operator might be used 3-character file type specifier MOV # "RMAC,FILEXT The number than 3 to pack it is assumed that the trailing characters are blanks. sign (#) is (MAC) into a single 1l6-bit word. a ; STORE RAD50 MAC AS FILE EXTENSION used to indicate immediate data, i.e., be assembled directly into object code. "R specifies characters MAC are to be converted to Radix-50. This wvalue stored in are The location FILEXT. 6-23 data to that the 1is then GENERAL ASSEMBLER DIRECTIVES 6.4 RADIX AND NUMERIC CONTROL FACILITIES 6.4.1 Radix Control and Unary Control Operators The normal default assumption for numeric values or expression values appearing 1in a MACRO-1ll source program is octal. However, numerous instances may occur where an alternate radix is useful for portions of a program or for variables within a given statement. It may be useful, for example, to declare a given radix for applicability throughout a program or to specify a numeric value or expression value in a manner that causes it to be interpreted as a binary, octal, or decimal value during assembly. In other such instances, it may be useful to complement numeric values or expression values. These MACRO-11 facilities are described in the following sections. NOTE When two or more unary modifying the same applied, from right to operators appear term, the left, to the together, operators term. are 6.4.1.1 .RADIX Directive - Numbers used in a MACRO-11l source program are initially considered to be octal values; however, you can declare any one of the following radices for applicability throughout the source program or within specific portions of the program: 2, This is 8, 10 accomplished .RADIX where: via a .RADIX directive of the form: n n represents one of listed above. If the octal default the three acceptable radices the argument n is not specified, radix is assumed. The argument in the .RADIX directive 1is always interpreted as a decimal value. Any alternate radix declared in the source program through the .RADIX directive remains in effect until altered by the occurrence of another such directive, i.e., a given radix declaration is valid throughout a program until changed. For example, the statement: .RADIX 10 ;BEGINS A SECTION OF .RADIX Any value other than .RADIX directive assembly listing. null, 2, <causes an 8, ;DECIMAL RADIX. s REVERTS TO OCTAL or 10 error specified code (A) CODE HAVING A RADIX. as to argument in the be generated an in the In general, macro definitions should not contain or rely on radix settings established with the .RADIX directive. Rather, temporary radix control operators should be used within a macro definition. Where a possible radix conflict exists within a macro definition or in possible future uses of that code, it is recommended that the user 6-24 GENERAL ASSEMBLER DIRECTIVES specify numeric or expression values using the temporary radix control operators described below. "D, "0, and "B - Once the 6.4.1.2 Temporary Radix Control Operators: user has specified a given radix for a section of code or has decided to use the default octal radix, he may discover a number of cases where an alternate radix is more convenient or desirable (particularly The creation of a mask word, for example, within macro definitions). might best be accomplished through the use of a binary radix. MACRO-11 has three unary operators that allow the user to establish an alternate radix, "D"number" O"number" "B"number" Thus, an alternate localized | as shown below: ("number" ("number" ("number" radix requirement can is evaluated as a decimal number) is evaluated as an octal number) is evaluated as a binary number) be declared in the source program. temporarily to meet a Such a declaration can be made at any time, regardless of the existence of the default octal radix or another specific radix declaration elsewhere in the program. In other words, the effect of a temporary radix control operator is limited to the term or expression immediately following the operator. Any value specified in connection with a temporary radix control operator is evaluated during assembly as a l6-bit entity. Temporary radix control declarations can be included 1in the source program anywhere a numeric value is legal. The expressions below are representative of the methods of specifying temporary radix control operators: "D123 "0 47 "B 00001101 “0<A+13> Decimal radix Octal Radix Binary Radix Octal Radix Note that the up-arrow and the radix control operator may not be separated, but the radix control operator and the following term or expression can be physically separated by spaces or tabs for legibility or formatting purposes. A multi-element term or expression that is to be interpreted in an alternate radix should be enclosed within angle brackets, as shown radix control expressions above. The following example also in the last of the four illustrates the use of angle temporary brackets to delimit an expression that is to be interpreted in an alternate radix: A=10 .RADIX 10 .WORD "O<A+10>*10 When the temporary radix expression in the .WORD evaluated, directive above it effectively yields the following equivalent statement: .WORD is 180. MACRO-11 also allows a temporary radix change to decimal by specifying a number, immediately followed by a decimal point (.), as shown below: 100.. 1376. 128. Equivalent to 144(8) Equivalent to 2540(8) Equivalent to 200(8) 6-25 GENERAL ASSEMBLER DIRECTIVES The above expression forms are below: equivalent in function | to those listed “D100 "D1376 "D128 6.4.2 Numeric Directives and Unary Control Operators Two storage directives and two numeric control operators are available to simplify the use of the floating-point hardware on the PDP-11. These facilities allow floating-point data to be <created in the program, and numeric values to be complemented or treated as floating-point numbers. A floating-point number is represented by a string of decimal digits. The string (which can be a single digit in length) may optionally contain a decimal point, and may be followed by an optional exponent indicator in the form of the letter E and a signed decimal integer exponent. The number may not contain embedded blanks, tabs or angle brackets and may not be an expression. Such a string will result in one or more errors (A or Q) in the assembly listing. The list of numeric representations below contains seven valid representations of the same floating-point number: distinct, 3 3. 3.0 3.0E0 3E0 . 3E1 300E-2 As can be 3000E-3, inferred, the .03E2, etc.). list could A leading be plus extended indefinitely sign is optional (e.g., (e.g., 3.0 is considered to be +3.0). A leading minus sign complements the bit. No other operators are allowed (e.g., 3.0+N is illegal). All floating-point numbers format: 64 S 63 56 are 55 EEEEEEEE evaluated as 64 bits in the MMM.....MMM Exponent (55 bits) (8 bits) Sign (1 MACRO-11l returns a value of the appropriate of the floating-point directives. The truncated or rounded (see Section 6.2). bit) size and precision via one values returned may be Floating=-point numbers are normally rounded. That floating=-point number exceeds the limits of the field to be stored, the high-order bit of the unretained word 1low-order if the number are needed bit is to following 0 Mantissa the sign of to be the retained stored express 1its in a exact word, as 2-word value, 6-26 shown field, the 1is, when in which it 1is added below. For but more than highest bit a is to example, (32) 32 of bits the GENERAL ASSEMBLER DIRECTIVES unretained field is added to the least significant bit (0) of the retained field (see illustration below). The .ENABL FPT directive is used to enable floating-point truncation; .DSABL FPT is wused to return to floating-point rounding Bit 32 Bit 0 (see Table Bit 32 31 Retained 6-2). Bit 0 Untetained field field Note that all numeric operands associated with Floating Point Processor instructions are automatically evaluated as single-word, decimal, floating-point values wunless a temporary radix control operator 1is specified. For example, to add (floating) the octal constant 41040 to the contents of floating accumulator =zero, the following instruction must be used: ADDF where: #°041040,F0 FU is assumed Floatingwpoint to represent numbers are applicable PDP-11 mporary floating accumulator daacribéd, in greater Processor Handbook. Numeric Control Operators: zero. detail "C and in "F -The unary operator ;allmwa you to &p@cmfy an argument that is complemented as it is evaluated during assembly. The °F operator allows you flamtinquomnt number‘ As with 2 control the rad1X' operator to contrml ( C) specify an arqument consisting of | , operators d@sarlb@d abmv&, the the °C to be unary a l-word | numeric can be used anywhere in the source program that an expression value is legal. Such a construction is evaluated by MACRO-11 as a 1l6-bit binary value before being complemented. For example, the following statement: TAG4: .WORD "C151 causes the 1l's cmmpl@ment of the value 151 (octal) to be stored as a l16-bit wvalue in the program. The resulting value expressed in octal form is 177626(80 GENERAL ASSEMBLER DIRECTIVES Because the "C construction is a unary operator, the operator and its argument are regarded as a term. Thus, more than one unary operator may be applied to a single term. For example, the following construction: “C°D25 causes the decimal value 25 to be complemented during assembly. The resulting binary value, when expressed 1in octal form, reduces to 177746 (octal). | The term created through operator thus becomes combination with other following construction: A ' the use of the temporary numeric control an entity that can be used alone or in expression elements. For example, the “C2+6 is equivalent in function to: <"C2>+6 This expression is evaluated during assembly as the 1l's complement of 2, plus the absolute value of 6. When these terms are combined, the resulting expression value generates a carry beyond the most significant bit, leaving 000003(8) as the reduced value. As shown above, when the temporary numeric control operator and its argument are coded as a term within an expression, angle brackets should be used as delimiters to ensure precise evaluation and readability. | MACRO-11 also supports a unary operator for numeric control which allows you to specify an argument consisting of a 1l-word floating-point number. For example, the following statement: MOV $#"F3.7,R0 creates a l-word floating-point number at location A+2 containing value 3.7 formatted as shown below. BIT 15 | S Sign 14 7 6 EEEEEEEE (bit 15) Exponent the 0 MMMMMMM (bits 14-7) Mantissa (bits 6-0) = A: GENERAL ASSEMBLER DIRECTIVES 6.5 LOCATION COUNTER CONTROL DIRECTIVES The directives used in controlling the value of the current location in the object program are space storage in reserving and counter described in the following sections. | MACRO-11 be noted that several it should this connection, In statements may cause an odd number of bytes to be allocated, as listed below: l. .BYTE directive 2. .BLKB directive 3. .ASCII or 4, .0ODD directive 5. A direct assignment statement of the form .=.+expression, which results in the assignment of an odd address value. .ASCIZ directive In cases that yield an odd address value, the next word-boundaried instruction automatically forces the 1location counter to an even in the value, but that instruction is flagged with an error code (B) assembly listing. 6.5.1 .EVEN Directive The .EVEN directive ensures that the current location counter contains If the current an even value by addlng 1 if the current value is odd. Any aperands location counter is already even, no action is taken. following an .EVEN directive are flagged with an error code (Q) in the assembly The listing. .EVEN directive 6.5.2 is used as follows: .ASCIZ .EVEN /THIS IS A TEST/ .WORD XYZ | ;ENSURES THAT THE NEXT STATEMENT WILL ;BEGIN ON A WORD BOUNDARY. .0ODD Directive The .0DD directive ensures that the current location counter contains If the current an odd value by adding 1 if the current value is even. location counter is already odd, no action 1is taken. Any operands following an .ODD directive are also flagged with an error code (Q) in the assembly listing. GENERAL ASSEMBLER DIRECTIVES 6.5.3 .BLKB and .BLKW Directives Blocks of storage can be reserved in the .BLKB and .BLKW directives. reserve blocks. byte The blocks; similarly, the .BLKW two directives are of the form: . BLKB exp . BLKW exp where: the object program by The .BLKB directive exp directive | in either of is not an absolute value, with an error code (A) in illustrates the caeooo geeeno PASStI1 e2e000 use of the .BLKB PSECY IMPUR ,E D ,BLKW i «PSECT IMPPAS,D,GBL 2 the the and these directives .BLKW directives. JPASS FLAG INEXT GROUP MUST STAY SYMBOL ¢ ,BLKW popen4d 22eee4 MODE s 3 ,BLKB { ) poavees poeRes SECTORss ,BLKB VALUEES BLKW i i i JSYMBOL/EXPRESSION FJEXPRESSION VALUE JRELOCATION LEVEL RELLVLSS ,BLKW evean3 177 PSYMBOL 178 JREPT HAXXMTW!Q.*SYMBOL)/?) o BLKW { TOGETHER ACCUMULATOR JMODE/FLAGS FLAGSi1t 220010 176 word statement is flagged assembly listing. gepoas BYTE TYPE « ENDR 179 CLCNAMg: BLKW CLCFGS11,BLKB CLCSEC11,BLKB CLCLOCs 1 ,BLKW g ,BLKW CLCMAX T S8 ,BLKW CHRPN SYMBEGI: ,BLKW ENDFLGES ,BLKW 180 020020 PA0R24 182 200025 183 220a26 184 AGBo3a 188 @30032 186 28va34 187- BBRB36 {88 0200008 181 6-6 directive in statement: Example a of LOCATION COUNTER NAME H ) ) | JEND OF GROUPED DATaA JCHARACTER POINTER JPOINTER TO STARY OF SYMBOL ) o PSECT Figure The .BLKB following JCURRENT .flp“-"-«“““&} 166 167 168 169 17@ 171 {172 173 174 175 6-6 reserves of to represents the specified number of bytes or words to be reserved in the object program. If no argument is present, a default wvalue of 1 is assumed. These directives should not be used without arguments. Any expression that is completely defined at assembly-time and that reduces to an absolute value 1is legal. If the expression specified Figure means is used .BLKB and source program has .BLKW Directives the same effect as the .=.texpression the current which causes the value of the expression to be added to The .BLKB directive, however, is location value the counter. of source code 1in which it easier to interpret in the context of the appears and is therefore recommended. GENERAL ASSEMBLER DIRECTIVES 6.6 TERMINATING DIRECTIVES 6.6.1 .END Directive The .END directive indicates the logical end of the source input, takes the following .END where: and form: exp exp represents an optional expression value which, if present, 1indicates the program-entry point, i.e., the transfer address at which program execution is to begin. When MACRO-11 encounters a valid occurrence of the .END directive, it terminates the current assembly pass. Any additional text beyond this point in the current source file, as well as in additional source files identified in the command line, will be ignored. When creating an image consisting of several object modules, only one object module may be terminated with an .END exp statement specifying the starting address. All other object modules must be terminated with an .END statement without an address argument; otherwise, a diagnostic message will be 1issued at 1link time. If no starting address 1is specified in any of the object modules, image execution will begin at location 1 of the image and immediately fault because of an odd addressing error. | | | The .END statement must not be used within a macro expansion or a conditional assembly block; if it is so used, it is flagged with an error code (0) in the assembly listing. The .END statement may be used, however, in an 1immediate conditional statement (see Section 6.10.2) . If the source program input 1is not terminated with an .END an error 6.6.2 code (E) results in the assembly listing. directive, LJ.EOT Directive Under RSX-1ll, RT-11l, and IAS operating systems, the MACRO-11 .EOT directive 1is ignored and simply treated as a directive without effect, i.e., as a no-op. 6.7 PROGRAM BOUNDARIES DIRECTIVE: .LIMIT It is often desirable to know the upper and of the image. When the .LIMIT directive program, MACRO-11 effectively generates the . BLKW lower address boundaries is specified in the source following instruction: 2 causing two storage words to be reserved in the object module. Later, at 1link time, the lowest address in the load image is inserted into the first reserved word, and the address of the first free word following the image is inserted into the second reserved word. During linking, 2-word boundary. the size of the image is rounded upward to the nearest GENERAL ASSEMBLER DIRECTIVES For a discussion of memory applicable system manual 6.8 allocation (see Section 0.3 and mapping, refer in the Preface). to the PROGRAM SECTIONING DIRECTIVES The MACRO-11 program sectioning directives are used to for program sections and to establish certain attributes essential to the linking processing. 6.8.1 declare program names section .PSECT Directive The .PSECT directive allows absolute control over the memory allocation of a program at link time, because any program attributes established through this directive are passed to the linker. For example, if you are writing programs for a multi-user environment, a program section containing pure code (instructions only) or a program section containing impure code (data and instructions) may be explicitly declared through the .PSECT directive. Furthermore, program sections may be explicitly declared as read-only qualifying them for use as protected, The advantages gained through reentrant programs. sectioning programs in this these code, manner therefore relate primarily to control of memory allocation, program modularity, and more effective partitioning of memory. Refer to the applicable system manual for a discussion of memory allocation (see Section 0.3 The in the Preface). .PSECT directive .PSECT where: is formatted as follows: name,argl,arg2,...argn name ’ arqgl, arg2,... argn represents the symbolic name of section, as described in Table 6-3. represents any legal separator . space) the (comma, tab program and/or represent one or more of the 1legal symbolic . PSECT the use with for defined arguments directive, as described in Table 6-3. The slash separating each pair of symbolic arguments listed optional these that indicates table the in arguments are mutually exclusive, i.e., one or the other, but not both, may be specified. Multiple arguments must be separated by a legal separating character. Any symbolic argument specified in the .PSECT directive other than those listed in Table 6-3 will cause that statement to be flagged with an error code (A) in the assembly listing. GENERAL ASSEMBLER DIRECTIVES Table 6-3 Symbolic Arguments of .PSECT Directive Argument Default NAME Blank Meaning Establishes the program specified is which section as one to name, six argument this Radix~-50 characters. If is omitted, a comma must appear in place Radix-50 The name parameter. of the is listed in Section A.2 set character of Appendix A. RO/RW RW is access of type which Defines permitted to the program section: RO=Read-Only Access RW=Read/Write Access NOTE IAS and RSX-11lD for protection sections. not provide Defines 1/D hardware program do RSX-11lM and RT-11 the such protection. program section as (I) or instructions either containing the allow attributes These data (D). differentiate global symbols to linker entry-point program are that that are those from (I) instructions data values GBL/LCL set RO LCL Defines section, the link time. (D). scope of the program as subsequently interpreted at In building single-segment nonoverlaid programs, the GBL/LCL arguments have no memory total the because meaning, for the program will go into allocation the root segment of the image. The GBL/LCL arguments apply only in the case of overlays. If an object program module section, contains then the a local storage occur will module allocation for that segment in which the module the within reference can modules Many resides. the and section, program same this is module each for memory allocation or overlaid within concatenated either the segment, depending on of the program section the (.PSECT) argument defining (continued on next page) 6-33 GENERAL ASSEMBLER DIRECTIVES Table 6-3 (Cont.) Symbolic Arguments of .PSECT Directive Argument Default GBL/LCL LCL (cont'd) Meaning its allocation below). requirements If an object global (see CON/OVR module contains a | program contributions to this section, the program section segment boundaries, are collected across and the allocation of memory for that section will go into the segment nearest the root in which the first contribution to this program section appeared. (The term contribution implies an allocation of memory to the program section.) ABS/REL REL Defines the relocatability attribute the section: program of ABS=Absolute (non-relocatable). When the ABS argument is specified, the program section is regarded at 1link time as an absolute module, requiring no relocation. program loaded, address The thus The section 1is assembled and starting at absolute virtual 0. location program of data sections in must absolute fall the virtual memory 1limits segment containing the section; otherwise, an within of the program error results at link time. For example, the following code, although wvalid at during assembly, may generate an error message if wvirtual 1location 100000 is outside the segment's virtual address space: .PSECT ALPHA,ABS .=.+100000 .WORD X The above coding assembles properly, but the resulting load address may be outside the respective segment's boundaries. In such cases, the linker recognizes this as an attempt to load data outside the image and responds with an error message. REL=Relocatable. argument is When the REL specified, the linker calculates a relocation bias and adds it to all references to locations within the program section, i.e., all references to the program section must relocation bias added make them absolute. have to them a to (Continued on next page) 6-34 GENERAL ASSEMBLER DIRECTIVES Table 63 (Cont.) Symbollc Arguments of .PSECT Directive Argument Default Meaning CON/OVR CON Defines the allocation the program section: requirements of CON=Concatenated. All program section contributions are to be concatenated with other references to this same program section in order to determine allocation the total requirement program section. for memory this OVR=0Overlaid. All program section contributions are to be overlaid. Thus, the total allocation requirement for the program section is equal to the 1largest allocation request made by any individual contribution to this program section. The only argument in the .PSECT directive that 1is position-dependent is NAME. If it is omitted, a comma must be used in its place. For example, the directive: .PSECT ,GBL shows a .PSECT directive with a blank name argument and the GBL argument. Default values (see Table 6-3) are assumed for all other unspecified arguments. Once the attributes of a program section are declared through a .PSECT directive, MACRO-1l1l assumes that these attributes remain in effect for all subsequent .PSECT directives of the same name that are encountered within the module. MACRO-11 provides for The , 256(10) program sections, l. One default 2. One default unnamed relocatable program section 3. Two-hundred-fifty-four .PSECT directive absolute program section as listed below: enables ABS.) named program sections. the l. Create program sections 2. Share code and data (. user to: (see Section 6.8.1.1) among ©6.8.1.2). 6-35 program sections (see Section GENERAL ASSEMBLER DIRECTIVES For each program section following information: specified 1. Program section name 2. Contents current 3. Maximum location 4., Program of the implied, location counter section described or value attributes, in Table 6-3 MACRO-11l maintains counter encountered i.e., the .PSECT 2zero of a source The a given occurrence of a arguments above. 6.8.1.1 Creating Program Sections - MACRO-1l1 assembling source statements at relocatable program section, i.e., the first statement of always an implied .PSECT directive. first the .PSECT directive with automatically begins the unnamed program is 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 1is specified. Further occurrences of a program section name in subsequent .PSECT statements cause the resumption of assembly where that section previously ended. For example: .PSECT «WORD 0 ; DECLARES UNNAMED RELOCATABLE PROGRAM ;SECTION ASSEMBLED AT RELOCATABLE B: « WORD 0 ;sADDRESSES C: « WORD 0 A: | 0, 2, AND 4. .PSECT ALPHA +DECLARES X . WORD 0 : NAMED ALPHA ASSEMBLED Y: « WORD 0 s ADDRESSES D: . PSECT . WORD 0 s RETURNS : PROGRAM ;BLY AT RELOCATABLE 0 AND PROGRAM AT SECTION RELOCATABLE 2. TO UNNAMED RELOCATABLE SECTION AND CONTINUES ASSEM- RELOCATABLE ADDRESS 6. A given program section may be defined completely wupon encountering its first .PSECT directive. Thereafter, the section can be referenced by specifying its name only, or by completely respecifying its attributes. the directive: .PSECT and later example, requires a program section can be declared through ALPHA,ABS,OVR referenced .PSECT which For through the equivalent directive: ALPHA no arguments. By maintaining separate location counters for each program section, MACRO-11 allows the user to write statements that are not physically contiguous within the program, but that c¢an be 1loaded contiguously following assembly, as shown in the following example. GENERAL ASSEMBLER DIRECTIVES A: .PSECT .WORD SEC1,REL,RO 0 s .WORD 0 ST: +sADDRESSES 0, 2, AND 4. 0 . WORD B s START A RELOCATABLE PROGRAM SECTION +:NAMED SEC1 ASSEMBLED AT RELOCATABLE s ASSEMBLE CODE AT RELOCATABLE ;ADDRESSES 6 THROUGH 12. A B CLR CLR C CLR ;START AN ABSOLUTE PROGRAM SECTION SECA,ABS .PSECT ;ABSOLUTE ADDRESSES 0 AND 2. :RESUME RELOCATABLE PROGRAM SECTION .+2,A SECl1 «WORD .PSECT ASSEMBLE CODE AT RELOCATABLE +SECl. sADDRESSES 14 AND 16. A ST INC BR ASSEMBLE CODE AT ;:NAMED SECA. 1likewise, all All labels in an absolute program section are absolute; location current The relocatable. are section relocatable a labels in counter symbol (.) is also relocatable or absolute when referenced in a relocatable or absolute program section, respectively. Any labels appearing on a line a containing (or .PSECT .ASECT or directive are assigned the value of the current location .CSECT) counter before the .PSECT (or other) directive takes effect. Thus, if | the first statement of a program is: ALT,REL .PSECT A: the label A is assigned to relocatable address zero of the unnamed (or blank) program section. It is not known during assembly where relocatable program sections will be loaded, therefore all references between relocatable sections in a single assembly are translated by MACRO-1ll to references relative Thus, MACRO-11l provides the to the base of the referenced section. linker with the necessary information to resolve the linkages between Such information is not necessary, however, various program sections. when referencing an absolute program section, because all instructions in an absolute program section are associated with an absolute virtual | | address. In the following example, references relative references into translated program section named SEN. .=.+1000 A: .PSECT ENT,ABS CLR X JMP Y .PSECT MOV SEN,REL RO,R1 JMP Y: X: .WORD the symbols X and Y are to the base of the relocatable ;ASSEMBLED AS CLR BASE OF ; RELOCATABLE SECTION + 10. ;ASSEMBLED AS JMP BASE OF ; RELOCATABLE SECTION + 6. ;ASSEMBLED AS JMP 1000. A HALT to 0 NOTE in conjunction constant In the preceding example, using a location counter symbol (.) in the form current the with .=1000 would result in an error, because constants are always absolute and are always associated with the program's .ASECT section (. ABS.). If the form .=1000 were incompatibility would be detected. used, for a discussion of the current location counter. 6-37 a program See Section 3.6 GENERAL ASSEMBLER DIRECTIVES 6.8.1.2 Code or Data Sharing - Named relocatable program sections with the arguments GBL and OVR operate in the same manner as FORTRAN COMMON, i.e., program sections of the same name with the arguments GBL and OVR from different assemblies are all loaded at the same location at link time. All other program sections, i.e., those with the argument CON, are concatenated. Note that no conflict exists between internal symbolic names and program section names, i.e., it is legal to use the same symbolic name for both purposes. Considering FORTRAN again, using the same symbolic name 1is necessary to accommodate the following statement: COMMON /X/ A,B,C,X where the symbol X the fourth element 6.8.1.3 represents of that Memory Allocation generate an error you to place odd several modules when the base of the program section and also does not section. Considerations a module length data at contain object ends at an - The odd assembler location. the end of a module. code contributions to This allows However, when the same program section having the concatenate attribute (see Table 6-3), odd 1length modules (except the 1last) may cause succeeding modules to be linked starting at odd locations, thereby making the linked program unexecutable. To avoid this problem, code and data should be separated from each other and be placed in separately named program sections. This permits the linker to automatically begin each program section on an even address. Refer to the applicable system manual for further information on memory allocation of tasks (see Section 0.3 in the Preface). 6.8.2 J.ASECT and .CSECT Directives IAS and RSX-1ll assembly-language programs use the .PSECT and .ASECT directives exclusively, since the .PSECT directive provides all the capabilities of the .CSECT directive defined for other PDP-11 assemblers. MACRO-11 will accept both .ASECT and .CSECT directives, but assembles them as though they were .PSECT directives with the default attributes 1listed in Table 6-4. Also, compatibility exists between other MACRO-11l programs and the IAS/RSX-11 Task Builders, since the respective Task Builders recognize the .ASECT and .CSECT directives that appear in such programs and likewise assign the default values listed in Table 6-4. GENERAL ASSEMBLER DIRECTIVES Table 6-4 Program Section Default Values Non-IAS/RSX-11 Default Attribute .ASECT Name . Access RW Type I Scope Value .CSECT (named) ABS. .CSECT (unnamed) name f Blank RW RW I I GBL GBL LCL Relocation ABS REL REL Allocation OVR OVR CON | The allowable syntactical forms of the .ASECT and .CSECT directives are: .ASECT .CSECT .CSECT Note that the statement: .CSECT is identical symbol JIM to the .PSECT statement: JIM,GBL,OVR because the .CSECT default values GBL and named program section. 6.9 SYMBOL CONTROL DIRECTIVE: OVR are assumed for the .GLOBL MACRO-11 produces a relocatable object module and a 1listing file containing the assembly listing and symbol table. The linker joins separately-assembled object modules into a single executable image. During 1linking, object modules are relocated as a program function of the specified base of the module. The object modules are then 1linked via global symbols, such that a global symbol in one module, defined either by a global assignment operator (==), a global label operator (::), or the .GLOBL directive can be referenced from another module. Thus, all symbols which will be referenced by other program must be singled out as global symbols in the defining modules. modules The .GLOBL directive is provided to define (and thus provide 1linkage to) symbols not otherwise defined as global symbols within a module. For example, if the .DSABL GBL directive is in effect (see Section 6.2), .GLOBL directives might be .GLOBL A,B,C is equivalent ==gxpression (or A B £4 ==expression B==expression (or C e the directive (or % effect linkage to library routines. ) ) ) 6-39 included 1in a source program to For a global to: symbol definition, GENERAL ASSEMBLER DIRECTIVES Thus, the general .GLOBL where: A form of .GLOBL directive is: syml,sym2,...symn syml, sym2,... symn .GLOBL the represent legal symbolic names. When multiple symbols are specified, they are separated by any legal separator (comma, space, and/or tab). directive may also embody a label field and/or a comment field. At the end of assembly pass 1, MACRO-1l1 determines whether a given global symbol is defined within the current program module or whether it is to be treated as an external symbol. All internal symbols appearing within a given or they assembly pass 1 references. Refer program will to must be Section enabling/disabling of global be defined assumed 6.2 to for be a at the end of default global description of references. In the example below, A and B are entry-point symbols. The symbol A 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 is not defined as a label within the current assembly, it 1is an external (global) reference if .ENABL GBL is in effect. ; DEFINE A SUBROUTINE ; EXTERNAL SUBROUTINE WITH 2 ENTRY POINTS WHICH CALLS AN b1 ; .PSECT A: X: B:: .GLOBL MOV ;DECLARE A @ (R5) +,R0 MOV #X,R1 JSR PC,C RTS R5 MOV CLR (R5)+,R1 R2 BR X External symbols can MACRO-11 below: directive CLR EXT .WORD EXT CLR @EXT External symbols may shown below: ;DEFINE ;DEFINE ; CALL THE UNNAMED PROGRAM SECTION. A AS A GLOBAL SYMBOL. ENTRY POINT A. EXTERNAL SUBROUTINE C. ;EXIT. ; DEFINE appear as a also CLR .WORD EXT+A EXT-2 CLR @EXT+A (R1) in the direct appear as ENTRY POINT operand field reference, as a term within B. of an shown an instruction or in the examples expression, ~ as It should be noted that an undefined external symbol cannot be used in the evaluation of a direct assignment statement or as an argument in a conditional assembly directive (see Sections 6.10.1 and 6.10.3). GENERAL ASSEMBLER DIRECTIVES CONDITIONAL ASSEMBLY DIRECTIVES 6.10 Conditional assembly directives allow you to include or exclude blocks of source code during the assembly process, based on the evaluation of condition stated tests within the body of This program. the capability allows several variations of a program to be generated from the same source code. Conditional Assembly Block Directives: 6.10.1 .IF, .ENDC The general form of a conditional assembly block is as follows: (s) ;START CONDITIONAL ASSEMBLY BLOCK. cond,argument .IF ; RANGE OF CONDITIONAL ASSEMBLY BLOCK. :END OF CONDITIONAL ASSEMBLY BLOCK. . ENDC cond where: represents a specified condition that must be met 1is to be included in the assembly. if the block the by tested that may be The conditions conditional assembly directives represents any legal separator Table 6-5. and/or t (s) argumen tab). are defined in space, (comma, or argument (s) symbolic the represent(s) the specified conditional test. of expression(s) the thus a function of These arguments are specified condition to be tested (see Table 6-5). either represents the body of code that is included in the assembly or excluded, depending range upon whether the specified condition is met. . ENDC This terminates the conditional assembly block. directive must be present to end the conditional assembly block. an 1illegal A condition test other than those listed in Table 6-5, argument, or-a null argument specified in an .IF directive causes that line to be flagged with an error code (A) in the assembly listing. Table 6-5 Legal Condition Tests for Conditional Assembly Directives Conditions Positive | Complement Arguments Assemble Block If: EQ NE Expression Expression GT LE Expression Expression is equal to 0 (or not equal to 0). than equal 0 to (or 0). is less greater than or GENERAL ASSEMBLER DIRECTIVES Legal Table Condition Tests for 6-5 (Cont.) Conditional Assembly Directives Conditions Positive | Complement LT GE Arguments Assemble Block Expression Expression is (or greater to 0). DF NDF B NB IDN DIF Symbolic Symbol argument defined). Macro-type Argument argument non-blank). Two Arguments macro-type arguments (or is If: less defined is than than or blank are O equal (or not (or identical different). Z NZ Expression Same as EQ/NE. G L Expression Same as GT/LT. NOTE A macro-type argument argument), angle brackets construction (which is a shown below, or denoted (as described form of symbolic enclosed within an up—arrow with in Section 7.3.1). <A,B,C> “/124/ An example of .IF a conditional EQ assembly ALPHA+1 directive ;ASSEMBLE follows: BLOCK IF ALPHA+1=0. . ENDC The two operators conditions, in & and that special allowed & Logical AND | Logical inclusive - For have they are example, the .IF DF conditional SYMl & meaning within DF and NDF in grouping symbolic arguments. operator assembly OR operator statement: SYM2 » « ENDC results and SYM2 in the are assembly of both defined. the conditional block if the symbols SYMI GENERAL ASSEMBLER DIRECTIVES Nested conditional directives take the form: Conditional Assembly Directive Conditional Assembly Directive - . ENDC .ENDC For example, the following conditional directives: SYMl SYM2 .IF DF .IF DF » . ENDC .ENDC can govern whether assembly 1is to occur. In the example outermost condition 1is unsatisfied, no deeper level of nested conditional statements within the program occurs. Each conditional directive. assembly listing. An block .ENDC is MACRO-11 permits levels. depth is 6.10.2 assembly block flagged with a must directive neéting Any statement that flagged with an error be terminated with an .(ENDC encountered outside a conditional an error code (0) the assembly depth of 16(10) conditional assembly 1in attempts to exceed this nesting code (0) in the assembly listing. Subconditional Assembly Block Directives: Subconditional directives may blocks to indicate: above, if the evaluation of be placed within .IFF, .IFT, .IFTF conditional 1. The assembly of an alternate body of of the block tests false. 2. The assembly of a non-contiguous body of conditional assembly block, depending upon conditional test in entering the block. 3. The unconditional assembly conditional assembly block. of a code when body level of the assembly condition code within the result of code within the the a The subconditional directives are described in detail 1in Table ©6-6. If a subconditional directive appears outside a conditional assembly block, an error code (0) is generated in the assembly listing. 6-43 GENERAL ASSEMBLER DIRECTIVES Table 6-6 Subconditional Assembly Block Directives Subconditional Directive Function .IFF If the condition tested upon entering the the code £false, 1is block assembly conditional following this directive, and continuing up to the of a subconditional directive or occurrence next "to the end of the conditional assembly to be .IFT included in the program. block, is 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, 1is to be .IFTF included in the program. The code following this directive, and continuing of a subconditional occurrence next the to up directive or to the end of the conditional block, is to be included in the program, assembly tested <condition regardless of the result of the upon entering the conditional assembly block. The implied argument of a subconditional directive is 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 1l: Assume .IF DF . that SYM symbol SYM is defined. ; TESTS TRUE, SYM IS DEFINED. ; THE FOLLOWING CODE. .IFF . ;TESTS FALSE. ;ASSEMBLE THE . IFT ;TESTS TRUE. . SYM IS DEFINED. FOLLOWING CODE. SYM IS DEFINED. ;BLE THE FOLLOWING CODE. ASSEMBLE DO NOT ASSEM- .IFTF . ;ASSEMBLE FOLLOWING CODE UNCONDITION;ALLY. LIFT . . ;TESTS TRUE. SYM IS DEFINED. ASSEM;BLE REMAINDER OF CONDITIONAL ASSEM;BLY BLOCK. . ENDC GENERAL ASSEMBLER DIRECTIVES EXAMPLE 2: Assume that symbol X is defined and that symbol Y is not defined. .IF DF .IF DF .IFF . X Y .IFT ; ; TESTS TRUE, SYMBOL X IS DEFINED. s TESTS FALSE, SYMBOL Y IS NOT DEFINED. ; TESTS TRUE, SYMBOL Y IS NOT DEFINED, sASSEMBLE THE FOLLOWING CODE. s TESTS FALSE, SYMBOL Y IS NOT DEFINED. ;DO NOT ASSEMBLE THE FOLLOWING CODE. .ENDC .ENDC EXAMPLE 3: Assume that symbol A is defined and that symbol B is not defined. .1IF DF A MOV A,R1 .1FF : TESTS TRUE. A IS DEFINED. ;ASSEMBLE THE FOLLOWING CODE. | +:TESTS FALSE. s ASSEMBLE MOV THE A IS DEFINED. DO NOT FOLLOWING CODE. R1,R0 .1IF NDF B . ;sNESTED CONDITIONAL DIRECTIVE IS NOT +sEVALUATED. . ENDC . ENDC EXAMPLE 4: Assume that symbol X is not defined and that symbol Y defined. .IF DF X ;sTESTS FALSE. is SYMBOL X IS NOT DEFINED. ;DO NOT ASSEMBLE .IF DF . Y THE FOLLOWING CODE. s NESTED CONDITIONAL DIRECTIVE IS NOT : EVALUATED. . IFF . :NESTED SUBCONDITIONAL DIRECTIVE :NOT EVALUATED. . IFT . + NESTED SUBCONDITIONAL DIRECTIVE IS :NOT EVALUATED. . ENDC «.ENDC 1S GENERAL ASSEMBLER DIRECTIVES ©.10.3 Immediate Conditional Assembly Directive: .IIF An immediate conditional assembly directive provides a means for writing a l-line conditional assembly block. 1In using this directive, no terminating .ENDC statement is regquired, and the condition to be tested is completely expressed within the 1line c¢ontaining the directive. Immediate conditional assembly directives are of the form: .IIF where: cond,arg,statement cond represents one of the defined for <conditional 6-5. ’ | represents and/or 1legal separator (comma, space, tab). arg represents the argument associated immediate conditional directive, expression, symbolic argument, or argument, as described in Table 6-5. ’ represents the separator between the conditional argument and the statement field. If the preceding argument is an expression, then a comma must be wused; otherwise, a comma, space, and/or tab may be used. statement For any 1legal condition tests assembly blocks in Table example, represents the specified statement if the condition is satisfied. the .IIF immediate DF conditional to with the i.e., an macro-type be assembled statement: FOO,BEQ ALPHA generates thé code BEQ if the ALPHA symbol As with FOO is defined within the .IF directive, Table ©6-5, an illegal .IIF directive 6.10.4 results in a condition argument, an the error or code source program. test a other null (A) than argument in the those listed specified assembly in in an listing. PAL-11lR Conditional Assembly Directives In order to maintain compatibility with programs developed under PAL-11R, the following conditionals remain permissible under MACRO-11, It is advisable, however, to develop future programs using the format for MACRO-11l conditional assembly directives. Directive .IFZ or .IFNZ or .IFL or .IFG or .IFLE .IFDF . IFNDF .IFEQ .IFNE .IFLT .IFGT Arguments Assemble expression expression expression expression expression symbolic argument symbolic argument expression=0 expression not equal 0 expression<0 expression>0 expression is < or =0 symbol is defined symbol is undefined The Block 1if rules governing these directives are the same as for conditional assembly directives previously described. 6-46 the MACRO-11 CHAPTER 7 MACRO DIRECTIVES 7.1 DEFINING MACROS In assembly-language programming, it is often convenient and desirable to generate a recurring coding sequence by invoking a single statement within the program. In order to do this, the desired coding sequence is first established with dummy arguments as a macro definition. Once a macro has been defined, a single statement calling the macro by name with a 1list of real arguments (replacing the corresponding dummy arguments in the macro definition) generates the desired coding sequence. This sequence is called the macro expansion. 7.1.1 .MACRO Directive The first statement of a macro definition must be a .MACRO This directive takes the label: where: .MACRO form: name, directive. dummy argument list label represents an optional statement label. name represents the programmer-—-assigned symbolic name of the macro. This name may be any legal symbol and may be used as a label elsewhere in the program. ' represents any and/or tab). dummy argument list represents legal a number of separator (comma, legal symbols space, (see 3.2.2) that may appear anywhere in the body of the macro definition, even as a label. These dummy symbols can be used elsewhere 1in the program with no conflict of definition. Multiple dummy arguments specified in this directive may be separated by any legal separator. The detection of a duplicate or an 1illegal symbol in a dummy argument list terminates the scan and causes an error code to be generated. A comment may follow the dummy argument list in a .MACRO directive, as shown below: .MACRO ABS A,B ;DEFINES MACRO ABS WITH TWO ARGUMENTS. MACRO DIRECTIVES NOTE Although it is legal for .MACRO directive, this a label to appear on a practice is discouraged, especially in the case of nested macro definitions, because invalid labels or labels constructed with the concatenation character will cause the macro directive to be ignored. This may result 1in improper termination of the macro definition. This NOTE also applied to .IRP, .IRPC, 7.1.2 and .REPT. .ENDM Directive The final directive statement of of the form: . ENDM where: every macro definition must be an .ENDM name name represents an optional argument specifying the symbolic name of the macro being terminated by the directive, as shown in the following example: . ENDM i TERMINATES sMACRO . ENDM ABS s TERMINATES ~ sMACRO THE CURRENT DEFINITION. THE CURRENT DEFINITION NAMED ABS. If specified, the symbolic name in the .ENDM statement must match name specified in the corresponding .MACRO directive. Otherwise, the the statement is flagged with an error code (A) in the assembly 1listing (see Appendix D). In either case, the current macro definition is terminated. Specifying the macro name in the .(ENDM statement thus permits MACRO-11 to detect missing .ENDM statements or improperly-nested macro definitions. The .ENDM contain a directive may label, shown .MACRO JSR .WORD . An is as be followed TYPMSG MESSGE R5,TYPMSG MESSGE ENDM by a comment field, but must not below: s TYPE A MESSAGE. ;END OF TYPMSG MACRO. .ENDM statement encountered by MACRO-11 outside a macro definition flagged with an error code (0) in the assembly listing (see Appendix D). NOTES l. Labels on .ENDM directives 2. Illegal labels will to be bypassed. cause are the ignored. directive MACRO DIRECTIVES 7.1.3 .MEXIT Directive The .MEXIT directive may be used to terminate a macro expansion before the end of the macro is encountered. This directive is also legal It is most useful in within repeat blocks (see Sections 7.6 and 7.7). The .MEXIT directive terminates the the context of nested macros. current macro as though an .ENDM directive had encountered. been .MEXIT directive bypasses the complexities of nested Using the conditional directives and alternate assembly paths, as shown in the following example: .MACRO ALTR N,A,B IF EQ N ; START CONDITIONAL ASSEMBLY BLOCK. +MEXIT .ENDC ;sTERMINATE MACRO EXPANSION. ;END CONDITIONAL ASSEMBLY BLOCK. . ENDM ; NORMAL END OF MACRO. Considering the above macro, in an assembly where the real argument (see Table 6-5), the for the dummy symbol N is equal to zero conditional block would be assembled, and the macro expansion would be terminated by the .MEXIT directive. When macros are nested, a .MEXIT directive causes an exit to the next higher level of macro expansion. 1is A .MEXIT directive encountered outside a macro definition with an error code (0) in the assembly listing. 7.1.4 flagged MACRO Definition Formatting A form-feed character used within a macro during eject however, the assembly of definition the macro definition. is not performed when the macro is expanded. causes a page A page eject, Conversely, when the .PAGE directive 1is specified within a macro definition, it is ignored during the assembly of the macro definition, but a page eject is performed when that macro is expanded. 7.2 CALLING MACROS .MACRO the A macro definition must be established by means of (see Section 7.1.1) before the macro can be expanded within directive Macro calls are of the general form: the source program. label: where: name label name real arguments represents an optional statement label. represents the name of the macro, as specified the .MACRO directive 7-3 (see Section 7.1.1). in MACRO DIRECTIVES real arguments represent symbolic arguments the arguments specified dummy directive. they are When multiple separated by Arguments to the which in arguments are any legal macro call replace the are o . MACRO specified, separator. treated as character strings whose usage is determined by the macro definition. Note that MACRO-1l1l accepts the ASCII value of 1lower-case alphabetic characters when .ENABL LC has been specified. When a macro name is the same as a user label, the appearance of the symbol in the operator field designates the symbol as a macro call; the appearance of the symbol in the operand field designates it as a label, as shown below: ABS: 7.3 MOV (RO),R1 sABS IS DEFINED AS A LABEL. BR ABS sABS IS CONSIDERED ABS #4 ,ENT,LAR ;ABS IS A MACRO CALL. ARGUMENTS TO BE A LABEL. T IN MACRO DEFINITIONS AND MACRO CALLS Arguments within a other arguments by Section 3.1.1. macro any definition of the legal or macro call are separated from separating characters described in — Macro definition arguments (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 For call can override example, the following expansion this contain multiple .MACRO correspondence macro definition (see and Section its 7.3.6). associated arguments: macro REN A,B,C - REN Arguments ALPHA,BETA,<Cl1l,C2> which enclosed 1in macro call: REN causes themselves paired angle <MOV contain brackets, separating as shown characters above. For must be example, the X,Y>,#44 ,WEV the entire expression MOV X,Y to replace all occurrences Real arguments within a of the macro strings a and are treated as symbol A in the macro definition. «call are considered to be character single entity during the macro expansion. 7-4 «««««« MACRO DIRECTIVES The up-arrow (~) construction is provided to allow angle brackets to be passed as part of the argument. This construction, for example, could have been used in the above macro call, as follows: ~/<MOV X,Y>/,#44,WEV REN causing the entire character string <MOV X,Y¥> to be passed as an argument. The following macro call: #44 ,WEV~ /MOV X,Y/ REN however, contains only two arguments (#44 and WEV"/MOV X,Y/), Dbecause the wup-arrow is a unary operator (see Section 3.1.3) and it is not preceded by an argument separator. As shown in the examples above, spaces can be wused within bracketed of such expressions. the legibility qument constructions to increase 7.3.1 Macro Nesting The nesting of macros, where the expansion of one macro includes a call to another, causes one set of angle brackets in the macro The definition to be removed from an argument with each nested call. depth of nesting allowed is dependent upon the amount of dynamic memory used by the source program being assembled. To pass an argument containing legal argument delimiters to nested macros, the argument in the macro definition should be enclosed within one set of angle brackets for each level of nesting, as shown in the It should be noted that this extra set of coding sequence below. angle brackets for each level of nesting is required 1in the macro definition, not in the macro call. .MACRO LEVEL2 LEVEL2 LEVEL1 DUM1,DUM2 <DUMI1> <DUM2> .ENDM .MACRO LEVEL2 DUM3 ADD MOV #10,R0 RO, (R1) + DUM3 . ENDM A call to the LEVEL1 macro, as shown below, for example: LEVEL1 <MOV X,R0>,<MOV R2,R0> causes the following macro expansion to occur: MOV ADD MOV MOV X,RO #10,R0 RO, (R1)+ R2,R0 MOV RO, (R1)+ MACRO DIRECTIVES When macro definitions are nested, i.e., when a macro definition is contained entirely within the definition of another macro, the inner definition is not a callable macro until the outer macro has been. called and expanded. For example, in the following coding: .MACRO LV1 A,B . .MACRO LVZ2 C . ENDM . ENDM the LV2 macro cannot been so0 invoked. definition invoked. 7.3.2 An cannot be be called Likewise, called Special Characters argument bracketed may include construction semicolons, or and expanded until the LV1 macro has any macro defined within the LV2 macro and expanded until LV2 has also been in Macro Arguments special if commas. that For .MACRO PUSH ARG MOV ARG, - (SP) characters without argument does not example, the enclosing contain them spaces, macro definition: in a tabs, .ENDM - PUSH causes the following MOV 7.3.3 X+3(%2) code to be generated: X+3(%2),-(SP) Passing Numeric Arguments as Symbols When macro arguments are passed, an absolute symbol value passed which is treated by the macro as a numeric string. An preceded by the unary operator backslash (\) is treated as a value in the current program radix. The ASCII characters this value are inserted in the macro expansion, and their defined in the context of the resulting code, as following example: .MACRO INC CON A,\B ;B CON -WORD 4 . ENDM C=0 INC IS TREATED AS ; PROGRAM . ENDM A'B: X,C numeric representing function is shown in the A,B B=B+1 .MACRO can be argument A NUMBER IN CURRENT RADIX. A,B ;A'B IS DESCRIBED IN SECTION 7.3.6. MACRO DIRECTIVES The above macro call X0: .WORD Note in this (INC) would thus expand to: 4 expanded code that the label X0: is the result of the concatenation of two real arguments. The single quote (') character in the label A'B: causes the real arguments X and 0 to be concatenated as they are passed during the expansion of the macro. This type of argument construction is described in further detail in Section 7.3.6. A subsequent call to the same macro would generate the following code: and so on, for later calls. The two macro definitions are necessary because the symbol associated with dummy argument B (i.e., C) cannot be updated in the CON macro definition, because its numeric value has already been substituted for its symbolic name, i.e., the character 0 has replaced C in the argument string. In the CON macro definition, the number passed is treated as a string argument. (Where the value of the real argument is 0, only a single 0 character is passed to the macro expansion.) Passing numeric values listings. For in this example, manner is versions useful of in identifying programs source created through conditional assemblies of a single source program can be identified through such coding as that shown below. Assume, for example, that the symbol ID in the macro call (IDT) has been equated elsewhere in the source program to the value 6. .MACRO IDT SYM /VO5A'SYM/ .IDENT ~ .ENDM ;WHERE . above 6 macro 7.3.4 If is more If call would then expand numeric value of Arguments arguments fewer THE THE UPDATE PROGRAM. to: /V05a6/ the Number definition, OF \ID .IDENT where VO5A IS ;VERSION IDT The ;ASSUME THAT THE SYMBOL ID TAKES ;ON A UNIQUE 2-DIGIT VALUE. an arguments code appear the symbol ID. in Macro Calls appear error of in (Q) 1in the macro call is generated the macro in call than in the the assembly than in macro listing. the macro definition, missing arguments are assumed to be null values. The conditional directives .IF B and .IF NB (see Table 6-5) can be used within the macro to detect missing arguments. The number of arguments can also be specified using the .NARG directive (Section 7.4.1). Note that a macro can be defined with no arguments. 7.3.5 Creating Local Symbols Automatically A label is often required in an expanded macro. In the conventional macro facilities thus far described, such a label must be explicitly 7-7 MACRO DIRECTIVES specified as an argument with each macro call. Be careful in issuing subsequent calls to the same macro, to avoid specifying a duplicate label as a real argument. This concern c¢an be eliminated through a feature of MACRO-11l which <creates a unique symbol where a label is required in an expanded macro. As noted in Section 3.5, MACRO-11l <can automatically c¢reate 1local symbols of the form n$, where n is a decimal integer within the range 64 through 127, inclusive. Such local symbols are created by MACRO-1l1 in numerical order, as shown below: | 64$ 65% - 1265 1278 This automatic facility is invoked on each call of a macro whose definition contains a dummy argument preceded by the guestion mark (?) character, as shown in the macro definition below: .MACRO ALPHA, TST BEQ A B ADD #5,A A,?B ; CONTAINS DUMMY ARGUMENT B PRECEDED BY s+QUESTION MARK. B: . ENDM A local symbol is generated automatically by MACRO-11l only when a real argument of the macro <call is either null or missing, as shown in Example 1 below, defined above. which reflects the expansion of the ALPHA nmacro If the real argument is specified in the macro call, however, MACRO-1l1 inhibits the generation of a local symbol and normal argument replacement occurs, EXAMPLE 1l: as shown in Example Generate a Local Symbol ALPHA Rl TST R1 BEQ ADD for 2 below. the Missing Argument: s SECOND ARGUMENT IS MISSING. 643 $#5,R1 | ; LOCAL SYMBOL IS GENERATED. 64S: EXAMPLE 2: Do Not Generate ALPHA R2,XYZ TST R2 BEQ ADD ~ XYZ #5,R2 a Local Symbol: ;SECOND ARGUMENT XYZ IS SPECIFIED. ; NORMAL ARGUMENT REPLACEMENT OCCURS. XYZ: Automatically-generated local symbols 16 (10) arguments of a macro definition. are restricted to the first Note that automatically-created 1local symbols resulting from the expansion of a macro, as described above, do not in any way influence local symbol block boundaries. In other words, such “automatically=-created 1local block in their own right. symbols do not establish a local symbol MACRO DIRECTIVES " # However, when a macro has several arguments earmarked for automatic local symbol generation, substituting a specific label for one such argument introduces a risk that assembly errors will result. This is because MACRO-1l1 constructs its argument substitution list at the point of macro invocation. Therefore, the appearance of any label, the .ENABL LSB directive, or the .PSECT directive, in the macro expansion will create a new local symbol block. This could leave local symbol references 1in the previous block and the symbol definitions in the new one, resulting in error codes in the assembly listing (see Appendix D). Furthermore, a subsequent macro expansion that generates local symbols in the new block may duplicate one of the symbols in question, resulting in an additional error code (P) in the assembly 7.3.6 listing. Keyword Arguments Macros may be defined with and/or invoked with keyword argument has the following form: keyword arguments. A name=string where The name represents the dummy string represents the real keyword argument may not argument, symbolic argument. contain unless properly delimited as described When a keyword definition, argument the appears in embedded in section the dummy specified string becomes argument separators 7.3. argument the default list of a macro real argument at macro call. When a keyword argument appears in the real argument list of a macro call, the specified string becomes the real argument for the dummy argument that exactly matches the specified name, whether or not the dummy argument was defined with a keyword. If a match fails, the entire argument specification is treated as the next positional real argument. A keyword argument may be specified anywhere in the dummy argument list of a macro definition and is part of the positional ordering of argument. On the other hand, a keyword argument may be specified anywhere in the real argument list of a macro call but does not affect the positional correspondence of the remaining arguments. 1 ¥ 2 3 4 5 ) 7 8 9 10 11 12 13 14 15 l6 LLIST ; : ; ME DEFINE A MACRO HAVING KEYWORDS .MACRO .WORD . WORD . WORD . ENDM H : : NOW INVOKE IN DUMMY ARGUMENT LIST TEST CONTRL=1l,BLOCK,ADDRES=TEMP CONTRL BLOCK ADDRES SEVERAL TIMES MACRO DIRECTIVES 17 18 19 20 21 000000 000000 000002 000004 000O0OOG 000000G 00000O0G TEST . WORD .WORD . WORD A,B,C A B C 000006 000006 000010 000012 000040 000030 000020 TEST .WORD .WORD .WORD ADDRES=20,BLOCK=30,CONTRL=40 40 30 20 TEST .WORD BLOCK=>5 1 . WORD . WORD 5 TEMP TEST . WORD CONTRL=5,ADDRES=VARIAB 5 -.WORD . WORD VARIAB 000014 000014 000016 000020 000001 000005 000000G 22 23 24 25 000022 000022 000024 000026 000005 000000 000000G 000030 000030 000032 000034 000001 000000 000000G .WORD .WORD .WORD 000036 000036 000040 000042 000001 000000 o00000O0C TEST .WORD .WORD .WORD 000001 .END TEST 1 TEMP 26 27 28 29 30 7.3.7 ADDRES=JACK!JILL 1 JACK!JILL Concatenation of Macro Arguments The apostrophe or single quote character (') delimiting character in macro definitions. precedes and/or follows a dummy argument removed, and the substitution of point. For example, in the following A'B: when .MACRO .ASCI1IZ .BYTE it XY: is expanded, .ASCIZ .BYTE a macro definition the real argument occurs statements: at 1is that DEF A,B,C /C/ ''"A,''B the macro DEF DEF in operates as a legal A single quote that is called through the statement: X,Y,<MACRO-11> as follows: /MACRO-11/ 'X,'Y In expanding the first 1line, the scan for the first argument terminates wupon finding the first ' character. Since A is a dummy argument, the ' is removed. The scan then resumes with B; B is also noted as another dummy argument. The two real arguments X and Y are then concatenated to form the label XY:. The third dummy argument 1is noted 1in the operand field of the .ASCIZ directive, causing the real argument MACRO-11l to be substituted in this field. 7-10 MACRO DIRECTIVES When evaluating the arguments to the .BYTE directive during expansion of the second line, the scan begins with the first ' character. Since it is neither preceded nor followed by a dummy argument, this ' character remains in the macro expansion. The scan then encounters the second ' character, which is followed by a dummy argument and 1is therefore discarded. The scan of argument A 1is terminated upon encountering the comma (,). The third ' character is neither preceded nor followed by a dummy argument and again remains in the macro expansion. The fourth (and last) ' character is followed by another dummy argument and is likewise discarded. (Note that four ‘' characters were necessary in the macro definition to generate two ' characters in the macro expansion.) | 7.4 MACRO ATTRIBUTE DIRECTIVES: .NARG, .NCHR, AND .NTYPE Three directives are available in MACRO-11 which allow the wuser to determine certain attributes of macro arguments. The use of these directives permits selective modifications of a macro expansion, depending on the nature of the arguments being passed. These directives are described separately below. 7.4.1 .NARG Directive The .NARG directive is used to determine the number of arguments in the macro call currently being expanded. Hence, the .NARG directive can appear only within a macro definition; if it does not, an error code (0) 1is generated in the assembly listing. This directive takes the form: label: where: .NARG symbol label represents an optional symbol represents any legal symbol. This symbol 1is equated to the number of arguments in the macro call currently being expanded. If a symbol is not specified, the .NARG directive is flagged with an error code (A) in the assembly listing. 7-11 statement label. MACRO DIRECTIVES example of the .NARG directive follows: LTITLF NARG NE LN An JMACRNA NOPP, NUM MNARG SYM JIF EQ,SYM O P~ JMEXTIT TFF JRERPT M N NOR i@ 11 12 e ENDM o ENDC « ENDM NOPP Apegen 1S prarae « NARG SYM o IF MEXTITY EQ,SYM . IFF JREPT NOP ENDM s ENDC {6 17 annaee {R APAAA Y NOPP 6 JNARG SYM JMEXTT o TFF P2QARA REPT () NOP e ENDM A00QA0Q2 QAag2un NOP NOP NOP NOP NOP NP AARAA2 . AAR2UR R 002U ARRAGU QCOQA24Q PARBREe QQ@a2uR AAAA1I2 o0agu~ araRr12 «ENDC {19 20 et 7.4.2 Q20001 « ENP J.NCHR Directive The .NCHR directive, which can appear anywhere in a MACRO-1l1] program, is used to determine the number of characters in a specified character string. This directive, which is useful in calculating the length of macro arguments, label: .NCHR where: label symbol takes the following form: symbol,<string> represents an optional statement label. represents any legal symbol. This symbol 1is the number of characters in the specified character string. If a symbol is not specified, the .NCHR directive is flagged with an error code (A) 1in the assembly 1listing (see equated to Appendix D). ~ 7-12 MACRO DIRECTIVES r represents : and/or {string> tab). legal separator (comma, space, represents a string of printable characters. The character string need be enclosed within angle brackets specified if the a 1legal separator (comma, space, and/or tab). If the delimiting characters do not match or if the ending delimiter cannot be detected because of a syntactical error in the character string (thus prematurely terminating its evaluation), the .NCHR directive is flagged with an error code (A) in the assembly listing. , . . An example of the .NCHR directive N AL D O P NCHR C(CHAR,MESS SYM,MESS JWORD SYM «ASCII «EVEN /MESS/ o ENDM ARPARD MSG1 ¢t CHAR HELLO> PENARS e SYM,HMELLO pe@roe repARS «WORD earee? SYM 112 «ASCIT /HELLOY/ NCHR tas earangd t14 aearns 114 tt? «EVEN 1e 13 ta The PR JENR .NTYPE Directive .NTYPE directive is used to determine the specified macro argument. within a macro definition; with (") only contains follows: «MACRD aRraRrR6 7.4.3 (<>) or up-arrows character string «TITLF NCHR PrAQRY & any an error code (0) the form: label: J.NTYPE where: label addressing mode of a Hence, the .NTYPE directive can appear only if it appears elsewhere, in the assembly listing. it 1is flagged This directive takes symbol,aexp represents an optiqmal statement label. represents any legal symbol. This synm bol is equated to the 6-bit addressing mode of the following argument. If a symbol is not specified, the .NTYPE directive is flagged with an error code (A) ' in the assembly listing. represents any and/or tab). 7-13 legal separator (comma, space, MACRO DIRECTIVES represents any legal address expression, as used with an opcode. If no argument is specified, the result will be zero. aexp An example of shown below: the use of an é 3 .NTYPE directive .TITLE NTYPE «MACRO 4 JNTYPE in a macro definition SAVE, ARG SYM, ARG S o I1F é MOV ARG,=(SP) $REGISTER o JFF MOV #HARG, = (SP) tNONeREGISTFR 7 8 9 FR,SYMRTQ sENDC 1@ i1 12 13 is MOQODE “MODE JENPM P207200 0OQAAQAA TFMP JWORD g SAVE R1 {4 15 16 2pPnn2 ARROA Y ArARR2 21P1Ub +NTYPE SYM,R1 o IF FQR,SYMRT7Q MAV R{,=(SP) tREGISTER #R1,«(SP) tNONeREGISTER . IFF MAV « ENNC 17 18 19 peac0uy “ SAVFE PPARET «MNTYPE M127U6 TEMP W IF ER,SYMR T MAY TFMP,=(8P) sREGISTER #TEMP,=(SP) INON=REGISTFR MAY PORARR® MNDF MDDE + ENDC 2e el 22 feAa2M 1 o FND For additional information concerning Chapter 5 and Appendix B, Section B.2. 7.5 MONDE SYM, TEMP o« IFF PAAPRY MODE .ERROR AND addressing modes, refer to .PRINT DIRECTIVES The .ERROR directive is used to output messages to the 1listing file A common use of this directive is to provide during assembly pass 2. a diagnostic announcement of a rejected or erroneous macro call or to alert the wuser to the existence of an illegal set of conditions specified in a conditional assembly. If the 1listing file 1is not specified, the .ERROR messages are output to the command output device. The .ERROR directive takes the form: label: .ERROR expr ;text MACRO DIRECTIVES represents an optional statement label. label where: represents an optional expression whose expr output when the during assembly. value denotes the beginning of the text string. ; represents the specified message text the .ERROR directive. Upon encountering an .ERROR directive anywhere in MACRO-11 outputs a single line containing: a associated source o The sequence number of the .ERROR directive statement W The value of the current location countér = The value of the expression, W L program, if one is specified . . The source line containing the .ERROR directive. For example, with (P) An error code . is .ERROR directive is encountered the following directive: .ERROR : INVALID MACRO ARGUMENT A causes a line in the following form to be output to the listing file: Seq. No. P Loc. No. 512 005642 Exp. Text Value 000076 "~ .ERROR A . INVALID MACRO ARGUMENT The .PRINT directive is identical in function to the .ERROR directive, except that it is not flagged with the P error code. 7.6 INDEFINITE REPEAT BLOCK DIRECTIVES: .IRP AND .IRPC An indefinite repeat block is a structure that is similar to a macro essentially a macro definition that has only one dummy definition; this argument. At each expansion of the indefinite repeat range, dummy argument is replaced with successive elements of a specified its An indefinite repeat block directive and real argument list. associated repeat range are coded in-line within the source program. This type of macro definition and expansion does not require calling the macro by name, as required in the expansion of conventional macros previously described in this section. An indefinite repeat block can appear either within or outside another or repeat block (see indefinite repeat block, macro definition, The rules for specifying indefinite repeat block Section 7.7). arguments are the same as for specifying macro arguments (see Section 7.3). 7.6.1 .IRP Directive The .IRP directive is used to replace a dummy argument with successive This replacement in an argument string. specified real arguments process occurs during the expansion of an indefinite repeat block range. This directive takes the following form: 7-15 MACRO DIRECTIVES label: L.IRP sym,<argument (range of indefinite list> repeat block) L . ENDM where: label sym represents an represents a optional dummy statement argument label. that is successively replaced with the specified real arguments enclosed within the angle brackets. If no dummy argument 1is specified, the .IRP directive is 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 consist of one or more characters; multiple arguments must be separated by any 1legal separator (comma, arguments range are space, specified, represents the for occurrence each block of and/or no code of tab). action a to is be real If no real taken. repeated argument once in the list. The range may contain other macro definitions and repeat ranges. The .MEXIT directive (see Section 7.1.3) is legal within the range . ENDM of an indicates indefinite the end of repeat the block. indefinite repeat block range. An example 7.6.2 The of the use of the .IRP directive is shown in Figure 7-1. .J.IRPC Directive .IRPC directive 1is available to permit single character substitution, rather than argument substitution. On each iteration of the indefinite repeat range, the dummy argument is replaced with each successive character in the specified string. The .IRPC directive is specified as follows: label: L.IRPC sym,<string> - (range of indefinite repeat block) - . ENDM where: label represents an optional 7-16 statement label. il MACRO DIRECTIVES represents a dummy argument that sym is successively arguments no dummy real specified the with replaced If enclosed within the angle brackets. the .IRPC directive is argument is specified, in the assembly (A) flagged with an error code listing. represents any and/or tab). ’ " <string> - , legal separator (comma, space, represents a list of characters enclosed within angle brackets to be used in the expansion of the indefinite repeat Although range. the angle required only when the string brackets are is their use contains separating characters, recommended for legibility. range represents the block of code to be repeated once for each occurrence of a character in the list. The range may contain macro definitions and repeat ranges. repeat indicates the end of the indefinite repeat block block. .ENDM The .MEXIT directive (see Section 7.1.3) is legal within the range of an indefinite | , range. An example of the use of the .IRPC directive is shown in Figure 7-1. LTITLE ! «LIST 2 IRPTST ME 3 4 5 6 ,Iflp 7 8 200002 2080P04 AAPN1ID A20014 PRA20 V20024 Q16720 16722 ©B16720 Q16720 016727 016722 e . 1RPC 11 12 APAN3E 220234 P2004Q 200044 POPN50 Vi P0QAS4 15 16 112744y 112741 112741 112741 (12741 112741 #ix,=(R1) MOvVB MA,~(R1) #B,=(RY{) #C,=(R1) JENDM MOVEB MOVB 0QAROQ006 QPQGQQG QQPR0POG MOVB MOVvB MOVB QQOQQ0G X,<ABCDEF> MOVB QP0QR06 Q000206 #D,=(R1) BE,~(R1) #F,»(R1) JEND pegeey’ Figure 7-1 7.7 MOV MOV AA, (RD)e BR, (RA)+ CCy (R DD, (RA)« EE, (RDB)+ FF,(RQ)» , 10 13 X,(RO)e L ENDM MOV MOV MOV MOV QAABARAG 0ROPROG 200200206 nNpRR226 QPAAMAG ARYO0CAG x,tlA,BEl,fiCaD&.EE,FFb MOV Example of .IRP and .IRPC Directives REPEAT BLOCK DIRECTIVE: .REPT, .ENDR of fula block of code a number to duplicate It is sometimes use times This duplication of code |is with other source code. in-line accomplished by creating a repeat block, wusing a directive in the form: 7-17 MACRO DIRECTIVES label: .REPT exp - (range of repeat block) - . ENDM where: label represents exp an represents optional any statement 1legal label. expression whose controls value the number of times the block of code is to be assembled within the program. When the expression value 1is 1less than or equal to zero (0), the repeat block is not assembled. If this expression statement assembly range 1is is not an absolute flagged with listing. represents the block of value, an error code to code be the (A) .REPT in repeated the the number of times determined by the specified expression value. The repeat block may contain macro other definitions, indefinite repeat blocks, repeat blocks. The .MEXIT directive legal within the range of a repeat block. . ENDM indicates the end of the repeat block range. The terminating statement in a repeat block can be either an .ENDM directive or an .ENDR directive. or .ENDR 7.8 MACRO LIBRARY DIRECTIVE: The .MCALL and/or or 1is directive allows user-defined macro .MCALL you to indicate definitions in advance that are those system required in the assembly of the source program. The .MCALL directive allows vyou to specify the names of all system or user macro definitions not defined within the source program but which are required to assemble the program. The .MCALL directive must appear before the first occurrence of a call to any externallywdeflned macro. The .MCALL directive is of the form: .MCALL where: argl,arg2,...argn argl, arg2,... represent definitions argn program. The separated by and/or The .MCALL user-defined the symbolic required in the symbolic any tab). directive and thus provides system macro libraries legal names of assembly of macro names separator the means to during assembly. the the macro source may be (comma, space, access both The /ML sw;tch under RSX-1ll and the /LIBRARY qualifier under IAS and RT-11, specified in connection with an input file specification, 1ndlcate to MACRO-11 that the file is a macro llbrary. When a macro call is encountered in the source program, MACRO-11 first searches the user macro continues library the for the search with named the macro definitions, and, system macro library. 7-18 if necessary, MACRO DIRECTIVES In Any number of such user-supplied macro files may be designated. cases of multiple 1library files, the search for the named macros The search continues 1in begins with the last such file specified. order until the required macro definitions are found, reverse terminating again, if necessary, with a search of the system macro library. If any named macro is not found upon completion of the search, 1i.e., if the macro is not defined, the .MCALL statement is flagged with an Furthermore, a statement error code (U) in the assembly 1listing. elsewhere in the source program which undefined macro is flagged with an error attempts to expand such an code (O) 1in the assembly listing. The command strings to MACRO-11, through which file specifications are supplied, are described 1in detail in the appropriate system manual (see Section 0.3 in the Preface). 7-19 APPENDIX A MACRO-11 CHARACTER SETS A.1 ASCII CHARACTER SET EVEN PARITY 7-BIT OCTAL CODE CHARACTER 0 1 000 001 NUL SOH 1 002 STX 0 003 ETX 1 004 EOT 0 005 ENQ 0 1 1 006 007 010 ACK BEL BS BIT 0 0 1 0 011 012 013 014 HT LF VT FF REMARKS Null, tape feed, CONTROL/SHIFT/P. Start of heading; also SOM, start of message, CONTROL/A. Start of text; also EOA, end of address, CONTROL/B. also EOM, end of End of text; message, CONTROL/C. End of transmission (END); off TWX machines, CONTROL/D. also (ENQRY) ; Enquiry shuts WRU, CONTROL/E. Acknowledge; also RU, CONTROL/F. Rings the bell. CONTROL/G. format FEO, also Backspace; some backspaces effector. machines, CONTROL/H. Horizontal tab. CONTROL/I. Line feed or Line space (new line); to paper advances duplicated by CONTROL/J. Vertical tab (VTAB). to Feed Form top CONTROL/L. (PAGE). return next line, CONTROL/K. of page next to beginning of 1 015 CR Carriage 1 016 SO shift out; changes ribbon color to 0 017 SI shift in; changes ribbon color 1 020 DLE Data link escape. 0 021 DC1l line; duplicated by CONTROL/M. red. CONTROL/N. black. CONTROL/O. Device control 023 DC3 0 024 DC4 CONTROL/P (DCO). turns 1; transmitter (READER) on, CONTROL/Q (X ON). ©0 022 DC2 Device control 2; 1 to turns CONTROL/R punch or auxiliary on. (TAPE, AUX ON). control 3; Device control 4; turns Device transmitter (READER) off, CONTROL/S (X OFF). auxiliary OFF). off. turns punch CONTROL/T oOr (AUX MACRO-11 CHARACTER SETS EVEN 7-BIT PARITY OCTAL BIT CODE CHARACTER 025 NAK REMARKS Negative ERROR. SYN also Synchronous file ETB End of transmission LEM, logical Cancel (CANCL). EM End medium. SUB Substitute. ESC Escape. of File Group RS Record Us Unit SP Space. + N~ =@ 00N FS | =~ block; end CONTROL/W. CAN GS of also medium. CONTROL/X. CONTROL/Y. CONTROL/Z. CONTROL/SHIFT/K. separator. CONTROL/SHIFT/L. separator. separator. separator. Accent ERR, (SYNC) . CONTROL/V. HIQPMBUOQOWIP® VIV I A o OOLNOUID WNHON - 026 acknowledge; CONTROL/U. acute or CONTROL/SHIFT/M. CONTROL/SHIFT/N. CONTROL/SHIFT/O. apostrophe. 7-BIT OCTAL BIT CODE CHARACTER 112 113 114 115 116 117 120 121 122 123 124 125 126 127 130 131 135 136 137 140 141 142 143 144 145 146 147 150 151 152 153 154 155 156 157 160 161 162 163 164 165 166 167 170 171 172 173 174 175 170 177 * © -~ 4 134 TN X ECSC AN RQUOIERAURITAQMMD QWO T 132 Yt S EVEN PARITY N KX E<SCHNODOWOZERHRG MACRO-11 CHARACTER SETS DEL REMARKS SHIFT/K. SHIFT/L. SHIFT/M. * * % Accent grave. This code generated by ALTMODE. This code generated by PREFIX (if present). DELETE, RUBOUT. Appears as # or ~ on some machines. ** + Appears as _ on some machines. A-3 key ", MACRO-11 CHARACTER SETS A.2 RADIX-50 CHARACTER SET Character space ASCII Octal Equivalent 40 | Radix-50 Equi?alent 0 A-Z 101-132 1-32 $ 44 33 . 56 34 unused 35 0-9 The 60-71 maximum Radix-50 value 1is, 36-47 thus, 47*%50% +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 1is performed in octal): X=113000 2=002400 B=000002 X2B=115402 SINGLE CHAR. OR FIRST CHAR. SECOND THIRD CHARACTER CHARACTER Space A B C D E F G H I J K L M N 0 P Q R S T U 000000 000001 000002 000003 000004 000005 000006 000007 000010 000011 000012 000013 000014 000015 000016 000017 000020 000021 000022 000023 000024 000025 X Y 000030 000031 Space A B C D E F G H I J K L M N O P Q R S T U 000000 003100 006200 011300 014400 017500 022600 025700 031000 034100 037200 042300 045400 050500 053600 056700 062000 065100 070200 073300 076400 101500 Space A B C D E F G H I J K L M N 0 P Q R S T U X Y 113000 116100 X Y \Y W Z $ 104600 107700 121200 124300 ' W Z $ 000000 000050 000120 000170 000240 000310 000360 000430 000500 000550 000620 000670 000740 001010 001060 001130 001200 001250 001320 001370 001440 001510 - 001560 001630 \' W 002020 Z 001700 001750 002070 A-4 $ 000026 000027 000032 000033 MACRO-11 CHARACTER SETS SINGLE CHAR. OR FIRST CHAR. . Unused 0 1 2 3 4 5 6 7 8 9 127400 132500 135600 140700 144000 147100 152200 155300 160400 163500 166600 171700 SECOND CHARACTER . Unused 0 1 2 3 4 5 6 7 8 9 002140 002210 002260 002330 002400 002450 002520 002570 002640 002710 002760 003030 THIRD CHARACTER . Unused 0 1 2 3 4 5 6 7 8 9 000034 000035 000036 000037 000040 000041 000042 000043 000044 000045 000046 000047 I APPENDIX B MACRO-11 ASSEMBLY LANGUAGE AND ASSEMBLER DIRECTIVES B.1 SPECIAL CHARACTERS Function @“ .. Character (comma) 2 e @ W i N =D space IV A (apostraphe)V \ vertical B.2 tab Label terminator Direct assignment operator Register term indicator Item terminator or field terminator - Item terminator or field terminator Immediate expression indicator Deferred addressing indicator Initial register indicator Terminal register indicator Operand field separator Comment field indicator Arithmetic addition operator or auto increment indicator Arithmetic subtraction operator or auto decrement indicator Arithmetic multiplication operator Arithmetic division operator Logical AND operator 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 argument indicator Macro call numeric argument indicator Source line terminator SUMMARY OF ADDRESS MODE SYNTAX Address mode syntax is expressed 1in the summary below using the following n symbols: is an integer between 0 and 7 representing a register number; R is a register expression; E 1is an expression; and ER is either to 7. a register expression or an expression in the range 0 MACRO-11 ASSEMBLY LANGUAGE AND ASSEMBLER DIRECTIVES Address Mode - Format - Address Mode Name Number R Register On @R or Register 1n (ER) + Autoincrement o 2n The contents of the register specified as (ER) are incremented after being used as the address of the operand. @(ER)+ | Autoincrement Deferred 3n The register specified as contains the pointer to address of the operand; (ER) deferred Meaning Register operand. Register dress of register after R contains R contains the the ad- operand. (ER) 1is the : (ER) the the incremented use. - (ER) Autodecrement 4n The contents of the @- (ER) Autodecrement 5n The contents of the register Index én The expression E, | E (ER) Deferred specified as (ER) are decremented before being used as the pointer to the address of the operand. -~ @E (ER) Index Deferred register specified as (ER) are decremented before being used as the address of the operand. 7n plus the contents of the register specified as (ER), form the address of the operand. The expression E, plus the contents of the register specified as (ER), vyield a pointer to the address of the operand. #E Immediate Q#E E QE B.3 27 The expression operand itself. ~Absolute 37 The Relative 67 The address of the operand E, relative to the instruction, follows the instruction. Relative 77 Deferred expression address of the ' The address E is the E is the operand. of the operand is pointed to by E whose address, ‘relative to the instruction, follows the instruction. ASSEMBLER DIRECTIVES The MACRO-11 assembler directives table. For a detailed are description B-2 summarized of each in the directive, following the table MACRO-11 ASSEMBLY LANGUAGE AND ASSEMBLER DIRECTIVES AS contains references to the appropriate sections in manual. % ~ 3 Section Form 3.3 3.6 | ~ body of the | ' Reference the ~ | Operation A single followed by quote (apostrophe) one ASCII character generates a word which contains the 7-bit ASCII the representation of character in the low-order byte and zero in the high-order byte. This character is also used as a concatenation indicator in the expansion of macro arguments (see Section 7.3.6). " 6.3.3 | A double gquote followed by two | ASCII characters 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 is stored in the high-order byte. "Bn 6.4.1.2 - 5 - "Cexpr 6.4.2.2 | | 6.4.1.2 | "Fn . radix the wvalue n binary number. | “Dn | Temporary to be the expression's value complemented. | Temporary radix wvalue n to be causes treated Temporary numeric control; the causes to be ones- control; be causes treated as a Temporary numeric control; the wvalue n to decimal number. 6.4.2.2 control; as a causes treated as a sixteen-bit floating-point number. “On 6.4.1.2 ' Temporary the value octal “"Reccce .ASCII /string/ - 6.3.7 6.3.4 radix control; causes n to be treated as an number. Convert ccc to Radix-50 form. Generates a block of data | containing the ASCII equivalent of the character string (enclosed in ' delimiting characters), one character per byte. MACRO-11 ASSEMBLY LANGUAGE AND ASSEMBLER DIRECTIVES Section Reference Form .ASCIZ /string/ 6.3.5 Operation Generates a block containing the ASCII the character string delimiting character per .ASECT characters), byte, with the specified Begin the absolute or resume 6.5.3 Reserves a block of storage space whose length in words is determined by the specified expression. .BYTE expl,exp2,.. Generates each byte .CSECT [name] Begin .DSABL arg Disables the function the argument. .ENABL arg Enables (invokes) the specified by the argument. [exp] Indicates the logical end source program. The .END .ENDM .ENDR successive bytes of data; contains the value of the corresponding specified expression. or resume named [name] or unnamed relocatable program section. This directive is provided for PDP-11 other with compatibility assemblers. specified by function of the optional argument specifies the transfer address where program execution is to begin. Indicates the end assembly block. .ENDC one =zero Reserves a block of storage space whose length in bytes is determined by the specified expression. exp .BLKW exp a byte terminating string. program section. .BLKB of data equivalent of (enclosed 1in Indicates the end of of a conditional the current repeat block, indefinite repeat block, or macro definition. The optional name, 1if used, must be identical to the name specified 1in the macro definition. Indicates the end of the current repeat block. This directive is provided for compatibility with other PDP-11 assemblers. .EOT Ignored; indicates end-of-tape (which is detected automatically by the hardware). compatibility assemblers. B-4 It is included for with earlier MACRO-11 ASSEMBLY LANGUAGE AND ASSEMBLER DIRECTIVES Form ~ Section Reference Operation .ERROR exp;text 7.5 User-invoked error directive; causes output to the listing file or the command output device containing the optional expression and the statement containing the directive. .EVEN 6.5.1 Ensures that the current location counter contains an even address by adding 1 if it is odd. 6.9 Defines .GLOBL syml,sym2,... global symbol(s) specified as .IDENT /string/ 6.1.5 Provides a means of 1labeling the object module with the program version number. The version number is the Radix-50 string appearing between the paired delimiting characters. .IF ©.10.1 Begins a conditional assembly block of source code which is included in the assembly only if the stated condition 1is met with respect to the argument(s) specified. 6.10.2 Appears only within a conditional assembly block, indicating the beginning of a section of code to be assembled if the condition upon entering the block tests false. cond,argl IFF LIFT ' 6.10.2 ' | Appears only within assembly block, a conditional the indicating section of code - “ the symbol (s). beginning of a be assembled if the condition entering the block tests true. IFTF 06.10.2 Appears only within a conditional assembly block, indicating beginning of a section of <code be assembled unconditionally. .IIF cond,arg, statement ' ©6.10.3 to upon the to Acts as a 1l-line conditional assembly block where the condition is tested for the argument specified. assembled tests B-5 true. The only 1f statement is the condition MACRO-11 ASSEMBLY LANGUAGE AND ASSEMBLER DIRECTIVES Section Reference Form .IRP Indicates the beginning of an indefinite repeat block in which the symbol specified 1is replaced with successive elements of the real argument list enclosed within angle brackets. sym, <argl,arg2,...> .IRPC Operation sym,<string> Indicates the beginning indefinite repeat block the specified symbol takes value of optionally brackets. Task high .LIST successive characters, enclosed within angle Reserves two words into .LIMIT [arg] .MACRO name,argl, arg2,... 6.1.1 of an in which on the which ~ the Builder inserts the low and addresses of the task image. Without an argument, the LLIST directive increments the 1listing level count by 1. With an argument, this directive does not alter the listing level count, but formats the assembly listing according to the argument specified. Indicates the definition name and having the arguments. start of a macro the specified following dummy ~ | Specifies the symbolic names of the user or system macro definitions required in the assembly of the current user program, but which are not defined within the program. Causes an .MEXIT macro repeat .NARG symbol exit from expansion block. or the current indefinite Can appear only within a macro definition; equates the specified symbol to the number of arguments in the macro call currently being expanded. .NCHR NLIST symbol,<string> [arg] Can appear program; specified characters Without directive an anywhere equates to the in the 1in a source the symbol number = of specified string. argument, decrements the the .NLIST listing level count by 1. With an argument, this directive suppresses that portion of the specified by the argument. B-6 listing MACRO-11 ASSEMBLY LANGUAGE AND ASSEMBLER DIRECTIVES Section Reference Form .NTYPE symbol,aexp 7.4.3 Operation Can appear definition; only within a macro equates the symbol to the 6-bit addressing mode of specified address expression. the .ODD 6.5.2 Ensures that the current 1location counter contains an odd address by adding 1 if it is even. . PAGE 6.1.6 Causes the assembly listing to skip to the top of the next page, increment the page count. .PRINT exp;text 7.5 and to User-invoked message directive; causes output to the listing file or the command output device containing the optional expression and the statement directive. containing the .PSECT name,attl,... attn 6.8.1 Begin or resume a named or unnamed program section having the specified attributes. .RADIX n 6.4.1.1 Alters the current program radix to n, where n is 2, 8, or 10. .RAD50 /string/ ' 6.3.6 Generates a block of data containing the Radix-50 equivalent of the character string enclosed within delimiting characters. .REPT exp | 7.7 Begins a repeat block; causes the section o0of code up to the next .ENDM or L.ENDR directive to be repeated the number of times specified as exp. .SBTTL string 6.1.4 Causes the specified string to be printed as part of the assembly listing page header. The string component of each .SBTTL directive is collected 1into a table of contents at the beginning of the assembly listing. .TITLE string 6.1.3 Assigns the first six Radix-50 characters in the string as an object module name and causes the string to appear on each page of the assembly listing. .WORD expl,exp2,.. i 6.3.2 Generates successive words of data; each word contains the value of the corresponding specified expression. APPENDIX C PERMANENT SYMBOL TABLE (PST) The permanent symbol table (PST) contains those symbols which are automatically recognized by MACRO-11l. These symbols consist of both op codes and assembler directives. The op codes (i.e., the instruction set) are 1listed first, followed by the directives which cause specific actions during assembly. For a detailed description of PDP-11 Processor Handbook. C.l1 the instruction set, see the appropriate OP CODES OCTAL MNEMONIC VALUE FUNCTIONAL ADC ADCB ADD ASH ASHC ASL ASLB ASR ASRB BCC BCS BEQ BGE BGT 005500 Add Carry 105500 060000 072000 073000 006300 106300 006200 106200 103000 103400 001400 002000 003000 Add Carry (Byte) Add Source To Destination Shift Arithmetically Arithmetic Shift Combined Arithmetic Shift Left Arithmetic Shift Left (Byte) Arithmetic Shift Right Arithmetic Shift Right (Byte) Branch If Carry Is Clear Branch If Carry Is Set Branch If Equal Branch If Greater Than Or Equal Branch If Greater Than BHI BHIS BIC 101000 103000 040000 Branch If Higher Branch If Higher Bit Clear BICB BIS BISB BIT BITB BLE BLO BLOS BLT 140000 050000 150000 030000 130000 003400 103400 101400 002400 Bit Clear (Byte) Bit Set Bit Set (Byte) Bit Test Bit Test (Byte) Branch If Less Than Or Equal Branch If Lower Branch If Lower Or Same Branch If Less Than Or NAME Same ~ PERMANENT SYMBOL TABLE (PST) MNEMONIC OCTAL VALUE BMI BNE BPL BPT BR BVC BVS 100400 001000 100000 000003 000400 102000 102400 Branch If Minus Branch If Not Equal Branch If Plus Breakpoint Trap Branch Unconditional Branch If Overflow Is Clear Branch If Overflow Is Set CMPB 120000 Compare Source To COM COMB 005100 105100 Complement Destination Complement Destination DEC DECB 005300 105300 Decrement Destination Decrement Destination DIV EMT FADD 071000 104000 075000 Divide Emulator Trap Floating Add FDIV FMUL FSUB 075030 075020 075010 HALT 000000 Halt INC INCB 005200 105200 Increment Destination Increment Destination 10T JMP JSR MARK 000004 000100 004000 006400 Input/Output Trap Jump » Jump To Subroutine Mark MFPS 106700 ~ Instruction Space Move from PS (LSI-11) MOV MOVB 010000 110000 MTPI 006600 MTPS 106400 ‘MUL NEG NEGB NOP RESET RETURN ROL ROLB ROR 070000 005400 105400 000240 000005 000207 006100 106100 006000 CALL CCC CLC CLN CLR CLRB CLV CL%Z CMP 004700 000257 000241 000250 005000 105000 000242 000244 020000 FUNCTIONAL NAME Jump To Subroutine (JSR PC,xxXx) Clear All Condition Codes Clear C Condition Code Bit Clear N Condition Code Bit Clear Destination Clear Destination (Byte) Clear V Condition Code Bit Clear 7Z Condition Code Bit Compare Source To Destination Destination (Byte) (Byte) (Byte) MFPI 006500 Floating Divide Floating Multiply - Floating Subtract (Byte) Move From Previous Move Source To Destination Move Source To Destination (Byte) Move To Previous Instruction Space Move to PS ' (LSI-11) Multiply Negate Destination Negate Destination (Byte) No Operation Reset External Bus Return From Subroutine Rotate Left Rotate Left Rotate Right (Byte) (RTS PC) PERMANENT SYMBOL TABLE (PST) OCTAL MNEMONIC VALUE RORB 106000 RTI 000002 FUNCTIONAL NAME Rotate Right (Byte) Return From Interrupt (Permits a trace trap) RTS RTT SBC SBCB SCC SEC SEN SEV SEZ SOB SUB SWAB SXT TRAP TST TSTB WAIT XOR 000200 000006 Return From Subroutine 005600 105600 Subtract Carry 000277 000261 000270 000262 000264 077000 160000 000300 006700 104400 005700 105700 000001 074000 Return From Interrupt (inhibits trace trap) Subtract Carry (Byte) Set All Condition Code Bits 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 Destination Swap Bytes Sign Extend Trap Test Destination Test Destination ‘ (Byte) Wait For Interrupt Exclusive OR OP CODES FLOATING POINT PROCESSOR ONLY OCTAL FUNCTIONAL NAME MNEMONIC VALUE ABSD ABSF ADDD ADDF CFCC 170600 170600 172000 172000 170000 Make Absolute Double Make Absolute Floating Add Double CLRD LDCDF 170400 170400 173400 173400 174400 174400 177400 Clear Double Clear Floating Compare Double Compare Floating Divide Double Divide Floating Load And Convert From LDCFD 177400 Load And Convert From Floating To Double LDCID 177000 LDCIF 177000 LDCLD 177000 LDCLF 177000 LDD 172400 176400 CLRF CMPD CMPF DIVD DIVF LDEXP Add Floating Copy Floating Condition Codes Double To Floating Load And Convert Integer To Double Load And Convert Integer To Fleoating Load And Convert Long integer To Double Load And Convert Long Integer To Floating Load Double Load Exponent Cc-3 PERMANENT SYMBOL TABLE (PST) OCTAL MNEMONIC VALUE FUNCTIONAL NAME LDF 172400 Load Floating LDFPS 170100 Load FPPs Program Status MFPD 106500 Move From Previous 171400 Space Multiply And Integerize 171400 Double Multiply And Integerize MODD MODF Data Floating MTPD 106600 Move MULD MULF 171000 171000 Multiply Double Multiply Floating NEGD NEGF 170700 Negate Negate 170700 To Previous Data Space Double Floating SETD 170011 Set Double SETF 170001 Set Floating SETI 170002 Set Integer SETL 170012 Set Long SPL 000230 Set Priority STCDF 176000 Store Mode Mode Mode Integer And Mode Level Convert From Double C.2 To Floating And Convert From STCDI 175400 Store STCDL 175400 Double To Integer Store And Convert From STCFD 176000 Double To Long Integer Store And Convert From STCFI 175400 Floating To Double Store And Convert From STCFL 175400 Floating To Integer Store And Convert From STD 174000 Floating To Store Double STEXP 175000 Store Exponent STF STFPS 174000 170200 Store Store Floating FPPs Program STST 170300 Store FPPs SUBD SUBF 173000 173000 Subtract Subtract TSTD 170500 Test Double TSTF 170500 Test Floating MACRO-11 Long Integer Status Status Double Floating DIRECTIVES DIRECTIVE FUNCTIONAL SIGNIFICANCE .ASCII Translates character string to ASCII .ASCIZ Translates character string to .ASECT inserts zero byte Begins absolute as Reserves specified . BLKW Reserves byte other block .CSECT word block section PDP-11 (provided for assembliers). in accordance with wvalue of in accordance with value of , Generates successive specified arguments. Begins equivalents; argument. specified argument. .BYTE equivalents. character. program compatibility with . BLKB last ASCII relocatable compatibility with C-4 byte data program other in section PDP-11 accordance (provided assemblers). with for (PST) PERMANENT SYMBOL TABLE FUNCTIONAL SIGNIFICANCE DIRECTIVE . DSABL .ENABL .END | Disables specified function. Enables specified function. Defines logical end of source program. .ENDC . ENDM Defines end of conditional assembly block. Defines end of macro definition, repeat block, . ENDR for Defines end of current repeat block (provided compatibility with other PDP-1l1l assemblers). Define End of Tape condition (ignored). file or to 1listing Outputs diagnostic message .EOT . ERROR or indefinite repeat block. command output device. Word—aligns the current location counter. Declares global Labels object attribute module for specified with specified symk . program version number. Begins conditional assembly block. Begins subconditional assembly block (1f Begins subconditional assembly block (1f conditional assembly block test is false). .IFTF LIIF .IRP conditional assembly block test is true). Begins subconditional assembly block (whether conditional assembly block test is true or false). Assembles immediate conditional assembly statement (if specified condition is satisfied). Begins indefinite repeat block; replaces symbol specified . IRPC .LIMIT .LIST block:; repeat of value with indefinite Begins symbol specified characters in specified string. Reserves two words of storage addresses of task image. Controls assembly 1listing listing. definition. - MCALL specified successive real with arguments. Identifies 1level <count .NARG .NCHR .NLIST .NTYPE .ODD . PAGE format and required macro | definition(s) Exit from current macro definition repeat high and low of .MACRO Denotes start of macro assembly. .MEXIT for replaces successive or for indefinite block. Equates specified symbol to the number of arguments in the macro expansion. of number the to symbol specified Equates characters in the specified character string. suppresses and count 1level 1listing Controls specified portions of the assembly listing. mode addressing Equates specified symbols to the of the specified argument. Byte—aligns the current location counter. Advances form to top of next page. « PRINT . PSECT Prints specified message on command output device. specified Begins specified program section having .RADIX .RADS50 Changes current program radix to specified radix. equivalents Radix-50 Generates data block having +.REPT Begins repeat block and replicates it according to the value of the specified expression. attributes. of specified character C-5 string. PERMANENT SYMBOL TABLE DIRECTIVE .SBTTL .TITLE MACRO-11l Prints specified of assembly listing specified title the Prints SIGNIFICANCE subtitle text page text as the second line object module name header. as in the first 1line of the assembly listing page header. Generates successive word data in accordance with specified arguments. . WORD The FUNCTIONAL (PST) directives in Appendix B. listed above are summarized in greater detail APPENDIX D DIAGNOSTIC ERROR MESSAGE SUMMARY D.1 MACRO-11] ERROR CODES A diagnostic error code is printed as the first character in a source line which contains an error detected by MACRO-11l. This error code identifies a syntactical problem or some other type of error condition detected during the processing of a source line. An example of such a source line Q is shown below: 26 000236 MOV R1,R2,A 010102 The extraneous argument A in the MOV instruction above causes the line to be flagged with a Q (syntax) error. Meaning Error Code A Assembly error. Because many different types of 10 is conditions produce this diagnostic message, error all the possible directives which may yield a general assembly error have been categorized below to reflect specific classes of error conditions: " CATEGORY 1l: ILLEGAL ARGUMENT SPECIFIED. 2, .RADIX -- A value other than specified as a new radix. .LIST/.NLIST -- Other than argument directive. (see Table 6-1) a 8, or legally defined is specified with the 1legally defined .ENABL/.DSABL -- Other than a (see Table 6-2) is specified with the argument directive. .PSECT -- Other than a legally-defined argument the specified with is 6-3) Table (see directive. defined legally a than .IF/.IIF -- Other test (see Table 6-5) or an illegal conditional argument expression value is specified with the directive. .MACRO -- An illegal or duplicate symbol in dummy argument list. found DIAGNOSTIC ERROR MESSAGE Error Code A (Cont'd) SUMMARY Meaning CATEGORY 2: -TITLE NULL ARGUMENT OR SYMBOL SPECIFIED. -- Program directive, following or the character. -IRP/.IRPC the name -- No directive. dummy .NARG/.NCHAR/.NTYPE in the directive. IF/.IIF -- No specified in the is not first directive argument -- No 3: UNMATCHED CONSTRUCTION. symbol an illegal an illegal directive. .NCHAR -- match, CATEGORY 4: the is in specified argument -- delimiters ARGUMENT Character do is not string match, or do not character is used as a delimiter, or argument construction is used in the Character or delimiter string in specified DELIMITER/ILLEGAL -ASCII/.ASCIZ/.RAD50/.IDENT argument is conditional directive. CATEGORY or specified non-blank character 1is a non-Radix-50 an string 1illegal in the delimiters character is directive. GENERAL ADDRESSING This type of error results possible conditions: used as a ERRORS. from one of several 1. range of i.e., from -128(10) been exceeded. a branch instruction, to +127(10) words, has 2. A invalid Permissible statement current makes location ".=expression" statement the current location program 3. A section statement use counter, (.PSECT) contains attempts counter the to to a force cross boundaries. an invalid expression. In cases where address expression is required, a of e.g., address an absolute specifying global symbol, a relocatable value, or a relocatable value (see Section 3.9) in an invalid address expression. Similarly, in cases where a relocatable address expression 1is required, either a relocatable or absolute value is complex results permissible, complex likewise results expression. error but relocatable are a global value in Specific those which symbol in an cases the invalid of follow: or a statement this address type of DIAGNOSTIC ERROR MESSAGE SUMMARY Error Code | Meaning .BLKB/.BLKW/.REPT -- Other than an absolute value or an expression which reduces to an absolute value has been specified with directive. 4. » m the Multiple expressions are not separated by a comma. This condition causes the next symbol to be evaluated as part of the current expression. CATEGORY 5: ILLEGAL FORWARD REFERENCE. This type of error results possible conditions: l1. from either A global assignment (symbol==expression) contains reference to another symbol. 2. An expression defining the current location counter of two statement a value contains a forward of 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 1is reached during source input and the .END directive has not yet been encountered, MACRO-1l1l generates this error code, ends assembly pass 1, and proceeds with assembly pass 2. I Illegal character which are also question mark (?) is then ignored. L Input line length. detected. Illegal characters non-printable are replaced by a on the listing. The character is greater Currently, than 132(10) characters 1in this error condition is caused only through excessive substitution of real arguments for dummy arguments during the expansion of a macro. > M Multiple definition of a 1label. A label was encountered which was equivalent (in the first six characters) to a label previously encountered. . N A number contains a digit 0 Opcode error. Directive Permissible nesting 1level current program radix. a decimal value. that The number out depth 1s not in the is evaluated as of context. for conditional assemblies has been exceeded. Attempt to expand a macro which was unidentified after .MCALL search. 'DIAGNOSTIC Error ERROR MESSAGE SUMMARY Code P Meaning Phase error. from one A label's assembly definition pass to of another value or varies a multiple definition of a local symbol has occurred within a local symbol block. Also, when in a local symbol block defined by the .ENABL LSB directive, an attempt has occurred to define a local symbol in a program section other than that which was 1in effect when the block was entered. A P error code also appears if an .ERROR directive is assembled. Q Questionable many scan R syntax. arguments was not are Arguments are specified, or missing, the too instruction completed. Register-type error. An invalid use of or reference to a register has been made, or an attempt has been made to redefine a standard register symbol without first issuing the .DSABL REG directive. T Truncation error. bits 1in a word, than 8 significant .BYTE directive or U Undefined encountered A number generated more than 16 or an expression generated more bits during the wuse of the trap (EMT or TRAP) instruction. symbol. An undefined Instruction error. The the symbol evaluation was an expression; such an undefined symbol is assigned a value of zero. Other possible conditions which result in this error code include unsatisfied macro names in the list of .MCALL arguments and a direct assigment (symbol=expression) statement which contains a forward reference to a symbol whose definition also contains a forward reference; also, a local symbol may have been referenced that does not exist in the current local symbol block. Z dur ing instruction not compatible among all family. See Section 5.3 for so members of details. of flagged the 1is PDP-11 APPENDIX E SAMPLE CODING STANDARD E.1 INTRODUCTION Standards eliminate wvariability and the requirement to make a decision. Much of the difficulty in establishing standards stems from the notion that they should be optimal. However, to be successfully applied, standards must represent an agreement on certain aspects of the programming process. This Appendix contains DIGITAL's PDP-11 Program Coding Standard. It is suggested that this be used as a model to assist users in preparing standards for their own installations. E.2 LINE FORMA’ All source lines shall consist of from one to a maximum of exghty characters {(not including the audit trail added by SLIPR (SLP in RSX-11M) editor. This program is described in the applicable RSX-11M or RSX-11D Utilities Manual or in the IAS Editing Utilities Reference Manual (see Section 0.3 in the Preface). Assembly language code lines shall have the following format: 1. Label Field - if present, 2. Operation 1 (column Operand the label shall start at tab stop 0 field - the operation 9). field - the operand field shall start at field shall start at tab tab stop stop 2 (column 17). 4. Comments field - the comments field shall start at tab stop 4 (column 33) and may continue to column 80. Comment lines that are included in the code body shall be delimited by a line <c¢ontaining only a leading semicolon. The comment itself contains a 1@@&1»@ semac@lnn and starts in column 3. Indents shall be fi. étf%h - ' If the operand field extends beyond tab stop 4 (column 33) mp leave a space and start the comment. Comments which apply to an instruction but reguire continuation should always line up with the character position which started the comment. SAMPLE CODING STANDARD E.3 COMMENTS Comment all coding to convey the global role of an instruction, rather simply a literal translation of the instruction into English. 1In general this will consist of a comment per 1line of code. If a than particularly difficult, obscure, used, a paragraph of comments must code. Preface text, which variables, etc., will start of the automated start column and is of describes formats, algorithms, program-local be delimited by the character sequence ;+ at the ;- of at the narrative 3. end; these commentary. delimiters The comment facilitate itself will N THE WE A LIST WG + example: APPLIES NE wg For in text extraction or elegant instruction sequence immediately precede that section TO INVERT OF ROUTINE ACCEPTS RANDOM NUMBERS AND THE h KOLMOGOROV ALGORITHM ALPHABETIZE THEM. E.4 NAMING E.4.1 STANDARDS Register Standards E.4.1.1 permitted General Purpose as register Registers - Only names; and may the not purpose: RU=%0 ;REG R1=%1 R2=%2 ;REG ; REG R3=%3 R4=%4 R5=%5 ;REG ;REG sREG SP=%0 ;STACK PC=%7 E.4.1.2 Hardware identically to the E.4.1.3 Device following names are be used for any other 0 1 2 3 4 5 POINTER (REG 6) ; PROGRAM COUNTER (REG 7) Registers - These hardware definition. registers For must example, PS be named and SWR. Registers - These are symbolically named identically hardware notation. For example, the control status register for the RK disk is RKCS. Only this symbolic name may be used to refer to this register. to the SAMPLE CODING STANDARD E.4.2 Processor Priority Testing or altering the processor priority is done using the symbols which are equated to their corresponding priority bit pattern. E.4.3" - Other Symbols Frequently-used bit patterns such as CR conventional symbolics on an as-needed basis. E.4.4 The and LF will be made assembler. All Using the Standard Symbolics register other standards will be defined standard symbols will appear within the in a file and will be linked prior to program execution. E.4.5 Symbols* E.4.5.1 Global Symbols Global symbols should be easily recognized by their format. The following standards apply and completely define symbol standards for PDP-11 Medium/Large software products. symbol . pos-1 non-glbl-sym letter | a-num/| null glbl-sym S/. pos-3 pos-4 pos-5 pos-6 length a-num/| null a-num/| null a-num/| null a-num/| null >=1 >=1 a-num/| a-num/| a-num/| a-num/| a-num/| null null null null null a-num/| null a-num/| null >=3 a-num/| a-num/| >=4 null null glbl-offset letter| $/. a-num | a-num/| null glbl-bit-ptrn letter| a-num S/. local-sym number | - ¥ pos-2 a-num/| S >=2 * * ** Symbols that are branch targets are always use the term "symbol". Number *** The is in use of software. the $ or range . for also called labels, but we will 0<number<65535. global names is reserved for DEC-supplied SAMPLE CODING STANDARD where: a—-num | non-glbl-=sym is an alphanumeric character. are non—-global symbols. local-sym local glbl-sym glbl-offset symbols, as defined by MACRO-11. are global symbols (addresses). are global offsets (absolute glbl=-bit-ptrn are global bit patterns. quantities). A program never E.4.5.2 Symbol Non-Global contains a .GLOBL statement without showing cause. Examples Symbols AlB ZXCJ1 INSRT Global Address Symbols SJIM . VECTR S$SEC Global Absolute Offset Symbols ASJIM A$xT A . ENT Global Bit Pattern Symbols A1$20 B3.6 JI.M Local Symbols 378 2718 6% E.4.5.3 Program—Local (.+n) 1s absolutely other contexts must be Symbols - Self-relative address arithmetic forbidden in branch instructions; its use in avoided if at all possible and practical. E-4 SAMPLE CODING STANDARD Target symbols for branches that exist solely for positional reference will use local symbols of the form <num>$: Use of non-local symbols is restricted, within reason, to those cases where reference to the code occurs external to the code. Local-symbols are formatted such that the numbers proceed sequentially down the page and from page to page. E.4.5.4 Macro Names - The last two characters (with character possibly being null) have special significance. last character is a $, the last, a character specifying the last The next to the mode of the macro. For example, in the three macro forms in-line, stack, and p-section, the 1in-line form has no suffix, the stack has an <S>, p-section a <C>. Thus the RSX Queue I/0 macro can be written and the as any of QIOS QIOSS QIOSC depending on the form required. the form of E.5 E.5.1 the name is standard. These are not reserved letters. ' Only PROGRAM MODULES General Comments on Programs In our software, a program provides a single distinct function. No limits exist on size, but the single function limitation should make modules larger than 1K a rarity. Since any software may eventually exploit the wvirtual memory capacity of the 11/40 and 11/45, programs should make every attempt to maintain a dense reference locus (do not promiscuously branch over page boundaries or over a large absolute address distance). All code is read-only. contains explanatory read-write data. E.5.2 Code and data areas are distinct and each text. Read-only data should be segregated from The Module Preface Each program module in the system shall exist as a separate file. The file name will reflect the name of the module and the file type shall be of the form 'NNN'. The 'NNN' signifies the edit number or the version number. The version number shall be changed only when a new base level is created. Furthermore, if no corrections are made to a file from one base level to the next, the version number will not be changed. The availability of File Control Services and File Control Primitives will greatly simplify version number maintenance. Program modules adhere to a strict format. This format adds to the readability and understandability of the module. The following sections are included in each module: E=>5 SAMPLE CODING STANDARD For the Code lfl A Section: .TITLE statement a module used. that contains An .IDENT statement PDP-11 version number A .PSECT the A statement module than the one name specifying the standard appears that defines of routine, the statement, COPYRIGHT DIGITAL (C) SOFTWARE ON ONLY A WITH NOTICE. IS CORPORATION, version number. in section E.10. program INCLUSION PROVIDED ANY OTHER PERSON OR MAYNARD, UNDER A COMPUTER SOFTWARE, NOT OWNERSHIP The in which OF AND MAY THE ABOVE OR ANY OTHER OTHERWISE EXCEPT LICENSE SYSTEM FOR USE OF THE SOFTWARE SHALL THEREOF, AVAILABLE SUCH SYSTEM AND TITLE TO AT ALL USE COPIED COPYRIGHT COPIES MADE ON FOR BE TIMES TO TO AND REMAIN DEC. THE INFORMATION WITHOUT DEC IN NOTICE COMMITMENT THIS AND BY DIGITAL DOCUMENT SHOULD NO RESPONSIBILITY OF ITS SUPPLIED version The PDP-11 E.10. BY number version and A brief in TO CHANGE CONSTRUED AS A SOFTWARE FOR ON THE USE OR EQUIPMENT WHICH IS DEC. of the number The name of the principal module was first created. The name of modification. SUBJECT BE EQUIPMENT CORPORATION. ASSUMES NOT IS NOT RELIABLILITY Note: section If be MASS. ONE WHO AGREES TO THESE LICENSE TERMS. line may the disclaimer. FURNISHED THE THIS BE and SINGLE MAY The module. 1976 EQUIPMENT ONLY IN the subtitles resides. copyright THIS specifies more file. standard author is and described the date on in section which the each modifying author and the date of Names and modification dates appear one per chronological statement of the order. function of the module. Items 1-8 should appear on the same page. A list of the definitions of all equated local symbols used in the module. These definitions appear one per line and in alphabetical order. 10. All by - 11. local macro definitions, preferably in alphabetical name. order | All local data. The data should indicate a. b. c. Description of each element (type, size, etc.) Organization (functional, alpha, adjacent, etc.) Adjacency requirements SAMPLE CODING STANDARD 12. A more detailed definition of the function of 13. A list of the inputs expected by the module. the calling sequence if non-standard, settings, and global data settings. 14, M This list of the outputs produced as a result of module. These 1include delivered results, settings, visible 15. A list result in the C but not to the side The (A1l code entering these this condition code outputs are caller.) of all effects (including side effects) produced as a of entering this module. Effects include alterations state of the system not explicitly expected 1in the calling sequence, 16. effects. includes condition A | E.5.3 the module. or those not visible to the caller. module code. Formatting the Module Preface Rules: l. The first eight items appear have explicit headings. p-section is being used. 2. 3. Headings start indented 1 the same page and at the left tab position. margin¥; template for which the do not module apply may preface be will not if the blank descriptive Items 7-14 will have headings which start at the preceded and followed by lines containing only a Items A on Item 3 may be omitted text 1is left margin, leading <;>. omitted. follows. FILE-EXAMPL.SO1 EXAMPLE .IDENT /01/ .PSECT KERNEL W COPYRIGHT W W .TITLE DIGITAL (C) 1976 COPORATION, MAYNARD, MASS. g MADE s SYSTEM AND TO ONE WE WME Ul ANY OTHER COPIES THEREOF, TO AND OWNERSHIP OF THE W THIS SOFTWARE IS FURNISHED UNDER A LICENSE FOR USE ONLY ON A SINGLE COMPUTER SYSTEM AND MAY BE COPIED ONLY WITH THE INCLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE, OR IN AVAILABLE MAY NOT BE TO ANY OTHER PERSON WHO AGREES TO THESE SOFTWARE FOR USE LICENSE ON SUCH TERMS. SHALL AT ALL TIMES TITLE REMAIN | TS We s %P DEC. PROVIDED OR OTHERWISE EXCEPT THE INFORMATION IN THIS NOTICE AND SHOULD NOT BE EQUIPMENT CORPORATION. DOCUMENT IS SUBJECT TO CHANGE WITHOUT CONSTRUED AS A COMMITMENT BY DIGITAL s <5 N e NEF EQUIPMENT *The text left margin consists of a <;> a of the heading begins in column E-7 <space> 3. then the heading, so the SAMPLE CODING STANDARD ASSUMES NO RESPONSIBILITY FOR THE SOFTWARE ON EQUIPMENT WHICH IS USE OR RELIABILITY OF NOT SUPPLIED BY DEC. WE WG W DEC ITS 01 WS WS VERSION 1-JAN-72 WE WE JOE PASCUSNIK BY: WE %NS MODIFIED DOE 21-JAN-73 WO WS RICHARD 12-JUN-73 WS WE SPENCER THOMAS statement of the module's function WE WE Brief SYMBOLS WE WO EQUATED equated symbols W List MACROS e W LOCAL Macros ‘g Local DATA Wy wWE LOCAL data + Module function-details INPUTS: %S WE wg Wy W Local of inputs OUTPUTS: WF WE WS NS Description of outputs EFFECTS: WE W W WE Description of effects WE WME Description Begin Module Code E.5.4 Modularity No other success Software characteristic has more impact on the of a system than does modularity. Engineering's products consists of the wultimate engineering Modularity for PDP-11 application of the single=function philosophy described in section E.5.1, to a set of calling and return conventions. E.5.4.1 Calling Conventions conventions must be observed. (Inter-Module) E-8 - The | and following | adherence calling SAMPLE CODING STANDARD Transfer of Control Macros will exist for call and return. The actual transfer will be wvia a JSR PC instruction. For register save routines, a JSR Rn,SAVE will be 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. (State preservation is assumed across calls.) Argument Passing Any registers may be used, but their use should follow a coherent pattern. For example, if passing three arguments, pass them in RU, Rl and R2 rather than RO, R2, R5. Saving and restoring occurs E.5.4.2 1in one place. Exiting - All subroutine exits occur through a single RETURN macro. E.5.4.3 Intra-Module Calling Conventions - consistency inter-module E.5.4.4 favors a sequence. calling sequence Success/Failure Indication - The Designer identical C bit to optional, will that be but of the wused to return the success/failure indicator, where success equals 0, and failure equals 1. The argument registers can be used to return values or additional success/failure data. E.5.4.5 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. E.6 E.6.1 FORMATTING STANDARDS Program Flow Programs will page, be organized on the listing such that they even at the cost of an extra branch or jump. E-9 flow down the SAMPLE CODING STANDARD For example: PROCESS v BBB AAA COMMON shall appear TST BNE AAA: » ® % » B N LI . » & " % B » BR BBB: CMN: Rather than: TST BNE AAA: : CMN BBB: * " & @ . % & » ® & & » . n " » . & # » . % % » " B & » . & & » . % » » .- 5 & & L BR on the listing as: SAMPLE CODING STANDARD E.6.2 Common Exits A common exit appears as the last code sequence on the listing. the flow chart: M' J appear on the listing as: will PR1l: . B ¥ @ L * % & % LI N L L2 * & » @ . ® » » & » % » » ® & LI * = » » » % 5 LA L S LR I I » O & @ * 5 ® 9 L EXIT BR PR4: I EXIT BR PR3: L EXIT BR PR2 EXIT . & & » . % & » S & & % . % ® & . * B » W LN B EXIT: And not PR1: EXIT: PR2: PR3: L » ® % L I . % @ ® % » 5 & » » > & » * & = & * % » » * % & » . ® » » ow » - * » » B * 5 * % w ® L B & @ LI L BR EXIT * % » @ * " " » *. " % » ., 8 8 B *® ® " » - " 8 » EXIT BR PR4: W LR T - % » * » " L S "- " BR % » » EXIT E-11 w3 Thus SAMPLE CODING STANDARD E.6.3 Code three Code with Interrupts Inhibited that is executed with interrupts inhibited, shall semicolon (;;;) comment delimiter. For example: . .ERTZ: 10$: E.7 ; ENABLE SYSTEM SUBROUTINES, INHIBIT C INTERRUPTS #PR7,PS :3; BIT #PR7,+2 (SP) i3 BEQ 10$ HE A ® RTT 38 cene “ oo ;i HHH ceon “ees HHH .o e oo HHH & ® 753 & & & PROGRAM SOURCE 5 @ flagged by a RETURNING ;BY BIS % BY be M M E N T S FILES Source creation and maintenance shall be done in base levels. A base level 1is defined as a point at which the program source files have been frozen. From the freeze point to the next base level, corrections will not be made directly to the base level itself. Rather a file of corrections shall be accumulated for each file in base level. Whenever an updated source file 1is desired, correction file will be applied to the base file. the the The accumulation of corrections shall proceed until a logical breaking point has occurred (i.e. a milestone or significant implementation point has been reached). At this time all accumulated corrections shall be applied to the previous base level to create a new base level. Correction files will then be started for the new base level. E.8 FORBIDDEN 1. INSTRUCTION USAGE The use of instructions or previous instruction. For uses to MOV @PC,Register BIC Src,Dst the be bit a clear very index words example: instruction "neat" way as a to as literals literal. save a word of the This may seem but what about maintaining a program using this trick? To compound the problem, it will not execute properly if I/D space is enabled on the 11/45. 1In this case @PC is a D bank reference. 2. The to use of the transfer MOV instruction program control instead to of a another JMP instruction location. For example: MOV #ALPHA, PC transfers control to location ALPHA. Besides taking 1longer to execute (2.3 microseconds for MOV vs. 1.2 for JMP) the use of MOV instead of JMP makes it nearly impossible to pick up someone else's program and tell where transfers of control E-12 SAMPLE CODING STANDARD What if one would like to get a take place. Jjump trace of the execution of a program (a move trace is unheard of)? As a more general issue, perhaps even other operations such as ADD and SUB from PC should be discouraged. Possibly one or two words can be saved by using these operations but how many such occurrences are there? instructions The seemingly "neat" use of all single word where one double-word instruction could be used and would execute faster and would not consume additional memory. 3. Consider the following instruction sequence: CMP -(R1), (=-R1) CMP -(R1),-(R1) The intent of this instruction sequence is to subtract 8 from This can be (not to set condition codes). register Rl SUB time via a the 1/3 in approximately accomplished 3.8 microseconds) at no additional cost instruction (9.4 vs. Another question here is also, what if Rl in memory space. is o0dd? SUB properly and always wins is always faster! since it will always execute RECOMMENDED CODING PRACTICE E.9 E.9.1 Conditional Branches is it When using the PDP-11 conditional branch instructions, the and signed the between made be choice correct the that imperative unsigned branches. SIGNED BGE BLT BGT BLE UNSIGNED BHIS BLO BHI BLOS (BCC) (BCS) BGT) when comparing A common pitfall is to use a signed branch (e.g. All goes well until the two addresses have two memory addresses. (100000(8)) that is, one of them goes across the 16K opposite signs; This type of coding error usually shows itself as a result of bound. the 1in size of a change re-linking at different addresses and/or program. E.10 PDP-11 VERSION NUMBER STANDARD The PDP-11 Version Number Standard applies to all modules, parameter files, complete programs, and libraries which are written or caused to It 1is be written, as part of the PDP-11 Software Development effort. used to provide unique identification of all released, pre-released, and in-house software. It is limited in that, as currently specified, only six characters of implementations of the Macro Future used. are identification for at least nine Assembler, linker, and librarian should provide E-13 SAMPLE CODING STANDARD characters, and will be enhanced Version possibly twelve. as the need arises. Identifier <form> <form> Used {version> to It <version> <edit> <patch> a particular form of a module or LINK-1ll. applicable, One as the of null (i.e., Used to alphabetic a binary identify Two the 0) character, if not release, decimal 1in if case wused, and used. or digits, generation, starting at of 00, a and discretion of the project in what, in their opinion, is a Used to identify the level to which a particular release, or generation, of a program or module has been edited. An edit 1is defined to be an alteration to the source form. Two decimal digits, beginning at 01, and incremented with each edit; null if no edits. <patch> Used to identify the level to which a particular release, or generation, of a program or module has been patched. A patch is defined as an alteration to a binary form. One alphabetic character, starting at B, and running sequentially toward 2, each time a set of patches is released; null if fields {patch> <edit> ot interrelated. are When bugs have Displaying visible the been of the <form> following released X in-house Y field <version> or identifier = have of program separates is not intended to {version> null. then that null, when Dbecause been appear as: <patch>, identified: frozen version that 'X' corresponds roughly to support, and 'V' to company support. <patch> <edit> should experimental version test, pre-release, or in-house Note dash which changed, Identifier version Key Letters \Y 1is fixed. the Version output <key—-letter> and/or <version> <edit> must be reset to nulls. It is incremented, then <patch> w1ll be re-set various where patches. and is E.10.1 When identification, individual from <edit> a version then the release support, is used identifier format 'Y' only version to if group <edit> is displayed is: Program <space><key-letter><form><version>-<edit><patch> Name standard <edit> These part this where no The that identify incremented at the order to reflect major change. The expected program, program. the is as SAMPLE CODING STANDARD Examples: PIP X03 LINK VB04-C MACRO Y05-01 E.10.2 Use of the Version Number in the Program All sources must contain the version number in an L.IDENT directive. For programs (or libraries) which consist of more than one module, each individual module will follow this version number standard. The version number of the program or library is not necessarily related to the version numbers of the constituent modules; it 1is perfectly reasonable, for example, that the first version of a new FORTRAN library, V00, contain an existing SIN routine, say V05-01l. Parameter files are also required to contain the .IDENT directive. Because the assembler records parameter files must precede the program. version number in an the last .IDENT seen, Entities which consist of a collection of modules or programs, e.g., the FORTRAN Library, will have an identification module in the first position. An identification module exists solely to provide identification, and normally consists of something like: ;OTS IDENTIFICATION .TITLE FTNLIB . IDENT /003010/ . END ey APPENDIX F ALLOCATING VIRTUAL MEMORY This appendix is intended for the MACRO-1l user who wants to avoid the problem of thrashing, by optimizing the allocation of virtual memory. Users of smaller systems, particularly those with the 8K subset version of MACRO-1ll, should become thoroughly familiar with the conventions discussed herein. In this regard, Appendix F addresses the following topics: l. General hints and 2. Macro definitions 3. Operational space=saving and guidelines expansions techniques. The user is assumed to have pursued a policy of modular programming, as advised in Appendix E. In addition to the obvious advantages accruing from small, distinct, highly-functional bodies of code, one can wusually avoid the problem of insufficient dynamic memory during assembly by practicing such a policy. Other suggestions as to how available memory can be best utilized are discussed in the following sections. F.1l GENERAL HINTS AND SPACE-SAVING GUIDELINES Work-file memory is shared by a number of MACRO-1ll's tables, each of which 1is allocated space on demand (64K words of dynamically pageable storage are available to the corresponding entry sizes are as l. User-defined symbols 2. Local 3. Program sections 4, Macro names 5. Macro text 6. Source symbols - tables and their five words. four words. - four six words. words. - six words. scratch l. Expression analysis 2. Object code The - nine words. files In addition, several process, as follows: - - assembler). follows: pad - generation tables are used durlng five words. - five words. the assembly ALLOCATING VIRTUAL MEMORY 3. Macro argument processing 4, .MCALL argument - processing The above information can serve as storage requirements and for requirements. For example, the use of local encouraged, since their dynamic storage than that The wusage scope of MACRO-11l of 1local - five words. a guide for estimating dynamic determining ways to reduce such symbols whenever possible can often be blocks through Sections 3.5 and maximized loops instances when indicator. In to a occur If possible, keeping with the during temporarily the definition the same conditional assigned symbol symbols by the .ENABL 6.2). Since MACRO-1l1l does not support a purge function, defined, it permanently occupies its dynamic Numerous 1is internal representation requires required for regular user-defined symbols 1local symbol directives (see three words. is so used extending LSB/.DSABL as a should be and count repeat or offset re-used. principle, special treatment should be commonly-used symbols. Instead of of the LSB once a symbol is memory allocation. assemblies used highly 25% less symbols. given simply appending a prefix file which defines all possibly-used symbols for each assembly, users are encouraged to group symbols into logical classes. Each class so grouped can then become a shortened prefix file or a macro in a library (see Section F.2 below). In either case, selective definition of symbolic assignments is achieved, resulting in fewer defined (but unreferenced) symbols. An appropriate example of standard symbols. The seen in the definition of library, for example, supplies several macros used to define distinct classes of symbols. These groupings and associated macro names are, as follows: F.2 this idea 1is system macro DRERRS - Directive return IOERRS - I/0 FILIOS - File-related SPCIO$ - Special return status status I/0 I/0 codes codes function function codes codes MACRO DEFINITIONS AND EXPANSIONS By far, dynamic storage is used most heavily for the storage of macro text. Upon macro definition or the issuance of an .MCALL directive, the entire macro body is stored, including all comments appearing in the macro definition. For this reason, comments should not be included as part of the macro text. An RSX-1l1l utility program (called SQZ for RSX-1lD only) and a Librarian function switch (/SZ) are 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. For additional information regarding these two utility tasks, consult the applicable RSX-11lM or RSX-11lD Utilities Manual (see Section 0.3 in the Preface). It often seems expedient each assembly to however, may produce to append a macro definition provide commonly-used macros. the undesirable allocation of F-2 prefix file to This practice, valuable dynamic ALLOCATING VIRTUAL MEMORY storage for unnecessary macros. This side effect can be avoided by specifying that the prefix file containing the macros is a user-supplied macro library file (see Table 8-1). This action imposes the stipulation that the names of all desired macros must be listed as arguments in the .MCALL directive (see Section 7.8). Storage for macro text can be re-used effectively by redefining certain types of macros to null after they have been invoked. This practice releases their dynamic memory for the storage of later macro text and also eliminates the overhead and the need for dynamic memory which would otherwise be required during the subsequent invocation and expansion of such non-redefined macros. The practice of redefining macros to null applies mainly -to those that only define symbolic assignments, as shown in the example below. The redefinition process may be accomplished as .MACRO follows: DEFIN SYM1 = VALI SYM2 = VALZ2 ;DEFINE SYMBOLIC ASSIGNMENTS. OFF1 = SYMBOL OFF2 = OFF1+SIZl OFF3 = OFF2+SIZ2 ;DEFINE SYMBOLIC OFFSETS. OFFN = OFFM+SIZIM .MACRO DEFIN ;sMACRO NULL REDEFINITION. . ENDM .ENDM DEFIN Macros exhibiting this redefinition property should be defined (or read via the .MCALL directive) and invoked before all other macro definition and/or .MCALL processing. So doing ensures more efficient use of dynamic memory. The following system macros have property after once being invoked: DRERRS - Directive IOERRS - return the status automatic null codes I/0 return status codes FILIOS - File-related I/0 function codes SPCIOS$ - Special I/0 function codes CSIS - Command String Interpreter codes and offsets GCMLDS - Get Command Line codes and offsets BDOFF$ - FCS buffer descriptor FCSBTS - FCS bit value codes FDOFF$ - FCS file descriptor FSROFS$ - FCS file NBOFFS$S - FCS filename block storage offsets block region offsets (FSR) offsets F-3 offsets redefinition ALLOCATING VIRTUAL MEMORY F.3 OPERATIONAL TECHNIQUES When, still despite adhering to the guidelines discussed above, performance falls below expectations, several additional measures may be taken to improve performance. The first measure involves shifting the burden of symbol definition from MACRO-11 to the linker. 1In most cases, the definition of system I/0 and FCS symbols (and user-defined symbols of the same nature) is not necessary defaulted category during the assembly process, to global references (see Section 4 of error code A). The linker since such 3.9 and attempts symbols are Section D.1, to resolve all global system references from user-specified default libraries and/or the 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. A second way of making more dynamic memory available only one output file (either object or listing), as The additional file descriptor block (FDB) and file (FSR) required to support the second output file are is to produce opposed to two. storage region allocated from available dynamic memory at the start of each assembly. Furthermore, the size of the file storage region allocated is the minimum required for the second (listing) output file. For disk files, this is 264 (10) words, and for direct line printer output, it is 74(10) words. The final way of increasing available dynamic memory is related only to the operating environment. Under RSX-11M, MACRO-11l allocates all storage between its highest address and the end of its partition as dynamic memory. Consequently, the amount of working storage can be increased by installing and running MACRO-11l in a larger partition. In IAS and RSX-1lD, the assembler's time. dynamic memory is fixed at 1link If a larger assembler is not available, you may build one increasing the size of the task's stack. This 1is accomplished altering the STACK= option in the command file to build MACRO-11. F-4 by by APPENDIX G WRITING POSITION INDEPENDENT CODE G.l INTRODUCTION TO POSITION INDEPENDENT CODE The output of a MACRO-11 assembly is a relocatable object module. Task Builder binds one or more modules together to create The an executable task image. Once built, a task can generally be loaded and This is executed only at the virtual address specified at link time. because the linker has had to modify some instructions to reflect the memory locations in which the program is to run. Such a body of code is considered position-dependent (i.e., dependent on the virtual addresses to which it was bound). All PDP-11 processors offer addressing modes that make it possible to write instructions that are not dependent on the virtual addresses to which they are bound. A body of such code is termed loaded and executed at any virtual position-independent and can be address. Position-independent code can improve system efficiency, both in wuse of virtual address space and in conservation of physical memory. In multiprogramming systems like IAS, RSX-1lD and RSX-11M, it Iis important that many tasks be able to share a single physical copy of common code; for example a library routine. To make the optimum use of a task's virtual address space, shared code should be Code that is not position—-independent can also position-independent. be shared, but it must appear in the same virtual locations in every This restricts the placement of such code by the Task task using it. Builder and can result in the loss of virtual addressing space. The construction of position-independent code is closely linked to the remainder of this The addressing modes. proper usage of PDP-1l1 Appendix assumes you are familiar with the addressing modes described in Chapter | 5. All addressing modes involving only register These modes are as follows: position-independent. R (R) (R) + @-(R) When using are register mode deferred register mode autoincrement mode deferred autoincrement mode @(R)+ - (R) references autodecrement mode deferred autodecrement mode these addressing providing position-independence, been supplied such that they are virtual memory location. modes, the not you are guaranteed contents of the registers have dependent upon a particular WRITING POSITION The relative relocatable addressing address These modes are as modes 1is INDEPENDENT CODE are referenced position-independent from a relocatable follows: A relative @A when a instruction. mode relative deferred mode Relative modes are not position—-independent when an absolute address (that 1s a non-relocatable address) is referenced from a relocatable instruction. 1In this case, absolute addressing (i.e., @#A) may be employed to make the reference position-independent. Index modes can be according to their X (R) index @X (R) index If the base, X, the either position-independent or position-dependent, use in the program. These modes are as follows: reference mode deferred is an absolute value (e.g;, a control is position-independent. For block example: MOV 2(sp),RO s POSITION~-INDEPENDENT MOV N (SP) ,RO ; POSITION-INDEPENDENT N=4 If, however, X 1is position-dependent. CLR Immediate a For relocatable example: ADDR(R1) mode its usage. can be ~ an absolute address, the offset), | reference is ; POSITION-DEPENDENT either Immediate mode #N When mode position-independent references are immediate or not, formatted as according to follows: mode code is position-independent. When a relocatable expression defines N, code is position-dependent. That is, immediate mode references expression defines the are position-independent only when N is the an value absolute of N, the value. | Absolute mode addressing is position-independent only in those cases where an absolute virtual location is being referenced. Absolute mode addressing references are formatted as follows: Q#A An example of to the For example: absolute mode a MOV G.2 position-independent directive status word @#SDSW,RO absolute ($DSW) from a s RETRIEVE reference is relocatable DIRECTIVE a reference instruction. STATUS EXAMPLES The RSX-11l library routine, PWRUP, is a FORTRAN callable subroutine to establish or remove a user power failure AST entry point address. Imbedded within the routine is the actual AST entry point which saves all registers, restores The effects all registers on following examples a call to return, are the user-specified entry point, and executes an AST exit excerpts from this routine. directive. The first has been modified to illustrate position-dependent references, (see Figure G-1). The second example, Figure G-2, 1is the position-independent version. example G-2 WRITING POSITION INDEPENDENT CODE PWRUP:: CLR CALL | | 208 | BA: -~ :PUSH (SAVE) ARGUMENT ADDRESSES ONTO .X.PAA ; STACK +CLEAR DSW, AND SET R1=R2=SP sGET OTS IMPURE AREA POINTER :sGET AST ENTRY POINT ADDRESS NO POWER + IF NONE SPECIFIED, SPECIFY ;sRECOVERY AST SERVICE .WORD MOV MOV BNE CLR 1.,SDSwW $OTSV,R4 (SP)+,R2 108 - (SP) MOV MOV R2,F.PF (R4) #BA,- (SP) CALL 109.,2. s ISSUE DIRECTIVE, EXIT. .BYTE .X.EXT MOV MOV RO,-(SP) R1l,-(SP) ;PUSH (SAVE) RO ;PUSH (SAVE) Rl BR 10S$: s ASSUME SUCCESS - (SP) 208 ; H :SET AST ENTRY POINT s PUSH AST SERVICE ADDRESS 3 Position-Dependent Code Figure G-1 PWRUP: : | CLR - (SP) + ASSUME SUCCESS MOV MOV @#SOTSV,R4 (SP)+,R2 ;GET OTS IMPURE AREA POINTER ;GET AST ENTRY POINT ADDRESS CALL .WORD BNE 20$: :IF NONE SPECIFIED, SPECIFY NO POWER 108 s RECOVERY AST SERVICE - (SP) MOV MOV ADD R2,F.PF (R4) PC,~-(SP) #BA-., (SP) "+SET AST ENTRY POINT ; PUSH CURRENT LOCATION ; COMPUTE ACTUAL LOCATION OF AST CALL .X.EXT + ISSUE DIRECTIVE, EXIT. 208 .BYTE . | 109.,2. ACTUAL AST SERVICE ROUTINE: A: 1) 2) (78] . 4) g [0 w6 we =8 we w8 ws s o ; PUSH ARGUMENT ADDRESSES ONTO STACK :CLEAR DSW, AND SET R1=R2=SP. .X.PAA 1.,$DSW CLR BR 10S: (SAVE) R2 ;PUSH R2,-(SP) MOV | : SAVE REGISTERS EFFECT A CALL TO SPECIFIED SUBROUTINE RESTORE REGISTERS ISSUE AST EXIT DIRECTIVE MOV MOV MOV RO, - (SP) R1,-(SP) R2,-(SP) Figure G-2 ;PUSH (SAVE) RO ;PUSH (SAVE) Rl ;PUSH (SAVE) R2 Position-Independent Code The position-dependent version of the subroutine contains a relative reference to an absolute symbol ($OTSV) and a literal reference to a Both references are bound by the Task relocatable symbol (BA). Builder to fixed memory locations. Therefore, the routine will not execute properly as part of a resident library if its location in virtual memory is not the same as the location specified at link time. WRITING POSITION INDEPENDENT CODE In the position-independent version, the reference to SOTSV has been changed to an absolute reference. 1In addition, the necessary code has been added to compute the virtual location of BA based upon the value of the program counter. In this case, the value is obtained by adding the value of the program counter to the fixed displacement between the current 1location and the specified symbol. Thus, execution of the modified routine is not affected by its 1location in the image's virtual address space. The MACRO-11 Assembler provides a way of checking the position-independence of code. In an assembly 1listing, MACRO-11 inserts a ' character following the contents of any word which requires the linker to perform a relocation operation. In some cases this character indicates a position-dependent instruction; in other cases, it merely draws the user's attention to the use of a symbol which may or may not be position-independent. The cases which cause a ' character to be inserted in the assembly listing are as follows: 1. Absolute mode references are flagged with a ' the reference 1is relocatable. References when they are example: MOV 2. position-independent (i.e., ;PIC ONLY IS @#ADDR,R1 IF ADDR character when are not flagged absolute). For ABSOLUTE. Index and index deferred mode references are flagged with character when the offset is relocatable. For example: 3. MOV ADDR(R1),R5 ;NON-PIC MOV @ADDR(R1l),R5 IF ADDR IS ;NON-PIC IF IS ADDR a RELOCATABLE. RELOCATABLE. Relative and relative deferred mode references are flagged with a ' character when the address specified is relocatable with respect to another program section. For example: 4. MOV ADDR1,R1 +NON-PIC MOV @ADDRI1,R1 IS :TO SECTION Immediate mode flagged with a MOV MOV WHEN ADDR1 ANOTHER PROGRAM references to ' character. #3,R0 #ADDR,R1 relocatable reference is made (i.e., to an addresses are always sALWAYS POSITION-INDEPENDENT. ;sNON-PIC WHEN ADDR IS RELOCATABLE. There is one case in which the MACRO-11 potential position-dependent reference. instruction BOUND absolute MOV $OTSV,R4 virtual assembler does not flag a This occurs where a relative location from a relocatable in Figure F-1). Those references requiring more than simple relocation at 1link time are also indicated in the assembly listing. Simple global references are flagged with the letter G. Those which contain multiple global references or complex relocation, are flagged with the letter C (see Section 3.9 positively in general, and Chapter state which it 4). are or In such are not position-independent. cases, it 1is difficult is safe to apply the guidelines discussed earlier resulting address value produced at link time. this Appendix to the to However, in APPENDIX H SAMPLE ASSEMBLY AND CROSS REFERENCE LISTING 5 LTITLE i + IDENT 2 3 y COPYRIGHT 1976, OIGITAL EQUIPMENY C(CORP,, MAYNARD, MASS, ' FOR USE y TMIS SOFTWARE 18 FURNISHED TO PURCHASER UNDER A LICENSE N y ON A SINGLE COMPUTER SYSTEM AND CAN BE COPIED (WITH INCLUSIO EXCEPT ’ 9 gy OF DEC’S COPYRIGHT NOTICE) 11 ' 14 9y EQUIPMENY CORPORATION, 16 17 y DEC ASSUMES NO RESPONSIBILITY y OF 178 SOFTWARE ON EQUIPMENT i@ 12 13 TO CHANGE WITHOUT y THE INFORMATION IN THIS DOCUMENT IS AS SUBJECT A COMMITMENT AY DIGITAL y NOTICE AND SHOULD NOT BE CONSTRUED ? 18 ' 20 '} 2 ' el ] 26 ' 28 ' 30 ' 32 ' gt 23 2% 2?7 29 31 33 34 t C, MONIA AS«FEB=T76 ¢ LOCAL MACROS t DEFINE CANNED SECTION TaBLE ENTRIES 3y SECTN NAME,FLAGS,SEG } WHERE1 ' ! 37 ) H 38 39 t 41 B2 42 43 $$0m, 4s $$8s, 4y 46 oMoy 48 +888S 47 49 S0 51 52 sS 81 s7 : ¢ PERFORM PRELIMINARY SyYMBOL TABLE PROCESSING 1 ue FOR THME USE OR RELIABILITY WHICH IS NOTY SUPPLIED BY DEC, y VERSION 25 18 36 ONLY FOR USE IN SUCH SYSTEM, y AS MAY OTHERWISE BE PROVIDED IN WRITING BY DEC, 18 19 L 705/ 4 S é 7 8 i P3IPRE NAMESSECTION NAME FSET IN SEGMENT DESCRIPYOR TO RECEIVE SECTYION ADDRESS, OFFSET=QF BLANK IF NONE, FLAGSESECTION FLAGS BYTE CONTENTS SEGa*RO0T* IF SECTION IS DEFINED IN ROOT SEGMENT ONLY JMACRO SECTN LWORD @ RADSA /NAME/ «BYTE FLAGS JBYTE « IFF ) JWORD JIF 8 «IF NB JWORD « IFF NAME,FLAGS,OFFSET,SEG @ SEG OFFSET OFFSET H-1 H LoT1)L1 2v e e n2eboe 20pve ¢ v900BY ‘ 2fP020 i =4x2»3S43F°L0ONYA%0%Q‘Q%108d ¢ vd01 vivg JON3’ 43384’ WON3® q0uom*® 9nt2o0 v0ae entLee 3B$1$I13L39WNI44OA80N3JSIA80NNuWTH¥ALS8%I)TSAIMMN¥X¥XyTII1I1l888e°°N°'**OI4‘IM ¢m 01M SM |M ‘1M g2t3WLNOILI3S03¢N¢o1THIL4vI0VOS3nIn8uNQ3i0wILVHWyTdY3EAMISSNOaAD14TAN0H13OMYi88NSIWVOL3IdALIILS84SNNIA9NI0JQv3WAS3Y19VZ3S4v3THQyN4VIiA0LvL9VVSWvHIAU1N4HIV¥NIYuSNDININ;3WIOW39S3S 7OSQoI8wNN49IILINMdSWDI3TsT$§IL170V8vSV8Y443IV¥O SN4nLVEIQmsdN®3LOSDQLISSQVYyvNNSaWNIS¥LlhSS$V01M Ny3YSA31OI38N3HIJ5O4EN0Q0DAN1AUSQddVAN133WivWTG73IL4738SN0VV1G7IL4$I1SNI130304¥IW8d09WSQA3AvNTSV1Q364AH¥98030804Fl0LQSHi1HI3d0SNNI3ID¥H3LIS3$YN83OuQ0EAN°wBSNL3(SdNW$AA3BLN$T4‘I928S¥3HvQ07LI0l)I4YNdMI¥Od3I0L3NH0LW IwATSI¥VNvW»FNI3YHLyuEJYsEdNLIN9IIQA3vO®OsBaNLWHOnIlSI%8sAY4%N0)IDSsIHNNAIOS480I3V9Ln3IAS3w4QS0YVNQINvI4i0v3AdI8WNDA3IL0dWNS3N3ISLNWI843D3S03)JSlH0d8ILHAO¥d802I18¥3l3IWd0SINN3LIUSSd3Q¥0(IWNLIS ”t!wNWNGOLVWODNOOD2I©=2LS37QI91vV3YSAH4®03LS8SI/NT0IQYv30NN7dL1OVY$IHSI/SA0)3HW1$L4SI1M30u3Q3dNSAv0¢ON4W3I0w¥3IeNINWIN1¥A4JE0OdNWIeTDI"VN¢IAWNNV13YJWW¥3dA1sV3OT(HA0N1dIIL¥NIOSY30¢ 08 ="3197qyom*®12% ) SAMPLE ASSEMBLY AND CROSS REFERENCE LISTING MX mamam% ‘ “““”h““““”““ n908eo ISiNaNI “““*““““““““ Ls2sel g1t ”3AHWLndSNOILI3SQ3LVNOIS3QSYL108,3uYQ30N7ININI3HLNIVW T3M¥7YNNNIAT0IW0NlINOLIXML30VN8IwASSIANIAQI s e T08WASANINI¥04AVIN3A0T0HINOIIILNOY 3INOONWI M8 Y A 0 ' Q 0 S A Q S O Mg’ 13384’ Q*LF3ANOI1V89FY3VAI7M8YV34OWLM3H L B 13WNLSd ] nail IR sel 151 e QONOJ3S 4vyW 40 ARYN Q0w ses AN3IW3T3 qugm*® L5t 951 A e R e e d0ae s gouves ote se 9ie en ent ol e $9v4 YN3LOS8IWLNI3IMS 4LIANvS0YHNIHd A I quom* ] ‘ ! " ] ilag’ ' €51 est Ni1J3S W quom*® e @BSAVY® /YNS/ e F3WNLSA 90 0 0 oloden 0 0 2L B e RNCh gxig’ W 2eeoee L $¥3SI348SNQV0YvL L A W N G m y u 1 g * M¥1E * 0o0eRY B e 12384’ L e 921 W gt 8 mu18"’ M8’ mue’ Mu18°* Mye° SAMPLE ASSEMBLY AND CROSS REFERENCE LISTING e ESHY N W 951 §§1 st e 091 191 991 Ni3J3S IWNLIS 0950 0 patete nEnioe 21050 nenioe J0eoee p1esa1 giLetlt Talele pasele ense e 85 0 0 nsS0 0 94i50 8 na9ve 9690 8 Le2 962 1341 fos nos 1711 21t 91t e e 181 i i 2% et nat 92¢% 141 an3* ¥17v3 By'SH AQOW L*TINV¥038HSIAOWN9I3S9 s34Lv013I1u08d298T3y i 1331 +(ty) Sy‘dy o TWASNI 139$6380Qv40IN3WH3S401dI¥I830 ¢O138N40 41 1 V0T108WAS201dIN3830ONYANIFNdA3NiIN3NOITL0I83WIASSLSNNIW37388VLdNi3S Mvd I 12¢ tses 1sa¢é NS MENSL‘HNEMEH gn90ee diWd (0y) LT L% §0¢2 AOwW W W rig T AOKW S ) u‘sSy AONW 0u’SH (L) By 03¢ 'I8AND (By) T i18 T 1331 AOW Ce 038 $A9dvO7D4 eIt niSO0 9IslL l 8473 ‘s3usSIm (0¥ 9 v i g N O I 1 3 S S v I N I Q I S 3 u = % S v Y L 1 3 9 S 3 ¥ Q v 4 0 v I 0 7 1 H 0 1 l d I ¥ J 3 8 3 Q INENL3 WNLSde 141384030ON041¥335d4Q0¥a04L073188 dNNIi3H80ldI¥IS3Q Y Ta'WAS13 ¥0L0d1LIv¥NI4$0O37M0 4LO08N1v374ON74AOWdIV0Dv3YSNM H¥AvO3NT3IT U9dIANY3IVQIHSE3NI¥GT N3$O8¥I3L08ILJ03QSv L 90¢ L Qes 038 AOW8181 (By)= $o% R P Y ’ Z * N A S T I 9nse0e enisel +++(((BQ0yyy)))'''+++(((T%8YtyHu))) 10 3 IN3WO3S CAIND 795020 AOW SAMPLE ASSEMBLY AND CROSS REFERENCE LISTING MWWW@,Q | 720 0 esetle l1o0e0 2590 0 i ] (131 ffs eWiy, £ SAMPLE ASSEMBLY AND CROSS REFERENCE LISTING i1g=2 Toc=2n $92=2» X9 X9 oo oxix - Y WAS1IT iy NQONW JYdid JdSi¥ 44 WASNI] ind183 WN TS3 AM8I83 WNLJS vds$ 4448 WASINI L2TYYIR AWKNG 4843 o X9 oo EYT) 189848 T3u8AS LNvos AN DS H91438 HTNISGMHSAS X9 X9 X9 oo §91le2 12 2 Y TY YL ] PL2=2 2900200 T08HAS JSANI X9 ni2=2 nnodes n2eode n9e gs 29de=¢ dil=2» WMEAS 9ig=2 d92=2 pLe=2 192=2 991= 2 9912 n9le? n9l=2 BL1=2 9822 X9 691=2 Log=2 1fg=2 252=2 n9le2 192=2 nie=2 95d=2 6912 f6d=2 elé=2 n9le2n B1s=2 9L2=2 342 ToA 6éi=2 L91=2 §91=2 BLi=2 SAMPLE ASSEMBLY AND CROSS REFERENCE LISTING g 02i=2C» gGC=2» n é=¢ 292=2 g82=2 LoC=2» Bifelx 0ig=gs Lo2=2s 192 gLd=2» ndi=2 61d=2 682 nig=2 612=2» 2 Ty 2d 068KAS §52=2» 29¢2=¢ARLT Sy $3IN34343Y Li2g=2 O 6n2e=2 eli=¢ glg=2% §2 =2% £y HILSION I0GWASS0¥IFINIYIL3Y 602=2» ésa=2 gLa=2 922=2 0ig=2 AYLTE. 6hd=¢ L)CYRLT L08=2 91g=2 eni=2» 992=2 BIndelsi90222=2» 182=2%Lne=2»Bhde=2» 922=2» 192=2%02i=2» hhdeee»§c=2s Thig=2YL LI TEned=2YL =2» 625 ned=d» 962> Pide2s 13A H-6 SAMPLE ASSEMBLY AND CROSS REFERENCE LISTING one=2 Itfe2sTig=2 Ene=e 902=2 1e2=2 612=2 8L2=2 9Si=1in NuNl3Y FSOIMNIUOYI¥JV3IWY Uei=2n §91=2» RiT=2n 13 80 ¥17vd s¥oY 3 UAVS YA YSN123S 808§ SAMPLE ASSEMBLY AND CROSS REFERENCE LISTING - Pl ned=2d 192 981«2 9 1=2 22i=2 =2 991 2922 2ig=2 dg=2 Lei=2 121=2 §9i=2 8912 L91=2 S91=2 891e2 12 =2 enée=¢ g21=2 921i=2 L91=2 Bi12=2 ped=2 n9l=2 L91=2 8Li=2 =2 991 ULl=2 2s51=2 691=2 02e=2 édé=2 it1e=2 9 12 fif=2 691=2 aNg® Bnd=2¢ pl2=2 6912 =2 BL1=2 Qe2=2 2 d=2 gne=2 JaN3* I8l gisl éed=¢ gne=2 n9le MFIVY 62g=2 pL2=2 n9le2 a1° 2ie=2 db2=2 Ind=2 6622 1st=2 ngd=2 8L1=2 991=2 n9leg 0L1=2 geg=¢ neleg LT IR 90e=2 292=2 2g=2 Scli=2 9L1=2 gxle’ myie* dWld S0é=¢ LS2=2 212=2 222=2 d2é=2 on2=2 1g=2 si¥ 3¢ ye INI dnl sl gsle ile gl e 078 ane 413 ing=2 slg=2 05e=2 n9d=¢ £02=2 LE2=2 2td=2 282e2 nege=2 25d=2 502=2 aqyv 338 01e $36 T08WAS $43IN3IUI 2i =2 L9¢=2 hidee 162=2 9 5 d = ¢ 2 1L2=2 ININVWYEd T08WAS 376YL S08I 3IN3HI43Y glg=2 1g2=2 l1gg=e B12=2 ande2 Iig=2 2og=2 0e =2 2i2=2 §2é=2 n é=2 B12=2 2 é=2 On2=2 SB2=2 8022 B1e=2 822+2 ane=2 192-2 1ge=2 l1og=2 4340 dadid=2 92 =2 vede2 8ld=2 eBi=¢ oA niged 9=28 g02=2 ene =e N INDEX 4, Absolute addresses, 6-14 Absolute binary output, 6-14 Absolute expression, 3-16 Absolute mode, 5-5, Absolute module, 5-7 6-34 Absolute program section, Address boundaries, 6-31 Address Address mode syntax, modes, 5-1 6-37 B-1 Addressing forms, summary, 5-7 Allocating byte data, 6-17 Allocating dynamic memory, F-1 Allocating word data, 6-18 Allocation requirements, 6-35 Alternate radix, 6-25 B operator, Backslash, 6-25 3-1 Binary operators, 3-15 Blank lines, 2-2 Blocks of storage, reserving, 6-30 .BLKB directive, 6-30 .BLKW directive, 6-30 Branch instruction addressing, 5-8 .BYTE directive, 6-17 Ampersand, 3-1 Angle brackets, 3-3, 3-15, 6-4, 6-25, 6-28, 7-4 to 7-5, 7-16 to 7-17 Apostrophe, 7-10 Argument substitution, 7-16 "C operator, 6-27 Calling conventions, E-8 Calling macros, 7-3 Changing default radix, 3-13 Changing value of location Arithmetic addition operator or autoincrement indicator 3-1 Arithmetic division operator Character set, 3-1 Character substitution, 7-16 Code and data separation, 6-38 Code or data sharing, 6-38 Coding standard, E-1 3-1 3-1 Arithmetic subtraction operator or autodecrement indicator, 3-1 ASCII character set, A-1 ASCII conversion, 3-14 ASCII conversion characters 6-19 .ASCII directive, 6-20 .ASCIZ directive, 6-21 .ASECT directive, 6-38 Assembler directives, 6-1, B-1, Assembler B-2 version, language, B-1 listing, 2-6 Assembly pass 1, 1-1 Asterisk, 3-1 At sign, 3-1 Attribute of the current location counter, 3-12 Autodecrement deferred mode, 5-3, 5-7 Autodecrement mode, 5-7 Comment field Complementing argument, E-2 2-5 indicator, an 3-1 6-27 Complex relocatable expression, 3-16 Complex relocation, 4-1 Concatenated, 6-35 Concatenation of macro arguments, Conditional 7-10 assembly block, assembly directive, 6-41, 6-42 Conditional branches, E-13 Continuation lines, 2-2 Creating local symbols automatically, 7-7 Creating program sections, 6-36 Cross~reference (CREF)r listing H-5 .CSECT directive, 6-17 Current location counter, Autoincrement deferred 5-2, 3-1 Comma, 3-1 Comment, 6-14, Comment field, 6-41 Conditional 6-8 Assembly Assembly mode, 5-3, 5-7 Autoincrement mode, 3-12 Colon, Arithmetic multiplication operator, counter, 3-11, 5-7 Index-1 3-14, 5-6, 6-29 2-2, "D operator, 6- 25 Data storage directives, 6-17 Date, 6-8 Default object module name, (CONT.) Finding number of characters in strings, 7-12 Floating-point data, 6-26 number, 6-11 summary, truncation, .FLT2 directive, usage, operator, 3-1 Direct assignment statements, 3-7 Directives, 2-5 Double ASCII character indicator, 3-1 Double colon, 3-1, 3-7 Double equal sign, 3“""1 r 3"""7 Double quote, 3-1, 3-14, 6 -19 .DSABL directive, 3 “71 3“9 6-13 to 6-1 5, 6 =27 Duplication of code, 7-17 \ 6-27 E-12 i Formatting standards, E-9 Forward referencing, 3-8 Function control switches, Function directives, 8-6 6-13 General purpose registers, General registers, 3-9 Global label, 6-40 references, k E-2 6-15 6-40 symbol directory, 1-2 .GLOBL directive, 3-7, 6-39 GSD, 1-2 5-8 .ENABL directive, 6-15, 5-7, 6-27 3-15 Exclamation point, 3-1 Executable task image, Exiting, E-9 Expressions, 3-14, 4-1 3-15 External 3-16 expression, External symbols, 3-15, 6 -40 Externally-defined macro, “F operator, 6-27 7-18 Hardware registers, E-2 Horizontal formatting, 2-6 .IF directive, 6-41 .IFF directive, 6-43, 6-44 LIFT directive, 6-43 .IFTF directive, 6-43 .IIF directive, 6-46 Illegal characters, 3-3 Immediate conditional assembly, 6-46 Immediate expression indicator, 3-1 Immediate mode, 5-4, 5-7 Immediate mode deferred, 5-5 Implicit .WORD directive, 2-5, 6-18 Indefinite repeat block directives, 7-15 Index deferred mode, 5-4, 5-7 Index 3- 14, address arguments, mode 7-13 of 2-3, 6-1 3, .END directive, 6-3 1 .ENDC directive r6“’ 41 .ENDM directive 17""' 2 End of the source input, 6-31 .ENDR directive Entry-point instructions, 6-33 .EOT directive, 6-3 1 Equal sign, 3-1 Error codes, D- 1 .ERROR directive, 7 -14 Evaluation of expressions, Finding g 6-27 Form-feed, 6-13, 7-3 Format control, 2-6 symbol, EMT, 6-14, .FLT4 directive 6-27 Forbidden instruction D- 1 assignment 6-28 number specification, 6-27 rounding, 6-15, 6-27 storage directives, 6-27 Default register definitions, 6 - 15 Deferred addressing indicator, 3-1 Defining macros, 7-1 Device registers, E-2 Diagnostic, 7-14 Diagnostic error message Direct = INDEX macro mode, 5-4, 5-7 — Initial argument or expression indicator, 3-1 Initial Index-2 register indicator, i 3-1 ! INDEX Instruction set, C-1 .IRP directive, 7-15 .IRPC directive, 7-15, 7-16 Item or field terminator, 3-1 Keyword arguments, 7-4, 7-9 (CONT.) Macro call arguments, 7-4 Macro call numeric argument indicator, 3-1 Macro definition, 7-1, 7-15 Macro definition arguments, 7-4 Macro definition formatting, 7-3 Macro definition termination, 7-2 Macro definitions and expansions, F-2 Macro directives, 7-1 Macro expansion termination, Label field, 2-2 Label terminator, 3-1 Left angle bracket, 3-1 Left parenthesis, 3-1 .LIMIT directive, 6-31 Line format, E-1 Linker, 2-2, 4-1 Linking, 4-1, 4-39 .LIST directive, 6-1 Listing conditional assemblies, 6-4 Listing control directives, 6-1 Listing level count, 6-2 7-3 Listing of binary extensions, 6-3 Listing of Listing of binary Listing of Listing of comments, 6-4 generated code, 6-3 macro class, 6-4 macro definitions, 6-4 Listing of macro expansion binary Listing of code, 6-4 repeat range 6-4 symbol block, 6-14 symbol block delimiters, 3-10 Local symbols, 3-6, 3-10, Location counter, 6-36 Location counter control directives, 6-29 Logical AND operator, library directive, Macro name, 7-1, Macro names, E-5 3-11 3-1, 6-42 Logical inclusive OR operator, 3-1, 6-42 Lower-case ASCII, 6-14 Macro nesting, 7-5 Macro symbol table, 3-5 MACRO-11 character sets, A-1 MACRO-11 directives, 5-9, C-4 MACRO-11 symbols, 3-5 .MCALL directive, 7-18 Memory allocation, 6-32, 6-33, 6-38 Memory allocation and mapping, 6-32 .MEXIT directive, 7-18 Minus sign, 3-1 Modularity, E-8 Module checking routines, E-9 .Module preface, E-5 symbols, 3-11 Multiple labels, 2-4 Naming standards, E-2 .NARG directive, 7-11 .NCHR directive, 7-11, Negative numbers, 3-14 Macro arguments, 7-6 Macro attritube directives, Macro call, | 2-5, 7-3, 7-5 7-12 Nested conditional directives, 6-43 Nested macros, 7-3, 7-5 . .NLIST directive, 6-1, 6-11 .NTYPE directive, 7-11, 7-13 Number of arguments in macro calls, 7-7, 7-11 Number sign, 3-1, 5-4 Numbers, 3-13 Numeric control, 6-24 Numeric control operators, 6-26, 6-27 Numeric directives, 7-11 7-18 7-4 Multi-defined label, 2-4 Multiple definitions of local expansions, 6-4 Listing of source lines, 6-3 Listing of the current location counter, 6-3 Listing of the symbol table, Local Local Macro "0 operator, 6-25 Object module, 4-1 Object module name, Index-3 6-26 6-11 INDEX Octal radix, 3-13 .ODD directive, 6-29 Register, Op codes, 2-4, C-1 Operand field, 2-4 Operand field separator, Operator field, 2-4 Order of symbol table 3-1 search, 3-6 symbols, E-3 Other (CONT.) Relative Relative Relative mode, 5-1, 5-7 standards, E-2 symbols, 3-9 term indicator, 3-1 addresses, 6-14 addressing mode, 5-6 deferred mode, 5-6, 5-7 Relative mode, Register Register Register Overlaid, 6-35 Relocatability, Overlays, 6-33 Relocatable 5-5, 5-7 6-34 expressions, 3-16, 4-1 .PAGE directive, Page eject, 7-3 6-13 Relocatable module, Relocatable program 6-37 Relocation, 4-1 bias, Page Page Page ejection, 6-13 formatting, 2-6 Relocation headings, .REPT directive, Page number, PAL-11R 6-8 6-8 conditional 6-46 Passing numeric as symbols, Percent sign, Permanent Repeat assembly, arguments table, Program boundaries 6-31 7-17 7-17 storage, 6-30 storage space, Reserving Reserving 6-29 Right parenthesis, 3-13, 3-1 3-5, Program counter, 3-9, modules, E-5 Program Program section section .SBTTL Scope G-1 directive, Program 5-1 access, 6-33 name, 6-33 sections, 3-12, 6-32 Program source files, E-12 Program-local symbols, E-4 Programming standards and conventions, 2-1 .PSECT directive, 3-12, 6-32, 6—-35 directive, of the 6-8, 6-11 program section, 6-33 | Semicolon, 3-1 Sending messages to listing file, 7-14 Separating and delimiting characters, 3-2 Single ASCII character indicator, 3-1 Single quote, 3-1, 3-14, 6-19, 7-10 Slash, 3-1 | Source line sequence numbers, 6-3 Space, 3-1 Special Special characters, B-1 characters in macro arguments, Stack operator, 6-23 directive, .RAD50 3-13, 6-24 Radix control, 6-24 Radix control operators, 6-25 Radix-50 character set, A-4 Radix-50 6-34 3-1 symbol Plus sign, 3-1 w Position independent code, .PRINT directive, 7-14 Processor priority, E-3 R 2-2, directive, 6-46 C-1 Program block 6-34 sections, control operator, 6-23 Radix-50 data, 6-22 .RADIX directive, 3-13, Read-only access, 6-33 Read/write access, 6-33 Register deferred Register expression, mode, 5-1 5-2 | 3-9 format, 2-1 Statement Storing Radix-50 data, 6-23 Subconditional assembly, 6-43 subtitle, 6-8 Success/failure indication, E-9 Symbol Symbol Symbol 6-24 7-6 pointer, control directive, examples, E-4 table listing, 1-2 6-39 Symbolic arguments of listing control directives, 6-3, 6-4 Symbols, E-3 Symbols and expressions, 3-1 System macro libraries, 7-18 Index-4 TM INDEX Tab, 3-1 Tab character, 1 | 2-2 Table of contents, 6-4, 6-11 Teleprinter mode, 6-4 Terminal argument or expression indicator, 3-1 Terminal register indicator, | 3-1 Terminating directives, 6-31 Terms, 3-14 Time-of-day, 6-8 .TITLE directive, 6-11 Title of the object module, 6-8 Translating to ASCII, Translating (CONT.) Unary operator ordering, Unary operators, 3-15 Unconditional assembly, 6-28 6-43 Undefined symbols, 3-7, 3-14 Universal unary operator or argument indicator, 3-1 Up arrow or circumflex, 3-1 Up—-arrow, 3-3 Up-arrow (°) construction, 7-5 User symbol table, 3-5 | User-defined and macro symbols, 3-5 User-defined macro libraries, 7-18 Using the standard symbolics, to Radix-50, 6-22 Trap instructions, Unary and 3-4 5-8 Version number, 6-12 Version number standard, E-13 binary operators, Unary control, 6-24 .WORD directive, Index=-5 3-11, 6-18 PDP-11 MACRO-11 Language Reference Manual AA-5075A~TC READER'S This form is for document comments only. DIGITAL will use comments submitted on this form at the company's discretion. Problems with software should be reported on a Software Performance Report (SPR) form. If you require a written reply and are eligible to receive one under SPR service, submit your comments on an SPR form. Did you find errors Did you find Please make Is there in this manual? this manual suggestions If so, understandable, for usable, improvement. sufficient documentation on specify by page. associated and well-organized? system programs required for use of the software described in this manual? what material is missing and where should it be placed? Please indicate 000000 . Please cut alon this line. —— NOTE: COMMENTS the Assembly type of language Higher-level user/reader that you most nearly If not, represent. programmer language programmer Occasional programmer (experienced) Uaer with little programming experience Student programmer ‘Non-programmer interested in computer concepts and capabilities ‘Name Date Organization (Stre@t‘ | City___ State _ Zip Code or Country Fold Here Do Not Tear - Fold Here and Staple FIRST CLASS PERMIT NO. 33 MAYNARD, MASS. BUSINESS REPLY MAIL NO POSTAGE STAMP NECESSARY IF MAILED IN THE UNITED STATES Postage will be paid by: Software Documentation 146 Main Street Maynard, ML5-5/E39 Massachusetts 01754
Home
Privacy and Data
Site structure and layout ©2025 Majenko Technologies