Prev: 56317 Up: Map Next: 56455
56391: 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 63744 (B is set to 249). 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 56391 EXX Switch to the alternate registers.
56392 LD B,A B=A.
56393 EXX Switch to the alternate registers.
56394 LD A,(52790) The column step.
56397 ADD A,L A gains L.
56398 LD L,A L=A.
56399 LD B,249 B=249.
56401 JP DrawMirroredSlopeRows_PopWord Jump to DrawMirroredSlopeRows_PopWord.
DrawMirroredSlopeRows_Loop 56404 EXX Switch to the alternate registers.
DrawMirroredSlopeRows_PopWord 56405 POP DE Bring DE back off the stack.
56406 LD C,E C=E.
56407 LD A,(BC) Read BC.
56408 LD (HL),A Write A where HL points.
DrawMirroredSlopeRows_Patch 56409 JR DrawMirroredSlopeRows_Patch Skip ahead by the displacement at 56410.
56411 INC L Advance L.
56412 LD C,D C=D.
56413 LD A,(BC) Read BC.
56414 LD (HL),A Write A where HL points.
56415 DEC H Step H back.
56416 POP DE Bring DE back off the stack.
56417 POP DE Bring DE back off the stack.
56418 LD C,E C=E.
56419 LD A,(BC) Read BC.
56420 LD (HL),A Write A where HL points.
56421 DEC L Step L back.
DrawMirroredSlopeRows_Second 56422 LD C,D C=D.
56423 LD A,(BC) Read BC.
56424 LD (HL),A Write A where HL points.
56425 DEC H Step H back.
56426 LD A,H A=H.
56427 INC A Advance A.
56428 AND %00000111 Keep the bits of A that are set in 7.
56430 JR NZ,DrawMirroredSlopeRows_Next Jump to DrawMirroredSlopeRows_Next if the zero flag is clear.
56432 LD A,L A=L.
56433 SUB 32 Subtract 32 from A.
56435 LD L,A L=A.
56436 JR C,DrawMirroredSlopeRows_Next Jump to DrawMirroredSlopeRows_Next if the carry flag is set.
56438 LD A,H A=H.
56439 ADD A,8 Add 8 to A.
56441 LD H,A H=A.
DrawMirroredSlopeRows_Next 56442 EXX Switch to the alternate registers.
56443 DJNZ DrawMirroredSlopeRows_Loop Decrease B and jump to DrawMirroredSlopeRows_Loop until none remain.
56445 EXX Switch to the alternate registers.
56446 JP FinishStep Jump to FinishStep.
DrawMirroredSlopeRows_Last 56449 POP DE Bring DE back off the stack.
56450 POP DE Bring DE back off the stack.
56451 DEC H Step H back.
56452 JP DrawMirroredSlopeRows_Second Jump to DrawMirroredSlopeRows_Second.
Prev: 56317 Up: Map Next: 56455