![]() |
Routines |
| Prev: 53159 | Up: Map | Next: 53303 |
|
Used by the routine at UpdateDrift.
Moves the drift of an entity, which is held in field 32 one step towards zero.
|
||||||||||
| DecayDrift | 53268 | LD A,(IX+32) | Read the drift. | |||||||
| 53271 | AND %00011111 | Use the magnitude in the low five bits. | ||||||||
| 53273 | RET Z | The drift is already zero. | ||||||||
| 53274 | PUSH HL | Remember the displacement. | ||||||||
| 53275 | LD A,1 | The nudge is one. | ||||||||
| 53277 | BIT 7,(IX+32) | A negative drift is nudged the other way. | ||||||||
| 53281 | JR NZ,DecayDrift_Nudge | |||||||||
| 53283 | NEG | The nudge is minus one. | ||||||||
| DecayDrift_Nudge | 53285 | CALL UpdateDrift_Apply | Nudge the drift. | |||||||
| 53288 | LD A,D | The nudge crossed zero when the signs differ. | ||||||||
| 53289 | XOR (IX+32) | |||||||||
| 53292 | RLA | |||||||||
| 53293 | JR NC,DecayDrift_Keep | |||||||||
| 53295 | LD (IX+32),0 | Clear the drift and restore the displacement. | ||||||||
| 53299 | POP HL | |||||||||
| 53300 | RET | Return. | ||||||||
| DecayDrift_Keep | 53301 | POP DE | Keep the updated displacement. | |||||||
| 53302 | RET | Return. | ||||||||
| Prev: 53159 | Up: Map | Next: 53303 |