版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
1、實(shí)驗(yàn)一Fibonacci數(shù)列實(shí)現(xiàn)實(shí)驗(yàn)?zāi)康募皟?nèi)容1、實(shí)驗(yàn)?zāi)康倪M(jìn)一步掌握子程序的設(shè)計(jì)方法,熟悉遞歸程序的設(shè)計(jì)2、實(shí)驗(yàn)要求掌握遞歸程序的調(diào)用、返回及入口、出口參數(shù)的傳遞方法。3、實(shí)驗(yàn)內(nèi)容程序接收由用戶鍵入的數(shù)N,根據(jù)給定的N值,計(jì)算Fibonacci數(shù)。Fibonacci數(shù)的定義如下:FIB(1)=1FIB(2)=1一. FIB(N)=FIB(N-2)+FIB(N-1)N>=3實(shí)驗(yàn)環(huán)境二. MasmForWindows集成實(shí)驗(yàn)環(huán)境共享版編寫編譯程序?qū)嶒?yàn)方法程序接收用戶輸大于20小于30的十進(jìn)制正整數(shù),存入輸入緩沖區(qū)后再把它轉(zhuǎn)化為十六進(jìn)制數(shù),存入內(nèi)存單元N中。調(diào)用FIB函數(shù)求Fibonacci數(shù)
2、,結(jié)果高位存在RESULT2H低位存在RESULT2L最后調(diào)用OUTPUT!數(shù)將結(jié)果以十進(jìn)制的形式顯示出來。程序亮點(diǎn)在于將結(jié)果轉(zhuǎn)換為十進(jìn)制時(shí)采用了除10取余的方法,對于高位通過在適當(dāng)?shù)奈粩?shù)加65536(ADD65536)的方式巧妙地將乘法轉(zhuǎn)化為加法。實(shí)驗(yàn)步驟1. 顯示提示,并接受一個(gè)數(shù)字N;2. 調(diào)用fib遞歸得到結(jié)果存入內(nèi)存;三. 調(diào)用顯示10進(jìn)制函數(shù)OUTPUT實(shí)驗(yàn)結(jié)論輸入數(shù)據(jù)25(十進(jìn)制)輸出數(shù)據(jù)75025(10進(jìn)制)空C;TIin)OYSsyste*32coKAaiLd.vcokpleaseinputnunber<20-30N-2SpiB<N;=75025Pt*essany
3、keyt«e=xi-tB«輸入19與31,驗(yàn)證邊界滿足,如下圖:BMC:YIHD0VS.syst*32couajid.cobPleaseinputanu.nbex-C2030=H=19Hnunherbetween20and30please!Fleaseinputanunbei*<20-30>:H-31Anumberhetueen20and30please*Pleaseinputanunbep<2030>:H=_實(shí)驗(yàn)分析本實(shí)驗(yàn)使我進(jìn)一步掌握子程序的設(shè)計(jì)方法,熟悉遞歸程序的設(shè)計(jì),豐富了我寫匯編程序的經(jīng)驗(yàn)。實(shí)驗(yàn)二窗口顏色改變實(shí)驗(yàn)一、實(shí)驗(yàn)?zāi)康木帉懗绦?,在屏?/p>
4、上設(shè)置任意兩個(gè)數(shù)值,以此為對角線坐標(biāo)點(diǎn)開設(shè)窗口,設(shè)定熱鍵控制窗口的顏色,使屏幕顏色有淺至深。二、實(shí)驗(yàn)要求要求用匯編實(shí)現(xiàn),并使用熱鍵控制顏色改變。三、實(shí)驗(yàn)環(huán)境MasmForWindows集成實(shí)驗(yàn)環(huán)境共享版編寫編譯程序四、實(shí)驗(yàn)步驟輸入兩個(gè)坐標(biāo),作為對角線坐標(biāo),建立窗口用熱鍵控制顏色,看顏色變化。五、實(shí)驗(yàn)結(jié)論輸入坐標(biāo):top_left為50,50,;bottom_right為100,100實(shí)驗(yàn)三學(xué)生信息管理系統(tǒng)一、實(shí)驗(yàn)?zāi)康睦脜R編語言編寫學(xué)生信息管理系統(tǒng)二、實(shí)驗(yàn)要求熟悉匯編語言編程,編寫學(xué)生信息系統(tǒng)三、實(shí)驗(yàn)內(nèi)容建立學(xué)生成績信息庫,包括學(xué)號、成績、名次,從鍵盤輸入學(xué)號,實(shí)現(xiàn)成績、名次等信息的查詢:學(xué)號
5、姓名成績名次01cjh80102np993四、實(shí)驗(yàn)環(huán)境MasmForWindows集成實(shí)驗(yàn)環(huán)境共享版編寫編譯程序五、實(shí)驗(yàn)結(jié)論MyStudenl;lina.grenent;temiCi>lia-t<1><s>quHTheclioidCsCldAaihlAdinJdfAH!WJrihTdUd'WriUf*WriVflW#UdW偵WdUCVriU'-ffW列出所有學(xué)生信息,輸入lKC:SYsystID:61NANE;GjhSCORE:80BANK;IB:G2NAtlE:npSCORE:99RANK:IB:63NAIIE;JjbSCORE:6。RANK:e
6、nter"f"toreturn查詢記錄,輸入s,并且輸入ID號查詢and.cqbPleaseinputID:02ID:班NAME:npSCORE二99EflNK:2Pleaseenter'*r'*toreturn,"c',tocontinue插入記錄,輸入i混C:fTNDOTSsysteB32couand«cob._-;、匚HITDOTSAsvTtID:04ID;04NAME:xsflNAHE:xglSCORE:9RSCORE:9iRAHX=4RANK;4Pieaseenter"p"toreturn,pcMto
7、centinue實(shí)驗(yàn)四虛擬實(shí)驗(yàn)平臺模型機(jī)實(shí)驗(yàn)1. 實(shí)驗(yàn)?zāi)康?)掌握模型機(jī)的基本原理和結(jié)構(gòu)2)掌握機(jī)器指令與微程序的對應(yīng)關(guān)系;2. 3)掌握機(jī)器指令的執(zhí)行流程;實(shí)驗(yàn)設(shè)備74LS181芯片兩片,memory6116一片,微程序控制存儲器芯片一片,編譯器芯片一片,八位同步計(jì)數(shù)器芯片一片,ALU_G芯片一片,PC_G芯片一片,74LS273芯片若干,輸入,輸出芯片各一片,選擇器芯片若干,連接器芯片若干,燈泡若干,開關(guān)若干等。實(shí)驗(yàn)原理些部件的動(dòng)作控制信號都有微控器根據(jù)微指令產(chǎn)生。需要特別說明的是由機(jī)器指令構(gòu)成的程序存放在存儲器中,而每條機(jī)器指令對應(yīng)的微程序存儲在微控器中的存儲器中。模型機(jī)詳細(xì)原理見附件。
8、3. 實(shí)驗(yàn)內(nèi)容1)選擇實(shí)驗(yàn)設(shè)備,將所需要的組件從組件列表中拖到實(shí)驗(yàn)設(shè)計(jì)流程欄中2)搭建實(shí)驗(yàn)流程:根據(jù)原理圖1和電路圖(見附件),將已選擇的組件進(jìn)行連線。3)輸入機(jī)器指令:選擇菜單中的“工具”,再選擇“模型機(jī)調(diào)試”,在指令輸入窗口中輸入如下指令:本實(shí)驗(yàn)設(shè)計(jì)機(jī)器指令程序如下:地址(二進(jìn)制)內(nèi)容(二進(jìn)制)助記符說明00000000P00000000INR0“INPUTDEVICE,->R00000000100010000ADD0AH,R0R0+0AH->R000000010r000010100000001100100000STAR0,0BHR0->0BH00000100000010
9、110000010100110000OUT0BH0BH->LED00000110000010110000011101000000JMP00H00H->PC000010000000000000001010運(yùn)算數(shù)據(jù)自定00001011求和結(jié)果4)這里做的是個(gè)加法運(yùn)算,第一個(gè)加數(shù)已經(jīng)存入到內(nèi)存的00001010單元中,第二個(gè)加數(shù)是需要手工輸入的。在實(shí)驗(yàn)運(yùn)行面板中點(diǎn)擊“運(yùn)行”按鈕,選擇“輸入”芯片,設(shè)置輸入的數(shù)據(jù)后,雙擊連接“輸入”芯片的單脈沖,這樣第二個(gè)加數(shù)就設(shè)置好了。5)在實(shí)驗(yàn)運(yùn)行面板中雙擊連續(xù)脈沖,模型機(jī)便開始工作,觀察各個(gè)芯片的狀態(tài)。或者在模型機(jī)調(diào)試窗口中(如圖2所示)點(diǎn)擊“指令執(zhí)
10、行”選項(xiàng)卡,在模型機(jī)調(diào)試窗口中點(diǎn)擊“下一時(shí)鐘”,模型機(jī)機(jī)執(zhí)行到下一個(gè)時(shí)鐘,點(diǎn)擊“下一微指令”,模型機(jī)機(jī)執(zhí)行到下一個(gè)微指令,點(diǎn)擊“下一指令”,模型機(jī)機(jī)執(zhí)行到下一條指令。觀察各個(gè)芯片的狀態(tài),思考模型機(jī)的運(yùn)行原理。5:實(shí)驗(yàn)調(diào)試在指令輸入框中輸入指令,點(diǎn)擊輸入按鈕,然后執(zhí)行指令,點(diǎn)擊下一時(shí)鐘,下一微指令HIE屈機(jī)做U11T'71Al,IIIOUTMiBn|?1TLEDCTTa?r*IH:Cw?HC»nr«ikTHDK1=JDItEELOO|pg。1日fc圖2模型機(jī)調(diào)試窗口實(shí)驗(yàn)心得:通過這次匯編組成原理課程設(shè)計(jì),更加深入的了解了匯編指令的執(zhí)行過程,更加透徹得明確了計(jì)算機(jī)執(zhí)行指
11、令的過程,特別是虛擬平臺的模型及實(shí)驗(yàn),讓我知道計(jì)算機(jī)執(zhí)行指令時(shí)的具體過程。對于計(jì)算機(jī)的底層運(yùn)算不在陌生。源碼附錄1:Fibonacci數(shù)DATASSEGMENTSTR1DB'Pleaseinputanumber(20-30):N=','$'STR2DB13,10,'FIB(N)=','$'WRONGSTRDB13,10,13,10,'Anumberbetween20and30please!',13,10,13,10,'$'INPUTBUFFERDB3,?,3DUP(?)NDW?;輸入N值RESULT
12、1HDW0RESULT1LDW0RESULT2HDW0;結(jié)果的高16位RESULT2LDW0;結(jié)果的低16位C10DW10OUTPUTBUFFERDB11DUP('0')DATASENDSCODESSEGMENTASSUMECS:CODES,DS:DATASSTART:MOVAX,DATASMOVDS,AXCALLINPUTCALLFIBCALLOUTPUTJMPQUIT;INPUTPROCJMPT1WRONG:LEADX,WRONGSTRMOVAH,9INT21HT1:LEADX,STR1MOVAH,9INT21HLEADX,INPUTBUFFERMOVAH,10INT21H
13、MOVAX,0MOVCL,INPUTBUFFER+1MOVCH,0LEABX,INPUTBUFFER+2T2:MULC10MOVDL,BXCMPDL,'0'JBWRONGCMPDL,'9'JAWRONGANDDL,0FHADDAL,DLADCAH,0INCBXLOOPT2CMPAX,001EHJAWRONGCMPAX,0014HJBWRONGMOVN,AXRETINPUTENDP;*FIBPROCCMPN,1JZL1CMPN,2JZL2DECNCALLFIBMOVAX,RESULT2LMOVDX,RESULT2HMOVCX,RESULT1LADDRESULT2L
14、,CXMOVCX,RESULT1HADCRESULT2H,CXMOVRESULT1L,AXMOVRESULT1H,DXJMPEXITL1:MOVRESULT1L,1MOVRESULT2L,1JMPEXITL2:MOVRESULT2L,1DECNCALLFIBEXIT:RETFIBENDP.*OUTPUTPROCMOVAX,RESULT2LLEASI,OUTPUTBUFFERMOVCX,5R1:MOVDX,0;低位力口AOUTPUTBUFFERDIVC10INCSIADDSI,DLLOOPR1;MOVAX,RESULT2HLEASI,OUTPUTBUFFERMOVCX,5R2:MOVDX,0DI
15、VC10INCSIPUSHCX;高位力口入OUTPUTBUFFERCMPDX,0JENOADDMOVCX,DXADDN:CALLADD65536LOOPADDNNOADD:POPCXLOOPR2;LEADX,STR2MOVAH,9INT21HLEASI,OUTPUTBUFFERMOVBX,10R3:CMPBYTEPTRSI+BX,'0'JAPRINTDECBX;顯示十進(jìn)制結(jié)果JMPR3PRINT:MOVDL,SI+BXMOVAH,2INT21HDECBXCMPBX,1JAEPRINTRETOUTPUTENDP;ADD65536PROC;高位算法ADDBYTEPTRSI,6MOV
16、DL,0CMPBYTEPTRSI,3AHJBA1SUBBYTEPTRSI,10MOVDL,1A1:ADDBYTEPTRSI+1,3ADDBYTEPTRSI+1,DLMOVDL,0CMPBYTEPTRSI+1,3AHJBA2SUBBYTEPTRSI+1,10MOVDL,1A2:ADDBYTEPTRSI+2,5ADDBYTEPTRSI+2,DLMOVDL,0CMPBYTEPTRSI+2,3AHJBA3SUBBYTEPTRSI+2,10MOVDL,1A3:ADDBYTEPTRSI+3,5ADDBYTEPTRSI+3,DLMOVDL,0CMPBYTEPTRSI+3,3AHJBA4SUBBYTEPTRS
17、I+3,10MOVDL,1A4:ADDBYTEPTRSI+4,6ADDBYTEPTRSI+4,DLMOVDL,0CMPBYTEPTRSI+4,3AHJBA0SUBBYTEPTRSI+4,10MOVDL,1A5:ADDBYTEPTRSI+5,DLMOVDL,0CMPBYTEPTRSI+5,3AHJBA0SUBBYTEPTRSI+5,10MOVDL,1A6:ADDBYTEPTRSI+6,DLMOVDL,0CMPBYTEPTRSI+6,3AHJBA0SUBBYTEPTRSI+6,10MOVDL,1A7:ADDBYTEPTRSI+7,DLMOVDL,0CMPBYTEPTRSI+7,3AHJBA0SUB
18、BYTEPTRSI+7,10MOVDL,1A8:ADDBYTEPTRSI+8,DLMOVDL,0CMPBYTEPTRSI+8,3AHJBA0SUBBYTEPTRSI+8,10MOVDL,1A9:ADDBYTEPTRSI+9,DLA0:RETADD65536ENDP.*;QUIT:MOVAH,4CHINT21HCODESENDSENDSTART2:顏色改變.*.MACRODEFINE.clearscreencl_scrnmacrotlr,tlc,brr,brcmovah,6moval,0movbh,7movch,tlrmovcl,tlcmovdh,brrmovdl,brcint10hendm.o
19、utputprintfmacromsg_addrleadx,msg_addrmovah,9int21hendm.crlfmacromovdl,0dhmovah,2int21h.movdl,0ahmovah,2int21hendm.modelsmall.stack.datatlrdw?.top_leftrowtlcdw?.top_leftcolumnbrrdw?.bottom_rightrowbrcdw?.bottom_rightcolumncolordb0fh-rowppdw?biggerdw?countdw8pattern1db00000001bpattern2db00010001bpatt
20、ern3db00100101bpattern4db01010101bpattern5db11011010bpattern6db11101110bpattern?db11111110bpatternsdb11111111bmsgdb'*PRESSESCTOENDTHEPROGRAM*',13,10,'$'msg1db'Inputtop_leftposition(row:0479,column:0639):row,column',13,10,'$'msg2db'Inputbottom_rightposition(row:047
21、9,column:0639):row,column',13,10,'$'msg3db'InputError!Again.',13,10,'$'flagdb0ffh.*,.code.mainprocfarstart:movax,datamovds,ax.MAINPARTGOESHEREagain:callget_pos.getwindow'spositionfromkbdtestflag,0f0hjzexitcalldisplay.displaythewindowjmpagainexit:movax,4c00hint21hmaine
22、ndp.get_posprocnear.seEGA/VGAmovah,00hmoval,02hint10h.clearscreencl_scrn0,0,24,79printfmsginput:printfmsg1leasi,tlrcallget_numtestflag,0f0hjzget_pos_exittestflag,0fhjzerrorcrlfprintfmsg2leasi,brrcallget_numtestflag,0f0hjzget_pos_exittestflag,0fhjzerrorget_pos_exit:reterror:cl_scrn1,0,24,79movbh,0mov
23、dh,1movdl,0movah,2int10hprintfmsg3orflag,0fhjmpinputget_posendp;get_numprocnearcalldecibincmpdl,','jzstore_firstcmpdl,1bhjzst_endcmpdl,0jnzget_num_errormovah,7int21hjmpget_num_errorstore_first:cmpbx,479jaget_num_errormovsi,bxcalldecibincmpdl,0dhjzstore_secondcmpdl,1bhjzst_endcmpdl,0jnzget_nu
24、m_errormovah,7int21hjmpget_num_errorst_end:andflag,0fhjmpget_num_exitget_num_error:andflag,0f0hjmpget_num_exitstore_second:cmpbx,639jaget_num_errormovsi+2,bxget_num_exit:retget_numendp;decibinprocnear;storethenumberfromkbdinBXmovbx,0get_char:movah,1int21hmovdl,alsubal,30hjldecibin_exitcmpal,9jgdecib
25、in_exitcbwxchgax,bxmovcx,10mulcxaddbx,axjmpget_chardecibin_exit:retdecibinendp;displayprocnear;displaythewindowpushsi;setEGA/VGAmovah,0moval,13hint10h;movax,brrsubax,tlrincaxmovdx,0movcx,8divcxmovrowpp,axmovbigger,dx;repaint:movsi,8leadi,pattern1movbh,0movah,0chmoval,colormovdx,tlrcmpdx,brrjaxchg_rm
26、ovcx,tlccmpcx,brcjaxchg_cjmpwrite_partxchg_r:xchgdx,brrmovtlc,dxjmpwrite_partxchg_c:xchgcx,brcmovtlc,cxwrite_part:movbl,dipushrowppcmpsi,biggerjawrite_rowincrowppwrite_row:cmprowpp,0jzrow_endpushbxnext_p:rolbl,1;jncdont_write;int10h-;jmpwrite_enddont_write:;addal,8int10h;subal,8write_end:inccxcmpcx,
27、brcjbenext_p;popbxrolbl,1rolbl,1movcx,tlcincdxdecrowppjmpwrite_rowrow_end:incdipoprowppdecsijnzwrite_part;changecolorget_key:movah,0int16hcmpah,1jzdisplay_exitcmpah,48hjzinc_colorcmpah,4dhjzinc_colorcmpah,50hjzdec_colorcmpah,4bhjzdec_colorsubah,2jlget_keycmpah,7jgget_keymovcolor,ahjmprepaintinc_colo
28、r:inccolor;andcolor,07hjmprepaintdec_color:deccolorandcolor,07hjmprepaintdisplay_exit:popsiretdisplayendp;endstart3:學(xué)生管理系統(tǒng)DATASEGMENTTIPS3DB'PleaseinputID:$'查詢提示信息TIPS4DB'Pleaseenter"r"toreturn$'TIPS5DB'Pleaseenter"r"toreturn,"c"tocontinue$'IDDB&
29、#39;ID:$'NAMDB'NAME:$'SEXDB'SEX:$'SCOREDB'SCORE:$'RANKDB'RANK:$'FIDDW?;文件號SEXMDB'male$'SEXFDB'female$'mess0DB'*',0ah,0dh,'$'mess1DB'*',0ah,0dh,'$'mess2DB'*WelcomeToUseThisStudentManagementSystem*',0ah,0dh,
30、9;$'mess3DB'*insert(i)*',0ah,0dh,'$'mess4DB'*list(l)*',0ah,0dh,'$'mess5DB'*search(s)*',0ah,0dh,'$'mess6DB'*quit(q)*',0ah,0dh,'$'mess7DB'*Pleasechose(i/l/s/q):*',0ah,0dh,'$'mess8DB'*',0ah,0dh,'$'mess9D
31、B'*PoweredByLinx*',0ah,0dh,'$'mess10DB'*',0ah,0dh,'$'ID_LENGTHEQU4;配置信息NAM_LENGTHEQU10SCORE_LENGTHEQU5RANK_LENGTHEQU5STU_LENGTHDW?;每條學(xué)生信息總長度DELDB30DUP('');清空信息用DEL_DONEDB'Deletesuccess!$'ERRDB'Dataerror,Pleaseinputagain成;錯(cuò)誤提示信息NOSTUDB'Sorry,the
32、reisnothisstudnet!$'ERR_NODB'Nostudentinformation!$'ERR_SAMEDB'ThereisthesameID,pleaseinputagain成NEWFDB0DH,0AH,0DH,0AH,'Warning:thisoperationwillemptyallyourdata!',0DH,0AH,0DH,0AH,'Willyoucontinue?(y:empty,otherkey:return):$'FPATHDB'c:recoder.txt',。;數(shù)據(jù)庫文本STRDB
33、50;緩沖區(qū)strDB?DB50DUP(?)STR0DB50DUP(?);緩沖區(qū)str0ENTERDB'$'TMPDW0SCDB0;空格;是否為空標(biāo)志信息;分?jǐn)?shù)保護(hù)處用BYEDB'ThanksForUsingAgain!',0DH,0AH,0DH,0AH,'Bye$'DATAENDSSET_P1MACROMOVAH,02HMOVDH,02MOVDL,03MOVBH,0INT10HENDMSET_P3MACROMOVAH,02HMOVDH,10MOVDL,50MOVBH,0INT10HENDM;設(shè)定光標(biāo)位置A;設(shè)定光標(biāo)的位置B;當(dāng)前這頁TABMAC
34、ROMOVAH,2MOVDL,0DHINT21HMOVDL,0AHINT21HENDM;換行CREATEFMACROMOVAH,3CHMOVCX,00HLEADX,INT21HMOVENDM;創(chuàng)建文件(傳入文件號、傳入文件路徑);普通文件OPENFMACRO;打開文件(傳入文件號、傳入文件路徑)MOVAL,2;讀寫文式打開MOVAH,3DHLEADX,INT21HMOVENDMCLOSEFMACROMOVBX,MOVAH,3EHINT21HENDM;關(guān)閉文件(傳入文件號)READFMACROMOVBX,LEADX,TEMPMOVAX,NUMMOVCX,AXMOVAH,3FHINT21H;讀文件
35、(傳入文件號、傳入緩沖區(qū)、傳入字節(jié)數(shù))ENDMWRITEFMACRO;寫文件(傳入文件號、傳入緩沖區(qū)、傳入字節(jié)數(shù))MOVBX,MOVCX,NUMLEADX,TEMP2MOVAH,40HINT21HENDMMOVEFMACRO;移動(dòng)文件指針(傳入文件號、傳入移動(dòng)方式、傳入偏移字節(jié)(高位)傳入偏移字節(jié)(低位)MOVBX,MOVAH,42HMOVAL,STYPE;尾+1!移量方式MOVCX,HIGEC;偏移字節(jié)(高位)MOVDX,LOWD;偏移字節(jié)(低位)INT21HENDMINPUTMACROBUFFER,LENGTH;輸入字符串(傳入字符串名、返回字符串長度)MOVAH,10LEADX,BUFF
36、ERINT21HMOVLENGTH,BUFFER1ENDMSHOWMACROBUFFER;顯示字符串(傳入字符串名)MOVAH,9LEADX,BUFFERINT21HENDMSTAKSEGMENTSTACKDB200DUP(?)STAKENDSJ;代碼段,=CODESEGMENTASSUMECS:CODE,DS:DATASHOW_EXITPROCNEAR;提示按r退出PUSHAXPUSHBXPUSHCXPUSHDXTABTABSHOWTIPS4EXIT_1:MOVAH,7INT21HCMPAL,'r'JNZEXIT_1POPDXPOPCXPOPBXPOPAXRETSHOW_EX
37、ITENDPSHOW_ECPROCNEARPUSHAXPUSHBXPUSHCXPUSHDXTABTABSHOWTIPS5EXIT_2:MOVAH,7INT21HCMPAL,'r'JZEXIT_4CMPAL,'c'JNZEXIT_2CALLINSERTEXIT_4:POPDXPOPCXPOPBXPOPAXRETSHOW_ECENDP;詢問退出還是繼續(xù)SHOW_ERRPROCNEARPUSHAXPUSHBXPUSHCXPUSHDXTABTABSHOWERRTABTABPOPDXPOPCXPOPBXPOPAXRETSHOW_ERRENDP;顯示出錯(cuò)信息子程序RE_TM
38、PPROCNEARPUSHAXPUSHBXPUSHCXPUSHDXMOVCX,50MOVBX,1RE:INCBXMOVSTRBX,''LOOPREPOPDXPOPCXPOPBXPOPAXRETRE_TMPENDP;用空格初始化緩沖區(qū)子程序CLEARPROCNEARPUSHAXPUSHBXPUSHCXPUSHDXMOVAL,0MOVCL,0;清屏;上滾行數(shù);上滾窗口左上角的列號為MOVCH,0;上滾窗口左上角的行號為0MOVDH,24;上滾窗口右上角的行號為24MOVDL,79;上滾窗口右上角的列號為79MOVBH,14;空白行的屬性MOVAH,6;入口參數(shù)INT10HSET_P
39、1POPDXPOPCXPOPBXPOPAXRETCLEARENDPSHOW_STUPROCNEAR;顯示學(xué)生信息子程序PUSHAXPUSHBXPUSHCXPUSHDXSHOWID;IDMOVCX,ID_LENGTHMOVBX,-1SH_ID:INCBXMOVDL,STR0BXMOVAH,2INT21HLOOPSH_IDSHOWENTERSHOWNAM;NAMEMOVCX,NAM_LENGTH;MOVBX,ID_LENGTH;DECBXSH_NAME:INCBXMOVDL,STR0BXMOVAH,2INT21HLOOPSH_NAMENN:SHOWENTERSHOWSCORE;SCOREMOVCX
40、,SCORE_LENGTH;MOVBX,ID_LENGTH;ADDBX,NAM_LENGTHSH_SCORE:INCBXMOVDL,STR0BXMOVAH,2INT21HLOOPSH_SCORENN1:SHOWENTERSHOWRANK;RANKMOVCX,RANK_LENGTH;MOVBX,ID_LENGTH;ADDBX,NAM_LENGTH;ADDBX,SCORE_LENGTHSH_RANK:INCBXMOVDL,STR0BXMOVAH,2INT21HLOOPSH_RANKPOPDXPOPCXPOPBXPOPAXRETSHOW_STUENDP;=以下插入(insert)子程序=INSERT
41、PROCNEARPUSHAXPUSHBXPUSHCXPUSHDXTABCALLCLEAR;清屏TABTABOPENFFID,FPATH;打開文件IN_ID:SHOWID;學(xué)號INPUTSTR,BL;向緩沖區(qū)輸入IDCMPBL,ID_LENGTH;看ID是否合法JZL1JNZERR_IDERR_SA:;錯(cuò)誤處理TABTABSHOWERR_SAMETABTABJMPIN_IDERR_ID:TABTABCALLSHOW_ERRTABTABJMPIN_IDL1:;ID判斷只能為數(shù)字MOVCX,ID_LENGTHLEASI,STR+2LN:MOVAL,BYTEPTRSICMPAL,'0'
42、JBERR_IDCMPAL,'9'JAERR_IDINCSILOOPLNMOVEFFID,0,0,0;指針移到文件首IA:MOVEFFID,1,0,5IB:READFFID,STR0,STU_LENGTH;讀取學(xué)生信息CMPAX,0;文件是否結(jié)束JNZIL1JMPIC;沒有重復(fù)學(xué)號,可以插入IL1:LEASI,STR0LEADI,STRINCDIDECSIMOVCX,ID_LENGTHIL2:INCSIINCDIMOVAL,BYTEPTRDICMPAL,BYTEPTRSIJNZIA;不符合條件讀取下一個(gè)同學(xué)信息LOOPZIL2JMPERR_SA;有重復(fù)學(xué)號IC:MOVEFFID
43、,2,0,5WRITEFFID,STR,ID_LENGTH;數(shù)據(jù)合法則寫入數(shù)據(jù)TABIN_NAM:SHOWNAM;姓名CALLRE_TMP;初始化緩沖區(qū)INPUTSTR,BLADDBL,2;去掉回車MOVBH,0MOVSI,BXMOVSTRSI,''SUBBL,2CMPBL,NAM_LENGTHJNAL2ERR_NAM:CALLSHOW_ERRJMPIN_NAML2:CMPSTR2,''姓名第一個(gè)字符不為空J(rèn)ZERR_NAMCMPSTR2,'z'JAERR_NAMCMPSTR2,'A'JBERR_NAMCMPSTR2,'a
44、'JNBIIICMPSTR2,'Z'JAERR_NAMCMPSTR2,'A'JBERR_NAMIII:MOVCX,NAM_LENGTHMOVBX,2II0:INCBXDECCXCMPSTRBX,'z'JAERR_NAMCMPSTRBX,''JBERR_NAMCMPSTRBX,'a'JNBII0CMPSTRBX,'Z'JAERR_NAMCMPSTRBX,'A'JNBII0CMPSTRBX,''JNZERR_NAMCMPCX,0JNZII0WRITEFFID,ST
45、R,NAM_LENGTHTABIN_SCORE:SHOWSCORECALLRE_TMPINPUTSTR,BLMOVSC,BL;BL保護(hù)ADDBL,2;去掉回車MOVBH,0MOVSI,BXMOVSTRSI,''SUBBL,2CMPBL,SCORE_LENGTH;分?jǐn)?shù)最多4位JBL5ERR_SCORE:CALLSHOW_ERRJMPIN_SCOREL5:MOVCX,BX;分?jǐn)?shù)只能是數(shù)字和.MOVBX,2L6:CMPSTRBX,'0'JNBL7;>=0CMPSTRBX,'.'JNZERR_SCOREJZL8L7:CMPSTRBX,'9&
46、#39;<=9JAERR_SCOREINCBXLOOPL6L8:MOVBL,SCCMPBL,4;分?jǐn)?shù)(0100),支持一位小數(shù)JNZL9CMPSTR4,'.'JNZERR_SCOREJMPLWL9:CMPBL,3JNZL10CMPSTR3,'.'JZLWCMPSTR2,'1'JNZERR_SCORECMPSTR3,'0'JNZERR_SCORECMPSTR4,'0'JNZERR_SCOREJMPLWL10:CMPBL,2JNZL11CMPSTR2,'.'JZERR_SCOREJMPLWL11:
47、CMPSTR2,'.'JZERR_SCORELW:WRITEFFID,STR,SCORE_LENGTHTABIN_RANK:SHOWRANKCALLRE_TMPINPUTSTR,BLMOVSC,BL;BL保護(hù)ADDBL,2;去掉回車MOVBH,0MOVSI,BXMOVSTRSI,''SUBBL,2CMPBL,RANK_LENGTH;分?jǐn)?shù)最多4位JBL12ERR_RANK:CALLSHOW_ERRJMPIN_RANKL12:MOVCX,BX;分?jǐn)?shù)只能是數(shù)字和.MOVBX,2L13:CMPSTRBX,'0'JNBL14;>=0CMPSTRBX,
48、'.'JNZERR_RANKJZL15L14:CMPSTRBX,'9'<=9JAERR_RANKINCBXLOOPL13L15:MOVBL,SCCMPBL,4;分?jǐn)?shù)(0100),支持一位小數(shù)JNZL16CMPSTR4,'.'JNZERR_RANKJMPLW1L16:CMPBL,3JNZL17CMPSTR3,'.'JZLW1CMPSTR2,'1'JNZERR_RANKCMPSTR3,'0'JNZERR_RANKCMPSTR4,'0'JNZERR_RANKJMPLW1L17:CMP
49、BL,2JNZL18CMPSTR2,'.'JZERR_RANKJMPLW1L18:CMPSTR2,'.'JZERR_RANKLW1:WRITEFFID,STR,RANK_LENGTHTAB;關(guān)閉文件CLOSEFFIDCALLSHOW_ECPOPDXPOPCXPOPBXPOPAXRETINSERTENDP=以下是瀏覽(list)子程序=LISTPROCNEARPUSHAXPUSHBXPUSHCXPUSHDXCALLCLEARMOVAX,0MOVTMP,AXOPENFFID,FPATHTAB;是否為空標(biāo)志清0;打開文件D:MOVEFFID,1,0,5E:READFFID,STR0,STU_LENGTH;讀取學(xué)生信息CMPAX,0;是否到文件尾JNZGCMPTMP,0;判斷有沒有信息JNZFTABTABTABSHOWER
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 提升課堂教學(xué)效率策略計(jì)劃
- 如何制定量化的倉庫目標(biāo)計(jì)劃
- 戰(zhàn)略風(fēng)險(xiǎn)管理實(shí)踐培訓(xùn)
- 班級運(yùn)動(dòng)會的組織安排計(jì)劃
- 艾滋病常見問題咨詢
- 過橋貸擔(dān)保協(xié)議書范文范本下載
- 離婚協(xié)議書范文2020標(biāo)準(zhǔn)版章
- 交警隊(duì)保密協(xié)議書范文模板下載
- 離婚協(xié)議書范文一子女無財(cái)產(chǎn)無債務(wù)
- 律師事務(wù)所整體轉(zhuǎn)讓協(xié)議書范文
- 煤礦安全檢查工課件
- 開展買方信貸可行性報(bào)告
- 營養(yǎng)師培訓(xùn)飲食健康與飲食指導(dǎo)
- 海洋石油平臺結(jié)構(gòu)完整性分析
- 紀(jì)檢監(jiān)察建議書整改落實(shí)情況報(bào)告
- 《平衡針灸》課件
- 空間幾何圖形的距離和位置問題課件
- 空調(diào)、電視供貨安裝維護(hù)方案
- 交警行業(yè)腐敗案例分析
- 光伏電站施工進(jìn)度計(jì)劃安排與保證措施
- 人際關(guān)系的建立與維護(hù)
評論
0/150
提交評論