Professional Documents
Culture Documents
Role of Assembler
Source Object
Assembler Linker
Program Code
Executable
Code
Loader
Elements of Assembly Language
Format of Statement
[label] <opcode> <operand>[,..<operand>..]
AREA
AREA + 5
AREA(4)
Types of Assembly Statements
IMPERATIVE STATEMENTS
DECLARATION STATEMENTS
ASSEMBLER DIRECTIVES
Imperative Statements
Memory Reference/ Transfer Control
Arithmetic
Logical
Flow Control
Imperative Statements
STOP 00 READ 09
ADD 01 PRINT 10
SUB 02
MULT 03
MOVER 04
MOVEM 05
COMP 06
BC 07
DIV 08
EXAMPLES :
MOVER BREG , ONE
MOVEM BREG, TERM
NEXT MULT CREG,TERM
COMP CREG, N
BC LE, NEXT
DECLARATION STATEMENTS
DS – Reserves storage space
DC – Declares constant & reserves memory
Formats
DS: [label] DS <constant>
e.g. A DS 1
A DS 10
DC: [label] DC ‘<value>’
e.g. T DC ‘5’
Literals vs. DC vs. Immediate Operands
Literals Constants Immediate
Operands
ADD AREG, ‘=5’ ADD AREG,FIVE ADD AREG, 5
……..
……..
FIVE DC ‘5’
START
Syntax: START <constant>
e.g. START 200
END
Syntax: END [<operand spec>]
e.g. END
END 205
LTORG
Assigns memory locations to various literals.
Literal Pool
END statement.
????
START 100
L1 MOVER AREG, =’6’
BC LE, NEXT
ORIGIN L2
C DC ‘5’
N DS 1
END L2
Language Processor
Analysis Phase
Synthesis Phase
ASSEMBLER:
General Design Specification
Phases
Data Structures
Translation Schemes
General Design Specifications
Specify the Problem & identify
information
Specify data structures
required
Specify the algorithm to be used
Translation Scheme
Single Pass Translation
Two Pass Translation
LC SYMTAB
Data Structures Used
Symbol Table (SYMTAB)
Literal Table (LITTAB)
Operation Code Table (OPTAB,POT,MOT)
Location Counter (LC)
Pool table (POOLTAB)
OPTAB
Mnemonic Class Mnemonic Info
Opcode
MOVER IS (04,1)
DS DL R#7
START AD R#1
Symbol Table (SYMTAB)
SYMBOL LOCATION LENGTH
A 101 3
L1 104 1
Literal Table ( LITTAB)
Literal Address
1 =‘6’
2 =‘1’
POOLTAB
LITERAL NO.
#1
#2
FLOW CHART & ALGORITHM
PASS - I