Need help in assembly x86. Please be descriptive when showing results. Thank you
ID: 3811821 • Letter: N
Question
Need help in assembly x86. Please be descriptive when showing results. Thank you. 1. (5 points) Write an assembly program to find the largest element by searching an array int aryl (1, 5, -3, -4, 0, 6,11 -9,18) int index 0: int max arylo int arraysize size of array /sizeof max while (index arra ysize) if (arylindex max) max arylindexl Use cmp instruction and the appropriate jump instruction (signed or unsigned) to translate the if and while statements Use S operator (see chapter 3) to calculate the size of the array, and inc instruction to increment the index of the array Run your program using the debugger to verify your answers (do this too for questions 2 and 3) Submit the following: o Lastnamel asm 2. (5 points) Write an assembly program to implement the following while X> 0 if X!- 3 AND (XExplanation / Answer
To find the largest number
DATA SEGMENT
ARR DB 1,4,2,3,9,8,6,7,5,10 //data
LEN DW $-ARR //$ to find length
LARGE DB ? // to store large value
DATA ENDS
CODE SEGMENT
ASSUME DS:DATA CS:CODE
START:
MOV AX,DATA
MOV DS,AX
LEA SI,ARR
MOV AL,ARR[SI]
MOV LARGE,AL
MOV CX,LEN
REPEAT:
MOV AL,ARR[SI]
CMP LARGE,AL
JZ NOCHANGE
MOV LARGE,AL
NOCHANGE:
INC SI
LOOP REPEAT
MOV AH,4CH
INT 21H
CODE ENDS
END START
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.