• Aucun résultat trouvé

o /FIRST START 0

Dans le document Assembler Language (Page 145-159)

o

/FIRST START 0

10 ,ADDRESS

I

LA

Equivalent ~

I

• I

40 11DDRESS DC C 'SAMPLE ,

END

/411

A/ 0

rco401 ,

\

Section F: Addressing 133

How to Establish Addressability

Location Source Module To establish the addressability

of a control section, you must, at coding time:

O.

Specify a base address from which the assembler can corofute

displacements

• • Assign a base register to contain this base address

• • Write the instruction that loads the base register with the base address.

At assembly time, the implicit addresses you code are converted

• into their eXFlicit base-displaceroent formi then, they are assenbled intc the object code of the machine instructicns in which they have been coded •

At execution tine, the base address is loaded into the base register and should renain there thrcughcut the execution of your ~rogram.

FIA - THE USING INSTRUCTION

Purpose

in Hex

FIRST START BALR USING BEGIN

ment

22 CONADR DC

L

END

The USING instruction allows you to specify a base address and assign one or more base registers. If you also load the base register with the base address, you have

established addressability in a control section.

To use the USING instruction correctly you should:

1. I<now which locations in a control section are Irade addressable by the USING instruction

2. Know where in a source module you can use these

established addresses as imflicit addresses in instruction operands.

0

Object Code in Hex

4

BE~IN ,11

F'22'

c

The Range of a USING Instruction ______ 'The ra_nge o~ USING inst_rucJ:_inD __

{called the USING ranqe} is the

0

4-,096 bytes beginning - at the ~ address specified in the USING

instruction. Addresses that lie within the USING range can be the USING instruction.

NOTE: The USING range is the range

instruction assigns ITore than one base register, the composite USING range is the sum of the USING ranges that would apply if the base

registers were specified in separate USING instructions.

The Domain of a USING Instruction 'The domain of a USING instruction (called the USING domain) begins where the USING instruction appears in a source module and continues to the end of the source module.

(Exceptions are discussed later in this subsection, under NOTES ABOUT THE USING DOMAIN.) The

~assembler converts implicit address references into their explicit form:

1. If the address reference appears address references that are outside the USING domain. The USING domain depends on the position of the USING instruction in the source module after conditional asserrbly, if any, has been performed.

This page left blank intentionally.

How to Use the USING Instruction Y-6tl--sOOu±d---spec-i-fy-y-ou-r---B-Sl-NG----instructions so that:

1. All the addresses in each control section lie within a USING range and

2. All the references for these addresses lie within the

corresponding USING domain.

You should therefore place all USING instructions at the beginning of the source module and specify a base address in each USING instruction that lies at the beginning of each control section.

FOR EXECUTABLE CONTROL SECTIONS:

The figure to the right illustrates a way of establishing the

addressability of an executable control section (defined by a START or CSECT instruction). You specify

o

a base address and assign a base register in the USING instruction •

• At execution time the base register is loaded with the correct base address.

Note that for this particular combination of the BALR and USING instructions, you should code them exactly as shown in the figure to the right.

Location in Decimal

USING range

o

a

p

2

~97

Source Module FIRST START

BALR USING BEGIN L 3

A 3 ST 3

A DS

B DS

C DS

END

Section F: Addressing 137

If a control section is longer than assign more than one base register.

establish the addressability of the with one USING instruction as shown opposite page.

4096 bytes, you must This allows you te entire control section in the figure on the The assembler assumes that the base registers that you

O

assign contain the correct base addresses. The address of HERE is loaded into the first base register. ~he

addresses HERE+4096 and HERE+8192 are loaded into the second and third base registers respectively.

~Note that you must define the address, EASES, within the first part of the total USING range, that is, the addresses covered by base register 9. This is because the explicit

~address converted from the implicit address reference, is assembled into the LM instruction. At execution time, the assembled address must have a base register which already contains a base address at this point; the only base register loaded with its base address is register 9.

O

The addressability of addresses in the USING range covered , by the second and third base registers is not completely

established until after the LM instruction.

NOTE: Addresses specified in address constants (exce~t

the S-type) are net cenverted to their base-displacement form.

USING range

I

LONG

: 0

~ERE

.BASES BEGIN

9

START BALR USING LM

B

DC DS

HERE+4095 HERE+4096

HERE+8192

1 4 - - - 1 HERE+12187

Source Module

0 + 1 1

-I

HERE+8192 )1

END

Section F: Addressing 139

FOR REFERENCE CONTROL SECTIONS:

The figure to the right illustrates how to estatlish the addressability of a dummy section. A dummy section is a reference control section

defined by the DSEC~ instructions.

Examples of establishing address ability for the other

reference control sections are given in E3C and E4.

• As the tase address, yeu sheuld specify the address of the first tyte of the durrrry sectien, se that all its addresses lie within the

• I=ertinent USING range.

• The address you load into the base register must be the address of the storage area being formatted by the dummy section.

Note that the assembler assumes that you are referring to the

• symbolic addresses of the dummy section, and it computes

displacements accordingly. However, at execution time, the assembled

addresses refer to the location.

of real data in the storage area.

Source Module

FIRST START 0 BALR 12,0 USING >''<,12

LA 11,INPUT--+-K.

~SING /INDATA,ll INPUT DS

:8

L

INDATA DSECT

A DS

F DS

END

Specifications for the USING Instruction

The remaining operands specify from 1 to 16 base registers. !he operands must be absolute expressions whose values lie in the range 0 through 15=

The ass embler assuroes that the first base register (EASREG1) contains A the base address BASE at executicn .., time. If present, the subsequent

operands, BASREG2, BASREG3, ••• , represent registers that the

assembler assumes will contain the address values, EASE+4096,

BASE+8192, ••• , respectively.

NOTES ABOUT THE USING DOMAIN: The preceding USING instruction.

• • A subsequent USING instruction specifies the same register or registers assigned by the preceding USING instruction.

Name Operation Operand

Sequence USING

NOTES AEOU! !EE USING RANGE: !wc

USI~G ranges coincide when the same tase address is s~ecified in twc different USI~G instructions, even though the tase registers used are different. When two USING ranges coincide, tte assentler uses the

o

higher numbered register for asserrtling the addresses within

the ccmrrcn USING range. In the example, this a~~l~es cnly tc the

~implicit addresses that a~pear after the second USING instruction. In effect, the first USI~G domain is

• terminated after the seccnd USING instructicn.

common USING range

Source Module CONFLICT START 0

USING

A DS

B DS

USING

(A+4095)

L

END

~wo USI~G ranges overlap when the tase address ef cne USING instructicn lies ~ithin the range of another

~ USING instructicn. ~hen twc ranges overlap, the assembler computes

4It

displacements frcrr the base address that gives the smallest displacement;

• second USING instruction.

EASE REGISTERS FOR AESOLU~E

ADLRESSES: Atsclute addresses used in a source medule rrust alse be

rrade addressable. Atsolute addresses require a base register ether than the base register assigned to

relocatable addresses (as described above) •

• Lisplacerr:ents are ccrrfuted frcrr the base address 0, because the

Source Module Object Code in Hex

Source Module

ABS START

LA LA

o

For at solute implicit addresses greater than 4095, a USING instruction must be specified according tc the fcllcwing:

~. with a base address representing an atsolute expressicn, and

USING range 4096-8191

US~NG.4096'

• • With a base register that has not been assigned by a USING

instruction iT; which a relocatable base address is specified •

LA

• This tase reg ister rrust be leaded

~ith the base address specified.

END

FlB - THE DROP INSTRUCTION

Purpose

You can use the tRCP instruction to indicate to the

assembler that one or more registers are no longer available as base registers. This allows you:

1. To free tase registers for other programming purposes 2. To ensure that the assembler uses the base register you wish in a particular coding situation, for exarople, when two USING ranges overlap or coincide (as described above in F1A, Notes about the USING range).

Object Code in Hex

-4096 1024

o

Specifications

Up to 16 operands can be specified.

They must be absolute expressions whose values represent the general

registers 0 through 15. A tROP instruction with a blank operand field causes all currently active base registers assigned by USING instructions to be dropped.

After a DROP instruction, the

assembler will not use the registers specified in a DROP instruction as base registers. A register made unavailable as a base register by a DROP instruction can be reassigned as a base register by a subsequent USING instruction.

Sequence symbol or blank

USING range

DROP BASREGI

[BASREG~

...

or blank

Source Module

DROPS START o USING BASE,IO

BASE DS

END

.., ... " ...

restored USING domain

Register 10 unavailable as a base register

Section F: Addressing 145

• • o

A [ROP instructicn is nct needed:

• If the base address is being changed ty a new USING instructicn, and the same base register is assigned. Ecwever, the new tase address must be loaded into the tase register. Ncte that the implicit address "E" lies within the first USING dcrrain, and that the base address to which i t refers lies within tte first USING range.

• At the end of a source module.

first USING range

second USING range

CHANGE

A

Source Module START USING DS

END

o

A,9

first USING domain

~·.·j,~22

. •

B,9

second USING domain

Dans le document Assembler Language (Page 145-159)

Documents relatifs