Exp 4
Exp 4
Objectives: -
Students will be able
i) To draw the flow chart and develop the logic how an alphabet is repeated in
a string.
ii) To understand assembler directives and write program in assembly language
iii) To understand the function of compiler and assembler
iv) To understand the difference between language and machine language.
Theory:-
The following instructions are useful for developing assembly level language
program:
i) CMP:
ii) JNZ:
iii) Loop:
Algorithm:-
1. Initialize the data segment
2. Initialize a string and length of string (String db ‘employee$’ and len db $-string)
3. Clear Al register
4. Move offset value of string in SI
5. Move length of the string as a counter in CL register
6. Take alphabet in BH
7. Compare BH with desired alphabet (eg. cmp bh,’e’)
8. Increment Al register if comparison answer is zero else jump to step 9
9. Increment memory to access next alphabet of string
10.Decrement the counter, if not zero jump to step 6
11.Display result in memory with variable “ans”
1
Program:-
Result & Discussion:- write about the hex values of string and desired alphabet
2
Output:-
AL =
Memory address where AL is stored = xxxxh =
Conclusion:
Write about LEA, SI, CMP, JNZ
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
________________________________________________________________
Date of Performance:
Weight 20 20 20 20 20 100
_________
Date of Correction:
___________
Signature of Faculty: