In GNU as (the GNU collector), the following code compiles without errors:
mov $(80 * 24 + 4), %cx
However, this code does not:
mov $(80 * 24 / 4), %cx
Radiation of a very unexpected error:
example.S: Assembler messages: example.S:42: Error: unbalanced parenthesis in operand 1.
The only difference is that the latter uses division instead of adding. This must be valid, according to the manual .
( $<expression> embeds immediately in the collected result, that is, a constant. Arithmetic is performed at “compilation time.” I could work out the math, but it makes more sense in its extended form.)
source share