BX = –val2 + 7 - (- val3 + val1) * 2
Please answer using this format for code:
.386
.model flat, stdcall
.stack 4096
ExitProcess PROTO, dwExitCode:DWORD
.data
...(please initialize the variables)...
.code
...(insert code here)...
INVOKE ExitProcess,0
main ENDP
END main
.386
.model flat,stdcall
.stack 4096
ExitProcess proto,dwExitCode:dword
.data
val1 sbyte 0 ;intialize val1
val2 sbyte 0 ;intialize val2
val3 sbyte 0 ;intialize val3
result sword 0 ;intialize result
.code
main proc
mov val1,12 ;val1 = 12
mov val2,9 ;val2 = 9
mov val3,2 ;val3 = 2
mov ax,0
mov bx,0
mov cx,0
mov dx,0
movzx dx,val2 ;dx = val2
neg dx ;dx = -val2
add dx,7 ;dx = -val2 + 7
movzx ax,val3 ;ax = val3
neg ax ;ax = -val3
movzx cx,val1 ;cx = val1
add ax,cx ;ax = -val3 + val1
add dx,ax ;dx = -val2 + 7 -val3 + val1
mov ax,dx ;ax = dx
mul 2 ;ax = -val2 + 7 -val3 + val1 * 2
mov bx,ax ;bx = result, = -val2 + 7 -val3 + val1
invoke ExitProcess,0
main endp
end main
Get Answers For Free
Most questions answered within 1 hours.