- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
川师汇编实验十二
实验编号: 四川师大 实验报告 2015 年 12月 24 日
计算机科学学院2014 级 3 班 实验名称:IBM-PC汇编语言程序设计
实验_十二__ 子程序设计实验__
实验目的及要求
掌握子程序设计方法
掌握汇编语言程序上机过程和调试方法
实验内容
参考主程序流程图编写完整程序,完成以下功能:
在一个字符串中查找某字符,记录该字符出现的次数并以十六进制形式显示。要求:待查找字符从键盘输入;查找字符并统计次数用子程序coun实现;以十六进制形式显示次数用子程序disp实现。
实验主要流程、基本操作或核心代码、算法片段(该部分如不够填写,请另加附页)
data segment
maxlen db 40
n db ?
teble db 40 dup(?)
char db a ;查找字符A
even
addr dw 3 dup(?)
data ends
code segment
assume cs:code, ds:data
main proc far
start:
push ds
mov ax,0
push ax
mov ax,data
mov ds,ax
lea dx,maxlen
mov ah,0ah
int 21h ;从键盘接受字符串
mov addr,offset table
mov addr+2,offset n
mov addr+4,offset char
mov bx,offset addr ;通过地址表传送变量地址
call count ;计算CHAR的出现次数
call display ;显示
ret
main endp
count proc near ;count子程序
push si
push di
push ax
push cx
mov di,[bx]
mov si,[bx+2]
mov cl,byte ptr[si]
mov ch,0
mov si,[bx+4]
mov al,byte ptr[si]
mov bx,0
again:
cmp al,byte ptr[di]
jne l1
inc bx
l1:inc di
loop again
pop cx
pop ax
pop di
pop si
ret
count endp
display proc near ;display子程序
call crlf ;显示回车和换行
mov dl,char
mov ah,2
int 21h
mov dl,20h
mov ah,2
int 21h
mov al,bl
and al,0fh
add al,30h
cmp al,3ah
jl print
add al,7
print:
mov dl,al
int 12h
call crlf
ret
display endp
crlf proc near ;crlf子程序
mov dl,0dh
mov ah,2
int 21h
mov dl,0ah
mov ah,2
int 21h
ret
crlf endp
code ends
end start
实验结果的分析与评价(该部分如不够填写,请另加附页)
注:实验成绩等级分为(90-100分)优,(80-89分)良,(70-79分)中,(60
您可能关注的文档
- on the high school english words memory method(在高中英语单词记忆方法).doc
- on the high school english writing ability(高中英语写作能力).doc
- on the hard-line groups carbide brazing sheet business competitive strategy(在强硬派组织硬质合金钎焊板业务竞争战略).doc
- on the high school geography classroom instruction optimization(在高中地理课堂教学的优化).doc
- on the high school history classroom management errors(高中历史课堂管理上的错误).doc
- on the high school history curriculum and the local history of teachers college course system(在高中历史课程和地方师范学院课程体系的历史).doc
- on the high school language classroom methods stimulated interest(在高中语言课堂方法激发兴趣).doc
- on the high school geography learning(在高中地理学习).doc
- on the high school biology teaching how to play the main role of the(在高中生物教学如何发挥主要的作用).doc
- on the high school language teaching in the importance of strengthening the discussion session(在高中外语教学的重要性,加强讨论会议).doc
文档评论(0)