Prev: 56155 Up: Map Next: 56247
56201: Draw Slope Rows
Used by the routine at JumpToDrawingRoutine.
Draws the rows of a piece of a slope two bytes wide, going up the screen two pixel rows at a time. The words of the picture are popped from the stack: the bytes of the first word go to the left and right, and of the third word to the right and left, so that they make a zigzag. The second word of each group is not used. The jump at DrawSlopeRows_Patch has its displacement set by SetUpPiece to skip the first byte of each pair of rows when only part of the piece is drawn. When the pixel row is the top of a character the routine moves up to the character above.
Input
A Number of pairs of pixel rows to draw
HL Screen address
SP Address of the picture
DrawSlopeRows 56201 LD B,A B=A.
56202 LD A,(52790) The column step.
56205 ADD A,L A gains L.
56206 LD L,A L=A.
DrawSlopeRows_Loop 56207 POP DE Bring DE back off the stack.
56208 LD (HL),E Write E where HL points.
DrawSlopeRows_Patch 56209 JR DrawSlopeRows_Patch Skip ahead by the displacement at 56210.
56211 INC L Advance L.
56212 LD (HL),D Write D where HL points.
56213 DEC H Step H back.
56214 POP DE Bring DE back off the stack.
56215 POP DE Bring DE back off the stack.
56216 LD (HL),E Write E where HL points.
56217 DEC L Step L back.
DrawSlopeRows_Second 56218 LD (HL),D Write D where HL points.
56219 DEC H Step H back.
56220 LD A,H A=H.
56221 INC A Advance A.
56222 AND %00000111 Keep the bits of A that are set in 7.
56224 JR NZ,DrawSlopeRows_Next Jump to DrawSlopeRows_Next if the zero flag is clear.
56226 LD A,L A=L.
56227 SUB 32 Subtract 32 from A.
56229 LD L,A L=A.
56230 JR C,DrawSlopeRows_Next Jump to DrawSlopeRows_Next if the carry flag is set.
56232 LD A,H A=H.
56233 ADD A,8 Add 8 to A.
56235 LD H,A H=A.
DrawSlopeRows_Next 56236 DJNZ DrawSlopeRows_Loop Decrease B and jump to DrawSlopeRows_Loop until none remain.
56238 JP FinishStep Jump to FinishStep.
56241 POP DE Bring DE back off the stack.
56242 POP DE Bring DE back off the stack.
56243 DEC H Step H back.
56244 JP DrawSlopeRows_Second Jump to DrawSlopeRows_Second.
Prev: 56155 Up: Map Next: 56247