• Aucun résultat trouvé

How to Use the DS Instruction

Dans le document Assembler H Version 2 Application Programming: (Page 138-143)

TO RESERVE STORAGE: If you want to take advantage of automatic boundary alignment Cif the ALIGN option is specified) and implicit length calculation, you should not supply a length modifier in your operand specifications. You should specify a type subfield that corresponds to the type of area you need for your instructions.

Note:

Duplication has no effect on implicit length.

Using a length modifier can give you the advantage of explicitly specifying the length attribute value assigned to the label naming the'area reserved. However, your areas will not be aligned automatically according to their type. If you omit the nominal value in the operand, you should use a length modifier for the binary (B), character (C), hexadecimal (X), and decimal

(P and Z) type areas; otherwise, their labels will be given a length attribute value of 1.

When you need to reserve large areas, you can use a duplication factor. However, in this case, you can only refer to the first area by label. You can also use the character (C) and

hexadecimal (X) field types to specify large areas using the length modifier.

Although the nominal value is optional for a DS instruction, you can put it to good use by letting the assembler compute the length for areas of the B, C, X, and decimal (P or Z) type

areas. You achieve this by specifying the general format of the nominal value that will be placed in the area at execution time.

TO

FORCE ALIGNMENT:

You can use the DS instruction to force alignment to a boundary that otherwise would not be provided.

You can force the location counter to a doubleword, fullword, or halfword boundary by using the appropriate field type (for

example, D, F, or H) with a duplication factor of zero. No space is reserved for such an instruction, yet the data that follows is aligned on the desired boundary. For example, the following statements would set the location counter to the next doubleword boundary and reserve storage space for a 128-byte field (whose leftmost byte would be on a doubleword boundary).

Name Operation Operand

DS OD

AREA DS CL128

Note:

Alignment is forced when either the ALIGN or the NOALIGN assembler option is set.

TO NA~E

FIELDS OF AN

AREA: Using a duplication factor of zero in a DS instruction also allows you to provide a label for an area of storage without actually reserving the area. You can use DS or DC instructions to reserve storage for, and assign labels to, fields within the area. These fields can then be addressed symbolically. (Another way of accomplishing this is described in "DSECT--Identify Dummy Section" on page 58.) The whole area is addressable by its label. In addition, the symbolic label will have the length attribute value of the whole area. Within the area, each field is oddressable by its label.

124 Assembler H Version 2 Application Programming: Language Reference

/~-.~~\

~.

,;J

o

o

o

For example, assume that SO-character records are to be read into an area for processing and that each record has the following format:

positions

5-10 Payroll Number

Pos;i tions

11-30 Employee Hame

positions

31-36 Date

positions

47-54 Gross Wages

positions

55-62 Withholding Tax

The following example illustrates how DS instructions might be used to assign a name to the record area, then define the'fields of the area and allocate storage for them. Hote that the first statement names the entire area by defining the symbol RDAREA;

this statement gives RDAREA a length attribute of SO bytes, but does not reserve any storage. Similarly, the fifth statement names a 6-byte area by defining the symbol DATE; the three subsequent statements actuallY define the fields of DATE and allocate storage for them. The second, ninth, and last

statements are used for spacing purposes and, therefore, are not named.

Name operation Operand

RDAREA DS OClSO

DS CL4

PAYNO DS Cl6

NAME DS Cl20

DATE DS OCl6

DAY DS CL2

MONTH DS Cl2

YEAR DS CL2

DS CL10

GROSS DS CL8

FEDTAX DS Cl8

DS CL18

Additional examples of DS statements are shown below:

Name Operation Operand

ONE DS CLSO (One SO-byte field,

length attribute of SO)

TWO DS 80C (SO 1-byte fields,

length attribute of 1)

THREE DS 6F (6 fullwords, length

attribute of 4)

FOUR DS D (1 doubleword, length

attribute of 8)

FIVE DS 4H (4 halfwords,

length attribute of 2) To define four lO-byte fields and one 100-byte field, the respective DS statements might be as follows:

Name operation Operand

FIELD DS 4CllO

AREA DS CLIOO

Although FIELD might have been specified as one 40-byte field, the preceding definition has the advantage of providing FIELD with a length attribute of 10. This would be pert;nent when using FIELD as an SS machine instruction operand.

Chapter 5. Assembler Instruction Statements 125

CCW OR CCWO--DEFINE CHANNEL COMMAND WORD (FORMAT 0)

You can use the CCW or CCWO instruction to define and generat~

an 8-byte channel command word aligned at a doubleword boundary for input/output operations. The CCW and CCWO instructions have identical functions; however, the CCWO instruction is not

included in the 5/370 instruction set. A CCW or CCWO will cause any bytes skipped to be zeroed. A CCW or CCWO instruction will result in a Format 0 channel command word which allows 24-bit data addresses. The internal machine format of a channel command word is shown in Figure 33.

Byte Bits Usage

0 0-7 Command code

1-3 8-31 Address of data to operate upon

4 32-37 Flags

38-39 Must be specified as zeros 5 40-47 Set to zeros by assembler 6-7 48-63 Byte count or length of data Figure 33. Channel Command Word, Format 0

The format of the CCW or CCWO instruction statement is:

Name Operation ope."and

Any symbol CCW or CCWO Command code, data

or blank address, flags, data

count

All four operands must appear. They are written, from left to right, as follows:

1. An absolute expression that specifies the command code.

This expression's value is right-justified in byte

o.

2. A relocatable or absolute expression specifying the address of the data to operate upon. This value is treated as a 3-byte, A-type address constant. The value of this expression is right-justified in bytes 1 through 3.

3. An absolute expression that specifies the flags for bits 32 through 37, and zeros for bits 38 and 39. The value of this expression is right-justified in byte 4. (Byte 5 is set to zero by the assembler.)

4. An absolute expression that specifies the byte count or length of data. The value of this expression is

right-justified in bytes 6 and 7.

The generated channel command word is aligned on a doubleword boundary. Any bytes skipped are set to zero.

The symbol in the name field, if present, is ass.igned the value of the address of the leftmost byte of the channel command word generated. The length attribute value of the symbol is 8.

The following are examples of CCW and CCWO statements:

Name operation Operand

WRITEI CCW l,DATADR,X'48',X'50'

WRITE2 CCWO 1,DATADR,X'48',X'50'

126 Assembler H Version 2 Application Programming: language Reference

C-.\

.. ~

.,

o

o

The object code generated (in hexadecimal) for either of the above examples is:

01 xxxxxx 48 00 0050

where xxx xxx contains the address of DATADR, and DATADR must reside below 16 megabytes.

Notes:

1. If you use the EXCP access method, you must use CCW or CCWO, because EXCP does not support 31-bit data addresses in channel command words.

2. You should use RMODE 24 with CCW or CCWO to ensure that valid data addresses are generated in the channel command words at execution time.

CCW1--DEFINE CHANNEL COMMAND I~ORD (FORHAT 1)

You can use the CCWI instruction to specify the object code format to be used for an 8-byte channel command word aligned at a doubleword boundary for input/output operations. The object code for a Format 1 channel command word allows a 31-bit data address, whereas the object code generated by a CCW or CCWO

instruction allows only a 24-bit data address. A CCWl will cause any bytes skipped to be zeroed. The internal machine format of a channel command word is shown in Figure 34 .

Byte Bits

Usage

0 0-7 Command code

1 8-15 Flags

2-3 16-31 Count

4 32 Must be zero

4-7 33-63 Data address

Figure 34. Channel Command Word, Format 1

The format of the CCWI instruction statement is:

Name operation Operand

Any symbol CCWl Command code, data

or blank address, flags, data

count

All four operands must appear. They are written, from left to right, as follows:

1. An absolute expression that specifies the command code.

This expression's value is right-justified in byte O.

2. An expression specifying the data address. This value is treated as a 4-bytet A-type address constant. The value of this expression is in bytes 4 through 7, the first bit of which is set to O.

3. An absolute expression that specifies the flags for bits 8 through 15. The value of this expression is right-justified in byte 1.

4. An absolute expression that specifies the count. The value of this expression is right-justified in bytes 2 and 3.

Note:

The expression for the data address should be such that the address is within the range 0 to 231_1, inclusive, after

Chapter 5. Assembler Instruction Statements 127

possible relocation. This will be the case if the expression refers to a location within one of the control sections which will be link-edited together. An expression such as

*-1000000000 will yield an acceptable value only when the

command control word is placed in storage location 1000000000 or higher.

The generated channel command word is aligned on a doubleword boundary. Any bytes skipped are set to zero.

The symbol in the name field, if present, is assigned the value of the address of the leftmost byte of the channel command word generated. The length attribute value of the symbol is 8.

The following is an example of a CCW1 statement:

Name Operation operand

A CCW1 X'OC',BUF1,X'00',l'BUF1

The object code (in hexadecimal) generated in the above example is:

ac

00 yy xxxxxxxx

where yy is length of SUF1, and xxxxxxxx is BUF1 address.

Note:

BUFI can reside anywhere in virtual storage.

PROGRAM CONTROL INSTRUCTIONS

You use the program control instructions to:

Specify the end of an assembly .

Set the location counter to a value or word boundary .

• Insert previously written coding in the program.

• Specify the placement of literals in storage.

• Check the sequence of input cards.

• Indicate statement format.

• Punch a card.

Except for the CHOP and COPY instructions, none of these

assembler instructions generate instructions or constants in the object program.

ICTL-INPUT FORMAT CONTROL

The ICTl instruction allows you to change the begin, end, and continue columns that establish the coding format of the assembler language source statements.

For example, with the ICTl instruction, you can increase the number of columns to be used for the identification or sequence checking of your source statements. By changing the begin column, you can even create a field before the begin column to contain identification or sequence numbers.

You can use the IeTl instruction only once, at the very beginning of a source program. If you do not use it, the

assembler recognizes the standard values for the begin, end, and continue columns.

The format of the ICTl instruction statement is as follows:

128 Assembler H Version 2 Application Programming: language Reference

o

o

o

0',"·:

~

Name Operation Operand

Blank ICTl 1-3 decimal

self-defining terms of the form b or b,e or b,e,c The operand entry must be one to three decimal self-defining terms. There are only three possible ways of specifying the operand entry:

1. The operand b specifies the begin column of the source statement. It must always be specified, and must be within the range of 1 through 40, inclusive.

2. The operand e specifies the end column of the source

statement. The end column, when specified, must be within the range of 41 through 80; inclusive; when not specified,

it is assumed to be 71.

3. The operand c specifies the continue column of the source statement. The continue column, when specified, must be within the range of 2 through 40. If the continue column is not specified, or if column 80 is specified as the end

column, the assembler assumes that continuation lines are not allowed.

If no ICTl statement is used in the source program, the assembler assumes that 1, 71, and 16 are the begin, end, and continue columns, respectively.

The values specified for the three operands depend on each other. Two rules governing the interaction of b, e, and care:

1. The position of the end column must not be less than the position of the begin column +5, but must be greater than the position of the continue column.

2. The position of the continue column must be greater than that of the begin column.

The next example designates the begin column as 25. Since the end column is net specified, it is assumed to be column 71. Ho continuation cards are recognized because the continue column is not specified.

Dans le document Assembler H Version 2 Application Programming: (Page 138-143)