汇编课程设计个人档案管理文件.docx

上传人:啊飒飒 文档编号:13344897 上传时间:2021-12-22 格式:DOCX 页数:12 大小:29.15KB
返回 下载 相关 举报
汇编课程设计个人档案管理文件.docx_第1页
第1页 / 共12页
汇编课程设计个人档案管理文件.docx_第2页
第2页 / 共12页
汇编课程设计个人档案管理文件.docx_第3页
第3页 / 共12页
汇编课程设计个人档案管理文件.docx_第4页
第4页 / 共12页
汇编课程设计个人档案管理文件.docx_第5页
第5页 / 共12页
点击查看更多>>
资源描述

《汇编课程设计个人档案管理文件.docx》由会员分享,可在线阅读,更多相关《汇编课程设计个人档案管理文件.docx(12页珍藏版)》请在三一文库上搜索。

1、华 北 科 技 学 院课程设计说明书课程名称: 汇编语言 班级: 计算机B08-1 姓名: 胡诗招 学号: 200807014102 设计题目: 个人档案管理文件 设计时间: 2010年6月23号 _至 2010年7月2号 _指导教师:_ 李冬艳_ _评 语:_评阅成绩: 评阅教师: 1、 课程设计目的进行程序设计方法和技能的基本训练,巩固在课堂上学到的有关程序设计的基本知识和基本方法,通过实际动手能力的培养,进一步熟悉汇编语言的结构和使用方法,达到能独立阅读、编制和调试一定规模的汇编语言程序的水平。2、 课程设计要求 1要求编写并调试通过一个小型软件,实现对软件或硬件的操作。2遵循模块化、结

2、构化的程序设计方法。3.要求程序必须正确。4.程序简明易懂,多运用输入输出提示,出错信息及必要的注释。5.要求程序结构合理,语句使用得当。6.适当追求编程技巧和程序运行效率。三、课程设计题目: 个人档案管理文件四、课题分析 程序开始时,先建立判断是否存在文件,如果不存在,就创立文件。然后随便输入i,l,q中任意一个字母,然后跳到相应的子程序,输入i诗,跳到输入的子程序,输入相应的数据,保存到文件里。当输入l时,保存在文件里的数据就会显示,每个学生的信息显示一行。当输入q时,直接关闭文件,程序结束五、流程图: 开始 先建立一个文件 输入i,l,q中的 一个字母 输入i 输入l 输入学生的名字,年

3、龄 性别,身高,体重,并把 打开文件 数据依次存到文件 显示学生名字,年领 ,性别,身高,体重 输入q 关闭文件 结束六、程序源代码:vardata segment filename db 'ffff.txt',00 ;定义文件vardata endscondata segment names db 10 dup(?) ;名字定义 age db ?,? ;年龄定义 sex db 2 dup(?) ;性别定义 height db 3 dup(?) ;身高定义 weight db 3 dup(?) ;体重定义 mess_n db 0dh,0ah,' name:$'

4、mess_a db 0dh,0ah,' age:$' mess_s db 0dh,0ah,' sex:$' mess_h db 0dh,0ah,' height:$' mess_w db 0dh,0ah,' weight:$' s4 db 0dh,0ah db '*',0dh,0ah db '* -1: print list L- *',0dh,0ah db '* -2: insert new ele I- *',0dh,0ah db '* -3: quit q- *'

5、;,0dh,0ah db '*',0dh,0ah db 0dh,0ah db '$' s1 db ' name age sex height weight',13,10,'$' s2 db ' $' s3 db ' $'condata endscode segment assume cs:code,ds:vardata,es:condatastart: mov ax, condata mov es, ax mov ax, vardata mov ds, ax push ds;-print comma

6、nd hint- mov ax, es mov ds, ax mov dx, offset s4 mov ah, 9h int 21h pop ds;-intepret command-cmp_l: mov ah, 01h int 21h cmp al, 'l' jnz cmp_i call list_all jmp startcmp_i: cmp al, 'i' jnz cmp_q call insert jmp startcmp_q: cmp al, 'q' jnz closef exit: mov ax, 4c00h int 21h;-打开

7、和创建文件list_all proc near call open_create ;open or create file push ds mov ax, es ;es里放的是文件 mov ds, ax lea dx, s1 mov ah, 9 int 21h mov dl, 0ah mov ah,2 int 21hloop_rd: mov ah, 3fh ;read record from file to memory 读取文件 mov dx, offset names mov cx, 20 mov bx, si int 21h cmp ax, 0 je read_finish ;read

8、to the end,then finish相等是结束 ;-名字 lea dx, s3 mov ah, 9 int 21h mov bx, 0go_on: mov dl, namesbx mov ah, 2h int 21h inc bx cmp bx, 10 jl go_on;-年龄 lea dx,s2 mov ah,9 int 21h mov dl, age0 mov ah, 2 int 21h mov dl, age1 mov ah, 2 int 21h;-性别 lea dx,s2 mov ah,9 int 21h mov bx, 0l1: mov dl, sexbx mov ah, 2

9、h int 21h inc bx cmp bx, 2 jl l1;-身高 lea dx,s2 mov ah,9 int 21h mov bx, 0l2: mov dl, heightbx mov ah, 2h int 21h inc bx cmp bx, 3 jl l2;-体重 lea dx,s2 mov ah,9 int 21h mov bx, 0l3: mov dl, weightbx mov ah, 2h int 21h inc bx cmp bx, 3 jl l3 mov dl, 0dh mov ah,2 int 21h mov dl, 0ah mov ah,2 int 21h jmp

10、 loop_rd ; a record finished ,then to read the next接着显示read_finish: call closef pop ds retlist_all endp;-输入子程序insert proc near call open_create ; open of create file push ds mov ax, es mov ds, ax;-名字输入 mov dx, offset mess_n mov ah, 9h int 21h mov bx, 0init: ;memory initialize初始化 mov namesbx,0 inc bx

11、 cmp bx, 20 jl init mov bx, 0lp: ;从键盘接受数据 mov ah, 1 int 21h cmp al, 0dh jz inext cmp al, 0ah jz inext mov namesbx,al inc bx cmp bx, 10 jl lp ;-年龄 的输入inext: lea dx,s2 mov ah,9 int 21h mov dx, offset mess_a mov ah, 9h int 21h mov bx, 0lp2: mov ah, 1h int 21h cmp al, 0dh jz inext1 cmp al, 0ah jz inext1

12、 mov agebx,al inc bx cmp bx, 1 jle lp2 ;-性别输入 inext1: lea dx,s2 mov ah,9 int 21h mov dx, offset mess_s mov ah, 9h int 21h mov bx, 0 lp3: mov ah, 1h int 21h cmp al, 0dh jz inext2 cmp al, 0ah jz inext2 mov sexbx,al inc bx cmp bx,2 jle lp3 ;-身高输入inext2: lea dx,s2 mov ah,9 int 21h mov dx, offset mess_h

13、mov ah, 9h int 21h mov bx, 0lp4: mov ah, 1h int 21h cmp al, 0dh jz inext3 cmp al, 0ah jz inext3 mov heightbx,al inc bx cmp bx,3 jle lp4 ;-体重输入inext3: lea dx,s2 mov ah,9 int 21h mov dx, offset mess_w mov ah, 9h int 21h mov bx, 0lp5: mov ah, 1h int 21h cmp al, 0dh jz iexit cmp al, 0ah jz iexit mov wei

14、ghtbx,al inc bx cmp bx,3 jle lp5 iexit: ;move the file pointer to the end of file mov ah, 42h ;移动文件 mov al, 2 mov bx, si mov cx, 0 mov dx, 0 int 21h mov ah, 40h ;write the record to file写入文件 mov bx, si mov cx, 20 mov dx, offset names int 21hback: call closef pop ds retinsert endp;-open_create proc n

15、ear push ds mov ax, seg filename ;filename文件d的段地址值送给ax mov ds, ax mov ah, 3dh ;open the file mov dx, offset filename mov al, 2h ;显示文件 int 21h jnc ok ;大于等于时跳转 mov ah, 3ch ;如果不存在文件,就创建文件 mov dx, offset filename mov cx, 00 int 21hok: mov si, ax pop ds retopen_create endpclosef proc near mov bx, si mov

16、ah, 3eh ;关闭文件 int 21h retclosef endp code ends end start七、结果显示8、 感想、收获及体会 课程设计从开始找资料到课设结束,在这短时间里,课设给我的收获很大,虽然我的题目不是很难,比其他同学的简单,程序也简单,程序的代码都是简单的指令,但我学到的却很多。以前学程序时思维都很乱,但写这个程序是,我的思路确是非常清晰的,本来想加上一些代码,让显示时带有颜色,但试了几次都不太理想,就去掉了。这个程序不是我单独完成的,有些东西是在网上找的。虽然是别人的,但我把它转换为自己的东西。在写程序时,思路是最终要的,如果思路错了,你就很难写出正确的程序,但要是思路非常的清晰,就算程序有写错误,你也会很快的找出并把它改对。所以我认为在写一个程序时,必须把思路弄得非常的清楚,然后再开始写。- 11 -

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

当前位置:首页 > 科普知识


经营许可证编号:宁ICP备18001539号-1