Motorola Axiom CMD11E1 Podręcznik Użytkownika Strona 17

  • Pobierz
  • Dodaj do moich podręczników
  • Drukuj
  • Strona
    / 101
  • Spis treści
  • BOOKMARKI
  • Oceniono. / 5. Na podstawie oceny klientów
Przeglądanie stron 16
2.3. BRANCHING 17
Exercise:
1. Using the MM command (memory modify) enter the following values in
memory locations D000, D001, · · ·: 30 31 32 33 41 42 43 44. Verify the
values using the memory dump, MD, command.
2. Using RM, the register modify command, change the value in the X register
to D000
3. Execute the command CALL FFBB and write down what the output was and
also the value in the X register after the command is executed.
4. Repeat the the command CALL FFBB and write down the output and the
new value in the X register.
5. Repeat the last part until you have performed 7 calls to $FFBB.
2.3 Branching
Conditional branching in HC11 is controlled by the state of one or more hardware
flags. The state of a flag depends on the most recently executed instruction that
affects the flag. Thus, if your branching depends on the result of some instruction,
then it is your responsibility to make sure that none of the instructions between
the instruction you are interested in and the branching instruction affects the
flags that control the branching instruction. Thus, it is a good idea to follow the
instruction that sets the flag by the branching instruction. In this lab, we will use
the following conditional branch instructions:
BEQ Branch if the Z flag is set
BNE Branch if the Z flag is not set
Now, the Z flag is set after most instructions if the result of the instruction is a
zero; or else it is cleared, i.e. not set. The two most important instructions that
are often used to set/clear the flag are
CMP Perform a subtraction and discard the answer. However, set the flags.
TST Same as CMP except subtract the number zero
Thus, after the CMP command, the Z flag would be set if the two values that are
compared are equal. Similarly, the TST command will compare a value (memory
or register) with zero and set the Z flag if the value is zero.
Przeglądanie stron 16
1 2 ... 12 13 14 15 16 17 18 19 20 21 22 ... 100 101

Komentarze do niniejszej Instrukcji

Brak uwag