![]() |
Routines |
| Prev: 48951 | Up: Map | Next: 49107 |
|
Used by the routine at DrawChangedObjects.
Draws the objects that the player is carrying on the panel, but only if they have changed since they were last drawn. The panel has room for three objects, which are drawn from the left: the object that was picked up last comes first. Each object is drawn in a space of 24 by 24 pixels, with a colour that goes with it.
|
||||||
| DisplayObjectsCarried | 48965 | LD A,(23476) | Fetch the flag that says the objects carried have changed from ObjectsCarriedChangedFlag. | |||
| 48968 | AND A | Test it. | ||||
| 48969 | RET Z | Return if they have not changed. | ||||
| 48970 | XOR A | Clear A. | ||||
| 48971 | LD (23476),A | Clear the flag at ObjectsCarriedChangedFlag. | ||||
|
This entry point is used by the routine at RunGame.
The objects are drawn using an object that is kept just for drawing the panel.
|
||||||
| DisplayObjects | 48974 | PUSH IX | Stash IX on the stack. | |||
| 48976 | LD IX,49115 | Point IX at PanelObject. | ||||
| 48980 | LD B,3 | Set the number of objects to 3. | ||||
| 48982 | LD HL,23516 | Point HL at ObjectsCarried_Newest. | ||||
| DisplayObjects_Next | 48985 | PUSH BC | Stash the number of objects left on the stack. | |||
| 48986 | PUSH HL | Stash the address of the object carried on the stack. | ||||
| 48987 | LD A,B | Copy the number of objects left into A. | ||||
| 48988 | NEG | Negate it. | ||||
| 48990 | ADD A,3 | Add 3, to get the number of objects done. | ||||
| 48992 | SLA A | Multiply it by eight. | ||||
| 48994 | SLA A | |||||
| 48996 | SLA A | |||||
| 48998 | LD C,A | Stash it in C. | ||||
| 48999 | SLA A | Multiply it by two. | ||||
| 49001 | ADD A,C | Add the number multiplied by eight, to get it multiplied by 24. | ||||
| 49002 | ADD A,16 | Add 16 to get the pixel X coordinate. | ||||
| 49004 | LD (IX+26),A | Set the pixel X coordinate. | ||||
| 49007 | LD (IX+27),0 | Set the pixel Y coordinate to 0. | ||||
| 49011 | LD C,(IX+26) | Fetch the pixel X coordinate into C. | ||||
| 49014 | LD B,(IX+27) | Fetch the pixel Y coordinate into B. | ||||
| 49017 | PUSH HL | Stash the address of the object carried on the stack. | ||||
| 49018 | CALL CalculateBufferAddress | Find the address in the screen buffer. | ||||
| 49021 | LD L,C | Copy it to HL. | ||||
| 49022 | LD H,B | |||||
| 49023 | LD BC,792 | Set the width to 3 bytes and the height to 24 lines. | ||||
| 49026 | XOR A | Set the fill byte to 0. | ||||
| 49027 | CALL FillWindow | Clear the area. | ||||
| 49030 | POP HL | Restore the address of the object carried from the stack. | ||||
| 49031 | LD A,(HL) | Fetch the graphic number of the object. | ||||
| 49032 | AND A | Test it. | ||||
| 49033 | JR Z,DisplayObjectsCarried_CopyPlace | Jump to DisplayObjectsCarried_CopyPlace if there is no object. | ||||
| 49035 | LD (IX+0),A | Set the graphic number of the panel object. | ||||
| 49038 | CALL PrintSprite | Draw the object. | ||||
|
Copy the area from the screen buffer to the display.
|
||||||
| DisplayObjectsCarried_CopyPlace | 49041 | LD C,(IX+26) | Fetch the pixel X coordinate into C. | |||
| 49044 | LD B,(IX+27) | Fetch the pixel Y coordinate into B. | ||||
| 49047 | CALL CalculateScreenAddress | Find the address in the display. | ||||
| 49050 | CALL CalculateBufferAddress | Find the address in the screen buffer. | ||||
| 49053 | LD L,C | Copy it to HL. | ||||
| 49054 | LD H,B | |||||
| 49055 | LD BC,6147 | Set the number of lines to 24 and the number of bytes to 3. | ||||
| 49058 | CALL CopyBlockToScreen | Copy the area to the display. | ||||
|
Colour the area.
|
||||||
| 49061 | POP HL | Restore the address of the object carried from the stack. | ||||
| 49062 | POP BC | Restore the number of objects left from the stack. | ||||
| 49063 | PUSH BC | Stash the number of objects left on the stack. | ||||
| 49064 | PUSH HL | Stash the address of the object carried on the stack. | ||||
| 49065 | LD A,(HL) | Fetch the graphic number of the object. | ||||
| 49066 | AND %00001111 | Keep the number of the object. | ||||
| 49068 | LD E,A | Copy it into E. | ||||
| 49069 | LD D,0 | Clear D. | ||||
| 49071 | LD HL,49107 | Point HL at ObjectAttributes. | ||||
| 49074 | ADD HL,DE | Find the attribute of the object. | ||||
| 49075 | LD C,(HL) | Fetch it into C. | ||||
| 49076 | LD L,(IX+26) | Set L to the pixel X coordinate. | ||||
| 49079 | LD A,(IX+27) | Fetch the pixel Y coordinate. | ||||
| 49082 | ADD A,23 | Add 23, to get the top of the area. | ||||
| 49084 | LD H,A | Use it as the Y coordinate of the position. | ||||
| 49085 | CALL CalculateAttributeAddress | Find the address in the attribute file. | ||||
| 49088 | EX DE,HL | Copy it to HL. | ||||
| 49089 | LD A,C | Fetch the attribute. | ||||
| 49090 | LD BC,771 | Set the width to 3 and the height to 3. | ||||
| 49093 | CALL FillWindow | Colour the area. | ||||
| 49096 | POP HL | Restore the address of the object carried from the stack. | ||||
| 49097 | POP BC | Restore the number of objects left from the stack. | ||||
| 49098 | INC HL | Move on to the next object carried. | ||||
| 49099 | INC HL | |||||
| 49100 | INC HL | |||||
| 49101 | INC HL | |||||
| 49102 | DJNZ DisplayObjects_Next | Jump to DisplayObjects_Next until all of the objects have been drawn. | ||||
| 49104 | POP IX | Restore IX from the stack. | ||||
| 49106 | RET | Return. | ||||
|
||||||
| Prev: 48951 | Up: Map | Next: 49107 |