Laboratory 3 - Exercises
Write a program in assembly language which computes one of the following arithmetic expressions, considering the following domains for the variables (in the unsigned and signed representation).
Additions, subtractions
a - byte, b - word, c - double word, d - qword - Unsigned representation
- c-(a+d)+(b+d)
- (b+b)+(c-a)+d
- (c+d)-(a+d)+b
- (a-b)+(c-b-d)+d
- (c-a-d)+(c-b)-a
- (a+b)-(a+d)+(c-a)
- c-(d+d+d)+(a-b)
- (a+b-d)+(a-b-d)
- (d+d-b)+(c-a)+d
- (a+d+d)-c+(b+b)
- (d-c)+(b-a)-(b+b+b)
- (a+b+d)-(a-c+d)+(b-c)
- d-b+a-(b+c)
- (a+d)-(c-b)+c
- a+b-c+(d-a)
- c-a-(b+a)+c
- (c+c-a)-(d+d)-b
- (d+d)-a-b-c
- (d+d)-(a+a)-(b+b)-(c+c)
- (a+c)-b+a + (d-c)
- (c-a) + (b - d) +d
- (d+c) - (c+b) - (b+a)
- ((a + a) + (b + b) + (c + c)) - d
- ((a + b) + (a + c) + (b + c)) - d
- (a + b + c) - (d + d) + (b + c)
- (c-b+a)-(d+a)
- (a+c)-(d+b)
- d-(a+b)+(c+c)
- d+c-b+(a-c)
- (b+c+a)-(d+c+a)
a - byte, b - word, c - double word, d - qword - Signed representation
- (c+b+a)-(d+d)
- (c+b)-a-(d+d)
- (b+b+d)-(c+a)
- (b+b)-c-(a+d)
- (c+b+b)-(c+a+d)
- c-(d+a)+(b+c)
- (c+c+c)-b+(d-a)
- (b+c+d)-(a+a)
- a-d+b+b+c
- b+c+d+a-(d+c)
- d-(a+b+c)-(a+a)
- (a-b-c)+(d-b-c)-(a-d)
- (b-a+c-d)-(d+c-a-b)
- c-b-(a+a)-b
- c+a+b+b+a
- (d-a)-(a-c)-d
- (c+d-a)-(d-c)-b
- (d-b)-a-(b-c)
- (d+a)-(c-b)-(b-a)+(c+d)
- a-b-(c-d)+d
- d-a+(b+a-c)
- c+b-(a-d+b)
- a + b + c + d - (a + b)
- (a + b + c) - d + (b - c)
- (a + b - c) + (a + b + d) - (a + b)
- (c-d-a)+(b+b)-(c+a)
- (d+d-c)-(c+c-a)+(c+a)
- c+d-a-b+(c-a)
- (a+a)-(b+b)-(c+d)+(d+d)
- d-a+c+c-b+a
Multiplications, divisions - Unsigned representation and signed representation
- c+(a*a-b+7)/(2+a), a-byte; b-doubleword; c-qword
- 2/(a+b*c-9)+e-d; a,b,c-byte; d-doubleword; e-qword
- (8-a*b*100+c)/d+x; a,b,d-byte; c-doubleword; x-qword
- (a*2+b/2+e)/(c-d)+x/a; a-word; b,c,d-byte; e-doubleword; x-qword
- (a+b/c-1)/(b+2)-x; a-doubleword; b-byte; c-word; x-qword
- x+a/b+c*d-b/c+e; a,b,d-byte; c-word; e-doubleword; x-qword
- (a-2)/(b+c)+a*c+e-x; a,b-byte; c-word; e-doubleword; x-qword
- 1/a+200*b-c/(d+1)+x/a-e; a,b-word; c,d-byte; e-doubleword; x-qword
- (a-b+c*128)/(a+b)+e-x; a,b-byte; c-word; e-doubleword; x-qword
- d-(7-a*b+c)/a-6+x/2; a,c-byte; b-word; d-doubleword; x-qword
- (a+b)/(2-b*b+b/c)-x; a-doubleword; b,c-byte; x-qword
- (a*b+2)/(a+7-c)+d+x; a,c-byte; b-word; d-doubleword; x-qword
- x-(a+b+c*d)/(9-a); a,c,d-byte; b-doubleword; x-qword
- x+(2-a*b)/(a*3)-a+c; a-byte; b-word; c-doubleword; x-qword
- x-(a*b*25+c*3)/(a+b)+e; a,b,c-byte; e-doubleword
- x/2+100*(a+b)-3/(c+d)+e*e; a,c-word; b,d-byte; e-doubleword; x-qword
- x-(a*a+b)/(a+c/a); a,c-byte; b-doubleword; x-qword
- (a+b*c+2/c)/(2+a)+e+x; a,b-byte; c-word; e-doubleword; x-qword
- (a+a+b*c*100+x)/(a+10)+e*a; a,b,c-byte; e-doubleword; x-qword
- x-b+8+(2*a-b)/(b*b)+e; a-word; b-byte; e-doubleword; x-qword
- (a*a/b+b*b)/(2+b)+e-x; a-byte; b-word; e-doubleword; x-qword
- a/2+b*b-a*b*c+e+x; a,b,c-byte; e-doubleword; x-qword
- (a*b-2*c*d)/(c-e)+x/a; a,b,c,d-byte; e-word; x-qword
- a-(7+x)/(b*b-c/d+2); a-doubleword; b,c,d-byte; x-qword
- (a*a+b+x)/(b+b)+c*c; a-word; b-byte; c-doubleword; x-qword
- (a*a+b/c-1)/(b+c)+d-x; a-word; b-byte; c-word; d-doubleword; x-qword
- (100+a+b*c)/(a-100)+e+x/a; a,b-byte; c-word; e-doubleword; x-qword
- x-(a*100+b)/(b+c-1); a-word; b-byte; c-word; x-qword
- (a+b)/(c-2)-d+2-x; a,b,c-byte; d-doubleword; x-qword
- a*b-(100-c)/(b*b)+e+x; a-word; b,c-byte; e-doubleword; x-qword