![]() |
Routines |
| Prev: BA0D | Up: Map | Next: BB0B |
|
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 | BA8C | LD A,C | Copy the row count to A. | |||||||||||||||||||
| BA8D | EX AF,AF' | Store the row count in AF'. | ||||||||||||||||||||
| BA8E | LD A,(DE) | Fetch the first byte of the row. | ||||||||||||||||||||
| BA8F | LD C,A | Copy it to C to use as the index into the shift table. | ||||||||||||||||||||
| BA90 | PUSH HL | Stash the screen address on the stack. | ||||||||||||||||||||
| DrawNewEntityRow_0 | BA91 | JR DrawNewEntityRow_0 | Jump into the unrolled code. The operand of this instruction is changed by PrepDraw2. | |||||||||||||||||||
| DrawNewEntityRow_Byte_1 | BA93 | LD A,(DE) | Byte 1 of the row: look up the shifted byte for the left cell and XOR it onto the screen. | |||||||||||||||||||
| BA94 | LD C,A | |||||||||||||||||||||
| BA95 | LD A,(BC) | |||||||||||||||||||||
| BA96 | XOR (HL) | |||||||||||||||||||||
| BA97 | LD (HL),A | |||||||||||||||||||||
| BA98 | INC L | |||||||||||||||||||||
| DrawNewEntityRow_Byte_1_Right | BA99 | 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. | |||||||||||||||||||
| BA9A | LD A,(BC) | |||||||||||||||||||||
| BA9B | XOR (HL) | |||||||||||||||||||||
| BA9C | LD (HL),A | |||||||||||||||||||||
| BA9D | DEC B | |||||||||||||||||||||
| BA9E | INC DE | |||||||||||||||||||||
| DrawNewEntityRow_Byte_2 | BA9F | LD A,(DE) | Byte 2 of the row: look up the shifted byte for the left cell and XOR it onto the screen. | |||||||||||||||||||
| BAA0 | LD C,A | |||||||||||||||||||||
| BAA1 | LD A,(BC) | |||||||||||||||||||||
| BAA2 | XOR (HL) | |||||||||||||||||||||
| BAA3 | LD (HL),A | |||||||||||||||||||||
| BAA4 | INC L | |||||||||||||||||||||
| DrawNewEntityRow_Byte_2_Right | BAA5 | 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. | |||||||||||||||||||
| BAA6 | LD A,(BC) | |||||||||||||||||||||
| BAA7 | XOR (HL) | |||||||||||||||||||||
| BAA8 | LD (HL),A | |||||||||||||||||||||
| BAA9 | DEC B | |||||||||||||||||||||
| BAAA | INC DE | |||||||||||||||||||||
| DrawNewEntityRow_Byte_3 | BAAB | LD A,(DE) | Byte 3 of the row: look up the shifted byte for the left cell and XOR it onto the screen. | |||||||||||||||||||
| BAAC | LD C,A | |||||||||||||||||||||
| BAAD | LD A,(BC) | |||||||||||||||||||||
| BAAE | XOR (HL) | |||||||||||||||||||||
| BAAF | LD (HL),A | |||||||||||||||||||||
| BAB0 | INC L | |||||||||||||||||||||
| DrawNewEntityRow_Byte_3_Right | BAB1 | 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. | |||||||||||||||||||
| BAB2 | LD A,(BC) | |||||||||||||||||||||
| BAB3 | XOR (HL) | |||||||||||||||||||||
| BAB4 | LD (HL),A | |||||||||||||||||||||
| BAB5 | DEC B | |||||||||||||||||||||
| BAB6 | INC DE | |||||||||||||||||||||
| DrawNewEntityRow_Byte_4 | BAB7 | LD A,(DE) | Byte 4 of the row: look up the shifted byte for the left cell and XOR it onto the screen. | |||||||||||||||||||
| BAB8 | LD C,A | |||||||||||||||||||||
| BAB9 | LD A,(BC) | |||||||||||||||||||||
| BABA | XOR (HL) | |||||||||||||||||||||
| BABB | LD (HL),A | |||||||||||||||||||||
| BABC | INC L | |||||||||||||||||||||
| DrawNewEntityRow_Byte_4_Right | BABD | 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. | |||||||||||||||||||
| BABE | LD A,(BC) | |||||||||||||||||||||
| BABF | XOR (HL) | |||||||||||||||||||||
| BAC0 | LD (HL),A | |||||||||||||||||||||
| BAC1 | DEC B | |||||||||||||||||||||
| BAC2 | INC DE | |||||||||||||||||||||
| DrawNewEntityRow_Byte_5 | BAC3 | LD A,(DE) | Byte 5 of the row: look up the shifted byte for the left cell and XOR it onto the screen. | |||||||||||||||||||
| BAC4 | LD C,A | |||||||||||||||||||||
| BAC5 | LD A,(BC) | |||||||||||||||||||||
| BAC6 | XOR (HL) | |||||||||||||||||||||
| BAC7 | LD (HL),A | |||||||||||||||||||||
| BAC8 | INC L | |||||||||||||||||||||
| DrawNewEntityRow_Byte_5_Right | BAC9 | 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. | |||||||||||||||||||
| BACA | LD A,(BC) | |||||||||||||||||||||
| BACB | XOR (HL) | |||||||||||||||||||||
| BACC | LD (HL),A | |||||||||||||||||||||
| BACD | DEC B | |||||||||||||||||||||
| BACE | INC DE | |||||||||||||||||||||
| DrawNewEntityRow_Byte_6 | BACF | LD A,(DE) | Byte 6 of the row: look up the shifted byte for the left cell and XOR it onto the screen. | |||||||||||||||||||
| BAD0 | LD C,A | |||||||||||||||||||||
| BAD1 | LD A,(BC) | |||||||||||||||||||||
| BAD2 | XOR (HL) | |||||||||||||||||||||
| BAD3 | LD (HL),A | |||||||||||||||||||||
| BAD4 | INC L | |||||||||||||||||||||
| DrawNewEntityRow_Byte_6_Right | BAD5 | 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. | |||||||||||||||||||
| BAD6 | LD A,(BC) | |||||||||||||||||||||
| BAD7 | XOR (HL) | |||||||||||||||||||||
| BAD8 | LD (HL),A | |||||||||||||||||||||
| BAD9 | DEC B | |||||||||||||||||||||
| BADA | INC DE | |||||||||||||||||||||
| DrawNewEntityRow_Byte_7 | BADB | LD A,(DE) | Byte 7 of the row: look up the shifted byte for the left cell and XOR it onto the screen. | |||||||||||||||||||
| BADC | LD C,A | |||||||||||||||||||||
| BADD | LD A,(BC) | |||||||||||||||||||||
| BADE | XOR (HL) | |||||||||||||||||||||
| BADF | LD (HL),A | |||||||||||||||||||||
| BAE0 | INC L | |||||||||||||||||||||
| DrawNewEntityRow_Byte_7_Right | BAE1 | 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. | |||||||||||||||||||
| BAE2 | LD A,(BC) | |||||||||||||||||||||
| BAE3 | XOR (HL) | |||||||||||||||||||||
| BAE4 | LD (HL),A | |||||||||||||||||||||
| BAE5 | DEC B | |||||||||||||||||||||
| BAE6 | INC DE | |||||||||||||||||||||
| DrawNewEntityRow_Byte_8 | BAE7 | LD A,(DE) | Byte 8 of the row: look up the shifted byte for the left cell and XOR it onto the screen. | |||||||||||||||||||
| BAE8 | LD C,A | |||||||||||||||||||||
| BAE9 | LD A,(BC) | |||||||||||||||||||||
| BAEA | XOR (HL) | |||||||||||||||||||||
| BAEB | LD (HL),A | |||||||||||||||||||||
| BAEC | INC L | |||||||||||||||||||||
| DrawNewEntityRow_Byte_8_Right | BAED | LD A,L | A=L. | |||||||||||||||||||
| BAEE | AND %00011111 | Keep only bits 0-4. | ||||||||||||||||||||
| BAF0 | 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. | ||||||||||||||||||||
| BAF2 | INC B | Look up the shifted byte for the cell to the right and XOR it onto the screen. | ||||||||||||||||||||
| BAF3 | LD A,(BC) | |||||||||||||||||||||
| BAF4 | XOR (HL) | |||||||||||||||||||||
| BAF5 | LD (HL),A | |||||||||||||||||||||
| BAF6 | DEC B | |||||||||||||||||||||
| DrawNewEntityRow_Byte_8_Next | BAF7 | INC DE | Move on to the next byte of pixel data. | |||||||||||||||||||
| BAF8 | EX AF,AF' | Fetch the row count from AF'. | ||||||||||||||||||||
| BAF9 | LD C,A | Copy the row count to C. | ||||||||||||||||||||
| BAFA | POP HL | Restore the screen address from the stack. | ||||||||||||||||||||
| BAFB | DEC H | Move up one pixel line. | ||||||||||||||||||||
| BAFC | LD A,H | A=H. | ||||||||||||||||||||
| BAFD | CPL | Flip the bits. | ||||||||||||||||||||
| BAFE | AND %00000111 | Keep only the pixel line bits (bits 0-2). | ||||||||||||||||||||
| BB00 | RET NZ | Return if the move up stayed inside the same character cell. | ||||||||||||||||||||
| BB01 | LD A,L | Subtract 20 from the low byte to move up to the previous character row. | ||||||||||||||||||||
| BB02 | SUB $20 | |||||||||||||||||||||
| BB04 | LD L,A | |||||||||||||||||||||
| BB05 | RET C | Return if the move up stayed inside the same third of the screen. | ||||||||||||||||||||
| BB06 | LD A,H | Add 08 to the high byte to move up to the previous third of the screen. | ||||||||||||||||||||
| BB07 | ADD A,$08 | |||||||||||||||||||||
| BB09 | LD H,A | |||||||||||||||||||||
| BB0A | RET | Return. | ||||||||||||||||||||
|
View the equivalent code in;
|
||||||||||||||||||||||
| Prev: BA0D | Up: Map | Next: BB0B |