Prev: 56201 Up: Map Next: 56317
56247: Draw Slope Rows From Edge
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, starting from the second column of the row that the screen address is in (or the next one if it is in the last two columns). The two jumps at DrawSlopeRowsFromEdge_PatchFirst and DrawSlopeRowsFromEdge_PatchSecond are changed by SetUpPiece to skip bytes when only part of the piece is to be drawn. The variable PieceColumn sets where the next piece starts on the row. The routine finishes with FinishStep.
Input
A Number of pairs of pixel rows to draw
HL Screen address
SP Address of the picture
DrawSlopeRowsFromEdge 56247 LD B,A B=A.
56248 LD A,L A=L.
56249 INC A Advance A.
56250 INC A Advance A.
56251 AND %11100000 Keep the bits of A that are set in 224.
56253 INC A Advance A.
56254 LD L,A L=A.
56255 INC SP Advance SP.
DrawSlopeRowsFromEdge_PatchFirst 56256 JR DrawSlopeRowsFromEdge_PatchFirst Skip ahead by the displacement at 56257.
56258 INC SP Advance SP.
DrawSlopeRowsFromEdge_Loop 56259 POP DE Bring DE back off the stack.
56260 LD (HL),E Write E where HL points.
DrawSlopeRowsFromEdge_PatchSecond 56261 JR DrawSlopeRowsFromEdge_PatchSecond Skip ahead by the displacement at 56262.
56263 INC L Advance L.
56264 LD (HL),D Write D where HL points.
56265 DEC H Step H back.
56266 POP DE Bring DE back off the stack.
56267 LD (HL),E Write E where HL points.
56268 DEC L Step L back.
DrawSlopeRowsFromEdge_StoreHigh 56269 LD (HL),D Write D where HL points.
DrawSlopeRowsFromEdge_PopWord 56270 POP DE Bring DE back off the stack.
56271 DEC H Step H back.
56272 LD A,H A=H.
56273 INC A Advance A.
56274 AND %00000111 Keep the bits of A that are set in 7.
56276 JR NZ,DrawSlopeRowsFromEdge_Next Jump to DrawSlopeRowsFromEdge_Next if the zero flag is clear.
56278 LD A,L A=L.
56279 SUB 32 Subtract 32 from A.
56281 LD L,A L=A.
56282 JR C,DrawSlopeRowsFromEdge_Next Jump to DrawSlopeRowsFromEdge_Next if the carry flag is set.
56284 LD A,H A=H.
56285 ADD A,8 Add 8 to A.
56287 LD H,A H=A.
DrawSlopeRowsFromEdge_Next 56288 DJNZ DrawSlopeRowsFromEdge_Loop Decrease B and jump to DrawSlopeRowsFromEdge_Loop until none remain.
56290 LD A,(23598) The piece column.
56293 LD B,A B=A.
56294 LD A,(52790) The column step.
56297 LD C,A C=A.
56298 LD A,L A=L.
56299 AND %11100000 Keep the bits of A that are set in 224.
56301 OR B Set the bits of A that are set in B.
56302 SUB C Subtract C from A.
56303 LD L,A L=A.
56304 JP FinishStep Jump to FinishStep.
56307 DEC H Step H back.
56308 JP DrawSlopeRowsFromEdge_StoreHigh Jump to DrawSlopeRowsFromEdge_StoreHigh.
56311 DEC H Step H back.
56312 LD (HL),D Write D where HL points.
56313 POP DE Bring DE back off the stack.
56314 JP DrawSlopeRowsFromEdge_PopWord Jump to DrawSlopeRowsFromEdge_PopWord.
Prev: 56201 Up: Map Next: 56317