微原软件实验报告.docx

上传人:b****0 文档编号:16847060 上传时间:2023-07-19 格式:DOCX 页数:29 大小:190.53KB
下载 相关 举报
微原软件实验报告.docx_第1页
第1页 / 共29页
微原软件实验报告.docx_第2页
第2页 / 共29页
微原软件实验报告.docx_第3页
第3页 / 共29页
微原软件实验报告.docx_第4页
第4页 / 共29页
微原软件实验报告.docx_第5页
第5页 / 共29页
微原软件实验报告.docx_第6页
第6页 / 共29页
微原软件实验报告.docx_第7页
第7页 / 共29页
微原软件实验报告.docx_第8页
第8页 / 共29页
微原软件实验报告.docx_第9页
第9页 / 共29页
微原软件实验报告.docx_第10页
第10页 / 共29页
微原软件实验报告.docx_第11页
第11页 / 共29页
微原软件实验报告.docx_第12页
第12页 / 共29页
微原软件实验报告.docx_第13页
第13页 / 共29页
微原软件实验报告.docx_第14页
第14页 / 共29页
微原软件实验报告.docx_第15页
第15页 / 共29页
微原软件实验报告.docx_第16页
第16页 / 共29页
微原软件实验报告.docx_第17页
第17页 / 共29页
微原软件实验报告.docx_第18页
第18页 / 共29页
微原软件实验报告.docx_第19页
第19页 / 共29页
微原软件实验报告.docx_第20页
第20页 / 共29页
亲,该文档总共29页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

微原软件实验报告.docx

《微原软件实验报告.docx》由会员分享,可在线阅读,更多相关《微原软件实验报告.docx(29页珍藏版)》请在冰点文库上搜索。

微原软件实验报告.docx

微原软件实验报告

微原软件实验报告

 

班级:

2011211116班

学号:

2011210459

姓名:

张乾

 

实验二分支,循环程序设计

一.实验目的:

1.开始独立进行汇编语言程序设计;

2.掌握基本分支,循环程序设计;

3.掌握最简单的DOS功能调用.

二.实验内容:

1.安排一个数据区,内存有若干个正数,负数和零.每类数的个数都不超过9.

2.编写一个程序统计数据区中正数,负数和零的个数.

3.将统计结果在屏幕上显示.

No

No

结果显示

代码:

datasegment

buffdw11,22,3,0,-22,-11,-9,15,-127,0,-5

countequ$-buff

zerodb?

maxdb?

mindb?

string1db'zheng:

','$'

string2db'fu:

','$'

string3db'zero:

','$'

dataends

stacksegmentstack'stack'

db100dup(?

stackends

codesegment

assumecs:

code,ds:

data,ss:

stack

begin:

xorax,ax

movax,data

movds,ax

movcx,count

shrcx,1

movdx,0

movah,0

movbx,offsetbuff

again:

cmpwordptr[bx],0

jgeplu

incah

jmpnext

plu:

jzzer

incdl

jmpnext

zer:

incdh

next:

incbx

incbx

loopagain

movmax,dl

movzero,dh

movmin,ah

calldisplay1

calldisplay2

calldisplay3

movax,4c00h

int21h

display1procnear;显示大于0的数

pushdx

movah,09h

movdx,segstring1

movds,dx

movdx,offsetstring1

int21h

moval,max

addal,'0'-0h

movah,02h

movdl,al

int21h

movdl,0ah

int21h

popdx

ret

display1endp

display2procnear;显示小于0的数

pushdx

movah,09h

movdx,segstring2

movds,dx

movdx,offsetstring2

int21h

moval,min

addal,'0'-0h

movah,02h

movdl,al

int21h

movdl,0ah

int21h

popdx

ret

display2endp

display3procnear;显示等于0的数

pushdx

movah,09h

movdx,segstring3

movds,dx

movdx,offsetstring3

int21h

moval,zero

addal,'0'-0h

movah,02h

movdl,al

int21h

movdl,0ah

int21h

popdx

ret

display3endp

codeends

endbegin

截图显示:

心得体会:

B实验并不是太难,课本上的循环那节就有类似的判断分支代码,程序也比较简单清晰,唯一需要添加的是调用子程序,DOS显示功能,整个编代码过程不算太复杂。

实验三代码转换程序设计

一.实验目的:

1.掌握几种最基本的代码转换方法;

2.运用子程序进行程序设计.

二.实验内容:

1.从键盘上输入若干两位十进制数,寻找其中的最小值,然后在屏幕上显示出来.

2.两个十进制数之间的分隔符,输入结束标志自定,但要在报告中说明.

3.对输入要有检错措施,以防止非法字符输入,并有适当的提示.

4.将整个程序分解为若干模块,分别用子程序实现.在报告中要给出模块层次图.

错误输入数字正确

代码:

datasegment

minhdb9

minldb9

number1db100(?

number2db100(?

errordb'inputerror',0dh,0ah,'$'

welcomedb'letusprintthenumber',0dh,0ah,'$'

dataends

stacksegmentstack'stack'

db100dup(?

stackends

codesegment

assumecs:

code,ds:

data,ss:

stack

start:

xorbx,bx

xorcx,cx

movax,data

movds,ax

movsi,offsetnumber1

movdi,offsetnumber2

callwel

loop1:

callget1

cmpbl,01

jzstart

loop2:

mov[si],al

callget2

cmpbl,02

jzstart

incsi

incdi

callget3

cmpal,0dh

jzover

cmpal,41h

jza

cmpal,'0'

jbstart

cmpal,'9'

jbeloop2

jmpstart

over:

movah,02h

movdl,0dh

int21h

movdl,0ah

int21h

callsort

movsi,offsetnumber1

movdi,offsetnumber2

movah,02h

show:

movdl,[si]

int21h

movdl,[di]

int21h

movdl,0dh

int21h

movdl,0ah

int21h

incsi

incdi

loopshow

a:

movax,4c00h

int21h

welprocnear

movah,09h

movdx,segwelcome

movds,dx

movdx,offsetwelcome

int21h

ret

welendp

get1procnear

movah,01h

int21h

cmpal,'0'

jberror1

cmpal,'9'

jaerror1

jmpendpp

error1:

movbl,01h

movah,09h

movdx,segerror

movds,dx

movdx,offseterror

int21h

endpp:

ret

get1endp

get2procnear

movah,01h

int21h

cmpal,'0'

jberror2

cmpal,'9'

jaerror2

mov[di],al

movah,02h

movdl,','

int21h

inccx

jmpendpp1

error2:

movbl,02h

movah,09h

movdx,segerror

movds,dx

movdx,offseterror

int21h

endpp1:

ret

get2endp

get3procnear

movah,01h

int21h

ret

get3endp

sortprocnear

pushcx

pushbx

pushax

movbl,cl

moval,cl

st1:

movcl,al

movsi,offsetnumber1

movdi,offsetnumber2

st2:

movah,[si]

movbh,[si+1]

cmpah,bh

jbexch

jalast

movah,[di]

movbh,[di+1]

cmpah,bh

jbexch

jmplast

exch:

movah,[si]

movbh,[si+1]

xchgah,bh

mov[si],ah

mov[si+1],bh

movah,[di]

movbh,[di+1]

xchgah,bh

mov[di],ah

mov[di+1],bh

last:

incsi

incdi

loopst2

decbx

cmpbl,0

jast1

popax

popbx

popcx

ret

sortendp

codeends

endstart

截图:

心得与体会:

这次代码感觉挺复杂的

首先是输入的输入的选择,刚开始是想通过串输入进行输入,是挺直接,但是检错的步骤就不好完成,造成后续很多冗余的判断过程。

所以我选择了字节的输入,成绩一位一位的进行输入,一共用到了三个输入子程序,联合在一起完成数字的输入,成绩的判断大小并不难,将两个字节组成的数字十位个位进行比较来判断大小,再更新最小数字的存储,唯一需要注意的是键盘的输入是ASCII码,得需要我们的转化。

整个编代码过程挺麻烦的,想代码,改正,调试都用了不少的时间,最后出来结果也少不了同学的指导,虽然代码有些复杂但是对汇编语言的学习与理解有着很大的帮助

实验四子程序设计

一.实验目的:

1.进一步掌握子程序设计方法;

2.进一步掌握基本的DOS功能调用.

二.实验内容:

1.从键盘上输入某班学生的某科目成绩.输入按学生的学号由小到大的顺序输入.

2.统计检查每个学生的名次.

3.将统计结果在屏幕上显示.

4.为便于观察,输入学生数目不宜太多,以不超过一屏为宜.输出应便于阅读.尽可

能考虑美观.

5.输入要有检错手段.

 

流程图

输入错误输入正确

代码:

datasegment

minhdb9

minldb9

number1db100(?

number2db100(?

errordb'inputerror',0dh,0ah,'$'

welcomedb'letusprintthemark',0dh,0ah,'$'

dataends

stacksegmentstack'stack'

db100dup(?

stackends

codesegment

assumecs:

code,ds:

data,ss:

stack

start:

xorbx,bx

xorcx,cx

movax,data

movds,ax

movsi,offsetnumber1

movdi,offsetnumber2

callwel

loop1:

callget1

cmpbl,01

jzstart

loop2:

mov[si],al

callget2

cmpbl,02

jzstart

incsi

incdi

callget3

cmpal,0dh

jzover

cmpal,41h

jza

cmpal,'0'

jbstart

cmpal,'9'

jbeloop2

jmpstart

over:

movah,02h

movdl,0dh

int21h

movdl,0ah

int21h

callsort

movsi,offsetnumber1

movdi,offsetnumber2

movah,02h

show:

movdl,[si]

int21h

movdl,[di]

int21h

movdl,0dh

int21h

movdl,0ah

int21h

incsi

incdi

loopshow

a:

movax,4c00h

int21h

welprocnear

movah,09h

movdx,segwelcome

movds,dx

movdx,offsetwelcome

int21h

ret

welendp

get1procnear

movah,01h

int21h

cmpal,'0'

jberror1

cmpal,'9'

jaerror1

jmpendpp

error1:

movbl,01h

movah,09h

movdx,segerror

movds,dx

movdx,offseterror

int21h

endpp:

ret

get1endp

get2procnear

movah,01h

int21h

cmpal,'0'

jberror2

cmpal,'9'

jaerror2

mov[di],al

movah,02h

movdl,','

int21h

inccx

jmpendpp1

error2:

movbl,02h

movah,09h

movdx,segerror

movds,dx

movdx,offseterror

int21h

endpp1:

ret

get2endp

get3procnear

movah,01h

int21h

ret

get3endp

sortprocnear

pushcx

pushbx

pushax

movbl,cl

moval,cl

st1:

movcl,al

movsi,offsetnumber1

movdi,offsetnumber2

st2:

movah,[si]

movbh,[si+1]

cmpah,bh

jbexch

jalast

movah,[di]

movbh,[di+1]

cmpah,bh

jbexch

jmplast

exch:

movah,[si]

movbh,[si+1]

xchgah,bh

mov[si],ah

mov[si+1],bh

movah,[di]

movbh,[di+1]

xchgah,bh

mov[di],ah

mov[di+1],bh

last:

incsi

incdi

loopst2

decbx

cmpbl,0

jast1

popax

popbx

popcx

ret

sortendp

codeends

endstart

截图:

心得与体会:

这次的实验比上次还要难了许多,但是有上次的输入程序做铺垫,输入程序倒是没花很大的劲,主要的难点集中在排序上,没有现有的程序,得通过自己的汇编语言进行排序,与二年级上学期的数据结构排序形成了很好的联系,通过把排序子程序编出其他的都迎刃而解。

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > PPT模板 > 商务科技

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2