Prev: 55944 Up: Map Next: 56028
56008: Object - vertical room position check/adjustment
Used by the routines at 51968, 52059 and 53550.
Check that an object isn't moving (e.g. carried by the servant) below the bottom of the room boundary.
Recalculated vertical pixel position returned in E register, ready for a later call to the room border checks at 57401
56008 LD A,(60234) Graphic vertical position (of object) from top of screen (pixels)
56011 LD E,A Store in E register
56012 LD HL,60150 Address holding vertical position of room (viewport) in pixels
56015 INC HL ...the main value is stored in the high byte of the address, so advance to this address
56016 LD A,96 Offset (96 pixels, from top of screen) for the bottom of the room's active playing area
56018 ADD A,(HL) Add to the room's vertical position (e.g. if Maroc is towards the top of the room, and the room extends downwards off the bottom of the playing area, then it's OK for the object to be dragged there)...
56019 SUB E ...Subtract the object's vertical screen position
56020 JR C,56027 If this results in a carry, it's too far off the bottom of the playing area
While the servant can move anywhere in the visible screen area, objects are constrained by room wall boundaries.
The next set of instructions adds a small offset (based on the room offset position) to the item's vertical position, which is used for later room boundary checks. i.e. extends the boundary
This lets the servant drag the object into the room's wall areas - to an extent at least. Without this adjustment it would be difficult to do certain things, such as drag objects to trade with warlocks.
56022 RRA The A register still contains (from the previous instructions) the difference between the item's vertical position and the bottom of the screen area
56023 AND 127 Halve this value, and filter out bit 7 as it's not needed
56025 ADD A,E Store in E register
56026 LD E,A
56027 RET
Prev: 55944 Up: Map Next: 56028