![]() |
Routines |
| Prev: 8C05 | Up: Map | Next: 8C58 |
|
Used by the routine at AccelerateObject.
Limits a speed to the range set by AccelerateObject.
|
||||||||||||
| LimitSpeedToRange | 8C3F | BIT 7,H | Jump to LimitSpeedToRange_Negative if it is negative. | |||||||||
| 8C41 | JR NZ,LimitSpeedToRange_Negative | |||||||||||
| 8C43 | LD A,($8C03) | Fetch the positive limit from 8C03. | ||||||||||
| 8C46 | DEC A | Subtract one. | ||||||||||
| 8C47 | CP H | Compare it with the high byte of the speed. | ||||||||||
| 8C48 | RET NC | Return if the speed is within the limit. | ||||||||||
| 8C49 | INC A | Restore the limit... | ||||||||||
| 8C4A | LD H,A | ...and use it as the speed. | ||||||||||
| 8C4B | LD L,$00 | Clear the low byte of the speed. | ||||||||||
| 8C4D | RET | Return. | ||||||||||
| LimitSpeedToRange_Negative | 8C4E | LD A,($8C04) | Fetch the negative limit from 8C04. | |||||||||
| 8C51 | CP H | Compare it with the high byte of the speed. | ||||||||||
| 8C52 | RET C | Return if the speed is within the limit. | ||||||||||
| 8C53 | INC A | Add one to the limit... | ||||||||||
| 8C54 | LD H,A | ...and use it as the speed. | ||||||||||
| 8C55 | LD L,$00 | Clear the low byte of the speed. | ||||||||||
| 8C57 | RET | Return. | ||||||||||
| Prev: 8C05 | Up: Map | Next: 8C58 |