微机实验.docx
- 文档编号:17544234
- 上传时间:2023-07-26
- 格式:DOCX
- 页数:21
- 大小:16.19KB
微机实验.docx
《微机实验.docx》由会员分享,可在线阅读,更多相关《微机实验.docx(21页珍藏版)》请在冰点文库上搜索。
微机实验
微机实验
一.实验指导书
1.4
datasegment
tabledw10h,20h,30h,40h,50h
entrydw4
dataends
codesegment
assumecs:
code,ds:
data
start:
movax,data
movds,ax
leabx,table
addbx,entry
movax,[bx]
movah,4ch
int21h
codeends
endstart
2.1两个连续变量之和
a.
datasegment
adb5ch,85h
bdb43h,0abh
dataends
codesegment
assumecs:
code,ds:
data
start:
movax,date
movds,ax
movsi,0
moval,a[si]
addal,b[si]
mova[si],al
incsi
moval,a[si]
adcal,b[si]
mova[si],al
movah,4ch
int21h
codeends
endstart
b.定义字
datasegment
adw855ch
bdw0ab43h
dataends
codesegment
assumecs:
code,ds:
data
start:
movax,data
movds,ax
movbx,a
addbx,b
movwordptr[a],bx
movah,4ch
int21h
codeends
endstart
c.立即数
datasegment
adb5ch,85h
bdb43h,0abh
dataends
codesegment
assumecs:
code,ds:
data
start:
movax,date
movds,ax
moval,a
addal,b
mova,al
moval,a+1
adcal,b+1
mova+1,al
movah,4ch
int21h
codeends
endstart
2.2写2*(X+Y-50)/Z
datasegment
xdw0125h
ydw0035h
zdw0012h
org0040h
adw?
bdw?
dataends
codesegment
assumecs:
code,ds:
data
start:
movax,data
movds,ax
movax,x
addax,y
subax,50h
movbx,02h
imulbx
idivz
mova,ax
movb,dx
movah,4ch
int21h
codeends
endstart
2.3拆字
datasegment
org1000h
adw3678h
org4000h
bdb3dup(?
)
dataends
codesegment
assumecs:
code,ds:
data
start:
movax,data
movds,ax
movax,a
movb+1,ah
movb+2,al
movah,4ch
int21h
codeends
endstart
3.1大写换为小写
datasegment
stringdb'IaMaSTUDeNT'
lenequ$-string
dataends
codesegment
assumecs:
code,ds:
data
start:
movax,data
movds,ax
movsi,offsetstring
movcx,len
l0:
moval,[si]
incsi
cmpal,'A'
jbl1
cmpal,'Z'
jal1
addal,20h
jmpl1
l1:
movdl,al
movah,2h
int21h
loopl0
movah,4ch
int21h
codeends
endstart
3.3判断
a.
datasegment
string0db'else$'
string1db'number$'
string2db'bigletter$'
string3db'smallletter$'
dataends
codesegment
assumecs:
code,ds:
data
start:
movax,data
movds,ax
movah,01h
int21h
cmpal,'0'
jbl0
cmpal,'9'
jbel1
cmpal,'A'
jbl0
cmpal,'Z'
jbel2
cmpal,'a'
jbl0
cmpal,'z'
jbel3
jmpl0
l0:
leadx,string0
movah,09h
int21h
jmpexit
l1:
leadx,string1
movah,09h
int21h
jmpexit
l2:
leadx,string2
movah,09h
int21h
jmpexit
l3:
leadx,string3
movah,09h
int21h
jmpexit
exit:
movah,4ch
int21h
codeends
endstart
b.
datasegment
string1db'smallletter$'
string2db'bigletter$'
string3db'number$'
string4db'else$'
dataends
codesegment
assumecs:
code,ds:
data
start:
movax,data
movds,ax
movah,01h
int21h
cmpal,'Z'
jal1
cmpal,'A'
jbl1
leadx,string2
movah,09h
int21h
jmpexit
l1:
cmpal,'z'
jal2
cmpal,'a'
jbl2
leadx,string1
movah,09h
int21h
jmpexit
l2:
cmpal,'9'
jal3
cmpal,'0'
jbl3
leadx,string3
movah,09h
int21h
jmpexit
l3:
leadx,string4
movah,09h
int21h
exit:
movah,4ch
int21h
codeends
endstart
4.1反序输出
datasegment
Adb'1234567890'
nequ$-a
Bdbndup(?
)
dataends
codesegment
assumecs:
code,ds:
data,es:
data
start:
movax,data
movds,ax
moves,ax
leasi,a
leadi,b
adddi,n-1
movcx,n
move:
moval,[si]
moves:
[di],al
incsi
decdi
loopmove
movah,4ch
int21h
codeends
endstart
4.2数据传输
datasegment
org1000h
string1db100dup(12h)
nequ$-string1
org1050h
string2db100dup(?
)
dataends
codesegment
assumecs:
code,ds:
data
start:
movax,data
movds,ax
leasi,string1
leadi,string2
movcx,64h
cmpsi,di
jal1
adddi,n-1
addsi,n-1
l2:
movbl,[si]
mov[di],bl
decsi
decdi
loopl2
jmpexit
l1:
movbl,[si]
mov[di],bl
incsi
incdi
loopl1
exit:
movah,4ch
int21h
codeends
endstart
4.3最大数据
datasegment
Adb12h,09h,96h,95h,80h,33h,40h,20h,52h,71h
nequ$-A
dataends
codesegment
assumecs:
code,ds:
data
start:
movax,data
movds,ax
leasi,A
movcx,n-1
movbx,[si]
again:
incsi
cmp[si],bx
janext
deccx
cmpcx,0
jeexit
jmpagain
next:
movbx,[si]
deccx
cmpcx,0
jeexit
jmpagain
exit:
mov[si+1],bx
movah,4ch
int21h
codeends
endstart
6.1显示ASCII码
codesegment
assumecs:
code
start:
movah,08h
int21h
movbl,al
movcl,4h
shral,cl
addal,30h
movdl,al
movah,02h
int21h
andbl,0fh
cmpbl,9
jal1
addbl,30h
jmpl2
l1:
addbl,37h
movdl,bl
movah,02h
int21h
jmpexit
l2:
movdl,bl
movah,02h
int21h
exit:
movdl,68h
movah,02h
int21h
movah,4ch
int21h
codeends
endstart
6.2判断数字
datasegment
stringdb'Thisisnotanumber$'
dataends
codesegment
assumecs:
code,ds:
data
start:
movax,data
movds,ax
movah,08h
int21h
cmpal,'9'
jal0
cmpal,'0'
jbl0
movdl,ax
movah,02h
int21h
jmpexit
l0:
leadx,string
movah,09h
int21h
jmpexit
exit:
movah,4ch
int21h
codeends
endstart
二.课后习题
4.10小写换大写
datasegment
stringdb'IaMaSTUDeNT'
lenequ$-string
dataends
codesegment
assumecs:
code,ds:
data
start:
movax,data
movds,ax
movsi,offsetstring
movcx,len
l0:
moval,[si]
cmpal,'a'
jbl1
cmpal,'z'
jal1
subal,20h
mov[si],al
l1:
incsi
loopl0
movah,4ch
int21h
codeends
endstart
4.11完成(Z-(X*Y+200))/20
datasegment
xdw0125h
ydw0035h
zdw0012h
org0040h
vdw?
wdw?
dataends
codesegment
assumecs:
code,ds:
data
start:
movax,data
movds,ax
movax,x
movbx,y
imulbx
movcx,50
movbx,0
addax,cx
adcdx,bx
movcx,z
movbx,0
subcx,ax
sbbbx,dx
movbx,20
idivbx
movv,ax
movw,dx
movah,4ch
int21h
codeends
endstart
4.12取最大值和求平均值
datasegment
bufdw-1,3,24,94,62,72,55,0,-48,99
nequ($-buf)/2
maxdw?
avedb?
?
dataends
codesegment
assumecs:
code,ds:
data
start:
movax,data
movds,ax
leasi,buf
clc
xorax,ax
xordx,dx
movax,[si]
movcx,n
l0:
adcdx,[si]
cmpax,[si]
jgel1
movax,[si]
l1:
addsi,2
loopl0
movmax,ax
movbl,n
movax,dx
idivbl
movave,al
movave+1,ah
movah,4ch
int21h
codeends
endstart
4.14拆字拆成4部分
datasegment
adw1234h
dataends
codesegment
assumecs:
code,ds:
data
start:
movax,data
movds,ax
movax,a
movbx,ax
movdx,ax
movcl,4
shrah,cl
moval,ah
movbl,bh
andbl,0Fh
movdh,dl
shrdh,cl
movcl,dh
anddx,0Fh
movah,4ch
int21h
codeends
endstart
4.16找is的个数
datasegment
stringdb'Tomisagoodboy,ishe?
$'
nequ$-string
dataends
codesegment
assumecs:
code,ds:
data
start:
movax,data
movds,ax
leasi,string
movcx,n
movbl,00h
l0:
cmpbyteptr[si],'i'
jnenext
incsi
cmpbyteptr[si],'s'
jnenext
incbl
next:
incsi
loopl0
addbl,30h
movdl,bl
movah,02h
int21h
movah,4ch
int21h
codeends
endstart
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 微机 实验