Your task is to write assembly code to initialize an array o

Your task is to write assembly code to initialize an array of 10 numbers. Then calculate mean, minimum and maximum of those numbers. Based on the calculated mean, you will have to implement an up or down counter. For example, if \'mean\' is close to \'minimum\', implemented counter will count downwards and if mean is close to the \'maximum\' of the array of numbers, implemented counter will count upwards. The initial value of the counter should be same as the calculated \'mean\' of the array. The counter should count to cither maximum or minimum of the array (depending on if it\'s an up or down counter).then reset to the \'mean\' and repeat. The counter values (while it is counting) should be displayed on the Seven Segment Display units and the 8-bit bar LED unit available on the Dragon EVB. There should be a constant delay of 1.5 seconds between each update of counter value.

Solution

.MODEL SMALL

.STACK 100H

.DATA

PROMPT DB \'THE ARRAY ELEMENTS ARE : $ \'

ARRAY DB 10 DUP(0)

.CODE

   MAIN PROC

   MOV AX, @DATA

   MOV DS, AX

   LEA DX, PROMPT

   MOV AH, 9

   INT 21H

   MOV CX, 10

   LEA SI, ARRAY

   @SHOW :

   XOR AH, AH

   MOV AL, [SI]

   CALL OUTDEC

   MOV AH, 2

MOV DL, 20H

   INT 21H

   INC SI

   LOOP @SHOW

   MOV AH, 4CH

   INT 21H

MAIN ENDP

DATA SEGMENT

   ARR DB 1,2,3,4,5,6,7,8,9,10

   LEN DW $-ARR

   LARGE 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,AL

   MOV CX, LEN

REPEAT :

   MOV AL, ARR[SI]

   CMP LARGE, AL

   JG NOCHANGE

NOCHANGE :

   INC SI

   LOOP REPEAT

   MOV AH, 4CH

   INT 21H

CODE ENDS

END START

 Your task is to write assembly code to initialize an array of 10 numbers. Then calculate mean, minimum and maximum of those numbers. Based on the calculated me
 Your task is to write assembly code to initialize an array of 10 numbers. Then calculate mean, minimum and maximum of those numbers. Based on the calculated me

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site