Sunteți pe pagina 1din 7

1.What is assembly language and assembler.

Write down the advantages and disadvantages of


assembly language. Why we use assembly language.

Solution An assembly language is a low-level programming language for microprocessors and

other programmable devices. It is not just a single language, but rather a group of languages.
Assembly language implements a symbolic representation of the machine code needed to
program a given CPU architecture.Also known as assembly code. The term is often also used
synonymously with 2GL.
An assembler is a type of computer program that interprets software programs written in
assembly language into machine language, code and instructions that can be executed by a
computer. An assembler enables software and application developers to access, operate and
manage a computer's hardware architecture and components. An assembler is sometimes referred
to as the compiler of assembly language. It also provides the services of an interpreter.
Advantages Assembly Language:
1.The symbolic programming of Assembly Language is easier to understand and saves a lot of
time and effort of the programmer.
2. It is easier to correct errors and modify program instructions.
3. Assembly Language has the same efficiency of execution as the machine level language.
Because this is one-to-one translator between assembly language program and its corresponding
machine language program.
Disadvantages Assembly Language:
1.One of the major disadvantages is that assembly language is machine dependent. A program
written for one computer might not run in other computers with different hardware configuration.
2. What is the difference between procedure and macro ?
Macro

Procedure

It will return set of rows to the user

It may return 1 or more values to client as


parameters (not rows)

May contain BTEQ commands

May contain comprehensive SPL

A macro that allows only input values

SP that allows both input and output values

It can fetch rows directly

It must use cursors to fetch the rows.

Accessed during assembly when name given to


macro is written as an instruction in the assembly
program.

Accessed by CALL and RET instructions during


program execution.

Machine code is generated for instructions each


time a macro is called.

Machine code for instructions is put only once in


the memory.

This due to repeated generation of machine code


requires more memory.

This as all machine code is defined only once so


less memory is required.

Parameters are passed as a part of the statement in


which macro is called.

Parameters can be passed in register memory


location or stack.

3. What is assembly statement? What are the rules for declaring namefield in assembly
language?
SolutionThe layout of a machine instruction is part of the architecture of a processor chip. Without
knowing the layout you can't tell what the instruction means. Even if you know the layout, it is
hard to remember what the patterns mean and hard to write machine instructions.
A statement in pure assembly language corresponds to one machine instruction. Assembly
language is much easier to write than machine language. Here is the previous machine
instruction and the assembly language that it corresponds to:
Machine instruction

assembly language statement

0000 0001 0010 1011 1000 0000 0010 0000

add $t0,$t1,$t2

The instruction means: add the integers in registers $t1 and $t2 and put the result in register
$t0. To create the machine instruction from the assembly language statement a translation
program called an assembler is used.

4. what are the differences between machine language and assembly language?
Machine code is the only form of program instructions that the computer hardware can
understand and execute directly. All other forms of computer language must be translated into
machine code in order to be executed by the hardware. Machine code consists of many strings of
binary digits that are easy for the computer to interpret, but tedious for human beings to interpret.
Machine code is different for each type of computer. A program in machine code for an Intel
x86-based PC will not run on an IBM mainframe computer, and vice versa.
Assembly language is a symbolic representation of machine code, which allows programmers to
write programs in machine code without having to deal with the long binary strings. For
example, the machine code for an instruction that adds two numbers might be 01101110, but in
assembly language, this can be represented by the symbol ADD. A simple assembler program

translates this symbolic language directly into machine code. Because machine code is specific
to each type of computer hardware, assembly languages are also specific to each type of
computer. However, all machine languages and assembly languages look very similar, even
though they are not interchangeable.

MACHINE LANGUAGE : the language of 0s and 1s is called as machine language. The


machine language is system independent because there are different set of binary instruction for
different types of computer systems .
LIMITATIONS OF MACHINE LANGUAGES :
It is very tedious and error prone process of writing programs in machine languages.
ASSEMBLY LANGUAGES: it is low level programming language in which the sequence of
0s and 1s are replaced by mnemonic (ni-monic) codes. Typical instruction for addition and
subtraction.
Example :- ADD for addition , SUB for subtraction etc
Since our system only understand the language of 0s and 1s. therefore a system program is
known as assembler . Which is designed to translate an assembly language program into the
machine language program.

5. Write down the steps to create and run an assembly program .

6. write down the difference between linker and assembler ?


A compiler reads, analyses and translates code into either an object file or a list of error
messages.
A linker combines one or more object files and possible some library code into either some
executable, some library or a list of error messages.

Compiler: It is a program which translates a high level language program into a machine language
program. A compiler is more intelligent than an assembler. It checks all kinds of limits, ranges, errors
etc. But its program run time is more and occupies a larger part of the memory. It has slow speed.
Because a compiler goes through the entire program and then translates the entire program into

machine codes. If a compiler runs on a computer and produces the machine codes for the same
computer then it is known as a self compiler or resident compiler. On the other hand, if a compiler
runs on a computer and produces the machine codes for other computer then it is known as a cross
compiler.
Linker: In high level languages, some built in header files or libraries are stored. These libraries are
predefined and these contain basic functions which are essential for executing the program. These
functions are linked to the libraries by a program called Linker. If linker does not find a library of a
function then it informs to compiler and then compiler generates an error. The compiler automatically
invokes the linker as the last step in compiling a program. Not built in libraries, it also links the user
defined functions to the user defined libraries. Usually a longer program is divided into smaller
subprograms called modules. And these modules must be combined to execute the program. The
process of combining the modules is done by the linker.

S-ar putea să vă placă și