微機(jī)原理習(xí)題2求BUF開始的10個(gè)數(shù)無符號(hào)字節(jié)數(shù)據(jù)之和并將結(jié)果存放到_第1頁
微機(jī)原理習(xí)題2求BUF開始的10個(gè)數(shù)無符號(hào)字節(jié)數(shù)據(jù)之和并將結(jié)果存放到_第2頁
微機(jī)原理習(xí)題2求BUF開始的10個(gè)數(shù)無符號(hào)字節(jié)數(shù)據(jù)之和并將結(jié)果存放到_第3頁
微機(jī)原理習(xí)題2求BUF開始的10個(gè)數(shù)無符號(hào)字節(jié)數(shù)據(jù)之和并將結(jié)果存放到_第4頁
微機(jī)原理習(xí)題2求BUF開始的10個(gè)數(shù)無符號(hào)字節(jié)數(shù)據(jù)之和并將結(jié)果存放到_第5頁
已閱讀5頁,還剩16頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、AX的指令(單條1MOV2AND3XOR4SUB2BUF10SUMDATABUFDB1,2,3,4,5,6,7,8,9,10SUMDW?DATAENDSCODESEGMENTASSUMECS:CODE,DS:DATA MOVAX,DATAMOVDS,AXMOVCX,10LEABX,[BUF]MOVAX,0 ADDAL,[BX]INCBXDECJNZLOPJMP MOVSUM,AXCODEENDSEND

LOOP40H,41H80H,81H斷矢量號(hào)為08H,從片為70H.。通過中斷方式按鍵次數(shù)。IRQ0>IRQ1>IRQ8>IRQ9>…>IRQ15>IRQ3>IRQ4>…>IRQ7CODESEGMENTASSUMECS:CODESTART:MOVCX,0MOVAL,11HICW1MOVDX,40HOUTMOVAL,08HICW2INCDXOUTMOVAL,1DHICW4OUTDX,ALMOVAL,11HICW1MOVDX,80HOUTMOVAL,70HICW2INCDXOUTMOVAL,09HICW4OUTDX,ALPUSHMOVAX,OFFSETIRQ8_KEYMOV[01C0H],AXMOVMOV[01C2H],AXPOPDS INAL,81H ;讀字ANDAL,0FEH;82590OUT81H,ALIRQ8_KEY:INCMOVAL,20HEOIOUTMOVAL,20HEOIMOV CODEENDSENDIRQ6STACKSEGMENTSTACKDW64DUP(?)STACKENDSDATASEGMENTCISHUDB0,0DATAENDSCODESEGMENTASSUMECS:CODE,DS:DATASTART:MOVAX,DATAMOVDS,AXPUSHDSMOVAX,0000HMOVDS,AXMOVAX,OFFSETIRQ6ADDAX,2000HMOVSI,0038HMOV[SI],AXMOVAX,0000HMOVSI,003AHMOV[SI],AXPOPDSINAL,21HANDAL,0BFHOUT21H,ALMOV CMPCX,0000HJNZA2INAL,21HORAL,40HOUT21H,ALJMPA1A2:JMPA1IRQ6:PUSHINCCISHUMOVAL,CISHUMOVBL,ALANDBL,0FHCMPBL,0AHJBADD_30ADDBL,07HADD_30:ADDANDAL,0F0HMOVCL,4SHRAL,CLCMPAL,0AHJBADD_30_1ADDAL,07HADD_30_1:ADDMOVAH,01HINT10HMOVAL,BLINT10HMOVAX,0120HINT10HDECMOVAL,20HOUT20H,ALPOPAXCODEENDSTACKSEGMENTSTACKDW64DUP(?)STACKCODESEGMENTASSUMECS:CODE PUSHMOVMOVDS,AX MOVAX,OFFSETIRQ6IRQ6ADDAX,2000H MOVSI,0038H ;填8259中斷6的中斷矢量MOV[SI],AX MOVAX,0000HMOVMOV[SI],AX POPDSIN ;讀8259中斷ANDAL,0BFH 6OUT21H,ALMOV CMPCX,00FFHJNZA2IN ;度8259中斷ORAL,40H 6OUT21H,AL JMPA1 PUSHINCCXPUSHMOV CXAND ;CX低字節(jié)的高四CMP 10JBADD_30 1030HADDAL,07H ADDAL,30H ;大于10加37HMOVAH,01H ;調(diào)用INT10HINTMOV CXMOVAND ;CX低字節(jié)的低四SHR CMP 10JBADD_30_1 1030HADDBL,07HADD_30_1:ADDBL,30H 1037HMOVAL,BLMOVAH,01H INT10HMOVAX,0120H INT10HPOPCXDECMOV EOIOUT20H,AL CODEEND5BUFMAXMINDATABUFDB123,-4,0FFH,66H,88,'A',0COUNTEQU$-BUFMAXDBMINDB'?'DATAENDSCODEASSUMECS:CODE,DS:DATA MOVAX,DATAMOVMOVSI,OFFSETBUFMOVDH,[SI]MOVDL,[SI]MOVCX,COUNT-1INCSI CMP[SI],DLJGECHECK_MAXMOVDL,[SI]CHECK_MAX:CMPJLEOUTTMOVDH,[SI] INCSILOOPLOPMOVMAX,DHMOVCODEEND6BUFRESULTDATABUFDW6688H,8866H,6688HRESULTDW'?'DATAENDSCODESEGMENTASSUMECS:CODE,DS:DATA MOVAX,DATAMOVDS,AXMOVAX,BUFCMPAX,BUF+2JZONEEQUTWOCMPAX,BUF+4JZMOVRESULT,AXJMPOUTTONEEQUTWO:MOVMOVRESULT,AXJMPOUTTONEEQUTHR:MOVMOVCODE

JMP

此處也可以是:MOVINTEND7BUF10SUM(不考慮溢出DATABUFDWX0,X1,X2,X3,X4,X5,X6,X7,X8,X9SUMDW'?'DATAENDSCODESEGMENTASSUMECS:CODE,DS:DATASTART:MOVAX,DATAMOVDS,AXLEABX,BUFMOVCX,10MOVAX,0 ADDAX,[BX]INCBXINCBXLOOPLOPMOVSUM,AXMOVAH,4CHINT21HCODEEND8、某接口設(shè)計(jì)采用一片8255A實(shí)現(xiàn)。其端口A連接并行,端口B連接紙帶讀入機(jī),如圖所示。8255A工作于方式0,以查詢方式傳送數(shù)據(jù)。端口A、端口B、端口C以及控制口地址依次為DATABUFDBX1,X2,X3,X4,X5DATAENDSCODEASSUMEMOVAL, OUT43H,ALMOVMOVBX,OFFSETBUFLPST:INAL,42HTEST B;BUSYJNZLPSTOUT40H,ALMOVAL,[BX]OUT40H,ALMOVAL, B;PC41OUT43H,ALMOVAL, B;PC40OUT43H,ALMOVAL, B;PC41OUT43H,ALINCBXLOOPLPSTMOVAL, BOUT43H,ALMOVAL, B;PC51OUT43H,ALMOVAL, B;PC50OUT43H,ALMOVAL, B;PC51OUT43H,ALRDST:INTEST B;PC3JZRDSTINAL,41HCODE9、判斷從A端口輸入的數(shù)據(jù)是否大于100,若大于100則。電路圖如圖所示。設(shè)CS=40H,端口A、端口BC40H、41H、42H、43H。8088ADATABUFDBXDATAENDSCODESEGMENTASSUMECS:CODE,DS:DATAMOVAL, OUT INAL,40HCMPAL,100JAMOVAL, B;PCO0OUT43H,ALMOVAL, B;PC10OUT43H,ALJMPCTRL_OUT:MOVAL, B;PC01OUT43H,ALMOVAL, B;PC11OUT43H,ALOUTT:JMPMAINCODEENDS

也可以改寫為MOV OUT,10、主程序先送一個(gè)數(shù)給完成后經(jīng)反相器輸出信號(hào)給中斷服務(wù),其他的數(shù)據(jù)在中斷中繼續(xù)送給打印。設(shè)8259的地址為20H、21H,中斷矢量號(hào)為08H。,INTR8088系總系DATADATA_PRINTDB0,1,2,3,4,5,6,7,8,9DATAENDSCODEASSUMECS:CODE,DS:DATA MOVAX,DATAMOVMOVAL, OUT20H,ALMOVAL, OUT21H,ALMOVAL, OUT21H,ALPUSHDSMOVAX,0MOVMOVAX,OFFSETIRQ3_PRINTMOV[002CH],AX MOVAX,CSMOV[002EH],AX POPDSIN ;讀8259中 B;8255MOVDX,PORT_CTRLOUTDX,ALMOVAL,DATA_PRINTMOVDX,PORTAOUTMOVAL, MOVDX,PORT_CTRLOUTMOVAL, OUTDX,ALMOVAL, OUTDX,ALMOVBX,OFFSETDATA_PRINTINCBX JMPMAINIRQ3_PRINT:PUSHAXPUSHMOVAL,[BX]MOVOUT PORTAMOVDX,PORT_CTRLMOV OUTDX,AL ;PC0置1MOVAL, OUTDX,AL ;PCO置0MOVAL, OUTDX,AL ;PC01INCBXMOV EOIOUT20H,ALPOPDXPOPAXCODEEND11、LEDaab總||||||A口||8255(靜態(tài)DATATAB_SEGDB3FH,06H,5BH,4FH,66H,6DH,7DH,07H,7FH,6FHNUMDB'?'DATAENDSCODESEGMENTASSUMECS:CODE,DS:DATAMOVAL,80HOUTPORT_CTRL,ALMOVAL,NUMMOVLEABX,TAB_SEGADDBX,AXMOVAL,[BX]OUTCODE||||||a ||abab1|||2總||||3B8255(動(dòng)態(tài)DATADISP_NUMDBTAB_SEGDB3FH,06H,5BH,4FH,66H,6DH,7DH,07H,7FH,6FHDATAENDSCODEASSUMECS:CODE,DS:DATAMOVAL,80HOUTPORT_CTRL,ALMOVAL,DISP_NUMMOVAH,0LEABX,TAB_SEGADDBX,AXMOVAL,[BX]OUTMOVAL, OUTPORTB,ALCALLDELAYMOVAL,DISP_NUM+1LEABX,TAB_SEGMOVAH,0ADDBX,AXMOVAL,[BX]OUTMOVAL, OUTPORTB,ALCALLDELAYMOVAL,DISP_NUM+2LEABX,TAB_SEGMOVAH,0ADDBX,AXMOVAL,[BX]OUTMOVAL, OUTPORTB,ALCALLDELAYCODEDATADISP_NUMDBTAB_SEGDB3FH,06H,5BH,4FH,66H,6DH,7DH,07H,7FH,6FHDATAENDSCODEASSUMECS:CODE,DS:DATAMOVAL,80HOUTPORT_CTRL,ALNEXT:LEABX,TAB_SEGMOVDH, MOVCX,3MOVSI,OFFSETDISP_NUMLOP:MOVAL,[SI]OUTPORTA,ALMOVAL,DHOUTPORTB,ALINCSIRORDH,1LOOPLOPJMPCODE12、當(dāng)按下按鍵5次后產(chǎn)生一次中斷,在中斷服務(wù)程序中做變量KEY_ENTER_NUM加1。設(shè)8259的20H、21H,18H;8253的CS=60H,60H~63H。DATAKEY_ENTER_NUMDB0DATAENDSCODEASSUMEMOV B;8253OUT63H,ALMOVAL,4OUTAL,60HMOV B;ICW1,8259OUTMOVAL,18H OUT21H,ALMOVAL, B;ICW4OUT21H,ALPUSHDSMOVAX,0MOVMOVAX,OFFSETIRQ7_KEYMOV[007CH],AXMOVMOV[007EH],AXPOPDSIN ;中斷ANDAL,7FH OUT21H,ALIRQ7_KEY:INCMOV EOIOUT20H,ALCODE5,8253280H~283H。 065536NN11MOVMOVOUTDX,ALMOVAX,10000B

103MOVDX,280HOUTDX,ALMOVAL,AHOUTDX,ALMOVAL, MOVDX,283HOUTDX,ALMOVDX,281HMOVAX,1000OUTDX,ALMOVAL,AHOUTDX,AL14825920H、21H,18H;825540H~43H,825360H~63H。系總系總系N

12

65536NCODE

12

ASSUMEMOVAL, B;ICW1OUT20H,ALMOVAL,18H OUT21H,ALMOVAL, B;ICW4OUT21H,ALPUSHDSMOVMOVMOVAX,OFFSETIRQ7_2SMOV[007CH],AXMOVMOV[007EH],AXPOPDSIN ;讀中斷ANDAL,7FH 7OUT21H,ALMOV ;8255OUTMOV B0OUT63H,ALMOVAX,2380OUT60H,ALMOVAL,AHOUT60H,ALMOV B2OUT63H,ALMOVAX,1000OUT62H,ALMOVAL,AHOUT62H,ALMOVAL,0MOVBL,ALOUT40H,ALIRQ7_2S:NOTMOVAL,BLOUTMOV EOIOUT20H,ALCODE158253220H~223H,02,1000,二進(jìn)制計(jì)數(shù);13,1000,BCDMOV B0此處可以改寫為MOVMOVDX,220HOUTDX,ALMOVAL,AHOUTDX,ALMOVDX,223HOUTDX,ALMOV此處可以改寫為MOVMOVDX,220HOUTDX,ALMOVAL,AHOUTDX,ALMOV B1MOVDX,223HOUTDX,ALMOVAL,00HMOVDX,221HOUTDX,ALMOVAL,10HOUTDX,AL果第1列(0-7)有按鍵按下,在數(shù)碼管上顯示0。編寫相關(guān)程序段(8255初始化,鍵盤掃描,七段碼的建立,查表顯示功能825560H~63H。F bF b dhABCDEDATATAB_SEGDB3FH,06H,5BH,4FH,66H,6DH,7DH,07H,7FH,6FHDATAENDSCODE

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論