Prev: 33246 Up: Map Next: 33361
33291: 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 33291 CALL LocationLit Call LocationLit to test whether the location is lit.
33294 EX AF,AF' Save the lighting flags and read the next picture byte.
33295 LD A,(IY+0)
33298 INC IY Increment the graphic data pointer to the next byte.
33300 EX AF,AF' Switch back to the "normal" AF register to check the result of the call to LocationLit.
33301 JR NC,Drawing_Border Jump to Drawing_Border if LocationLit found the location lit (carry clear).
33303 EX AF,AF' Overwrite the graphic data in the shadow AF register to 0 (black).
33304 XOR A
33305 EX AF,AF' Switch back to the "normal" AF register simply to accommodate the jump from 33301.
Drawing_Border 33306 EX AF,AF' Switch to the shadow AF register containing the first byte of the graphic data (or 0 if it's dark).
33307 OUT (254),A Set the border colour from A.
33309 PUSH HL Point at the screen buffer at 16384.
33310 PUSH DE
33311 PUSH BC
33312 LD HL,16384
33315 LD DE,16385 Fill the screen buffer at 16384 with zero.
33318 LD BC,4095
33321 LD (HL),0
33323 LDIR
33325 LD HL,22528 Point HL at the attributes at 22528, DE at the next byte, and set the length to 511.
33328 LD DE,22529
33331 LD BC,511
33334 LD A,(IY+0) Read the attribute byte for this picture.
33337 INC IY Increment the graphic data pointer to the next byte.
33339 EX AF,AF' Use the flags saved for this picture.
33340 JR NC,Drawing_Paper Jump to Drawing_Paper if the location is lit (carry clear).
33342 EX AF,AF' Overwrite the graphic data in the shadow AF register to 0 (black).
33343 XOR A
33344 EX AF,AF' Switch back to the "normal" AF register simply to accommodate the jump from 33340.
Drawing_Paper 33345 EX AF,AF' Switch to the shadow AF register containing the second byte of the graphic data (or 0 if it's dark).
33346 LD (HL),A Write this to the attribute buffer using the target/ length specified previously.
33347 LDIR
33349 POP BC Restore the pen from the stack. A dark place ends the picture.
33350 POP DE
33351 POP HL
33352 EX AF,AF'
33353 RET NC Return if it is LIGHT.
33354 POP HL Jump back to Drawing_End to return.
33355 JP Drawing_End
33358 DEFB 56,0,0
Prev: 33246 Up: Map Next: 33361