Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

the previous code INCLUDE Irvine32.inc .code main PROC movzx eax,bNum01 movzx ebx,bNum02 add eax, ebx movzx ebx,bNum03 add eax, ebx mov bSum, al movzx eax,bNum02

image text in transcribed

the previous code

INCLUDE Irvine32.inc .code main PROC movzx eax,bNum01 movzx ebx,bNum02 add eax, ebx movzx ebx,bNum03 add eax, ebx mov bSum, al movzx eax,bNum02 add eax,bNum03 sub eax,bNum01 movzx bDiff,eax movzx eax,bSum add eax,bDiff movzx bResult,eax mov esi,OFFSET bSum mov ecx,LENGTHOF bSum mov ebx,TYPE bSum call DumpMem ; call Dump Memory for selected offset value mov esi,OFFSET bDiff mov ecx,LENGTHOF bDiff mov ebx,TYPE bDiff call DumpMem ; call Dump Memory for selected offset value mov esi,OFFSET bResult mov ecx,LENGTHOF bResult mov ebx,TYPE bResult call DumpMem ; call Dump Memory for selected offset value ; ---------------WORD main processing-------- movzx ebx,wNum01 add ebx,wNum02 add ebx,wNum03 mov wSum,bx movzx ebx,wNum02 add ebx,wNum03 sub ebx,wNum01 movzx wDiff,ebx movzx ebx,wSum add ebx,wDiff movzx wResult,ebx mov esi,OFFSET wSum mov ecx,LENGTHOF wSum mov ebx,TYPE wSum call DumpMem ; call Dump Memory for selected offset value mov esi,OFFSET wDiff mov ecx,LENGTHOF wDiff mov ebx,TYPE wDiff call DumpMem ; call Dump Memory for selected offset value mov esi,OFFSET wResult mov ecx,LENGTHOF wResult mov ebx,TYPE wResult call DumpMem ; call Dump Memory for selected offset value ; --------DWORD main processing--------------- mov eax,0 mov eax,dwNum01 add eax,dwNum02 add eax,dwNum03 mov dwSum,eax mov eax,0 mov eax,dwNum02 add eax,dwNum03 sub eax,dwNum01 mov dwDiff,eax mov eax,0 mov eax,dwSum add eax,dwDiff mov dwResult,eax mov esi,OFFSET dwSum mov ecx,LENGTHOF dwSum mov ebx,TYPE dwSum call DumpMem ; call Dump Memory for selected offset value mov esi,OFFSET dwDiff mov ecx,LENGTHOF dwDiff mov ebx,TYPE dwDiff call DumpMem ; call Dump Memory for selected offset value mov esi,OFFSET dwResult mov ecx,LENGTHOF dwResult mov ebx,TYPE dwResult call DumpMem ; call Dump Memory for selected offset value ;----------------Dwtotal---------------- mov eax,0 movzx eax,bSum add ebx,wSum add eax,dwSum mov dwTotal,eax mov esi,OFFSET dwTotal mov ecx,LENGTHOF dwTotal mov ebx,TYPE dwTotal call DumpMem ; call Dump Memory for selected offset value exit main ENDP END main 
70 F@ Dump of offset 0046 60 Dump of offset 0040 9070 FFFQ 9060 Dump of offset 0040 30000070 Dump of offset 0040 FFFFFFFQ Dump of offset 0040 Move with Zero Fill for Different Data Sizes plus Arithmetic Copy the completed 101-AddSubOps.asm file to A02-AddSubMovZX.asm c Command Prompt The data segment contains these byte variables, plus their word and dword Dump of offset 0040 equivalents, and an additional variable dwTotal: .data Dump of offset 0040 bNum01 byte 64 bNum2 byte 32 bNum3 byte 16 bSum byte ? bDiff byte? bResult byte? Dump of offset 0040 Rework the arithmetic operations so that all ADD and SUB commands operate only on 32-bit registers (EAX and EBX). Dump of offset 0048 Use the MOVZX command to move byte and word values less than dword in size to a register appropriate for indicated arithmetic. Repeat all calculations from Assignment 01 using full 32-bit registers for math: 1. Add the three predefined numbers together and store in bSum. 2. Subtract first number from the sum of second and third number. Store the result in bDiff. bDiff = (bNum2 + bNum03) - bNum01 90000060 3. Add bSum and bDiff. Store this sum in bResult. 09680150 ADD and SUB operations should only be applied to the EAX and EBX registers. Use the MOV command to store 32-bit register values (in EAX) back to dword variables or refer to appropriate parts of the EAX register (AX for word sizes, AL for bytes) to store register values into variables less than 32 bits in length. The MOVZX operator can only be used to move data into registers, not for moves to variables in memory. Call DumpMem (set up with MOV commands) to display contents of bSum, bDiff, and bResult wSum, wDiff, and wResult dwSum, dwDiff, and dwResult After displaying the three sets of memory dumps (9 total), add bSum, wSum, and dwSum together using the ADD command only with values in the EAX and EBX registers. Use MOVZX to load byte and word values into these 32-bit registers used for the ADD operatons. Store the overall resulting sum in dwTotal (another declared dword). Call DumpMem to display the content of dwTotal. When complete, the assembly routine will have 19 variables, three separate memory dumps of_Sum, _Diff, and _Result, plus one memory dump of dwTotal, all in a single program. Output should be the same as before. Add these two lines of instruction right before the exit command to keep the display window open. call Crlf call WaitMsg Dump of offset 0040 70 F@ Dump of offset 0046 60 Dump of offset 0040 9070 FFFQ 9060 Dump of offset 0040 30000070 Dump of offset 0040 FFFFFFFQ Dump of offset 0040 Move with Zero Fill for Different Data Sizes plus Arithmetic Copy the completed 101-AddSubOps.asm file to A02-AddSubMovZX.asm c Command Prompt The data segment contains these byte variables, plus their word and dword Dump of offset 0040 equivalents, and an additional variable dwTotal: .data Dump of offset 0040 bNum01 byte 64 bNum2 byte 32 bNum3 byte 16 bSum byte ? bDiff byte? bResult byte? Dump of offset 0040 Rework the arithmetic operations so that all ADD and SUB commands operate only on 32-bit registers (EAX and EBX). Dump of offset 0048 Use the MOVZX command to move byte and word values less than dword in size to a register appropriate for indicated arithmetic. Repeat all calculations from Assignment 01 using full 32-bit registers for math: 1. Add the three predefined numbers together and store in bSum. 2. Subtract first number from the sum of second and third number. Store the result in bDiff. bDiff = (bNum2 + bNum03) - bNum01 90000060 3. Add bSum and bDiff. Store this sum in bResult. 09680150 ADD and SUB operations should only be applied to the EAX and EBX registers. Use the MOV command to store 32-bit register values (in EAX) back to dword variables or refer to appropriate parts of the EAX register (AX for word sizes, AL for bytes) to store register values into variables less than 32 bits in length. The MOVZX operator can only be used to move data into registers, not for moves to variables in memory. Call DumpMem (set up with MOV commands) to display contents of bSum, bDiff, and bResult wSum, wDiff, and wResult dwSum, dwDiff, and dwResult After displaying the three sets of memory dumps (9 total), add bSum, wSum, and dwSum together using the ADD command only with values in the EAX and EBX registers. Use MOVZX to load byte and word values into these 32-bit registers used for the ADD operatons. Store the overall resulting sum in dwTotal (another declared dword). Call DumpMem to display the content of dwTotal. When complete, the assembly routine will have 19 variables, three separate memory dumps of_Sum, _Diff, and _Result, plus one memory dump of dwTotal, all in a single program. Output should be the same as before. Add these two lines of instruction right before the exit command to keep the display window open. call Crlf call WaitMsg Dump of offset 0040

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions