![]() |
Routines |
| Prev: EEF3 | Up: Map | Next: EF91 |
|
||||||||||||||||||||
|
The buffer containing bounds is fixed at:
The function updates IX on each call to point at the next entries beyond the one it was called with, and can be called multiple times or in a loop for each moving object in the room.
|
||||||||||||||||||||
| EF35 | LD E,(IX+$02) | Put the distance to move in DE. | ||||||||||||||||||
| EF38 | LD D,(IX+$03) | |||||||||||||||||||
| EF3B | PUSH BC | Store BC and AF. | ||||||||||||||||||
| EF3C | PUSH AF | |||||||||||||||||||
| EF3D | XOR A | Reset flags used in this routine. | ||||||||||||||||||
| EF3E | LD ($F673),A | |||||||||||||||||||
| EF41 | LD ($F672),A | |||||||||||||||||||
| EF44 | LD A,(IX+$00) | Get the current x co-ordinate in A. | ||||||||||||||||||
| EF47 | ADD A,E | Add the distance to move by. | ||||||||||||||||||
| EF48 | LD L,A | Put this in L. | ||||||||||||||||||
|
Check the minimum x co-ordinate.
|
||||||||||||||||||||
| EF49 | LD A,(BC) | Get the minimum x co-ordinate. | ||||||||||||||||||
| EF4A | INC BC | Point BC to the next place in the buffer. | ||||||||||||||||||
| EF4B | CP L | Is our current x co-ordinate the minimum? | ||||||||||||||||||
| EF4C | JR NZ,$EF59 | Jump forward if not. | ||||||||||||||||||
|
x co-ordinate has reached the minimum or maximum.
|
||||||||||||||||||||
| EF4E | LD A,$01 | Flag x boundary reached. | ||||||||||||||||||
| EF50 | LD ($F672),A | |||||||||||||||||||
| EF53 | LD A,E | Flip the distance to change between negative and positive. | ||||||||||||||||||
| EF54 | NEG | |||||||||||||||||||
| EF56 | LD E,A | |||||||||||||||||||
| EF57 | JR $EF5D | |||||||||||||||||||
|
Check the maxmimum x co-ordinate.
|
||||||||||||||||||||
| EF59 | LD A,(BC) | Get the maxmimum x co-ordinate. | ||||||||||||||||||
| EF5A | CP L | Is our current x co-ordinate the maximum? | ||||||||||||||||||
| EF5B | JR Z,$EF4E | Jump back to flip direction if so. | ||||||||||||||||||
|
x co-ordinate is in range, check the y co-ordinate.
|
||||||||||||||||||||
| EF5D | INC BC | Point BC to the next place in the buffer. | ||||||||||||||||||
| EF5E | LD A,(IX+$01) | Get the current y co-ordinate in A. | ||||||||||||||||||
| EF61 | ADD A,D | Add the distance to move by. | ||||||||||||||||||
| EF62 | LD H,A | Put this in H. | ||||||||||||||||||
|
Check the minimum y co-ordinate.
|
||||||||||||||||||||
| EF63 | LD A,(BC) | Get the minumum y co-ordinate. | ||||||||||||||||||
| EF64 | INC BC | Point BC to the next place in the buffer. | ||||||||||||||||||
| EF65 | CP H | Is our current y co-ordinate the minimum? | ||||||||||||||||||
| EF66 | JR NZ,$EF73 | Jump forward if not. | ||||||||||||||||||
|
y co-ordinate has reached the minimum or maximum.
|
||||||||||||||||||||
| EF68 | LD A,$01 | |||||||||||||||||||
| EF6A | LD ($F673),A | |||||||||||||||||||
| EF6D | LD A,D | Flip the distance to change between negative and positive. | ||||||||||||||||||
| EF6E | NEG | |||||||||||||||||||
| EF70 | LD D,A | |||||||||||||||||||
| EF71 | JR $EF77 | |||||||||||||||||||
|
Check the maximum y co-ordinate.
|
||||||||||||||||||||
| EF73 | LD A,(BC) | Get the maximum y co-ordinate. | ||||||||||||||||||
| EF74 | CP H | Is our current y co-ordinate the maxmimum? | ||||||||||||||||||
| EF75 | JR Z,$EF68 | Jump back to flip the direction if so. | ||||||||||||||||||
|
The positions have all been updated, so write them out.
|
||||||||||||||||||||
| EF77 | LD ($A838),HL | Write the position to update that will be used by the next call to the routine at A83D. | ||||||||||||||||||
| EF7A | LD (IX+$00),L | Write back the positions. | ||||||||||||||||||
| EF7D | LD (IX+$01),H | |||||||||||||||||||
| EF80 | LD (IX+$02),E | Write back the directions. | ||||||||||||||||||
| EF83 | LD (IX+$03),D | |||||||||||||||||||
| EF86 | POP AF | Restore AF and BC. | ||||||||||||||||||
| EF87 | POP BC | |||||||||||||||||||
| EF88 | INC IX | Move to the next entry and return. | ||||||||||||||||||
| EF8A | INC IX | |||||||||||||||||||
| EF8C | INC IX | |||||||||||||||||||
| EF8E | INC IX | |||||||||||||||||||
| EF90 | RET | |||||||||||||||||||
| Prev: EEF3 | Up: Map | Next: EF91 |