Question: Create the two programs described below. Upload them to Canvas prior to the due date. 1. swapthem.asm - rearranges the values of the following array

 Create the two programs described below. Upload them to Canvas priorto the due date. 1. swapthem.asm - rearranges the values of thefollowing array into the order shown. Use only MOV and XCHG to

Create the two programs described below. Upload them to Canvas prior to the due date. 1. swapthem.asm - rearranges the values of the following array into the order shown. Use only MOV and XCHG to accomplish the desired result. DO NOT use any immediate values except in the .data section. Use only direct offset addressing to accomplish the goal. Be as efficient as you can. Note: You will have to look at memory to see if you have achieved your goal. You may not create other data elements to assist with this problem. Original Array: theArray WORD 98h, 32h, 67h, 45h At the end of this part of the assignment, the array will be in increasing order. This means in memory, not just the registers. You will be using a new Irvine Library function. DumpMem. In order to use this you need the following information. ESI= Offset of myArray ECX= \# of elements in myArray. Create a symbolic constant in the .data section using the $ directive to get this information. EBX = unit size (use the TYPE instruction). After you have the information required in ESI, ECX, and EBX, you will simply type call DumpMem on the next line. To be clear, it will be something like the following (where you will fill in the xxx) mov esi, xxxxxxx mov ecx, xxxxxxx mov ebx, xxxxxxx call dumpmem fibonacci.asm - computes the following. a. Compute fib(n) for n=2,3,,15 using an array, of the appropriate size and type. If you so desire, you may declare a value for fib(0) and fib(1). However, all computation of the remaining elements of the array must be done by your program, no use of immediate values is allowed. In other words, you must use the formula shown below (figure 1) to determine the values of the remainder of the required elements. Do not declare an array pre-filled with ALL the required elements. b. After your array is filled with required values, store fib(6) through fib(9) in consecutive bytes of the ebx register starting from the lowest byte; that is, fib(6) is stored in the low byte (bl) of ebx, fib(7) is stored in the next byte (bh), fib(8) is stored in the next byte of ebx and fib(9) is stored in the highest byte. Often, especially in modern usage, the sequence is extended by one more initial term: 0,1,1,2,3,5,8,13,21,34,55,89,144,.[3] By definition, the first two numbers in the Fibonacci sequence are either 1 and 1 , or 0 and 1 , depending on the chosen starting point of the sequence, and each subsequent number is the sum of the previous two. In mathematical terms, the sequence Fn of Fibonacci numbers is defined by the recurrence relation Fn=Fn1+Fn2 with seed values [1][2] F1=1,F2=1 or[5] F0=0,F1=1. Figure 1: Information on the Fibonnaci sequence Notes for Fibonacci.asm 1. Assume fib(0)=0,fib(1)=1. These are the only two values you may directly initialize in the .data section. You can declare them as part of the array. 2. You may use any instruction/directive/operator through chapter 4pg128, including any of the arithmetic operators +,,1,. 3. Your program must use indirect operands in some way as discussed in chapter 4. 4. You program MUST calculate all values of the Fibonacci sequence except Fib(0) and Fib(1). 5. You must use a loop. Specifications for Entire Assignment 1. Your program must make calls to DumpRegs as necessary. 2. If you use immediate values for any portion of this assignment (except where specifically allowed), you will receive a zero for that portion of the assignment. Example: mov ebx, 08050302 i// This is NOT ALLOWED 3. Part of the program will be graded based on program style. I reserve the right to judge style as I deem fit for the assignment. This includes commenting, whitespace, use of the required header, etc 4. You can use immediate values if you are using direct addressing

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!