Prev: CEAB Up: Map Next: CFA7
CF85: Copy a rectangle of the buffer to the screen
Used by the routines at RUN_CLOCK, SHOW_CARRIED, BLIT_2X8 and RENDER_DYNAMIC_OBJECTS.
Works up the screen a row at a time, as SHOW_BUFFER does: for the areas RENDER_DYNAMIC_OBJECTS wiped, the carried things on the panel (SHOW_CARRIED), and pieces of the panel redrawn in place (RUN_CLOCK, BLIT_2X8). As Knight Lore's blit_to_screen.
Input
HL the buffer address of its bottom-left byte
DE the display address of the same byte
B the height in rows
C the width in bytes
BLIT_TO_SCREEN CF85 PUSH BC One row: B is cleared so that LDIR copies C bytes
CF86 PUSH DE
CF87 PUSH HL
CF88 LD B,$00
CF8A LDIR
CF8C POP HL The buffer row above is 32 bytes on
CF8D LD DE,$0020
CF90 ADD HL,DE
CF91 POP DE Up a display line, unless that crossed a character row
CF92 DEC D
CF93 LD A,D
CF94 CPL
CF95 AND $07
CF97 JR NZ,BLIT_TO_SCREEN_0
CF99 LD A,E Crossing a character row: back 32 in E, and back into this third unless that borrowed
CF9A SUB $20
CF9C LD E,A
CF9D JR C,BLIT_TO_SCREEN_0
CF9F LD A,D
CFA0 ADD A,$08
CFA2 LD D,A
BLIT_TO_SCREEN_0 CFA3 POP BC The next row
CFA4 DJNZ BLIT_TO_SCREEN
CFA6 RET
Prev: CEAB Up: Map Next: CFA7