Zilog Z08470 Manual do Utilizador Página 288

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 326
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 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 página 287
1 2 ... 283 284 285 286 287 288 289 290 291 292 293 ... 325 326

Comentários a estes Manuais

Sem comentários