| Routines

E7E8: Move a row of the screen left, right, up or down

Used by the routines at E80E (to move a row left), E845 (to move a row right), E87C (to move a row up) and E8B7 (to move a row down).
Input
DE | Destination attribute file address
HL | Source attribute file address
E7E8 | XOR A | Set A=0 initially to indicate that we are copying a row of attribute bytes first
E7E9 | PUSH HL | Save the source attribute file address
E7EA | PUSH DE | Save the destination attribute file address
E7EB | LD BC,$001F | The operand of this instruction is set to 001F by the routines at E80E and E845, and to 0020 by the routines at E87C, E8B7 and FC6A
E7EE | LDDR | This instruction is set to LDIR by the routines at E80E, E87C, E8B7 and FC6A, and to LDDR by the routine at E845; it copies the source row of attribute bytes or pixels to the destination row
E7F0 | POP DE | Restore the destination attribute file address to DE
E7F1 | POP HL | Restore the source attribute file address to HL
E7F2 | AND A | Have we just copied a row of attribute bytes?
E7F3 | JR Z,$E7FB | Jump if so to point DE and HL at the corresponding display file bytes
E7F5 | INC D | Otherwise point DE and HL at the next destination and source rows of pixels
E7F6 | INC H
E7F7 | DEC A | Have we copied 8 rows of pixels yet?
E7F8 | JR NZ,$E7E9 | Jump back if not
E7FA | RET |
E7FB | LD A,H | Set HL to the display file address that corresponds to the source attribute file address
E7FC | AND $0B
E7FE | ADD A,A
E7FF | ADD A,A
E800 | ADD A,A
E801 | LD H,A
E802 | LD A,D | Set DE to the display file address that corresponds to the destination attribute file address
E803 | AND $0B
E805 | ADD A,A
E806 | ADD A,A
E807 | ADD A,A
E808 | LD D,A
E809 | LD A,$08 | There are 8 rows of pixels to copy
E80B | JR $E7E9 | Jump back to copy them