Prev: D59F Up: Map Next: D69E
D67C: 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 step up a pixel line on the display.
CopyBlockToScreen D67C PUSH BC Stash the number of lines and the number of bytes on the stack.
D67D PUSH DE Stash the address on the screen on the stack.
D67E PUSH HL Stash the address in the buffer on the stack.
D67F LD B,$00 Clear B.
D681 LDIR Copy the line.
D683 POP HL Restore the address in the buffer from the stack.
D684 LD DE,$0020 Set DE to the length of a line.
D687 ADD HL,DE Move on to the next line in the buffer.
D688 POP DE Restore the address on the screen from the stack.
D689 DEC D Go up one line on the screen.
D68A LD A,D Test whether that has gone into the character row above.
D68B CPL
D68C AND %00000111 Keep the bits of the line within the character row.
D68E JR NZ,CopyBlockToScreen_Next Jump to CopyBlockToScreen_Next if it has not.
D690 LD A,E Go up one character row.
D691 SUB $20
D693 LD E,A Store it.
D694 JR C,CopyBlockToScreen_Next Jump to CopyBlockToScreen_Next if that has gone into the third of the screen above.
D696 LD A,D Put the line at the bottom of the character row.
D697 ADD A,$08
D699 LD D,A Store it.
CopyBlockToScreen_Next D69A POP BC Restore the number of lines and the number of bytes from the stack.
D69B DJNZ CopyBlockToScreen Jump to CopyBlockToScreen until all of the lines are copied.
D69D RET Return.
View the equivalent code in;
Prev: D59F Up: Map Next: D69E