25618: Prepare sprite tiles used by Sam when somersaulting or rolling
Used by the routine at 25789. Animatory states 9, 10, 15 and 31 - corresponding to the sprites of Sam rolling and somersaulting - use sprite tiles 239-247. These sprite tiles are initialised before Sam starts his acrobatic manoeuvre, and later rotated as he moves through each phase of animation.
Superimpose sprite tile 205 from base page 215 over sprite tile 243 (which is currently a copy of sprite tile 6, the centre tile of Sam's base animatory state); this makes Sam appear to bend his arms and hold his knees while performing the acrobatic feat, at the expense of losing some detail from his current disguise
25655
LD HL,55245
25658
LD DE,51187
25661
LD A,(DE)
25662
OR (HL)
25663
INC H
25664
AND (HL)
25665
INC H
25666
LD (DE),A
25667
INC D
25668
LD (DE),A
25669
INC D
25670
DJNZ 25661
This entry point is used by the routine at 25789. Here we rotate sprite tiles 239-247 and store the results in sprite tile slots 238-246.
25672
LD L,239
Tile 239 is the first source tile
25674
LD E,L
E=238 (the first target tile)
25675
DEC E
25676
LD D,199
The base page for these tiles is 199
25678
LD B,8
Rotate the source sprite tile 90 degrees anticlockwise and copy it over the target sprite tile
25680
LD H,198
25682
LD C,1
25684
INC H
25685
RRC (HL)
25687
RLA
25688
INC H
25689
RRC (HL)
25691
RL C
25693
JR NC,25684
25695
LD (DE),A
25696
INC D
25697
LD A,C
25698
LD (DE),A
25699
INC D
25700
DJNZ 25680
25702
INC L
Move to the next source sprite tile reference
25703
BIT 3,L
Have we rotated sprite tiles 239-247 yet?
25705
JR Z,25674
Jump back if not
Next we move sprite tiles 238-246 up to 239-247.
25707
LD A,16
There are 16 bytes of graphic and mask data in each tile