Question
Question 1 (5 points) Implement the following expression in assembly language: AL = (val3 + 7) - (var2 + val1) + (5/3)*7 - Assume that
Question 1
-
(5 points) Implement the following expression in assembly language:
AL = (val3 + 7) - (var2 + val1) + (5/3)*7
-
- Assume that val1, val2, and val3 are 8-bit integer variables
-
- Initialize val1 with 12, val2 with 9, and val3 with 2
-
- You are only allowed to use 8-bit registers.
-
- Use ONLY mov, add, sub instructions whenever needed.
-
- Use the debugger to verify your answer.
o Submit the following: Save your source code as Lastname1.asm and upload the Lastname1.asm
Screenshot showing that AL register contains the correct result.
-
I do not if I am doing this right it giving me an error message
Question 2
-
points) Implement the following expression in assembly language:
BX = val2 + 7 - (- val3 + val1)
-
- Assume that val1, val2, and val3 are 8-bit integer variables
-
- Initialize val1 with 12, val2 with 9, and val3 with 2
-
- You are only allowed to use 16-bit registers to hold intermediate results, whenever needed.
-
- Use mov, add, sub, movzx, movzx, or neg instructions whenever needed.
-
- Use the debugger to verify your answer.
o Submitthefollowing: Save your source code as Lastname2.asm and upload the Lastname2.asm
Screenshot showing that BX register contains the correct result.
-
same with this one it giving me an error please help me.
5 6 7 er Explorer Toolbox ;AL = (val3 + 7)-(val2 + val1)+(5/3)*7 . 386 model flat, stdcall .stack 4096 ExitProcess PROTO, dwExitCode: DWORD 8 9 10 .data val1 AH 12 val2 BH 9 val3 CH 2 . code main PROC mov eax, O mov CH, val3 mov BH, val2 mov DH, val1 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 add CH, 7 add BH, DH sub CH, BH add CH, 5/3 * 7 Call WriteDec invoke ExitProcess, O call ExitProcess main ENDP END main 100 % No issues found Output Show output from: Build Clean started... 1>------ Clean started: Project: assignment2.91, Configuration: Debug Win32 ========== Clean: 1 succeeded, O failed, o skipped ========== Error List Output O Clean succeeded U Type here to search O X 5 6 er Explorer Toolbox 7 8 9 ;AL = (val3 + 7)-(val2 + vali)+(5/3)*7 .386 model flat, stdcall .stack 4096 ExitProcess PROTO, dwExitCode: DWORD .data val1 AH 12 val2 BH 9 val3 CH 2 .code main PROC mov eax, 0 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 mov CH, val3 mov BH, val2 mov DH, val1 add CH, 7 add BH, DH sub CH, BH add CH, 5/3 * 7 Call WriteDed invoke ExitProcess, 0 call ExitProcess main ENDP END main 100 % No issues found Error List Entire Solution X 8 Errors ! O Warnings O O Messages Build + IntelliSense Code Description X A2008 syntax error: AH X A2008 syntax error: BH X A2008 syntax error: CH X A2006 undefined symbol: val3 X A2006 undefined symbol: val2 Error List Output Project assignment2.91 assignment2.91 assignment2.91 assignment2.91 assignment2.91 O Ready H O Type here to search ,C & Explorer Toolbox 5 6 7 ;BX = -val2 + 7 - (-val3 + vall) .386 .model flat, stdcall .stack 4096 ExitProcess PROTO, dwExitCode: DWORD 8 9 .data mov val1, 12 mov val2, 9 mov val3, 2 mov ax, 0 mov bx, o mov cx, 0 mov dx, o 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 movzx dx, val2 neg dx add dx, 7 movzx ax, val3 neg ax movzx cx, vall add ax, cx add ax, ax neg ax add dx, ax No issues found 100 % Error List Entire Solution X 2 Errors ! O Warnings O O Messages XX Build + IntelliSense Code Description X A1010 unmatched block nesting: main X MSB3721 The command "ml.exe /cologo /Zi /FO"Debug\moralesdeleon2.obj" /W3 /errorReport:prompt / Tamoralesdeleon2.asm" exited with code 1. Project assignment2.92 assignment2.92 Error List Output O Ready H Type here to search Jer Explorer 21 22 23 movzx dx, val2 neg dx add dx, 7 Toolbox 24 25 26 27 28 29 movzx ax, val31 neg ax movzx cx, val1 add ax, cx add ax, ax neg ax add dx, ax mov result, dx mov bx, dx 30 31 32 33 34 35 36 37 38 39 40 41 invoke ExitProcess, O call Exit Process main ENDP END main 100 % No issues found ** Error List Entire Solution X 2 Errors ! 0 Warnings 0 0 Messages * Build + IntelliSense Code Description A1010 unmatched block nesting: main MSB3721 The command "ml.exe /cologo /Zi /Fo"Debug\moralesdeleon2.obj"/W3 /errorReport:prompt / Tamoralesdeleon2.asm" exited with code 1. Project assignment2.92 assignment2.92 Error List Output Ready Type here to search DI C. 5 6 7 er Explorer Toolbox ;AL = (val3 + 7)-(val2 + val1)+(5/3)*7 . 386 model flat, stdcall .stack 4096 ExitProcess PROTO, dwExitCode: DWORD 8 9 10 .data val1 AH 12 val2 BH 9 val3 CH 2 . code main PROC mov eax, O mov CH, val3 mov BH, val2 mov DH, val1 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 add CH, 7 add BH, DH sub CH, BH add CH, 5/3 * 7 Call WriteDec invoke ExitProcess, O call ExitProcess main ENDP END main 100 % No issues found Output Show output from: Build Clean started... 1>------ Clean started: Project: assignment2.91, Configuration: Debug Win32 ========== Clean: 1 succeeded, O failed, o skipped ========== Error List Output O Clean succeeded U Type here to search O X 5 6 er Explorer Toolbox 7 8 9 ;AL = (val3 + 7)-(val2 + vali)+(5/3)*7 .386 model flat, stdcall .stack 4096 ExitProcess PROTO, dwExitCode: DWORD .data val1 AH 12 val2 BH 9 val3 CH 2 .code main PROC mov eax, 0 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 mov CH, val3 mov BH, val2 mov DH, val1 add CH, 7 add BH, DH sub CH, BH add CH, 5/3 * 7 Call WriteDed invoke ExitProcess, 0 call ExitProcess main ENDP END main 100 % No issues found Error List Entire Solution X 8 Errors ! O Warnings O O Messages Build + IntelliSense Code Description X A2008 syntax error: AH X A2008 syntax error: BH X A2008 syntax error: CH X A2006 undefined symbol: val3 X A2006 undefined symbol: val2 Error List Output Project assignment2.91 assignment2.91 assignment2.91 assignment2.91 assignment2.91 O Ready H O Type here to search ,C & Explorer Toolbox 5 6 7 ;BX = -val2 + 7 - (-val3 + vall) .386 .model flat, stdcall .stack 4096 ExitProcess PROTO, dwExitCode: DWORD 8 9 .data mov val1, 12 mov val2, 9 mov val3, 2 mov ax, 0 mov bx, o mov cx, 0 mov dx, o 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 movzx dx, val2 neg dx add dx, 7 movzx ax, val3 neg ax movzx cx, vall add ax, cx add ax, ax neg ax add dx, ax No issues found 100 % Error List Entire Solution X 2 Errors ! O Warnings O O Messages XX Build + IntelliSense Code Description X A1010 unmatched block nesting: main X MSB3721 The command "ml.exe /cologo /Zi /FO"Debug\moralesdeleon2.obj" /W3 /errorReport:prompt / Tamoralesdeleon2.asm" exited with code 1. Project assignment2.92 assignment2.92 Error List Output O Ready H Type here to search Jer Explorer 21 22 23 movzx dx, val2 neg dx add dx, 7 Toolbox 24 25 26 27 28 29 movzx ax, val31 neg ax movzx cx, val1 add ax, cx add ax, ax neg ax add dx, ax mov result, dx mov bx, dx 30 31 32 33 34 35 36 37 38 39 40 41 invoke ExitProcess, O call Exit Process main ENDP END main 100 % No issues found ** Error List Entire Solution X 2 Errors ! 0 Warnings 0 0 Messages * Build + IntelliSense Code Description A1010 unmatched block nesting: main MSB3721 The command "ml.exe /cologo /Zi /Fo"Debug\moralesdeleon2.obj"/W3 /errorReport:prompt / Tamoralesdeleon2.asm" exited with code 1. Project assignment2.92 assignment2.92 Error List Output Ready Type here to search DI C
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started