![]() |
Routines |
| Prev: 54942 | Up: Map | Next: 55023 |
|
Works out the pixel position of an object on the screen from its x, y and z positions. The pixel x position is x + y - 128 and the pixel y position (from the bottom of the screen) is half of y - x + 128, plus z, less 104, each with the adjustments of the object added.
|
||||||||||||
|
Work out the pixel x position.
|
||||||||||||
| CalculatePixelCoordinates | 54985 | LD A,(IX+1) | Fetch the x position of the object. | |||||||||
| 54988 | ADD A,(IX+2) | Add the y position. | ||||||||||
| 54991 | SUB 128 | Subtract 128. | ||||||||||
| 54993 | ADD A,(IX+18) | Add the pixel x adjustment. | ||||||||||
| 54996 | LD (IX+26),A | Set the pixel x position. | ||||||||||
|
Work out the pixel y position.
|
||||||||||||
| 54999 | LD A,(IX+2) | Fetch the y position of the object. | ||||||||||
| 55002 | SUB (IX+1) | Subtract the x position. | ||||||||||
| 55005 | ADD A,128 | Add 128. | ||||||||||
| 55007 | SRL A | Halve it. | ||||||||||
| 55009 | ADD A,(IX+3) | Add the z position. | ||||||||||
| 55012 | SUB 104 | Subtract 104. | ||||||||||
| 55014 | ADD A,(IX+19) | Add the pixel y adjustment. | ||||||||||
| 55017 | LD (IX+27),A | Set the pixel y position. | ||||||||||
| 55020 | CP 192 | Compare it with the number of lines of the screen. | ||||||||||
| 55022 | RET | Return. | ||||||||||
| Prev: 54942 | Up: Map | Next: 55023 |