汇编语言:编制程序实现如下操作: 设有10个学生的成绩分别是76,69,84,90,73,88,99,63,100和80分。

上机代码

dataseg segment

but   db 0DH,0AH,'the result   $'

grade dw 76,69,84,90,73,88,99,63,100,80

s6 db 0

s7 db 0

s8 db 0

s9 db 0

s10 db 0

dataseg ends

cseg segment

main proc far

assume cs:cseg,ds:dataseg

start:

push ds

sub ax,ax

push ax

mov ax,dataseg

mov ds,ax

mov cx,10

call count

call disp

mov ah,1

int 21h

ret

main endp

count proc near

mov si,0

next:mov ax,grade[si]

mov bl,10

div bl

mov bl,al

mov bh,0

sub bx,6

cmp bx,0

jae next1

next1:

inc s6[bx]

add si,2

loop next

ret

count endp

disp proc near

lea si,s6

mov cx,5

loop1:

mov   dx,OFFSET but

mov          ah,9

int            21h

mov dl,[si]

add dl,30h

mov ah,2

int 21h

inc si

loop loop1

ret

disp endp

 mov ah,4ch

    int 21h

cseg ends

end start

你可能感兴趣的:(汇编语言:编制程序实现如下操作: 设有10个学生的成绩分别是76,69,84,90,73,88,99,63,100和80分。)