Prev: BACD Up: Map Next: BAF7
BADC: Mask against tile
This ANDs a tile in the mask buffer against the specified mask tile.
Used by the routine at render_mask_buffer.
Input
A Mask tile index.
HL Pointer to a tile in the mask buffer.
mask_against_tile BADC PUSH HL Save tile pointer
BADD EXX Switch register banks during the routine
Point HL at mask_tiles[A]
BADE LD L,A Move the mask tile index into HL
BADF LD H,$00
BAE1 ADD HL,HL Multiply it by 8
BAE2 ADD HL,HL
BAE3 ADD HL,HL
BAE4 LD BC,$8218 Add base of mask_tiles array
BAE7 ADD HL,BC
BAE8 POP DE Retrieve tile pointer
BAE9 LD B,$08 Set B for 8 iterations
Start loop
mat_loop BAEB LD A,(DE) Fetch a byte of mask buffer
BAEC AND (HL) Mask it against a byte of mask tile
BAED LD (DE),A Overwrite the input byte with result
BAEE INC L Advance the mask tile pointer by a row
BAEF INC E Advance the mask buffer pointer by a row
BAF0 INC E
BAF1 INC E
BAF2 INC E
BAF3 DJNZ mat_loop ...loop
BAF5 EXX Switch register banks back
BAF6 RET Return
Prev: BACD Up: Map Next: BAF7