Creates a CCB relative address.
int32 MakeCCBRelative (field, linkObject)
MakeCCBRelative()
allows you to turn the absolute address of an object into the sort of relative address needed by the cel engine. The first argument is a pointer to the field to receive the relative address and the second argument is a pointer to the object to be referenced. This macro does the math required to create a correct relative offset, which is not simply the difference between the two addresses. For example, to create a relative pointer to a “next cel” you would use these arguments:
cel->ccb_Next Ptr=(CCB*)CCB_Relative(&cel->ccb_Next Ptr,&Next Cel();
To make sure the cel indicates it has a relative pointer to the next cel, explicitly clear the control flag:
Clear Flag(cel->ccb_Flags,CCB_NPABS);
This macro is required because the cel engine uses pipelined prefetch techniques that keep the cel engine's internal addressing ahead of the internal logic that processes the addresses and data in the cel control block.
The macro returns an int32 value that is the relative offset between the two addresses corrected (offset) as required by the cel engine.
Macro implemented in graphics.h V20.
graphics.h