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

ORG Instruction If you specify multiple location counters with the LOCTR instruction, the ORG instruction can alter only the location counter in use when the instruction appears. Thus, you cannot control the structure of the whole control section using ORG, but only the part that is controlled by the current location counter. An ORG statement cannot be used to change sections or LOCTR segments. For example: AA CSECT X DS D Y DS F BB CSECT ORG Y is invalid, because the section containing the ORG statement (BB) is not the same as the section in AA in which the ORG operand expression Y is defined. With the ORG statement, you can give two instructions the same location counter values. In such a case, the second instruction does not always eliminate the effects of the first instruction. Consider the following example: ADDR DC A(ADDR) ORG –4 B DC C'BETA' In this example, the value of B ('BETA') is destroyed by the relocation of ADDR during linkage editing. | The following example shows some examples of ORG using the boundary and | offset operands: | origin csect | ds 235x Define 235 bytes | org origin,,3 Move location counter back to start + 3 | org ,8 Align on 8 byte boundary | org ,8,-2 Align to 8 byte boundary -2 bytes | translate dc cl256' ' Define aligned translate table | org translate+c'a' | dc c'ABCDEFGHI' | org translate+c'j' | dc c'JKLMNOPQR' | org translate+c's' | dc c'STUVWXYZ' | org translate+c'A' | dc c'ABCDEFGHI' | org translate+c'J' | dc c'JKLMNOPQR' | org translate+c'S' | dc c'STUVWXYZ' | org , | end Using Figure 57 on page 203 as an example, to build a translate table (for example, to convert EBCDIC character code into some other internal code): 1. Define the table (see ▌1▐ in Figure 57) as being filled with zeros. 2. Use the ORG instruction to alter the location counter so that its counter value indicates a specific location (see ▌2▐ in Figure 57) within the table. 202 HLASM V1R5 Language Reference

ORG Instruction 3. Redefine the data (see ▌3▐ in Figure 57) to be assembled into that location. 4. After repeating the first three steps (see ▌4▐ in Figure 57) until your translate table is complete, use an ORG instruction with a null operand field to alter the location counter. The counter value then indicates the next available location (see ▌5▐ in Figure 57) in the current control section (after the end of the translate table). Both the assembled object code for the whole table filled with zeros, and the object code for the portions of the table you redefined, are printed in the program listings. However, the data defined later is loaded over the previously defined zeros and becomes part of your object program, instead of the zeros. That is, the ORG instruction can cause the location counter to be set to any part of a control section, even the middle of an instruction, into which you can assemble data. It can also cause the location counter to be set to the next available location so that your program can be assembled sequentially. Source Module │ Object Code ─────────────────────────────────────────────────────┼──────────────────────── │ FIRST START │ . │ . │ ▌1▐ TABLE DC XL256'' │ TABLE (in Hex) ▌2▐ ORG TABLE+ │ + ┌────┐ ┌ DC C'' ▌3▐ │ │ F │ │ DC C'1' │ │ F1 │ │ . │ │ . │ │ . │ │ . │ │ ORG TABLE+13 │ +13 │ . │ │ DC C'D' │ │ C4 │ │ DC C'E' │ │ C5 │ │ . │ │ . │ │ . │ │ . │ ▌4▐ ─┤ ORG TABLE+C'D' │ │ . │ │ DC AL1(13) │ +196 │ 13 │ │ DC AL1(14) │ │ 14 │ │ . │ │ . │ │ . │ │ . │ │ ORG TABLE+C'' │ +24 │ . │ │ DC AL1() │ │ │ │ DC AL1(1) │ │ 1 │ │ . │ │ │ └ . │ +255 └────┘ ORG │ ▌5▐ GOON DS H │ ▲ . │ TABLE+256 . │ TR INPUT,TABLE │ . │ . │ INPUT DS CL2 │ . │ Figure 57. Building a Translate Table . │ END │ Chapter 5. Assembler Instruction Statements 203

ORG Instruction<br />

If you specify multiple location counters with the LOCTR instruction, the ORG<br />

instruction can alter only the location counter in use when the instruction appears.<br />

Thus, you cannot control the structure of the whole control section using ORG, but<br />

only the part that is controlled by the current location counter.<br />

An ORG statement cannot be used to change sections or LOCTR segments. For<br />

example:<br />

AA<br />

CSECT<br />

X DS D<br />

Y DS F<br />

BB<br />

CSECT<br />

ORG Y<br />

is invalid, because the section containing the ORG statement (BB) is not the same<br />

as the section in AA in which the ORG operand expression Y is defined.<br />

With the ORG statement, you can give two instructions the same location counter<br />

values. In such a case, the second instruction does not always eliminate the<br />

effects of the first instruction. Consider the following example:<br />

ADDR DC A(ADDR)<br />

ORG –4<br />

B DC C'BETA'<br />

In this example, the value of B ('BETA') is destroyed by the relocation of ADDR<br />

during linkage editing.<br />

| The following example shows some examples of ORG using the boundary and<br />

| offset operands:<br />

| origin csect<br />

| ds 235x Define 235 bytes<br />

| org origin,,3 Move location counter back to start + 3<br />

| org ,8 Align on 8 byte boundary<br />

| org ,8,-2 Align to 8 byte boundary -2 bytes<br />

| translate dc cl256' ' Define aligned translate table<br />

| org translate+c'a'<br />

| dc c'ABCDEFGHI'<br />

| org translate+c'j'<br />

| dc c'JKLMNOPQR'<br />

| org translate+c's'<br />

| dc c'STUVWXYZ'<br />

| org translate+c'A'<br />

| dc c'ABCDEFGHI'<br />

| org translate+c'J'<br />

| dc c'JKLMNOPQR'<br />

| org translate+c'S'<br />

| dc c'STUVWXYZ'<br />

| org ,<br />

| end<br />

Using Figure 57 on page 203 as an example, to build a translate table (for<br />

example, to convert EBCDIC character code into some other internal code):<br />

1. Define the table (see ▌1▐ in Figure 57) as being filled with zeros.<br />

2. Use the ORG instruction to alter the location counter so that its counter value<br />

indicates a specific location (see ▌2▐ in Figure 57) within the table.<br />

202 <strong>HLASM</strong> V1R5 <strong>Language</strong> <strong>Reference</strong>

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

Saved successfully!

Ooh no, something went wrong!