Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Register No.

: 20BCE1377 Name: Kevin Gandhi

Date: <21/3/2022 > Exp.<10.> <Finding volume of cone>

Aim: To Find Volume of Cone by the value of radius and height using 8087
Processor

Tool Used:

Assembler - MASM 611

Algorithm:
1. Initialize RADIUS as 5.2, pi*(1 / 3) = 1.0467 in CONSTANT
2. HEIGHT as 3.1 and CONE to hold volume of cone under data segment.
3. Move data to AX and AX to data segment.
4. Then load the RADIUS using FLD at stack(0).
5. Then again load radius at stack(4) and perform multiplication of stack(0) and stack(4) to
compute RADIUS2 and it store it in stack(0).
6. Then multiply RADIUS2 with HEIGHT and then with CONSTANT and then store the result in
CONE.
7. Then HLT the program.
8. To assemble and run follow this-
masm cone.asm
link cone.obj;
debug cone.exe -u (2 times)
-g 0765:0028
-d 0764:0000 000F

Program:
DATA SEGMENT
RADIUS dd 5.2
HEIGHT dd 3.1
CONST dd 1.0466
VOLUME dd 01 dup(?)
DATA ENDS
Assume cs:code,DS:DATA

Code segment
.8087
start:
MOV AX,DATA
MOV DS,AX
FINIT
Register No.: 20BCE1377 Name: Kevin Gandhi

FLD RADIUS
FST ST(4)
FMUL ST(0),ST(4)
FLD HEIGHT
FMUL
FLD CONST
FMUL
FST VOLUME
HLT
CODE ENDS
END START

Sample Input:
RADIUS = 5.2
HEIGHT = 3.1
CONST = 1.0466
Sample Output:

Volume = 87.7302 (42 AF 75 DB in hex)


Register/ Memory Contents for I/O:

Snapshot of the Output:


Register No.: 20BCE1377 Name: Kevin Gandhi

Output value in Hexadecimal :-

Result: The Volume of cone by giving the value of radius and height is 87.7302
(42 AF 75 DB in hex)

You might also like