![]() |
Routines |
| Prev: 763A | Up: Map | Next: 76AB |
|
Draws one row of the sprite prepared by PrepareOldSprite by exclusive ORing it onto the screen, then moves on to the row above.
|
||||||||||||||||
|
The entry point for a sprite which is aligned to a character cell.
|
||||||||||||||||
| DrawOldSpriteRow_Aligned | 766D | EX DE,HL | DE=the row of sprite data, and HL=the address of the next row. | |||||||||||||
| 766E | EX (SP),HL | HL=the screen address, and the address of the next row of sprite data is stored on the stack. | ||||||||||||||
| 766F | JR DrawSpriteRow_Write | Jump to DrawSpriteRow_Write. | ||||||||||||||
|
This entry point is used by the routine at XORSpriteLoop.
The entry point for a sprite which is not aligned to a character cell.
|
||||||||||||||||
| DrawOldSpriteRow | 7671 | PUSH HL | Stash the screen address on the stack. | |||||||||||||
| 7672 | EX DE,HL | HL=the address of the sprite data, and DE=the screen address. | ||||||||||||||
| 7673 | PUSH DE | Stash the screen address on the stack again. | ||||||||||||||
| 7674 | LD D,(HL) | D=the first byte of the row. | ||||||||||||||
| 7675 | INC HL | Move to the next byte of sprite data. | ||||||||||||||
| 7676 | LD E,(HL) | E=the second byte of the row. | ||||||||||||||
| 7677 | INC HL | Move on to the next row of sprite data. | ||||||||||||||
| 7678 | EX DE,HL | HL=the row of sprite data, and DE=the address of the next row. | ||||||||||||||
| 7679 | XOR A | A=00. | ||||||||||||||
|
Self modifying code; the operand of this command is written by 7568. It jumps into the sequence of shifts below, so that the row is moved right by the right number of pixels.
|
||||||||||||||||
| DrawOldSpriteRow_Shift | 767A | JR DrawOldSpriteRow_Shift | Jump to the first shift to do. | |||||||||||||
|
Shift the row left by up to seven bits; the bits which are shifted out of the row end up in A.
|
||||||||||||||||
| 767C | ADD HL,HL | Shift HL left by one, moving the bit shifted out into A. | ||||||||||||||
| 767D | ADC A,A | |||||||||||||||
|
Shift the row left by up to seven bits; the bits which are shifted out of the row end up in A.
|
||||||||||||||||
| 767E | ADD HL,HL | Shift HL left by one, moving the bit shifted out into A. | ||||||||||||||
| 767F | ADC A,A | |||||||||||||||
|
Shift the row left by up to seven bits; the bits which are shifted out of the row end up in A.
|
||||||||||||||||
| 7680 | ADD HL,HL | Shift HL left by one, moving the bit shifted out into A. | ||||||||||||||
| 7681 | ADC A,A | |||||||||||||||
|
Shift the row left by up to seven bits; the bits which are shifted out of the row end up in A.
|
||||||||||||||||
| 7682 | ADD HL,HL | Shift HL left by one, moving the bit shifted out into A. | ||||||||||||||
| 7683 | ADC A,A | |||||||||||||||
|
Shift the row left by up to seven bits; the bits which are shifted out of the row end up in A.
|
||||||||||||||||
| 7684 | ADD HL,HL | Shift HL left by one, moving the bit shifted out into A. | ||||||||||||||
| 7685 | ADC A,A | |||||||||||||||
|
Shift the row left by up to seven bits; the bits which are shifted out of the row end up in A.
|
||||||||||||||||
| 7686 | ADD HL,HL | Shift HL left by one, moving the bit shifted out into A. | ||||||||||||||
| 7687 | ADC A,A | |||||||||||||||
|
Shift the row left by up to seven bits; the bits which are shifted out of the row end up in A.
|
||||||||||||||||
| 7688 | ADD HL,HL | Shift HL left by one, moving the bit shifted out into A. | ||||||||||||||
| 7689 | ADC A,A | |||||||||||||||
| 768A | EX DE,HL | DE=the shifted row, and HL=the address of the next row of sprite data. | ||||||||||||||
| 768B | EX (SP),HL | HL=the screen address, and the address of the next row of sprite data is stored on the stack. | ||||||||||||||
| 768C | XOR (HL) | Exclusive OR the first byte (in A) onto the screen. | ||||||||||||||
| 768D | LD (HL),A | Write the result to the screen. | ||||||||||||||
| 768E | INC L | Move to the next byte on the screen. | ||||||||||||||
|
This entry point is used by the routine at DrawActorSpriteRow_Aligned.
|
||||||||||||||||
| DrawSpriteRow_Write | 768F | LD A,D | Fetch the second byte. | |||||||||||||
| 7690 | XOR (HL) | Exclusive OR it onto the screen. | ||||||||||||||
| 7691 | LD (HL),A | Write the result to the screen. | ||||||||||||||
| 7692 | INC L | Move to the next byte on the screen. | ||||||||||||||
| 7693 | LD A,E | Fetch the third byte. | ||||||||||||||
| 7694 | XOR (HL) | Exclusive OR it onto the screen. | ||||||||||||||
| 7695 | LD (HL),A | Write the result to the screen. | ||||||||||||||
| 7696 | POP DE | DE=the address of the next row of sprite data. | ||||||||||||||
| 7697 | POP HL | HL=the screen address of the row which was just drawn. | ||||||||||||||
|
Move up one pixel row on the screen.
|
||||||||||||||||
| 7698 | DEC H | Move up one pixel row on the screen (decrease H by one). | ||||||||||||||
| 7699 | LD A,H | Fetch the high byte of the screen address. | ||||||||||||||
| 769A | CPL | Flip the bits. | ||||||||||||||
| 769B | AND %00000111 | Keep only bits 0-2. | ||||||||||||||
| 769D | RET NZ | Return if still inside the same character row. | ||||||||||||||
| 769E | LD A,L | Fetch the low byte of the screen address. | ||||||||||||||
| 769F | SUB $20 | Subtract 20 to move up a character row. | ||||||||||||||
| 76A1 | LD L,A | Update the low byte of the screen address. | ||||||||||||||
| 76A2 | CPL | Flip the bits. | ||||||||||||||
| 76A3 | AND %11100000 | Keep only bits 5-7. | ||||||||||||||
| 76A5 | RET Z | Return if still inside the same third of the screen. | ||||||||||||||
| 76A6 | LD A,H | Fetch the high byte of the screen address. | ||||||||||||||
| 76A7 | ADD A,$08 | Add 08. | ||||||||||||||
| 76A9 | LD H,A | Update the high byte of the screen address. | ||||||||||||||
| 76AA | RET | Return. | ||||||||||||||
| Prev: 763A | Up: Map | Next: 76AB |