SMRLW


Adds an offset to the mirror destination to the address of a symbol, adds an integer value to the obtained value, and then obtains the value of the lower-order 16 bits among the 32-bit value of the result.

[Function]

When the specified term is an expression that adds an integer value to a relocatable symbol, only the symbol is checked instead of the value of the whole term. When the symbol is in the mirror source area, the offset to the mirror destination is added to the address of the symbol, the specified integer value is added to the obtained value, and then the value of the lower-order 16 bits among the 32-bit value of the result is returned.

When the relocatable symbol is outside the mirror source area, an error will occur at linkage.

When the term is an absolute term, the same value as for LOWW is returned. When the term only refers to a relocatable symbol, the same value as for MIRLW is returned.

 

Only a term that takes any one of the following forms after operation by the assembler is allowed. In other cases, errors will occur. (A is an absolute symbol, R is a relocatable symbol, and C is an integer constant in the following forms.)

This is also applicable to MIRLW and MIRHW.

-

SMRLW(C) : Same operation as LOWW.

-

SMRLW(A) : Same operation as LOWW.

-

SMRLW(R) : R is checked as to whether it is in the mirror source area.

-

SMRLW(R + C) : R is checked as to whether it is in the mirror source area.

-

SMRLW(R - A + C) : R is checked as to whether it is in the mirror source area.

[Application example]

MOVW    AX, #SMRLW(GSYM + 0x1000)       ; (1)

GSYM is an external reference name.

(1)

When the address of relocatable symbol GSYM is in the mirror source area, it is converted to the corresponding address in the mirror destination, 0x1000 is added to the obtained value, and then the value of the lower-order 16 bits of the result is loaded in the AX register.