Professional Documents
Culture Documents
Experiment 6: Theory
Experiment 6: Theory
Theory:
Instruction sets -
Q1
ALGORITHM:
1. Store all the vowels (lowercase and uppercase) in a string
2. Set counter to zero
3. Move the given string to SI and the vowel string to DI
4. Check for the end of the string
5. Traverse through SI compare the letter in the position with all vowels by traversing through DI
6. If vowel found, increment counter
7. Continue for all the letters in the given string
CODE:
OUTPUT:
RESULT AND VERIFICATION:
CODE:
OUTPUT:
RESULT AND VERIFICATION:
Input: Matrix 1 @ 1000 = ( (4,4,4) , (4,4,4) , (4,4,4) ), Matrix 2 @ 2000 = ( (1,1,1) , (1,1,1) , (1,1,1) )
Sum @ 5000 = ( (5,5,5) , (5,5,5) , (5,5,5) ), Difference @ 7000 = ( (3,3,3) , (3,3,3) , (3,3,3) ),
The output is displayed correctly.
Q3
ALGORITHM:
1. Move the given string to SI
2. Reverse the given string
3. The string is now stored in DI
4. Compare each letter of DI to SI using REPE CMPSB
5. If same print message ‘Palindrome’ else print ‘not palindrome’
CODE:
OUTPUT:
RESULT AND VERIFICATION:
Input = ‘ABCBA’ is a palindrome and the same has been printed on the screen. Hence, result verified.
Q4
AIM: Write an ALP to find one’s and two’s complement of a 16-bit number.
ALGORITHM:
1. Move the given 16-bit data to AX register
2. Use the command NOT to invert all digits (0 to 1 and 1 to 0) to obtain the 1’s complement
3. Use the INC command to add 1 and obtain the 2’s complement.
CODE:
OUTPUT: