HLASM Language Reference

HLASM Language Reference HLASM Language Reference

faculty.cs.niu.edu
from faculty.cs.niu.edu More from this publisher
22.02.2015 Views

Terms, Literals, and Expressions The following example shows how to use the length attribute to move a character constant into either the high-order or low-order end of a storage field. A1 DS CL8 B2 DC CL2'AB' HIORD MVC A1(L'B2),B2 LOORD MVC A1+L'A1-L'B2(L'B2),B2 A1 names a storage field 8 bytes in length and is assigned a length attribute of 8. B2 names a character constant 2 bytes in length and is assigned a length attribute of 2. The statement named HIORD moves the contents of B2 into the first 2 bytes of A1. The term L'B2 in parentheses provides the length specification required by the instruction. The statement named LOORD moves the contents of B2 into the rightmost 2 bytes of A1. The combination of terms A1+L'A1-L'B2 adds the length of A1 to the beginning address of A1, and subtracts the length of B2 from this value. The result is the address of the seventh byte in field A1. The constant represented by B2 is moved into A1 starting at this address. L'B2 in parentheses provides the length specification in both instructions. For ease in following the preceding example, the length attributes of A1 and B2 are specified explicitly in the DS and DC statements that define them. However, keep in mind that the L'symbol term makes coding such as this possible in situations where lengths are unknown. For example: C3 DC C'This is too long a string to be worth counting' STRING MVC BUF(L'C3),C3 Other Attribute References Other attributes describe the characteristics and structure of the data you define in a program; for example, the kind of constant you specify or the number of characters you need to represent a value. These other attributes are: Count (K') Defined (D') Integer (I') Number (N') Operation code (O') Scale (S') | Type (T'); allowed only in conditional assembly. You can refer to the count (K'), defined (D'), number (N'), and operation code (O') attributes only in conditional assembly instructions and expressions. For full details, see “Data Attributes” on page 324. Literals You can use literals as operands in order to introduce data into your program. The literal is a special type of relocatable term. It behaves like a symbol in that it represents data. However, it is a special kind of term because it also is used to define the constant specified by the literal. This is convenient because: The data you enter as numbers for computation, addresses, or messages to be printed is visible in the instruction in which the literal appears. You avoid the added effort of defining constants elsewhere in your source module and then using their symbolic names in machine instruction operands. 40 HLASM V1R5 Language Reference

Terms, Literals, and Expressions The assembler assembles the data item specified in a literal into a literal pool (See “Literal Pool” on page 44). It then assembles the address of this literal data item in the pool into the object code of the instruction that contains the literal specification. Thus, the assembler saves you a programming step by storing your literal data for you. The assembler also organizes literal pools efficiently, so that the literal data is aligned on the correct boundary alignment and occupies a minimum amount of space. Literals, Constants, and Self-Defining Terms Literals, constants, and self-defining terms differ in three important ways: Where you can specify them in machine instructions, that is, whether they represent data or an address of data Whether they have relocatable or absolute values What is assembled into the object code of the machine instruction in which they appear Figure 15 on page 42 shows examples of the differences between literals, constants, and self-defining terms. Chapter 2. Coding and Structure 41

Terms, Literals, and Expressions<br />

The assembler assembles the data item specified in a literal into a literal pool (See<br />

“Literal Pool” on page 44). It then assembles the address of this literal data item in<br />

the pool into the object code of the instruction that contains the literal specification.<br />

Thus, the assembler saves you a programming step by storing your literal data for<br />

you. The assembler also organizes literal pools efficiently, so that the literal data is<br />

aligned on the correct boundary alignment and occupies a minimum amount of<br />

space.<br />

Literals, Constants, and Self-Defining Terms<br />

Literals, constants, and self-defining terms differ in three important ways:<br />

Where you can specify them in machine instructions, that is, whether they<br />

represent data or an address of data<br />

Whether they have relocatable or absolute values<br />

What is assembled into the object code of the machine instruction in which they<br />

appear<br />

Figure 15 on page 42 shows examples of the differences between literals,<br />

constants, and self-defining terms.<br />

Chapter 2. Coding and Structure 41

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!