Professional Documents
Culture Documents
ASSEMBLER
Role of Assembler
Object
Source
Program
Assembler
Code
addressing scheme
offset
A 1, 250 (0,15)
index register
base register
5 Instruction Formats
RR (register-register)
RX (register-indexed)
RS (register-storage)
SI (storage-immediate)
SS (storage-storage)
Two passes
Source program
Location counter(LC) which stores location of each
instruction
Machine Operation Table (MOT):This table indicates the
symbolic mnemonic for each instructions and its length.
Pseudo Operation Table (POT): This table indicates the
symbolic mnemonic and action taken for each pseudo-op in
pass1.
Symbol Table (ST) which stores each label along with its
value.
Literal Table(LT) which stores each literal and its
corresponding address
A copy of input which will be used by pass2.
Format of databases
Flowchart
Example
Base Table
Flowchart
Synthesis Phase
Addressing
Segment based addressing scheme is used.
Code segment(CS)
Data segment(DS)
Stack segment(SS)
Extra Segment(ES)
Assembler directives
1. EQU : It associates symbol with some address
specification.
<symbol> EQU <address spec>
2. ORG : It is used to set location counter to specified address.
ORG <address spec>
3. ASSUME : This directive tells the assembler which
segment register contains the segment base.
ASSUME <register> :<segment name>
4. SEGMRNT : It indicates start of segment
5. ENDS : It indicates end of segment
Databases required
1.
2.
3.
4.
5.
6.
Source program
Mnemonic Operation Table (MOT). This table indicates
the symbolic mnemonic for each instruction.
Symbol Table (ST) which stores each label along with its
relevant information.
Segment Register Table (SRTAB) which stores
information about segment name and segment register.
Forward Reference Table (FRT) which stores information
about forward references.
Cross reference table (CRT) which list out all references to
a symbol in ascending order of statements.
Machine
op-codes
(2)
75 H
Alignment/forma
t information
(1)
00H
Routine id
(4)
binary
R2
Symbol Tabel
Pointer
(2)
SRTAB #
(1)
Instruction Usage
Address
Code
(2)
(1)
Source
statement
#
(2)
Every type statement requires different processing. The statemets are processed
in following way.
If it is EQU pseudo-op then
Evaluate expression in operand field,
Make entry for the label in SYMTAB
set offset = value of operand
Enter stmt_no in the CRT list of the label in operand field
Process forward references to the label.
size=0
If
If
If
size!=0
If