Implement the following expression in assembly language:
ECX = –(val3 - val1) + (-val4 + val2) + 3
Assume that val1 is 16-bit variable, val2 is 32-bit variable, val3 is 8-bit variable, and val4 is 8-bit variable.
You need to implement the expression the way it is provided, you cannot do any reduction on the expression while implementing it.
Initialize val1 with 12 (decimal), val2 with 9 (decimal), val3 with 2 (decimal), val4 with 20 (decimal),
You are NOT allowed to update the values stored in val1, val2, val3 and val4
Use mov, add, sub, movsx, movzx, or neg instructions whenever needed.
Use the debugger to verify your answer.
Submit the following:
Save your source code using your last name, Lastname2.asm and upload the
Lastname2.asm
Screenshot (showing the code and register window) of ECX register contains the correct result.
Give the Whole Code and screen shot of the Register
Trending nowThis is a popular solution!
Step by stepSolved in 3 steps
- NAND2TETRIS HARDWARE SIMULATOR HiLoMux - This has one 8-bit input bus, in, and one 4-bit output bus, out. Alsopresent is a sel input, which is used to select what appears on out. Ifsel is false, then out should contain the lower 4-bits of in (i.e. in[0],in[1], in[2], in[3]). If sel is true, then out should contain theupper 4-bits of in (i.e. in[4] mapped to out[0], in[5], mapped toout[1], etc.). In other words, the HiLoMux can be used to select anibble from a byte please use the skeleton program below CHIP HiLoMux{ IN in[8], sel; OUT out[4]; PARTS: }arrow_forwardplz do it in very easy methid in assembly languagearrow_forwardint i = 5; is a statement in a C program. A. during execution, value of i may change but not its address B. during execution both the address and value may change C. repeated execution may result in different addresses for i D. i may not have an associated addressarrow_forward
- Write an assembly code that will calculate the value of y in the following equation: y= 2a+ 3b−4c Here, roll= 2019000510221 Microprocessor and Interfacing, Electrical and electronics engineering.arrow_forward|long arith(long x,long y,long z) { long t1=x+y; long t2=z+t1; long t3=x+4; |long t4=y*48; long t5=t3+t4; long rval=t2*t5; return rval ; } In what registers are the arguments x, y, and z passed? In what register is variable rval returned? How many registers are involved in the execution of all the ALU operations? How many bytes are allocated to the stack frame of function arith? Justify your answer. Annotate each line of the assembly code obtained from the compiler and include the screenshot.arrow_forwardThere are three single precision floating point numbers, numA, numB and numC. Write a piece of code in MIPS assembly language that compares two numbers numA and numb, if numB is greater than numA, add them and save the result in numC. Otherwise save 0 in numC.arrow_forward
- Please show the output of the following code in assembly:arrow_forwardWrite a code in sim8085 for the following problem: The pressure of two boilers is monitored and controlled by a microcomputer works based on microprocessor programming. A set of 6 readings of first boiler, recorded by six pressure sensors, which are stored in the memory location starting from 2050H. A corresponding set of 6 reading from the second boiler is stored at the memory location starting from 2060H. Each reading from the first set is expected to be higher than the corresponding position in the second set of readings. Write an 8085 sequence to check whether the first set of reading is higher than the second one or not. If all the readings of first set is higher than the second set, store 00 in the ‘D’ register. If any one of the readings is lower than the corresponding reading of second set, stop the process and store FF in the register ‘D’. Data (H): First set: 78, 89, 6A, 80, 90, 85 Second Set:71, 78, 65, 89, 56, 75arrow_forwardNAND2TETRIS HARDWARE SIMULATOR HiLoMux - This has one 8-bit input bus, in, and one 4-bit output bus, out. Alsopresent is a sel input, which is used to select what appears on out. Ifsel is false, then out should contain the lower 4-bits of in (i.e. in[0],in[1], in[2], in[3]). If sel is true, then out should contain theupper 4-bits of in (i.e. in[4] mapped to out[0], in[5], mapped toout[1], etc.). In other words, the HiLoMux can be used to select anibble from a byte please use the skeleton program below CHIP HiLoMux{ IN in[8], sel; OUT out[4]; PARTS: }arrow_forward
- Write an assembly function that uses a for loop to multiply all the numbers from 1 through and including N. Return the result. Print the returned value. Hello I was hoping someone could run through this code step by step as I am new to Assembly language, thank you!arrow_forwardNO PSEUDOINSTRUCTIONS you can not use li or la. Write a MIPS assembly language subroutine called GetCode that asks the user to enter a 7 bit code consisting of ones and zeros. When the user is finished entering the data, they should hit the Enter key. The data should be stored in memory as a NULL terminated ASCII string at the address passed into the routine in register a1. The user should be prompted for the data by displaying a prompt to the console asking them to enter the data. These prompts can be stored in the beginning of the data segment, and should not reside outside of the range 0x10000000 through 0x1000FFFF in memory NO PSUEDOINSTRUCTIONSarrow_forwardQ1- Write a program in assembly language for the 8085 microprocessor to send one byte of data located at the memory address (3000H ) using SOD at a baud rate of 1200. Information: The 8085 processor operates at a frequency of 3.072 MHz . When sending the required byte, you must adhere to the following: The two high bits of the start bits(1 1) must be sent, after that the data bits are sent, after that the low bit of the stop bit (0) is sent. The following flowchart will help you. The solution must be integrated and include the calculation of the baudrate delay timearrow_forward
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education