Prev: 47668 Up: Map Next: 47810
47677: Display Objects Carried
Used by the routine at RunGame.
Displays the objects which the player is carrying in the panel. Each of the three places takes three cells across and is 24 pixels apart from the next. The place is cleared, the sprite of the object is printed in the screen buffer and copied to the screen, and the cells are coloured according to the shape of the object (see InventoryColours).
Draw the three places in the panel.
DisplayObjectsCarried 47677 PUSH IX Stash IX on the stack.
47679 LD IX,47818 Use the temporary object, TemporaryObject.
47683 LD B,3 Set a counter of 3 places.
47685 LD HL,42790 Start with the first carried object, ObjectsCarried_Newest.
Work out the pixel x of this place (24 times the place, plus 16).
DisplayObjectsCarried_Next 47688 PUSH BC Stash the counter on the stack.
47689 PUSH HL Stash the address of the object on the stack.
47690 LD A,B Copy the counter to A.
47691 NEG Make it negative.
47693 ADD A,3 ...and add three, to get the number of the icon.
47695 SLA A Multiply it by eight.
47697 SLA A
47699 SLA A
47701 LD C,A Keep it in C.
47702 SLA A Multiply by two again, which makes 16 times the number.
47704 ADD A,C Add the eight times.
47705 ADD A,16 Add 16.
47707 LD (IX+26),A Write it as the screen x co-ordinate of the temporary object.
47710 LD (IX+27),0 Write 0 as the screen y co-ordinate.
Clear the place and print the sprite.
47714 LD C,(IX+26) Fetch the pixel x position into C.
47717 LD B,(IX+27) Fetch the pixel y position into B.
47720 PUSH HL Stash the address of the object on the stack.
47721 CALL CalculateBufferAddress Call CalculateBufferAddress to get the address in the buffer.
47724 LD L,C Copy it to HL.
47725 LD H,B
47726 LD BC,792 Set BC to 792.
47729 XOR A Set A to 0.
47730 CALL FillWindow Call FillWindow.
47733 POP HL Restore the address of the object from the stack.
Draw the icon, if there is an object in this entry.
47734 LD A,(HL) Fetch the type of the object.
47735 AND A Jump to DisplayObjectsCarried_Copy if the carried entry is empty.
47736 JR Z,DisplayObjectsCarried_Copy
47738 LD (IX+0),A Set the type of the temporary object.
47741 CALL DrawObject_Sprite Call DrawObject_Sprite to draw its sprite.
Copy the place to the screen.
DisplayObjectsCarried_Copy 47744 LD C,(IX+26) Fetch the pixel x position into C.
47747 LD B,(IX+27) Fetch the pixel y position into B.
47750 CALL CalculateScreenAddress Call CalculateScreenAddress to get the address in the display file.
47753 CALL CalculateBufferAddress Call CalculateBufferAddress to get the address in the buffer.
47756 LD L,C Copy it to HL.
47757 LD H,B
47758 LD BC,6147 Set BC to 6147.
47761 CALL CopyBlockToScreen Call CopyBlockToScreen to copy the icon to the screen.
Colour the cells from the shape.
47764 POP HL Restore the address of the object from the stack.
47765 POP BC Keep the counter on the stack.
47766 PUSH BC
47767 PUSH HL Stash the address of the object on the stack.
47768 LD A,(HL) Fetch the type of the object.
47769 AND %00000111 Keep only bits 0 to 2.
47771 LD E,A Copy the shape into DE.
47772 LD D,0
47774 LD HL,47810 Point HL at the entry of InventoryColours for the shape.
47777 ADD HL,DE
47778 LD C,(HL) Fetch the colour into C.
47779 LD L,(IX+26) Fetch the pixel x position of the place into L.
Add 23 to the y co-ordinate to get to the top of the icon.
47782 LD A,(IX+27) Fetch the pixel y position of the place.
47785 ADD A,23 Add 23.
47787 LD H,A Keep it in H.
47788 CALL CalculateAttributeAddress Call CalculateAttributeAddress to get the address in the attribute file.
47791 EX DE,HL Swap it into HL.
47792 LD A,C Fetch the colour.
47793 LD BC,771 Set BC to 771.
47796 CALL FillWindow Call FillWindow to set the attributes.
47799 POP HL Restore the address of the object and the counter from the stack.
47800 POP BC
47801 INC HL Move on to the next entry, which is four bytes on.
47802 INC HL
47803 INC HL
47804 INC HL
47805 DJNZ DisplayObjectsCarried_Next Decrease the counter and loop until all three icons have been drawn.
47807 POP IX Restore IX from the stack.
47809 RET Return.
View the equivalent code in;
Prev: 47668 Up: Map Next: 47810