Program Structure
Expressions
Expressions produce either an absolute or a relocatable result. Any operation involving only absolute terms yields an absolute result. Relocatable terms are allowed only for the + and - operators. The legal combinations involving relocatable terms are shown in “Legal Combinations For Relocatable Terms” on page 30.
Table |
| Legal Combinations For Relocatable Terms |
|
| |
|
|
|
|
|
|
|
| Operation |
| Result |
|
|
|
|
|
|
|
|
| Absolute + Relocatable |
| Relocatable |
|
|
|
|
|
|
|
|
| Relocatable + Absolute |
| Relocatable |
|
|
|
|
|
|
|
|
| Relocatable - Absolute |
| Relocatable |
|
|
|
|
|
|
|
|
| Relocatable - Relocatable (defined locally) |
| Absolute |
|
|
|
|
|
| |
|
| For more information on the term relocatable, refer to “Assembler | |||
|
| Features” on page 15. |
|
| |
|
| The combination | |||
NOTE |
| ||||
|
| For example, assume the symbols MONTH and YEAR are relocatable, and | |||
|
| ||||
|
| JANUARY and FEBRUARY are absolute. The expressions MONTH+JANUARY | |||
|
| and | |||
|
| ||||
|
| MONTH+JANUARY*4 is also legal and produces a relocatable result, | |||
|
| because JANUARY*4 is evaluated first, producing an absolute | |||
|
| intermediate result that is added to MONTH. The expression MONTH+YEAR | |||
|
| is illegal, because the sum of two relocatable terms is not permitted. |
Because all instructions are a single word in length, it is not possible to form a complete
LDW START,%r2
Because LDW provides only 14 bits for the address of START, the Assembler or linker prints an error message if the address of START requires more than 14 bits. There are two instructions, LDIL and ADDIL, whose function is to form the
30 | Chapter 2 |