Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 0H
- .DATA
- A DB 4,9,2,5,6
- LEN DW $-A
- MSG DB "AVERAGE = $"
- MSG2 DB "SMALLEST = $"
- MSG3 DB "LARGEST = $"
- .CODE
- MAIN PROC
- MOV AX,@DATA
- MOV DS,AX
- CALL AVG
- CALL SMALLEST
- CALL LARGEST
- MAIN ENDP
- AVG PROC
- MOV SI,OFFSET A
- LEA DX,MSG
- MOV AH,9
- INT 21H
- MOV AX,00
- MOV BL,5
- MOV CX,5
- LOOP1:
- ADD AL,[SI]
- INC SI
- LOOP LOOP1
- DIV BL
- ADD AL,30H
- MOV DL,AL
- MOV AH,2
- INT 21H
- MOV DL,0DH
- INT 21H
- MOV DL,0AH
- INT 21H
- RET
- AVG ENDP
- SMALLEST PROC
- MOV SI,OFFSET A
- LEA DX,MSG2
- MOV AH,9
- INT 21H
- MOV BL,[SI]
- MOV AX,00
- MOV CX,LEN
- LOOP2:
- MOV AL,[SI]
- CMP BL,AL
- JL NOCNG
- MOV BL,AL
- NOCNG:
- INC SI
- LOOP LOOP2
- MOV AL, BL
- ADD AL,30H
- MOV DL,AL
- MOV AH,2
- INT 21H
- MOV DL,0DH
- INT 21H
- MOV DL,0AH
- INT 21H
- RET
- SMALLEST ENDP
- LARGEST PROC
- MOV SI,OFFSET A
- LEA DX,MSG3
- MOV AH,9
- INT 21H
- MOV BL,[SI]
- MOV AX,00
- MOV CX,LEN
- LOOP3:
- MOV AL,[SI]
- CMP BL,AL
- JG NOCN
- MOV BL,AL
- NOCN:
- INC SI
- LOOP LOOP3
- MOV AL, BL
- ADD AL,30H
- MOV DL,AL
- MOV AH,02H
- INT 21H
- LARGEST ENDP
- END MAIN
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement