written 8.5 years ago by | modified 8.5 years ago by |
- Assembler is the language translator that accepts inputs as assembly language (ALP) and obtains its machine equivalent code (Object code) along with the information required by the loader.
- Assembly language program is a low level language.
- The execution of statements can be done line by line.
Types of ALP
Absolute ALP
The address specified for the execution is fixed .we cannot change the address .the allocation is done by the programmer.
Relative ALP
The address specified for the execution can be changed the allocation is done by the loader.
Consider the below example:
Pseudo Opcode Table (POT)
- POT is the fixed length table.
- In pass 1, using Pseudo Opcode, POT is consulted for processing some pseudo opcode like DS, DC, START, END, etc.
- In pass 2 using Pseudo Opcode, POT is consulted for processing some pseudo opcode like DS,DC,USING DROP.
Pseudo Opcode | Address of routine to process pseudo opcode |
---|---|
START | - |
USING | - |
DROP | - |
EQU | - |
DC | - |
DS | - |
START-
- It is used to specify the starting execution of a program.
USING –
- It specifies the base table register that is been used.
DROP –
- It is used to remove the register used in the base table.
EQU-
- It is used for making program more readable. Whenever symbol define with EQU statement no memory would be allocated only an entry would make in symbol table.
Declare Constant (DC) -
- It is used to declare or define the values.
Declare Storage (DS) -
- It is used to store the value at specified address.
Machine Opcode Table (MOT)
- MOT is a fixed length table i.e. we make no entry in either of the passes.
- It is used to accept the instructions and convert/gives its binary opcode.
- In pass 1, using mnemonic Opcode, MOT is consulted to update location Counter (LC).
In pass 2, using mnemonic opcode ,MOT is consulted to obtain
1) Binary opcode (to generate the instruction).
2) Instruction length (to update the instruction).
3) Instruction Format (to assemble the instruction).
M/C Instruction | Binary Opcode | Length | Instruction Format |
---|---|---|---|
L | 4 | - | |
A | 4 | - | |
ST | 4 | - |
L 1, data
Load the data into register.
A 1, data
Add the data into register.
ST 1, temp
Store the content of register to temp (constant).
Instruction:
RR
- The first operand is register and second operator is also register
Opcode | Operand1 | Operand2 |
---|
RX
The first operand is register and second operator is an address.
The address is generated by considering Base + index + displacement.
Opcode | Operand1 | Operand2 |
---|
$$\text{Address = (Base + index + displacement)}$$
Symbol Table (ST)
- Symbol table is used for keeping the track of symbol that are defined in the program.
- It is used to give a location for a symbol specified.
- Symbol is said to be defined it appears in a label field.
- In pass 1, whenever a symbol is defined and for entry is made in symbol table.
- In pass2, symbol table is used for generating address of a symbol.
Symbol | Vale | Length | Relative/Absolute |
---|---|---|---|
PQR | 00 | 01 | R |
FIVE | 16 | 04 | R |
FOUR | 20 | 04 | R |
BASE | 10 | 01 | A |
TEMP | 24 | 04 | R |
Literal Table (LT)
- Literal table is used for keeping track of literals that are encountered in the programs.
- We directly specify the value, literal is used to give a location for the value.
- Literals are always encountered in the operand field of an instruction.
- In pass 1, whenever a Literal is defined and for entry is made in Literal table.
- In pass2, Literal table is used for generating address of a Literal.
Literal | Vale | Length | Relative /Absolute |
---|---|---|---|
= F ‘5’ | 28 | 04 | R |