資源描述:
《微機(jī)原理上機(jī)實(shí)驗(yàn)問題詳解》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在工程資料-天天文庫。
1、實(shí)用標(biāo)準(zhǔn)實(shí)驗(yàn)01A將FFFFH送到AX,BX,CX,DX,SI,DI,BP寄存器程序如下:CODESEGMENTASSUMECS:CODESTARTPROCFARSTT:PUSHDSSUBAX,AXPUSHAX;==============================MOVAX,0FFFFHMOVBX,AXMOVCX,AXMOVDX,AXMOVSI,AXMOVDI,AXMOVBP,AX;==============================RETSTARTENDPCODEENDSENDSTT??實(shí)驗(yàn)01B將FFH送到內(nèi)存1000H,1001H,1002H,1003H,10
2、04H單元中程序如下:DATASEGMENTORG1000HH1DB5DUP(?)DATAENDSCODESEGMENTASSUMECS:CODE,DS:DATASTARTPROCFARSTT:PUSHDSSUBAX,AXPUSHAX;==============================MOVAL,0FFHMOVDI,1000HMOVCX,5;循環(huán)5次LP1:MOV[DI],AL;FF放入1000H-1004H中INCDI文檔大全實(shí)用標(biāo)準(zhǔn)DECCXJNZLP1;==============================RETSTARTENDPCODEENDSENDSTT?
3、?實(shí)驗(yàn)02A編寫一個(gè)加法程序,在數(shù)據(jù)段偏移地址1000H處開始,存放有兩個(gè)3字節(jié)長的數(shù)據(jù)(高位對(duì)應(yīng)高地址,低位對(duì)應(yīng)低地址),求這兩數(shù)據(jù)(十六進(jìn)制數(shù))的和,并將結(jié)果放在兩數(shù)據(jù)之后,利用DEBUG調(diào)試程序,并求解:CCBBAAH+223344H=?CCBBAA+554433H=?程序如下:DATASEGMENTORG1000HH1DB10DUP(?)DATAENDSCODESEGMENTASSUMECS:CODE,DS:DATASTARTPROCFARSTT:PUSHDSSUBAX,AXPUSHAXMovax,dsegMovds,ax;=========================
4、=====MOVSI,1000H;不帶最高位進(jìn)位的全加器MOVDI,1003HMOVBX,1006HMOVCX,3CLCAA:MOVAL,[SI]ADCAL,[DI]MOV[BX],ALPUSHF;保護(hù)FR,這里其實(shí)沒有必要,因?yàn)镮NC不會(huì)產(chǎn)生進(jìn)位INCSIINCDIINCBXPOPFLOOPAA文檔大全實(shí)用標(biāo)準(zhǔn)?MOVDL,0;最高位進(jìn)位ADCDL,0MOVDI,1009HMOV[DI],DL;==============================RETSTARTENDPCODEENDSENDSTT??實(shí)驗(yàn)02B用串傳送指令把A程序的數(shù)據(jù)塊(被加數(shù)、加數(shù)、和)偏移地址100
5、0H開始的區(qū)域傳遞到同一數(shù)據(jù)段的偏移地址為1010H開始的區(qū)域,并利用DEBUG查看運(yùn)行結(jié)果程序如下:DATASEGMENTORG1000HH1DB20DUP(?)DATAENDSCODESEGMENTASSUMECS:CODE,DS:DATASTARTPROCFARSTT:PUSHDSSUBAX,AXPUSHAX;==============================MOVAX,DS;使ES段地址與DS相同MOVES,AX?MOVSI,1000H;不帶最高位進(jìn)位的全加器MOVDI,1003HMOVBX,1006HMOVCX,3CLCAA:MOVAL,[SI]ADCAL,[D
6、I]MOV[BX],ALPUSHF;保護(hù)FR,這里其實(shí)沒有必要,因?yàn)镮NC不會(huì)產(chǎn)生進(jìn)位INCSIINCDI文檔大全實(shí)用標(biāo)準(zhǔn)INCBXPOPFLOOPAA?MOVDL,0;最高位進(jìn)位ADCDL,0MOVDI,1009HMOV[DI],DL?MOVSI,1000H;串傳送MOVDI,1010HMOVCX,5CLDREPMOVSW;一次傳送一個(gè)字;==============================RETSTARTENDPCODEENDSENDSTT??實(shí)驗(yàn)02C,選作編寫一個(gè)兩位十進(jìn)制數(shù)加法程序,當(dāng)從鍵盤上輸入:n1n2+n3n4則在CRT上顯示n1n2+n3n4=n5n6程序
7、如下:DATASEGMENTH1DB"Theaddendsallmustbetwofigures,insufficientadds0infront.",13,10,'$'DATAENDSCODESEGMENTASSUMECS:CODE,DS:DATASTARTPROCFARSTT:PUSHDSSUBAX,AXPUSHAX;==============================MOVAX,DATAMOVDS,AX?LEADX,H1;打印注釋:加數(shù)和被加數(shù)都必須為兩