西南交通大學(xué)微機(jī)原理實驗代碼_第1頁
西南交通大學(xué)微機(jī)原理實驗代碼_第2頁
西南交通大學(xué)微機(jī)原理實驗代碼_第3頁
西南交通大學(xué)微機(jī)原理實驗代碼_第4頁
西南交通大學(xué)微機(jī)原理實驗代碼_第5頁
已閱讀5頁,還剩23頁未讀, 繼續(xù)免費閱讀

下載本文檔

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

文檔簡介

1、2-1DATASSEGMENT;此處輸入數(shù)據(jù)段代碼DATASENDSSTACKSSEGMENT;此處輸入堆棧段代碼STACKSENDSC0DES5EGMENTASSUMCS:CODES,DS:DATAS,SS:STACKS STARTM0SI,3500H ;設(shè)置待轉(zhuǎn)換數(shù)據(jù)區(qū)的地址指針MODI,3510H ;設(shè)置結(jié)果數(shù)據(jù)區(qū)的地址指針MOBX,000AH ;乘數(shù) 10MOVCX,0004H ;循環(huán)4 次MOAH,00HMOAL,SI;取第一位 ASCH 碼SUBAL,30H ;轉(zhuǎn)換成二進(jìn)制數(shù)A1: IMULBX ;乘 10ADDAL,SI+01;加次位SUBAL,30HINC SI ;修改地址指針

2、LOOP A1 ;循環(huán)MODI,AX ;保存結(jié)果INT 3H;此處輸入代碼段代碼MOAH,4CHINT 21HCODESENDSENDSTARTAX=000C BX=000ADX=&QGSP=000BDS=0B55ES=0B55SS=OB65OS=0B6 IP=QO1ECCINT3-D3510BB55:3510BC000D舶4D鉗73-wa6C6i3855:352073736167732C20-6F722Q636F6D6D61 ?26E642D6563朋55:354020f:F6E206F2R6F-S6Gf:2E0BS5:3550204543484F20SB4F-4E20?C0DBA5?202

3、04543鈿YF265BBB55:357BG7鈔77ED0DHAHl)BA54-79&5206974686F?574-207061HP=0000 SI=3534 DI=3510NU UP El PL HZ NA PO NC73 20 6D 65.me75BE 73ssagfes, or turns6F 69 GE 67conunand-echo ing時RD肺20on or off4F 46 46 5DECHO ON ! OFF J65 73 73 61.U ECHO Cmessa45 43 4E 4Fge JType ECHO61 D B5 74without paramet948D0D02

4、77602627時 C:IFDOISsystea32cd, exe鯨詡盹0BX-0000CX 0023DK呦麗0SP-0000BP=0O00D=00O0DS=BB5b ES=0B55SS=3B65CS=0B65IP=0300NUUP ElPL NZ NA PO NC0恥 5 =0000 EE0陽 EMOUSI,35R0-E35000B55:350669.306E.3B75.3065.312E.32-G2-2DATASSEGMENT;此處輸入數(shù)據(jù)段代碼DATASENDSSTACKSSEGMENT;此處輸入堆棧段代碼STACKSENDSCODES5EGMENTASSUMCS:CODES,DS:DA

5、TAS,SS:STACKS STARTMOVCX,0005H ;循環(huán)計數(shù)器賦初值MOVDI,3500H ;ASCH 碼首址A1:MOVBL,0FFH ;將錯誤標(biāo)志送入BLMOAL,DI;送ASCH 碼至 ALCMPAL,3AH ;比較 AL 與3AJNB A2 ;不低于3A則轉(zhuǎn)A2SUBAL,30H ;低于3A則取ASCH碼低4位JB A2 ;低于30則轉(zhuǎn)A2MOVBL,AL ;否則AL內(nèi)容送入BL,取代FF A2:MOAL,BL ;結(jié)果或錯誤標(biāo)志送入ALMODI+0AH,ALINC DILOOP A1INT 3HCODESENDSENDSTART” C:IRD0ISsyste*32cd, e

6、ieAX-0800 EX-0000DS =BB55 ES =0B5 50B65:0006 B9Q500-EeB55:35000BS5:350B69.31-GCX -O01D DM-BOM GP-0000 BP 0(300 SI-0060 DI -0000GS=0B65 CS =BB65IP=0000 NU UP El PL NE NA PO NC0B65:001C CC-D0B55:35BAflB55:35009BS5:3B1B450B55:352073BB55:353B0B55:3540GF0B55:355045BBSS:35frB0DHO0BS5:35706765RB55:358O2077

7、AX=0005DS=0B55ES=0B55DX=0000SP=0000SS=0B65 CME65 IP=001C I NT 36973-702C20-6F&E64-2D206F-665B4FTE454348-4F0DBA54-796F7574-2HD5DFF0A84666420606624207D1FE37D90666455601&1RP=0000D】=35酊NU UP El PL HZ NA PE NC55370D1F56762564SDEEA63823 0 0 4*4-029D63302760474335FAFS507704642948D0D007760262SE. .FIDlsplavs

8、 me stages, or turns coMand-BC ho ing an op off _ ECHO ON : OFF!.W ECHO Insssa gel. . . - Type ECHO without pMOUOU 盹 052-5DATASSEGMENT;此處輸入數(shù)據(jù)段代碼DATASENDSSTACKSSEGMENT;此處輸入堆棧段代碼STACKSENDSCODES5EGMENTASSUMCS:CODES,DS:DATAS,SS:STACKS STARTMOAX,0B07HMODS,AXMOV)I,3000HMOV)X,9111HMOVCX,2222HTEST DH,80HJZ

9、LPXOFDX,7FFFHNOT CXADCCX,1ADCDX,0LP:MOVDI,CLM0VDI+1,CHM0VDI+2,DLM0VDI+3,DHINT 3INT 3HCODESENDSENDSTART八 C:TIRDOISsystcb32c eie-R DX DX 0000 :9111-H CX CX 0U2C :2222-Gax =0BB7 bxDS=0B07ES=0B550B65:Q02A CCCX=DDDE DX =EEEE SP=0000SS=OB65 CS=0B6 IP=Q02A I NT 3BP=0000SI=0B90D】=30師NU UP El NG HZ NA PE NCD

10、EDD0807:3010&C65B07:3d202H740007:303020700B07:304BG42&0BQ7:3Q5G0ARDBB87:30frB7920WB07:3070(JDBAD0B07:36009F07484422267564E05FE50BE2666424EC829A1DE26760&42D2D66-6F?22D572E-BD0A3E434F4D4D414E72tl6D-2H20&3657279-726S7449540D-0A3D43697274&F495220-5B64725 78 fit 6D 70一for exanp51 75 69 74 73le, /-W.Qults

11、44 2E 43 4F 4Dthe COMMAND.COMGF 6D 6D 61 6Eprogram Ccomman5 72 29 2E 0Dd interpreter.72 65 61 74 65.E3d, exe岡DS =BB55 ES=0B5 5 0恥5 伽00 即1000 -E300W0BS5:30066F.113B55:300a66-11BBS5:3Q1020.11-GCX =0020DK-0000 SP=0ftR0 BP-盹胸 SI-0600 DI =0000SS=0B65 GS=0B6S IP=00B0 HU UP El PL NZ NA PO NCMOUOU 0010222 2

12、 .497773.44 70.1165-22b3.3369.4461.44 20.11GE.22E5.3M77.4AX=BB11DS=BB55 nB6 5;f)027-D3B10BB55:3B1G3B55:304SUB55:30600BS5:3070ES=PB55CC11 22 GF 726F6C65 D76 6 9 EG 的1CXDK =(4000S=0B65 CS=0B65I NT 3SP=00B0IP=00274411223344-112233?96F?57220-64657320666?&C65-2E0DBA732C2Q7365-74732C?6GG734D-532D6FCEGD6E-

13、7428?62E0D0A0A-5345546C碼3D73-7472&930E9F23232676776BF=QM00 SI=2FFF DI300FNU UP El PL ZR NA PE NC3130511D367266652E92O96D26672675194F32B71S46SV564470F10E4752462644,*3D.,*3D.*3D.3D74or 90ur destinat70ion flie.MDisp72lgyw” setsf or rGEsmovea MS-DOS en62uiponment uariab72 lesSET vap0Dtable st i*ljng .4-

14、1DATASSEGMENT;此處輸入數(shù)據(jù)段代碼DATASENDSSTACKSSEGMENT;此處輸入堆棧段代碼STACKSENDSCODESSEGMENTASSUMCS:CODES,DS:DATAS,SS:STACKS STARTMODX,01HMOBL,02HA1:MOAL,BLINC BLMULBLADDDX,AXCMPAX,0C8HJBE A1INT 3HCODESENDSENDSTART4-2DATASSEGMENT;此處輸入數(shù)據(jù)段代碼DATASENDSSTACKSSEGMENT;此處輸入堆棧段代碼STACKSENDSCODESSEGMENTASSUMCS:CODES,DS:DATAS

15、,SS:STACKS STARTMODI,3000HMOVCX,DIMOVCH,00HMOVBL,00HINC DIA1:MOAX,DICMPAX,0000HJGE A2INC BLA2:INC DILOOP A1MODI,BLINT 3HCODESENDSENDSTART點 C:IRD0ISsysteB32cd, eie舫詡0胸 BX-0O0ft DS =0B4F ES=0B4F 0B5F:0000 BF003 Q -E8B4F:30e0 0B4F:30066F.06_GCX 0019DK=00O0SP-0000 BP 0m SI-0df D=00OSS=BB5F CS=0B5F IP=08

16、00 HU UP El PL NZ NA PO NCMOU DI,300074_12CX=9000SP=0000SS=0B5F CS=0B5F IP=Q618 1NT 3SI=0B90 DI=3007NU UP El PL HZ NA PO NC9B4F:301020640BF:30206F72690B4F:3040&C610B4F:305B656DBB4F:30frB76690B4F:30706C650B4F:30806961fiX=6933 BX=0003DS=0B4F ES=0BF 0B5F:Q013 CC -D0B4F:3G37726?76&52B6 P-72207020796F757

17、220-6465736E206G69tc6ME0DPfi79732C20736&-74732C6F76E573204D-532D44726FGE6D佔6E-74207G732EBD0 口BDBfl-534554626C653D5B20 6E 65 77y en new74 68 20 66driye or path f69 6E 61 74or yuiJir1 destinat加 69 73 70ion f ileUDisp6F 72 20 72lays sets, or r53 20 65 6Eemoves MS-DOS en72 962uironnent yft*iah5B 76 Bl 7

18、2lesSEItuapiable=11470F10667524625-1DATASSEGMENTAA DB0D9H,07H,8BH,0C5H,0EBH,04H,9DH,0F9H此處輸入數(shù)據(jù)段代碼DATASENDSSTACKSSEGMENT;此處輸入堆棧段代碼STACKSENDSCODESEGMENTASSUMCS:CODE,DS:DATAS,SS:STACKS SUB1 PROC NEARCMPCX,0JE A4DECCXMOBH,SIMOBL,BHA1:INC SIMOAL,SICMPAL,BHJAE A2CMPAL,BLJBE A3JMP A4A2:MOV3H,ALJMP A4A3:MOV

19、3L,ALA4:LOOP A1RETSUB1 ENDPSTARTMOVXQATASMODS,AXMOSI, OFFSETS MOCX,OOO8HCALL NEAR PTR SUB1MOAH,BHMOAL,BLINT 3CODE ENDSENDSTART實驗6DATASSEGMENTORC3000HVAR DB11H,0d3H,77H,6bH,0BH,33H,0aaH,21H,0ffH,67H ;此處輸入數(shù)據(jù)段代碼DATASENDSSTACKSSEGMENT DW100 DUP?);此處輸入堆棧段代碼STACKSENDSCODES5EGMENTASSUMCS:CODES,DS:DATAS,SS:

20、STACKS STARTMOAX,DATASMODS,AXMOVCX,000AHMOSI,300AHMOBL,0FFHA1: CMP3L,0FFHJNE A4MOBL,00HDECCXCMPCX,0JE A4PUSFSIPUSFCXA2: DECSIMOAL,SIMOV)L,SI-1 CMPALQLJA A3MOVSI-1,AL MOVSI,DL MOV3L,OFFHA3: LOOP A2POPCXPOPSIJMP A1A4: INT 3;此處輸入代碼段代碼MOAH,4CHINT 21HCODESENDSENDSTARTC;TINDOTSyste32cBd- cteSUU m二師朋04F ES

21、=RB4F :00Q0 B85FOBCX=3118 DX =QQQG SP=0000SS=0B5F CS=0E6DIP=G000MOUBP=0000 SI=0600 DI=0000MU UP El PL NZ NA PO NG:0033ES=BB4F COCX=3002 DX=00AA SP=6300SS=0B5F CS=0E6ft IP=6033I NT 3BP=0000 SI=3G3A DI=0000HU UP El PL NZ AC PO CV_M- 0 iS -M- H- 0 _M _u iS IS _u R- _M _M- 9 -M _M-Si 0 KS IS 0 tSi R- 0

22、q 0 0 0R- _M- -MR- _M 9 1 IS -M- -M- _MM00Si _w- -M- 邑 w- R- 一 0 -M- 0 0R- _0 -M- Si -M- -MR- fi- -M- ii i -M- -M- CS77 AA-D3 FF 06-00 0G 0Q 00-00 000U 09-Q& 000(j 00-00 000(1 00-00 QQBSISIBI00ISI0Itu 0 q一 0 0 0 of _M- -MLb _M- tSi -M- -M- -M30000000 30000000 100000010000000B00R0000 w- 一 -M- -M-IBS

23、F: 3000B5F:3010 BSF:3020 IB5F:3O38 IBSF: 3040 B5F:3050 B5F:3060 IB5F:3070實驗七DATASSEGMENT;此處輸入數(shù)據(jù)段代碼DATASENDSSTACKSSEGMENT;此處輸入堆棧段代碼STACKSENDSCODES5EGMENTSTARTMOAL,O;表示前景、背景顏色MOV3H,OAHM0AH,6HMOVCX,0MOV)H,24MOV)L,79 INT 10HM0AH,2MOV3H,0MODH,10HMODL,10H INT 10HMOVCX,001AHMODL, ZLP:MOAL,DLMOV3H,0MOV3L,2F

24、HMOAH,9INT 10HDECDL;清屏幕;光標(biāo)設(shè)置在第10行第10列;共26個字母,所以循環(huán)次數(shù)為26;設(shè)置顯示的A到Z的底色和字色LOOP LPINT 3CODESENDSENDSTART實驗八.486pd8255 macro port,data1 movdx,port moveax,data1 out dx,eaxnopnop endmdatasegme nt at 0 use16org1*4v1dw2 dup(?)org2*4v2dw2 dup( ?)org3*4v3dw2 dup( ?)org1000htttdb?stackpequ 2000hP255CWequ 20CHP255

25、A equ 200HP255B equ 204HP255C equ 208Hdata endscodesegme nt use16assumecs:code,ds:data,ss:dataorg 1100h start : nopmovax,0movds,ax movss,ax movsp,stackpini ti:moveax,60000000hmovcr0,eaxmovax,data movds,ax movss,ax movsp,stackp movcx,1000 i0: deccxjnz i0d8255 P255CW,80808080hi1: d8255 P255A,0c099c099

26、hd8255 P255B,0c0c0c0c0h ;40004000 d8255 P255C,0fafafafah ;綠 call del1d8255 P255C,0f5f5f5f5h call dell d8255 P255C,0f0f0f0f0h calldelld8255 P255C,0ffffffffh calldelld8255 P255A,8ef8c0c0h d8255 P255B,8E8ec0c0h d8255 P255C,0fafafafah calldelld8255 P255C,0f5f5f5f5h calldelld8255 P255C,0f0f0f0f0h calldel

27、ld8255 P255C,0ffffffffh calldellmovax,4000h moves,ax moveax,0chk:movbx,0000hmoves:bx,eax movdx,P255A out dx,eax nop nop movdx,P255B out dx,eax nop nop call del1 push eax moveax,0fafafafah movdx,P255C out dx,eax;紅;黃;滅;00007FFF;從4000: 0000單元開始寫;寫入的數(shù)據(jù)入棧;綠色call del1pop eax;出棧chk1: add bx,4;cmpbx,8000hjz

28、 chk2;寫滿8000H個內(nèi)存單元moves:bx,eaxjmP chk1;chk2: movbx,0fffchchk3: add bx,4cmpbx,8000hjz chkO cmpeax,es:bxjz chk3 movecx,eax moveax,0f5f5f5f5h movdx,P255Cout dx,eax moveax,ecxcall del1;把每個單元的數(shù)據(jù)讀出與寫入的;數(shù)據(jù)比較,是否正確;不正確,顏色變成紅色;延時;下一個寫入的數(shù)據(jù);延時chk0: add eax,01010101h cmpeax,0ffffffffhjz chk4 jmp chkchk4: jmp i1d

29、el1 procmovecx,8ffffh i2: dec ecxjnz i2ret endpcode endsend start實驗10.1 :(以key為原本改進(jìn)).486DATA SEGMENT AT 0 USE16ORG 1000HDATA ENDSCODE SEGMENT USE16ASSUME CS:CODEORG 3000HBEG: JMP STARTTAB DB 3FH,06H,5BH,4FH,66H,6DH,7DH,07HDB 7FH,6FHDPORT1 EQU 360HDPORT2 EQU 380HNUM DB 0001HCOUNT DD 00000FFFFHSTART:

30、MOV AX,DATAMOV DS,AXMOV CL,5KK:MOV AL,CLMOV BX,OFFSET TABXLAT TABMOV DXQPORT2OUT DX,ALNOPMOV DXQPORT1MOV AL,NUMOUT DX,ALNOPNOPROL NUM,1MOV COUNT,OOOOOFFFFHDELAY:NOPDEC COUNTJNZ DELAYJMP KKCODE ENDSEND BEG實驗10.2使顯示20115158.486DATA SEGMENT AT 0 USE16ORG 2000HBUF DD ?COUNT DB ?DB ?DATA ENDSCODE SEGMENT

31、 USE16ASSUME CS:CODE,DS:DATAORG 01000HBEG:JMP STARTTAB1DB0A4H,0F9H,92H,92HTAB2DB0C0H,0F9H,0F9H,80HRGDD050A050AHGRDD0A050A05HRYDD05000500HYRDD00050005HRRRRDD05050505HRGYRDD050A0005HSTART:MOV AX,DATAMOV DS,AXMOV DX,20CHMOV EAX,80808080HOUT DX,EAXNOPNOPL1:MOV DX,200HMOV EAX,DWORD PTR TAB1OUT DX,EAXMOV

32、BP,200L2:DEC BPJNZL2MOVDX,204HMOVEAX,DWORD PTR TAB2OUT DX,EAXMOV BP,200L3: DEC BPJNZL3MOVDX,208HMOVEAX,RGYROUT DX,EAXMOV BP,200L4:DECBPJNZL4HLTJMPL1CODE ENDSEND BEG三連實驗9;i8259.asm.486DATA SEGMENT USE16 AT 0ORG 40H*4V40HDW ?,?;保存中斷向量的變量OPORTEQU3A0H;8259的偶地址JPORTEQU3A8H;8259的奇地址TR8255EQU20CH;8255控制口地址

33、A8255EQU200H;8255A口地址B8255EQU204H;8255B口地址C8255EQU208H;8255C口地址ORG 1000HMMDD ?DATAENDSCODESEGMENT USE16ASSUME CS:CODE,DS:DATAORG 2000HBEG:CLIJMP STARTSTART: MOV AX,DATAMOVDS,AXMOVAX,0MOVSS,AXMOVSP,1000HMOVMM,0F5F5F5F5HMOVAL,80H;MOVDX,TR8255OUTDX,ALMOVAL,99HMOVDX,A8255OUTDX,ALMOVAL,5MOVDX,C8255OUTDX,

34、ALCALLWRITEVER初始化8255LLL:MOV AL,00010011BMOV DX,OPORTOUT DX,ALNOP寫 ICW1NOPMOVAL,01000000BMOVDX,JPORTOUTDX,ALNOPNOPMOVAL,00000001BMOVDX,JPORTOUTDX,ALNOPNOPMOVAL,11111100BMOVDX,JPORTOUTDX,ALSTIJLL:MOVSI,1;LL1:MOVCX,10000寫 ICW2寫 ICW4寫IMR等待中斷LL2:NOPLOOP LL2DEC SIJNZ LL1NOPNOPNOPNOPNOPNOPNOPNOPNOPJMP LLW

35、RITEVER PROC寫中斷向量中斷服務(wù)程序,顯示-SUCCESSPUSHAMOVBX, OFFSET SERVERMOVV40H,BXMOVAX,CSMOVV40H+2,AXPOPARETWRITEVERENDPSERVER PROCMOVEAX,92C6C1BFHMOVDX,A8255OUTDX,EAXMOVEAX,9286C692HMOVDX,B8255OUTDX,EAXMOVEAX,MMMOVDX,C8255OUTDX,EAXNOTEAXMOVMM,EAXMOVAL,20HMOVDX,OPORTOUTDX,ALIRETSERVER ENDPCODE ENDSEND BEG.486SE

36、GMENT USE16ASSUME CS:CODE CRGJMPCODE實驗11CCONBIT1EQU00010110BCCONBIT2EQU01010100BCCONBIT3EQU10010110BCDPORT1EQU300HCDPORT2EQU304HCDPORT3EQU308HCHDBIT1EQU08HCHDBIT2EQU04HSTART:NOPNOP;啟動延時MOVDX,CCONPORT;寫入控制字MOVAL,CCONBIT1OUT DX,AL NOPNOPMOVDX,CDPORT1;寫入初值MOVAL,CHDBIT1OUTNOPNOPDX,ALMOVDX,CCONPORT;寫入控制字

37、MOVAL,CCONBIT2OUTNOPNOPDX,ALMOVDX,CDPORT2;寫入初值1000H START30CHBEG:CCONPORTEQUMOV AL,CHDBIT1OUT DX,ALWT1:MOVDX,CCONPORTMOVAL,CCONBIT3OUTDX,ALNOPNOPMOVDX,CDPORT3MOVAL,CHDBIT2OUTDX,ALWT:NOPNOPNOP寫入控制字;寫入初值JMP WTCODEENDSEND BEG實驗13.486DATASEGMENT AT 0 USE16ORG1000HMMDB ?DATAENDSCODESEGMENT USE16ASSUME CS:CODE,DS:DATAORG2000HBEG:JMPSTARTTABDB0C0H,0F9HLENSEQU$-TABC8251EQU330HD8251EQU320HCCONPORTEQU30CHCCONBIT1EQU00010110BCCONBIT2EQU01010110BCCONBIT3EQU10010110BCDPORT1EQU300HCDPOR

溫馨提示

  • 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)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論