Com 212 intro to system programming book Theory



Download 0.65 Mb.
View original pdf
Page28/72
Date13.05.2021
Size0.65 Mb.
#56617
1   ...   24   25   26   27   28   29   30   31   ...   72
com-212-introduction-to-system-programming-theory
9833 SS1 FISHERY LESSON NOTE
EXAMPLE.LOCAL LABELS.
The example shows that local labels is a simple, useful, concept that is easy to implement. Ina two-pass assembler, each local label is entered into the symbol table as any other symbol, in pass Thus the symbol table in our example contains Symbol Table n v
113 124 131 2 102 The order of the labels in the symbol table is important. If the symbol table is sorted between the two passes, all occurrences of each octal label should remain sorted by value. In pass when an

Page | 34 instruction uses a octal label such as F , the assembler identifies the specific occurrence of label
1 by comparing all local labels 1 to the current value of the LC. The first such instruction in our example is the ‘JMP Fat LC=17.Clearly,the assembler should look fora octal label with the name ‘1 and a value The smallest such label has value In the second case, LC and the assembler is looking fora B It needs the label with name ‘1 ’ and a value which is the largest among all values <24.It therefore identifies the label as the ‘1 ’at 13.
EXERCISE
If we modify the instruction at 24 above to read 1:LOD RF would the F refer to address 31 or 24? Ina one-pass assembler, again the labels are recognized and put into the symbol table in the single pass. An instruction using a octal label iB is no problem, since is needs the most recent occurrence of the local label ‘1 in the table. An instruction using an iF is handled like any other future symbol case. An entry is opened in the symbol table with the name iF a type of U and a value which is a pointer to the instruction. In the example above, a snapshot of the symbol table at LC is

Download 0.65 Mb.

Share with your friends:
1   ...   24   25   26   27   28   29   30   31   ...   72




The database is protected by copyright ©ininet.org 2024
send message

    Main page