Com 212 intro to system programming book Theory



Download 0.65 Mb.
View original pdf
Page9/72
Date13.05.2021
Size0.65 Mb.
#56617
1   ...   5   6   7   8   9   10   11   12   ...   72
com-212-introduction-to-system-programming-theory
9833 SS1 FISHERY LESSON NOTE
THE ONE-PASS ASSEMBLER

As its name implies, this assembler reads the source file once. During that single pass, the assembler handles both label definitions and assembly. The only problem is future symbols and, to understand the solution Lets consider the following example LC
36 BEQ AB BRANCH ON EQUAL
67 BNE AB BRANCH ON NOT EQUAL
89 JMP AB UNCONDITIONALLY
126 AB anything Symbol AB is used three times as a future symbol. On the first reference, when The LC happens to stand at 36, the assembler searches the symbol table for AB , does not find it, and therefore assumes that it is a future symbol. It then inserts AB into the symbol table but, since AB has no value yet, it gets a special type. Its type is U (underlined. Even though it is still underlined, it now occupies an entry in the Symbol table, an entry that will be used to keep track of AB as long as it is a future symbol. The next step is to set the value field of that entry to 36 (the current value of the LC).This means that the symbol table entry for AB is now pointing to the instruction in which AB is needed. The value field is an ideal place for the pointer since it is the rightsize, it is currently empty, and it is associated with AB The BEQ instruction itself is only partly assembled and is stored, incomplete, in memory location The field in the instruction were the value of AB should be stored (the address field),remains empty.

Page | 13 When the assembler gets to the BNE instruction (at which point the LC stands at 67), it searches the symbol table for AB , and finds it. However, AB has a type of U , which means that it is a future symbol and thus its value field (=36) is not a value but a pointer It should be noted that, at this point, a type of U does not necessarily mean an underlined symbol. While the assembler is performing its single pass, any underlined symbols must be considered future symbols. Only at the end of the pass can the assembler identify underlined symbols (see below).The assembler handles the BNE instruction by i)
Download 0.65 Mb.

Share with your friends:
1   ...   5   6   7   8   9   10   11   12   ...   72




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

    Main page