![]() |
Routines |
| Prev: 975B | Up: Map | Next: 9867 |
|
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_Jump, which is changed by PrepDraw2.
|
||||||||||||||||||||||
| DrawNewEntityRow | 97E1 | LD A,C | Copy the row count to A. | |||||||||||||||||||
| 97E2 | EX AF,AF' | Store the row count in AF'. | ||||||||||||||||||||
| 97E3 | LD A,(DE) | Fetch the first byte of the row. | ||||||||||||||||||||
| 97E4 | LD C,A | Copy it to C to use as the index into the shift table. | ||||||||||||||||||||
| 97E5 | PUSH HL | Stash the screen address on the stack. | ||||||||||||||||||||
| DrawNewEntityRow_Jump | 97E6 | JR DrawNewEntityRow_Jump | Jump into the unrolled code. The operand of this instruction is changed by PrepDraw2. | |||||||||||||||||||
| DrawNewEntityRow_Byte_1 | 97E8 | LD A,(DE) | Byte 1 of the row: look up the shifted byte for the left cell and XOR it onto the screen. | |||||||||||||||||||
| 97E9 | LD C,A | |||||||||||||||||||||
| 97EA | LD A,(BC) | |||||||||||||||||||||
| 97EB | XOR (HL) | |||||||||||||||||||||
| 97EC | LD (HL),A | |||||||||||||||||||||
| 97ED | INC L | |||||||||||||||||||||
| DrawNewEntityRow_Byte_1_Right | 97EE | 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. | |||||||||||||||||||
| 97EF | LD A,(BC) | |||||||||||||||||||||
| 97F0 | XOR (HL) | |||||||||||||||||||||
| 97F1 | LD (HL),A | |||||||||||||||||||||
| 97F2 | DEC B | |||||||||||||||||||||
| 97F3 | INC DE | |||||||||||||||||||||
| DrawNewEntityRow_Byte_2 | 97F4 | LD A,(DE) | Byte 2 of the row: look up the shifted byte for the left cell and XOR it onto the screen. | |||||||||||||||||||
| 97F5 | LD C,A | |||||||||||||||||||||
| 97F6 | LD A,(BC) | |||||||||||||||||||||
| 97F7 | XOR (HL) | |||||||||||||||||||||
| 97F8 | LD (HL),A | |||||||||||||||||||||
| 97F9 | INC L | |||||||||||||||||||||
| DrawNewEntityRow_Byte_2_Right | 97FA | 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. | |||||||||||||||||||
| 97FB | LD A,(BC) | |||||||||||||||||||||
| 97FC | XOR (HL) | |||||||||||||||||||||
| 97FD | LD (HL),A | |||||||||||||||||||||
| 97FE | DEC B | |||||||||||||||||||||
| 97FF | INC DE | |||||||||||||||||||||
| DrawNewEntityRow_Byte_3 | 9800 | LD A,(DE) | Byte 3 of the row: look up the shifted byte for the left cell and XOR it onto the screen. | |||||||||||||||||||
| 9801 | LD C,A | |||||||||||||||||||||
| 9802 | LD A,(BC) | |||||||||||||||||||||
| 9803 | XOR (HL) | |||||||||||||||||||||
| 9804 | LD (HL),A | |||||||||||||||||||||
| 9805 | INC L | |||||||||||||||||||||
| DrawNewEntityRow_Byte_3_Right | 9806 | 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. | |||||||||||||||||||
| 9807 | LD A,(BC) | |||||||||||||||||||||
| 9808 | XOR (HL) | |||||||||||||||||||||
| 9809 | LD (HL),A | |||||||||||||||||||||
| 980A | DEC B | |||||||||||||||||||||
| 980B | INC DE | |||||||||||||||||||||
| DrawNewEntityRow_Byte_4 | 980C | LD A,(DE) | Byte 4 of the row: look up the shifted byte for the left cell and XOR it onto the screen. | |||||||||||||||||||
| 980D | LD C,A | |||||||||||||||||||||
| 980E | LD A,(BC) | |||||||||||||||||||||
| 980F | XOR (HL) | |||||||||||||||||||||
| 9810 | LD (HL),A | |||||||||||||||||||||
| 9811 | INC L | |||||||||||||||||||||
| DrawNewEntityRow_Byte_4_Right | 9812 | 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. | |||||||||||||||||||
| 9813 | LD A,(BC) | |||||||||||||||||||||
| 9814 | XOR (HL) | |||||||||||||||||||||
| 9815 | LD (HL),A | |||||||||||||||||||||
| 9816 | DEC B | |||||||||||||||||||||
| 9817 | INC DE | |||||||||||||||||||||
| DrawNewEntityRow_Byte_5 | 9818 | LD A,(DE) | Byte 5 of the row: look up the shifted byte for the left cell and XOR it onto the screen. | |||||||||||||||||||
| 9819 | LD C,A | |||||||||||||||||||||
| 981A | LD A,(BC) | |||||||||||||||||||||
| 981B | XOR (HL) | |||||||||||||||||||||
| 981C | LD (HL),A | |||||||||||||||||||||
| 981D | INC L | |||||||||||||||||||||
| DrawNewEntityRow_Byte_5_Right | 981E | 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. | |||||||||||||||||||
| 981F | LD A,(BC) | |||||||||||||||||||||
| 9820 | XOR (HL) | |||||||||||||||||||||
| 9821 | LD (HL),A | |||||||||||||||||||||
| 9822 | DEC B | |||||||||||||||||||||
| 9823 | INC DE | |||||||||||||||||||||
| DrawNewEntityRow_Byte_6 | 9824 | LD A,(DE) | Byte 6 of the row: look up the shifted byte for the left cell and XOR it onto the screen. | |||||||||||||||||||
| 9825 | LD C,A | |||||||||||||||||||||
| 9826 | LD A,(BC) | |||||||||||||||||||||
| 9827 | XOR (HL) | |||||||||||||||||||||
| 9828 | LD (HL),A | |||||||||||||||||||||
| 9829 | INC L | |||||||||||||||||||||
| DrawNewEntityRow_Byte_6_Right | 982A | 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. | |||||||||||||||||||
| 982B | LD A,(BC) | |||||||||||||||||||||
| 982C | XOR (HL) | |||||||||||||||||||||
| 982D | LD (HL),A | |||||||||||||||||||||
| 982E | DEC B | |||||||||||||||||||||
| 982F | INC DE | |||||||||||||||||||||
| DrawNewEntityRow_Byte_7 | 9830 | LD A,(DE) | Byte 7 of the row: look up the shifted byte for the left cell and XOR it onto the screen. | |||||||||||||||||||
| 9831 | LD C,A | |||||||||||||||||||||
| 9832 | LD A,(BC) | |||||||||||||||||||||
| 9833 | XOR (HL) | |||||||||||||||||||||
| 9834 | LD (HL),A | |||||||||||||||||||||
| 9835 | INC L | |||||||||||||||||||||
| DrawNewEntityRow_Byte_7_Right | 9836 | 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. | |||||||||||||||||||
| 9837 | LD A,(BC) | |||||||||||||||||||||
| 9838 | XOR (HL) | |||||||||||||||||||||
| 9839 | LD (HL),A | |||||||||||||||||||||
| 983A | DEC B | |||||||||||||||||||||
| 983B | INC DE | |||||||||||||||||||||
| DrawNewEntityRow_Byte_8 | 983C | LD A,(DE) | Byte 8 of the row: look up the shifted byte for the left cell and XOR it onto the screen. | |||||||||||||||||||
| 983D | LD C,A | |||||||||||||||||||||
| 983E | LD A,(BC) | |||||||||||||||||||||
| 983F | XOR (HL) | |||||||||||||||||||||
| 9840 | LD (HL),A | |||||||||||||||||||||
| 9841 | INC L | |||||||||||||||||||||
| DrawNewEntityRow_Byte_8_Right | 9842 | 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. | |||||||||||||||||||
| 9843 | LD A,(BC) | |||||||||||||||||||||
| 9844 | XOR (HL) | |||||||||||||||||||||
| 9845 | LD (HL),A | |||||||||||||||||||||
| 9846 | DEC B | |||||||||||||||||||||
| 9847 | INC DE | |||||||||||||||||||||
| DrawNewEntityRow_Byte_9 | 9848 | LD A,(DE) | Byte 9 of the row: look up the shifted byte for the left cell and XOR it onto the screen. | |||||||||||||||||||
| 9849 | LD C,A | |||||||||||||||||||||
| 984A | LD A,(BC) | |||||||||||||||||||||
| 984B | XOR (HL) | |||||||||||||||||||||
| 984C | LD (HL),A | |||||||||||||||||||||
| 984D | INC L | |||||||||||||||||||||
| DrawNewEntityRow_Byte_9_Right | 984E | 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. | |||||||||||||||||||
| 984F | LD A,(BC) | |||||||||||||||||||||
| 9850 | XOR (HL) | |||||||||||||||||||||
| 9851 | LD (HL),A | |||||||||||||||||||||
| 9852 | DEC B | |||||||||||||||||||||
| 9853 | INC DE | |||||||||||||||||||||
| DrawNewEntityRow_Byte_9_Next | 9854 | EX AF,AF' | Fetch the row count from AF'. | |||||||||||||||||||
| 9855 | LD C,A | Copy the row count to C. | ||||||||||||||||||||
| 9856 | POP HL | Restore the screen address from the stack. | ||||||||||||||||||||
| 9857 | DEC H | Move up one pixel line. | ||||||||||||||||||||
| 9858 | LD A,H | Fetch the inverse of the high byte of the address in A. | ||||||||||||||||||||
| 9859 | CPL | |||||||||||||||||||||
| 985A | AND %00000111 | Keep only the pixel line bits (bits 0-2). | ||||||||||||||||||||
| 985C | RET NZ | Return if the move up stayed inside the same character cell. | ||||||||||||||||||||
| 985D | LD A,L | Subtract 20 from the low byte to move up to the previous character row. | ||||||||||||||||||||
| 985E | SUB $20 | |||||||||||||||||||||
| 9860 | LD L,A | |||||||||||||||||||||
| 9861 | RET C | Return if the move up stayed inside the same third of the screen. | ||||||||||||||||||||
| 9862 | LD A,H | Add 08 to the high byte to move up to the previous third of the screen. | ||||||||||||||||||||
| 9863 | ADD A,$08 | |||||||||||||||||||||
| 9865 | LD H,A | |||||||||||||||||||||
| 9866 | RET | Return. | ||||||||||||||||||||
|
View the equivalent code in;
|
||||||||||||||||||||||
| Prev: 975B | Up: Map | Next: 9867 |