Prev: 6438 Up: Map Next: 6480
6456: Draw Room Row
Used by the routine at Draw_Room_Rows_Loop.
Copies a single character row (08 pixel lines) from the room buffer to the screen buffer, then copies the corresponding colour attributes.
Input
HL Pointer to the room buffer row
Copy eight pixel lines from the room buffer to the screen buffer.
Draw_Room_Row 6456 LD B,$08 Set the pixel line counter to 08 in B.
6458 PUSH HL Stash the room buffer pointer on the stack.
Draw_Room_Row_Pixel_Loop 6459 PUSH BC Stash the pixel line counter and room buffer pointer on the stack.
645A PUSH HL
645B LD D,H Copy the room buffer pointer to DE.
645C LD E,L
645D RES 7,D Reset bit 7 of D to convert from a room buffer address to the corresponding screen buffer address.
645F LD BC,$0020 Copy 20 bytes from the room buffer to the screen buffer.
6462 LDIR
6464 POP HL Restore the room buffer pointer and pixel line counter from the stack.
6465 POP BC
6466 INC H Advance to the next pixel line in the room buffer.
6467 DJNZ Draw_Room_Row_Pixel_Loop Decrease the pixel line counter and loop back to Draw_Room_Row_Pixel_Loop until all 08 lines are copied.
Copy the colour attributes for this character row. Convert the room buffer address to the source and destination attribute buffer addresses.
6469 POP HL Restore the original room buffer pointer from the stack.
646A LD A,H Rotate the high byte right three positions.
646B RRCA
646C RRCA
646D RRCA
646E AND %00000011 Mask to extract the character row index.
6470 OR %11011000 Set bits 3-4 and 6-7 to form the source attribute buffer high byte.
6472 LD H,A Set H to the source high byte and copy L to E.
6473 LD E,L
6474 LD A,H Mask the high byte again.
6475 AND %00000011
6477 OR %01011000 Set bits 3-4 and 6 to form the destination attribute buffer high byte.
6479 LD D,A Set D to the destination high byte.
647A LD BC,$0020 Copy 0020 attribute bytes to the screen attribute buffer.
647D LDIR
647F RET Return.
Prev: 6438 Up: Map Next: 6480