| Routines

F928: Prepare the sprite tiles used by a character when lying down

Used by the routine at F9D2. 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 0xF8-0xFF (which are used by the animatory state of the character lying down).
Input
A | Character's base animatory state
F928 | OR $82 | Point HL at the reference for tile 0 of the character's base animatory state
F92A | LD L,A
F92B | LD H,$D7
F92D | LD E,$F7 | The animatory states of the characters lying down use sprite tiles 0xF8-0xFF; initialise the tile reference counter now
F92F | INC H | Point HL at the next source sprite tile reference
F930 | INC E | Increment the tile reference counter
F931 | RET Z | Return if we've rotated all 8 sprite tiles
F932 | LD A,E | A=target sprite tile reference (0xF8-0xFF)
F933 | CP $FC | Have we just finished rotating the tiles in the leftmost column of the source sprite?
F935 | JR NZ,$F938 | Jump if not
F937 | INC H | H=0xDD (where the reference for sprite tile 6 is located)
F938 | PUSH HL | Save the source sprite tile reference pointer
F939 | LD D,$C7 | Point DE at where we will place the graphic data for the rotated sprite tile
F93B | LD L,(HL) | L=source sprite tile reference
F93C | LD B,$08 | There are 8 pairs of graphic and mask bytes to rotate
F93E | LD H,$C5 | Initialise the source sprite tile pointer for rotating graphic data
F940 | LD A,$80 | Set bit 7 of A
F942 | INC H | Collect a pixel column from the source sprite tile's graphic data
F943 | INC H
F944 | RLC (HL)
F946 | RRA
F947 | JR NC,$F942
F949 | LD (DE),A | Insert the pixel column of graphic data as a pixel row into the target sprite tile
F94A | INC D | Point DE at the corresponding pixel row of mask data in the target sprite tile
F94B | LD H,$C6 | Initialise the source sprite tile pointer for rotating mask data
F94D | LD A,$80 | Set bit 7 of A
F94F | INC H | Collect a pixel column from the source sprite tile's mask data
F950 | INC H
F951 | RLC (HL)
F953 | RRA
F954 | JR NC,$F94F
F956 | LD (DE),A | Insert the pixel column of mask data as a pixel row into the target sprite tile
F957 | INC D | Point DE at the next pixel row of graphic data in the target sprite tile
F958 | DJNZ $F93E | Jump back until we've done all 8 pairs of graphic and mask bytes
F95A | POP HL | Restore the source sprite tile reference pointer to HL
F95B | JR $F92F | Jump back to build the next rotated sprite tile