Com 212 intro to system programming book Theory



Download 0.65 Mb.
View original pdf
Page11/72
Date13.05.2021
Size0.65 Mb.
#56617
1   ...   7   8   9   10   11   12   13   14   ...   72
com-212-introduction-to-system-programming-theory
9833 SS1 FISHERY LESSON NOTE

Exercise What if a certain symbol is needed in pass 2, to assemble an instruction, and is not found in the symbol table To assign values to labels in pass 1, the assembler has to maintain the LC. This in turn means that the assembler has to determine the size of each instruction (in words, even though the instructions themselves are not assembled. In many cases it is easy to figure out the size of an instruction. On the IBM 360 for example, the mnemonic determines the size uniquely. An assembler for this machine keeps the size of each instruction in the Op-Code table together with the mnemonic and the Op-Code . On the DEC PDP-11 the size is determined both by the type of the instruction and by the addressing modes) that it uses. Most instructions are one word (16- bits) long. However, if they use either the index or index deferred modes, one more word is added to the instruction. If the instruction has two operands (source and destination) both using those modes, its size will be 3 words. On most modern microprocessors, instructions are between
1 and 4 bytes long and the size is determined by the Op-Code and the specific operands used. This means that, in many cases, the assembler has to work hard in the first pass just to determine the size of an instruction. It has to look at the mnemonic and, sometimes, at the operands and the modes, even though it does not assemble the instruction in the first pass. All the information about the mnemonic and the operand collected by the assembler in the first pass is extremely useful in the second pass, when instructions are assembled. This is why many assemblers save all the information collected during the first pass and transmit it to the second pass through an intermediate file Each record on the intermediate file contains a copy of a source line plus all the information that has been collected about that line in the first pass. At the end of the first pass the original source leis closed and is no longer used. The intermediate leis reopened and is read by the second pass as its input file. A record in atypical intermediate file contains i)
The record type. It can bean instruction, a directive, a comment, or an invalid line. ii) The LC value for the line. iii) A pointer to a specific entry in the Op-Code table or the directive table. The second pass uses this pointer to locate the information necessary to assemble or execute the line.

Page | 15 More sophisticated high-level assemblers provide language abstractions such as Advanced control structures

High-level procedure/function declarations and invocations

High-level abstract data types, including structures/records, unions, classes, and sets Sophisticated macro processing

Object-Oriented features such as encapsulation, polymorphism, inheritance, interfaces

Download 0.65 Mb.

Share with your friends:
1   ...   7   8   9   10   11   12   13   14   ...   72




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

    Main page