![]() |
Routines |
| Prev: CCF5 | Up: Map | Next: CD6B |
|
Used by the routine at DrawTerrain.
Sets up the variables for a segment of the tile, whose type is at offset 03 of the segment record. When the tile is drawn upside down the type is first changed with the table at FlipTypeTable. SetSlopeParameters then loads the three steps of the type. The routine stores a vertical step of 04 if the type has none (and so is flat), and stores the absolute values of the column and horizontal steps in ColumnStepSize and HorizontalStepSize. If the tile is upside down it moves the pixel position of a vertical segment sideways.
|
||||||||
| SetUpSegment | CD08 | LD A,($5C26) | The upside down flag. | |||||
| CD0B | AND A | Jump to SetUpSegment_Steps if A is zero. | ||||||
| CD0C | JR Z,SetUpSegment_Steps | |||||||
| CD0E | LD E,(IX+$03) | Read offset 03 of IX into E. | ||||||
| CD11 | LD D,$00 | Clear D. | ||||||
| CD13 | LD HL,$CE14 | The flip type table. | ||||||
| CD16 | ADD HL,DE | HL gains DE. | ||||||
| CD17 | LD A,(HL) | Read HL. | ||||||
| CD18 | LD (IX+$03),A | Write A to offset 03 of IX. | ||||||
| SetUpSegment_Steps | CD1B | CALL SetSlopeParameters | Call SetSlopeParameters. | |||||
| CD1E | LD A,($CE37) | The vertical step. | ||||||
| CD21 | LD ($CE5A),A | Update the vertical step copy. | ||||||
| CD24 | AND A | Jump to SetUpSegment_Column if A is not zero. | ||||||
| CD25 | JR NZ,SetUpSegment_Column | |||||||
| CD27 | OR %00000100 | Set the bits of A that are set in 04. | ||||||
| CD29 | LD ($CE5A),A | Update the vertical step copy. | ||||||
| SetUpSegment_Column | CD2C | LD A,($CE36) | The column step. | |||||
| CD2F | LD ($5C24),A | Update the column step size. | ||||||
| CD32 | LD A,($CE35) | The horizontal step. | ||||||
| CD35 | LD ($CE59),A | Update the horizontal step copy. | ||||||
| CD38 | AND A | Jump to SetUpSegment_Absolute if A is not zero. | ||||||
| CD39 | JR NZ,SetUpSegment_Absolute | |||||||
| CD3B | LD A,($E41B) | The slope direction. | ||||||
| CD3E | NEG | Negate A. | ||||||
| CD40 | ADD A,A | Double A. | ||||||
| CD41 | ADD A,A | Double A. | ||||||
| CD42 | ADD A,A | Double A. | ||||||
| CD43 | LD B,A | B=A. | ||||||
| SetUpSegment_Absolute | CD44 | LD ($5C25),A | Update the horizontal step size. | |||||
| CD47 | BIT 7,A | Jump to SetUpSegment_Flip if bit 7 of A is clear. | ||||||
| CD49 | JR Z,SetUpSegment_Flip | |||||||
| CD4B | NEG | Negate A. | ||||||
| CD4D | LD ($5C25),A | Update the horizontal step size. | ||||||
| CD50 | LD A,($5C24) | The column step size. | ||||||
| CD53 | NEG | Negate A. | ||||||
| CD55 | LD ($5C24),A | Update the column step size. | ||||||
| SetUpSegment_Flip | CD58 | LD A,($5C26) | The upside down flag. | |||||
| CD5B | CP $99 | Return if A is not 99. | ||||||
| CD5D | RET NZ | |||||||
| CD5E | LD A,($CE59) | The horizontal step copy. | ||||||
| CD61 | AND A | Return if A is not zero. | ||||||
| CD62 | RET NZ | |||||||
| CD63 | LD A,($CE43) | The segment column. | ||||||
| CD66 | ADD A,B | A gains B. | ||||||
| CD67 | LD ($CE43),A | Update the segment column. | ||||||
| CD6A | RET | Return. | ||||||
| Prev: CCF5 | Up: Map | Next: CD6B |