Prev: CEAB Up: Map Next: CFA7
CF85: 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 CF85 PUSH BC Stash BC, DE and HL on the stack.
CF86 PUSH DE
CF87 PUSH HL
CF88 LD B,$00 Set B to 00.
CF8A LDIR Copy C bytes from HL to DE.
CF8C POP HL Restore HL from the stack.
CF8D LD DE,$0020 Move HL up by 0020 bytes.
CF90 ADD HL,DE
CF91 POP DE Restore DE from the stack.
CF92 DEC D Decrement D.
CF93 LD A,D Fetch D and invert it.
CF94 CPL
CF95 AND %00000111 Keep bits 0 to 2.
CF97 JR NZ,CopyBlockToScreen_Next Jump to CopyBlockToScreen_Next if it is not zero.
CF99 LD A,E Subtract 20 from E.
CF9A SUB $20
CF9C LD E,A
CF9D JR C,CopyBlockToScreen_Next Jump to CopyBlockToScreen_Next if carry is set.
CF9F LD A,D Add 08 to D.
CFA0 ADD A,$08
CFA2 LD D,A
CopyBlockToScreen_Next CFA3 POP BC Restore BC from the stack.
CFA4 DJNZ CopyBlockToScreen Jump to CopyBlockToScreen until B is zero.
CFA6 RET Return.
View the equivalent code in;
Prev: CEAB Up: Map Next: CFA7