Write an assembly language program to calculate the followin
Write an assembly language program to calculate the following expression 3x + x - 2. Suppose that x is stored in R0 and the result in R7.
Solution
Answer:
Assembly Language Program :
.zero 1
main:
push rbp
mov rbp, rsp
mov eax, DWORD PTR [rbp-4]
sal eax, 2
sub eax, 2
mov DWORD PTR [rbp-8], eax
mov eax, 0
pop rbp
ret
