File No. 8360-21 Order No. GC28-6514-9 Systems Reference Library OS Assembler Language OS Release 21 This publication contains specifications for the ~BM System/360 Operating System Assembler Language (Leyels E and F) . The assembler language is a symbolic programming language used to write programs for the IBM System/360. The language pro vides a convenient means for representing the machine instructions and related data necessary to program the IBM System/360. The IBM Systelt1/360 Operating System Assem bler Program processes the language and provides auxiliary functions useful in the preparation and documentation of a program, and includes facilities for processing the assembler macro language. Part I of this publication describes the assembler language. Part II of this publication describes an extension of the assembler language -- the macro language used to define macro instructions. PREFACE This publication is a reference manual operations are discussed in the publication for the programmer using the assembler IBM System/360 Principles of Operation, language and its features. Order No. GA22-682l. The IBM System/370 machine operations are discussed in the Part I of this publication presents publication IBM System/370 Principles of information common to all parts of the Operation, Order No. GA22-7000. Information language followed by specific information on program assembling, linkage editing, concerning the symbolic machine instruction executing, interpreting listings, and codes and the assembler program functions assembler programming considerations is provided for t:he programmer I s use. Part II provided in OS Assembler (F} Programmer's contains a description of the macro lan Guide, Order No. GC26-3756. guage and procedures for its use. Appendixes A through J follow Part II. Appendixes A through F are associated with The following publications are referred to Parts I and II and present such items as a in this publication: summary chart for constants, instruction listings, character set representations, OS Introduction, Order No. GC28-6534 and other aids to programming. Appendix G contains macro language summary charts, and OS Utilities, Order No. GC28-6586 Appendix H is a sample program. Appendix I is a features comparison chart of System/360 assemblers. Appendix J includes OS Loader and Linkage Edito~, Order No. GC28-6538 samples of macro definitions. Knowledge of IBH System/360 machine OS Supervisor Services and Macro operations, particularly storage address Instructions, Order No. GC28-6646 ing, data formats, and machine instruction formats and functions, is prerequisite to OS Data Management Macro Instructions, using this publication, as is experience Order No. GC26-3794 with programming concepts and techniques or completion of basic courses of instruction OS Data Management Services Guide, in these areas. IBM System/360 machine Order No. GC26-3746 lenth Edition (January, 1974) This is a reprint of GC28-6514-8 incorporating changes released in the following Technical Newsletter: GN33-8154 (dated April 30, 1973) This Technical Newsletter is a part of release 21.7 of OS/MPT and OS/MVT. This edition applies to release 21 of IBM System/360 Operating System and to all subsequent releases until otherwise indicated in new editions or Technical Newsletters. Changes are continually made to specifications herein; before using this publication in connection with the operation of IBM systems, consult tJile IBM System/360 and System/370 Bibliography, Order No. GA22-6822, for the editions that are applicable and current. Requests for copies of IBM publications should be made to your IBM representative or to the IBM branch office serving your locality. A form is provided at the back of this publication for readers' comments. If the form has been removed, comments may be addressed to IBM Nordic Laboratory, Product Communications, Box 962, S-181 09 Lidingo 9, Sweden. Comments become the property of IBM. ©Copyright International Business Machines Corporation 1966, 1968, 1969, 1970, 1972, 1974 CONTENTS PART 1 -- THE ASSEMBLER LANGUAGE CSECT -- Identify Control SECTION 1: INTRODUCTION. 3 Section • • • • • • • • • • 23 Compatibility •• 3 Unnamed Control Section. • • 24 DSECT -- Identify Dummy Section. • 24 The Assembler Language • • 3 External Dummy Sections(Assemb1er F}. 25 Machine Operation Codes. 3 DXD -- Define External Dummy Assembler Operation Codes •• 3 Section. • • • • • • • • • • • • • • 25 Macro Instructions • 3 CXD - Cumulative Length External Dummy Section. • • • • • • •• • • • 25 The Assembler Program. 4 COM -- Define Blank Common Control Basic Functions. 4 Section. • • • • • • • • • • • 26 Symbolic Linkages • • •• • • • 26 Programmer Aids. 4 ENTRY -- Identify Entry-Point Symbol • • • •• • • • • • • • • 27 Operating System Relationships • 5 EXTRN -- Identify External Symbol • • 27 Addressing External Control SECTION 2: GENERAL INFORMATION •• 7 sections. • • • • • • • • 28 AsseJ';:.)ler Language Coding Conventions. • 7 SECTION 4: MACHINE-INSTRUCTIONS •• 29 Coding Form. • • • • 7 Continuation Lines • 7 Machine-Instruction Statements • • • 29 Statement Boundaries 8 Instruction Alignment and Statement Format • • • • • 8 Checking. • • • •••••• • 29 Identification-Sequence Field. 9 Operand Fields and Subfields •• • 29 Summary of Statement Format. 9 Lengths -- Explicit and Implied • 30 Character Set ••••••••••• 10 Machine-Instruction Mnemonic Codes • 31 Assembler Language Structure • • • 10 Machine-Instruction Examples. • 31 RR Format. 31 Terms and Expressions. • 10 RX Format. 32 Terms . . • • • • • • • 10 RS Format. • • • • • • 32 Symbols. • • • • • 10 SI Format. • 32 Self-Defining Terms. • 12 SS Format ••• 32 Location Counter Reference • • 14 Literals • • • • • • • • • 14 Extended Mnemonic Codes. 32 Symbol Length Attribute Reference • • • • • • • • 15 SECTION 5: ASSEMBLER INSTRUCTION Terms in Parentheses. • 16 STATEMENTS. • • • • • • • • • 35 Expressions • • • • • • • • • • • 16 Evaluation of Expressions. • • 16 Symbol Definition Instruction. • • • 35 Absolute and Relocatable EQU -- EQUATE SYMBOL. • • • • • 35 Expressions • • • • • • • • • 17 Operation Code Definition Instruction. 36 SECTION 3: ADDRESSING -- PROGRAM OPSYN -- EQUATE OPERATION CODE . . . 36 SECTIONING AND LINKING. • .19 Data Definition Instructions • • • • • • 36 DC -- DEFINE CONSTANT • • • • • • • • 36 Addressing • • • • . • • • • 19 Operand Subfield 1: DUplication Addresses -- Explicit and Implied. • 19 Factor. • • • • • • • 0 • •• 38 Base Register Instructions ••• • 19 Operand Subfield 2: Type. •• 38 USING -- Use Base Address Operand Subfield 3: Modifiers. 38 Register. • • • • • • • • • • 19 Operand Subfield 4: Constant • 41 DROP -- Drop Base Register • • 20 DS -- Define Storage. • • • • • • • • 48 Programming with the USING Special Uses of the Duplication Instruction. • • • • 21 Factor. • • • • • • • • • • 50 Relative Addressing • • • • • • 21 CCW -- Define Channel Command Word. • 50 Program Sectioning and Linking • • • 22 Listing Control Instructions . • 51 Control Sections •••••• • 22 TITLE Identify Assembly Output 51 Control Section Location EJECT Start New Page 52 Assignment ••••••• • 22 SPACE Space Listing. 52 First Control section • • • • 23 PRINT Print Optional Data. • 52 START -- Start Assembly. • • • 23 iii Program Control Instructions . .. .53 Inner Macro Instructions . . 73 ICTL -- Input Format Control ..... 53 ISEQ -- Input Sequence Checking ... 54 Levels of Macro Instructions 74 a PUNCH -- Punch Card . . . .. .54 REPRO -- Reproduce Following Card .. 55 SECTION 9: HOW TO WRITE CONDI'l'IONAL ORG -- Set Location Counter ..... 55 ASSEMBLY INSTRUCTIONS . 75 LTORG -- Begin Literal Pool ..... 55 Special Addressing Consideration .56 SET Symbols ..... . • • 75 Duplicate Literals ........ 56 Defining SET Symbols . • 75 CNOP -- Conditional No Operation ... 56 Using Variable Symbols . • • • • • 75 COpy -- Copy Predefined Source Coding . . . . . . . . . . • .57 Attributes . . . . . . . . . . 76 END End Assembly . . . ... 58 Type Attribute (T'). ... . . 77 Length (L'), Scaling (S'), and PART 2 -- THE MACRO LANGUAGE Integer (I') Attributes. . 78 SECTION 6: INTRODUCTION TO THE MACRO Count Attribute (K') • 78 LANGUAGE. .61 Number Attribute (NI ). • • 79 Assigning Attributes to Symbols .. 79 The Macro Instruction Statement. .61 The Macro Definition .61 Sequence Symbols . . . . . · 80 The Macro Library .. · .61 LCLA,LCLB,LCLC -- Define SET Symbols . . 81 System & Programmer Macro Definitions .. 62 SETA -- Set Arithmetic . 81 Evaluation of Arithmetic System Macro Instructions. . . .. .62 Expressions . . . 82 Varying the Generated Statements .62 Using SETA Symbols . · 82 Variable Symbols ............ 62 SETC -- Set Character ... • 83 Types of Variable Symbols.. .62 Type Attribute . . 83 Assigning Values to Variable Character Expression . . • • 83 Symbols . . . . . . . . . . . . .63 Substring Notation . 84 Global SET Symbols .. ....63 Using SETC Symbols . · 85 Organization of this Part of the SETB -- Set Binary . . . . . · 86 Publication . . . .. . ... 63 Evaluation of Logical Expressions . . . . • • 87 SECTION 7: HOW TO PREPARE MACRO Using SETB Symbols . . 87 DEFINITIONS . .... . .65 AIF Conditiona+ Branch. 88 MACRO -- Macro Definition Header . .65 AGO Unconditional Branch. • • • • 89 MEND -- Macro Definition Trailer .... 65 ACTR -- Conditional Assembly Loop Macro Instruction Prototype .. · .65 Counter . . . . . . . . . . . • • 89 Statement Format . . . . . . . 66 ANOP -- Assembly No Operation. . . . . . 90 Model Statements . . . · .66 Conditional Assembly Elements. • •• 90 Symbolic Parameters. . . .67 Concatenating Symbolic SECTION 10: EXTENDED FEATURES OF THE Parameters with Other MACRO LANGUAGE. . . . . . . . . 93 Characters or Other Symbolic Parameters .. .68 MEXIT Macro Definition Exit 93 Comments Statements. • .69 MNOTE Request for Error Message 93 COpy Statements ... · .69 Global and Local Variable Symbols. • 94 SECTION 8: HOW TO WRITE MACRO Defining Local and Global SET INSTRUCTIONS ... · .71 Symbols . . • • 95 Using Global and Local SET Macro Instruction Operands . · .71 Symbols . . . . . . . . 95 Subscripted SET Symbols .. • • 97 Statement Format . ••• 72 SYSTEM VARIABLE SYMBOLS. . .. . .. 98 Omitted Operands . • .72 &SYSNDX -- Macro Instruction Index . . . . . . . . . .. . 98 Operand Sublists . . · .72 iv &SYSECT -- Current Control APPENDIX C: MACHINE-INSTRUCTION FORMAT.119 Section . . . . . . . .. . 99 &SYSLIST -- Macro Instruction APPENDIX D: MACHINE-INSTRUCTION Operand. . . .. . .... 100 MNEMONIC OPERATION CODES .... .. 121 Keyword Macro Definitions And APPENDIX E: ASSEMBLER INSTRUCTIONS. .131 Instructions . . . . . . . . .. 100 Keyword Prototype ... .101 APPENDIX F: SUMMARY OF CONSTANTS. .135 Keyword Macro Instruction. . .. 101 APPENDIX G: MACRO LANGUAGE SUMMARY. .137 Mixed-Mode Macro Definitions and . Instructions ..•.•..•..... 103 APPENDIX H: SAMPLE PROGRAM. .141 Mixed-Mode Prototype ...... 103 Mixed-Mode Macro Instruction •. 103 APPENDIX I: ASSEMBLER LANGUAGES-- FEATURES COMPARISON CHART .145 Macro Definition Compatibility .•... 104 APPENDIX J: SAMPLE MACRO DEFINITIONS .. 149 APPENDIXES INDEX .. .151 APPENDIX A: CHARACTER CODES •.•... 107 APPENDIX B: HEXADECIMAL-DECIMAL NUMBER CONVERSION TABLE ....•... 113 V' ILLUSTRATIONS figures Figure 2-1. Coding Form 7 Figure 5-2. Bit-Length Specification F'igure 2-2. Punched Card Form 8 (Single Constant) . . . . . 39 Figure 2-3. Assembler Language Figure 5-3. Bit-Length Specification Structure--Machine and (Multiple Constants) .... 40 Assembler Instructions. .11 Figure 5-4. Bit-Length Specification F'igure 3-l. Multiple Base Register (Multiple Operands) . . . . 40 Assignment. .21 Figure 5-5. Floating-Point External Figure 4-1. Extended Mnemonic Codes .33 Formats . . .. .... 45 Figure 5-1. Type Codes for Constants. .38 Figure 5-6. CNOP Alignment. . . . . . . 57 Tables 'rable 4-1. Address Specification Table 4-2. Details of Length Specifi Details .........• 30 cations in SS Instructions. 31 vi SUMMARY OF AMENDMENTS FOR GC28-6514-8 OS RELEASE 21 USE OF DSECT SYMBOLS IN ADCONS &SYSLIST The use of DSECT symbols as absolute An explanation of &SYSLIST(O) has been expressions in adcons has been rewritten added for completeness. for clarification. COMMENTS ON ASSEMBLER INSTRUCTIONS A note has been added explaining why HEXADECIMAL CONSTANTS AND SYNTAX RULES certain assembler instructions (e.g.,LTORG) are not flagged when an "operand" is Clarification of the syntax restriction present. on the number of hexadecimal digits allow able per explicit hexadecimal constant POSITIONAL PARAMETERS specification has been added. A note has been added explaining that positional parameters cannot be changed to keywords by substitution. MACHINE-INSTRUCTION ON MNEMONIC OPERATION CODES MACRO SEQUENCE SYMBOLS Erroneous instruction names, condition code settings, and operand formats contained An explanatory note has been added dis in Appendix D have been corrected. tinguishing the "name field" of a macro from the name field parameter. CHARACTER CODE GRAPHICS TITLE CHANGES The EBCDIC printer graphics for the IBM Cross-references to OS publications System/360 8-bit code have been added to have been changed to reflect their new Appendix A. titles. vii PART I -- THE ASSEMBLER LANGUAGE SECTION 1: INTRODUCTION SECTION 2: GENERAL INFORMATION SECTION 3: ADDRESSING AND PROGRAM SECTIONING AND LINKING SECTION 4: MACHINE INSTRUCTIONS SECTION 5: ASSEMBLER INSTRUCTIONS SECTION 1: INTRODUCTION computer programs may be expressed in THE ASSEMBLER LANGUAGE machine language, i.e., language directly interpreted by the computer, or in a sym bolic language, which is much more mean1ng The basis of the assembler language is a ful to the programmer. The symbolic lan collection of mnemonic symbols which rep guage, however, must be translated into resent: machine language before the computer can execute the program. This fUnction is 1. System/360 machine-language operation accomplished by a processing program. codes. 2. Operations (auxiliary functions) to be Of the various symbolic programming lan performed by the assembler program. guages, assembler languages are closest to machine language in form and content. The The language is augmented by other sym assembler language discussed in this manual bols, supplied by the programmer, and used is a symbolic programming language for the to represent storage addresses or data. IBM System/360. It enables the programmer Symbols are easier to remember and code to use all IBM System/360 machine func than their machine-language equivalents. tions, as if he were coding in System/360 Use of symbols greatly reduces programming machine language. effort and error. The programmer may also create a type of The assembler program that processes the instruction called a macro instruction. A language translates symbolic instructions mnemonic symbol, supplied by the program into machine-language instructions, assigns mer, serves as the operation code of the storage locations" and perf orms auxiliary instruction. functions necessary to produce an executa ble machine-language program. Machine Operation Codes The assembler language provides mnemonic Compatibility machine-instruction operation codes for all machine ins'tructions in the IBM System/360 Universal Instruction Set and extended mne System/360 Operating System assemblers monic operation codes for the conuitional process source programs written in the branch instruction. Basic Programming Support/360 basic assem bler language, the IBM 7090/7094 Support Package for IBM System/360 assembler lan guage, the Basic Programming Support Ass Assembler Operation Codes embler (8K Tape) language, the Basic Oper ating System Assembler (8K Disk) language, and the Disk and Tape Systems Assembler The assembler language also contains language, with the following exceptions: mnemonic assembler-instruction operation codes, used to specify auxiliary functions to be performed by the assembler. These 1. The XFR assembler instruction is con are instructions to the assembler program sidered an invalid mnemonic operation itself and, with a few exceptions, result code by Operating System/360 assem in the generation of no machine-language blers. code by the assembler program. 2. The assignment, size, and ordering of literal pools may differ among the Macro Instructions assemblers. Differences in the macro language for The assembler language enables the pro- System/360 assemblers are described in Sec grammer to define and use macro tion 10 of this publication. instructions. Section 1: Introduction 3 Macro instruct~ons are represented by an The amount of main storage allocated to operation code which stands for a sequence the assembler for use during processing of machine and/or assembler instructions. determines the maximum number of certain Macro instructions used in preparing an language elements that may be present in assembler language source program fall into the source program. two categories: system macro instructions, provided by IBM, which relate the object program to components of the operating system; and macro instructions created by PROGRAMMER AIDS the programmer specifically for use in the program at hand, or for incorporation in a library, available for future use. The assembler provides auxiliary fUnc tions that assist the programmer in check Programmer-created macro instructions ing and documenting programs, in controll are used to simplify the writing of a ing address assignment, in segmenting a program and to ensure that a standard program, in data and symbol definition, in sequence of instructions is used to generating macro instructions, and in con accomplish a desired function. For trolling the assembler itself. Mnemonic instance, the logic of a program may operation codes for these functions are require the same instruction sequence to be provided in the language. executed again and again. Rather than code this entire sequence each time it is need ed, the programmer creates a macro Variety in Data Representation: Decimal, instruction to represent the sequence and binary, hexadecimal, or character represen then, each time the sequence is needed, the tation of machine-language binary values programmer simply codes the macro may be employed by the programmer in writ instruction statement. During assembly, ing source statements. The prograrr@er se the sequence of instructions represented by lects the representation best suited to his the macro instruction is inserted in the purpose. object program .. Part II of this publication discusses Base Register Address Calculation: As dis the language and procedures for defining cussed in IBM System/360: Principles of and using macro instructions. Operation, the Systern/360 addressing scheme requires the designation of a base register (containing a base address value) and a displacement value in specifying a storage THE ASSEMBLER PROGRAM location. The assembler assumes the cleri cal burden of calculating storage addresses in these terms for the symbolic addresses The assembler program, also referred to used by the programmer. The programmer as the "assembler," processes the source retains control of base register usage and statements written in the assembler the values entered therein. language. Relocatability: The object programs pro duced by the assembler are in a format Basic Functions enabling relocation from the originally aSSigned storage area to any other suitable area. Processing involves the translation of source statements into machine language, the assignment of storage locations to Sectioning and Linkin~ The assembler lan instructions and other elements of the guage and program provide facilities for program, and t~he performance of the auxil partitioning an assembly into one or more iary assembler functions deSignated by the parts called control sections. Control programmer. The output of the assembler sections may be added or deleted when program is the object program, a machine loading the object program. Because con language translation of the source program. trol sections do not have to be loaded The assembler furnishes a printed listing contiguously in storage, a sect.ioned pro of the source statements and object program gram may be loaded and executed even though statements and additional information a continuous block of storage large enough useful to the programmer in analyzing his to accommodate the entire program may not program, such as error Indications. The be available. object program is in the format required by the linkage editor component of Operating The assembler allows symbols to be Systerrv360. (See the linkage editor publi defined in one assembly and referred to in ca·tion. ) another, thus effecting a link between 4
Description: