Prev: E4F1 Up: Map Next: E55B
E52B: 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 F900. 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 E52B DEC L Step L back.
DrawMirroredTwoByteRows_One E52C DEC L Step L back.
DrawMirroredTwoByteRows_Start E52D LD B,$F9 B=F9.
E52F EXX Switch to the alternate registers.
E530 LD B,A B=A.
DrawMirroredTwoByteRows_Loop E531 EXX Switch to the alternate registers.
E532 POP DE Bring DE back off the stack.
E533 LD C,E C=E.
E534 LD A,(BC) Read BC.
E535 LD (HL),A Write A where HL points.
E536 INC L Advance L.
E537 LD C,D C=D.
E538 LD A,(BC) Read BC.
E539 LD (HL),A Write A where HL points.
E53A DEC H Step H back.
E53B POP DE Bring DE back off the stack.
E53C LD C,E C=E.
E53D LD A,(BC) Read BC.
E53E LD (HL),A Write A where HL points.
E53F DEC L Step L back.
E540 LD C,D C=D.
E541 LD A,(BC) Read BC.
E542 LD (HL),A Write A where HL points.
E543 DEC H Step H back.
E544 LD A,H A=H.
E545 INC A Advance A.
E546 AND %00000111 Keep the bits of A that are set in 07.
E548 JR NZ,DrawMirroredTwoByteRows_Next Jump to DrawMirroredTwoByteRows_Next if the zero flag is clear.
E54A LD A,L A=L.
E54B SUB $20 Subtract 20 from A.
E54D LD L,A L=A.
E54E JR C,DrawMirroredTwoByteRows_Next Jump to DrawMirroredTwoByteRows_Next if the carry flag is set.
E550 LD A,H A=H.
E551 ADD A,$08 Add 08 to A.
E553 LD H,A H=A.
DrawMirroredTwoByteRows_Next E554 EXX Switch to the alternate registers.
E555 DJNZ DrawMirroredTwoByteRows_Loop Decrease B and jump to DrawMirroredTwoByteRows_Loop until none remain.
E557 EXX Switch to the alternate registers.
E558 JP FinishStep Jump to FinishStep.
Prev: E4F1 Up: Map Next: E55B