Take a look at the program shown in Fig 412 replicated below
     Take a look at the program shown in Fig. 4.12 replicated below.; this program evaluates: - (x + y - 2z + 1)  .586  .MODEL FLAT  .STACK 4096  .DATA  x DWORD 80  y DWORD 40  z DWORD 26 .CODE  main PROC  mov eax, X; result:= x  add eax, y; result:= x + y  mov ebx, z; temp:= z  add ebx, ebx; temp:= 2*z  sub eax, ebx; result:= x + y - 2z  inc eax; result:= x + y - 2*z + 1  neg eax; result:= - (x + y - 2*z + 1)  mov eax, 0; exit with return code 0  ret  main ENDP  END  Change the code in Fig 4.12 to perform: ((x-y)/y - 3z) - 1  As the code shows, the result is given in eax. Verity your code using ProjOne in debug mode. 
  
  Solution
; this program: ((x-y)/y - 3z) - l
 .586
 .MODEL FLAT
 .STACK 4096
.DATA
 x DWORD 80
 y DWORD 40
 z DWORD 26
.CODE
 main PROC
 mov eax,x ;result = x
 sub eax,y ;result = x-y
 div eax,y ;division (x-y)/y
 mflo ecx ; quotient of the division
 mov ebx,z ;temp = z
 mult ebx,3 ; result : 3*z
 mflo edx ; lower 32 bits of multiplication
 sub ecx,edx ; result: (((x-y)/y)-3z)
 sub ecx,1 ; result : (((x-y)/y)-3z)-1
 mov ecx,0; exit with return code 0
 ret
 main ENDP
 END
   

