Search code examples
microprocessors8085

How count works in 8085 Processor?


 MVI D,10H
 LXI H,4500
 LXI B,4600
 l1: MOV A,M
 STAX B
 INX H
 INX B
 DCR D
 JNZ l1
 RST 1
 hlt

Can any one help me to understand how loop works i.e, how count becomes zero and why is D value 10H?


Solution

  • My understanding of loops in 8085 is that they are executed when there is a flag(decision).
    in your example the program will execute normally until;DCR D
    Then the jnz flag will be checked if contents in D > 0.
    The program will go back to mov A, M.
    This process will stop when D == 0. As you know DCR is decrementing.