Download Print this page

ZiLOG Z80 Handbook page 63

Hide thumbs Also See for Z80:

Advertisement

2. The HL and DE registers are incremented by one to point to
the next byte of each block.
3. The byte count in BC is decremented by one.
4. If (BC) 0, the P/V bit in the flags is set.
Instruction LDD performs the same functions as LDI except that
the HL and DE registers in step 2 are decremented by one (LDI =
Load and Increment, while LDD = Load and Decrement). LDI,
therefore, transfers data from block start to block end while LDD
transfers data from block end to block start. The action of LDI and
LDD are shown in Fig. 5-6.
MEMORY
SOURCE
BLOCK
1000H
1001H
1002H
1003H
1004H
(HL) AFTER LDD
IHLI BEFORE INSTRUCTION
MEMORY
DESTINATION
BLOCK
8 BITS
- (DE) AFTER LDD
- (DE) BEFORE INSTRUCTION
f- IDEI AFTER LD I
Fig. 5-6 . LDI and LDD instructions.
LDIR and LDDR perform identical functions to LDI and LDD
with a supplemental action. If the byte count is not zero (P/V flag
set), then the instruction continues transferring data until the byte
count is 0. This means that there will be N executions of an LDIR
or LDDR, where N is the initial value of the BC register. LDIR
and LDDR are automatic transfers of a block of data while LDI and
LDD are "semi-automatic," requiring a separate test of the P/V flag
2000H
2001H
2002H
2003H
2004H
LDI ACTIONS
1. TRANSFER BYTE FROM 1002H TO 2002H
2. ADD 1 TO HL TO POINT TO 1003H
3. ADD 1 TO DE TO POINT TO 2003H
4. SUBTRACT 1 FROM BC )BYTE COUNT)
5. GOON TO NEXT INSTRUCTION
LDD ACTIONS
1. TRANSFER BYTE FROM 1002H TO 2002H
2. SUBTRACT 1 FROM HL TO POINT TO 1001H
3. SUBTRACT 1 FROM DE TO POINT TO 2001H
4. SUBTRACT 1 FROM BC ( BYTE COUNT)
5. GO ON TO NEXT INSTRUCTION
66

Advertisement

loading