Vous êtes sur la page 1sur 5

NAME- ALLIYU ISMAEL OLALEKAN

MATRIC NUMBER- HC201600214


COURSE CODE-COM 323

1. SOURCE CODE
program practice1;
#include ("stdlib.hhf");
static
bb: int32;
cc: int32;
summ: int32;
a: int32;
b: int32:=5;
c: int32:=6;
begin practice1;
mov( b, eax ); //move b into the register
mul( b, eax ); //multiply it by b in it
mov( eax, bb ); //move eax into bb
mov( c, eax ); //move c into the register
mul( c, eax ); // multiply by c
mul( c, eax ); // multiply by another c in the register
mov( eax, cc); // multiply by another c

mov( bb, eax); //move bb into eax


add( cc, eax); //move cc into eax
mov( eax, summ); // mov eax into summ

stdout.put (" b^2 = " , bb , nl );


stdout.put (" c^3 = ", cc,nl );
stdout.put (" b^2 + c^3 = " ,summ ,nl);
stdout.put (" a = " , summ , nl );

end practice1;
OUTPUT

2. SOURCE CODE
program practice2;
#include ("stdlib.hhf");
static
dd: int32;
cc: int32;
bb: int32;
subtr: int32;
d: int32:=8;
c: int32:=4;
begin practice2;
mov( d, eax ); // move d into the register
mul( d, eax ); // multiply another d to it
mul( d, eax ); // multiply another d
mul( d, eax ); // multiply another d
mov( eax, dd ); //move eax into dd
mov( c, eax ); // move c into register
mul( c, eax ); // multiply c with it
mul( c, eax ); //multiply another c
mov( eax, cc ); // move the eax into cc

mov( dd, eax ); //move dd into eax


sub( cc, eax ); // subtract cc from the register
mov( eax, subtr ); // move eax into subtraction
mov( subtr, eax ); // move subtraction into eax
mul( subtr, eax ); // multiply the subtrated value in the eax
mov( eax, bb ); //move eax into bb
stdout.put (" d^4 = " ,dd , nl );
stdout.put (" c^3 = ", cc,nl );
stdout.put (" d^4 - c^3 = " , subtr ,nl);
stdout.put (" b = (d^4 + c^3)^2 = " , bb ,nl);
end practice2;

OUTPUT

3. SOURCE CODE

program practice3;
#include ("stdlib.hhf");
static
aa: int32;
cc: int32;
bb: int32;
ab: int32;
bc: int32;
ca: int32;
sum1: int32;
sum2: int32;
answer: int32;
a: int32:=5;
b: int32:=6;
c: int32:=7;
d: int32:=2;
begin practice3;
mov( a, eax );
mul( a, eax );
mov( eax, aa );
mov( b, eax );
mul( b, eax );
mov( eax, bb );

mov( c, eax );
mul( c, eax );
mov( eax, cc );

mov( aa, eax );


add( bb, eax );
add( cc, eax );
mov( eax, sum1 );
mov( a, eax );
mul( b, eax );
mov( eax, ab );
mov( b, eax );
mul( c, eax );
mov( eax, bc );
mov( c, eax );
mul( a, eax );
mov( eax, ca );

mov( ab, eax );


add( bc, eax );
add( ca, eax );
mul( d, eax );
mov( eax, sum2);
mov( sum1, eax );
add( sum2, eax );
mov( eax, answer);
stdout.put (" a^2 = " ,aa , nl );
stdout.put (" b^2 = ", bb,nl );
stdout.put (" c^2 = ", cc,nl);
stdout.put (" a^2 + b^2 + c^2 = " , sum1 ,nl);
stdout.put (" ab = " ,ab , nl );
stdout.put (" bc = " ,bc , nl );
stdout.put (" ca = " ,ca , nl );
stdout.put (" 2*(ab + bc + ca) = " , sum2 ,nl);
stdout.put (" S = (a^2 + b^2 + c^2)+(2*(ab + bc + ca)) = " , answer ,nl);
end practice3;

OUTPUT

Vous aimerez peut-être aussi