I am working on an assembly, technically HLA(High Level Assembly) assignment. Here is my assignment:
Write an HLA Assembly language program that computes the surface area based on a radius. A sample program dialogue is shown below. However you decide to do it, your main program should include calling a procedure or function (atleast one...) to solve this problem.
Lemme calculate the surface area of a sphere! Gimme r: 1 Surface Area = 12.57
Lemme calculate the surface area of a sphere! Gimme r: 3.5 Surface Area = 153.94
Here is my code:
program surfaceArea;
#include( "stdlib.hhf" );
static
radius : real32;
procedure computeSurfaceArea(r : real32); @nodisplay; @noframe;
static
returnAddress : dword;
z : real32;
begin computeSurfaceArea;
pop(returnAddress);
pop(r);
push(returnAddress);
finit();
fld( r );
fld( st0 );
fmul();
fldpi();
fld(4.0); .
fmul();
fmul();
fstp( z );
stdout.putr32(z, 4, 10);
ret();
end computeSurfaceArea;
begin surfaceArea;
stdout.put("Lemme calculate the surface area of a sphere!", nl);
stdout.put("Gimme r: ");
stdin.get(radius);
stdout.put("Surface area is: ", nl);
call computeSurfaceArea;
end surfaceArea;
So my problem is with my fld(4.0) line of code. What I am trying to do is multiply 4 by pi, and then multiply the result of that with r square which was calculated up above. The error I get is:
Syntax Error, unexpected ".".
Thank you for the help.