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

USING Instruction A variable symbol that has been assigned a character string with a value that is valid for an ordinary symbol base specifies a base address, which can be a relocatable or an absolute expression. The value of the expression must lie between 0 and 2 31 −1. end specifies the end address, which can be a relocatable or an absolute expression. The value of the expression must lie between 0 and 2 31 −1. The end address may exceed the (base address + default range) without error. The end address must be greater than the base and must have the same relocatability attributes. base_register is an absolute expression whose value represents general registers 0 through 15. The default range is 4096 per base register. The essential difference between a labeled USING instruction and an ordinary USING instruction is the label placed on the USING statement. To indicate to the assembler that the USING established with the label is to provide resolution of base and displacement for a symbol, the label must be used to qualify the symbol. Qualifying a symbol consists of preceding the symbol with the label on the USING followed by a period. The only symbols resolved by the labeled USING are those symbols qualified with the label. This label cannot be used for any other purpose in the program, except possibly as a label on other USING instructions. The following examples show how labeled USINGs are used: PRIOR USING IHADCB,R1 NEXT USING IHADCB,R2 MVC PRIOR.DCBLRECL,NEXT.DCBLRECL The same code without labeled USINGs could be written like this: USING IHADCB,R1 MVC DCBLRECL,DCBLRECL-IHADCB(R2) In the following example, a new element, NEW, is inserted into a doubly-linked list between two existing elements LEFT and RIGHT, where the links are stored as pointers LPTR and RPTR: 224 HLASM V1R5 Language Reference

USING Instruction LEFT USING ELEMENT,R3 RIGHT USING ELEMENT,R6 NEW USING ELEMENT,R1 . . MVC NEW.RPTR,LEFT.RPTR Move previous Right pointer MVC NEW.LPTR,RIGHT.LPTR Move previous Left pointer ST R1,LEFT.RPTR Chain new element from Left ST R1,RIGHT.LPTR Chain new element from Right . . ELEMENT DSECT LPTR DS A Link to left element RPTR DS A Link to right element . . Range of a Labeled USING Instruction The range of a labeled USING instruction (called the labeled USING range) is the 4096 bytes beginning at the base address specified in the labeled USING instruction, or the range as specified by the range end, whichever is the lesser. Addresses that lie within the labeled USING range can be converted from their implicit form (qualified symbols) to their explicit form; those outside the USING range cannot be converted. Like the ordinary USING range, the labeled USING range is the range of addresses in a control section that is associated with the base register specified in the labeled USING instruction. If the labeled USING instruction assigns more than one base register, the composite labeled USING range is the product of the number of registers specified in the labeled USING instruction and 4096 bytes. The composite labeled USING range begins at the base address specified in the labeled USING instruction. Unlike the ordinary USING range, however, you cannot specify separate labeled USING instructions to establish the same labeled USING | range. For example, | IN USING BASE,1,11 | specifies a range of 8192 bytes beginning at BASE, but | IN USING BASE,1 | IN USING BASE+496,11 | specifies a single labeled USING range of 4096 bytes beginning at BASE+4096. You can specify the same base address in any number of labeled USING instructions. You can also specify the same base address in an ordinary USING and a labeled USING. However, unlike ordinary USING instructions that have the same base address, if you specify the same base address in an ordinary USING instruction and a labeled USING instruction, High Level Assembler does not treat the USING ranges as coinciding. When you specify an unqualified symbol in an assembler instruction, the base register specified in the ordinary USING is used by the assembler to resolve the address into base-displacement form. An example of coexistent ordinary USINGs and labeled USINGs is given below: USING IHADCB,R1 SAMPLE USING IHADCB,R2 MVC DCBLRECL,SAMPLE.DCBLRECL Chapter 5. Assembler Instruction Statements 225

USING Instruction<br />

LEFT USING ELEMENT,R3<br />

RIGHT USING ELEMENT,R6<br />

NEW USING ELEMENT,R1<br />

.<br />

.<br />

MVC NEW.RPTR,LEFT.RPTR Move previous Right pointer<br />

MVC NEW.LPTR,RIGHT.LPTR Move previous Left pointer<br />

ST R1,LEFT.RPTR Chain new element from Left<br />

ST R1,RIGHT.LPTR Chain new element from Right<br />

.<br />

.<br />

ELEMENT DSECT<br />

LPTR DS A Link to left element<br />

RPTR DS A Link to right element<br />

.<br />

.<br />

Range of a Labeled USING Instruction<br />

The range of a labeled USING instruction (called the labeled USING range) is the<br />

4096 bytes beginning at the base address specified in the labeled USING<br />

instruction, or the range as specified by the range end, whichever is the lesser.<br />

Addresses that lie within the labeled USING range can be converted from their<br />

implicit form (qualified symbols) to their explicit form; those outside the USING<br />

range cannot be converted.<br />

Like the ordinary USING range, the labeled USING range is the range of addresses<br />

in a control section that is associated with the base register specified in the labeled<br />

USING instruction. If the labeled USING instruction assigns more than one base<br />

register, the composite labeled USING range is the product of the number of<br />

registers specified in the labeled USING instruction and 4096 bytes. The<br />

composite labeled USING range begins at the base address specified in the<br />

labeled USING instruction. Unlike the ordinary USING range, however, you cannot<br />

specify separate labeled USING instructions to establish the same labeled USING<br />

| range. For example,<br />

| IN USING BASE,1,11<br />

| specifies a range of 8192 bytes beginning at BASE, but<br />

| IN USING BASE,1<br />

| IN USING BASE+496,11<br />

| specifies a single labeled USING range of 4096 bytes beginning at BASE+4096.<br />

You can specify the same base address in any number of labeled USING<br />

instructions. You can also specify the same base address in an ordinary USING<br />

and a labeled USING. However, unlike ordinary USING instructions that have the<br />

same base address, if you specify the same base address in an ordinary USING<br />

instruction and a labeled USING instruction, High Level Assembler does not treat<br />

the USING ranges as coinciding. When you specify an unqualified symbol in an<br />

assembler instruction, the base register specified in the ordinary USING is used by<br />

the assembler to resolve the address into base-displacement form. An example of<br />

coexistent ordinary USINGs and labeled USINGs is given below:<br />

USING IHADCB,R1<br />

SAMPLE USING IHADCB,R2<br />

MVC DCBLRECL,SAMPLE.DCBLRECL<br />

Chapter 5. Assembler Instruction Statements 225

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

Saved successfully!

Ooh no, something went wrong!