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

Need help with assembly x86. Please show results and work. Thank you. i. (5 poin

ID: 3813310 • Letter: N

Question

Need help with assembly x86. Please show results and work. Thank you. i. (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 sizeof array /sizeof max while (index arraysize) if (arylindex max) max arylindexl Use c instruction and the appropriate jump instruction (signed or unsigned to translate the if and mp while statements Use s operator (see chapter 3) to calculate the size of the array, and inc instruction to increment the index of the amay Run your program using the debugger to verify your answers (do this too for questions 2 and 3)

Explanation / Answer

DATA SEGMENT

   ARY DB 1,5,-3,-4,0,6,11,-9,18
   LEN DW $-ARY
   MAX DB ?
DATA ENDS
CODE SEGMENT
   ASSUME DS:DATA CS:CODE
START:
   MOV AX,DATA
   MOV DS,AX

   LEA SI,ARY
   MOV AL,ARY[SI]
   MOV MAX,AL

   MOV CX,LEN

REPEAT:
   MOV AL,ARY[SI]
   CMP MAX,AL
   JG NOCHANGE
   MOV MAX,AL

NOCHANGE:
   INC SI
   LOOP REPEAT

CODE ENDS
END START

Output after execution:

ARY   1,5,-3,-4,0,6,11,-9,18

LEN    9

MAX   18