![]() |
Routines |
| Prev: 47629 | Up: Map | Next: 47883 |
|
Used by the routine at XORSpriteLoop.
Draws one row of the new sprite, using XOR, and moves up to the next row. It is a copy of DrawOldEntityRow that uses the jump at DrawNewEntityRow_0, which is changed by PrepDraw2.
|
||||||||||||||||||||||
| DrawNewEntityRow | 47756 | LD A,C | Copy the row count to A. | |||||||||||||||||||
| 47757 | EX AF,AF' | Store the row count in AF'. | ||||||||||||||||||||
| 47758 | LD A,(DE) | Fetch the first byte of the row. | ||||||||||||||||||||
| 47759 | LD C,A | Copy it to C to use as the index into the shift table. | ||||||||||||||||||||
| 47760 | PUSH HL | Stash the screen address on the stack. | ||||||||||||||||||||
| DrawNewEntityRow_0 | 47761 | JR DrawNewEntityRow_0 | Jump into the unrolled code. The operand of this instruction is changed by PrepDraw2. | |||||||||||||||||||
| DrawNewEntityRow_Byte_1 | 47763 | LD A,(DE) | Byte 1 of the row: look up the shifted byte for the left cell and XOR it onto the screen. | |||||||||||||||||||
| 47764 | LD C,A | |||||||||||||||||||||
| 47765 | LD A,(BC) | |||||||||||||||||||||
| 47766 | XOR (HL) | |||||||||||||||||||||
| 47767 | LD (HL),A | |||||||||||||||||||||
| 47768 | INC L | |||||||||||||||||||||
| DrawNewEntityRow_Byte_1_Right | 47769 | 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. | |||||||||||||||||||
| 47770 | LD A,(BC) | |||||||||||||||||||||
| 47771 | XOR (HL) | |||||||||||||||||||||
| 47772 | LD (HL),A | |||||||||||||||||||||
| 47773 | DEC B | |||||||||||||||||||||
| 47774 | INC DE | |||||||||||||||||||||
| DrawNewEntityRow_Byte_2 | 47775 | LD A,(DE) | Byte 2 of the row: look up the shifted byte for the left cell and XOR it onto the screen. | |||||||||||||||||||
| 47776 | LD C,A | |||||||||||||||||||||
| 47777 | LD A,(BC) | |||||||||||||||||||||
| 47778 | XOR (HL) | |||||||||||||||||||||
| 47779 | LD (HL),A | |||||||||||||||||||||
| 47780 | INC L | |||||||||||||||||||||
| DrawNewEntityRow_Byte_2_Right | 47781 | 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. | |||||||||||||||||||
| 47782 | LD A,(BC) | |||||||||||||||||||||
| 47783 | XOR (HL) | |||||||||||||||||||||
| 47784 | LD (HL),A | |||||||||||||||||||||
| 47785 | DEC B | |||||||||||||||||||||
| 47786 | INC DE | |||||||||||||||||||||
| DrawNewEntityRow_Byte_3 | 47787 | LD A,(DE) | Byte 3 of the row: look up the shifted byte for the left cell and XOR it onto the screen. | |||||||||||||||||||
| 47788 | LD C,A | |||||||||||||||||||||
| 47789 | LD A,(BC) | |||||||||||||||||||||
| 47790 | XOR (HL) | |||||||||||||||||||||
| 47791 | LD (HL),A | |||||||||||||||||||||
| 47792 | INC L | |||||||||||||||||||||
| DrawNewEntityRow_Byte_3_Right | 47793 | 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. | |||||||||||||||||||
| 47794 | LD A,(BC) | |||||||||||||||||||||
| 47795 | XOR (HL) | |||||||||||||||||||||
| 47796 | LD (HL),A | |||||||||||||||||||||
| 47797 | DEC B | |||||||||||||||||||||
| 47798 | INC DE | |||||||||||||||||||||
| DrawNewEntityRow_Byte_4 | 47799 | LD A,(DE) | Byte 4 of the row: look up the shifted byte for the left cell and XOR it onto the screen. | |||||||||||||||||||
| 47800 | LD C,A | |||||||||||||||||||||
| 47801 | LD A,(BC) | |||||||||||||||||||||
| 47802 | XOR (HL) | |||||||||||||||||||||
| 47803 | LD (HL),A | |||||||||||||||||||||
| 47804 | INC L | |||||||||||||||||||||
| DrawNewEntityRow_Byte_4_Right | 47805 | 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. | |||||||||||||||||||
| 47806 | LD A,(BC) | |||||||||||||||||||||
| 47807 | XOR (HL) | |||||||||||||||||||||
| 47808 | LD (HL),A | |||||||||||||||||||||
| 47809 | DEC B | |||||||||||||||||||||
| 47810 | INC DE | |||||||||||||||||||||
| DrawNewEntityRow_Byte_5 | 47811 | LD A,(DE) | Byte 5 of the row: look up the shifted byte for the left cell and XOR it onto the screen. | |||||||||||||||||||
| 47812 | LD C,A | |||||||||||||||||||||
| 47813 | LD A,(BC) | |||||||||||||||||||||
| 47814 | XOR (HL) | |||||||||||||||||||||
| 47815 | LD (HL),A | |||||||||||||||||||||
| 47816 | INC L | |||||||||||||||||||||
| DrawNewEntityRow_Byte_5_Right | 47817 | 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. | |||||||||||||||||||
| 47818 | LD A,(BC) | |||||||||||||||||||||
| 47819 | XOR (HL) | |||||||||||||||||||||
| 47820 | LD (HL),A | |||||||||||||||||||||
| 47821 | DEC B | |||||||||||||||||||||
| 47822 | INC DE | |||||||||||||||||||||
| DrawNewEntityRow_Byte_6 | 47823 | LD A,(DE) | Byte 6 of the row: look up the shifted byte for the left cell and XOR it onto the screen. | |||||||||||||||||||
| 47824 | LD C,A | |||||||||||||||||||||
| 47825 | LD A,(BC) | |||||||||||||||||||||
| 47826 | XOR (HL) | |||||||||||||||||||||
| 47827 | LD (HL),A | |||||||||||||||||||||
| 47828 | INC L | |||||||||||||||||||||
| DrawNewEntityRow_Byte_6_Right | 47829 | 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. | |||||||||||||||||||
| 47830 | LD A,(BC) | |||||||||||||||||||||
| 47831 | XOR (HL) | |||||||||||||||||||||
| 47832 | LD (HL),A | |||||||||||||||||||||
| 47833 | DEC B | |||||||||||||||||||||
| 47834 | INC DE | |||||||||||||||||||||
| DrawNewEntityRow_Byte_7 | 47835 | LD A,(DE) | Byte 7 of the row: look up the shifted byte for the left cell and XOR it onto the screen. | |||||||||||||||||||
| 47836 | LD C,A | |||||||||||||||||||||
| 47837 | LD A,(BC) | |||||||||||||||||||||
| 47838 | XOR (HL) | |||||||||||||||||||||
| 47839 | LD (HL),A | |||||||||||||||||||||
| 47840 | INC L | |||||||||||||||||||||
| DrawNewEntityRow_Byte_7_Right | 47841 | 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. | |||||||||||||||||||
| 47842 | LD A,(BC) | |||||||||||||||||||||
| 47843 | XOR (HL) | |||||||||||||||||||||
| 47844 | LD (HL),A | |||||||||||||||||||||
| 47845 | DEC B | |||||||||||||||||||||
| 47846 | INC DE | |||||||||||||||||||||
| DrawNewEntityRow_Byte_8 | 47847 | LD A,(DE) | Byte 8 of the row: look up the shifted byte for the left cell and XOR it onto the screen. | |||||||||||||||||||
| 47848 | LD C,A | |||||||||||||||||||||
| 47849 | LD A,(BC) | |||||||||||||||||||||
| 47850 | XOR (HL) | |||||||||||||||||||||
| 47851 | LD (HL),A | |||||||||||||||||||||
| 47852 | INC L | |||||||||||||||||||||
| DrawNewEntityRow_Byte_8_Right | 47853 | LD A,L | A=L. | |||||||||||||||||||
| 47854 | AND %00011111 | Keep only bits 0-4. | ||||||||||||||||||||
| 47856 | JR Z,DrawNewEntityRow_Byte_8_Next | Jump to DrawNewEntityRow_Byte_8_Next if the first cell was at the right of the screen, as the second cell is then not written. | ||||||||||||||||||||
| 47858 | INC B | Look up the shifted byte for the cell to the right and XOR it onto the screen. | ||||||||||||||||||||
| 47859 | LD A,(BC) | |||||||||||||||||||||
| 47860 | XOR (HL) | |||||||||||||||||||||
| 47861 | LD (HL),A | |||||||||||||||||||||
| 47862 | DEC B | |||||||||||||||||||||
| DrawNewEntityRow_Byte_8_Next | 47863 | INC DE | Move on to the next byte of pixel data. | |||||||||||||||||||
| 47864 | EX AF,AF' | Fetch the row count from AF'. | ||||||||||||||||||||
| 47865 | LD C,A | Copy the row count to C. | ||||||||||||||||||||
| 47866 | POP HL | Restore the screen address from the stack. | ||||||||||||||||||||
| 47867 | DEC H | Move up one pixel line. | ||||||||||||||||||||
| 47868 | LD A,H | A=H. | ||||||||||||||||||||
| 47869 | CPL | Flip the bits. | ||||||||||||||||||||
| 47870 | AND %00000111 | Keep only the pixel line bits (bits 0-2). | ||||||||||||||||||||
| 47872 | RET NZ | Return if the move up stayed inside the same character cell. | ||||||||||||||||||||
| 47873 | LD A,L | Subtract 32 from the low byte to move up to the previous character row. | ||||||||||||||||||||
| 47874 | SUB 32 | |||||||||||||||||||||
| 47876 | LD L,A | |||||||||||||||||||||
| 47877 | RET C | Return if the move up stayed inside the same third of the screen. | ||||||||||||||||||||
| 47878 | LD A,H | Add 8 to the high byte to move up to the previous third of the screen. | ||||||||||||||||||||
| 47879 | ADD A,8 | |||||||||||||||||||||
| 47881 | LD H,A | |||||||||||||||||||||
| 47882 | RET | Return. | ||||||||||||||||||||
|
View the equivalent code in;
|
||||||||||||||||||||||
| Prev: 47629 | Up: Map | Next: 47883 |