Prev: 7E7C Up: Map Next: 7EFF
7EBA: Inglish: Fill The Claimed Slots
Used by the routine at Action_TalkTo.
Gives the current object up to A of the claimed character slots at B738: it writes the object id into the first A slots marked FF (claimed by Command_FollowTheGrammarFlag_ClaimTheSlot), capping A at the claimed-slot count in B737, then frees the rest of the claimed slots by writing 00 to them.
Inglish_FillTheClaimedSlots 7EBA PUSH BC Save BC, IX and DE, and keep A in B.
7EBB PUSH IX
7EBD PUSH DE
7EBE LD B,A
7EBF LD A,($B737) Read the slot count.
7EC2 LD C,A Jump to Inglish_FillTheClaimedSlots_UseTheSlotCountAgain if the slot count is not below the count in B.
7EC3 CP B
7EC4 JR NC,Inglish_FillTheClaimedSlots_UseTheSlotCountAgain
7EC6 LD B,A Cap the count at the slot count.
Inglish_FillTheClaimedSlots_UseTheSlotCountAgain 7EC7 LD A,C Use the slot count again.
7EC8 SUB B Take the count in B off the slot count, leaving how many slots remain.
7EC9 LD C,A Copy the result into C.
7ECA LD IX,$B71F Point IX one 19-byte slot before the first character slot at B738.
7ECE LD DE,$0019 Each slot is 19 bytes.
7ED1 XOR A Jump to Inglish_FillTheClaimedSlots_TestTheSlotCount if there are no slots to fill.
7ED2 CP B
7ED3 JR Z,Inglish_FillTheClaimedSlots_TestTheSlotCount
Inglish_FillTheClaimedSlots_FindAClaimedSlot 7ED5 ADD IX,DE Step IX on to the next 19-byte slot.
7ED7 LD A,(IX+$00) Read the object id in this slot.
7EDA CP $FF Jump back to Inglish_FillTheClaimedSlots_FindAClaimedSlot while this slot is not claimed (not FF).
7EDC JR NZ,Inglish_FillTheClaimedSlots_FindAClaimedSlot
7EDE LD A,($B6E8) Read *CurrentObject.
7EE1 LD (IX+$00),A Store the current object id in this slot.
7EE4 DJNZ Inglish_FillTheClaimedSlots_FindAClaimedSlot Loop back to Inglish_FillTheClaimedSlots_FindAClaimedSlot until B slots are filled.
Inglish_FillTheClaimedSlots_TestTheSlotCount 7EE6 LD B,C Jump to Inglish_FillTheClaimedSlots_RestoreAndReturn if no slots remain.
7EE7 XOR A
7EE8 CP B
7EE9 JR Z,Inglish_FillTheClaimedSlots_RestoreAndReturn
Inglish_FillTheClaimedSlots_FreeTheRest 7EEB ADD IX,DE Step IX on to the next 19-byte slot.
7EED LD A,(IX+$00) Read the object id in this slot.
7EF0 CP $FF Jump back to Inglish_FillTheClaimedSlots_FreeTheRest while this slot is not claimed (not FF).
7EF2 JR NZ,Inglish_FillTheClaimedSlots_FreeTheRest
7EF4 LD (IX+$00),$00 Mark this slot free with 00.
7EF8 DJNZ Inglish_FillTheClaimedSlots_FreeTheRest Loop back to Inglish_FillTheClaimedSlots_FreeTheRest until the slot count runs out.
Inglish_FillTheClaimedSlots_RestoreAndReturn 7EFA POP DE Restore DE, IX and BC from the stack.
7EFB POP IX
7EFD POP BC
7EFE RET Return.
Prev: 7E7C Up: Map Next: 7EFF