Prev: AE5D Up: Map Next: AEA7
AE8A: Find the address of an item with the specified index
Used by the routine at A92C.
Input
E The item index
HL On exit, holds of the address of the item data currently at that location
AE8A LD D,$00 Start at room 0.
AE8C LD BC,$21FF Set B to 21 (number of rooms) and C to FF (default index)
AE8F LD HL,$BCE9 Point HL at the start of the object data. (BCE9)
AE92 LD A,(HL) Get the next ID.
AE93 CP $FF Is this an end marker?
AE95 JR Z,$AEA0 Jump forward if it is.
AE97 INC HL Move to the next entry.
AE98 INC HL
AE99 INC HL
AE9A INC HL
AE9B INC C Increment the index count.
AE9C CP E Does this match the index?
AE9D JR NZ,$AE92 Jump back to look at more data if so.
AE9F RET Otherwise return, HL is now pointing at the data for this item.
There is no object data here.
AEA0 LD C,$FF Set C to "no item found".
AEA2 INC HL Move to the next entry in the object buffer.
AEA3 INC D Increment the room count.
AEA4 DJNZ $AE92 Loop while there are more rooms to look at.
AEA6 RET Otherwise return.
Prev: AE5D Up: Map Next: AEA7