Sunday, March 30, 2014

Multimedia Notes BCA, B.Tech

Multimedia Notes For BCA, B.Tech By Faruk Kazi

Faruk Kazi notes is one of the best notes for multimedia Systems. You can find every matched syllabus of BE,B.Tech, BCA in this notes.

Download Here

Multimedia Notes Faruk Kazi

Assembler

Assembler Notes


Assembler is system software which is used to convert an assembly language program to
its equivalent object code. The input to the assembler is a source code written in assembly
language (using mnemonics) and the output is the object code. The design of an
assembler depends upon the machine architecture as the language used is mnemonic
language.
1. Basic Assembler Functions:
The basic assembler functions are:
  Translating mnemonic language code to its equivalent object code.
 Assigning machine addresses to symbolic labels.


Source Program
-Mnemonic opcode
-Symbol
 

Assembler
 

Object Code
 
 

 • The design of assembler can be to perform the following: –
 Scanning (tokenizing) –
 Parsing (validating the instructions) –
Creating the symbol table –
Resolving the forward references –
Converting into the machine language
• The design of assembler in other words:
– Convert mnemonic operation codes to their machine language equivalents
 – Convert symbolic operands to their equivalent machine addresses
– Decide the proper instruction format Convert the data constants to internal machine
representations
– Write the object program and the assembly listing

So for the design of the assembler we need to concentrate on the machine architecture of
the SIC/XE machine. We need to identify the algorithms and the various data structures
to be used. According to the above required steps for assembling the assembler also has
to handle assembler directives, these do not generate the object code but directs the
assembler to perform certain operation. These directives are: • SIC Assembler Directive:
– START: Specify name & starting address.
– END: End of the program, specify the first execution instruction.
– BYTE, WORD, RESB, RESW
– End of record: a null char(00)
End of file: a zero length record
The assembler design can be done:
 Single pass assembler
 Multi-pass assembler
Single-pass Assembler:
In this case the whole process of scanning, parsing, and object code conversion is
done in single pass. The only problem with this method is resolving forward reference.
This is shown with an example below:
10  1000  FIRST     STL   RETADR 141033
--
--
--
--95 1033 RETADR RESW 1
In the above example in line number 10 the instruction STL will store the linkage
register with the contents of RETADR. But during the processing of this instruction the
value of this symbol is not known as it is defined at the line number 95. Since I single- pass assembler the scanning, parsing and object code conversion happens simultaneously.
The instruction is fetched; it is scanned for tokens, parsed for syntax and semantic
validity. If it valid then it has to be converted to its equivalent object code. For this the
object code is generated for the opcode STL and the value for the symbol RETADR need
to be added, which is not available.
Due to this reason usually the design is done in two passes. So a multi-pass
assembler resolves the forward references and then converts into the object code. Hence
the process of the multi-pass assembler can be as follows:
Pass-1
 Assign addresses to all the statements
 Save the addresses assigned to all labels to be used in Pass-2
 Perform some processing of assembler directives such as RESW, RESB to find
the length of data areas for assigning the address values.  Defines the symbols in the symbol table(generate the symbol table)
Pass-2
 Assemble the instructions (translating operation codes and looking up addresses).
 Generate data values defined by BYTE, WORD etc.
  Perform the processing of the assembler directives not done during pass-1.
 Write the object program and assembler listing.

Two Pass Assembler

Mostly assembler are designed in two passes(stages), therefore, they are called Two-Pass Assemblers. 'Re pass-wise grouping of tasks in a two pass assembler is given below:
Pass I
  • Separate the symbols, mnemonic op-code and operational fields.
  • Determine the storage requirement for every assembly language statement and up date the location counter.
  • Build the symbol table. (Table that is used to store each label and its corresponding value).
Pass II
  • Generate object code.
FUNCTION
The program of figure 5, although, written in a hypothetical assembler language, contains the basic elements which need to be translated into machine language. (It is not essential for students to understand the meaning of each statement of the program.) For ease of reference, each instruction is defined by a line number, which is not part of the program. Each instruction in our language contains either an operation specification (lines 1- 15) or a storage specification (lines 16- 21). An operation specification is a symbolic operation code, which may be preceded by a label and must be followed by 0, 1, or two operand specifications, as appropriate to the operation. A storage specification is a symbolic instruction to the assembler. In our assembler language, it must be preceded by a label and must be followed, if appropriate, by a constant FIXED. Labels and operand specifications are symbolic addresses; every operand specification must appear somewhere in the program as a label.
Line
Label
Operation
Operand 1
Operand 2
1

COPY
ZERO
OLDER
2

COPY
ONE
OLD
3

READ
LIMIT

4

WRITE
OLD

5
FRONT
LOAD
OLDER

6

ADD
OLD

7

STORE
NEW

8

SUBST
LIMIT

9

BRPOS
FINAL

10

WRITE
NEW

11

COPY
OLD
OLDER
12

COPY
NEW
OLD
13

JMP
FRONT

14
FINAL
WRITE
LIMIT

15

STOP


16
ZERO
CONST
0

17
ONE
CONST


18
OLDER
SPACE


19
OLD
SPACE


20
NEW
SPACE


21
LIMIT
SPACE