![]() |
Routines |
| Prev: DF34 | Up: Map | Next: DFFA |
|
Tests the move of an object that is facing to the left (along the negative X axis), in the same way as TestMoveUp. The front edge is at the X position minus the half width of the object, and it is tested from the top corner to the bottom corner. Each cell is tested by TestCellMovingLeft.
|
||||||||||||
| TestMoveLeft | DF97 | LD L,(IX+$01) | Fetch the X position of the object. | |||||||||
| DF9A | LD H,(IX+$02) | |||||||||||
| DF9D | LD C,(IX+$08) | Fetch the half width of the object. | ||||||||||
| DFA0 | LD B,$00 | |||||||||||
| DFA2 | AND A | Subtract it to get the front edge, and keep it in DE. | ||||||||||
| DFA3 | SBC HL,BC | |||||||||||
| DFA5 | EX DE,HL | |||||||||||
| DFA6 | LD L,(IX+$03) | Fetch the Y position of the object. | ||||||||||
| DFA9 | LD H,(IX+$04) | |||||||||||
| DFAC | LD C,(IX+$09) | Fetch the half depth of the object. | ||||||||||
| DFAF | AND A | Subtract it to get the first side edge. | ||||||||||
| DFB0 | SBC HL,BC | |||||||||||
| DFB2 | PUSH DE | Save the edges. | ||||||||||
| DFB3 | PUSH HL | |||||||||||
| DFB4 | CALL TestCellMovingLeft | Check whether the first corner of the front edge hits a wall. | ||||||||||
| DFB7 | POP HL | Get the edges back, with the registers swapped over. | ||||||||||
| DFB8 | POP DE | |||||||||||
| DFB9 | RET C | Return if the object hit a wall. | ||||||||||
| DFBA | PUSH DE | Save the edges again. | ||||||||||
| DFBB | PUSH HL | |||||||||||
| DFBC | LD C,(IX+$09) | Work out the depth of the object. | ||||||||||
| DFBF | SLA C | |||||||||||
| DFC1 | LD B,$00 | |||||||||||
| DFC3 | LD A,H | Work out the second side edge. | ||||||||||
| DFC4 | ADD HL,BC | |||||||||||
| DFC5 | CP H | Jump to TestMoveLeft_SameCell if the second side edge is in the same cell as the first. | ||||||||||
| DFC6 | JR Z,TestMoveLeft_SameCell | |||||||||||
| DFC8 | CALL TestCellMovingLeft | Check whether the second corner of the front edge hits a wall. | ||||||||||
| DFCB | POP DE | Get the edges back. | ||||||||||
| DFCC | POP HL | |||||||||||
| DFCD | RET C | Return if the object hit a wall. | ||||||||||
|
Check the cells after the move.
|
||||||||||||
| DFCE | LD C,(IX+$0A) | Fetch the velocity along the X axis. | ||||||||||
| DFD1 | LD B,$FF | Make it a negative word in BC. | ||||||||||
|
Work out the position that the velocity takes the front edge to, and return if it is in the same cell.
|
||||||||||||
| DFD3 | LD A,H | Find the front edge after the move. | ||||||||||
| DFD4 | ADD HL,BC | |||||||||||
| DFD5 | CP H | Return if it is in the same cell. | ||||||||||
| DFD6 | RET Z | |||||||||||
| DFD7 | EX DE,HL | Use the new position of the front edge. | ||||||||||
| DFD8 | PUSH DE | Save the edges. | ||||||||||
| DFD9 | PUSH HL | |||||||||||
| DFDA | CALL TestCellMovingLeft | Check whether the first corner hits a wall in the next cell. | ||||||||||
| DFDD | POP HL | Get the edges back, with the registers swapped over. | ||||||||||
| DFDE | POP DE | |||||||||||
| DFDF | RET C | Return if the object hit a wall. | ||||||||||
| DFE0 | LD C,(IX+$09) | Work out the depth of the object. | ||||||||||
| DFE3 | SLA C | |||||||||||
| DFE5 | LD B,$00 | |||||||||||
| DFE7 | ADD HL,BC | Work out the second side edge. | ||||||||||
|
Check whether the second corner hits a wall in the next cell.
|
||||||||||||
| DFE8 | JP TestCellMovingLeft | Jump to TestCellMovingLeft. | ||||||||||
|
The side edges are in the same cell.
|
||||||||||||
| TestMoveLeft_SameCell | DFEB | POP DE | Get the edges back. | |||||||||
| DFEC | POP HL | |||||||||||
|
Fetch the velocity along the X axis, which is negative.
|
||||||||||||
| DFED | LD C,(IX+$0A) | Fetch the velocity along the X axis. | ||||||||||
| DFF0 | LD B,$FF | Make it a negative word in BC. | ||||||||||
|
Work out the position that the velocity takes the front edge to, and return if it is in the same cell.
|
||||||||||||
| DFF2 | LD A,H | Find the front edge after the move. | ||||||||||
| DFF3 | ADD HL,BC | |||||||||||
| DFF4 | CP H | Return if it is in the same cell. | ||||||||||
| DFF5 | RET Z | |||||||||||
| DFF6 | EX DE,HL | Use the new position of the front edge. | ||||||||||
|
Check whether the first corner hits a wall in the next cell.
|
||||||||||||
| DFF7 | JP TestCellMovingLeft | Jump to TestCellMovingLeft. | ||||||||||
|
View the equivalent code in;
|
||||||||||||
| Prev: DF34 | Up: Map | Next: DFFA |