Question

In: Computer Science

Given an array labeled as array1 with the values: 11111h, 22222h, 33333h, 44444h And another array...

  1. Given an array labeled as array1 with the values: 11111h, 22222h, 33333h, 44444h
    And another array labeled as array2 with the values: 0AEFFh, 23CAH, 1156H

    Sum up BOTH arrays through direct addressing and place the sum into the EAX register.

array1 is a DWORD and array2 is a WORD

Solutions

Expert Solution

1. Code:

.data

array1: dw 1111h,2222h,3333h,4444h

array2: dw 0AEFFH,23CAH,1156H

.code

lea esi,array1              ;load the address of array1 to esi

lea edi,array2              ;load the address of array2 to edi

mov eax,[esi]              ;load the first number from array1 to eax

add esi,2                      ;increment the address to point to the next number in array1

add eax,[esi]               ;adding the second number with first number

add esi,2                      ;increment the address

add eax,[esi]               ;adding third number

add esi,2                      ;increment the address

add eax,[esi]               ;adding fourth number

add eax,[edi]               ;adding first number of array2 with the sum of array1

add esi,2                      ;increment the address of array2

add eax,[edi]               ;adding the second number

add edi,2                     ;increment the address

add eax,[edi]               ;adding the third number and store the answer in register eax

hlt

thank u , give thumbs up plz!


Related Solutions

1. Given the following array named 'array1': array1 DWORD 50h, 51h, 52h, 53h Write instructions to...
1. Given the following array named 'array1': array1 DWORD 50h, 51h, 52h, 53h Write instructions to swap the items in array1 (using only MOV and XCHG instruction), so that the array1 become: 53h, 51h, 50h, 52h ( That means the first item in the array is 53h, second item is 51h, third item is 50h, forth item is 52h). You can use registers to perform the MOV and XCHG operation.   Write the code to perform above mentioned transformation.
//   Given an array of size 9, with the values of 1-9, determine if the array...
//   Given an array of size 9, with the values of 1-9, determine if the array //   is valid or not. //   Display a message stating the row is VALId, or state its INVALID and what //   was the index number that determined the data invalid. // //   Use this java code as a start of your code. //   Test the array data by changing the values. //============================================================================= import java.util.*;    public class Soduko_ValidateRow    { public static void main(String...
Write, specify and prove the function copy that copies a range of values into another array,...
Write, specify and prove the function copy that copies a range of values into another array, starting from the first cell of the array. First consider (and specify) that the two ranges are entirely separated. Note: Prototype is as below. void copy(int const* src, int* dst, size_t len){ }
IN JAVA PLEASE Given an unsorted array numbers of integers with duplicate values. Sort the array...
IN JAVA PLEASE Given an unsorted array numbers of integers with duplicate values. Sort the array and remove the duplicates in-place such that each element appears only once in the input array and returns the new length. Do not allocate extra space for another array, you must do this by modifying the input array in-place with O(1) extra memory. Find the time complexity of your removeDuplicates() method in Big-O notation and write that in a comment line on the top...
Write a method that, given an array of grades stored as double values, computes and return...
Write a method that, given an array of grades stored as double values, computes and return their mean.    Write another method that will return an array of the mean grade obtained by an arbitrary number of student.    This method will take a 2-dimensional array of double values in which each row corresponds to the grade vector    for a different student. You can compute the mean for each row as you did before...    Once you are done,...
Given an array A[1..n], with distinct values and k with 1 ≤ k ≤ n. We...
Given an array A[1..n], with distinct values and k with 1 ≤ k ≤ n. We want to return the k smallest element of A[1.....n], in non-decreasing order. For example: A = [5, 4, 6, 2, 10] and k = 4, the algorithm returns [2, 4, 5, 6]. There are at least the following four approaches: a. heapify A and then extract k elements one by one b. sort the array (e.g. using MergeSort or HeapSort) and then read the...
Overlapping Arrays (C++) An array overlaps another array if all elements of the latter array exist...
Overlapping Arrays (C++) An array overlaps another array if all elements of the latter array exist in the former array. They need not necessarily be in the same order. For example, [1,7,3,4,2] overlaps [1,2,3] because 1,2 and 3 exist in [1,7,3,4,2]. To make the implementation easy, [1,7,3,4,2] overlaps [1,1,2,3] as well. We don’t need to check whether 1 appears twice in the first array. Write a program that lets the user enter two arrays and displays whether the first array...
A billiard ball moving horizontally, labeled 1, strikes another billiard ball at rest, labeled 2. Before...
A billiard ball moving horizontally, labeled 1, strikes another billiard ball at rest, labeled 2. Before impact, ball 1 was moving at a speed of 2.45 m/s, and after impact it is moving at 0.60 m/s at 45° counterclockwise from the direction of the initial velocity. If the two balls have equal masses of 160 g, what is the velocity of ball 2 after the impact? (Assume ball 1 initially moves along the +x-axis. Enter the magnitude in m/s and...
A billiard ball, labeled X, moving horizontally, strikes another billiard ball, labeled Y, at rest. Before...
A billiard ball, labeled X, moving horizontally, strikes another billiard ball, labeled Y, at rest. Before impact, ball X was moving at a speed of 3.1 m/s, and after impact it is moving at 0.50 m/s at 50.° from the original direction. If the two balls have equal masses of 0.274 kg, what is the velocity of the ball Y after the impact?  Give your answer in meters/second only; ignore direction.
Using an array and a function, print the values of an array backwards. Please follow these...
Using an array and a function, print the values of an array backwards. Please follow these guidelines: - Setup your array manually (whichever values you want, as many as you want and whichever datatype you prefer). - Call your function. You should send two parameters to such function: the array’s length and the array. - Inside the function, go ahead and print the array backwards. - Your function shouldn’t return anything.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT