• Keine Ergebnisse gefunden

CALLING AND USING ODT

Im Dokument for the (Seite 185-188)

THE ASSEMBLY PROCESS

FROM LIBRARY

8.1 CALLING AND USING ODT

ODT is supplied as a relocatable object module. It can be linked with the user program (using the HT-II Linker) for an absolute area in memory and loaded with the user program. When linked with the user program, ODT should reside in low memory, starting at 1000, to accommodate its stack.

Once loaded in memory with the user program, ODT has three legal start or restart addresses. The lowest (O.ODT) is used for normal entry, retaining the current breakpoints. The next (O.ODT+2) is a restart address which clears all breakpoints and re-initializes ODT saving the general registers and clearing the relocation registers. The last address (O.ODT+4) is used to reenter ODT. A reenter saves the Processor Status and general registers and removes the breakpoint instructions from the user program. ODT prints the Bad Entry (BE) error message. Breakpoints which were set are reset on the next ;G command. (;P is illegal after a BE message.) The ;G and ;P commands are used to run a program and are explained in Section 8.3.7.

The absolute address used is the address of the entry point O.ODT shown in the Linker load map. O.ODT is always the lowest address of ODT+l72, i.e., O.ODT is relative location 172 in ODT.

Examples:

NOTE

If linked with an overlay structured file, ODT should reside in the root segment so it is always in memory.

A breakpoint inserted in an overlay will be destroyed if it is overlaid during program execution.

1. ODT Linked with the User Program:

!.GET USER.SAV -,-START 1172

ODT V01-0l

User program previously linked to ODT is brought into memory.

Value (1172) of entry point a.ODT (determined from Linker load map) is used to start ODT.

2. Loading ODT with the User Program:

~GET ODT. SAY

~ GET USER. SAY

~START 40172 ODT V01-02 .:!.

ODT is loaded into memory.

User program is loaded into memory.

Assuming ODT has been linked for a bottom address of 40000, ODT starts.

3. Restarting ODT Clearing Breakpoints:

. START 1174 ..:!.

4. Reentering ODT:

. START 1176 BE001212

8.1.1 Return to Monitor, CTRL C

Assuming ODT was originally linked for a bottom address of 1000, this command (O.ODT+2) re·initializes ODT and clears any previous breakpoints.

Assuming ODT was linked for a bottom address of 1000, the value of O.ODT 1172+4 is used as the start address.

If ODT is awaiting a command, a CTRL C from the keyboard calls the HT·II Keyboard Monitor. The monitor responds with a

tc

on the terminal and awaits a Keyboard Monitor command. (The monitor REENTER command may be used to reenter ODT only if the user program has set the reenter bit. Otherwise ODT is reentered at address O.ODT+4 as shown above.)

8.1.2 Terminate Search, CTRL U

If typed during a search printout, a CTRL U terminates the search and ODT prints an asterisk.

8.2 RELOCATION

When the assembler produces a binary object module, the base address of the module is taken to be location 000000, and the addresses of all program locations as shown in the assembly listing are indicated relative to this base address. After the module is linked by the Linker, many values within the program, and all the addresses of locations in the program, will be incremented by a constant whose value is the actual absolute base address of the module after it has been relocated. This constant is called the relocation bias for the module. Since a linked program may contain several relocated modules each with its own relocation bias, and since, in the process of debugging, these biases will have to be subtracted from absolute addresses continually in order to relate relocated code to assembly listings, HT·II ODT provides an automatic relocation facility.

The basis of the relocation facility lies in eight relocation registers, numbered

a

through 7, which may be set to the values of the relocation biases at different times during debugging. Relocation biases should be obtained by consult·

ing the memory map produced by the Linker. Once set, a relocation register is used by ODT to relate relocatable code to relocated code. For more information on the exact nature of the relocation process, consult Chapter 6, the HT ·11 Linker.

8.2.1 Relocatable Expressions

A relocatable expression is evaluated by aDT as a 16-bit (6·digit octal) number and may be typed in anyone of the three forms presented in Table 8-1. In this table, the symbol n stands for an integer in the range 0 to 7 inclusive, and the symbol k stands for an actal number up to six digits long, with a maximum value of 177777. If more than six digits are typed, aDT takes the last six digits, truncated to the low-order 16 bits. k may be preceded by a minus sign, in which case its value is the two's complement of the number typed. For example:

k (number typed) Values

000001

-1 177777

400 000400

-177730 000050

1234567 034567

Table 8-1 Fonns of Relocatable Expressions (r)

r Value ofr

A) k The value of r is simply the value of k.

B) n,k The value of r is the value of k plus the contents of relocation register n.

If the n part of this expression is greater than 7, aDT uses only the last octal digit of n.

C) Cor Whenever the letter C is typed, aDT replaces C with the contents of a C,k or special register called the Constant Register. This value has the same role n,C or as the k or n that it replaces (Le., when used in place of n it designates a C,C relocation register). The Constant Register is designated by the symbol $C

and may be set to any value, as indicated below.

In the following examples, assume in each case that relocation register 3 contains 003400 and that the constant register contains 000003.

r Value ofr

5;C 000005

-17;C 177761

3,0;C 003400

3,150;C 003550

3,-I;C 003377

C;C 000003

3,C;C 003403

C,O;C 003400

C,1O;C 003410

C,C;C 003403

NOTE

For simplicity most examples in this section use Form A.

All three forms of r are equally acceptable, however.

Im Dokument for the (Seite 185-188)