Вы находитесь на странице: 1из 26

Unit -I

System Software

Basic Assembler
Functions
Fundamental functions of Assembler:
Translating mnemonic code to machine
language.
Assigning machine address.
What is mnemonic Instructions?
Load, Move,add,sub,Etc..

Additional Instructions
START: Specify name and starting address for

program.
END: End of source program and (Optionally )next
executable program.
BYTE: Generate character or hexadecimal constant,
occupying as many bytes as needed to represent the
constant.
WORD: Generate one word integer constant.
RESB: (Bytes) Reserve the indicated number of bytes
for a data area.
RESW: (Word) Reserve the indicated number of words
for a data area.

Example of a SIC assembler


language program.
An example of a SIC assembler language

program.
Reading input from F1(Input Device).
Copies them to an output device.
It has two subroutine.
SUB-1: RDREC(Read record into a buffer)
SUB-2: WRREC (Write record from buffer to

output device.)

Why Buffer?: To Synchronize I/O rates

between two device.

If RD & WD used, only one character will be

transferred at a time.
Each end of record marked with null
character (00 hexadecimal) .
If end of record is detected, the program
writes EOF.

A Simple SIC Assembler


Source to Object Translations Steps:
1. Mnemonic to machine language (STL14)
2. Symbolic operands to machine
address( RETADR 1033).
3. Build the machine instruction in the proper
format.
4. Data constants into internal machine
representations. ( EOF 454F46).
5. Write the object program and the assembly
listing.

Forward reference
Forward reference:
If the symbolic constant comes in more than
one time is called as forward reference.
The symbolic constant will have address by
later.
So two pass is required.
1st pass assigning address space for symbolic
constant.
2nd pass remaining process.

Assembler Directive
First statement to be processed is called

assembler directives.
Assembler directive provide instruction to
assembler itself.
START specifies the starting memory address

for the object program.


END To mark end of the program

Object program into


output
The assembler must writes object code into

some output device.


Then the object program will be loaded for
executions.
Three types of records namely Header, Text and

End

Object program format(Header, Text and End)

Header:
Program name, Starting address and Length.

Header Record:
Col. 1
H // column is nothing but byte.
Col. 2-7
Program Name
Col. 8-13
Object program starting address(In
hexadecimal).
Col. 14-19 Length of object program in bytes
(In hexadecimal).

Text:
Machine code and data with indications of address.
Text Header:
Col. 1
T
Col. 2-7
Starting address for object code in this
record(In hexadecimal).
Col. 8-9
Length of the object code in this record
in bytes.
Col. 10-69 Object code in hexadecimal.

End:
Marks end of the program and next starting
address
End Record:
Col. 1
E
Col. 2-7 Address for next executions.

Conversions of Object Code


Pass 1: (Define Symbols):
1. Assign address to all statement in the program.
2. Save the address assigned to all labels for use
in Pass-2.
3. Processing of assembler directive.

Pass-2:
1. Assemble instructions(translating operation
code and looking up address).
2. Generate data values defined by BYTE,
WORD, etc( value fulfilling 0 into 0000).
3. Processing of assembler directives not done
in pass-1.
4. Write object program and the assembly
listing.

Example of Object Code

Assembler Algorithms and Data


Structure
Major Internal Data Structure:
OPTAB Operations Code Table
SYMTAB Symbol Table
LOCCTR Locations Counter

LOCCTR
It is a variable used to help in the

assignment of address.
Initially it has the address of START address.
After each source statement processed, the
length of the assembled instruction or data
area to be generated is added to LOCCTR.
Thus whenever we reach a label in the source
program the current value of LOCCTR gives
the address to be associated with the label.

OPTAB
It has Mnemonic Operation Code and its

equivalent machine code.


Instruction format and its length.
During Pass 1: Look up and validate
operations codes in the source
program(Syntax verifications).
In pass 2: Translations of op code into
machine code.
It is organized as hash table (Fast retrieval
with minimum of search)with mnemonic
code as key.

SYMTAB
It is used to store values(address) assigned

to labels. (Name and value pairs).


Flags are used to identify duplicate label
used in source program.
Types of label and length of label also
stored. (Data type and Size).
During Pass 1: Label and its address(from
LOCCTR) are stored in SYMTAB.
Pass 2: Assembled instruction are stored in
specified address.

It is also organized as hash table.


Pass 1 usually writes an intermediate file

that contains each source statement together


with its assigned address, error indicators ,etc.
( for the purpose of location counter value
and error flags.)
Pointer are use between OPTAB and SYMTAB.

Вам также может понравиться