Zilog Z8F0130 Manuel d'utilisateur Page 158

  • Télécharger
  • Ajouter à mon manuel
  • Imprimer
  • Page
    / 314
  • Table des matières
  • MARQUE LIVRES
  • Noté. / 5. Basé sur avis des utilisateurs
Vue de la page 157
eZ8
CPU Core
User Manual
UM012820-0810 DJNZ Instruction
143
Sample Usage
DJNZ typically controls a loop of instructions. In this example, 18 bytes
are moved from one buffer area in the Register File to another and the
steps involved are:
1. Load the R6 counter with 18d (12h).
2. Load the R4 source pointer.
3. Load the R2 destination pointer.
4. Set up the loop to perform moves.
5. End loop with DJNZ.
The assembly listing required for this routine is as follows:
Ld R6, #12h ;Load counter with 12h (18d)
Ld R4, #36h ;Load source pointer
Ld R2, #24h ;Load destination pointer
LOOP: Ld R3, @R4 ;Load byte in R3 from source
Ld @R2, R3 ;Write byte to destination
dec R4 ;Decrement source pointer
dec R2 ;Decrement destination pointer
djnz R6, loop ;Decrement and loop until count =
0
Vue de la page 157
1 2 ... 153 154 155 156 157 158 159 160 161 162 163 ... 313 314

Commentaires sur ces manuels

Pas de commentaire