The Hobbit (v1.0)
Routines
Prev:
8B2F
Up:
Map
Next:
8BBC
8B93: Plot a pixel
Sets the pixel at (D,E) and gives its attribute cell the ink colour held at
8C2C
, keeping the cell's paper colour. If the ink would be the same as the paper (and so invisible), the ink is changed to its complement (XOR $38 before shifting).
8B93
PUSH HL
8B94
CALL
$8BBC
HL = the screen byte, A = the pixel's bit
8B97
PUSH AF
8B98
PUSH HL
8B99
LD A,H
Work out the attribute address from the screen address
8B9A
AND $18
8B9C
RRCA
8B9D
RRCA
8B9E
RRCA
8B9F
ADD A,$58
8BA1
LD H,A
8BA2
LD A,(HL)
Keep only the cell's paper colour
8BA3
AND $38
8BA5
LD (HL),A
8BA6
LD A,($8C2C)
A = the drawing colour, in the paper position
8BA9
RLCA
8BAA
RLCA
8BAB
RLCA
8BAC
CP (HL)
Same as the paper?
8BAD
JR NZ,$8BB1
8BAF
XOR $38
Yes: use its complement so it shows
8BB1
RRCA
Back into the ink position
8BB2
RRCA
8BB3
RRCA
8BB4
OR (HL)
Combine with the paper...
8BB5
LD (HL),A
...and store it
8BB6
POP HL
8BB7
POP AF
A = the pixel's bit
8BB8
OR (HL)
Set the pixel
8BB9
LD (HL),A
8BBA
POP HL
8BBB
RET
Prev:
8B2F
Up:
Map
Next:
8BBC