![]() |
Routines |
| Prev: CFA7 | Up: Map | Next: D037 |
|
Used by the routine at UpdateDrift.
Moves the drift of an entity, which is held in field 20 one step towards zero.
|
||||||||||
| DecayDrift | D014 | LD A,(IX+$20) | Read the drift. | |||||||
| D017 | AND %00011111 | Use the magnitude in the low five bits. | ||||||||
| D019 | RET Z | The drift is already zero. | ||||||||
| D01A | PUSH HL | Remember the displacement. | ||||||||
| D01B | LD A,$01 | The nudge is one. | ||||||||
| D01D | BIT 7,(IX+$20) | A negative drift is nudged the other way. | ||||||||
| D021 | JR NZ,DecayDrift_Nudge | |||||||||
| D023 | NEG | The nudge is minus one. | ||||||||
| DecayDrift_Nudge | D025 | CALL UpdateDrift_Apply | Nudge the drift. | |||||||
| D028 | LD A,D | The nudge crossed zero when the signs differ. | ||||||||
| D029 | XOR (IX+$20) | |||||||||
| D02C | RLA | |||||||||
| D02D | JR NC,DecayDrift_Keep | |||||||||
| D02F | LD (IX+$20),$00 | Clear the drift and restore the displacement. | ||||||||
| D033 | POP HL | |||||||||
| D034 | RET | Return. | ||||||||
| DecayDrift_Keep | D035 | POP DE | Keep the updated displacement. | |||||||
| D036 | RET | Return. | ||||||||
| Prev: CFA7 | Up: Map | Next: D037 |