Prev: C613 Up: Map Next: C657
C63D: Calculate Sprite Size
Used by the routine at FlagOverlappingObjects.
Works out where an object is on the screen and how much of the screen its sprite covers. The width in bytes is one more than the width of the sprite if the sprite does not start on a byte boundary, because it has to be shifted across.
Input
IX The address of the object
Widen the sprite if it is shifted.
CalculateSpriteSize C63D CALL CalculatePixelCoordinates Call CalculatePixelCoordinates.
C640 CALL GetSpriteAddress Call GetSpriteAddress.
C643 LD A,(IX+$1A) Fetch the pixel x position.
C646 AND %00000111 Keep only bits 0-2.
C648 LD A,(DE) Fetch the width of the sprite in bytes.
C649 INC DE Move on to the height.
C64A JR Z,CalculateSpriteSize_Store Jump to CalculateSpriteSize_Store if they were zero.
C64C INC A Increment A.
CalculateSpriteSize_Store C64D AND %00001111 Keep only bits 0-3.
C64F LD (IX+$18),A Store the width in bytes.
C652 LD A,(DE) Fetch the height of the sprite in lines.
C653 LD (IX+$19),A Store the height in lines.
C656 RET Return.
View the equivalent code in;
Prev: C613 Up: Map Next: C657