Prev: E48B Up: Map Next: E4CF
E4A7: Draw Three Byte Rows
Draws a piece of terrain that is three bytes wide, going up the screen two pixel rows at a time, using three words of the picture for each pair of rows. The entry points at DrawThreeByteRows and DrawThreeByteRows_Two first move to the right by three columns and two columns.
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
DrawThreeByteRows E4A7 INC L Advance L.
DrawThreeByteRows_Two E4A8 INC L Advance L.
E4A9 INC L Advance L.
E4AA LD B,A B=A.
DrawThreeByteRows_Loop E4AB POP DE Bring DE back off the stack.
E4AC LD (HL),E Write E where HL points.
E4AD INC L Advance L.
E4AE LD (HL),D Write D where HL points.
E4AF INC L Advance L.
E4B0 POP DE Bring DE back off the stack.
E4B1 LD (HL),E Write E where HL points.
E4B2 DEC H Step H back.
E4B3 LD (HL),D Write D where HL points.
E4B4 DEC L Step L back.
E4B5 POP DE Bring DE back off the stack.
E4B6 LD (HL),E Write E where HL points.
E4B7 DEC L Step L back.
E4B8 LD (HL),D Write D where HL points.
E4B9 DEC H Step H back.
E4BA LD A,H A=H.
E4BB INC A Advance A.
E4BC AND %00000111 Keep the bits of A that are set in 07.
E4BE JR NZ,DrawThreeByteRows_Next Jump to DrawThreeByteRows_Next if the zero flag is clear.
E4C0 LD A,L A=L.
E4C1 SUB $20 Subtract 20 from A.
E4C3 LD L,A L=A.
E4C4 JR C,DrawThreeByteRows_Next Jump to DrawThreeByteRows_Next if the carry flag is set.
E4C6 LD A,H A=H.
E4C7 ADD A,$08 Add 08 to A.
E4C9 LD H,A H=A.
DrawThreeByteRows_Next E4CA DJNZ DrawThreeByteRows_Loop Decrease B and jump to DrawThreeByteRows_Loop until none remain.
E4CC JP FinishStep Jump to FinishStep.
Prev: E48B Up: Map Next: E4CF