Routines
 Prev: 8A3C Up: Map Next: 8ABB
8A75: Draw the current cavern to the screen buffer at 7000
 Used by the routine at 8684. 8A75 LD IX,\$5E00 Point IX at the first byte of the attribute buffer at 5E00 8A79 LD A,\$70 Set the operand of the 'LD D,n' instruction at 8A9B (below) to \$70 8A7B LD (\$8A9C),A 8A7E CALL \$8A8A Draw the tiles for the top half of the cavern to the screen buffer at 7000 8A81 LD IX,\$5F00 Point IX at the 256th byte of the attribute buffer at 5E00 in preparation for drawing the bottom half of the cavern; this instruction is redundant, since IX already holds 5F00 8A85 LD A,\$78 Set the operand of the 'LD D,n' instruction at 8A9B (below) to \$78 8A87 LD (\$8A9C),A 8A8A 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 cavern) to the screen buffer at 7000. 8A8C LD E,C E holds the LSB of the screen buffer address 8A8D LD A,(IX+\$00) Pick up an attribute byte from the buffer at 5E00; this identifies the type of tile to draw 8A90 LD HL,\$8020 Move HL through the attribute bytes and graphic data of the background, floor, crumbling floor, wall, conveyor and nasty tiles starting at 8020 until we find a byte that matches the attribute byte of the tile to be drawn 8A93 LD BC,\$0048 8A96 CPIR 8A98 LD C,E Restore the value of the tile counter in C 8A99 LD B,\$08 There are eight bytes in the tile 8A9B 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 8A9D LD A,(HL) Copy the tile graphic data to the screen buffer at 7000 8A9E LD (DE),A 8A9F INC HL 8AA0 INC D 8AA1 DJNZ \$8A9D 8AA3 INC IX Move IX along to the next byte in the attribute buffer 8AA5 INC C Have we drawn 256 tiles yet? 8AA6 JP NZ,\$8A8C If not, jump back to draw the next one The empty cavern has been drawn to the screen buffer at 7000. If we're in The Final Barrier, however, there is further work to do. 8AA9 LD A,(\$8407) Pick up the number of the current cavern from 8407 8AAC CP \$13 Is it The Final Barrier? 8AAE RET NZ Return if not 8AAF LD HL,\$A000 Copy the graphic data from A000 to the top half of the screen buffer at 7000 8AB2 LD DE,\$7000 8AB5 LD BC,\$0800 8AB8 LDIR 8ABA RET
 Prev: 8A3C Up: Map Next: 8ABB