Prev: 81DE Up: Map Next: 8251
820B: Drawing: Read The Next Picture Byte
Used by the routine at DrawingSetup.
Reads the next picture byte. A dark location forces the border and paper to black, then the screen and the attributes are cleared.
DrawingClear 820B CALL LocationLit Call LocationLit to test whether the location is lit.
820E EX AF,AF' Save the lighting flags and read the next picture byte.
820F LD A,(IY+$00)
8212 INC IY Increment the graphic data pointer to the next byte.
8214 EX AF,AF' Switch back to the "normal" AF register to check the result of the call to LocationLit.
8215 JR NC,Drawing_Border Jump to Drawing_Border if LocationLit found the location lit (carry clear).
8217 EX AF,AF' Overwrite the graphic data in the shadow AF register to 00 (black).
8218 XOR A
8219 EX AF,AF' Switch back to the "normal" AF register simply to accommodate the jump from 8215.
Drawing_Border 821A EX AF,AF' Switch to the shadow AF register containing the first byte of the graphic data (or 00 if it's dark).
821B OUT ($FE),A Set the border colour from A.
821D PUSH HL Point at the screen buffer at 4000.
821E PUSH DE
821F PUSH BC
8220 LD HL,$4000
8223 LD DE,$4001 Fill the screen buffer at 4000 with zero.
8226 LD BC,$0FFF
8229 LD (HL),$00
822B LDIR
822D LD HL,$5800 Point HL at the attributes at 5800, DE at the next byte, and set the length to 01FF.
8230 LD DE,$5801
8233 LD BC,$01FF
8236 LD A,(IY+$00) Read the attribute byte for this picture.
8239 INC IY Increment the graphic data pointer to the next byte.
823B EX AF,AF' Use the flags saved for this picture.
823C JR NC,Drawing_Paper Jump to Drawing_Paper if the location is lit (carry clear).
823E EX AF,AF' Overwrite the graphic data in the shadow AF register to 00 (black).
823F XOR A
8240 EX AF,AF' Switch back to the "normal" AF register simply to accommodate the jump from 823C.
Drawing_Paper 8241 EX AF,AF' Switch to the shadow AF register containing the second byte of the graphic data (or 00 if it's dark).
8242 LD (HL),A Write this to the attribute buffer using the target/ length specified previously.
8243 LDIR
8245 POP BC Restore the pen from the stack. A dark place ends the picture.
8246 POP DE
8247 POP HL
8248 EX AF,AF'
8249 RET NC Return if it is LIGHT.
824A POP HL Jump back to Drawing_End to return.
824B JP Drawing_End
824E DEFB $38,$00,$00
Prev: 81DE Up: Map Next: 8251