Laboratory 2 - Exercises
Write a program in the assembly language that computes the following arithmetic expression, considering the given data types for the variables.
Simple exercises
Compute and analyze the result:
- 1+9
- 1+15
- 128+128
- 5-6
- 10/4
- 256*1
- 256/1
- 128+127
- 3*4
- 9+7
- 128*2
- 4-5
- 2+8
- -2*5
- 6*3
- 4*4
- 14+2
- 127+129
- 12/4
- 13/3
- 15/3
- 16/4
- 256*1
- 256/1
- 64*4
- 3-4
- 4+12
- 13/5
- 14/6
- 11+5
Additions, subtractions
a,b,c,d - byte
- 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)
- (a+c-d) +d - (b+b-c)
- 2-(c+d)+(a+b-c)
- a+b-c+d-(a-d)
- (a+d-c)-(b+b)
- a-b-d+2+c+(10-b)
- a+13-c+d-7+b
- (a+a-c)-(b+b+b+d)
- d-(a+b)+c
- d-(a+b)-c
- (a+a)-(c+b+d)
- (a-b)+(d-c)
- (a+b+b)-(c+d)
- (a-c)+(b+b+d)
- (a-b-b-c)+(a-c-c-d)
- (c+d+d)-(a+a+b)
- (a+a)-(b+b)-c
- (a+b-c)-(a+d)
- a+b-c+d
- (b+c)+(a+b-d)
- d-(a+b)-(c+c)
a,b,c,d - word
- (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)
- (b-c)+(d-a)
- d-(a+b)-(c+c)
- (a+a-c)-(b+b+d)
- (c+d)+(a-b)+a
- (a-b+c)-(d+d)
- (a+b+b)+(c-d)
- a+a-b-c-(d+d)
- (a-b-c)+(a-c-d-d)
- b+a-(4-d+2)+c+(a-b)
- b-(b+c)+a
- a-c+d-7+b-(2+d)
- (b-a)-(c+c+d)
- (a+b+c)-(d+d)
- (a-c)+(b-d)
- (a+b-c)-d
- (a+c)-(b+b+d)
- a+b-(c+d)+100h
- (d-c)+(b+b-c-a)+d
- (d-a)+(b+b+c)
- a-b+(c-d+a)
Multiplications, divisions
a,b,c - byte, d - word
- ((a+b-c)*2 + d-5)*d
- d*(d+2*a)/(b*c)
- [-1+d-2*(b+1)]/a
- –a*a + 2*(b-1) – d
- [d-2*(a-b)+b*c]/2
- [2*(a+b)-5*c]*(d-3)
- [100*(d+3)-10]/d
- (100*a+d+5-75*b)/(c-5)
- 3*[20*(b-a+2)-10*c]+2*(d-3)
- 3*[20*(b-a+2)-10*c]/5
- [(d/2)*(c+b)-a*a]/b
- a*[b+c+d/b]+d
- [(a*b)-d]/(b+c)
- (d-b*c+b*2)/a
- (a*2)+2*(b-3)-d-2*c
- (a+b)/2 + (10-a/c)+b/4
- 300-[5*(d-2*a)-1]
- 200-[3*(c+b-d/a)-300]
- [(a-b)*3+c*2]-d
- (50-b-c)*2+a*a+d
- d-[3*(a+b+2)-5*(c+2)]
- [(10+d)-(a*a-2*b)]/c
- [(a+b)*3-c*2]+d
- (10*a-5*b)+(d-5*c)
- [100-10*a+4*(b+c)]-d
- d+[(a+b)*5-(c+c)*5]
- d/[(a+b)-(c+c)]
- d+10*a-b*c
- [d-(a+b)*2]/c
- [(a-b)*5+d]-2*c
a,b,c,d-byte, e,f,g,h-word
- ((a-b)*4)/c
- e-a*a
- (e+f)*g
- (a-c)*3+b*b
- a*(b+c)+34
- (a*b)/c
- (a+b)*(c+d)
- 2*(a+b)-e
- (2*d+e)/a
- a*d+b*c
- (e+f)*(2*a+3*b)
- (a*d+e)/[c+h/(c-b)]
- (g+5)-a*d
- a*d*e/(f-5)
- f*(e-2)/[3*(d-5)]
- a*a-(e+f)
- h/a + (2 + b) + f/d – g/c
- f+(c-2)*(3+a)/(d-4)
- (e + g) * 2 / (a * c) + (h – f) + b * 3
- [(a+b+c)*2]*3/g
- (f*g-a*b*e)/(h+c*d)
- (a+(b-c))*3
- [(a+b)*2]/(a+d)
- [(a-d)+b]*2/c
- (e+f+g)/(a+b)
- (e+g-2*b)/c
- [(e+f-g}+(b+c)*3]/5
- (e+g-h)/3+b*c
- [[b*c-(e+f)]/(a+d)
- 100/(e+h-3*a)