Prev: 81DE Up: Map Next: 824E
820B: Take the stream's header off and clear the canvas
Used by the routine at RUN_PICTURE.
Two header bytes: the border colour, then the attribute the picture area starts as. The clear is exactly the picture's own extent and no more -- $4000-$4FFF is the top 128 scanlines, $5800-$59FF the top 16 character rows -- which leaves the text window below it untouched.
The carry from the routine at TOO_DARK decides whether the picture is drawn in its own colours or blacked out, and if it comes back clear this drops the interpreter's return address and leaves through its exit, so the stream is never run.
CLEAR_CANVAS 820B CALL TOO_DARK
820E EX AF,AF'
820F LD A,(IY+$00) Border colour, from the stream
8212 INC IY
8214 EX AF,AF'
8215 JR NC,CLEAR_CANVAS_0
8217 EX AF,AF'
8218 XOR A
8219 EX AF,AF'
CLEAR_CANVAS_0 821A EX AF,AF'
821B OUT ($FE),A
821D PUSH HL
821E PUSH DE
821F PUSH BC
8220 LD HL,$4000 Clear the top 128 scanlines
8223 LD DE,$4001
8226 LD BC,$0FFF
8229 LD (HL),$00
822B LDIR
822D LD HL,$5800 ...and the top 16 character rows
8230 LD DE,$5801
8233 LD BC,$01FF
8236 LD A,(IY+$00) The starting attribute, from the stream, filled over them
8239 INC IY
823B EX AF,AF'
823C JR NC,CLEAR_CANVAS_1
823E EX AF,AF'
823F XOR A
8240 EX AF,AF'
CLEAR_CANVAS_1 8241 EX AF,AF'
8242 LD (HL),A
8243 LDIR
8245 POP BC
8246 POP DE
8247 POP HL
8248 EX AF,AF'
8249 RET NC
824A POP HL Carry clear: abandon the picture through the interpreter's own exit
824B JP PICTURE_DONE
Prev: 81DE Up: Map Next: 824E