GENERAL DESCRIPTION 1.1 ASSEMBLY PROCESSING The Assembler is a two pass system, or, if both punch and list output are requested, a three pass sysem on a minimum configuraton. A pass is defined as a processing cycle of the source program input. In the first pass, the Assembler creates a symbol table from the names used in the source statements. It also checks for certain possible error conditions and generates diagnostic messages if necessary. During pass two, the Assembler again examines each state- ment in the source program along with the symbol table and produces the binary program and a program listing. Addition diagnostic messages may also be producted. If only one output device is available and if both the binary output and list output are requested, the listing function is deferred and performed as pass three. When using the Assembler with a mass storage device the source program is written on the device during the first pass; the second pass of the source is read from the mass storage. 1.2 SYMBOLIC ADDRESSING Symbols may be used for referring to machine instructions, data, constants, and certain other pseudo operations. A sym- bol represents the address for a computer word in memory. A symbol is defined when it is used as a label for a location in the program, a name of a common storage segment, the label of a data storage area or constant, the label of an absolute or relocatable value, or a location external to the program. Through use of simple arithmetic operators, symbols may be combined with other symbols or numbers to form an expres- sion which may identify a location other than that specifically named by a symbol. Symbols appearing in operand expres- sions, but not specifically defined, and symbols that are defined more than once are considered to be in error by the Assembler. 1-1 [IMAGE] HP ASSEMBLER PROCESSING 1-2 1.3 PROGRAM RELOCATION Relocatable programs may be relocated in core by the relocating loader; the location of the program origin and all subsequent instrucitons is determined at the time the program is loaded. A relocatable program is assembled assuming a starting location of zero. All other instructions and data areas are assembled relative to this zero base. When the program is loaded, the relocatable operands are adjusted to correspond with the actual locations assigned by the loader. The starting locations of the common storage area and the base page portion of the program are always established by the loader. References to the common area are common re- locatable. Reference to the base page portion of the program are base page relocatable. If a program refers to the common area or makes use of the base page via the ORB pseudo in- struction, the program must also be relocatable. If a program is to be relocatable, all subprograms comprising the program must be relocatable; all memory reference operands must be relocatable expressions or literals, or have an absolute value of less than 100(8). 1.4 PROGRAM LOCATION COUNTERS The Assembler maintains a counter, called the program loca- tion counter, that assigns consecutive memory addresses to source statements. The initial value of the program location counter is estab- lished according to the use of either the NAM or ORG psuedo operation at the start of the program. The NAM operation causes the program location counter to be set to zero for a relocatable program; the ORG operation specifies the absolute starting location for an absolute program. Through use or the ORB pseudo operation a relocatable pro- gram may specify that certain operations or data areas be allocated to the base page. If so, a separate counter, called the base page location counter, is used in assigning these locations. 1-3 1.5 ASSEMBLY OPTIONS Parameters specified with the first statement, the control statement, define the output to be produced by the assembler: [1] Absolute - The addresses generated by the Assembler are to be interpreted as absolute locations in memory. The program is a complete entity; external symbols, common storage references, and entry points are not permitted. Relocatable - The program may be located anywhere in memory. All operands which arefer to memory locations are adjusted as the program is loaded. Operands, other than those referring to the first 64 locations, must be re- locatable expressions. Subprograms may contain external symbols and entry points, and may refer to common storage. Binary output - An absolute or relocatable program is to be punched on the paper tape. List output - A program listing is produced either during pass two or pass three. Table print - List the symbol table at the end of the first pass. Selective assembly - Sections of the program may be included or excluded at assembly time depending on the option used. ----------------- [1] See Chapter 5 for complete details. 1-4