Question: PLEASE READ THE INSTRUCTION CAREFULLY AND TAKE A LOOK AT MY ANSWER AND FEEDBACK FROM THE PROFFESOR, I GOT 0 FOR IT AND NEED TO
PLEASE READ THE INSTRUCTION CAREFULLY AND TAKE A LOOK AT MY ANSWER AND FEEDBACK FROM THE PROFFESOR, I GOT FOR IT AND NEED TO FIX IT ASAP.
MUST BE IN MASMMICROSOFT MACRO ASSEMBLER
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
here is my answer:
INCLUDE Irvineinc
data
array DWORD
lower DWORD
upper DWORD
ArraySize DWORD
index DWORD
sum DWORD
qualifiedMembers DWORD
code
main PROC
; Calculate ArraySize
mov eax, SIZEOF array
mov ebx, SIZEOF lower
div ebx
mov ArraySize, eax
; Loop through the array
mov ecx, ArraySize
mov esi, OFFSET array
mov index,
mov sum,
mov qualifiedMembers,
loopstart:
cmp index, ecx
jge loopend
; Check if arrayindex qualifies for inclusion
mov eax, esi
index ; Load arrayindex into eax
cmp eax, lower
jl notqualified
cmp eax, upper
jg notqualified
; If qualified, add to sum and increment qualifiedMembers
add sum, eax
inc qualifiedMembers
notqualified:
inc index
jmp loopstart
loopend:
; Display results
mov edx, OFFSET qualifiedMembers
call WriteString
mov eax, qualifiedMembers
call WriteDec
call Crlf
mov edx, OFFSET sum
call WriteString
mov eax, sum
call WriteDec
call Crlf
exit
main ENDP
END main
FEEDBACK
This is an assembly language class. The directions tell you to replicate the algorithm using MASM.
the file you uploaded does not build please check your file
Severity Code Description Project File Line Suppression State
Error A syntax error : index Project C:UsershitcheDesktopProjectVSAddTwoasm
Error A missing right parenthesis in expression Project C:UsershitcheDesktopProjectVSAddTwoasm
Error MSB The command mlexe c nologo Sg Zi FoDebugAddTwoobj" FlProjectlstI c:IrvineWerrorReport:prompt TaAddTwoasm" exited with code Project C:Program FilesMicrosoft Visual StudioCommunityMSBuildMicrosoftVCvBuildCustomizationsmasmtargets
PLEASE FIX MY CODE AND SHOW ME THE SCREENSHOT OF OUTPUT
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
