Need help in assembly Thank you Implement the following expr
Need help in assembly. Thank you
 Implement the following expression in assembly language:  EAX = -val2 + 7 -val3 + val1  Assume that val1, val2, and val3 are 16-bit integer variables  Submit the following:  Lastname2.asmSolution
val1 dw 0202h
 val2 dw 100h
 val3 dw 200h
 segment .bss
 sum resb 1
 section   .text
 global _start ;must be declared for using gcc
   
 _start:   ;tell linker entry point
 
 mov eax,[val2]
 imul eax,\'-1\'
 add eax,\'7\'
 sub eax,[val3]
 add eax,[val1]
mov [sum],eax
   
 mov ecx,sum
 mov edx, 1
 mov ebx,1 ;file descriptor (stdout)
 mov eax,4 ;system call number (sys_write)
 int 0x80 ;call kernel
mov eax,1 ;system call number (sys_exit)
 int 0x80 ;call kernel
;nasm -f elf hello.asm
 ;ld -m elf_i386 -o hello hello.o
=====================================================================
Output:
akshay@akshay-Inspiron-3537:~/Chegg$ nasm -f elf hello.asm
 akshay@akshay-Inspiron-3537:~/Chegg$ ld -m elf_i386 -o hello hello.o
 akshay@akshay-Inspiron-3537:~/Chegg$ ./hello
 9

