![]() |
Routines |
| Prev: 54019 | Up: Map | Next: 54226 |
|
Used by the routine at FinishStep.
Moves to the next step of a segment: the pixel row goes up by the vertical step and the pixel column along by the horizontal step. Then the step is tested against the position at PositionAcross and PositionDown, and the flags in ContactFlags are set to say where they are in relation to each other.
|
||||
| NextStep | 54041 | LD A,(52791) | The vertical step. | |
| 54044 | LD B,A | B=A. | ||
| 54045 | LD A,(52804) | The segment row. | ||
| 54048 | SUB B | Subtract B from A. | ||
| 54049 | LD (52804),A | Update the segment row. | ||
| 54052 | LD A,(23597) | The segment screen row. | ||
| 54055 | SUB B | Subtract B from A. | ||
| 54056 | LD (23597),A | Update the segment screen row. | ||
| 54059 | LD A,(52789) | The horizontal step. | ||
| 54062 | LD B,A | B=A. | ||
| 54063 | LD A,(23596) | The segment screen column. | ||
| 54066 | ADD A,B | A gains B. | ||
| 54067 | LD (23596),A | Update the segment screen column. | ||
| 54070 | LD A,(52803) | The segment column. | ||
| 54073 | ADD A,B | A gains B. | ||
| 54074 | LD (52803),A | Update the segment column. | ||
|
This entry point is used by the routine at DrawTerrain.
Test the row. Rows that are above the position are drawn, a step at the same row is flagged by FlagFloorContact or FlagCeilingContact, and steps below the position are skipped.
|
||||
| NextStep_Test | 54077 | XOR A | Clear A. | |
| 54078 | LD (23601),A | Update the contact flags. | ||
| 54081 | LD A,(23581) | The tile number. | ||
| 54084 | BIT 0,A | Jump to NextStep_Bottom if bit 0 of A is set. | ||
| 54086 | JR NZ,NextStep_Bottom | |||
| 54088 | LD A,(52804) | The segment row. | ||
| 54091 | LD B,A | B=A. | ||
| 54092 | LD A,(52806) | The position down. | ||
| 54095 | CP B | Jump to FlagCeilingContact if A is B. | ||
| 54096 | JP Z,FlagCeilingContact | |||
| 54099 | JP NC,FinishStep_Next | Jump to FinishStep_Next if the carry flag is clear. | ||
| 54102 | JP NextStep_Column | Jump to NextStep_Column. | ||
| NextStep_Bottom | 54105 | LD A,(52826) | The vertical step copy. | |
| 54108 | LD B,A | B=A. | ||
| 54109 | LD A,(52804) | The segment row. | ||
| 54112 | SUB B | Subtract B from A. | ||
| 54113 | LD B,A | B=A. | ||
| 54114 | LD A,(52806) | The position down. | ||
| 54117 | CP B | Jump to FinishStep_Next if A is less than B. | ||
| 54118 | JP C,FinishStep_Next | |||
| 54121 | JP Z,FlagFloorContact | Jump to FlagFloorContact if the zero flag is set. | ||
|
This entry point is used by the routines at FlagFloorContact and FlagCeilingContact.
Test the column in the same way, with FlagLeftContact and FlagRightContact for the same column.
|
||||
| NextStep_Column | 54124 | LD A,(52803) | The segment column. | |
| 54127 | LD B,A | B=A. | ||
| 54128 | LD A,(23581) | The tile number. | ||
| 54131 | BIT 1,A | Jump to NextStep_Right if bit 1 of A is set. | ||
| 54133 | JR NZ,NextStep_Right | |||
| 54135 | LD A,(52791) | The vertical step. | ||
| 54138 | AND A | Jump to NextStep_Width if A is not zero. | ||
| 54139 | JR NZ,NextStep_Width | |||
| 54141 | LD A,(52801) | The horizontal offset. | ||
| 54144 | ADD A,B | A gains B. | ||
| 54145 | CP 240 | Jump to NextStep_Width if A is less than 240. | ||
| 54147 | JR C,NextStep_Width | |||
| 54149 | JP Z,FlagLeftContact | Jump to FlagLeftContact if the zero flag is set. | ||
| 54152 | CP 247 | Jump to NextStep_Width if A is 247 or more. | ||
| 54154 | JR NC,NextStep_Width | |||
| 54156 | LD A,C | A=C. | ||
| 54157 | DEC A | Step A back. | ||
| 54158 | JP NZ,FinishStep_Next | Jump to FinishStep_Next if the zero flag is clear. | ||
| 54161 | DEC A | Step A back. | ||
| 54162 | LD (55389),A | Update the edge flag. | ||
| NextStep_Width | 54165 | LD A,(23589) | The horizontal step size. | |
| 54168 | ADD A,B | A gains B. | ||
| 54169 | LD B,A | B=A. | ||
| 54170 | LD A,(52805) | The position across. | ||
| 54173 | CP B | Jump to FlagLeftContact if A is B. | ||
| 54174 | JP Z,FlagLeftContact | |||
| 54177 | JP NC,FinishStep_Next | Jump to FinishStep_Next if the carry flag is clear. | ||
| 54180 | JR NextStep_Flags | Jump to NextStep_Flags. | ||
| NextStep_Right | 54182 | LD A,(52805) | The position across. | |
| 54185 | CP B | Jump to FlagRightContact if A is B. | ||
| 54186 | JP Z,FlagRightContact | |||
| 54189 | JP C,FinishStep_Next | Jump to FinishStep_Next if the carry flag is set. | ||
|
This entry point is used by the routines at FlagLeftContact and FlagRightContact.
If any of the flags have been set the step is handled by one of the routines for contact. Otherwise the step is drawn.
|
||||
| NextStep_Flags | 54192 | LD A,(23601) | The contact flags. | |
| 54195 | AND A | Jump to SetUpPiece if A is zero. | ||
| 54196 | JR Z,SetUpPiece | |||
| 54198 | CP 8 | Jump to NoteWallContact if A is 8. | ||
| 54200 | JP Z,NoteWallContact | |||
| 54203 | CP 4 | Jump to NoteWallContact if A is 4. | ||
| 54205 | JP Z,NoteWallContact | |||
| 54208 | CP 1 | Jump to CountVerticalContact if A is 1. | ||
| 54210 | JP Z,CountVerticalContact | |||
| 54213 | CP 2 | Jump to CountVerticalContact if A is 2. | ||
| 54215 | JP Z,CountVerticalContact | |||
| 54218 | AND %00001111 | Keep the bits of A that are set in 15. | ||
| 54220 | JP NZ,CountVerticalContact | Jump to CountVerticalContact if the zero flag is clear. | ||
| 54223 | JP FinishStep_Next | Jump to FinishStep_Next. | ||
| Prev: 54019 | Up: Map | Next: 54226 |