Motorola M68000 Betriebsanweisung Seite 184

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 256
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 183
170 Assembly Language Programming for the 68000 Family
set operation can be performed in an indivisible manner. In other words,
only one CPU at a time can perform a TAS in a multiple CPU system.
No two TAS’s can overlap.
This instruction is normally used for locking operations. If a processor
wants to place a lock on some item, it can execute the following code:
Ls TAS LOCK
BNE L
It might look as if this loop would go on forever. This is not the case if the
lock was zero to begin with. Remember, the test operation is performed
before the set takes place. After a processor is finished with the locked
item, it must reset the lock and therefore allow other CPU’s to access the
data, one at a time. This unlock operation is performed by:
CLR.B LOCK
The byte variable LOCK must be initially cleared or no CPU will ever
be able to access the item.
The particular items protected by locks can vary all over the place.
A lock could be placed on a record of a file, an area of memory,
and so on. Since the use of a TAS involves a busy wait, an operating
system normally uses this instruction to implement higher level methods
of ensuring mutually exclusive access. Consult a good operating systems
text for these details.
Exercises
1. How large is the status register?
2. In addition to the CCR bits, what extra bits are in the SR?
3. Can the status register be accessed when in user mode?
4. What is the range of values for the interrupt mask?
5. Write an instruction to clear the carry bit in the CCR. All other bits
should remain the same.
6. What is the purpose of the RTR instruction?
7. Write an instruction to set the byte at location MINUS if the result of
a calculation is negative.
8. Assume your program is in supervisor mode. Write the instructions
necessary to initialize the USP to location USTACK.
9. What is an exception?
10. Where are the exception vectors located?
11. What is the difference between an RTE instruction and an RTS
instruction?
12. What happens when you try to access a word or longword at an odd
memory address?
Seitenansicht 183
1 2 ... 179 180 181 182 183 184 185 186 187 188 189 ... 255 256

Kommentare zu diesen Handbüchern

Keine Kommentare