Question: Lab (a) : Write a program to evaluate an expression with variables Answer sheet: Please help me out thank you! Data Transfer and Arithmetic Instructions
Lab (a) : Write a program to evaluate an expression with variables




Answer sheet:

Please help me out thank you!
Data Transfer and Arithmetic Instructions Write a program to implement the following expression in assembly. EAX = Xval - (Yval + Zval) Xval is signed 32-bit integer variable Yval and Zval are unsigned 32-bit integer variable o Assign Xval 26, Yval 30, and Zval 40. Data Transfer and Arithmetic (add and sub) Instructions Before writing a program you should know what an instruction can and can not do Add and subtract can only do the following: Add or sub register to/from register: add eax, ebx Add or sub register to/from memory: sub mem1, eax Add or sub memory to/from register: sub eax, mem1 Add or subtract immediate to/from memory: add mem1,3 Add or subtract immediate to/from register: add eax, 3 Data Transfer and Arithmetic (add and sub) Instructions Before writing a program you should know what an instruction can and can not do Add and subtract can NOT do the following Add or sub memory to/from memory: sub mem1,mem2 or add mem1,mem2 -The same apply for mov instruction Data Transfer and Arithmetic (add and sub) Instructions 386 .model flat, stdcall .stack 4096 ExitProcess PROTO, dwExitCode: DWORD Create a new Project to run the following : EAX = Xval - Yval + Zval). i parer.thesis have higher precedence, do them first program .data Xval SDWORD 26 Build and run the program using the Yval DWORD 30 debugger Zval DWORD 40 .code Examine the content of the registers main proc second term: Yval + Zval) Explain the content of the registers and mov ebx Yval add ebx.Zval variables ; sub the terms and store: sub Xvalebx mov eax.Xval invoke ExitProcess, O main ENDP END main Debug through each line of instructions. Take screenshot that includes code and register window. Record the register content. and explain the register contents. (4 points) Line number: Instruction: Register values: Screenshot: Explanation: Line number: Instruction: Register values: Screenshot: Explanation: Line number: Instruction: Register values: Screenshot: Explanation: Line number: Instruction: Register values: Screenshot: Explanation: Data Transfer and Arithmetic Instructions Write a program to implement the following expression in assembly. EAX = Xval - (Yval + Zval) Xval is signed 32-bit integer variable Yval and Zval are unsigned 32-bit integer variable o Assign Xval 26, Yval 30, and Zval 40. Data Transfer and Arithmetic (add and sub) Instructions Before writing a program you should know what an instruction can and can not do Add and subtract can only do the following: Add or sub register to/from register: add eax, ebx Add or sub register to/from memory: sub mem1, eax Add or sub memory to/from register: sub eax, mem1 Add or subtract immediate to/from memory: add mem1,3 Add or subtract immediate to/from register: add eax, 3 Data Transfer and Arithmetic (add and sub) Instructions Before writing a program you should know what an instruction can and can not do Add and subtract can NOT do the following Add or sub memory to/from memory: sub mem1,mem2 or add mem1,mem2 -The same apply for mov instruction Data Transfer and Arithmetic (add and sub) Instructions 386 .model flat, stdcall .stack 4096 ExitProcess PROTO, dwExitCode: DWORD Create a new Project to run the following : EAX = Xval - Yval + Zval). i parer.thesis have higher precedence, do them first program .data Xval SDWORD 26 Build and run the program using the Yval DWORD 30 debugger Zval DWORD 40 .code Examine the content of the registers main proc second term: Yval + Zval) Explain the content of the registers and mov ebx Yval add ebx.Zval variables ; sub the terms and store: sub Xvalebx mov eax.Xval invoke ExitProcess, O main ENDP END main Debug through each line of instructions. Take screenshot that includes code and register window. Record the register content. and explain the register contents. (4 points) Line number: Instruction: Register values: Screenshot: Explanation: Line number: Instruction: Register values: Screenshot: Explanation: Line number: Instruction: Register values: Screenshot: Explanation: Line number: Instruction: Register values: Screenshot: Explanation
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
