![]() |
Routines |
| Prev: 8A51 | Up: Map | Next: 8AE8 |
|
XOR the old (cached) image of a masked sprite off the screen and its new image on, row by row, using the remaining row counts in SpriteCachedRows (old image) and SpriteRowsLeft (new image).
|
||||||||||
|
Draw remaining rows from the current masked pair.
|
||||||||||
| MaskSprite | 8A5C | LD A,C | Jump to MaskSprite_TryShadow if the row counter is zero. | |||||||
| 8A5D | AND A | |||||||||
| 8A5E | JR Z,MaskSprite_TryShadow | |||||||||
| 8A60 | DEC C | Decrease the row counter and draw the next row of the old image. | ||||||||
| 8A61 | CALL MaskSprite_LoadMask | |||||||||
| 8A64 | EXX | Switch to the shadow registers. | ||||||||
| 8A65 | LD A,C | Jump to MaskSprite_NextSide if the shadow row counter is zero. | ||||||||
| 8A66 | AND A | |||||||||
| 8A67 | JR Z,MaskSprite_NextSide | |||||||||
| MaskSprite_Loop | 8A69 | DEC C | Decrease the shadow row counter and draw the next row of the new image. | |||||||
| 8A6A | CALL MaskSprite_LoadMaskAgain | |||||||||
| MaskSprite_NextSide | 8A6D | EXX | Switch back and loop to MaskSprite. | |||||||
| 8A6E | JR MaskSprite | |||||||||
| MaskSprite_TryShadow | 8A70 | EXX | Switch to the shadow registers. | |||||||
| 8A71 | LD A,C | Jump to MaskSprite_Loop if the shadow row counter is still live. | ||||||||
| 8A72 | AND A | |||||||||
| 8A73 | JR NZ,MaskSprite_Loop | |||||||||
|
Finish the sprite if any rows remain to be erased or drawn.
|
||||||||||
| MaskSprite_FinishSprite | 8A75 | EXX | Switch back to the normal registers. | |||||||
|
This entry point is used by the routine at DrawObjectSprite.
|
||||||||||
| MaskSprite_TestRemaining | 8A76 | LD A,($5E5A) | Return if both SpriteCachedRows and SpriteRowsLeft are zero. | |||||||
| 8A79 | LD C,A | |||||||||
| 8A7A | LD A,($5E59) | |||||||||
| 8A7D | OR C | |||||||||
| 8A7E | RET Z | |||||||||
| 8A7F | XOR A | Write 00 to SpriteCachedRows and switch register sets. | ||||||||
| 8A80 | LD ($5E5A),A | |||||||||
| 8A83 | EXX | |||||||||
| 8A84 | LD A,($5E59) | Load the remaining row count and clear A. | ||||||||
| 8A87 | LD C,A | |||||||||
| 8A88 | XOR A | |||||||||
|
This entry point is used by the routine at DrawObjectSprite.
|
||||||||||
| MaskSprite_StoreRowCount | 8A89 | LD ($5E59),A | Write the remaining row count to SpriteRowsLeft. | |||||||
| 8A8C | EXX | Switch back and loop to MaskSprite. | ||||||||
| 8A8D | JR MaskSprite | |||||||||
|
Reached by the self-modified shift (operand F2) when the mask is byte-aligned: only one screen byte is XORed.
|
||||||||||
| 8A8F | EX DE,HL | Switch the pair and jump to MaskSprite_XORSecond. | ||||||||
| 8A90 | EX (SP),HL | |||||||||
| 8A91 | JR MaskSprite_XORSecond | |||||||||
|
Load and shift the next mask byte for a row of the old image.
|
||||||||||
| MaskSprite_LoadMask | 8A93 | PUSH HL | Load the next mask byte from DE. | |||||||
| 8A94 | EX DE,HL | |||||||||
| 8A95 | PUSH DE | |||||||||
| 8A96 | LD D,$00 | |||||||||
| 8A98 | LD E,(HL) | |||||||||
| 8A99 | INC HL | |||||||||
| 8A9A | EX DE,HL | |||||||||
| MaskSprite_ShiftMask | 8A9B | JR MaskSprite_ShiftMask | Self-modifying shift. The operand is written by 8B5E. | |||||||
| 8A9D | ADD HL,HL | Shift the mask left into pixel alignment. | ||||||||
| 8A9E | ADD HL,HL | |||||||||
| 8A9F | ADD HL,HL | |||||||||
| 8AA0 | ADD HL,HL | |||||||||
| 8AA1 | ADD HL,HL | |||||||||
| 8AA2 | ADD HL,HL | |||||||||
| 8AA3 | ADD HL,HL | |||||||||
| 8AA4 | EX DE,HL | |||||||||
| MaskSprite_XORFirst | 8AA5 | EX (SP),HL | XOR the first mask byte onto the screen. | |||||||
| 8AA6 | LD A,D | |||||||||
| 8AA7 | XOR (HL) | |||||||||
| 8AA8 | LD (HL),A | |||||||||
| 8AA9 | INC L | |||||||||
| 8AAA | LD A,L | Fetch the new column. | ||||||||
| 8AAB | AND %00011111 | Keep only bits 0-4. | ||||||||
| 8AAD | JR Z,MaskSprite_MoveUp | Jump to MaskSprite_MoveUp if the row wrapped. | ||||||||
| MaskSprite_XORSecond | 8AAF | LD A,E | XOR the second mask byte onto the screen. | |||||||
| 8AB0 | XOR (HL) | |||||||||
| 8AB1 | LD (HL),A | |||||||||
|
Step the screen address up one pixel line.
|
||||||||||
| MaskSprite_MoveUp | 8AB2 | POP DE | Restore the graphic pointer and screen address. | |||||||
| 8AB3 | POP HL | |||||||||
| 8AB4 | DEC H | Move up one pixel. | ||||||||
| 8AB5 | LD A,H | |||||||||
| 8AB6 | CPL | |||||||||
| 8AB7 | AND %00000111 | Keep only bits 0-2. | ||||||||
| 8AB9 | RET NZ | Return if a character-row boundary was not crossed. | ||||||||
| 8ABA | LD A,L | Subtract 20 from the column address. | ||||||||
| 8ABB | SUB $20 | |||||||||
| 8ABD | LD L,A | |||||||||
| 8ABE | RET C | Return if that wrapped into the previous third. | ||||||||
| 8ABF | LD A,H | Add 08 to the line byte. | ||||||||
| 8AC0 | ADD A,$08 | |||||||||
| 8AC2 | LD H,A | |||||||||
| 8AC3 | RET | Return. | ||||||||
|
Reached by the self-modified shift (operand F2) when the mask is byte-aligned: only one screen byte is XORed.
|
||||||||||
| 8AC4 | EX DE,HL | Switch the pair and jump to MaskSprite_XORSecond. | ||||||||
| 8AC5 | EX (SP),HL | |||||||||
| 8AC6 | JR MaskSprite_XORSecond | |||||||||
|
Load and shift the next mask byte for a row of the new image.
|
||||||||||
| MaskSprite_LoadMaskAgain | 8AC8 | PUSH HL | Load the next mask byte from DE. | |||||||
| 8AC9 | EX DE,HL | |||||||||
| 8ACA | PUSH DE | |||||||||
| 8ACB | LD D,$00 | |||||||||
| 8ACD | LD E,(HL) | |||||||||
| 8ACE | INC HL | |||||||||
| 8ACF | EX DE,HL | |||||||||
| MaskSprite_ShiftAndPlace | 8AD0 | JR MaskSprite_ShiftAndPlace | Self-modifying shift. The operand is written by PositionMaskSprite_StoreShift. | |||||||
| 8AD2 | ADD HL,HL | Shift the mask left into pixel alignment and jump to MaskSprite_XORFirst. | ||||||||
| 8AD3 | ADD HL,HL | |||||||||
| 8AD4 | ADD HL,HL | |||||||||
| 8AD5 | ADD HL,HL | |||||||||
| 8AD6 | ADD HL,HL | |||||||||
| 8AD7 | ADD HL,HL | |||||||||
| 8AD8 | ADD HL,HL | |||||||||
| 8AD9 | EX DE,HL | |||||||||
| 8ADA | JR MaskSprite_XORFirst | |||||||||
| 8ADC | CALL PositionSprite | Call PositionSprite, clear SpriteCachedRows and jump to MaskSprite. | ||||||||
| 8ADF | EXX | |||||||||
| 8AE0 | XOR A | |||||||||
| 8AE1 | LD ($5E5A),A | |||||||||
| 8AE4 | LD C,A | |||||||||
| 8AE5 | JP MaskSprite | |||||||||
| Prev: 8A51 | Up: Map | Next: 8AE8 |