Prev: DB89 Up: Map Next: DBFD
DBB7: 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 DBB7 LD B,A B=A.
DBB8 LD A,L A=L.
DBB9 INC A Advance A.
DBBA INC A Advance A.
DBBB AND %11100000 Keep the bits of A that are set in E0.
DBBD INC A Advance A.
DBBE LD L,A L=A.
DBBF INC SP Advance SP.
DrawSlopeRowsFromEdge_PatchFirst DBC0 JR DrawSlopeRowsFromEdge_PatchFirst Skip ahead by the displacement at DBC1.
DBC2 INC SP Advance SP.
DrawSlopeRowsFromEdge_Loop DBC3 POP DE Bring DE back off the stack.
DBC4 LD (HL),E Write E where HL points.
DrawSlopeRowsFromEdge_PatchSecond DBC5 JR DrawSlopeRowsFromEdge_PatchSecond Skip ahead by the displacement at DBC6.
DBC7 INC L Advance L.
DBC8 LD (HL),D Write D where HL points.
DBC9 DEC H Step H back.
DBCA POP DE Bring DE back off the stack.
DBCB LD (HL),E Write E where HL points.
DBCC DEC L Step L back.
DrawSlopeRowsFromEdge_StoreHigh DBCD LD (HL),D Write D where HL points.
DrawSlopeRowsFromEdge_PopWord DBCE POP DE Bring DE back off the stack.
DBCF DEC H Step H back.
DBD0 LD A,H A=H.
DBD1 INC A Advance A.
DBD2 AND %00000111 Keep the bits of A that are set in 07.
DBD4 JR NZ,DrawSlopeRowsFromEdge_Next Jump to DrawSlopeRowsFromEdge_Next if the zero flag is clear.
DBD6 LD A,L A=L.
DBD7 SUB $20 Subtract 20 from A.
DBD9 LD L,A L=A.
DBDA JR C,DrawSlopeRowsFromEdge_Next Jump to DrawSlopeRowsFromEdge_Next if the carry flag is set.
DBDC LD A,H A=H.
DBDD ADD A,$08 Add 08 to A.
DBDF LD H,A H=A.
DrawSlopeRowsFromEdge_Next DBE0 DJNZ DrawSlopeRowsFromEdge_Loop Decrease B and jump to DrawSlopeRowsFromEdge_Loop until none remain.
DBE2 LD A,($5C2E) The piece column.
DBE5 LD B,A B=A.
DBE6 LD A,($CE36) The column step.
DBE9 LD C,A C=A.
DBEA LD A,L A=L.
DBEB AND %11100000 Keep the bits of A that are set in E0.
DBED OR B Set the bits of A that are set in B.
DBEE SUB C Subtract C from A.
DBEF LD L,A L=A.
DBF0 JP FinishStep Jump to FinishStep.
DBF3 DEC H Step H back.
DBF4 JP DrawSlopeRowsFromEdge_StoreHigh Jump to DrawSlopeRowsFromEdge_StoreHigh.
DBF7 DEC H Step H back.
DBF8 LD (HL),D Write D where HL points.
DBF9 POP DE Bring DE back off the stack.
DBFA JP DrawSlopeRowsFromEdge_PopWord Jump to DrawSlopeRowsFromEdge_PopWord.
Prev: DB89 Up: Map Next: DBFD