Prev: 63343 Up: Map Next: 63548
63470: Animate Intro Sprites
Used by the routine at 62700.
Iterates over the 24 three-byte entries in the sprite table at 62808 (Y pixel row at +0 X byte column at +1 attribute byte at +2) 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 (8 pixel rows vertically or 1 byte column horizontally: right across Y=0 down the right side at X=28 left across Y=160 up the left side at X=0), 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 62700.
AnimateIntroSprites 63470 LD B,24 B=24 (loop counter: 36 sprite entries).
63472 LD HL,62808 HL=62808 (attribute byte position of the first entry).
AnimateIntroSprites_Loop 63475 LD A,(HL) A=attribute byte from the current entry.
63476 EXX Switch to shadow; E=attribute byte; SET bit 7 (erase-mode flag for XorBlitSprite); switch back.
63477 LD E,A
63478 SET 7,E
63480 EXX
63481 DEC HL Back HL two bytes to the Y pixel row (start of entry).
63482 DEC HL
63483 PUSH HL Stash HL (entry start) and BC on the stack.
63484 PUSH BC
63485 CALL XorBlitSprite Call XorBlitSprite to erase the sprite at its current position.
63488 POP BC Restore BC and HL (entry start).
63489 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+1). Steps are 8 pixel rows vertically or 1 byte column horizontally. Wraps at X=28 (right boundary, drop down a row) and Y=160 (bottom boundary, scroll left).
63490 XOR A A=0.
63491 CP (HL) If Y position (*HL) = 0 jump to AnimateIntroSprites_ScrollX (top row: scroll X instead of Y).
63492 JR Z,AnimateIntroSprites_ScrollX
63494 INC HL Read X position (*(HL+1)) and compare with 0; restore HL.
63495 CP (HL)
63496 DEC HL
63497 JR NZ,AnimateIntroSprites_CheckBoundary If X!=0 jump to AnimateIntroSprites_CheckBoundary.
63499 LD A,(HL) Y −= 8 (on left side, scroll up); jump to AnimateIntroSprites_Draw.
63500 SUB 8
63502 LD (HL),A
63503 JR AnimateIntroSprites_Draw
AnimateIntroSprites_CheckBoundary 63505 LD A,160 A=160; compare with Y position.
63507 CP (HL)
63508 JR NZ,AnimateIntroSprites_ScrollDown If Y!=160 jump to AnimateIntroSprites_ScrollDown (not at bottom boundary, scroll down).
63510 INC HL X−− (at bottom boundary, scroll left); jump to AnimateIntroSprites_RestoreHL.
63511 DEC (HL)
63512 JR AnimateIntroSprites_RestoreHL
AnimateIntroSprites_DropRow 63514 DEC HL Back HL to the Y byte.
AnimateIntroSprites_ScrollDown 63515 LD A,(HL) Y += 8 (scroll down); jump to AnimateIntroSprites_Draw.
63516 ADD A,8
63518 LD (HL),A
63519 JR AnimateIntroSprites_Draw
Top row (Y=0): if X has reached the right boundary (28), drop a row (Y+=8); otherwise scroll right (X++).
AnimateIntroSprites_ScrollX 63521 INC HL Read X (*(HL+1)); if X=28 jump to AnimateIntroSprites_DropRow (drop a row); otherwise X++.
63522 LD A,(HL)
63523 CP 28
63525 JR Z,AnimateIntroSprites_DropRow
63527 INC (HL) X++ (scroll right).
AnimateIntroSprites_RestoreHL 63528 DEC HL Restore HL to the Y byte position.
AnimateIntroSprites_Draw 63529 PUSH HL Stash HL (entry start) and BC on the stack.
63530 PUSH BC
63531 EXX Switch to shadow; RES bit 7 of E (clear erase-mode flag for draw pass); switch back.
63532 RES 7,E
63534 EXX
63535 CALL XorBlitSprite Call XorBlitSprite to draw the sprite at the updated position.
63538 POP BC Restore BC and HL (entry start).
63539 POP HL
63540 INC HL Advance HL by 5 to the attribute byte of the next entry.
63541 INC HL
63542 INC HL
63543 INC HL
63544 INC HL
63545 DJNZ AnimateIntroSprites_Loop Decrease counter and loop back to AnimateIntroSprites_Loop.
63547 RET Return.
Prev: 63343 Up: Map Next: 63548