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 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 ....
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...
Use MIPS assembly language program to swap two of the integers in an integer array. The...
Use MIPS assembly language program to swap two of the integers in an integer array. The program should include the Swap function to swap the integers and the main function to call the Swap function. The main function should: • Pass the starting address of the array in $a0. • Pass the indices of the two elements to swap in $a1 and $a2. • Preserve (i.e. push onto the stack) any T registers that it uses. • Call the Swap...
Hi this is Assembly Language MASM x86 program. Please write it in the language and please...
Hi this is Assembly Language MASM x86 program. Please write it in the language and please explain it with comments thank you Please answer it I really need help this question was refunded before so please answer. Thank you so much also these are two separate programs thank you. 1) Write a procedure to read in decimal or hex number (byte-sized) Then write a procedure using shifts and ANDS to convert the string to a binary number (if is backward,...
Using the windows 32 framework , write an assembly language program ; write a procedure to...
Using the windows 32 framework , write an assembly language program ; write a procedure to read a string and shift each character of the string by one. As an example, if your input string is Abcz, your output should be Bcda. Note that you must test your string for non-alphabetic characters (such as numbers and special characters). If there are non-alphabetic characters, you should terminate your program with an appropriate message. You should display your converted string using the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT