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

write the asm code fragment that performs the indicated task or function. write

ID: 3579912 • Letter: W

Question

write the asm code fragment that performs the indicated task or function. write a procedure that, given a list of integers returns the minimum, maximum, and the avergae of the maximum and minimum of the numbers on the list. the procedure receives pointers to the list, the MinVal, MaxVal and avg. write the asm code fragment that performs the indicated task or function. write a procedure that, given a list of integers returns the minimum, maximum, and the avergae of the maximum and minimum of the numbers on the list. the procedure receives pointers to the list, the MinVal, MaxVal and avg. write the asm code fragment that performs the indicated task or function. write a procedure that, given a list of integers returns the minimum, maximum, and the avergae of the maximum and minimum of the numbers on the list. the procedure receives pointers to the list, the MinVal, MaxVal and avg.

Explanation / Answer

data segment
LIST DB 05H, 30H, 34H, 40H, 38H, 37H
SIZE=$-OFFSET LIST
MINIMUM DB ?
MAXIMUM DB ?
AVARAGE DB ?
ends

stack segment   

DW 128 DUP(0)

ends

code segment
start proc far

; set the segment registers:

MOV AX,DATA
MOV DS, AX
MOV ES,AX

  
MOV CX,SIZE
LEA SI,LIST

;find minimum value in the LIST & store it into the MINIMUM

;begin loop
MIN:

LEA DI,MINIMUM
MOV AL,[SI]
CMP AL,[SI+1]
ADD SI, 1

LOOP MIN
  

MOV CX, SIZE   
LEA SI, LIST

;find maximum value in the LIST & store it into the MAXIMUM
  

MAX:

LEA DI,MAXIMUM   
MOV AL,[SI]
CMP AL,[SI-1] ;???
ADD SI, 1


LOOP MAX

MOV CX, SIZE
LEA SI, LIST

;find average value in the LIST & store it into the AVERAGE

AVG:

LEA DI, AVARAGE
ADD AX, [SI]
ADD SI, 1
LOOP AVG
MOV BX, SIZE
DIV BX

; exit to the operating system.

MOV AX,4C00H
INT 21H

start endp

ends

end start ; set entry point & stop assembler.

ret

   /////*** Thank You ***/////