汇编语言 设有一个数组存放学生的成绩(0100),编制一个子程序统计059分,60~69分, 70~79分, 8089分,90100分的人数,并分别存放到scoreE, scoreD, scoreC, scoreB, scoreA单元中,编写一~个主程序与之配合使用。
stack segment stackdw 512 dup(?)
stack ends
data segmentscore db 30,33,67,59,69,78,81,100,83,84,93count equ($-score)/type scorescoreA db 30hscoreB db 30hscoreC db 30hscoreD db 30hscoreE db 30h
data ends
code segment 'code'assume cs:code,ds:data,ss:stack
start: mov ax,datamov ds,axcall scoresmov bl,scoreAcall countsmov dl,20hmov ah,02hint 21hmov bl,scoreBcall countsmov dl,20hmov ah,02hint 21hmov bl,scoreCcall countsmov dl,20hmov ah,02hint 21hmov bl,scoreDcall countsmov dl,20hmov ah,02hint 21hmov bl,scoreEcall countsmov ax,4c00hint 21h
scores procxor si,simov cx,count
lop: cmp score[si],0jb lastcmp score[si],60jb secmp score[si],70jb sdcmp score[si],80jb sccmp score[si],90jb sbcmp score[si],101jb sajmp last
sa: inc scoreAjmp last
sb: inc scoreBjmp last
sc: inc scoreCjmp last
sd: inc scoreDjmp last
se: inc scoreElast: inc siloop lopret
scores endp
counts procmov bh,30hcmp bl,39hja s1mov dl,blmov ah,02hint 21hjmp there
s1: sub bl,0ahinc bhcmp bl,39hja s1mov dl,bhmov ah,02hint 21hmov dl,blmov ah,02hint 21h
there: ret
counts endp
code endsend start
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!