Prev: 96B3 Up: Map Next: 977C
9728: Report Who Is Carrying An Object
Used by the routine at Turn_RunTheHandlerIfPresent.
On the player's turn, if the object in A is held by a visible animal, it prints "<animal> is carrying <object>" and returns with the zero flag clear; otherwise it returns with the zero flag set.
Turn_ReportWhoIsCarryingAnObject 9728 CP $FF Return if the object id is FF.
972A RET Z
972B PUSH IX Save IX, IY and BC, and keep the object id in B.
972D PUSH IY
972F PUSH BC
9730 LD B,A
Test whose turn it is.
9731 LD A,($B6EA) Jump to Turn_ReportWhoIsCarryingAnObject_RestoreTheId if *CurrentCharacter is 00 (the player).
9734 CP $00
9736 JR Z,Turn_ReportWhoIsCarryingAnObject_RestoreTheId
9738 XOR A Set the zero flag.
9739 JR Turn_ReportWhoIsCarryingAnObject_Return Jump to Turn_ReportWhoIsCarryingAnObject_Return to return with the zero flag set.
Turn_ReportWhoIsCarryingAnObject_RestoreTheId 973B LD A,B Take the object id back into A.
Find the object's record.
973C CALL LocateObject Call LocateObject to locate object.
973F LD A,(IX+$01) Read where this object is from the object record.
9742 CP $FF Jump to Turn_ReportWhoIsCarryingAnObject_Return if this object is not inside another object.
9744 JR Z,Turn_ReportWhoIsCarryingAnObject_Return
9746 LD A,B Take the object id back into A.
9747 PUSH IX Point IY at this object and call ConditionIsTheObjectCarried_0 to test whether the character whose turn it is is carrying it.
9749 POP IY
974B CALL ConditionIsTheObjectCarried_0
974E JR C,Turn_ReportWhoIsCarryingAnObject_Return Jump to Turn_ReportWhoIsCarryingAnObject_Return if the character is carrying it.
Find the object's record.
9750 CALL LocateObject Call LocateObject to locate object.
9753 BIT 6,(IX+$07) Jump to Turn_ReportWhoIsCarryingAnObject_Return if the object is not an animal.
9757 JR Z,Turn_ReportWhoIsCarryingAnObject_Return
9759 LD A,($C122) Jump to Turn_ReportWhoIsCarryingAnObject_Return if the player is not visible.
975C BIT 7,A
975E JR Z,Turn_ReportWhoIsCarryingAnObject_Return
9760 LD L,(IY+$08) Read the name token from IY.
9763 LD H,(IY+$09) Read the name token's high byte from IY.
9766 PUSH HL Read the name token from the object record.
9767 LD L,(IX+$08)
976A LD H,(IX+$09) Read the name token's high byte from the object record.
976D PUSH HL Point at the message "[0x04] is carrying[0x04][0x15]".
976E LD HL,$AFE4
9771 CALL PrintMessage Call PrintMessage to print message.
9774 OR $01 Clear the zero flag.
Turn_ReportWhoIsCarryingAnObject_Return 9776 POP BC Restore BC, IY and IX from the stack.
9777 POP IY
9779 POP IX
977B RET Return.
Prev: 96B3 Up: Map Next: 977C