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.
I have written my code but get "####" as the output of the surface area heres my code:
program surfaceArea;
#include( "stdlib.hhf" );
static
radius : real32;
procedure computeSurfaceArea(r : real32); @nodisplay; @noframe;
static
returnAddress : dword;
area : real32;
begin computeSurfaceArea;
pop(returnAddress);
pop(r);
push(returnAddress);
finit();
fld( r );
fld( st0 );
fmul();
fldpi();
fld(4.0);
fmul();
fmul();
fstp( area );
stdout.putr32(area, 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 = ");
call computeSurfaceArea;
end surfaceArea;