Prev: AD48 Up: Map Next: ADD8
ADBE: Fetch Frame Sprite
Used by the routines at CheckMapObjectCollisions, PrepareErase and PrepareDraw.
Finds the address of the sprite for the state of an object. The type is used as an index into the table at FrameTableAddresses, which gives the address of a table of sprites for the type; the bottom four bits of offset 13 are the index into that table.
Input
IX Address of the object
Output
DE Address of the sprite
FetchFrameSprite ADBE LD C,(IX+$00) The type.
ADC1 LD B,$00 Clear B.
ADC3 LD HL,$AF3D The frame table addresses.
ADC6 ADD HL,BC HL gains BC.
ADC7 ADD HL,BC HL gains BC.
ADC8 LD A,(HL) Read HL.
ADC9 INC HL Advance HL.
ADCA LD H,(HL) Read HL into H.
ADCB LD L,A L=A.
ADCC LD A,(IX+$13) The state.
ADCF AND %00001111 Keep the bits of A that are set in 0F.
ADD1 LD C,A C=A.
ADD2 ADD HL,BC HL gains BC.
ADD3 ADD HL,BC HL gains BC.
ADD4 LD E,(HL) Read HL into E.
ADD5 INC HL Advance HL.
ADD6 LD D,(HL) Read HL into D.
ADD7 RET Return.
Prev: AD48 Up: Map Next: ADD8