Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Assembler language and Architecture 2. inn is worth 50 porms that includes pomus

ID: 3582261 • Letter: A

Question


Assembler language and Architecture 2. inn is worth 50 porms that includes pomus your explanation ammers Write an assembly program that canalates the sum ofalt negative aman elen d robust any array size Assume the array of integers can be defined with any given mmber of that int Array swORD 1, 2,0, 7.120, 3.5 12 66 0 ntArray SWORD -S-3, to int Array swORD any gives mumber elements The program should display the resuh in ihr format CSC-310 Final Exam Your Name The sum of all negative array clements Explanatiou: (10 pointsh Solution: (40 points)

Explanation / Answer

format PE console
include 'win32a.inc'

mov esi,nD
mov ecx,[qcnD]
mov [negative_sum_result],0
mSum:
cmp dword [esi],0
jg mNotNeg
mov eax,[negative_sum_result]
add eax,dword [esi]
mov [negative_sum_result],eax
mNotNeg:

invoke ExitProcess,0

nD dd 1,-2,-3,4,5,-6,-7,8,9,10
qcnD dd ($-nD)/4
negative_sum_result dd ?

include 'APIkernel32.inc'

data import

library kernel32,'KERNEL32.DLL'

end data

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote