Prev: D85E Up: Map Next: D8DA
D86A: Draw Edge Pixels
Used by the routine at EndSegment.
Draws the pixels that finish the edge of a flat segment when the horizontal offset is not a multiple of eight. Nothing is drawn unless the segment is flat, its shape code (see EndShape) is 13 or 93 and steps have been flagged. The four bytes come from EdgePatternsRight or EdgePatternsLeft, depending on the type, and are stored going up the screen at the address in SegmentScreenAddress, except that only 02 are stored when the segment is at the top or bottom of the area.
Input
IX Address of the drawing record at ScrollWorld_Record
DrawEdgePixels D86A LD A,($CE37) The vertical step.
D86D AND A Return if A is not zero.
D86E RET NZ
D86F LD A,($5C34) The segment end shape.
D872 AND %01111111 Keep the bits of A that are set in 7F.
D874 CP $13 Return if A is not 13.
D876 RET NZ
D877 LD A,($5C2F) The flagged steps.
D87A AND A Return if A is zero.
D87B RET Z
D87C LD HL,$D851 The edge patterns right.
D87F LD A,(IX+$03) Read offset 03 of IX.
D882 AND A Jump to DrawEdgePixels_Table if A is zero.
D883 JR Z,DrawEdgePixels_Table
D885 LD HL,$D85E The edge patterns left.
DrawEdgePixels_Table D888 LD A,($CE41) The horizontal offset.
D88B AND %00000111 Keep the bits of A that are set in 07.
D88D RET Z Return if the zero flag is set.
D88E DEC A Step A back.
D88F DEC A Step A back.
D890 ADD A,A Double A.
D891 LD E,A E=A.
D892 LD D,$00 Clear D.
D894 ADD HL,DE HL gains DE.
D895 EX DE,HL Swap DE and HL.
D896 LD A,($D85D) The edge flag.
D899 AND A Is A zero?
D89A LD HL,($CE49) Fetch the word at SegmentScreenAddress into HL.
D89D JR Z,DrawEdgePixels_Address Jump to DrawEdgePixels_Address if the zero flag is set.
D89F LD (IX+$01),$00 Store 00 at offset 01 of IX.
D8A3 LD A,L A=L.
D8A4 SUB $20 Subtract 20 from A.
D8A6 LD L,A L=A.
D8A7 INC L Advance L.
D8A8 INC L Advance L.
D8A9 INC L Advance L.
DrawEdgePixels_Address D8AA INC L Advance L.
D8AB INC L Advance L.
D8AC INC L Advance L.
D8AD LD A,L A=L.
D8AE AND %00011111 Keep the bits of A that are set in 1F.
D8B0 DEC A Step A back.
D8B1 CP $1C Return if A is 1C or more.
D8B3 RET NC
D8B4 LD B,$04 B=04.
D8B6 LD A,($5C2D) The segment screen row.
D8B9 CP $B9 Jump to DrawEdgePixels_Rows if A is not B9.
D8BB JR NZ,DrawEdgePixels_Rows
D8BD INC DE Advance DE.
D8BE INC DE Advance DE.
D8BF LD H,$57 H=57.
D8C1 LD A,L A=L.
D8C2 AND %00011111 Keep the bits of A that are set in 1F.
D8C4 OR %11000000 Set the bits of A that are set in C0.
D8C6 LD L,A L=A.
D8C7 LD B,$02 B=02.
D8C9 JR DrawEdgePixels_Draw Jump to DrawEdgePixels_Draw.
DrawEdgePixels_Rows D8CB CP $19 Jump to DrawEdgePixels_Draw if A is not 19.
D8CD JR NZ,DrawEdgePixels_Draw
D8CF LD B,$02 B=02.
DrawEdgePixels_Draw D8D1 LD A,(DE) Read DE.
D8D2 LD (HL),A Write A where HL points.
D8D3 INC DE Advance DE.
D8D4 CALL MoveUpARow Call MoveUpARow.
D8D7 DJNZ DrawEdgePixels_Draw Decrease B and jump to DrawEdgePixels_Draw until none remain.
D8D9 RET Return.
Prev: D85E Up: Map Next: D8DA