org $1000
		lea msgIn,a1
		move.w sizeIn,d1
		move.b #1,d0
		trap #15
		
		clr.l d0
		move.w #0,d2
		lea iarray,a0
	input:	clr.l d1
		move.b #4,d0
		trap #15
		move.w d1,(a0)
		adda.l #2,a0
		addi.w #1,d2
		cmpi.w #10,d2
		blt input
		
		
		move.w #0,total	
		lea iarray,a0
		move.w #0,imax	
		move.w #0,imin	
		move.w #0,d2	
		move.w (a0),max
		move.w (a0),min
	loop:	move.w (a0),d0
		add.w d0,total
		bvs overflow
		cmp.w max,d0
		bgt maxpro
     resumeMax:	cmp.w min,d0
		blt minpro
     resumeMin:	adda.l #2,a0
		addi.w #1,d2
		cmpi.w #10,d2
		blt loop
		
		move.w total,d0
		divs #10,d0
		bvs overflow
		move.w d0,average
		
		lea msgMax,a1
		move.w sizeMax,d1
		move.b #1,d0
		trap #15
		move.w max,d1
		move.b #3,d0
		trap #15		
		lea msgidx,a1
		move.w sizeidx,d1
		move.b #1,d0
		trap #15
		move.w imax,d1
		move.b #3,d0
		trap #15
		move.l #0,a1
		move.b #0,d0
		trap #15
				
		lea msgMin,a1
		move.w sizeMin,d1
		move.b #1,d0
		trap #15
		move.w min,d1
		move.b #3,d0
		trap #15		
		lea msgidx,a1
		move.w sizeidx,d1
		move.b #1,d0
		trap #15
		move.w imin,d1
		move.b #3,d0
		trap #15
		move.l #0,a1
		move.b #0,d0
		trap #15
				
		lea msgAvr,a1
		move.w sizeAvr,d1
		move.b #1,d0
		trap #15
		move.w average,d1
		move.b #3,d0
		trap #15		
	ending:	move.l #0,a1
		move.b #0,d0
		trap #15
		stop #$2700
				
	maxpro: move.w d0,max
		move.w d2,imax
		bra resumeMax
	minpro: move.w d0,min
		move.w d2,imin
		bra resumeMin		

    overflow: 	lea msgOvr,a1
          	move.w sizeOvr,d1
          	move.b #1,d0
		trap #15
      		bra ending
	 
		
	 msgIn: dc.b 'Please input 10 integer numbers:'
        sizeIn: dc.w 32
        iarray: dcb.w 10,0
           max: ds.w 1
	  imax: ds.w 1
	   min: ds.w 1
	  imin: ds.w 1
	 total: ds.w 1
       average: ds.w 1
        msgMax: dc.b 'The largest number of this array is: '
       sizeMax: dc.w 37
        msgMin: dc.b 'The smallest number of this array is: '
       sizeMin: dc.w 38
        msgAvr: dc.b 'The average value of this array is: '
       sizeAvr: dc.w 36
        msgidx: dc.b '  index: '
       sizeidx: dc.w 9
        msgOvr: dc.b 'The calculation overflowed.'
       sizeOvr: dc.w 27
      		END $1000

    Source: geocities.com/wonlin/Assembly

               ( geocities.com/wonlin)