Prev: DB5B Up: Map Next: DBB7
DB89: 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 DB89 LD B,A B=A.
DB8A LD A,($CE36) The column step.
DB8D ADD A,L A gains L.
DB8E LD L,A L=A.
DrawSlopeRows_Loop DB8F POP DE Bring DE back off the stack.
DB90 LD (HL),E Write E where HL points.
DrawSlopeRows_Patch DB91 JR DrawSlopeRows_Patch Skip ahead by the displacement at DB92.
DB93 INC L Advance L.
DB94 LD (HL),D Write D where HL points.
DB95 DEC H Step H back.
DB96 POP DE Bring DE back off the stack.
DB97 POP DE Bring DE back off the stack.
DB98 LD (HL),E Write E where HL points.
DB99 DEC L Step L back.
DrawSlopeRows_Second DB9A LD (HL),D Write D where HL points.
DB9B DEC H Step H back.
DB9C LD A,H A=H.
DB9D INC A Advance A.
DB9E AND %00000111 Keep the bits of A that are set in 07.
DBA0 JR NZ,DrawSlopeRows_Next Jump to DrawSlopeRows_Next if the zero flag is clear.
DBA2 LD A,L A=L.
DBA3 SUB $20 Subtract 20 from A.
DBA5 LD L,A L=A.
DBA6 JR C,DrawSlopeRows_Next Jump to DrawSlopeRows_Next if the carry flag is set.
DBA8 LD A,H A=H.
DBA9 ADD A,$08 Add 08 to A.
DBAB LD H,A H=A.
DrawSlopeRows_Next DBAC DJNZ DrawSlopeRows_Loop Decrease B and jump to DrawSlopeRows_Loop until none remain.
DBAE JP FinishStep Jump to FinishStep.
DBB1 POP DE Bring DE back off the stack.
DBB2 POP DE Bring DE back off the stack.
DBB3 DEC H Step H back.
DBB4 JP DrawSlopeRows_Second Jump to DrawSlopeRows_Second.
Prev: DB5B Up: Map Next: DBB7