Question

Programming Problem: SUMMING ARRAY ELEMENTS -       Use Assembly Language x86 (MASM) Write an assembly code...

Programming Problem:

SUMMING ARRAY ELEMENTS -

      Use Assembly Language x86 (MASM) Write an assembly code calculates the sum of all array elements. Save the sum in the EAX register.

-------------------------------------------------------------------------------

This is my code so far:

INCLUDE Irvine32.inc

N=10
.data
array SDWORD N DUP(0,1,2,3,4,5,6,7,8,9)
j DWORD ?
k DWORD ?
.code
    main PROC

        ; not complete

         exit

   main ENDP

END main

0 0
Add a comment Improve this question Transcribed image text
Answer #1

.data

array DWORD 10000h 20000h 30000h 40000h

theSum DWORD ?

.code

main PROC

mov esi OFFSET array

mov ecx, LENGTHOF array

call ArraySum

mov theSum, eax

With this code you get the sum of all the elements in the array and get the result in eax register.

I hope you will get your solution.

Add a comment
Know the answer?
Add Answer to:
Programming Problem: SUMMING ARRAY ELEMENTS -       Use Assembly Language x86 (MASM) Write an assembly code...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • MASM Assembly Language for x86 Processors: Given the following array declaration: .data matrix DWORD 50 DUP(10...

    MASM Assembly Language for x86 Processors: Given the following array declaration: .data matrix DWORD 50 DUP(10 DUP(?)) If matrix[0][0] is the 0th sequentially stored BYTE in memory, which sequentially stored BYTE is the first byte corresponding to matrix[14][2]? (in decimal) Please expplain how you got the answer, so I can answer other questions like this! Thank you

  • This is a question from Assembly Language for x86 7th Edition by Kip Irvine, but the...

    This is a question from Assembly Language for x86 7th Edition by Kip Irvine, but the solution is not there. Programming exercise 12.7 #2. The code must be in assembly language for Intel using Kip Irvine library. An example of the source code would be: INCLUDE Irvine32.inc .code main PROC mov ax,4000h mov bx,1000h mov cx,1500h sub ax,bx sub ax,cx call DumpRegs exit main ENDP END main Question: Write a procedure that receives a single-precision floating-point binary value and displays...

  • Write an assembly language code Irvine32.inc x86 for the following pseudo code. Use Conditional jump If...

    Write an assembly language code Irvine32.inc x86 for the following pseudo code. Use Conditional jump If (op1 == op2)                         X=1; Else                         X=2; While (EAX < EBX)         EAX = EAX + 1 ;

  • Task is to implement the following algorithms in Assembly language for x86 processor

    Task is to implement the following algorithms in Assembly language for x86 processor1) Insertion sort Demonstrate Sorted Array of 10 elements in Watch Window for each one Running time of each algorithmsample bubble sort code:;----------------------------------------------------------BubbleSort PROC USES eax ecx esi,pArray:PTR DWORD, ; pointer to arrayCount:DWORD ; array size;; Sort an array of 32-bit signed integers in ascending; order, using the bubble sort algorithm.; Receives: pointer to array, array size; Returns: nothing;-----------------------------------------------------------mov ecx,Countdec ecx ; decrement count by 1L1: push ecx ; save outer...

  • NOTE: explain the lines in comments for better understanding Write an assembly program (for x86 processors...

    NOTE: explain the lines in comments for better understanding Write an assembly program (for x86 processors - Irvine) that has two procedures, a main procedure and a procedure called Fib. The fib procedure is to uses a loop to calculate and printout the first N Fibonacci numbers. Fibonacci sequence is described by the following formula: Fib(1) = 1, Fib(2) = 1, Fib(n) = Fib(n – 1) + Fib(n – 2). The value of N is to be communicated to this...

  • I need the following done in MASM (Assmebly or ASM) This program must use Irvine Library and the outline for the code is...

    I need the following done in MASM (Assmebly or ASM) This program must use Irvine Library and the outline for the code is below (Kip irvine) Write an assembly language program to input a string from the user. Your program should do these two things: 1. count and display the number of words in the user input string. 2. Flip the case of each character from upper to lower or lower to upper. For example if the user types in:   ...

  • X86 Assembly Language Help to implement the CipherChar Procedure at the end of the given code...

    X86 Assembly Language Help to implement the CipherChar Procedure at the end of the given code INCLUDE Irvine32.inc         .data       KeyPrompt BYTE "Enter the passphrase: ",0       TextPrompt BYTE "Enter the plaintest: ",0           str1 BYTE "The passphrase has length:",0           str2 BYTE "The plaintest has length:",0       KeyIs BYTE "The passphrase: ",0       PlainTextIs BYTE "The plaintext: ",0       CipherTextIs BYTE "The ciphertext: ",0       KMAX = 64                        ; passphrase buffer maximum size       BMAX = 128                       ; test...

  • I need help with a code in assembly language MASM (x86)

    write an assembly language (x86) program to input in a string 10 multi-digit integers and displays them in ascending order. Modify the code below to comply with the requirement..model small.stack 100h.datastrg1 DB 'Insert numbers: $'strg2 DB 'Sorted numbers: $'Arr Db 10 dup(?)v dw ?.codemain procmov ax,@datamov ds,axmov ah,9lea dx,strg1int 21hmov dl,0ahmov ah,2int 21h;inputsmov di,0mov cx,10Input_loop:mov ah,1int 21hmov arr[di],almov dl,0ahmov ah,2int 21hinc diloop Input_loopmov v,0sort:mov di,0mov cx,10sub cx,vB:mov al,Arr[di]cmp al,Arr[di+1]jng Cmov al,Arr[di]xchg al,Arr[di+1]mov Arr[di],alc:inc diloop Binc vcmp v,10jne sort;Outputmov ah,9lea dx,strg2int...

  • Please use X86 Assembly Language, Irvine32 Declare a double word array of size 10 and initialize...

    Please use X86 Assembly Language, Irvine32 Declare a double word array of size 10 and initialize it with some numbers. Find the number of even numbers and the number of odd numbers in this array and save them in locations called oddCount and evenCount.

  • Write this code using x86 assembly language using the irvine32 library

    Write this code using x86 assembly language using the irvine32 library Create a procedure that fills an array of doublewords with N random integers, making sure the values fall within the range j...k, inclusive. When calling the procedure, pass a pointer to the array that will hold the data, pass N, and pass the values of j and k. Preserve all register values between calls to the procedure. Write a test program that calls the procedure twice, using different values...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT