![]() |
Routines |
| Prev: 38696 | Up: Map | Next: 38881 |
|
Used by the routine at XORSpriteLoop.
Draws one row of the old sprite, using XOR, and moves up to the next row.
The row is drawn by unrolled code with one piece of 12 bytes for each byte of the row (up to nine bytes). The operand of the jump at DrawOldEntityRow_Jump is changed by PrepDraw23 so that the jump lands on the first piece that is needed. If the sprite is aligned to a character boundary the jump goes six bytes further in, which leaves out the first write.
|
||||||||||||||||||||||
| DrawOldEntityRow | 38747 | LD A,C | Copy the row count to A. | |||||||||||||||||||
| 38748 | EX AF,AF' | Store the row count in AF'. | ||||||||||||||||||||
| 38749 | LD A,(DE) | Fetch the first byte of the row. | ||||||||||||||||||||
| 38750 | LD C,A | Copy it to C to use as the index into the shift table. | ||||||||||||||||||||
| 38751 | PUSH HL | Stash the screen address on the stack. | ||||||||||||||||||||
| DrawOldEntityRow_Jump | 38752 | JR DrawOldEntityRow_Jump | Jump into the unrolled code. The operand of this instruction is changed by PrepDraw23. | |||||||||||||||||||
| DrawOldEntityRow_Byte_1 | 38754 | LD A,(DE) | Byte 1 of the row: look up the shifted byte for the left cell and XOR it onto the screen. | |||||||||||||||||||
| 38755 | LD C,A | |||||||||||||||||||||
| 38756 | LD A,(BC) | |||||||||||||||||||||
| 38757 | XOR (HL) | |||||||||||||||||||||
| 38758 | LD (HL),A | |||||||||||||||||||||
| 38759 | INC L | |||||||||||||||||||||
| DrawOldEntityRow_Byte_1_Right | 38760 | INC B | Look up the shifted byte for the cell to the right and XOR it onto the screen, then move on to the next byte of pixel data. | |||||||||||||||||||
| 38761 | LD A,(BC) | |||||||||||||||||||||
| 38762 | XOR (HL) | |||||||||||||||||||||
| 38763 | LD (HL),A | |||||||||||||||||||||
| 38764 | DEC B | |||||||||||||||||||||
| 38765 | INC DE | |||||||||||||||||||||
| DrawOldEntityRow_Byte_2 | 38766 | LD A,(DE) | Byte 2 of the row: look up the shifted byte for the left cell and XOR it onto the screen. | |||||||||||||||||||
| 38767 | LD C,A | |||||||||||||||||||||
| 38768 | LD A,(BC) | |||||||||||||||||||||
| 38769 | XOR (HL) | |||||||||||||||||||||
| 38770 | LD (HL),A | |||||||||||||||||||||
| 38771 | INC L | |||||||||||||||||||||
| DrawOldEntityRow_Byte_2_Right | 38772 | INC B | Look up the shifted byte for the cell to the right and XOR it onto the screen, then move on to the next byte of pixel data. | |||||||||||||||||||
| 38773 | LD A,(BC) | |||||||||||||||||||||
| 38774 | XOR (HL) | |||||||||||||||||||||
| 38775 | LD (HL),A | |||||||||||||||||||||
| 38776 | DEC B | |||||||||||||||||||||
| 38777 | INC DE | |||||||||||||||||||||
| DrawOldEntityRow_Byte_3 | 38778 | LD A,(DE) | Byte 3 of the row: look up the shifted byte for the left cell and XOR it onto the screen. | |||||||||||||||||||
| 38779 | LD C,A | |||||||||||||||||||||
| 38780 | LD A,(BC) | |||||||||||||||||||||
| 38781 | XOR (HL) | |||||||||||||||||||||
| 38782 | LD (HL),A | |||||||||||||||||||||
| 38783 | INC L | |||||||||||||||||||||
| DrawOldEntityRow_Byte_3_Right | 38784 | INC B | Look up the shifted byte for the cell to the right and XOR it onto the screen, then move on to the next byte of pixel data. | |||||||||||||||||||
| 38785 | LD A,(BC) | |||||||||||||||||||||
| 38786 | XOR (HL) | |||||||||||||||||||||
| 38787 | LD (HL),A | |||||||||||||||||||||
| 38788 | DEC B | |||||||||||||||||||||
| 38789 | INC DE | |||||||||||||||||||||
| DrawOldEntityRow_Byte_4 | 38790 | LD A,(DE) | Byte 4 of the row: look up the shifted byte for the left cell and XOR it onto the screen. | |||||||||||||||||||
| 38791 | LD C,A | |||||||||||||||||||||
| 38792 | LD A,(BC) | |||||||||||||||||||||
| 38793 | XOR (HL) | |||||||||||||||||||||
| 38794 | LD (HL),A | |||||||||||||||||||||
| 38795 | INC L | |||||||||||||||||||||
| DrawOldEntityRow_Byte_4_Right | 38796 | INC B | Look up the shifted byte for the cell to the right and XOR it onto the screen, then move on to the next byte of pixel data. | |||||||||||||||||||
| 38797 | LD A,(BC) | |||||||||||||||||||||
| 38798 | XOR (HL) | |||||||||||||||||||||
| 38799 | LD (HL),A | |||||||||||||||||||||
| 38800 | DEC B | |||||||||||||||||||||
| 38801 | INC DE | |||||||||||||||||||||
| DrawOldEntityRow_Byte_5 | 38802 | LD A,(DE) | Byte 5 of the row: look up the shifted byte for the left cell and XOR it onto the screen. | |||||||||||||||||||
| 38803 | LD C,A | |||||||||||||||||||||
| 38804 | LD A,(BC) | |||||||||||||||||||||
| 38805 | XOR (HL) | |||||||||||||||||||||
| 38806 | LD (HL),A | |||||||||||||||||||||
| 38807 | INC L | |||||||||||||||||||||
| DrawOldEntityRow_Byte_5_Right | 38808 | INC B | Look up the shifted byte for the cell to the right and XOR it onto the screen, then move on to the next byte of pixel data. | |||||||||||||||||||
| 38809 | LD A,(BC) | |||||||||||||||||||||
| 38810 | XOR (HL) | |||||||||||||||||||||
| 38811 | LD (HL),A | |||||||||||||||||||||
| 38812 | DEC B | |||||||||||||||||||||
| 38813 | INC DE | |||||||||||||||||||||
| DrawOldEntityRow_Byte_6 | 38814 | LD A,(DE) | Byte 6 of the row: look up the shifted byte for the left cell and XOR it onto the screen. | |||||||||||||||||||
| 38815 | LD C,A | |||||||||||||||||||||
| 38816 | LD A,(BC) | |||||||||||||||||||||
| 38817 | XOR (HL) | |||||||||||||||||||||
| 38818 | LD (HL),A | |||||||||||||||||||||
| 38819 | INC L | |||||||||||||||||||||
| DrawOldEntityRow_Byte_6_Right | 38820 | INC B | Look up the shifted byte for the cell to the right and XOR it onto the screen, then move on to the next byte of pixel data. | |||||||||||||||||||
| 38821 | LD A,(BC) | |||||||||||||||||||||
| 38822 | XOR (HL) | |||||||||||||||||||||
| 38823 | LD (HL),A | |||||||||||||||||||||
| 38824 | DEC B | |||||||||||||||||||||
| 38825 | INC DE | |||||||||||||||||||||
| DrawOldEntityRow_Byte_7 | 38826 | LD A,(DE) | Byte 7 of the row: look up the shifted byte for the left cell and XOR it onto the screen. | |||||||||||||||||||
| 38827 | LD C,A | |||||||||||||||||||||
| 38828 | LD A,(BC) | |||||||||||||||||||||
| 38829 | XOR (HL) | |||||||||||||||||||||
| 38830 | LD (HL),A | |||||||||||||||||||||
| 38831 | INC L | |||||||||||||||||||||
| DrawOldEntityRow_Byte_7_Right | 38832 | INC B | Look up the shifted byte for the cell to the right and XOR it onto the screen, then move on to the next byte of pixel data. | |||||||||||||||||||
| 38833 | LD A,(BC) | |||||||||||||||||||||
| 38834 | XOR (HL) | |||||||||||||||||||||
| 38835 | LD (HL),A | |||||||||||||||||||||
| 38836 | DEC B | |||||||||||||||||||||
| 38837 | INC DE | |||||||||||||||||||||
| DrawOldEntityRow_Byte_8 | 38838 | LD A,(DE) | Byte 8 of the row: look up the shifted byte for the left cell and XOR it onto the screen. | |||||||||||||||||||
| 38839 | LD C,A | |||||||||||||||||||||
| 38840 | LD A,(BC) | |||||||||||||||||||||
| 38841 | XOR (HL) | |||||||||||||||||||||
| 38842 | LD (HL),A | |||||||||||||||||||||
| 38843 | INC L | |||||||||||||||||||||
| DrawOldEntityRow_Byte_8_Right | 38844 | INC B | Look up the shifted byte for the cell to the right and XOR it onto the screen, then move on to the next byte of pixel data. | |||||||||||||||||||
| 38845 | LD A,(BC) | |||||||||||||||||||||
| 38846 | XOR (HL) | |||||||||||||||||||||
| 38847 | LD (HL),A | |||||||||||||||||||||
| 38848 | DEC B | |||||||||||||||||||||
| 38849 | INC DE | |||||||||||||||||||||
| DrawOldEntityRow_Byte_9 | 38850 | LD A,(DE) | Byte 9 of the row: look up the shifted byte for the left cell and XOR it onto the screen. | |||||||||||||||||||
| 38851 | LD C,A | |||||||||||||||||||||
| 38852 | LD A,(BC) | |||||||||||||||||||||
| 38853 | XOR (HL) | |||||||||||||||||||||
| 38854 | LD (HL),A | |||||||||||||||||||||
| 38855 | INC L | |||||||||||||||||||||
| DrawOldEntityRow_Byte_9_Right | 38856 | INC B | Look up the shifted byte for the cell to the right and XOR it onto the screen, then move on to the next byte of pixel data. | |||||||||||||||||||
| 38857 | LD A,(BC) | |||||||||||||||||||||
| 38858 | XOR (HL) | |||||||||||||||||||||
| 38859 | LD (HL),A | |||||||||||||||||||||
| 38860 | DEC B | |||||||||||||||||||||
| 38861 | INC DE | |||||||||||||||||||||
| DrawOldEntityRow_Byte_9_Next | 38862 | EX AF,AF' | Fetch the row count from AF'. | |||||||||||||||||||
| 38863 | LD C,A | Copy the row count to C. | ||||||||||||||||||||
| 38864 | POP HL | Restore the screen address from the stack. | ||||||||||||||||||||
| 38865 | DEC H | Move up one pixel line. | ||||||||||||||||||||
| 38866 | LD A,H | Fetch the inverse of the high byte of the address in A. | ||||||||||||||||||||
| 38867 | CPL | |||||||||||||||||||||
| 38868 | AND %00000111 | Keep only the pixel line bits (bits 0-2). | ||||||||||||||||||||
| 38870 | RET NZ | Return if the move up stayed inside the same character cell. | ||||||||||||||||||||
| 38871 | LD A,L | Subtract 32 from the low byte to move up to the previous character row. | ||||||||||||||||||||
| 38872 | SUB 32 | |||||||||||||||||||||
| 38874 | LD L,A | |||||||||||||||||||||
| 38875 | RET C | Return if the move up stayed inside the same third of the screen. | ||||||||||||||||||||
| 38876 | LD A,H | Add 8 to the high byte to move up to the previous third of the screen. | ||||||||||||||||||||
| 38877 | ADD A,8 | |||||||||||||||||||||
| 38879 | LD H,A | |||||||||||||||||||||
| 38880 | RET | Return. | ||||||||||||||||||||
|
View the equivalent code in;
|
||||||||||||||||||||||
| Prev: 38696 | Up: Map | Next: 38881 |