Prev: 58535 Up: Map Next: 58609
58575: 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 58575 INC L Advance L.
DrawTwoByteRows_One 58576 INC L Advance L.
DrawTwoByteRows_Start 58577 LD B,A B=A.
DrawTwoByteRows_Loop 58578 POP DE Bring DE back off the stack.
58579 LD (HL),E Write E where HL points.
58580 INC L Advance L.
58581 LD (HL),D Write D where HL points.
58582 DEC H Step H back.
58583 POP DE Bring DE back off the stack.
58584 LD (HL),E Write E where HL points.
58585 DEC L Step L back.
58586 LD (HL),D Write D where HL points.
58587 DEC H Step H back.
58588 LD A,H A=H.
58589 INC A Advance A.
58590 AND %00000111 Keep the bits of A that are set in 7.
58592 JR NZ,DrawTwoByteRows_Next Jump to DrawTwoByteRows_Next if the zero flag is clear.
58594 LD A,L A=L.
58595 SUB 32 Subtract 32 from A.
58597 LD L,A L=A.
58598 JR C,DrawTwoByteRows_Next Jump to DrawTwoByteRows_Next if the carry flag is set.
58600 LD A,H A=H.
58601 ADD A,8 Add 8 to A.
58603 LD H,A H=A.
DrawTwoByteRows_Next 58604 DJNZ DrawTwoByteRows_Loop Decrease B and jump to DrawTwoByteRows_Loop until none remain.
58606 JP FinishStep Jump to FinishStep.
Prev: 58535 Up: Map Next: 58609