MJN
MJN

Reputation: 653

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?

Upvotes: 0

Views: 136

Answers (1)

0n10n_
0n10n_

Reputation: 402

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.

Upvotes: 1

Related Questions