Prev: DB05 Up: Map Next: DC26
DBC9: Handler: Inventory Items
Used by the routine at Dispatch_Handlers.
Picks up a two-byte record when the player stands on it.
Handler_InventoryItems DBC9 LD HL,$7C70 Write Buffer_ActiveFont to *CHARS.
DBCC LD ($5C36),HL
DBCF LD IX,($6426) IX=*ReferenceInventoryItems.
DBD3 LD A,($64A4) C=*Player.
DBD6 LD C,A Copy the player column into C.
Handler_InventoryItems_Loop DBD7 LD A,(IX+$00) Return if the terminator FF is reached.
DBDA CP $FF
DBDC RET Z Jump to Handler_InventoryItems_Next if this item is already taken.
DBDD BIT 7,A
DBDF JR NZ,Handler_InventoryItems_Next Jump to Handler_InventoryItems_Next unless the player column matches.
DBE1 CP C
DBE2 JR Z,Handler_InventoryItems_Row
DBE4 INC A
DBE5 CP C
DBE6 JR NZ,Handler_InventoryItems_Next
Handler_InventoryItems_Row DBE8 LD A,($64A5) Jump to Handler_InventoryItems_Next unless the player row matches.
DBEB CP (IX+$01)
DBEE JR NZ,Handler_InventoryItems_Next Clear a 02 by 02 hole in the tile buffer.
DBF0 LD C,(IX+$00)
DBF3 LD B,(IX+$01)
DBF6 CALL JumpTable_ConvertCoordinate
DBF9 LD DE,$5DCE Mark the record collected.
DBFC ADD HL,DE
DBFD LD BC,$0202
DC00 LD A,$C8
DC02 CALL JumpTable_FillAttributes Increase *CollectedCount by one.
DC05 LD A,(IX+$00)
DC08 OR $80
DC0A LD (IX+$00),A Call Sound_Pickup (pickup sound).
DC0D LD A,($64A1)
DC10 INC A
DC11 LD ($64A1),A
DC14 LD BC,$0032 Jump to Print_CollectionBar.
DC17 LD DE,$0019
DC1A CALL Sound_Pickup
DC1D JP Print_CollectionBar
Handler_InventoryItems_Next DC20 INC IX Increase IX by two.
DC22 INC IX
DC24 JR Handler_InventoryItems_Loop Jump to Handler_InventoryItems_Loop.
Prev: DB05 Up: Map Next: DC26