微机原理汇编语言-对输入的一些成绩进行分类汇总

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

汇编语言程序成绩汇总对输入的一些成绩进行分类汇总。要求:(a)所有数字由键盘输入;(b)输入的成绩个数为任意个(小于100);(c)对成绩进行归类并输出显示在屏幕:·显示最高成绩、最低成绩、平均成绩·显示90-100分人数,80-89分人数,70-79分人数,60-69分人数,低于60分人数,·显示无效数字个数(非数字或大于100数字个数)datasegmentsaveDW100dup(0);输入数据的存放位置bufferdw0;暂时存放当前输入的数字ndb1;总共输入的数字个数highestdw0lowestdw0averagedw00to60dw060to70dw070to80dw080to90dw090to100dw0wrongdw0shuzi_wdb0shuzi_qdb0shuzi_bdb0shuzi_sdb0shuzi_gdb0;将排序好的数字显示出来,需要每一位转换成ASCII码stringdb'inputnumbers:',0dh,0ah,24hstring1db'output:',0dh,0ah,24hstring2db'highest:',0dh,0ah,24hstring3db'lowest:',0dh,0ah,24hstring4db'0~59:',0dh,0ah,24hstring5db'60~69:',0dh,0ah,24hstring6db'70~79:',0dh,0ah,24hstring7db'80~89:',0dh,0ah,24hstring8db'90~99:',0dh,0ah,24hstring9db'wrong:',0dh,0ah,24hstring10db'average:',0dh,0ah,24hkonggedb0dh,0ah,24hendsstacksegmentdw128dup(0)endscodesegmentstart:;setsegmentregisters:xorax,axpushaxmovax,datamovds,axmoves,axleadx,stringmovah,09hint21h;显示请输入数据;数据的输入movdi,offsetsavemovax,0movbuffer,axshurushuzi:movah,01hint21hcmpal,0dhjestopinputcmpal,'0'jbshurukonggecmpal,'9'jashurukongge;将输入的字符转为对应的数字subal,30h;ascll码转为相应的十进制数movah,0movbx,ax;buffer保存的为前一个数字,ax为当前输入的字符,buffer*10+ax即为输入的十进制数movdx,buffermovax,10muldxaddax,bxmovbuffer,axmov[di],ax;将转化好的数字放入储存空间jmpshurushuzi;输入大于10的数字的下一位;输入了空格,开始为输入下一个数字做准备shurukongge:callkonggexianshiadddi,2;指向下一个储存单元incnmovax,0movbuffer,ax;当前数字存入缓冲区等待处理jmpshurushuzistopinput:callkonggexianshi;数据处理部分;比较全部数据,找出最高成绩movcl,nmovch,0movbx,offsetsavemovax,[bx]lab1:cmpax,[bx]jalab2movax,[bx]lab2:incbxincbxlooplab1movhighest,ax;比较全部数据,找出最低成绩movcl,nxorch,chmovbx,offsetsavemovax,[bx]lab3:cmpax,[bx]jblab4movax,[bx]lab4:incbxincbxlooplab3movlowest,ax;求平均值movcl,nxorch,chmovbx,offsetsavemovax,0lab5:addax,[bx]adcAX,0incbxincbxlooplab5movbl,ndivblxorah,ahmovaverage,ax;各段人数统计movcl,nmovbx,offsetsaveL12:cmp[bx],0jbjw6cmp[bx],60jbjw1cmp[bx],70jbjw2cmp[bx],80jbjw3cmp[bx],90jbjw4cmp[bx],100jbjw5jajw6jw1:;xiaoyu60add0to60,1jmpjw7jw2:;add60to70,1jmpjw7jw3:;add70to80,1jmpjw7jw4:;add80to90,1jmpjw7jw5:;add90to100,1jmpjw7jw6:;addwrong,1jmpjw7jw7:incbxincbxloopL12;xianshichengxupushdxpushaxleadx,string1movah,09hint21hleadx,string2movah,09hint21hpopaxpopdxmovax,highestmovdx,0callshujuxianshicallkonggexianshipushdxpushaxleadx,string3movah,09hint21hpopaxpopdxmovax,lowestmovdx,0callshujuxianshicallkonggexianshipushdxpushaxleadx,string10movah,09hint21hpopaxpopdxmovax,averagemovdx,0callshujuxianshicallkonggexianshipushdxpushaxleadx,string4movah,09hint21hpopaxpopdxmovax,0to60movdx,0callshujuxianshicallkonggexianshipushdxpushaxleadx,string5movah,09hint21hpopaxpopdxmovax,60to70movdx,0callshujuxianshicallkonggexianshipushdxpushaxleadx,string6movah,09hint21hpopaxpopdxmovax,70to80movdx,0callshujuxianshicallkonggexianshipushdxpushaxleadx,string7movah,09hint21hpopaxpopdxmovax,80to90movdx,0callshujuxianshicallkonggexianshipushdxpushaxleadx,string8movah,09hint21hpopaxpopdxmovax,90to100movdx,0callshujuxianshicallkonggexianshipushdxpushaxleadx,string9movah,09hint21hpopaxpopdxmovax,wrongmovdx,0callshujuxianshicallkonggexianshi;;;;;;;;;;;;;;;;;;;;;;;;;;konggexianshiprocnearpushaxpushdxmovah,09movdx,offsetkonggeint21hpopdxpopaxretkonggexianshiendp;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;xianshidangeshuziprocnearpushdxpushaxmovdx,0movdl,alxorax,axmovah,02hint21hpopaxpopdxretxianshidangeshuziendp;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;shujuxianshiprocnearpushcxpushdsmovcx,10000divcxpushdx;保存余数movshuzi_w,alcmpshuzi_w,0jej1addal,30hcallxianshidangeshuzij1:popax;取余数movdx,0movcx,1000divcxpushdx;保存余数movshuzi_q,aladdshuzi_w,alcmpshuzi_w,0jej2addal,30hcallxianshidangeshuzij2:popax;取余数movdx,0movcx,100divcxpushdx;保存余数movshuzi_b,aladdshuzi_w,alcmpshuzi_w,0jej3addal,30hcallxianshidangeshuzij3:popax;取余数movdx,0movcx,10divcxpushdx;保存余数movshuzi_s,aladdshuzi_w,alcmpshuzi_w,0jej4addal,30hcallxianshidangeshuzij4:popdxadddl,30hmoval,dlcallxianshidangeshuzixorax,ax;chushuhuamovshuzi_w,almovshuzi_q,almovshuzi_b,almovshuzi_g,alpopdspopcxretshujuxianshiendpmovax,4c00h;exittooperatingsystem.int21hendsendstart;setentrypointandstoptheassembler.

1 / 11
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功