please code in assembly language
thanks in advance
Exercises 4.1 1.For each part ofthis problem,assume the "before values when the given mov instruction is executed. Give the requested "after" values. 122 Before Instruction After (a) EBX: 00 00 FF 75 ECX: 0000 01 A2 (b) EAX: 000001A2 (d EDX: FF75 4C 2E mov ebx, ecx mov eax, 100 EBX ECX EAX dValue: DWORD- "(d) AX: 01 4B (e) AL: 64 mov edx, dvalue mov ah, mov al, -1 EDX, dValue AX AL dValue: DWORD? (g) ECX:00 00 0000 EBX dValue ECX RAX qValue mov dvalue, ebx mov ecx, 128 (h) RAX:00 00 00 00 00 000000mo rax, -1 mov qvalue, 100 mov qvalue, R mov risw, wWalue ( qValue: QWORD Value, R8 K RBX: 12 12 1212 12 12 1212 ov ebx, 12 0) R15: 15 15 15 15 15 15 15 15 RBX wValue: WORD-15 R15 *2. Give the opcode and number of bytes of object code (including prefix bytes) for each instruction in Exercise 1. 3. Include each instruction (a)-(g) from Exercise 1 in a short program. Assemble the program and examine the listing file. If the object code has a ModR/M byte, give the value for each of the three fields and, if possible from the discussion in this section, interpret the value of each field. 4. For each part of this problem, assume the "before" values when the given xchg instruction is executed. Give the ers/jasee/Downloads/Introduction-to-80x86-Assembly-Language-and-Computer-Archi lofi Options v section, interpret the value of each field. 4. For each part of this problem, assume the "before" values when the given xchg instruction is executed. Give the requested "after" values. Before Instruction After (a) EBX:00 00 FF 75 EC:000001 A2 (b) EAX:00 00 01 A2 xchg ebx, ecx EBX ECX Temp: DWORD- (d DX: FF 75 (d) AX:01 48 xchg Tenp,eaxEAX Temp xchg dl, dh xchg ah, bl xchg eax, edx DX AX BX EAX EDX (e) EAX: 12 BC 9A 78 EDX: 56 DE 34 RO ( EBX: 1234 5678 EDX: 9A BC DE FO xchg bx, dx EBX EDX (g) RAX:0A 0A 0A 0A 0A OA 0A 04 xchg eax, r1s EAX R15 R15: 15 15 15 15 15 15 15 15 5. Give the opcode and number of bytes of object code (including prefix bytes) for each instruction in Exercise 4 6. Note that xchg cannot swap two values in memory. Write a sequence of mov and/or xchg instructions to s doublewords stored at valuer and value2. Pick instructions that give the smallest possible total number of bytes of object code. Assume that any register 32 you want to use is available. 4.2 Integer Addition and Subtraction Instructions The Intel 80x86 microprocessor has add and sub instructions ers/jasee/Downloads/lIntroduction-to-80x86-Assembly-Language-and-Computer-A 1 of 1 Options 4. Using the console32 or console64 framework, write a complete assembly language program that computes in EAX the value of the expression 2(-a+ b-1) c for doublewords in memory at a, b, and c. Choose your area code for a, the first 137 three digits of your local phone number for b, and the last four digits of your local phone number for c, and predict the result before building the program and executing it under control of the debugger. on-to-80x86-, + and-Computer-Architecture-3rd-Edition-BOOUBNOSESp 1 of 1 Options v io.h as appropriate. 6. Using the console32 or console64 framework, write a complete assembly language program that computes in EAX the perimeter (2"length 2"width) of a rectangle where the length and width are in memory doublewords. Choose the dimensions of a racquetball court for the length and width, and prediet the result before building the program and executing it under control of the debugger. (Hint: You can find the dimensions of a racquetball court at the USA Racquetball web site.) e here to search Execution of program to calculate area of rectangle Exercises 4.3 1. For each part of this problem, assume the "before" values when the given instruction is executed. Give the requested "after" values. Before (a) EAX: FFFF FF E (b) AX: FF FF FFE4 Instruction After mul eba mul value mul ax mul bh EAX EDX, CF OF EAX EDX, CF, OF AXDXCEOF AXCEOF AX CE OF doubleword at volue (c) AX: FFFIF (d) AL: OF e) AL: FO BH: C4 EAX: 00 0000 17 mul bh ( EOK: 00000082 EBX: 000004C2 doubleword at value imul ecx imul ebx imul value imul eax imul bh g) EAX: FF FF FF E4 EAX EDX, CF, ORF EAX EDX, CF.OF EAX EDX, CFOF AX CF OF (h) EAX: FF FF FF E O EAX: FF FF FF FF OAL: OF BH: 4C () AL: FO BH: C4 imul bh EDX: FF 03 FF 01 (m) EAX: 00 0000 0A imul ebx EAX EBX EDX CF OF mul ebx EAX EBX EDX CF OF *2. Give the opcode and the number of bytes of object code (including prefix bytes) for each instruction in Exercise 1. and inputs the length, width, and height of a box and computes and displays its volume (length * width * height). 2. Using the windows32 or windows64 framework, write a complete 8ox86 assembly language program that prompts for and inputs the length, width, and height of a box and calculates and displays its surface area 2*(length"width + length "height + width height). /a n-to-80x86-X+v file:/I/C to-80x86-Assembly-Language-and-Computer-Architecture-3rd-Edition-B0O 1 of 1 Options v aicurales e sum anu une average (su4 uue graues. Display the sum and average on two lines of a message box, each line with an appropriate label. 3. Using the windows32 or windows64 framework, write a complete 8ox86 assembly language program that prompts for and inputs four grades Grader, Grade2, Grade3, and Grade4. Suppose that the last grade is a final exam grade that counts twice as much as the other three. Calculate the sum (adding the last grade twice) and the average (sum/5). Display the sum and average on two lines of a message box, each line with an appropriate label. Type here to search 3 4.1 #1 a, c, f #2 a, c, f (from #1) #3 a, c , f (from #1) #4 a, f #5 a, f (from #4) #6 4.2 #4 4.3 #2 (programming exercise) 4.4 #1 b, e, g (exercise) #3 (programming exercise arch