Question

Please provide x86 (MASM not NASM) .386 (32bit) assembly program for the following (needs to be compatible with Visual Studio 2015.asm file):

(10 points) Write an assembly program to find the largest element by searching an array int aryll-[11, 15,-3,-4, 0,60.11,-9,18) int index-l; int max- 0; int arraySize-sizeof array /sizeof max while (index < arraySize) if (ary[index] > max) max = ary[index]; - 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) Maximum value should be in max variable at the end. -Submit the following: o Lastname1.asm

0 0
Add a comment Improve this question Transcribed image text
Answer #1

X86 program :-


DATA SEGMENT

ARR DB 10,20,30,90,17,29,32,5
LEN DW $-ARR
LARGE_NUM DB ?
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_NUM,AL
MOV CX,LEN

WHILE_LOOP:
MOV AL,ARR[SI]
CMP LARGE_NUM,AL
JG SKIP
MOV LARGE_NUM,AL
SKIP:
INC SI
LOOP WHILE_LOOP

MOV AH,4CH
INT 21H

CODE ENDS
END START

Add a comment
Know the answer?
Add Answer to:
Please provide x86 (MASM not NASM) .386 (32bit) assembly program for the following (needs to be...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT