Question: Hello, I need help with this project: Implement the following C + + code fragment in assembly language. Use the block structured . IF and
Hello, I need help with this project: Implement the following C code fragment in assembly language. Use the block structured IF and WHILE directives. Assume that all variables are bit integers.
int array;
int lower ;
int upper ;
int ArraySize sizeof array sizeof lower;
int index ;
int sum ;
while index ArraySize
if arrayindex lower && arrayindex upper
sum arrayindex;
index;
Your assembly language program must also display as output the number of times a member of 'array' qualified for inclusion into the 'sum' lower && upper and what the final value of the variable 'sum' was. Hint: you may have to add another variable. You may use the author's procedures in the book's link library. Use only the procedures that have been covered in the textbook so far.
Sample output:
Qualified members: XX
Sum XX This is my work so far, but I wasn't sure if I was doing it right: INCLUDE Irvineinc
model flat, stdcall
Stack
Exit Process PROTO, dwExitCode: DWORD
data
array DWORD
lower WORD
upper WORD
ArraySize $ Array TYPE lower
index DWORD
sum DWORD
disIndex BYTE "Qualified members:
disSum BYTE "Sum
code
main PROC
mov eax,
mov edx, lower
mov esi,
mov ecx, ArraySize
L: cmp ecx, edx
jl L
jmp L
L: cmp array esi
jg L
L: add eax, arrayesi
inc esi
jmp L
L: mov eax,
mov edx, upper
mov esi,
jl L
L: mov sum, eax
INVOKE ExitProcess,
main ENDP
END main
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
