Objective: Leam conditional processing and integer arithmetic: Comparison and ju
ID: 3740414 • Letter: O
Question
Objective: Leam conditional processing and integer arithmetic: Comparison and jump instructions, if and while statements. ements: (7 points) Write an assembly program to find the largest element by searching an array 1. int array[ ] = {10, 5,-1, 0, 12, 18, 11,-13, 40) int index-0; int max-array[0] int arraySize sizeof array sizeof max while (index ma) max = array[index]; index++ Use emp instruction and the appropriate jump instruction (signed or unsigned) to translate the if and -Use S operator (see chapter 3) to calculate the size of the array, and inc instruction to increment the while statements index of the array Run your program using the debugger to verify your anss rs (do this too for questions 2) Submit the following o Lastname1.asm 2. (8 points) Write an assembly program to implement the following while X >0 if X-4 AND (X> A ORX
Explanation / Answer
Please find the MASM code for part a below.
1.
CODE
========================
data segment
ARRAY DB 10, 05, -1, 0, 12, 18, 11, 13, 40
res db ?
data ends
code segment
assume cs:code, ds:data
start: mov ax, data
mov ds, ax
mov cx, 09h
mov bl, 79h
LEA SI, ARRAY
up:
mov al, [SI]
cmp al, bl
jge nxt
mov bl, al
nxt:
inc si
dec cx
jnz up
mov res,bl
int 3
code ends
end start
****NOTE: Due to lack of time, I could answer only part 1 (we get only 120 minutes to answer a question). Kindly raise one more post with the second question and I will help you to answer it.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.