Prev: E7B2 Up: Map Next: E834
E806: Fill a whole byte at once when nothing in it needs looking at pixel by pixel
Used by the routine at FILL_BYTE_TO_LEFT.
Jumped to from FILL_BYTE_TO_LEFT when the fill has just moved into a new byte. The whole byte is painted in one go only when nothing in it could change the fill's course: all eight pixels are clear in the clean copy, and each neighbouring row is the same all along the byte -- all clear if a run is open there (the run just goes on), all set if none is (none can open). Then all eight are marked in the clean copy, the texture's byte is written to the screen whole, and the loop goes on from the byte's left-hand pixel; the return address into FILL_NEXT_PIXEL is dropped so as to go straight to its top, ready for the next byte. Otherwise it returns and the byte is done pixel by pixel. On a room's big plain areas this paints eight pixels for about the work of one.
Input
HL The byte below, in the clean copy
FILL_WHOLE_BYTE E806 LD A,(HL) the row below, with no run open: go on only if all eight are set
E807 BIT 1,E
E809 JR NZ,FILL_WHOLE_BYTE_0
E80B INC A
E80C JR Z,FILL_WHOLE_BYTE_1
E80E RET
FILL_WHOLE_BYTE_0 E80F AND A with a run open: only if all eight are clear
E810 RET NZ
FILL_WHOLE_BYTE_1 E811 LD HL,(WORK_RECORD) the row above, the same way
E814 LD A,(HL)
E815 BIT 0,E
E817 JR NZ,FILL_WHOLE_BYTE_2
E819 INC A
E81A JR Z,FILL_WHOLE_BYTE_3
E81C RET
FILL_WHOLE_BYTE_2 E81D AND A
E81E RET NZ
FILL_WHOLE_BYTE_3 E81F LD HL,(STEP_AXES) this row: all eight must be clear
E822 LD A,(HL)
E823 AND A
E824 RET NZ
E825 CPL mark all eight done
E826 LD (HL),A
E827 EXX the texture's byte onto the screen whole
E828 LD (HL),E
E829 EXX
E82A LD A,C the byte's left-hand pixel is the last one painted
E82B AND $F8
E82D LD C,A
E82E LD D,$80
E830 POP HL drop the return into FILL_NEXT_PIXEL and go on from its top
E831 JP FILL_NEXT_PIXEL
Prev: E7B2 Up: Map Next: E834