Zilog Z08470 Manual de usuario Pagina 288

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 326
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 287
Z80 Instruction Set UM008007-0715
276
Z80 CPU
User Manual
Condition Bits Affected
None.
Example
A typical software routine is used to demonstrate the use of the DJNZ instruction. This
routine moves a line from an input buffer (INBUF) to an output buffer (OUTBUF). It
moves the bytes until it finds a CR, or until it has moved 80 bytes, whichever occurs first.
LD 8, 80 ;Set up counter
LD HL, Inbuf ;Set up pointers
LD DE, Outbuf
LOOP: LID A, (HL) ;Get next byte from
;input buffer
LD (DE), A ;Store in output buffer
CP ODH ;Is it a CR?
JR Z, DONE ;Yes finished
INC HL ;Increment pointers
INC DE
DJNZ LOOP ;Loop back if 80
;bytes have not
;been moved
DONE:
Vista de pagina 287
1 2 ... 283 284 285 286 287 288 289 290 291 292 293 ... 325 326

Comentarios a estos manuales

Sin comentarios