Prev: 8BBC Up: Map Next: 8C2C
8BE9: Start a picture: clear the picture area
Reads the picture's first two bytes: the border colour, which is set straight away, and the attribute for the picture area. The top two thirds of the screen ($4000-$4FFF) are cleared, and the 512 attributes of that area are filled with the picture's colour.
If Bilbo is in the dark (954D), the border and attributes are set to black instead, and the drawing is abandoned: the return address is discarded and the routine jumps to the end of 8985.
8BE9 CALL $954D Is Bilbo in the dark? (carry set if so)
8BEC EX AF,AF' Keep the answer in the alternate AF
8BED LD A,(IY+$00) A = the border colour (first byte of the picture)
8BF0 INC IY
8BF2 EX AF,AF'
8BF3 JR NC,$8BF8 Not dark: keep it
8BF5 EX AF,AF' Dark: black border
8BF6 XOR A
8BF7 EX AF,AF'
8BF8 EX AF,AF'
8BF9 OUT ($FE),A Set the border
8BFB PUSH HL
8BFC PUSH DE
8BFD PUSH BC
8BFE LD HL,$4000 Clear the top two thirds of the screen ($4000-$4FFF)
8C01 LD DE,$4001
8C04 LD BC,$0FFF
8C07 LD (HL),$00
8C09 LDIR
8C0B LD HL,$5800 512 attributes from $5800
8C0E LD DE,$5801
8C11 LD BC,$01FF
8C14 LD A,(IY+$00) A = the picture's colours (second byte)
8C17 INC IY
8C19 EX AF,AF'
8C1A JR NC,$8C1F Not dark: keep them
8C1C EX AF,AF' Dark: black on black
8C1D XOR A
8C1E EX AF,AF'
8C1F EX AF,AF'
8C20 LD (HL),A Fill the attributes
8C21 LDIR
8C23 POP BC
8C24 POP DE
8C25 POP HL
8C26 EX AF,AF' Not dark?
8C27 RET NC Then return and draw the picture
8C28 POP HL Dark: discard the return address...
8C29 JP $8A47 ...and skip the drawing altogether
Prev: 8BBC Up: Map Next: 8C2C