Prev: B09C Up: Map Next: B115
B0E4: Mask and draw an add-on into the ship's picture
fit_addon runs into it, to its second instruction for the mask or to the draw if there is no mask. A row at a time for the height in A': the mask, C bytes of it, ANDed onto the buffer at HL, then HL 6 bytes on to the next row. Then the stack gives back the buffer address and the graphic, the width and height are read again, and the picture is ORed on the same way. Returns to build_ship_sprite's loop.
Input
A' the height in lines
C the width in bytes
DE the mask
HL the place in the buffer
addon_mask_and_draw B0E4 EX AF,AF' keep the row count
This entry point is used by the routine at fit_addon.
addon_mask_and_draw_0 B0E5 LD B,C AND a row of the mask onto the buffer
B0E6 PUSH HL
addon_mask_and_draw_1 B0E7 LD A,(DE)
B0E8 AND (HL)
B0E9 LD (HL),A
B0EA INC DE
B0EB INC HL
B0EC DJNZ addon_mask_and_draw_1
B0EE POP HL the next row, 6 bytes on
B0EF LD A,$06
B0F1 CALL add_a_to_hl
B0F4 EX AF,AF'
B0F5 DEC A
B0F6 JR NZ,addon_mask_and_draw
This entry point is used by the routine at fit_addon.
addon_mask_and_draw_2 B0F8 POP HL the buffer address and the graphic back; its width and height
B0F9 POP DE
B0FA LD A,(DE)
B0FB LD B,A
B0FC LD C,A
B0FD INC DE
B0FE LD A,(DE)
B0FF INC DE
addon_mask_and_draw_3 B100 EX AF,AF' OR a row of the picture onto the buffer
B101 LD B,C
B102 PUSH HL
addon_mask_and_draw_4 B103 LD A,(DE)
B104 OR (HL)
B105 LD (HL),A
B106 INC DE
B107 INC HL
B108 DJNZ addon_mask_and_draw_4
B10A POP HL the next row
B10B LD A,$06
B10D CALL add_a_to_hl
B110 EX AF,AF'
B111 DEC A
B112 JR NZ,addon_mask_and_draw_3
B114 RET done
Prev: B09C Up: Map Next: B115