Prev: E4A7 Up: Map Next: E4F1
E4CF: Draw Two Byte Rows
Draws a piece of terrain that is two bytes wide, going up the screen two pixel rows at a time, using two words of the picture for each pair of rows. The entry points at DrawTwoByteRows and DrawTwoByteRows_One first move to the right by two columns and one column, and the one at DrawTwoByteRows_Start does not.
Input
A Number of pairs of pixel rows to draw
HL Screen address of the bottom left of the piece
SP Address of the picture
DrawTwoByteRows E4CF INC L Advance L.
DrawTwoByteRows_One E4D0 INC L Advance L.
DrawTwoByteRows_Start E4D1 LD B,A B=A.
DrawTwoByteRows_Loop E4D2 POP DE Bring DE back off the stack.
E4D3 LD (HL),E Write E where HL points.
E4D4 INC L Advance L.
E4D5 LD (HL),D Write D where HL points.
E4D6 DEC H Step H back.
E4D7 POP DE Bring DE back off the stack.
E4D8 LD (HL),E Write E where HL points.
E4D9 DEC L Step L back.
E4DA LD (HL),D Write D where HL points.
E4DB DEC H Step H back.
E4DC LD A,H A=H.
E4DD INC A Advance A.
E4DE AND %00000111 Keep the bits of A that are set in 07.
E4E0 JR NZ,DrawTwoByteRows_Next Jump to DrawTwoByteRows_Next if the zero flag is clear.
E4E2 LD A,L A=L.
E4E3 SUB $20 Subtract 20 from A.
E4E5 LD L,A L=A.
E4E6 JR C,DrawTwoByteRows_Next Jump to DrawTwoByteRows_Next if the carry flag is set.
E4E8 LD A,H A=H.
E4E9 ADD A,$08 Add 08 to A.
E4EB LD H,A H=A.
DrawTwoByteRows_Next E4EC DJNZ DrawTwoByteRows_Loop Decrease B and jump to DrawTwoByteRows_Loop until none remain.
E4EE JP FinishStep Jump to FinishStep.
Prev: E4A7 Up: Map Next: E4F1