• Aucun résultat trouvé

G3 - Defining Data

Dans le document Assembler Language (Page 173-188)

This section descrites the [C, [5, and CCW instructicns;

these instructions are used to define constants, reserve storage and specify the contents of channel corrrrand wcrds respectively. You can also frcvide a latel for these instructions and then refer to the data syrrJ:clically in the oferands of rrachine and asserrbler instructions. 1his data is generated and storage is reserved at asserrtly tirre, and used by the machine instructions at execution tirre.

Section G: Symbol and Data Definition 161

G3A -- THE CC INSTRUCTION

Purpose

You specify the DC instruction to define the data constants you need for program execution. The CC instruction causes the assembler to generate the binary representation of the data constant you specify, into a particular location in the assembled source module; this is done at assembly time.

TYPES OF CONSTANTS: The

rc

instruction can generate the following types of constants:

4Dt

Binary constants -- to define bit patterns

• Character constants -- to define character strings or messages

• Hexadecimal constants -- to define large bit patterns

• Fixed-Point constants -- for use by the fixed-point and other instructions of the standard set

• Decimal constants -- for use by the decimal instructions

• Floating-Foint constants -- for

use by the floating-~oint instruction set

• Address constants -- to define addresses mainly for the use of the fixed-point and ether instructions in the standard instruction set.

0

FLAG

CHAR

{FCON PATTERN

• {peON

AREA

0

{ ECON

• {ADCON

DC B'OOO10000'

DC C'STRING OF CHARACTERS' DC X'FFOOFFOO'

L 3,FCON DC F'IOO' AP AREA,PCON DC P'IOO' DS P LE 2,ECON DC E'IOO.50' L 5,ADCON DC A (SOMWHERE)

G3B -- GENERAL SFECIFICATIONS FOR CONSTANT S

~he general format of the tC instructions staterrents is shc~n

in the figure to the right. staterrent censists ef feur subfields.

~he fermat of a

rc

instruction operand is given in the figure te the right.

The first three subfields describe the constant, and the fourth sutfield

Rules for the DC Operand

o

1. The type subfield and the nominal

~ value must always be s~ecified.

2. The duplication factor and modifier subfields are optional •

• 3. When multiple operands are

NOTE: Separate constants axe

generated for each separate operand and nominal value specified.

6. No blanks are allowed:

D

Logical Equivalent

DC AL3(ONE)

Information about Constants SYMBOI.IC ADrRESSES OF CONSTANTS:

-Constants defined by the DC

instruction are assembled into an object module at the location where the instruction is specified.

Bowever, the type of ccnstant being defined will determine whether the constant is to be aligned on NAMTNG CONSTANTS: The length

attribute value assigned to the

4ItThe explicitly specified length of the constant.

implicitly or explicitly specified length.

Source Code Object Code

in Hex

Examples Value of Length

constant Length 1 Attribute 2

2 Depends on whether or not an explicit length is specified in constant

Section G: Symbol and Data Definition 165

ALIGNMENT OF CONSTAN'lS: 'Ihe assemtler aligns constants on different boundaries according to the following:

~

On boundaries implicit to the type of constant, when no length

specification is supplied.

On byte boundaries when an eXflici t length spec1f1cat10n is made.

Bytes that are skipped to align invoked the assembler.

NOTE: Alignment can be forced to

doubleword DC L'2.57E65'

halfword DC Y (HERE) /

Fadding and ~runcation of Values

The nomjnal JLalQ~ecjfjed fCLccnstantsuare-assembled into storage. The amount of space availatle for the ~crri~al

value of a constant is deterrrined:

1. By the e~plicit length specified in tbe second c~erand

sutfield, or

2. If no e~~licit lengtb is sfecified, by the implicit length according to the type of constant defined (see Appendix VI) •

PADDING: If rrore sface is available than is needed to accommodate the binary representation of the nominal value, the extra space is padded:

17

~ with binary zeros on the left for the tinary (B), hexadecimal (X), fixed-point (H,F), packed decimal

(~, and all address ~,y,S,V,Q)

constants

~With EBCDIC zeros on the left

~'11110000') for the zoned decimal (Z) constants

4EtWith EBCDIC blanks on the right

~'01000000') for the character (C) constant

NOTE: Floating-point constants

~,D,~ are also padded on the right with zeros (see G3I) •

Source Code

DC BL2'lOl'

DC XL3'FFA1' DC X'FFA' DC H'255' DC FL3'255' DC P'1234' DC PL4'123' DC AL3(512) DC ZL4'123' DC ZL4'3'

DC C'FOUR' DC CL5'FOUR DC CL5'A'

0

}e

Padding

-- - - - -

-Object Code

2 bytes

Hexadecimal

Section G: Symbol and Data Deiinition 167

Page of GC33-401o-4

NOTE: Floating-point constants

(E,~,L) are not truncated; they are rounded (see G3I) •

NOTE: The above rules for padding and truncation also apply when the bit-length specification is used

(see below under Subfield 3:

Modifiers) •

Subfield 1: Duplication Factor

The duplication factcr, if specified, causes the nottinal value cr multiple

o

established according to the

implicitly or explicitly specified length.

2. If duplication is specified for an address constant containing a location counter reference, the value of the location counter reference is increroented by the length of the constant before each duplication is performed (for examples, see G3J) •

The type specificaticn indicates to the assembler:

1. How the no~inal value(s) specified in subfield 4 is to be assembled;

that is, which binary representation

O

or machine format the object code of the constant must have.

2. At what boundary the assembler aligns the constant, if no length specification is present.

3. How much storage the constant is to occupy, according to the implicit length of the constant, if no explicit length specification is present (for details see above,

C Character 8-bit code for each Character X Hexadecimal 4-bit code for each hexadecimal digit

B Binary Binary format

F Fixed-point Signed, fixed-point binary format;

normally a fullword

H Fixed-point Signed, fixed-point binary format;

normally a halfword

E Floating-point Short floating-point format; normally a fullword

D Floating-point Long floating-point format; normally a doubleword

L Floating-point Extended floating-point format; normally two doublewords

P Decimal Packed decimal format

Z Decimal Zoned decimal format

A Address Value of address; normally a fullword y Address Value of address; normally a halfword S Address Base register and displacement value;

a halfword

V Address Space reserved for external symbol addresses; each address normally a fullword

Subfield 3: Modifiers

The three modifiers that can be specified to describe a constant are:

4It

The length modifier (L), which explicitly defines the length in

bytes desired for a ccnstant.

• 'Ihe scale modifier (S), which is only used with the fixed-point or floatingpoint constants (for details see below under Scale Modifier) •

• The exponent Ir.odifier (E), that is only used with fixed-point or floating-point constants, and which indicates the power of 10 by which the constant is to be roulti~lied

before conversion to its internal binary format.

e

If multiple modifiers are used, they must appear in the sequence:

length, scale, exponent.

LENGTH MODIF'IER: The length modifier indicates the number of bytes of storage into which the constant is to be assembled. It is written as Ln, where n is either of the following:

4It

A decimal self-defining term

An absolute expressicn enclosed in parentheses. It must have a positive value and any syrrbols it

• contains must be previously def1ned.

LENGTH SCALE

EXPON

~LL3

DECSDT

EXPR

,.---.

DC XL10'FF' DC FS8'35.92'

.-•

DC EE3'3.414'

'--'

DC D.hl'§]~' 2.7182'

Length

DC

DC XL(SYMBO~D) 'F7A'

When the length ffiodifier is specified:

o

Its value determines the number of bytes of storage allocated to a constant. It therefore determines whether the nominal value of a

constant must be radded or truncated to fit into the space allocated

(see above under Padding and Truncation of Constants).

No boundary alignment, according to constant type, is provided (see above under Alignment of Constants).

~Its value must not exceed the maximum length allowed for the various types of constant defined. (For the allowable range of length modifiers, see the specifications for the individual constants and areas from G3C through G3N.)

Source Code

---0---PADTRUNC DC CL3'ABCDE'

IMPLICIT DC C'·~··~~ri~'

For character constant: when no length is specified, the whole con-stant is assembled into its implicit iength

NOALIGN DC FL3'S13'

Assembled at the next available (byte) boundary

Object Code in hex

... Fullword

~

... bo 000201 ... u ... n .. d ... a.r Y

I

TOOLONG DC FL9'10' **LENGTH ERROR**

Section G: Symbol and Data Definition 171

BI~-IENG~H SFECIFICATICN: ~he length rrodifier can ce specified tc indicate the number cf bits intc which a constant is to be assembled. ~he cit-length specificaticn is written as L.n, where n is either of the follo~ing:

A decimal self-defining term

An absolute expression enclosed in parentheses. It rrust have a positive value and any syrrbcls it ccntains must be previously defined.

The value of n Rust lie bet~een 1 and the nurrber cf bits (a multiple of 8) that are required to rrake up the rraxirrurr number of bytes allowed in the type of ccnstant ceing defined. The bit length-specification cannot be used ~ith

the S, V, and ~-type ccnstants.

Source Code

HEXCHAR DC XL.41F'

When only one operand and one nominal value are specified in a

rc

instruction, the follcwing rules apply:

1. The bit-length specification allocates a field intc which a constant is to be assembled •

• The field starts at a byte boundary,

and can run over one or more Eyte boundaries, if the bit-length

• specified is greater than 8.

Object Code

Binary digits

byte byte

1111()t)QQ

"---' ·'~rUi.

F

,~';.

Ifii~l.

If the field does not end at a byte HEX3CHAR DC XL.121FFF' boundary, if the bit-length specified

is not a multiple of 8, the remainder of the last byte is filled with zeros.

byte byte

FFF

byte

• o

2. The nominal value cf the constant is assembled into the field:

Starting at the high order end for the C, E, C, and L type ccnstants.

• Starting at the low crder end for the remaining types of constants that allow cit-length Sfecification.

The nominal value is padded or truncated to fit the field (see above under Padding or Truncation of Constants) •

~ Padding of character constants is with hexadecimal blanks, X'40'i other constant types are fadded wi th zeros.

NOTE: The length attribute value of the symbol naming a DC instruction with a specified bit-length is equal to the minirrum number of integral bytes needed to contain the bit-length specified for the constant.

L'TRUNCF is equal to 2. Thus, a

Source Code

PADe DC

PADF DC FL.13'S79'

zeros at left

Object code binary digits

• r~feren<?e to TRUNCF would address • tne entire two bytes that are

assemtled.

Section G: Symbol and Data Definition 173

When rrore than cne c~erand is specified in a

rc

instruction or more than cne ncrrinal value in a

rc

o~erand, the above rules atout tit-length s~ecificaticns alsc

ap~ly, exce~t:

O

1. !he first field allccated starts at a byte bcundary, but the

succeeding fields start at the next available bit.

2. After all the constants have teen asserrbled intc their res~ective

fields, the bits remaining to make

up the last byte are filled Vii th zeros.

NO!E: If dUflicaticn is specified, filling with zeros occurs once at the end of all the fields occu~ied

by the dUflicated ccnstants.

3. !he length attribute value cf the symbol naming the

rc

instruction is equal tc the nurrber cf integral bytes that Viould be needed tc ccntain the bit-length specified for the first constant tc te asserrbled.

o

L 'VALUES=2 Source

Code VALUES DC FL.10'161,21,57'

Object Code

OL'OPERANDS=l

Source OPERANDS DC FL.7'B' ,CL.10'AB' ,XL.14'C4' Code

byte byte byte byte byte

Object ~:::;::;::~~::;:e:t:t1==~~=~~.

Code

o

• •

8

STORAGE REQUIFEMENT FOR CONS~ANTS:

~he total aIT;ount of storage required to assemble a DC instruction is the sum of:

1. The requireIT;ents for the individual DC operands specified in the instruction. for the toundary a11gnrrent between different operands.

Hexadecimal digits for floating-point (E,D,l) constants

Space for

I--Storage

Requirements

e r

SCALE MODIFIER FOR FIXED-POINT CONS'IANTS: The scale modifier for fixed-point constants sFecifies the power of two by which the fixed-point constant must be multiplied after its nominal value has been

• converted to its binary

representation, but before it is assemtled in its final "scaled"

form. Scaling causes the binary point to move from its assumed f~xed

position at the right of the rightmost bit positicn.

DC H'2'

Object Code Binary digits

Dans le document Assembler Language (Page 173-188)

Documents relatifs