微机原理 冒泡排序实验报告含源程序

上传人:豆浆 文档编号:823278 上传时间:2017-05-16 格式:DOCX 页数:7 大小:63.81KB
返回 下载 相关 举报
微机原理 冒泡排序实验报告含源程序_第1页
第1页 / 共7页
微机原理 冒泡排序实验报告含源程序_第2页
第2页 / 共7页
微机原理 冒泡排序实验报告含源程序_第3页
第3页 / 共7页
微机原理 冒泡排序实验报告含源程序_第4页
第4页 / 共7页
微机原理 冒泡排序实验报告含源程序_第5页
第5页 / 共7页
点击查看更多>>
资源描述

《微机原理 冒泡排序实验报告含源程序》由会员分享,可在线阅读,更多相关《微机原理 冒泡排序实验报告含源程序(7页珍藏版)》请在金锄头文库上搜索。

1、实 验 报 告实验名称_ _冒泡排序实验 _课程名称_ _ _微机原理_院 系 部: 控计学院 专业班级:信安 1101学生姓名:陈茹君 学 号:1111290106同 组 人: 实验台号:18指导教师:闫江毓 成 绩: 实验日期:2014 年 5月 9日华北电力大学一、 实验目的掌握用汇编语言编写气泡排序程序的思路和方法,掌握字符和数据的显示方法。二、 实验内容从键盘输入 5 个有符号 2 位十进制数,将它转换成有符号二进制数,将结果送入内存中 buff 开始的单元中。 将这些数从大到小排序,并将排序结果显示在屏幕上。三、 实验步骤1. 算法设计1) 问题分析键盘输入子程序 inword 出

2、口: buff 开始的单元,CX排序子程序 sort: 入口:buff 开始的单元,CX;出口:buff 开始的单元,CX显示子程序 display:入口:AL2) 绘出流程图2. 详细设计1) 变量定义及说明.databuff db -5,-43,-32,-22,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,02) 寄存器的使用及含义使用了 al、ah、bl、bh、ax 、bx、cx、di、si 寄存器,都是用来存放数据,比较数据的大小,进行数据的值的转化和计算。3) 程序功能说明程序调用 出口/入口 作用Inword 出口: buff 开始的单元,CX 键盘输入Sort 入口

3、:buff 开始的单元,CX ;出口:buff 开始的单元,CX 冒泡排序Display 入口:AL 显示4) 源程序清单.model small.data;buff db 20 dup(1)buff db -5,-43,-32,-22,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0.codestart:mov ax, datamov ds, axcall inwordcall sortcall displaymov ax, 4c00hint 21hinword procpush axpush bxpush cxpush ush simov si, offset buffmov

4、 cx, 5read:mov ah, 01h int 21hmov ah, 10xor bh, bhcmp al, 2dhjne posmov bl, 1mov ah, 01hint 21hpos:add bh, alsub bh, 30hmov ah, 01hint 21hcmp al, 20hje donesub al, 30hxchg bh, almov ah, 10mul ahadd bh, 30hjmp posdone:cmp bl, 1jne finishneg bhmov bl, 0finish:mov si, bhinc siloop readpop sipop op cxpo

5、p bxpop ax retendpsort procpush axpush bxpush cxpush sipush dimov bx, 4first:mov al, si mov cx, bxmov di, sisecond:inc dicmp al, dijge nextxchg al, dimov si, alnext:loop secondinc sidec bxjnz firstpop dipop sipop cxpop bxpop axretendpdisplay procpush axpush bxpush cx push ush simov dl, 0dhmov ah, 02

6、hint 21hmov dl, 0ahmov ah, 02hint 21hmov cx, 5mov si, offset buffmov dh, 10dis:test si, 10000000bjz positivemov dl, 2dhmov ah, 02hint 21hneg sipositive:mov al, sixor ah, ahdiv dhmov dl, aladd dl, 30hmov bh, ahmov ah, 02hint 21hmov dl, bhadd dl, 30hmov ah, 02hint 21h mov dl, 20hmov ah, 02hint 21hinc si loop dis pop sipop op cxpop bxpop axretendpend start四、 调试结果及调试分析五、 结论与心得我们不仅要学习书本上的知识,更要知识与实践相结合,多动手发现问题解决问题,学会举一反三、融会贯通。

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 行业资料 > 其它行业文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号