Assembly language programming subroutine

In the score led access storage area in order to hold 5 grade 7 students, try making a subroutine for the average scores of every student, and will be 1 units stored in the scores. Write another subroutine and average scores for each course, and stores are stored in the ave_score led in. Main program subroutine call two.

data segment
score db 1,89,38,29,28,59,0
db 1,99,68,25,88,79,0
.
.
.
ave_score db 5 dup(0)
data ends

--------------------------------------------------------------------------------------------------

The above is the topic I write a but not debugging have a look you had to recruit didn't. . .

Started by Ellie at December 19, 2016 - 8:38 AM

I am also a beginner, trying to write a "try to produce a subroutine for each student's grade point average, and the 1 unit is stored in the scores." Don't think, another!
Do not know of how to write, I hope you have a look can also give me one or two!
stu_ave proc
push ax
mov ax,score
mov ds,ax
mov si,0
mov ax,0
s0:mov cx,7 ;The 7 line, circulation 7 times
push cx ;A protective outer cycle count CX
s:mov cx,5 ;The 5 course, circulation 5 times
mov dl,0
mov dl,[si]
add al,dl ;Add to Al, if carry into ah, inner loop end AX= total score
inc si ;Mov a, pointing to the next grade
loop s ;Internal circulation s
mov bl,5 ;The inner loop ends, the beginning of division
div bl ;Dividend in ax, in addition to finish al business, ah.
inc si ;Mov a, 0 unit to the row
mov [si],al ;Business give back, this result with a decimal point is not, can only think of it, put a business, ha ha
pop cx ;The outer loop count CX stack, began to count S0
inc si ;Si is incremented by one, to refer to the second line of the first unit
loop s0 ;External circulation gradually began to calculate the next row
pop ax ;Ax stack
ret

stu_ave endp ;End of subroutine

Posted by Kenny at January 02, 2017 - 8:47 AM

How to edit your reply?
Just a little wrong, MOV ax, 0 to write in the middle of S and S0

Posted by Kenny at January 07, 2017 - 9:38 AM

Can't edit it, was criticized for many years, I am still my old self.

Posted by Ronald at January 08, 2017 - 9:56 AM