![]() |
Routines |
| Prev: F76F | Up: Map | Next: F83C |
|
Used by the routine at F4EC.
Iterates over the 18 three-byte entries in the sprite table at F558 (Y pixel row at +00 X byte column at +01 attribute byte at +02) to animate the border march effect on the intro screen. For each entry, erases the sprite at its current position (calls XorBlitSprite with bit 7 of E set in shadow to suppress attribute writes), advances the position by one step along a rectangular path (08 pixel rows vertically or 01 byte column horizontally: right across Y=00 down the right side at X=1C left across Y=A0 up the left side at X=00), then redraws the sprite at the new position (calls XorBlitSprite with bit 7 clear to write the attribute). Called once per frame by the attract mode loop at F4EC.
|
||||
| AnimateIntroSprites | F7EE | LD B,$18 | B=18 (loop counter: 24 sprite entries). | |
| F7F0 | LD HL,$F558 | HL=F558 (attribute byte position of the first entry). | ||
| AnimateIntroSprites_Loop | F7F3 | LD A,(HL) | A=attribute byte from the current entry. | |
| F7F4 | EXX | Switch to shadow; E=attribute byte; SET bit 7 (erase-mode flag for XorBlitSprite); switch back. | ||
| F7F5 | LD E,A | |||
| F7F6 | SET 7,E | |||
| F7F8 | EXX | |||
| F7F9 | DEC HL | Back HL two bytes to the Y pixel row (start of entry). | ||
| F7FA | DEC HL | |||
| F7FB | PUSH HL | Stash HL (entry start) and BC on the stack. | ||
| F7FC | PUSH BC | |||
| F7FD | CALL XorBlitSprite | Call XorBlitSprite to erase the sprite at its current position. | ||
| F800 | POP BC | Restore BC and HL (entry start). | ||
| F801 | POP HL | |||
|
Advance the sprite position by one step along the rectangular border path. Y pixel row is at *(HL), X byte column at *(HL+01). Steps are 08 pixel rows vertically or 01 byte column horizontally. Wraps at X=1C (right boundary, drop down a row) and Y=A0 (bottom boundary, scroll left).
|
||||
| F802 | XOR A | A=00. | ||
| F803 | CP (HL) | If Y position (*HL) = 00 jump to AnimateIntroSprites_ScrollX (top row: scroll X instead of Y). | ||
| F804 | JR Z,AnimateIntroSprites_ScrollX | |||
| F806 | INC HL | Read X position (*(HL+01)) and compare with 00; restore HL. | ||
| F807 | CP (HL) | |||
| F808 | DEC HL | |||
| F809 | JR NZ,AnimateIntroSprites_CheckBoundary | If X!=00 jump to AnimateIntroSprites_CheckBoundary. | ||
| F80B | LD A,(HL) | Y −= 08 (on left side, scroll up); jump to AnimateIntroSprites_Draw. | ||
| F80C | SUB $08 | |||
| F80E | LD (HL),A | |||
| F80F | JR AnimateIntroSprites_Draw | |||
| AnimateIntroSprites_CheckBoundary | F811 | LD A,$A0 | A=A0; compare with Y position. | |
| F813 | CP (HL) | |||
| F814 | JR NZ,AnimateIntroSprites_ScrollDown | If Y!=A0 jump to AnimateIntroSprites_ScrollDown (not at bottom boundary, scroll down). | ||
| F816 | INC HL | X−− (at bottom boundary, scroll left); jump to AnimateIntroSprites_RestoreHL. | ||
| F817 | DEC (HL) | |||
| F818 | JR AnimateIntroSprites_RestoreHL | |||
| AnimateIntroSprites_DropRow | F81A | DEC HL | Back HL to the Y byte. | |
| AnimateIntroSprites_ScrollDown | F81B | LD A,(HL) | Y += 08 (scroll down); jump to AnimateIntroSprites_Draw. | |
| F81C | ADD A,$08 | |||
| F81E | LD (HL),A | |||
| F81F | JR AnimateIntroSprites_Draw | |||
|
Top row (Y=00): if X has reached the right boundary (1C), drop a row (Y+=08); otherwise scroll right (X++).
|
||||
| AnimateIntroSprites_ScrollX | F821 | INC HL | Read X (*(HL+01)); if X=1C jump to AnimateIntroSprites_DropRow (drop a row); otherwise X++. | |
| F822 | LD A,(HL) | |||
| F823 | CP $1C | |||
| F825 | JR Z,AnimateIntroSprites_DropRow | |||
| F827 | INC (HL) | X++ (scroll right). | ||
| AnimateIntroSprites_RestoreHL | F828 | DEC HL | Restore HL to the Y byte position. | |
| AnimateIntroSprites_Draw | F829 | PUSH HL | Stash HL (entry start) and BC on the stack. | |
| F82A | PUSH BC | |||
| F82B | EXX | Switch to shadow; RES bit 7 of E (clear erase-mode flag for draw pass); switch back. | ||
| F82C | RES 7,E | |||
| F82E | EXX | |||
| F82F | CALL XorBlitSprite | Call XorBlitSprite to draw the sprite at the updated position. | ||
| F832 | POP BC | Restore BC and HL (entry start). | ||
| F833 | POP HL | |||
| F834 | INC HL | Advance HL by 05 to the attribute byte of the next entry. | ||
| F835 | INC HL | |||
| F836 | INC HL | |||
| F837 | INC HL | |||
| F838 | INC HL | |||
| F839 | DJNZ AnimateIntroSprites_Loop | Decrease counter and loop back to AnimateIntroSprites_Loop. | ||
| F83B | RET | Return. | ||
| Prev: F76F | Up: Map | Next: F83C |