Prev: DBFD Up: Map Next: DC87
DC47: Draw Mirrored Slope Rows
Used by the routine at JumpToDrawingRoutine.
Draws the rows of a piece of a slope back to front, two bytes wide, going up the screen two pixel rows at a time. Each byte of the picture is reversed using the table at F900 (B is set to F9). The jump at DrawMirroredSlopeRows_Patch is changed by SetUpPiece to skip bytes when only part of the piece is to be drawn, and the last words of each group are entered at DrawMirroredSlopeRows_Last and DrawMirroredSlopeRows_Second.
Input
A Number of pairs of pixel rows to draw
HL Screen address
SP Address of the picture
DrawMirroredSlopeRows DC47 EXX Switch to the alternate registers.
DC48 LD B,A B=A.
DC49 EXX Switch to the alternate registers.
DC4A LD A,($CE36) The column step.
DC4D ADD A,L A gains L.
DC4E LD L,A L=A.
DC4F LD B,$F9 B=F9.
DC51 JP DrawMirroredSlopeRows_PopWord Jump to DrawMirroredSlopeRows_PopWord.
DrawMirroredSlopeRows_Loop DC54 EXX Switch to the alternate registers.
DrawMirroredSlopeRows_PopWord DC55 POP DE Bring DE back off the stack.
DC56 LD C,E C=E.
DC57 LD A,(BC) Read BC.
DC58 LD (HL),A Write A where HL points.
DrawMirroredSlopeRows_Patch DC59 JR DrawMirroredSlopeRows_Patch Skip ahead by the displacement at DC5A.
DC5B INC L Advance L.
DC5C LD C,D C=D.
DC5D LD A,(BC) Read BC.
DC5E LD (HL),A Write A where HL points.
DC5F DEC H Step H back.
DC60 POP DE Bring DE back off the stack.
DC61 POP DE Bring DE back off the stack.
DC62 LD C,E C=E.
DC63 LD A,(BC) Read BC.
DC64 LD (HL),A Write A where HL points.
DC65 DEC L Step L back.
DrawMirroredSlopeRows_Second DC66 LD C,D C=D.
DC67 LD A,(BC) Read BC.
DC68 LD (HL),A Write A where HL points.
DC69 DEC H Step H back.
DC6A LD A,H A=H.
DC6B INC A Advance A.
DC6C AND %00000111 Keep the bits of A that are set in 07.
DC6E JR NZ,DrawMirroredSlopeRows_Next Jump to DrawMirroredSlopeRows_Next if the zero flag is clear.
DC70 LD A,L A=L.
DC71 SUB $20 Subtract 20 from A.
DC73 LD L,A L=A.
DC74 JR C,DrawMirroredSlopeRows_Next Jump to DrawMirroredSlopeRows_Next if the carry flag is set.
DC76 LD A,H A=H.
DC77 ADD A,$08 Add 08 to A.
DC79 LD H,A H=A.
DrawMirroredSlopeRows_Next DC7A EXX Switch to the alternate registers.
DC7B DJNZ DrawMirroredSlopeRows_Loop Decrease B and jump to DrawMirroredSlopeRows_Loop until none remain.
DC7D EXX Switch to the alternate registers.
DC7E JP FinishStep Jump to FinishStep.
DrawMirroredSlopeRows_Last DC81 POP DE Bring DE back off the stack.
DC82 POP DE Bring DE back off the stack.
DC83 DEC H Step H back.
DC84 JP DrawMirroredSlopeRows_Second Jump to DrawMirroredSlopeRows_Second.
Prev: DBFD Up: Map Next: DC87