![]() |
Routines |
| Prev: BC83 | Up: Map | Next: BD34 |
|
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 18 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 | BC9D | LD A,($5B23) | Return if GameCompletedFlag is set. | |||
| BCA0 | AND A | |||||
| BCA1 | RET NZ | |||||
| BCA2 | LD A,($5B14) | Return if ObjectsCarriedChangedFlag is zero. | ||||
| BCA5 | AND A | |||||
| BCA6 | RET Z | |||||
| BCA7 | XOR A | Write 00 to *ObjectsCarriedChangedFlag. | ||||
| BCA8 | LD ($5B14),A | |||||
|
This entry point is used by the routine at UpdatePanel.
Draw the three places in the panel.
|
||||||
| DisplayObjectsCarried_Display | BCAB | PUSH IX | Stash IX on the stack. | |||
| BCAD | LD IX,$BD38 | Point IX at SpriteObject. | ||||
| BCB1 | LD B,$03 | Set a counter of 03 places. | ||||
| BCB3 | LD HL,$5B7C | Point HL at ObjectsCarried. | ||||
|
Work out the pixel x of this place (18 times the place, plus 08).
|
||||||
| DisplayObjectsCarried_NextPlace | BCB6 | PUSH BC | Stash the counter on the stack. | |||
| BCB7 | PUSH HL | Stash the address of the object on the stack. | ||||
| BCB8 | LD A,B | Copy the counter to A. | ||||
| BCB9 | NEG | Make it negative. | ||||
| BCBB | ADD A,$03 | Add 03. | ||||
| BCBD | SLA A | Multiply it by eight. | ||||
| BCBF | SLA A | |||||
| BCC1 | SLA A | |||||
| BCC3 | LD C,A | Keep it in C. | ||||
| BCC4 | SLA A | Double it. | ||||
| BCC6 | ADD A,C | Add the eight times. | ||||
| BCC7 | ADD A,$08 | Add 08. | ||||
| BCC9 | LD (IX+$1A),A | Set the pixel x position of the place. | ||||
| BCCC | LD (IX+$1B),$00 | Set the pixel y position of the place to 00. | ||||
|
Clear the place and print the sprite.
|
||||||
| BCD0 | LD C,(IX+$1A) | Fetch the pixel x position into C. | ||||
| BCD3 | LD B,(IX+$1B) | Fetch the pixel y position into B. | ||||
| BCD6 | PUSH HL | Stash the address of the object on the stack. | ||||
| BCD7 | CALL CalculateBufferAddress | Call CalculateBufferAddress. | ||||
| BCDA | LD L,C | Copy it to HL. | ||||
| BCDB | LD H,B | |||||
| BCDC | LD BC,$0318 | Set BC to 0318. | ||||
| BCDF | XOR A | Set A to 00. | ||||
| BCE0 | CALL FillWindow | Call FillWindow. | ||||
| BCE3 | POP HL | Restore the address of the object from the stack. | ||||
| BCE4 | LD A,(HL) | Fetch the number of the object carried. | ||||
| BCE5 | AND A | Jump to DisplayObjectsCarried_CopyPlace if it is zero. | ||||
| BCE6 | JR Z,DisplayObjectsCarried_CopyPlace | |||||
| BCE8 | RES 6,(IX+$07) | Reset bit 6 of the flags. | ||||
| BCEC | LD (IX+$00),A | Set the sprite number of the object. | ||||
| BCEF | CALL PrintSprite | Call PrintSprite. | ||||
|
Copy the place to the screen.
|
||||||
| DisplayObjectsCarried_CopyPlace | BCF2 | LD C,(IX+$1A) | Fetch the pixel x position into C. | |||
| BCF5 | LD B,(IX+$1B) | Fetch the pixel y position into B. | ||||
| BCF8 | CALL CalculateScreenAddress | Call CalculateScreenAddress. | ||||
| BCFB | CALL CalculateBufferAddress | Call CalculateBufferAddress. | ||||
| BCFE | LD L,C | Copy it to HL. | ||||
| BCFF | LD H,B | |||||
| BD00 | LD BC,$1803 | Set BC to 1803. | ||||
| BD03 | CALL CopyBlockToScreen | Call CopyBlockToScreen. | ||||
|
Colour the cells from the shape.
|
||||||
| BD06 | POP HL | Restore the address of the object from the stack. | ||||
| BD07 | POP BC | Keep the counter on the stack. | ||||
| BD08 | PUSH BC | |||||
| BD09 | PUSH HL | Stash the address of the object on the stack. | ||||
| BD0A | LD A,(HL) | Fetch the number of the object carried. | ||||
| BD0B | AND %00001111 | Keep only bits 0 to 3. | ||||
| BD0D | LD E,A | Copy the shape into DE. | ||||
| BD0E | LD D,$00 | |||||
| BD10 | LD HL,$BD34 | Point HL at the entry of CarriedObjectColours for the shape. | ||||
| BD13 | ADD HL,DE | |||||
| BD14 | LD C,(HL) | Fetch the colour into C. | ||||
| BD15 | LD L,(IX+$1A) | Fetch the pixel x position of the place into L. | ||||
| BD18 | LD A,(IX+$1B) | Fetch the pixel y position of the place. | ||||
| BD1B | ADD A,$17 | Add 17. | ||||
| BD1D | LD H,A | Keep it in H. | ||||
| BD1E | CALL CalculateAttributeAddress | Call CalculateAttributeAddress. | ||||
| BD21 | EX DE,HL | Swap it into HL. | ||||
| BD22 | LD A,C | Fetch the colour. | ||||
| BD23 | LD BC,$0303 | Set BC to 0303. | ||||
| BD26 | CALL FillWindow | Call FillWindow. | ||||
| BD29 | POP HL | Restore the address of the object and the counter from the stack. | ||||
| BD2A | POP BC | |||||
| BD2B | INC HL | Move on to the next object carried. | ||||
| BD2C | INC HL | |||||
| BD2D | INC HL | |||||
| BD2E | INC HL | |||||
| BD2F | DJNZ DisplayObjectsCarried_NextPlace | Jump to DisplayObjectsCarried_NextPlace until all three places have been done. | ||||
| BD31 | POP IX | Restore IX from the stack. | ||||
| BD33 | RET | Return. | ||||
|
View the equivalent code in;
|
||||||
| Prev: BC83 | Up: Map | Next: BD34 |