内存中存储有10名学生的期末成绩,编写程序统计成绩小于80分的学生人数,并将统计结果输出到屏幕上(显示的内容为ASCII码,如6+30H就变成了36H就是6的ASCII码)
stack segment stack
db 256 dup(0)
stack ends
data segment
grade db 76,83,90,66,71,88,91,62,73,79
count = $-grade
result db ?
data ends
code segment
assume cs:code, ds:data, ss:stack
start:
mov ax,data
mov ds,ax
mov result,0
mov cx,count
xor si,si
next:
cmp grade[si],80
jnb @f
inc result
@@:
inc si
loop next
mov dl,result
or dl,'0'
mov ah,2
int 21h
mov ax,4c00h
int 21h
code ends
end start