Question

In: Computer Science

Write an assembly language program to define an array of 5 double words initialized to 33,44,25,72,23,11...

Write an assembly language program to define an array of 5 double words initialized to 33,44,25,72,23,11 (all decimal). Add the first three numbers together and subtract the last two numbers from the sum. Store the sum in EAX register. Display the sum by using Irvine32 library procedures or by dumping registers to the display and taking a screenshot.

Solutions

Expert Solution

INCLUDE Irvine32.inc

main:
        push    rbp
        mov     rbp, rsp
        movsd   xmm0, QWORD PTR .LC0[rip]
        movsd   QWORD PTR [rbp-64], xmm0
        movsd   xmm0, QWORD PTR .LC1[rip]
        movsd   QWORD PTR [rbp-56], xmm0
        movsd   xmm0, QWORD PTR .LC2[rip]
        movsd   QWORD PTR [rbp-48], xmm0
        movsd   xmm0, QWORD PTR .LC3[rip]
        movsd   QWORD PTR [rbp-40], xmm0
        movsd   xmm0, QWORD PTR .LC4[rip]
        movsd   QWORD PTR [rbp-32], xmm0
        movsd   xmm0, QWORD PTR .LC5[rip]
        movsd   QWORD PTR [rbp-24], xmm0
        movsd   xmm1, QWORD PTR [rbp-64]
        movsd   xmm0, QWORD PTR [rbp-56]
        addsd   xmm1, xmm0
        movsd   xmm0, QWORD PTR [rbp-48]
        addsd   xmm0, xmm1
        movsd   QWORD PTR [rbp-8], xmm0
        movsd   xmm1, QWORD PTR [rbp-32]
        movsd   xmm0, QWORD PTR [rbp-8]
        subsd   xmm0, xmm1
        movsd   xmm1, QWORD PTR [rbp-24]
        subsd   xmm0, xmm1
        movsd   QWORD PTR [rbp-8], xmm0
        mov     eax, xmm0

        call WriteInt    

        pop     rbp
        ret
.LC0:
        .long   0
        .long   1077968896
.LC1:
        .long   0
        .long   1078329344
.LC2:
        .long   0
        .long   1077477376
.LC3:
        .long   0
        .long   1079115776
.LC4:
        .long   0
        .long   1077346304
.LC5:
        .long   0
        .long   1076232192

Related Solutions

Using MIPS assembly language In this program, you should define an array of 10 elements in...
Using MIPS assembly language In this program, you should define an array of 10 elements in your data segment with these values: ? = {11, 12,−10, 13, 9, 12, 14, 15,−20, 0} a. Write a function which finds the maximum value of this array. b. Write another function which calculates the summation of this array. c. Call these functions in your main program, and print the outputs of these functions to the user i. “The maximum is 15” ii. “The...
Write a MARIE assembly language program that will read an “array” of positive decimal values stored...
Write a MARIE assembly language program that will read an “array” of positive decimal values stored in memory and output the smallest value. Use variable addr to store the location of the first data item. Use variable length to store the number of items in your array. Your code should be organized such that adding an additional array item would only involve adding the data line (ie. 021 dec 400) and updating the length variable (ie. length, dec 5). You...
Please in C++ language Write a program that reads 10,000 words into an array of strings....
Please in C++ language Write a program that reads 10,000 words into an array of strings. The program will then read a second file that contains an undetermined number of words and search the first array for each word. The program will then report the number of words in the second list that were found on the first list.
Write a program that uses an array of doubles initialized to whatever values you wish. Write...
Write a program that uses an array of doubles initialized to whatever values you wish. Write methods to calculate and return the minimum and a method to calculate and return the maximum value in the array. You must write YOUR ORIGINAL methods for minimum and maximum. You MAY NOT use Math class methods or other library methods. Write an additional method that accepts the array as a parameter and then creates and returns a new array with all the same...
Q1: A. WRITE AN ASSEMBLY LANGUAGE PROGRAM TO EXCHANGE 16-BIT NUMBERS B. WRITE AN ASSEMBLY LANGUAGE...
Q1: A. WRITE AN ASSEMBLY LANGUAGE PROGRAM TO EXCHANGE 16-BIT NUMBERS B. WRITE AN ASSEMBLY LANGUAGE PROGRAM TO SOLVE THE EQUATION Z=A+B-(C/D)+E please write the answer separately part A its own code and part B its own code this is microprocessor the ASSEMBLY LANGUAGE emu8086 should be written like this EX: mov ax,100h mov bx,200h etc
Write a C program to Declare an integer array of size 10 with values initialized as...
Write a C program to Declare an integer array of size 10 with values initialized as follows. int intArray[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; Compute each item of a new array of same size derived from the above array by: adding first item (intArray[0]) of the array with 3rd, 2nd with 4th, 3rd with 5th and so on. For the last-but-one item intArray[8], add it with first item and for the last item (intArray[9])...
Write a program that creates a two-dimensional array initialized with test data. The program should have...
Write a program that creates a two-dimensional array initialized with test data. The program should have the following functions: Hi There I really appreciate your help with this project. ▪ getTotal . This function should accept a two-dimensional array as its argument and return the total of all the values in the array. ▪ getAverage . This function should accept a two-dimensional array as its argument and return the average of all the values in the array. ▪ getRowTotal ....
Write an inline assembly program that initialized a 100 byte area of memory using the STOS...
Write an inline assembly program that initialized a 100 byte area of memory using the STOS instruction.
C++ ASSIGNMENT: Two-dimensional array Problem Write a program that create a two-dimensional array initialized with test...
C++ ASSIGNMENT: Two-dimensional array Problem Write a program that create a two-dimensional array initialized with test data. The program should have the following functions: getTotal - This function should accept two-dimensional array as its argument and return the total of all the values in the array. getAverage - This function should accept a two-dimensional array as its argument and return the average of values in the array. getRowTotal - This function should accept a two-dimensional array as its first argument...
Write a sequence of assembly language instructions to subtract each entry of an array A of...
Write a sequence of assembly language instructions to subtract each entry of an array A of five two’s complement 16-bit binary integers from the corresponding entry of an array B of five two’s complement 16-bit binary integers and construct a third array C of two’s complement 16-bit binary integers. i.e. C[i] = A[i] - B[i]. Use the following data for the arrays A and B. A: 10, -15, 20, 4, -5 B: 25, -5, -30, 6, 10 please answer in...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT