Prev: 58609 Up: Map Next: 58715
58667: Draw Mirrored Two Byte Rows
Draws a piece of terrain that is two bytes wide in the same way as DrawTwoByteRows, but passes every byte through the table of reversed bytes at 63744. The entry points at DrawMirroredTwoByteRows and DrawMirroredTwoByteRows_One first move to the left by two columns and one column, and the one at DrawMirroredTwoByteRows_Start does not.
Input
A Number of pairs of pixel rows to draw
HL Screen address of the bottom left of the piece
SP Address of the picture
DrawMirroredTwoByteRows 58667 DEC L Step L back.
DrawMirroredTwoByteRows_One 58668 DEC L Step L back.
DrawMirroredTwoByteRows_Start 58669 LD B,249 B=249.
58671 EXX Switch to the alternate registers.
58672 LD B,A B=A.
DrawMirroredTwoByteRows_Loop 58673 EXX Switch to the alternate registers.
58674 POP DE Bring DE back off the stack.
58675 LD C,E C=E.
58676 LD A,(BC) Read BC.
58677 LD (HL),A Write A where HL points.
58678 INC L Advance L.
58679 LD C,D C=D.
58680 LD A,(BC) Read BC.
58681 LD (HL),A Write A where HL points.
58682 DEC H Step H back.
58683 POP DE Bring DE back off the stack.
58684 LD C,E C=E.
58685 LD A,(BC) Read BC.
58686 LD (HL),A Write A where HL points.
58687 DEC L Step L back.
58688 LD C,D C=D.
58689 LD A,(BC) Read BC.
58690 LD (HL),A Write A where HL points.
58691 DEC H Step H back.
58692 LD A,H A=H.
58693 INC A Advance A.
58694 AND %00000111 Keep the bits of A that are set in 7.
58696 JR NZ,DrawMirroredTwoByteRows_Next Jump to DrawMirroredTwoByteRows_Next if the zero flag is clear.
58698 LD A,L A=L.
58699 SUB 32 Subtract 32 from A.
58701 LD L,A L=A.
58702 JR C,DrawMirroredTwoByteRows_Next Jump to DrawMirroredTwoByteRows_Next if the carry flag is set.
58704 LD A,H A=H.
58705 ADD A,8 Add 8 to A.
58707 LD H,A H=A.
DrawMirroredTwoByteRows_Next 58708 EXX Switch to the alternate registers.
58709 DJNZ DrawMirroredTwoByteRows_Loop Decrease B and jump to DrawMirroredTwoByteRows_Loop until none remain.
58711 EXX Switch to the alternate registers.
58712 JP FinishStep Jump to FinishStep.
Prev: 58609 Up: Map Next: 58715