Prev: 48259 Up: Map Next: 48436
48285: Display Objects Carried
Used by the routine at DrawChangedObjects.
Displays the objects which the player is carrying in the panel, if they have changed (see ObjectsCarriedChangedFlag). 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 CarriedObjectColours). DisplayObjectsCarried_Display displays the objects whether they have changed or not.
Return unless the objects have changed.
DisplayObjectsCarried 48285 LD A,(23331) Return if GameCompletedFlag is set.
48288 AND A
48289 RET NZ
48290 LD A,(23316) Return if ObjectsCarriedChangedFlag is zero.
48293 AND A
48294 RET Z
48295 XOR A Write 0 to *ObjectsCarriedChangedFlag.
48296 LD (23316),A
This entry point is used by the routine at UpdatePanel.
Draw the three places in the panel.
DisplayObjectsCarried_Display 48299 PUSH IX Stash IX on the stack.
48301 LD IX,48440 Point IX at SpriteObject.
48305 LD B,3 Set a counter of 3 places.
48307 LD HL,23420 Point HL at ObjectsCarried.
Work out the pixel x of this place (24 times the place, plus 8).
DisplayObjectsCarried_NextPlace 48310 PUSH BC Stash the counter on the stack.
48311 PUSH HL Stash the address of the object on the stack.
48312 LD A,B Copy the counter to A.
48313 NEG Make it negative.
48315 ADD A,3 Add 3.
48317 SLA A Multiply it by eight.
48319 SLA A
48321 SLA A
48323 LD C,A Keep it in C.
48324 SLA A Double it.
48326 ADD A,C Add the eight times.
48327 ADD A,8 Add 8.
48329 LD (IX+26),A Set the pixel x position of the place.
48332 LD (IX+27),0 Set the pixel y position of the place to 0.
Clear the place and print the sprite.
48336 LD C,(IX+26) Fetch the pixel x position into C.
48339 LD B,(IX+27) Fetch the pixel y position into B.
48342 PUSH HL Stash the address of the object on the stack.
48343 CALL CalculateBufferAddress Call CalculateBufferAddress.
48346 LD L,C Copy it to HL.
48347 LD H,B
48348 LD BC,792 Set BC to 792.
48351 XOR A Set A to 0.
48352 CALL FillWindow Call FillWindow.
48355 POP HL Restore the address of the object from the stack.
48356 LD A,(HL) Fetch the number of the object carried.
48357 AND A Jump to DisplayObjectsCarried_CopyPlace if it is zero.
48358 JR Z,DisplayObjectsCarried_CopyPlace
48360 RES 6,(IX+7) Reset bit 6 of the flags.
48364 LD (IX+0),A Set the sprite number of the object.
48367 CALL PrintSprite Call PrintSprite.
Copy the place to the screen.
DisplayObjectsCarried_CopyPlace 48370 LD C,(IX+26) Fetch the pixel x position into C.
48373 LD B,(IX+27) Fetch the pixel y position into B.
48376 CALL CalculateScreenAddress Call CalculateScreenAddress.
48379 CALL CalculateBufferAddress Call CalculateBufferAddress.
48382 LD L,C Copy it to HL.
48383 LD H,B
48384 LD BC,6147 Set BC to 6147.
48387 CALL CopyBlockToScreen Call CopyBlockToScreen.
Colour the cells from the shape.
48390 POP HL Restore the address of the object from the stack.
48391 POP BC Keep the counter on the stack.
48392 PUSH BC
48393 PUSH HL Stash the address of the object on the stack.
48394 LD A,(HL) Fetch the number of the object carried.
48395 AND %00001111 Keep only bits 0 to 3.
48397 LD E,A Copy the shape into DE.
48398 LD D,0
48400 LD HL,48436 Point HL at the entry of CarriedObjectColours for the shape.
48403 ADD HL,DE
48404 LD C,(HL) Fetch the colour into C.
48405 LD L,(IX+26) Fetch the pixel x position of the place into L.
48408 LD A,(IX+27) Fetch the pixel y position of the place.
48411 ADD A,23 Add 23.
48413 LD H,A Keep it in H.
48414 CALL CalculateAttributeAddress Call CalculateAttributeAddress.
48417 EX DE,HL Swap it into HL.
48418 LD A,C Fetch the colour.
48419 LD BC,771 Set BC to 771.
48422 CALL FillWindow Call FillWindow.
48425 POP HL Restore the address of the object and the counter from the stack.
48426 POP BC
48427 INC HL Move on to the next object carried.
48428 INC HL
48429 INC HL
48430 INC HL
48431 DJNZ DisplayObjectsCarried_NextPlace Jump to DisplayObjectsCarried_NextPlace until all three places have been done.
48433 POP IX Restore IX from the stack.
48435 RET Return.
View the equivalent code in;
Prev: 48259 Up: Map Next: 48436