Expression in assembly language

Implement the following c++ expression in assembly language, using 32-bit unsigned operand:
Val1 = (val2 * val3) / (val4 – 3)

Please, use this information:

.code

mov eax, val2

mov ebx, val3

mul ebx

mov ebx, val4

sub ebx, 3

div ebx

mov val1, eax

  1. Implement the following expression in assembly language, using 32-bit signed operands:

Val1 = (val2 / val3) * (val1 + val2)

Please, use this information:

.code

mov eax, val2

cdq

mov ebx, val3

idiv ebx

mov ebx, val1

add ebx, val2

imul ebx

mov val1, eax

This question has been answered.

Get Answer