• Aucun résultat trouvé

constant Single Multiple Type Nominal Value Nominal Value

Dans le document Assembler H Version 2 Application Programming: (Page 114-121)

C 'value' not allowed

X B H

F

P 'value' 'value,value, .•. value'

Z E

D l A Y

5 (value) (value,value, •.• value)

Q

V

As the above list shows, a data constant value (any type except A, Y, 5, Q, and V) is enclosed by apostrophes. An address constant value (type A, Y, 5, Q, or V) is enclosed by

parentheses. To specify two or more values in the subfield, the values must be separated by commas, and the entire sequence of values must be enclosed by the appropriate delimiters; that is, apostrophes or parentheses. Multiple values are not permitted for character constants.

How nominal values are specified and interpreted by the assembler is explained in each of the following subsections, starting with "Binary Constant--B" below.

LITERAL CONSTANTS: literal constants allow you to define and refer to data directly in machine instruction operands. You do not need to define a constant separately in another part of your source module. The difference between a literal, a data

constant, and a self-defining term is described in "literals" on page 32.

A literal constant is specified in the same way as the operand of a DC instruction. The general rules for the operand

subfields of a DC instruction also apply to the subfield of a literal constant. Moreover, the rules that apply to the individual types of constants apply to literal constants as well.

However, literal constants differ from DC operands in the following ways:

• literals must be preceded by an equal sign.

• Multiple operands are not allowed.

• The duplication factor must not be zero.

100 Assembler H Version 2 Application Programming: language Reference

o

o

o

o

The following text describes each of the constant types and provides examples. The constant types are:

Binary Character Hexadecimal Fixed-Point Decimal

Packed Decimal Zoned Decimal Address

Floating-Point

BINARY COt~STANT-B: The bi nary constant allows you to speci fy the precise bit pattern you want assembled into storage. Each binary.constant is assembled into the integral number of bytes (see (1) in Figure 22 on page 102) required to contain the bits specified.

The following example shows the coding used to designate a binary constant. BCOH would have a length attribute of 1.

Name Operation Operand

BCON DC B'11011101'

BTRUNC DC Bll'100100011'

BPAD DC Bll'lOl'

BTRUHC would assemble with the leftmost bit truncated, as follows:

00100011

BPAD would assemble with five zeros as padding, as follows:

00000101

Chapter 5. Assembler Instruction statements 101

Binary Constants

Subfield 3. Constant Type

Binary (B)

1. Duplication Factor Yes allowed

2. Modifiers As needed

I mpl icit Length: (Length

B DC B'IOIOllll ' LIB

=

~:e

Modifier not present)

C

DC B'IOl ' L'C

=

Alignment:

(Length Modifier not present) Byte

Range for Length: 1 through 256 (byte length) .1 through .2048 (bit length)

Range for Scale: Not allowed Range for Exponent: Not allowed

4. Nominal Value Binary digits (0 or 1) Represented by:

Enclosed by: Apostrophes

Exponent allowed: No

Number of Values per Multiple Operand:

With zeros Padding:

at left Truncation of

Assembled Value: At left

Figure 22. Binary Constants

102 Assembler H Version 2 Application Programming: Language Reference

o

o

o

CHARACTER CONSTANT--C: The character constant allows you to specify character strings, such as error messages, identifiers, or other text, that the assembler will convert into their binary (EBCDIC) representation.

Any of the valid 256 punch combinations can be designated in a character constant. Each character specified in the nominal value subfield is assembled into one byte (see (1) in Figure 23 on page 104).

Multiple nominal values are not allowed, because if a comma is specified in the nominal value subfield, the assembler considers the comma a valid character (see (2) in Figure 23) and,

therefore, assembles it into its binary (EBCDIC) representation.

For example DC C'A,B'

is assembled as A,B with object code C16BC2.

Special consideration must be given to representing apostrophes and ampersands as characters. Each single apostrophe or

ampersand desired as a character in the constant must be represented by a pair of apostrophes or ampersands. They are assembled as single apostrophes and ampersands (see (3) in

Figure 23).

In the following example, the length attribute of FIELD is 12:

Name operation Operand

FIELD DC C'TOTAL IS 110'

However, in this next example, the length attribute is 15, and three blanks appear in storage to the right of the zero:

Name Operation Operand

FIELD DC CL15'TOTAL IS 110'

In the next example, the length attribute of FIELD is 12, although 13 characters appear in the operand. The two ampersands count as only one byte.

Name Operation Operand

FIELD DC C'TOTAL IS &&10'

Note that, in the next example, a length of 4 has been specified, but there are five characters in the constant.

Name Operation Operand

FIELD DC 3CL4'ABCDE'

The generated constant would be:

ABCDABCDABCD

On the other hand, if the length had been specified as 6 instead of 4, the generated constant would have been:

ABCDE ABCDE ABCDE

Chapter 5. Assembler Instruction Statements 103

Character Constants Subfield 3. Constant Tyee

Character (C)

1. Duplication Factor Yes allowed

2. Modifiers As needed

Implicit Length: (Length

C DC C'LENGTH' L'C = 6

Modifier not present)

Alignment: Byte

(Length Modifier not present)

1 through 256 (byte length) Range for length: .1 through .2048 (bit length)

Range for Scale: Not allowed

Range for Exponent: Not allowed

4. Nominal Value DC CiA' 'B' Object Code (hex).

Represented by: Characters (All 256

A ' B "

I

c l l7Dlc21

8-bit combinations) Assembled A&B . ,

IClisolc21 DC C'A&&B'

Enclosed by: Apostrophes

Exponent allowed: No

Number of values per One DC C'A,B'

I

CIJ6BI c21

Operand: Assembled A,B

With blanks at right

Padding: (X'40')

Truncation of

Assembled value: At right

Figure 23. Character Constants

104 Assembler H Version 2 Application Programming: Language Reference

o

o

o

Hote that the. same constant could be specified as a literal.

Name operation operand

MVC AREA(12),=3CL4'ABCDE'

HEXADECIMAL COHSTANT--X: You can use hexadecimal constants to generate large bit patterns more conveniently than with binary constants. Also, the hexadecimal values you specify in a source module allow you to compare them directly with the hexadecimal values generated for the object code and address locations printed in the program listing.

Each hexadecimal digit (see (1) in Figure 24 on page 106) specified in the nominal value subfield is assembled into four bits (their binary patterns can be found in "Self-Defining Terms" on page 25). See (2) in Figure 24. The implicit length in bytes of a hexadecimal constant is then half the number of hexadecimal digits specified (assuming that a hexadecimal zero is added to an odd number of digits). See (3) in Figure 24.

An 8-digit hexadecimal constant provides a convenient way to set the bit pattern of a full binary word. The constant in the following example would set the first and third bytes of a word to Is:

Name Operation Operand

OS OF

TEST DC X'FFOOFFOO'

The OS instruction sets the location counter to a fullword boundary. (See "OS-Define storage" on page 123.)

The next example uses a hexadecimal constant as a literal and inserts Is into bits 24 through 31 of register 5.

I

~_N_a_m_e ____________ ~I __ ~_:_e_r_a_t_i_o_n ______ ~_:_p_.~ __ :_a_.:_: __ , _____________ ~

In the following example, the digit A is dropped, because 5 hexadecimal digits are specified for a length of 2 bytes:

Name

operation Operand

ALPHACOH DC 3XL2'A6F4E'

The resulting constant is 6F4E, which occupies the specified 2 bytes. It is duplicated three times, as requested by the duplication factor. If it had merely been specified as

3X'A6F4E', the resulting constant would have a hexadecimal zero in the leftmost position.

OA6F4EOA6F4EOA6F4E

Chapter 5. Assembler Instruction Statements 105

Hexadecimal Constants

()

Subfield 3. Constant Type Hexadecimal (X) 1.Duplication Factor

allowed Yes

2.Modifiers As needed

Implicit Length: (Length X DC X'FFOOA2' L'X =:

~::e

Modifier not present) Y DC X'FOOA2' L'Y

=

Alignment:

(Length Modifier not present) Byte

Range for Length: 1 through 256 (byte length) .1 through .2048 (bit length)

Range for Scale: Not allowed Range for Exponent: Not allowed

~

4. Nominal Value Hexadecimal digits (0 . (hex)

through 9 and A through 000111111

Represented by: DC X'lF'

F)

DC X'91F' 10000 1001 000111111

(

.. ~ j /

<i 4-1 byte __

}\

"':

Enclosed by: Apostrophes

Exponent allowed: No

Number of Values

per Operand: Multiple

Padding: With zeros at left

Truncation of

Assembled value: At left

Figure 24. Hexadecimal Constants

106 Assembler H Version 2 Application Programming: Language Reference

o

o

o

FIXED-POINT CONSTANT--F AND

H:

Fixed-point constants allow you to introduce data that is in a form suitable for the operations of the fixed-point machine instructions of the universal

instruction set. The constants you define can also be automatically aligned to the proper fullword or halfword

boundary for the instructions that refer to addresses on these boundaries (unless the HOALIGH option has been specified; see

"Information about Constantsft on page 92). You can perform algebraic functions using this type of constant because they can have positive or negative values.

A fixed-point constant is written as a decimal number, which can be followed by a decimal exponent if desired. The format of the constant is as follows:

1. The nominal value can be a signed (see (1) in Figure 25 on page 108)--plus is assumed if the number is

unsigned--integer, fraction, or mixed number (see (2) Figure 25) followed by an exponent (see (3) in Figure 25):

positive or negative.

2. The exponent must lie within the permissible range (see (4) in Figure 25). If an exponent modifier is also specified, the algebraic sum (see (5) in Figure 25) of the exponent and the exponent modifier must lie within the permissible range.

Some examples of the range of values that can be assembled into fixed-point constants are given below:

Range of Values that

Dans le document Assembler H Version 2 Application Programming: (Page 114-121)