Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Help, this is ASM project: COSC 2 4 2 5 - Project 2 Implement the following C + + code fragment in assembly language. Use
Help, this is ASM project: COSC 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, and it's asking me to use irvine: data
array WORD
lower DWORD
uppwe DWORD
index DWORD
sum DWORD
ArraySize$array
indexMsg BYTE "Qualified Member:
sumMsg BYTE "Sum:
code
text
global main
extern printif
main
mov eax,
mov ebx, ArraySize
mov ecx, lower
mov edx, upper
loop
cmp eax, ebx
jge done
mov esi, array
mov edi, esieax
cmp edi, ecx
jl next
cmp edi, ecx
jl next
add sum, edi
next
inc eax
jmp loop
done
mov eax,
xor ebx, ebx
int x
bss
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started