Prev: 54687 Up: Map Next: 54942
54908: 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 54908 PUSH BC Stash the number of lines and the number of bytes on the stack.
54909 PUSH DE Stash the address on the screen on the stack.
54910 PUSH HL Stash the address in the buffer on the stack.
54911 LD B,0 Clear B.
54913 LDIR Copy the line.
54915 POP HL Restore the address in the buffer from the stack.
54916 LD DE,32 Set DE to the length of a line.
54919 ADD HL,DE Move on to the next line in the buffer.
54920 POP DE Restore the address on the screen from the stack.
54921 DEC D Go up one line on the screen.
54922 LD A,D Test whether that has gone into the character row above.
54923 CPL
54924 AND %00000111 Keep the bits of the line within the character row.
54926 JR NZ,CopyBlockToScreen_Next Jump to CopyBlockToScreen_Next if it has not.
54928 LD A,E Go up one character row.
54929 SUB 32
54931 LD E,A Store it.
54932 JR C,CopyBlockToScreen_Next Jump to CopyBlockToScreen_Next if that has gone into the third of the screen above.
54934 LD A,D Put the line at the bottom of the character row.
54935 ADD A,8
54937 LD D,A Store it.
CopyBlockToScreen_Next 54938 POP BC Restore the number of lines and the number of bytes from the stack.
54939 DJNZ CopyBlockToScreen Jump to CopyBlockToScreen until all of the lines are copied.
54941 RET Return.
View the equivalent code in;
Prev: 54687 Up: Map Next: 54942