Prev: 63774 Up: Map Next: 63837
63784: Prepare the sprite tiles used by a character when lying down
Used by the routine at 63954. Builds rotated copies of the sprite tiles in the bottom four rows of the leftmost and middle columns of the character's base animatory state and places them in the slots for sprite tiles 248-255 (which are used by the animatory state of the character lying down).
Input
A Character's base animatory state
63784 OR 130 Point HL at the reference for tile 0 of the character's base animatory state
63786 LD L,A
63787 LD H,215
63789 LD E,247 The animatory states of the characters lying down use sprite tiles 248-255; initialise the tile reference counter now
63791 INC H Point HL at the next source sprite tile reference
63792 INC E Increment the tile reference counter
63793 RET Z Return if we've rotated all 8 sprite tiles
63794 LD A,E A=target sprite tile reference (248-255)
63795 CP 252 Have we just finished rotating the tiles in the leftmost column of the source sprite?
63797 JR NZ,63800 Jump if not
63799 INC H H=221 (where the reference for sprite tile 6 is located)
63800 PUSH HL Save the source sprite tile reference pointer
63801 LD D,199 Point DE at where we will place the graphic data for the rotated sprite tile
63803 LD L,(HL) L=source sprite tile reference
63804 LD B,8 There are 8 pairs of graphic and mask bytes to rotate
63806 LD H,197 Initialise the source sprite tile pointer for rotating graphic data
63808 LD A,128 Set bit 7 of A
63810 INC H Collect a pixel column from the source sprite tile's graphic data
63811 INC H
63812 RLC (HL)
63814 RRA
63815 JR NC,63810
63817 LD (DE),A Insert the pixel column of graphic data as a pixel row into the target sprite tile
63818 INC D Point DE at the corresponding pixel row of mask data in the target sprite tile
63819 LD H,198 Initialise the source sprite tile pointer for rotating mask data
63821 LD A,128 Set bit 7 of A
63823 INC H Collect a pixel column from the source sprite tile's mask data
63824 INC H
63825 RLC (HL)
63827 RRA
63828 JR NC,63823
63830 LD (DE),A Insert the pixel column of mask data as a pixel row into the target sprite tile
63831 INC D Point DE at the next pixel row of graphic data in the target sprite tile
63832 DJNZ 63806 Jump back until we've done all 8 pairs of graphic and mask bytes
63834 POP HL Restore the source sprite tile reference pointer to HL
63835 JR 63791 Jump back to build the next rotated sprite tile
Prev: 63774 Up: Map Next: 63837