You are on page 1of 2

EXP NO: 1a BASIC ARITHMETIC AND LOGICAL OPERATIONS

DATE: ON BYTE/WORD

AIM: 

To write an ALP to perform the basic arithmetic operations on a byte/word and to


execute them using MASM.

TOOLS REQUIRED  
PC with DOSBox 0.74-3 

FORMULA:

S = (a+b+c) / 2

ALGORITHM: 
1. Assume CS as code and DS as data .
2. Move the address of memory pointer-1200 into SI register.
3. Get inputs (a,b,and c) and store it into dl, bl, cl register locations by incrementing SI
register.
4. Add (a,b,and c) and store the result into al register.
5. Arithmetic shift right al to divide the value stored inside al by 2 to find S.
6. Subtract (a from S) , (b from S) , (c from S) and store the resulting values into dh, bh, ch
registers.
7. Increment SI to store area of the triangle.
8. Multiply S with (S-a), (S-b), (S-c) to get the final product.
9. Store the final product into the dl register.
10. Assign the value of ah and ch registers to zero.
11. To find the square root of the final product, create a loop to do the following ,
a. Increment the value in ch register
b. Move the value of ch register to ah register
c. Find the square of the value in ah register and store it back into ah register.
d. Compare the value of ah register with the final product value
e. If value of ah register is less than the final product then repeat the loop
f. Else exit the loop
12. Store the value of ch inside SI.
OUTPUT:

RESULT:  
Thus, ALP to perform the basic arithmetic operations on a byte/word is written,
executed using MASM and out is verified.

You might also like