Prev: F8E2 Up: Map Next: F9AC
F939: Build Shifted Shape B
Used by the routine at BuildShapeTables.
Merges a description of a shape into the buffers, once for each of the three shifts, using the second format. The description starts with the number of strips, the number of rows and the number of bytes in a row. Each row is merged into the buffer next to the chequered background. When the flag at HorizontalStepSize is set the background is merged differently, as the shape is back to front.
Input
HL Address of the description
HL' Address of the buffer for the shifted shape
BuildShiftedShapeB F939 CALL ReadShapeHeader Call ReadShapeHeader.
BuildShiftedShapeB_Shift F93C PUSH HL Stash HL on the stack.
BuildShiftedShapeB_Row F93D LD B,C B=C.
F93E LD A,($5C25) The back-to-front flag.
F941 AND A Jump to BuildShiftedShapeB_Merge if A is zero.
F942 JR Z,BuildShiftedShapeB_Merge
F944 LD E,$55 E=55.
F946 INC D Advance D.
F947 LD A,(DE) Read DE.
F948 DEC D Step D back.
F949 EXX Switch to the alternate registers.
F94A OR (HL) Set the bits of A that are set in the byte at HL.
F94B LD (HL),A Write A where HL points.
F94C EXX Switch to the alternate registers.
BuildShiftedShapeB_Merge F94D CALL MergeShiftedByte Call MergeShiftedByte.
F950 INC HL Advance HL.
F951 DJNZ BuildShiftedShapeB_Merge Decrease B and jump to BuildShiftedShapeB_Merge until none remain.
F953 LD A,($5C25) The back-to-front flag.
F956 AND A Jump to BuildShiftedShapeB_Background if A is zero.
F957 JR Z,BuildShiftedShapeB_Background
F959 EXX Switch to the alternate registers.
F95A INC HL Advance HL.
F95B EXX Switch to the alternate registers.
F95C JR BuildShiftedShapeB_Strip Jump to BuildShiftedShapeB_Strip.
BuildShiftedShapeB_Background F95E CALL MergeBackgroundByte Call MergeBackgroundByte.
BuildShiftedShapeB_Strip F961 LD A,($5C1E) The strips still to merge.
F964 DEC A Step A back.
F965 LD ($5C1E),A The strips still to merge.
F968 JR Z,BuildShiftedShapeB_Reload Jump to BuildShiftedShapeB_Reload if the zero flag is set.
F96A LD A,($5C25) The back-to-front flag.
F96D AND A Jump to BuildShiftedShapeB_Second if A is not zero.
F96E JR NZ,BuildShiftedShapeB_Second
F970 LD E,$AA E=AA.
F972 LD A,(DE) Read DE.
F973 CALL MergeNextShiftedByte_Merge Call MergeNextShiftedByte_Merge.
BuildShiftedShapeB_Second F976 LD B,C B=C.
BuildShiftedShapeB_Bytes F977 CALL FetchShiftedByte_Byte Call FetchShiftedByte_Byte.
F97A CALL MergeBackgroundByte_Merge Call MergeBackgroundByte_Merge.
F97D CALL MergeNextShiftedByte Call MergeNextShiftedByte.
F980 DJNZ BuildShiftedShapeB_Bytes Decrease B and jump to BuildShiftedShapeB_Bytes until none remain.
F982 LD A,($5C25) The back-to-front flag.
F985 AND A Is A zero?
F986 EXX Switch to the alternate registers.
F987 JR Z,BuildShiftedShapeB_Advance Jump to BuildShiftedShapeB_Advance if the zero flag is set.
F989 EXX Switch to the alternate registers.
F98A LD E,$AA E=AA.
F98C INC D Advance D.
F98D LD A,(DE) Read DE.
F98E DEC D Step D back.
F98F EXX Switch to the alternate registers.
F990 OR (HL) Set the bits of A that are set in the byte at HL.
F991 LD (HL),A Write A where HL points.
BuildShiftedShapeB_Advance F992 INC HL Advance HL.
F993 EXX Switch to the alternate registers.
F994 JR BuildShiftedShapeB_Count Jump to BuildShiftedShapeB_Count.
BuildShiftedShapeB_Reload F996 LD A,($5C1F) The number of strips.
F999 LD ($5C1E),A The number of strips.
BuildShiftedShapeB_Count F99C LD A,($5C1C) The rows still to merge.
F99F DEC A Step A back.
F9A0 LD ($5C1C),A The rows still to merge.
F9A3 JR NZ,BuildShiftedShapeB_Row Jump to BuildShiftedShapeB_Row if the zero flag is clear.
F9A5 POP HL Bring HL back off the stack.
F9A6 CALL NextShift Call NextShift.
F9A9 JR NZ,BuildShiftedShapeB_Shift Jump to BuildShiftedShapeB_Shift if the zero flag is clear.
F9AB RET Return.
Prev: F8E2 Up: Map Next: F9AC