Prev: F8D0 Up: Map Next: F939
F8E2: Build Shifted Shape A
Used by the routine at BuildShapeTables.
Merges a description of a shape into the buffers, once for each of the three shifts, using the first of the two formats. The description starts with the number of rows and the number of bytes in a row; the rows follow. Each row is merged into the buffer, with the byte that is left over at the end of the row from the shifted bytes, and the buffer moves on 30 bytes after each shift.
Input
HL Address of the description
HL' Address of the buffer for the shifted shape
BuildShiftedShapeA F8E2 CALL ReadShapeHeader_Rows Call ReadShapeHeader_Rows.
BuildShiftedShapeA_Shift F8E5 PUSH HL Stash HL on the stack.
BuildShiftedShapeA_Row F8E6 LD B,C B=C.
F8E7 INC B Advance B.
BuildShiftedShapeA_Merge F8E8 CALL MergeShiftedByte Call MergeShiftedByte.
F8EB INC HL Advance HL.
F8EC DJNZ BuildShiftedShapeA_Merge Decrease B and jump to BuildShiftedShapeA_Merge until none remain.
F8EE EXX Switch to the alternate registers.
F8EF LD (HL),$00 Store 00 at the address in HL.
F8F1 DEC HL Step HL back.
F8F2 DEC HL Step HL back.
F8F3 DEC HL Step HL back.
F8F4 OR (HL) Set the bits of A that are set in the byte at HL.
F8F5 LD (HL),A Write A where HL points.
F8F6 INC HL Advance HL.
F8F7 INC HL Advance HL.
F8F8 INC HL Advance HL.
F8F9 EXX Switch to the alternate registers.
F8FA CALL FetchShiftedByte_Count Call FetchShiftedByte_Count.
F8FD LD ($5C20),A Update the segments still to draw.
BuildShiftedShapeA_Next F900 INC B Advance B.
BuildShiftedShapeA_Loop F901 CALL MergeNextShiftedByte Call MergeNextShiftedByte.
F904 CALL FetchShiftedByte_Byte Call FetchShiftedByte_Byte.
F907 CALL MergeBackgroundByte_Merge Call MergeBackgroundByte_Merge.
F90A DJNZ BuildShiftedShapeA_Loop Decrease B and jump to BuildShiftedShapeA_Loop until none remain.
F90C INC D Advance D.
F90D LD A,(DE) Read DE.
F90E DEC D Step D back.
F90F EXX Switch to the alternate registers.
F910 DEC HL Step HL back.
F911 XOR (HL) Flip the bits of A that are set in the byte at HL.
F912 LD (HL),A Write A where HL points.
F913 LD A,($5C20) The segments still to draw.
F916 CALL MergeBackgroundByte_Store Call MergeBackgroundByte_Store.
F919 LD A,($5C1C) The number of rows.
F91C DEC A Step A back.
F91D LD ($5C1C),A One fewer row of the shifted shape.
F920 JR NZ,BuildShiftedShapeA_Row Jump to BuildShiftedShapeA_Row if the zero flag is clear.
F922 CALL NextShift_Rows Call NextShift_Rows.
F925 EXX Switch to the alternate registers.
F926 LD DE,$0030 DE=30.
F929 ADD HL,DE HL gains DE.
F92A EXX Switch to the alternate registers.
F92B POP HL Bring HL back off the stack.
F92C JR NZ,BuildShiftedShapeA_Shift Jump to BuildShiftedShapeA_Shift if the zero flag is clear.
F92E LD A,$5C A=5C.
F930 LD ($EB34),A Purpose not yet known.
F933 LD A,$40 A=40.
F935 LD ($EC30),A Purpose not yet known.
F938 RET Return.
Prev: F8D0 Up: Map Next: F939