Prev: 44360 Up: Map Next: 44504
44478: 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 19 are the index into that table.
Input
IX Address of the object
Output
DE Address of the sprite
FetchFrameSprite 44478 LD C,(IX+0) The type.
44481 LD B,0 Clear B.
44483 LD HL,44861 The frame table addresses.
44486 ADD HL,BC HL gains BC.
44487 ADD HL,BC HL gains BC.
44488 LD A,(HL) Read HL.
44489 INC HL Advance HL.
44490 LD H,(HL) Read HL into H.
44491 LD L,A L=A.
44492 LD A,(IX+19) The state.
44495 AND %00001111 Keep the bits of A that are set in 15.
44497 LD C,A C=A.
44498 ADD HL,BC HL gains BC.
44499 ADD HL,BC HL gains BC.
44500 LD E,(HL) Read HL into E.
44501 INC HL Advance HL.
44502 LD D,(HL) Read HL into D.
44503 RET Return.
Prev: 44360 Up: Map Next: 44504