Hexadecimal constant—X

Hexadecimal constants generate large bit patterns more conveniently than binary constants. Also, the hexadecimal values you specify in a source module let you 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 Table 1) specified in the nominal value subfield is assembled into four bits (their binary patterns can be found in Self-defining terms). The implicit length in bytes of a hexadecimal constant is then half the number of hexadecimal digits specified (assuming that a high-order hexadecimal zero is added to an odd number of digits). See  2  and  3  in Table 1.

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 sets the first and third bytes of a word with all 1 bits.
TEST DC 0F,X'FF00FF00'
TEST DC A(X'FF00FF00') 

The DS instruction sets the location counter to a fullword boundary. (See DS instruction.)

The next example uses a hexadecimal constant as a literal and inserts a byte of all 1 bits into the rightmost 8 bits of register 5.
         IC              5,=X'FF'
In the following example, the digit A is dropped, because 5 hexadecimal digits are specified for a length of 2 bytes:
ALPHACON DC              3XL2'A6F4E'         Generates 6F4E 3 times
The resulting constant is 6F4E, which occupies the specified 2 bytes. It is duplicated three times, as requested by the duplication factor. If it is specified as:
ALPHACON DC              3X'A6F4E'           Generates 0A6F4E 3 times
the resulting constant has a hexadecimal zero in the leftmost position.
0A6F4E0A6F4E0A6F4E
Table 1. Hexadecimal constants
Subfield Value Example Result
1. Duplication factor Allowed    
2. Type X    
3. Type Extension Not allowed
4. Program type Allowed    
5. Modifiers      

   Length:

1 to 256
(byte length)
 
.1 to .2048
(bit length)

   

      Implicit length:
      (Length modifier
      not present)

As needed

X  DC  X'FF00A2'
Y  DC  X'F00A2'

L'X = 3  2 
L'Y = 3  2 

      Alignment:

Byte    

   Scale:

Not allowed    

   Exponent:

Not allowed    
6. Nominal value      

   Represented by:

 
Hexadecimal
digits
(0 to 9 and
A to F)

 
DC  X'1F'
DC  X'91F'

Object code
X'1F'  1 
X'091F'  3 

   Enclosed by:

Apostrophes    

   Exponent allowed:

No    

      Number of values
      per operand:

 
Multiple

   

   Padding:

With zeros at left    

      Truncation of
      assembled value:

 
At left