You are on page 1of 8

DATE:

SYMBOL TABLE GENERATION


EXPT NO:

Aim:

To write a C program to implement Symbol Table

Algorithm:

STEP 1: Start the program for performing create, insert, modify, search, display and exit option
in symbol table.

STEP 2: Define the structure of the Symbol Table

STEP 3: Enter the choice for performing the operations in the symbol Table.

STEP 4: If the entered choice is 1, symbol table is created.

STEP 5: If the entered choice is 2, then a new symbol is inserted into the symbol table.

STEP 6: If the symbol is already present, it displays "variable already exists, enter another
variable". Else, insert the symbol and the corresponding address in the symbol table.

STEP 7: If the entered choice is 3, the symbol to be modified is searched in the symbol table.
The label or address or both can be modified.

STEP 8: If the entered choice is 4, the symbol to be searched is searched in the symbol table.

STEP 9: If the entered choice is 5, the symbol table is displayed.

STEP 10: Stop and execute the program.


DATE:
IMPLENTATION OF PASS ONE OF A PASS TWO
ASSEMBLER
EXPT NO:

Aim:

To write a C program to implement PASS ONE of a two pass assembler.

Algorithm:

STEP 1: Open the files fp1 and fp4 in read mode and fp2 and fp3 in write mode
Read the source program

STEP 2: If the opcode read in the source program is START, the variable location counter is
initialized with the operand value.

STEP 3: Else the location counter is initialized to 0.

STEP 4: The source program is read line by line until the reach of opcode END.

STEP 5: Check whether the opcode read is present in the operation code table.

STEP 6: If the opcode is present, then the location counter is incremented by 3.

STEP 7: If the opcode read is WORD, the location counter is incremented by3.

STEP 8: If the opcode read is RESW, the operand value is multiplied by 3 and then the location
counter is incremented.

STEP 9: If the opcode read is RESB, the location counter value is incremented by operand value.

STEP 10: If the opcode read is BYTE, the location counter is auto incremented.

STEP 11: The length of the source program is found using the location counter value.
DATE: IMPLEMENTATION OF PASS TWO OF A TWO PASS
ASSEMBLER
EXPT NO:

Aim :

To write a c program to implement pass two of a two pass assembler

Algorithm:

STEP 1: Get the intermediate file from pass1

STEP 2: Use the symbol table file and choose it for two pass assembler

STEP 3: Store all opcode’s assembler directives in a file

STEP 4: In the intermediate file,compare the opcode with file and get the corresponding opcode
value

STEP 5: Append this value with its corresponding location counter and store
label,opcode,operand,object code in a new file

STEP 6: Create a file to store and generate the object program format by using the object code
generated in pass1

STEP 7:Display the new file with its contents as header,text and end records.
DATE:

IMPLEMENTATION OF A SIMPLE TEXT EDITOR


EXPT NO:

Aim:

To write a c program for a simple text editor

Algorithm:

STEP 1: Display a Menu using switch case

STEP 2: Enter the choice

STEP 3: If the entered choice is 1, a new file is created.

STEP 4: If the entered choice is 2, an existing file is opened.

STEP 5: If the entered choice is 3, an existing file’s content is edited.

STEP 6: If the entered choice is 4, an existing file is deleted.

STEP 7: If the entered choice is 5, an existing file is renamed.

STEP 8: If the entered choice is 6, the program is existed.

.
DATE:

IMPLEMENTATION OF SINGLE PASS ASSEMBLER


EXPT NO:
Enter ur choice:6
Exit.

Aim:

To implement a single pass assembler using ‘c’ language

Algorithm:

STEP 1:Object code is generated in the program

STEP 2: If symbol is not yet defined,the operand address is omitted

STEP 3:The symbol is entered in the symbol table with ‘$’ pin

STEP 4: When the definition is encountered, program address is inserted in a list associated with
the symbol

STEP 5: continue the process fill the end of program fill all the forward references
DATE:

IMPLEMENTATION OF ABSOLUTE LOADER


EXPT NO:

Aim:

To implement the Absolute Loader using ‘c’ language

Algorithm:

STEP 1: Read the Loader record

STEP 2: Verify program name and length

STEP 3: Read first text record from the input file

STEP 4: Process the following steps until an end record is reached

STEP 5: If Object code is in character form convert in to internal hexadecimal representation.

STEP 6: Move object codes to specified locations in memory

STEP 7: Write the starting location counter value of a blocks of object code and the
corresponding internal representation to the output file

STEP 8: Read next record from the input file

STEP 9: Go to the address specified in end record

STEP 10: Close all the files and edit


DATE:
IMPLEMENTATION OF RELOCATION LOADER
EXPT NO:

Aim:

To write a c program to perform the Relocation Loader

Algorithm:

STEP 1: Start the program

STEP 2: Include the necessary header file and variable

STEP 3: Open the two file for

STEP 3.1: fp1= lin.dat and give read

STEP 3.2: fp2= lout.dat and give write

STEP 4: Read the content

STEP 5: Using while loop perform the loop until character is not equal to E
while(strcmp(input,"E")!=0)

STEP 6: If the character is H


Get the variable add, length, and input

STEP 8: Else if the character is T


Get the variable address and bitmask

STEP 9: And perform the for loop for starting zero to up to len
Get the opcode ,addr and assign relocbit to bitmask
STEP 10: If relocabit is zero
STEP 10.1: Then
actual address=address;
STEP 10.2: else
Add the address and start value

STEP 12: Finally terminate the program

You might also like