Routines
 Prev: 8C4A Up: Map Next: 8D6B
8D33: Draw the current room to the screen buffer at 7000
 Used by the routine at 8912. 8D33 CALL \$8D6B Fill the buffer at 5E00 with attribute bytes for the current room 8D36 LD IX,\$5E00 Point IX at the first byte of the attribute buffer at 5E00 8D3A LD A,\$70 Set the operand of the 'LD D,n' instruction at 8D5C (below) to \$70 8D3C LD (\$8D5D),A 8D3F CALL \$8D4B Draw the tiles for the top half of the room to the screen buffer at 7000 8D42 LD IX,\$5F00 Point IX at the 256th byte of the attribute buffer at 5E00 in preparation for drawing the bottom half of the room; this instruction is redundant, since IX already holds 5F00 8D46 LD A,\$78 Set the operand of the 'LD D,n' instruction at 8D5C (below) to \$78 8D48 LD (\$8D5D),A 8D4B LD C,\$00 C will count 256 tiles The following loop draws 256 tiles (for either the top half or the bottom half of the room) to the screen buffer at 7000. 8D4D LD E,C E holds the LSB of the screen buffer address 8D4E LD A,(IX+\$00) Pick up an attribute byte from the buffer at 5E00; this identifies the type of tile (background, floor, wall, nasty, ramp or conveyor) to be drawn 8D51 LD HL,\$80A0 Move HL through the attribute bytes and graphic data of the background, floor, wall, nasty, ramp and conveyor tiles starting at 80A0 until we find a byte that matches the attribute byte of the tile to be drawn; note that if a graphic data byte matches the attribute byte being searched for, the CPIR instruction can exit early, which is a bug 8D54 LD BC,\$0036 8D57 CPIR 8D59 LD C,E Restore the value of the tile counter in C 8D5A LD B,\$08 There are eight bytes in the tile 8D5C LD D,\$00 This instruction is set to either 'LD D,\$70' or 'LD D,\$78' above; now DE holds the appropriate address in the screen buffer at 7000 8D5E LD A,(HL) Copy the tile graphic data to the screen buffer at 7000 8D5F LD (DE),A 8D60 INC HL 8D61 INC D 8D62 DJNZ \$8D5E 8D64 INC IX Move IX along to the next byte in the attribute buffer 8D66 INC C Have we drawn 256 tiles yet? 8D67 JP NZ,\$8D4D If not, jump back to draw the next one 8D6A RET
 Prev: 8C4A Up: Map Next: 8D6B