汇编程序编写和提高Word格式文档下载.doc
《汇编程序编写和提高Word格式文档下载.doc》由会员分享,可在线阅读,更多相关《汇编程序编写和提高Word格式文档下载.doc(16页珍藏版)》请在冰豆网上搜索。
convert:
movah,1
int21h
cmpal,13
jzfinish
cmpal,'
a'
jbnext
z'
janext
subal,20h
jmpnext
next:
mov[si],al
incsi
jmpconvert
finish:
movdl,13
movah,2
int21h
movdl,10
movbyteptr[si],'
$'
leadx,buf
movah,9
MOVAH,4CH
INT21H
CODESENDS
ENDSTART
运行情况:
流程图:
2、将键盘上输入的十六进制数转换成十进制数,并在屏幕上显示。
DATASEGMENT
DATA1DB6DUP(?
),'
DATAENDS
CODESEGMENT
CODE,DS:
DATA
MOVAX,DATA
MOVDI,OFFSETDATA1+5
MOVBX,0
MOVCH,4
MOVCL,4
MOVSI,0AH
JUDGE:
MOVAH,01H
CMPAL,13
JETRANSPORT
CMPAL,30H
JBEXIT
CMPAL,39H
JBELAB
CMPAL,41H
CMPAL,46H
JBELAB1
CMPAL,61H
CMPAL,66H
JAEXIT
SUBAL,57H
JMPLAB2
LAB:
SUBAL,30H
JMPLAB2
LAB1:
SUBAL,37H
LAB2:
SHLBX,CL
ADDBL,AL
DECCH
JNZJUDGE
TRANSPORT:
MOVAX,BX
DISPLAY:
XORDX,DX
DIVSI
ADDDL,30H
MOV[DI],DL
DECDI
CMPAX,0
JNZDISPLAY
MOVAH,09H
INT21H
EXIT:
CODEENDS
3、利用中断调用,在屏幕上显示1—9之间随机数。
中断号86H
程序如下:
此处输入数据段代码
ASSUMECS:
MOVAX,DATAS
MOVDS,AX
callsetInt86
int86h
MOVAH,4CH
INT21H
setInt86proc
movax,cs
movds,ax
movsi,offsetdo0
movax,0
moves,ax
movdi,200h
movcx,offsetdo0end-offsetdo0
cld
repmovsb
movwordptres:
[86h*4],200h
[86h*4+2],0
ret
setInt86endp
do0:
MOVAH,0
INT1AH;
读取当前时间CH:
CL=时:
分
MOVAL,DL;
DH:
DL=秒:
1/100秒
MOVBL,9
DIVBL
INCAH
MOVDL,AH
ADDDL,30H
MOVAH,2
do0end:
nop
ENDSTART
4、键盘输入10个学生的成绩,编写一个程序统计60-69分,70-79分,80-89分,90-99分及100分的人数,分别存放在Score6,Score7,Score8,Score9和Score10单元中。
【输入10个学生的成绩如下】
659878828895726290100
datassegment
sentencedb0DH,0AH,'
theresult$'
gradedw76,69,84,90,73,88,99,63,100,80
score6db0
score7db0
score8db0
score9db0
score10db0
datasends
stackssegment
stacksends
codessegment
assumecs:
codes,ds:
datas
start:
movax,datas
movds,ax
movcx,10
callcount
calldisp
movah,4ch
int21h
countprocnear
movsi,0
movax,grade[si]
movbl,10
divbl
movbl,al
movbh,0
subbx,6
cmpbx,0
jaenext1
next1:
incscore6[bx]
addsi,2
loopnext
ret
countendp
dispprocnear
leasi,score6
movcx,5
loop1:
movdx,OFFSETsentence
movah,9
int21h
movdl,[si]
adddl,30h
movah,2
incsi
looploop1
dispendp
codesends
endstart
效果如下: