Prev: 32380 Up: Map Next: 32511
32442: 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 46904: it writes the object id into the first A slots marked 255 (claimed by Command_FollowTheGrammarFlag_ClaimTheSlot), capping A at the claimed-slot count in 46903, then frees the rest of the claimed slots by writing 0 to them.
Inglish_FillTheClaimedSlots 32442 PUSH BC Save BC, IX and DE, and keep A in B.
32443 PUSH IX
32445 PUSH DE
32446 LD B,A
32447 LD A,(46903) Read the slot count.
32450 LD C,A Jump to Inglish_FillTheClaimedSlots_UseTheSlotCountAgain if the slot count is not below the count in B.
32451 CP B
32452 JR NC,Inglish_FillTheClaimedSlots_UseTheSlotCountAgain
32454 LD B,A Cap the count at the slot count.
Inglish_FillTheClaimedSlots_UseTheSlotCountAgain 32455 LD A,C Use the slot count again.
32456 SUB B Take the count in B off the slot count, leaving how many slots remain.
32457 LD C,A Copy the result into C.
32458 LD IX,46879 Point IX one 25-byte slot before the first character slot at 46904.
32462 LD DE,25 Each slot is 25 bytes.
32465 XOR A Jump to Inglish_FillTheClaimedSlots_TestTheSlotCount if there are no slots to fill.
32466 CP B
32467 JR Z,Inglish_FillTheClaimedSlots_TestTheSlotCount
Inglish_FillTheClaimedSlots_FindAClaimedSlot 32469 ADD IX,DE Step IX on to the next 25-byte slot.
32471 LD A,(IX+0) Read the object id in this slot.
32474 CP 255 Jump back to Inglish_FillTheClaimedSlots_FindAClaimedSlot while this slot is not claimed (not 255).
32476 JR NZ,Inglish_FillTheClaimedSlots_FindAClaimedSlot
32478 LD A,(46824) Read *CurrentObject.
32481 LD (IX+0),A Store the current object id in this slot.
32484 DJNZ Inglish_FillTheClaimedSlots_FindAClaimedSlot Loop back to Inglish_FillTheClaimedSlots_FindAClaimedSlot until B slots are filled.
Inglish_FillTheClaimedSlots_TestTheSlotCount 32486 LD B,C Jump to Inglish_FillTheClaimedSlots_RestoreAndReturn if no slots remain.
32487 XOR A
32488 CP B
32489 JR Z,Inglish_FillTheClaimedSlots_RestoreAndReturn
Inglish_FillTheClaimedSlots_FreeTheRest 32491 ADD IX,DE Step IX on to the next 25-byte slot.
32493 LD A,(IX+0) Read the object id in this slot.
32496 CP 255 Jump back to Inglish_FillTheClaimedSlots_FreeTheRest while this slot is not claimed (not 255).
32498 JR NZ,Inglish_FillTheClaimedSlots_FreeTheRest
32500 LD (IX+0),0 Mark this slot free with 0.
32504 DJNZ Inglish_FillTheClaimedSlots_FreeTheRest Loop back to Inglish_FillTheClaimedSlots_FreeTheRest until the slot count runs out.
Inglish_FillTheClaimedSlots_RestoreAndReturn 32506 POP DE Restore DE, IX and BC from the stack.
32507 POP IX
32509 POP BC
32510 RET Return.
Prev: 32380 Up: Map Next: 32511