Zilog Z08470 Manual do Utilizador Página 40

  • Descarregar
  • Adicionar aos meus manuais
  • Imprimir
  • Página
    / 326
  • Índice
  • MARCADORES
  • Avaliado. / 5. Com base em avaliações de clientes
Vista de página 39
Hardware and Software Implementation UM008007-0715
28
Z80 CPU
User Manual
LD HL, DATA ;ADDRESS OF FIRST BYTE
LD B, COUNT ;SHIFT COUNT
XOR A ;CLEAR ACCUMULATOR
ROTAT: RLD ;ROTATE LEFT low-order DIGIT IN ACC
;WITH DIGITS IN (HL)
INC HL ;ADVANCE MEMORY POINTER.
DJNZ ROTAT-$ ;DECREMENT B AND GO TO ROTAT IF
;B IS NOT ZERO, OTHERWISE FALL
;THROUGH
Eleven bytes are required for this operation.
Example 4
One number is to be subtracted from another number, both of which exist in packed BCD
format and are of equal but varying length. The result is stored in the location of the minu-
end. The operation is programmed as follows:
LD HL, ARG1 ;ADDRESS OF MINUEND
LD DE, ARG2 ;ADDRESS OF SUBTRAHEND
LD B, LENGTH ;LENGTH OF TWO ARGUMENTS
AND A ;CLEAR CARRY FLAG
SUBDEC:LD A, (DE) ;SUBTRAHEND TO ACC
Figure 24. Shifting of BCD Digits/Bytes
0
Vista de página 39
1 2 ... 35 36 37 38 39 40 41 42 43 44 45 ... 325 326

Comentários a estes Manuais

Sem comentários