Prev: AC60 Up: Map Next: AD1B
ACDD: Trim Object Sprite
Used by the routine at UpdateMapObjects.
Used for the object at IY if it is type 1B or has state zero, one, three, ten or twelve. Returns if the bottom three bits of the vertical position in A1D6 are all set. Otherwise subtracts seven from that position and four from the number of rows in A1D8 (and sets the number of rows to zero if the new position is below 18).
TrimObjectSprite ACDD LD A,(IY+$00) Read offset 00 of IY.
ACE0 CP $1B Jump to TrimObjectSprite_Trim if A is 1B.
ACE2 JR Z,TrimObjectSprite_Trim
ACE4 LD A,(IY+$13) Read offset 13 of IY.
ACE7 AND %00001111 Keep the bits of A that are set in 0F.
ACE9 JR Z,TrimObjectSprite_Trim Jump to TrimObjectSprite_Trim if the zero flag is set.
ACEB CP $01 Jump to TrimObjectSprite_Trim if A is 01.
ACED JR Z,TrimObjectSprite_Trim
ACEF CP $03 Jump to TrimObjectSprite_Trim if A is 03.
ACF1 JR Z,TrimObjectSprite_Trim
ACF3 CP $0A Jump to TrimObjectSprite_Trim if A is 0A.
ACF5 JR Z,TrimObjectSprite_Trim
ACF7 CP $0C Return if A is not 0C.
ACF9 RET NZ
TrimObjectSprite_Trim ACFA LD A,($A1D6) The vertical position of the second sprite.
ACFD XOR %00000111 Flip the bits of A that are set in 07.
ACFF AND %00000111 Keep the bits of A that are set in 07.
AD01 RET Z Return if the zero flag is set.
AD02 LD A,($A1D8) The rows of the second sprite.
AD05 SUB $04 Subtract 04 from A.
AD07 LD ($A1D8),A The rows of the second sprite.
AD0A LD A,($A1D6) The vertical position of the second sprite.
AD0D SUB $07 Subtract 07 from A.
AD0F CP $18 Jump to TrimObjectSprite_Store if A is 18 or more.
AD11 JR NC,TrimObjectSprite_Store
AD13 XOR A Clear A.
AD14 LD ($A1D8),A The rows of the second sprite.
TrimObjectSprite_Store AD17 LD ($A1D6),A The vertical position of the second sprite.
AD1A RET Return.
Prev: AC60 Up: Map Next: AD1B