” CSCI 150编程 辅导、 写作c++,pythonCSCI 150 — Lab 3Programming in Assembly LanguageDue:________________________Feel free to discuss and help each other out, but does not imply that you can give awayyour code or your answers! Make sure to read all instructions before attempting this lab.Refer to the MSVS 2017/2019 document on Canvas and obtain helps from yourinstructor as necessary. You cannot work with a lab partner for this assignment.You must use an appropriate Provided template from Canvas or my website(zeus.mtsac.edu/~tvo) and output Author: Your Name(s) for all newprograms. If you are modifying an existing program, use Modified by: YourName(s).Exercise 1: Using the AddSub program from the book as a reference, write an assemblyprogram to perform the following operations using only 16-bit registers: AX = 20 – (15 +30). You must perform 15 + 30 first and then perform the subtraction operation. Useadditional registers as needed. Insert a call DumpRegs statement after each operationand confirm that AX is holding the correct result. Add a comment after each instructionto describe it. For example:mov bx, 1 ; assign 1 to bx so bx = 1add bx, 2 ; add 2 to bx so bx = 3In addition, display the message Author: Your Name. at the beginning of your programby defining a null-terminated string and then add a call WriteString instruction.Once your program is working correctly, modify it to add the following calculation: BX= a – (b + d), but do keep the Code from previous step. Once again, you must performaddition operation first and then perform the subtraction operation. Define variables a, b,and d as 16-bits signed integers with values 20, 15, and 30 respectively. Use DumRegsto confirm that it calculates the result for BX correctly.; instructions to calculate AX = 20 (15 + 30), using constants; instructions to calculate BX = a (b + d), using variables; AX and BX should have the same valueExercise 2: Write an assembly program in 32-bit Protected mode that implements thefollowing arithmetic expressions using as few instructions and registers as possiblewithout simplifying the Expression manually (i.e., perform operations in correct orderaccording to normal precedence and use variables as applicable). Assume that r1 is a 32-bit signed value and r2 is a 16-bit unsigned value. You can confirm that variables r1 andr2 hold correct values by assign them to different registers and call DumpRegs.r1 = -(v2 (v3 + v1)) + 1r2 = v4 + 10hUse the following data definitions:v1 SDWORD 10hv2 SDWORD 30hv3 SDWORD 20r1 SDWORD ?v4 WORD 0FFFFhr2 WORD ?In comments next to each instruction, write the current hexadecimal value of the affectedregister or variable (for example: mov eax, 12 ; eax = 0Ch). Insert a callDumpRegs Statement at the end of the program and you should examine various registersto confirm that your Program is working properly. In addition, display the messageAuthor: Your Name. at the beginning of your program by defining a null-terminatedstring and then add a call WriteString instruction.Lab question 1: How does MSVS know that you are working with an assembly programinstead another program such as C++?Lab question 2: What do you have to modify in your program to compute EBX = a – (b+ d)? Just answer the question without modifying your program.Extra Credit (1.5 points): Add code to second exercise to display the decimal values inr1 and r2 in correct format to the screen in for exercise 2.r1: [whatever value for r1]r2: [whatever value for r2]Fill out and turn in the PA submission file for this assignment (save as PDF format).请加QQ:99515681 或邮箱:99515681@qq.com WX:codehelp
“
添加老师微信回复‘’官网 辅导‘’获取专业老师帮助,或点击联系老师1对1在线指导。