Prev: D5CA Up: Map Next: D5FA
D5E6: Copy Routine
Input
DE Source for image data
HL Screen buffer address for destination of image
B Number of lines to copy (height)
C Number of bytes to copy (width)
This routine copies bytes from DE TO HL and uses the BC register to track the number of bytes and the number of lines.
Copy_Routine D5E6 PUSH BC Stashes BC (the counter) and HL (screen buffer address) on the stack.
D5E7 PUSH HL
D5E8 LD B,$00 Copies bytes from DE TO HL x C number of times.
D5EA EX DE,HL
D5EB LDIR
D5ED EX DE,HL Restores HL with the original screen buffer location.
D5EE POP HL
D5EF INC H Move to the next line down.
D5F0 LD A,H
D5F1 AND %00000111 Keep only bits 0-2.
D5F3 CALL Z,Calc_Attribute If this crosses a screen boundary then call Calc_Attribute.
D5F6 POP BC Grabs B and decreases it by one. Loop back round to Copy_Routine if B is not zero.
D5F7 DJNZ Copy_Routine
D5F9 RET Return.
Prev: D5CA Up: Map Next: D5FA