Unit 2 Question Answer
2 Marks Question
1. List assembly language programming tools
Ans:
o Editor
o Assembler
o Linker
o Locators o
Debuggers o
Emulators
2. State the function
of editor and
assembler.
Ans:
1. Editor
- An editor is a program which allows you to create a file containing the assembly language
statements for your
program. Example: PC-Write, Wordstar.
2. Assembler
- An assembler program is used to translate the assembly language mnemonics
for instructions to corresponding binary codes. When you run the assembler, it reads the
source file of your program from the disk where you have saved it after editing.
3. State the role of Debugger in assembly language programming.
Debugger:
- A debugger is a program which allows you to load your object code program into
system memory, execute the program and troubleshoot or debug it.
4. List the major steps in developing an Assembly language program.
1) Defining the problem
2) Algorithm
3) Flowchart
4) Initialization checklist
5) Choosing instructions
6) Converting algorithm to assembly language program
4 Marks Questions
1. Explain assembly language program development steps
Program development steps :
1) Defining the problem: The first step in the program development is the
careful analysis of problem. The objective of the program should be clear.
2) Algorithm: It is the step wise procedure designed to perform operations according
to the program which will lead to correct results.
3) Flowchart: It is the graphical representation of the program operation.
4) Initialization checklist: In this step, variables, constants and various parts of the
system such as segment registers, stack, flags etc. are initialized properly.
5) Choosing instructions: It includes selecting the proper instructions that will
perform the desired operations.
6) Converting algorithm to assembly language program : In this step , the instructions are
arranged in the proper sequence according to algorithm and then converted into
machine language so that the desired output can be obtained.
Algorithm and flow chart :
Algorithm is step by step procedure designed to perform an operation and which will
lead to final result.
FlowChart: It is graphical representation of algorithm. Symbols used to
draw flowchart are :
2. Explain the use of assembler directives : (i) DW (ii) EQU (ii
ASSUME (iv) OFFSET (v) SEGMENT (vi) EVEN
i) DW: . DW – The DW directive is used to declare a WORD type
variable
– A WORD occupies 16 bits or (2 BYTE).
Declaration examples:
Word DW 1234h
ii) EQU: The EQU directive is used to give name to some value or symbol. Each time the
assembler finds the given names in the program, it will replace the name with the value or a
symbol.
Ex: C EQU 10H
(iv)OFFSET: OFFSET used to load the address of string in register.
Ex:
data segment
A DB 05H, 04H, 56H
Data ends
MOV BX, OFFSET A
(v)SEGMENT:It is used to indicate the start of a logical segment. It is the name given to the
the segment.
data segment
A DB 45H
B DW 3554H
C EQU 10H
data ends
vi) EVEN:
3. Describe any four assembler directives with suitable example.
Ans: Data declaration directives:
1. DB – The DB directive is used to declare a BYTE A
BYTE is made up of 8 bits.
Declaration examples:
Byte1 DB 10h
2. DW – The DW directive is used to declare a WORD type variable
– A WORD occupies 16 bits or (2 BYTE).
Declaration examples:
Word DW 1234h
3. DD – The DD directive
is used to declare a
DWORD
A DWORD double word is made up of 32 bits =2 Word’s or 4 BYTE.
Declaration examples:
Dword1 DW 12345678h
4. DQ: define quad word. (64 bits)
5. DT: define ten byte. (80 bits)
6. Describe how an assembly language program is developed and debugging
using program developments tools.
Program Development Steps:
1) Defining the problem: The first step in the program development is the careful
analysis of problem. The objective of the program should be clear.
2)Algorithm: It is the step wise procedure designed to perform operations according
to the program which will lead to correct results.
3) Flowchart: It is the graphical representation of the program operation.
4)Initialization checklist: In this step, variables, constants and various parts of the
system such as segment registers, stack, flags etc. are initialized properly.
5)Choosing instructions: It includes selecting the proper instructions that will
perform the desired operations.
6)Converting algorithm to assembly language program : In this step , the instructions
are arranged in the proper sequence according to algorithm and then converted into
machine language so that the desired output can be obtained.
. Editor
-An editor is a program which allows you to create a file containing the assembly language
statements for your
program. Example: PC-Write, Wordstar.
Assembler
-An assembler program is used to translate the assembly language mnemonics
for instructions to corresponding binary codes. When you run the assembler, it reads the
source file of your program from the disk where you have saved it after editing.
Linker: . Linker
-A linker is a program used to join several object files into one large object file.
-It produces a link file which contains the binary codes for all the combined modules, also
produces a link map file which contains the address information about the linked files (.exe).
4. Locator
- A locator is a program used to assign the specific address of where the segments of object
code are to be loaded into memory.
Debugger:
- A debugger is a program which allows you to load your object code program into
system memory, execute the program and troubleshoot or debug it.
5. State the Assembler Directives used in 8086 programming and describe the function
of any two.
An assembler directive is a statement to give direction to the assembler to perform task of the
assembly process.
It control the organization if the program and provide necessary information to the
assembler to understand the assembly language programs to generate necessary machine
codes
Segment, ends:
It is used to indicate the start of a logical segment. It is the name given to the the segment.
Example: the code segment is used to indicate to the assembler the start of logical
segment.
Ex: data segment
A DB 45H
B DW 3554H C
EQU 10H
data ends
PROC & ENDP:
Procedure used to
execute function.
The PROC directive marks the start of a named procedure in the statement.
ENDP used to end the procedure.
EX:
PROC add
----
---
ENDP
By
calling
label
can
execute
proced
ure.