Converts the picture coordinates (D,E) to a screen address HL and a bit mask A. The y coordinate is turned upside down (127-E), because pictures are drawn with y measured upwards, and then split up in the usual way for the Spectrum's interleaved screen layout.
Input
D
x
E
y
Output
HL
Screen address
A
Bit mask
8BBC
LD A,$7F
Turn y upside down: row = 127 - y
8BBE
SUB E
8BBF
LD L,A
8BC0
AND $07
The low three bits of the row are the pixel line within the character...
8BC2
OR $40
...in the display file at $4000
8BC4
LD H,A
8BC5
LD A,L
Bits 6-7 of the row choose the third of the screen
8BC6
AND $C0
8BC8
RRCA
8BC9
RRCA
8BCA
RRCA
8BCB
OR H
8BCC
LD H,A
8BCD
LD A,L
Bits 3-5 choose the character row within the third
8BCE
AND $38
8BD0
RLCA
8BD1
RLCA
8BD2
LD L,A
8BD3
LD A,D
x / 8 is the column
8BD4
RRCA
8BD5
RRCA
8BD6
RRCA
8BD7
AND $1F
8BD9
OR L
8BDA
LD L,A
8BDB
LD A,D
x AND 7 is the bit within the byte
8BDC
AND $07
8BDE
PUSH BC
8BDF
LD B,A
8BE0
INC B
8BE1
LD A,$01
Start with bit 0 and rotate right x AND 7 + 1 times, giving $80 for x AND 7 = 0