微机原理程序.docx
- 文档编号:12630265
- 上传时间:2023-04-21
- 格式:DOCX
- 页数:33
- 大小:18.22KB
微机原理程序.docx
《微机原理程序.docx》由会员分享,可在线阅读,更多相关《微机原理程序.docx(33页珍藏版)》请在冰豆网上搜索。
微机原理程序
Documentserialnumber【UU89WT-UU98YT-UU8CB-UUUT-UUT108】
微机原理程序
实验二:
循环程序设计
2.
DATASEGMENT
xdb-78,127,-128,-125,88
ydb32,-43,76,95,1
Sdb5dup(?
)
dataends
Codesegment
Assumecs:
code,ds:
data
Start:
movax,data
Movds,ax
Movcx,5
Movbx,0
L1:
moval,x[bx]
Addal,y[bx]
Incbx
LoopL1
MOVAH,4CH
INT21H
CODEENDS
ENDSTART
3.
DATASEGMENT
YDB68H,24H,90H,57H,13H
HXDB67H,34H,12H,90H,57H
SDB5DUP(?
)
DATAENDS
CODESEGMENT
ASSUMECS:
CODE,DS:
DATA
START:
MOVAX,DATA
MOVDS,AX
MOVCX,5
MOVSI,OFFSETX
MOVDI,OFFSETY
LP:
MOVAL,[SI]
MOVAH,[DI]
ADCAL,AH
DAA
MOVS[SI],AL
INCSI
INCDI
LOOPLP
MOVAH,4CH
INT21H
CODEENDS
ENDSTART
4.
DATASEGMENT
LISTDB0,1,2,3,4,5,6,7,8,9
COUNTEQU$-LIST
DATAENDS
CODESEGMENT
ASSUMECS:
CODE,DS:
DATA
START:
MOVAX,DATA
MOVDS,AX
MOVCX,COUNT-1
LOOP1:
MOVDX,CX
MOVBX,0
LOOP2:
MOVAX,LIST[BX]
CMPAX,LIST[BX+1]
MOVLIST[BX],AX
LOOP3:
INCBX
LOOPLOOP2
MOVCX,DX
LOOPLOOP1
MOVAX,4CH
INT21H
CODEENDS
ENDSTART
实验三:
子程序调用程序设计
DATASEGMENT
NUMDB85,77,126,-1,-43,37,-128,11,-19,13
DATAENDS
ADDITIONSEGMENT
NUM1DB10DUP(?
)
ADDITIONENDS
CODESEGMENT
ASSUMECS:
CODE,DS:
DATA,ES:
ADDITION
START:
AX,DATA
MOVDS,AX
MOVAX,ADDITION
MOVES,AX
CALLORDER
CALLCOPY
MOVAH,4CH
INT21H
ORDERPROC
MOVCX,9
LP2:
MOVBX,0
MOVDX,CX
LP1:
MOVAL,NUM[BX]
CMPAL,NUM[BX+1]
JLENEXT
XCHGAL,NUM[BX+1]
MOVNUM[BX],AL
NEXT:
ADDBX,1
DECDX
JNZLP1
LOOPLP2
RET
ORDERENDP
COPYPROC
MOVCX,10
MOVBX,0
LP:
MOVAL,NUM[BX]
MOVES:
NUM1[BX],AL
INCBX
LOOPLP
RET
COPYENDP
CODEENDS
ENDSTART
实验四:
DOS功能系统调用
1.
DATASEGMENT
DUFDB10DUP(?
)
DATAENDS
STACKSEGMENT
SADB100DUP(?
)
TOPLABELWORD
STACKENDS
CODESEGMENT
ASSUMEDS:
DATA,CS:
CODE,SS:
STACK
START:
MOVAX,STACK
MOVSS,AX
MOVSP,OFFSETTOP
PUSHDS
SUBAX,AX
PUSHAX
MOVAX,DATA
MOVDS,AX
MOVCX,05H
MOVAL,0
S1:
MOVAH,1
INT21H
PUSHAX
LOOPS1
MOVDL,0DH
MOVAH,02H
INT21H
MOVDL,0AH
MOVAH,02H
INT21H
MOVCX,05H
MOVBX,4
S2:
POPAX
MOVDUF[BX],AL
DECBX
LOOPS2
MOVBX,0
MOVCX,05H
S3:
MOVDL,DUF[BX]
INCBX
MOVAH,2
INT21H
LOOP3
INCAL
MOVAH,4CH
INT21H
CODEENDS
ENDSTART
2.
DATASEGMENT
BUFFDB50
DB‘?
’
LETTERDB50DUP(‘?
’)
DATAENDS
CODESEGMENT
ASSUMECS:
CODE,DS:
DATA
START:
MOVAX,DATA
MOVDS,AX
LEADX,BUFF
MOVAH,0AH
INT21H
MOVDL,0DH
MOVAH,02H
INT21H
MOVDL,OAH
MOVAH,02H
INT21H
LEADX,LETTER
MOVAH,09H
INT21H
MOVAH,4CH
INT21H
CODEENDS
ENDSTART
第五次实验:
接口预备知识
DATASEGMENT
OUTBUFDB’5’,’4’,’3’,’2’,’1’
COUNTEQU$-COUNT
DATAENDS
CODESEGMENT
ASSUMECS:
CODE,DS:
DATA
START:
MOVAX,DATA
MOVDS,AX
MOVSI,OFFSETOUTBUF
MOVDI,COUNT
NEXT:
MOVDL,[SI]
MOVAH,02H
INT21H
CALLDELAY
INCSI
DECDI
JNZNEXT
MOVAH,4CH
INT21H
DELAYPROCNEAR
PUSHCX
MOVBX,299H
FOR1:
MOVCX,0FFFFH
FOR2:
LOOPFOR2
DECBX
JNZFOR1
POPCX
RET
DELAYENDP
CODEENDS
ENDSTART
第六次实验:
简单的输出接口
1.
CODESEGMENT
ASSUMECS:
CODE
start:
movdi,2
l1:
moval,02h
movdx,280h
outdx,al
calldelay
moval,00h
movdx,280h
outdx,al
calldelay
movsi,3
l2:
moval,04h
movdx,280h
outdx,al
calldelay
moval,00h
movdx,280h
outdx,al
calldelay
decsi
jnzl2
moval,08h
movdx,280h
outdx,al
calldelay
moval,00h
movdx,280h
outdx,al
calldelay
decdi
jnzl1
MOVAH,4CH
INT21H
DELAYPROCNEAR
PUSHCX
MOVBX,100H
FOR1:
MOVCX,0FFFFH
FOR2:
LOOPFOR2
DECBX
JNZFOR1
POPCX
RET
DELAYENDP
CODEENDS
ENDSTART
2.
CODESEGMENT
ASSUMECS:
CODE
START:
MOVCX,2
AA:
MOVBX,8
PUSHCX
MOVDX,280H
MOVAL,01H
BB:
OUTDX,AL
CALLDELAY
MOVDX,280H
ROlAL,1
OUTDX,AL
DECBX
JNZBB
POPCX
MOVDX,280H
movAL,00h
OUTDX,AL
LOOPAA
MOVAH,4CH
INT21H
DELAYPROCNEAR
PUSHBX
PUSHCX
MOVBX,299H
FOR:
MOVCX,0FFFFH
FOR1:
LOOPFOR1
DECBX
JNZFOR
POPCX
POPBX
RET
DELAYENDP
CODEENDS
ENDSTART
第七次实验:
简单的输入接口
1.
datasegment
xdb'end$'
dataends
codesegment
assumecs:
code,ds:
data
start:
movax,data
movds,ax
movcx,6
movdl,31h
lp:
pushdx
movdx,280h
inal,dx
andal,10h
movbl,al
lp1:
inal,dx
andal,10h
cmpbl,al
jzlp1
movdl,0ah
movah,02h
int21h
movdl,0dh
int21h
popdx
int21h
incdx
looplp
movdl,0ah
int21h
movdl,0dh
int21h
movdx,offsetx
movah,09h
int21h
movah,4ch
int21h
codeends
endstart
2.
datasegment
xdb'end$'
dataends
codesegment
assumecs:
code,ds:
data
start:
movax,data
movds,ax
movcx,6
movdl,31h
lp:
pushdx
movdx,280h
inal,dx
pushcx
movcx,2
lp1:
andal,10h
movbl,al
lp2:
inal,dx
andal,10h
cmpbl,al
jzlp2
looplp1
popcx
movdl,0ah
movah,02h
int21h
movdl,0dh
int21h
popdx
int21h
incdx
looplp
movdl,0ah
int21h
movdl,0dh
int21h
movdx,offsetx
movah,09h
int21h
movah,4ch
int21h
codeends
endstart
第八次实验:
数码管动态显示实验
1.
CODESEGMENT
ASSUMECS:
CODE
START:
MOVCX,03FFH
L1:
MOVDX,280H
MOVAL,00H
OUTDX,AL
MOVDX,290H
MOVAL,76H;H
OUTDX,AL
MOVDX,282H
MOVAL,02H
OUTDX,AL
CALLDONG
MOVDX,282H
MOVAL,00H
OUTDX,AL
MOVDX,290H
MOVAL,73H;P
OUTDX,AL
MOVDX,280H
MOVAL,01H
OUTDX,AL
CALLDONG
LOOPL1
MOVDX,280H
MOVAL,00H
OUTDX,AL
MOVAH,4CH
INT21H
DONGPROCNEAR
PUSHCX
PUSHBX
MOVBX,0100H
FOR1:
MOVCX,0100H
FOR2:
LOOPFOR2
DECBX
JNZFOR1
POPBX
POPCX
RET
DONGENDP
CODEENDS
ENDSTART
2.
CODESEGMENT
ASSUMECS:
CODE
START:
MOVCX,01FFH
L1:
MOVDX,280H
MOVAL,00H
OUTDX,AL
MOVDX,290H
MOVAL,3FH;0
OUTDX,AL
MOVDX,282H
MOVAL,02H
OUTDX,AL
CALLDONG
MOVDX,282H
MOVAL,00H
OUTDX,AL
MOVDX,290H
MOVAL,06H;1
OUTDX,AL
MOVDX,280H
MOVAL,01H
OUTDX,AL
CALLDONG
LOOPL1
MOVCX,01FFH
L2:
MOVDX,280H
MOVAL,00H
OUTDX,AL
MOVDX,290H
MOVAL,5BH;2
OUTDX,AL
MOVDX,282H
MOVAL,02H
OUTDX,AL
CALLDONG
MOVDX,282H
MOVAL,00H
OUTDX,AL
MOVDX,290H
MOVAL,4FH;3
OUTDX,AL
MOVDX,280H
MOVAL,01H
OUTDX,AL
CALLDONG
LOOPL2
MOVCX,010FH
L3:
MOVDX,280H
MOVAL,00H
OUTDX,AL
MOVDX,290H
MOVAL,66H;4
OUTDX,AL
MOVDX,282H
MOVAL,02H
OUTDX,AL
CALLDONG
MOVDX,282H
MOVAL,00H
OUTDX,AL
MOVDX,290H
MOVAL,6DH;5
OUTDX,AL
MOVDX,280H
MOVAL,01H
OUTDX,AL
CALLDONG
LOOPL3
MOVCX,010FH
L4:
MOVDX,280H
MOVAL,00H
OUTDX,AL
MOVDX,290H
MOVAL,7DH;6
OUTDX,AL
MOVDX,282H
MOVAL,02H
OUTDX,AL
CALLDONG
MOVDX,282H
MOVAL,00H
OUTDX,AL
MOVDX,290H
MOVAL,07H;7
OUTDX,AL
MOVDX,280H
MOVAL,01H
OUTDX,AL
CALLDONG
LOOPL4
MOVCX,010FH
L5:
MOVDX,280H
MOVAL,00H
OUTDX,AL
MOVDX,290H
MOVAL,7FH;8
OUTDX,AL
MOVDX,282H
MOVAL,02H
OUTDX,AL
CALLDONG
MOVDX,282H
MOVAL,00H
OUTDX,AL
MOVDX,290H
MOVAL,6FH;9
OUTDX,AL
MOVDX,280H
MOVAL,01H
OUTDX,AL
CALLDONG
LOOPL5
MOVDX,280H
MOVAL,00H
OUTDX,AL
MOVAH,4CH
INT21H
DONGPROCNEAR
PUSHCX
PUSHBX
MOVBX,0100H
FOR1:
MOVCX,0100H
FOR2:
LOOPFOR2
DECBX
JNZFOR1
POPBX
POPCX
RET
DONGENDP
CODEENDS
ENDSTART
第九次实验:
可编程并行接口8255实验
1.
codesegment
assumecs:
code
start:
movdx,283h
moval,90h
outdx,al
movdx,280h
inal,dx
andal,01h
cmpal,01H
movcx,3
movdx,281h
jnzl2
l1:
moval,01h
outdx,al
calldelay
moval,02h
outdx,al
calldelay
moval,04h
outdx,al
calldelay
moval,08h
outdx,al
calldelay
loopl1
moval,00h
outdx,al
jmpl3
l2:
moval,0f0h
outdx,al
calldelay
moval,000h
outdx,al
calldelay
loopl2
moval,00h
outdx,al
l3:
movah,4ch
int21h
delayprocnear
PUSHCX
PUSHBX
MOVBX,0200H
FOR3:
MOVCX,0FFFFH
FOR4:
LOOPFOR4
DECBX
JNZFOR3
POPBX
POPCX
RET
delayendp
coedends
endstart
2.
CODESEGMENT
ASSUMECS:
CODE
START:
MOVAL,10110100B
MOVDX,283H
OUTDX,AL
L1:
MOVDX,282H;C口端口号,检验C口的pc4是否为高电平,高电平则输入
INAL,DX
ANDAL,20H
JZL1
MOVDX,280H;A口端口号,读入数据
INAL,DX
CALLDELAY
MOVDX,281H;B口端口号,输出至A口
OUTDX,AL
L2:
MOVDX,282H
INAL,DX
ANDAL,02H;判断输出缓冲器是否满,满就等待,不满程序结束
JZL2
JMPL3
LOOPSTART
L3:
MOVAL,00
MOVDX,280H
OUTDX,AL
MOVAH,4CH
INT21H
DELAYPROCNEAR
PUSHCX
MOVBX,0f00H
FOR1:
MOVCX,0FFFFH
FOR2:
LOOPFOR2
DECBX
JNZFOR1
POPCX
RET
DELAYENDP
CODEENDS
ENDSTART
实验十:
可编程计数器/定时器8253实验
1.
CODESEGMENT
ASSUMECS:
CODE
START:
movdx,283h
moval,10h
outdx,al
movdx,280h
moval,04h
outdx,al
calldelay
movdx,280h
inal,dx
movdl,al
adddl,30h
movah,2
int21h
;jmpstart
movah,4ch
int21h
delayprocnear
pushcx
movbx,1000h
for1:
movcx,0ffffh
for2:
loopfor2
decbx
jnzfor1
popcx
ret
delayends
endstart
codeends
2.
CODESEGMENT
ASSUMECS:
CODE
START:
movdx,283h
moval,52h
outdx,al
movdx,281h
moval,05h
outdx,al
movah,4ch
int21h
endstart
codeends
实验十一:
DATASEGMENT
ABCDB'AREYOUREADY?
',0DH,0AH,'$'
CCCDB'IRQ10INTERRUPTNOW!
',0DH,0AH,'$'
DATAENDS
CODESEGMENT
ASSUMECS:
CODE,DS:
DATA
START:
MOVAX,CS
MOVDS,AX
MOVDX,OFFSETZD10
MOVAX,2572H
INT21H
CLI
INAL,21H
ANDAL,0FBH
OUT21H,AL
INAL,0A1H
ANDAL,0FBH
OUT0A1H,AL
STI
MOVCX,20
LOOP1:
PUSHCX
MOVAX,DATA
MOVDS,AX
LEADX,ABC
MOVAH,9
INT21H
CALLDELAY
POPCX
LOOPLOOP1
MOVDX,21H
INAL,DX
ORAL,4
OUT21H,AL
MOVDX,0A1H
INAL,DX
ORAL,4
OUT0A1H,AL
MOVAH,4CH
INT21H
ZD10PROCNEAR
PUSHAX
PUSHBX
PUSHCX
PUSHDX
MOVCX,5
AGAIN:
PUSHCX
LEADX,CCC
MOVAH,9
INT21H
CALLDELAY
POPCX
LOOPAGAIN
POPDX
POPCX
POPBX
POPAX
MOVAL,20H
OUT20H,AL
MOVAL,20H
OUT0A0H,AL
IRET
ZD10ENDP
DELAYPROCNEAR
MOVBX,02FFH
FOR1:
MOVCX,0FFFFH
FOR2:
LOOPFOR2
DECBX
JNZFOR1
RET
DELAYENDP
CODEENDS
ENDS
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 微机 原理 程序