Raj Kumar
Computer Science And Engineering

What are the Different types of assemblers and Explain the features used in assemblers

System Software and Compiler Design

Explanation

972    0
Machine-Dependent Assembler Features:
➜Instruction formats and addressing modes
➜Program relocation.
Instruction formats and Addressing Modes
The instruction formats depend on the memory organization and the size of the memory. In SIC machine the memory is byte addressable. Word size is 3 bytes. So the size of the memory is 2^12 bytes. Accordingly it supports only one instruction format. It has only two registers: register A and Index register. Therefore the addressing modes supported by this architecture are direct, indirect, and indexed. Whereas the memory of a SIC/XE machine is.
220 bytes (1 MB). This supports four different types of instruction types, they are:   1 byte instruction
  2 byte instruction
  3 byte instruction
  4 byte instruction
Instructions can be:


–-- Instructions involving register to register
–-- Instructions with one operand in memory, the other in Accumulator (Single operand instruction)
--– Extended instruction format
Addressing Modes are:
–-- Index Addressing(SIC): Opcode m, x
–-- Indirect Addressing: Opcode @m
–-- PC-relative: Opcode m
--– Base relative: Opcode m
–-- Immediate addressing: Opcode #c
Translations for the Instruction involving Register-Register addressing mode:
During pass 1 the registers can be entered as part of the symbol table itself. The value for these registers is their equivalent numeric codes. During pass2, these values are assembled along with the mnemonics object code. If required a separate table can be created with the register names and their equivalent numeric values.

Translation involving Register-Memory instructions:
In SIC/XE machine there are four instruction formats and five addressing modes. For formats and addressing modes. Among the instruction formats, format -3 and format-4 instructions are Register-Memory type of instruction.
Program relocation
➜The actual starting address of the program is not known until load time
➜An object program that contains the information necessary to perform this kind of modification is called a relocatable program
➜No modification is needed: operand is using program-counter relative or base relative addressing
➜The only parts of the program that require modification at load time are those that specified direct (as opposed to relative) addresses
➜Modification record
 ⦿Col. 2-7 Starting location of the address field to be modified, relative to the beginning of the program (Hex)
➜Col. 8-9 Length of the address field to be modified, in half-bytes (Hex)

Machine independent assembler feature:

Literals
Symbol-defining statements
Expressions
Program block
Control sections and program linking

Literals
 
 Write the value of a constant operand as a part of the instruction that uses it Such an operand is called a literal
 
 Avoid having to define the constant elsewhere in the program and make up a label for it
 
 A literal is identified with the prefix =, which is followed by a specification of the literal value
 
 Examples of literals in the statements:

o45	001A	ENDFIL	LDA	=C’EOF’    032010
o215	1062	WLOOP	TD	=X’05’	   E32011 

 
 With a literal, the assembler generates the specified value as a constant at some other memory location
 
 The address of this generated constant is used as the target address for the machine instruction
 
 All of the literal operands used in the program are gathered together into one or more literal pools
 
 Normally literals are placed into a pool at the end of the program
 
 A LTORG statement creates a literal pool that contains all of the literal operands used since the previous LTORG
 
 Most assembler recognize duplicate literals: the same literal used in more than one place and store only one copy of the specified data value
 
 LITTAB (literal table): contains the literal name, the operand value and length, and the address assigned to the operand when it is placed in a literal pool

Expressions
 Assembler allow arithmetic expressions formed according to the normal rules using the operator +, -, *, and /
 Individual terms in the expression may be constants, user-defined symbols, or special terms
 The most common such special term is the current value of the location counter (designed by *)
 Expressions are classified as either absolute expressions or relative expressions
Program Block
 Program blocks: segments of code that are rearranged within a single object unit
 Control sections: segments that are translated into independent object program units
 USE indicates which portions of the source program belong to the various blocks
Control section
 References between control sections are called external references
 The assembler generates information for each external reference that will allow the loader to perform the required linking
 The EXTDEF (external definition) statement in a control section names symbol, called external symbols, that are define in this section and may be used by other sections
 The EXTREF (external reference) statement names symbols that are used in this control section and are defined elsewhere
Define record (D)
⦿  Col. 2-7 Name of external symbol defined in this control section
⦿  Col. 8-13 Relative address of symbol within this control section (Hex)
⦿  Col. 14-73 Repeat information in Col. 2-13 for other external symbols
Refer record (R)
⦿  Col. 2-7 Name of external symbol referred to in this control section
⦿  Col. 8-73 Names of other external reference symbols
Modification record (revised : M)
⦿  Col. 2-7 Starting address of the field to be modified, relative to the beginning of the control section (Hex)
⦿  Col. 8-9 Length of the field to be modified, in half-bytes (Hex)
⦿  Col. 10 Modification flag (+ or -)
⦿  Col. 11-16 External symbol whose value is to be added to or subtracted from the indicated field


Share:   
   Raj Kumar
Computer Science And Engineering

More Questions from System Software and Compiler Design Module 1