x86 Assembly Language Reference Manual

Expression Semantics (Absolute vs. Relocatable)

Semantically, the expressions fall into two groups, absolute and relocatable. The equations later in this section show the legal combinations of absolute and relocatable operands for the addition and subtraction operators. All other operations are only legal on absolute-valued expressions.

All numbers have the absolute attribute. Symbols used to reference storage, text, or data are relocatable. In an assignment statement, symbols on the left side inherit their relocation attributes from the right side.

In the equations below, a is an absolute-valued expression and r is a relocatable-valued expression. The resulting type of the operation is shown to the right of the equal sign.

	a + a = a
	r + a = r
	a - a = a
	r - a = r
	r - r = a

In the last example, you must declare the relocatable expressions before taking their difference.

Following are some examples of valid expressions:



	[label + 0x100]

	[label1 - label2]

	$[label1 - label2]

Following are some examples of invalid expressions:

	[$label - $label]

	[label1 * 5]

	(label + 0x20)