SPOS Practical - Assign No1
SPOS Practical - Assign No1
SPOS Practical - Assign No1
EXPERIMENT NO : 01
1 Title:
2 Theory Concepts
Introduction :-
Disadvantages:
Not portable
More complex
Requires understanding of hardware details (interfaces)
Pass – 1 Assembler:
A two-pass assembler performs two sequential scans over the source code:
Data Structures:
- Location counter (LC): points to the next location where the code will be placed
- String storage buffer (SSB): contains ASCII characters for the strings
Statement format :
Associates the name ONE with a memory word containing the value ‘1’ . The programmer can
declare constants in decimal,binary, hexadecimal forms etc., These values are not protected by the
assembler. In the above assembly language program the value of ONE Can be changed by executing
an instruction MOVEM BREG,ONE
START <Constant>
Indicates that the first word of the target program generated by the assembler should be
placed in the memory word with address <Constant>
One complete scan of the source program is known as a pass of a Language Processor.
First type to be developed Most Primitive Source code is processed only once.
The operand field of an instruction containing forward reference is left blank
During the scan of the source program, all the symbols will be stored in a table called
SYMBOL TABLE. Symbol table consists of two important fields, they are symbol name
and address.
All the statements describing forward references will be stored in a table called Table of
Incompleted Instructions (TII)
TII (Table of Incomplete instructions)
By the time the END statement is processed the symbol table would contain the address of
all symbols defined in the source program.
□ Synthesis the target form using the address information found in Symbol table.
□ First pass constructs an Intermediated Representation (IR) of the source program for
use by the second pass.
1 ORIGIN
2 EQU
3 LTROG
ORIGIN :
Indicates that Location counter should be set to the address given by < address spec>
This statement is useful when the target program does not consist of consecutive memory
words. Eg) ORIGIN Loop + 2
EQU : Syntax
Loop LTORG :
(Literal Origin)
PASS 2:-
Note :(you can also write your own theory for this practical)
Solve the below example.for Pass-1 Assembler.
Conclusion :
Thus , I have implemented Pass-1 & Pass -II assembler with symbol table, literal table,pool table
and Machine Opcode Table .