Prev: DA88 Up: Map Next: DADC
DAC8: Object - vertical room position check/adjustment
Used by the routines at CB00, CB5B and D12E.
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 E039
DAC8 LD A,($EB4A) Graphic vertical position (of object) from top of screen (pixels)
DACB LD E,A Store in E register
DACC LD HL,$EAF6 Address holding vertical position of room (viewport) in pixels
DACF INC HL ...the main value is stored in the high byte of the address, so advance to this address
DAD0 LD A,$60 Offset (96 pixels, from top of screen) for the bottom of the room's active playing area
DAD2 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)...
DAD3 SUB E ...Subtract the object's vertical screen position
DAD4 JR C,$DADB 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.
DAD6 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
DAD7 AND $7F Halve this value, and filter out bit 7 as it's not needed
DAD9 ADD A,E Store in E register
DADA LD E,A
DADB RET
Prev: DA88 Up: Map Next: DADC