Prev: 52907 Up: Map Next: 53159
53125: Copy Block To Screen
Copies an area of the screen buffer to the screen, a line at a time.
Input
B Number of lines
C Number of bytes in a line
DE Address of the first line on the screen
HL Address of the first line in the buffer
Copy one line, then move up.
CopyBlockToScreen 53125 PUSH BC Stash BC, DE and HL on the stack.
53126 PUSH DE
53127 PUSH HL
53128 LD B,0 Set B to 0.
53130 LDIR Copy C bytes from HL to DE.
53132 POP HL Restore HL from the stack.
53133 LD DE,32 Move HL up by 0032 bytes.
53136 ADD HL,DE
53137 POP DE Restore DE from the stack.
53138 DEC D Decrement D.
53139 LD A,D Fetch D and invert it.
53140 CPL
53141 AND %00000111 Keep bits 0 to 2.
53143 JR NZ,CopyBlockToScreen_Next Jump to CopyBlockToScreen_Next if it is not zero.
53145 LD A,E Subtract 32 from E.
53146 SUB 32
53148 LD E,A
53149 JR C,CopyBlockToScreen_Next Jump to CopyBlockToScreen_Next if carry is set.
53151 LD A,D Add 8 to D.
53152 ADD A,8
53154 LD D,A
CopyBlockToScreen_Next 53155 POP BC Restore BC from the stack.
53156 DJNZ CopyBlockToScreen Jump to CopyBlockToScreen until B is zero.
53158 RET Return.
View the equivalent code in;
Prev: 52907 Up: Map Next: 53159