Motorola M68000 Betriebsanweisung Seite 98

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 256
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 97
84 Assembly Language Programming for the 68000 Family
fact, we can let the assembler do the work for us. By specifying a label for
the displacement, the assembler will automatically compute the proper
offset value. If we wish to access the data at location COUNT, we can
use PC with displacement addressing:
MOVE.L COUNT(PC),D0
0
COUNT: DC.L 1000
There are a couple of advantages in using this addressing mode. First,
the length of the instruction will be shorter than if the long absolute mode
is used, and a full word of memory will be saved. Second, when we
use PC relative addressing modes, the program code becomes position-
independent. This means that we can move the program around in
memory without modifying it and it will still work. Of course, this is
assuming that no absolute addressing is used anywhere in memory, which,
with great care, can be done. It is a help that all the branch instructions use
this mode at all times. Only with JMP and JSR do you have a choice. This
technique is useful for dynamically loaded programs that will be loaded
into various locations in memory. It is somewhat beyond the level of this
book to discuss all the applications of these techniques; however, one
application is that of dynamically loaded device drivers in an operating
system. If you program the Apple Macintosh, you will always have to
write position independent code—this is a drawback of the Macintosh
programming environment.
A couple of restrictions apply. PC relative modes can never be used
for the destination operand of an instruction. Additionally, many assem
blers and systems support the concept of a program section. Normally,
PC relative modes cannot be used with a label that is in another program
section. The specific restrictions on the use of these modes is somewhat
system-dependent. Consult the manuals for your assembler and system.
Additionally, some assemblers will generate this addressing mode auto
matically for references to labels that are not forward references. A for
ward reference is a reference to a label that has not yet been defined. You
should take a good look at your assembly listings to determine the ad
dressing modes that your assembler uses. Just look at the extension words
to the instruction. If there is only one, then PC relative mode is used.
Addressing Mode Summary
Here is a table of all the possible addressing modes and their assembler
syntax:
Seitenansicht 97
1 2 ... 93 94 95 96 97 98 99 100 101 102 103 ... 255 256

Kommentare zu diesen Handbüchern

Keine Kommentare