汇编语言论文.doc

上传人:文库蛋蛋多 文档编号:2392952 上传时间:2023-02-17 格式:DOC 页数:50 大小:214KB
返回 下载 相关 举报
汇编语言论文.doc_第1页
第1页 / 共50页
汇编语言论文.doc_第2页
第2页 / 共50页
汇编语言论文.doc_第3页
第3页 / 共50页
汇编语言论文.doc_第4页
第4页 / 共50页
汇编语言论文.doc_第5页
第5页 / 共50页
点击查看更多>>
资源描述

《汇编语言论文.doc》由会员分享,可在线阅读,更多相关《汇编语言论文.doc(50页珍藏版)》请在三一办公上搜索。

1、 本科课程论文 Course Paper课程名称 Course:IBM-PC汇编语言课程设计课程性质 Course No:专业课学 分 数 Credits:5主讲教师 Instructor: 开设学院 College:巢湖学院开设时间 Semester:2011-09-03论文编号 Paper No: 撰写日期 Date: 2012-01-01汇编的总结Paper Title in English姓名(计算机及信息工程学院 计算机科学与技术专业 2年级学号)论文类型Paper Type: 研究总结 Summary of Focused Research论及主题 Subject Covered:

2、 巢 湖 学 院汇编的总结姓 名 (计算机及信息工程学院计算机科学与技术 专业 2年级学号)Email: 摘 要: 作为最基本的编程语言之一,汇编语言虽然应用的范围不算很广,但重要性却勿庸置疑,因为它能够完成许多其它语言所无法完成的功能。就拿 Linux 内核来讲,虽然绝大部分代码是用 C 语言编写的,但仍然不可避免地在某些关键地方使用了汇编代码,其中主要是在 Linux 的启动部分。由于这部分代码与硬件的关系非常密切,即使是 C 语言也会有些力不从心,而汇编语言则能够很好扬长避短,最大限度地发挥硬件的性能。关键词: 编汇 应用 发展 汇编语言比机器语言易于读写、易于调试和修改,同时也具有机器

3、语言执行速度快,占内存空间少等优点,但在编写复杂程序时具有明显的局限性,汇编语言依赖于具体的机型,不能通用,也不能在不同机型之间移植。 是能完成一定任务的机器指令的集合。 常说汇编语言过时,是低级语言,并不是说汇编语言要被弃之,相反,汇编语言仍然是程序员必须了解的语言,在某些行业与领域,汇编是必不可少的,非它不可适用。只是,现在计算机最大的领域为IT软件,也是我们常说的 Windows编程,在熟练的程序员手里,使用汇编语言编写的程序,运行效率与性能比其它语言写的程序是成倍的优秀,但是代价是需要更长的时间来优化,如果对计算机原理及编程基础不扎实,实在是得不偿失,对比现在的软件开发,已经是市场化的

4、软件行业,加上高级语言的优秀与跨平台,一个公司不可以让一个团队使用汇编语言来编写所有的东西,花上几倍甚至几十倍的时间,不如使用其它语言来完成,只要最终结果不比汇编语言编写的差太多,就能抢先一步完成,这是市场经济下的必然结果。 汇编语言(6张)但是,至今为止,还没有程序员敢断定汇编语言是不需要学的,一个不懂汇编语言的程序员,只是三流的程序员,这是大部分人的共识,同时,技术汇编语言(Assembly Language)是面向机器的程序设计语言精湛的汇编程序员,已经脱离软件开发,挤身于工业电子编程中,一个电子工程师,主要开发语言就是汇编,c语言使用只占极少部分,而电子开发工程师是千金难求,在一些工业

5、公司,一个核心的电子工程师比其它任何职员待遇都高,对比起来,一般电子工程师待遇是程序员的十倍以上。这种情况是因为现在学习汇编的人虽然也不少,但是真正能学到精通的却不多,它难学,难用,适用范围小,虽然简单,但是过于灵活,学习过高级语言的人去学习汇编比一开始学汇编的人难得多,但是学过汇编的人学习高级语言却很容易,简从繁易,繁从简难。 总之,汇编语言是程序员的必修语言。 目前国内最好的汇编网站是“AoGo汇编小站”。其站长aogo,就是一个在工业方面有所成就的工程师,有意者可多参考。 其次就是罗云彬的汇编站点:这个大概是国内建站时间最长的汇编站点,其编写的Windows下汇编语言程序设计一书。是站长

6、十几年的经验的集合,不妨看看。 熟悉指令,可以尝试破解,加强兴趣,参考看雪学院,国内最好的破解组织,其中看雪与众高手打造的破解书加密 解密完全方案非常有名。汇编语言是一种低级的程序语言可直接控制硬件。汇编语言是计算机最底层的语言,现在一般都用在硬件层,对硬件直接控制,其他的都用高级的语言编写了,因为汇编写程序容易出错,而且太过于复杂和长啦,虽然引入了其他的有类似高级语言的一些伪指令但是相比高级语言可以解决的问题都不用汇编啦。好像现在的计算机已经增加了对C+还是什么语言(反正就是高级语言)的支持啦,就是开集的引导程序已经不用汇编啦(好像只有为苹果apple系统制作的机子有,微软不知道为什么还没,

7、不过不是技术问题,据说有其他目的)。 作为最基本的编程语言之一,汇编语言虽然应用的范围不算很广,但重要性却勿庸置疑,因为它能够完成许多其它语言所无法完成的功能。就拿 Linux 内核来讲,虽然绝大部分代码是用 C 语言编写的,但仍然不可避免地在某些关键地方使用了汇编代码,其中主要是在 Linux 的启动部分。由于这部分代码与硬件的关系非常密切,即使是 C 语言也会有些力不从心,而汇编语言则能够很好扬长避短,最大限度地发挥硬件的性能。 按CPU不同的话基本每一种CPU都对应一种汇编,比如Intel出的CPU可以算一个系列的,这些CPU在推出新版CPU的时候会基本保持向下兼容,就是原来低级CPU的

8、指令在高级的CPU上也是一样的,所以说可以算作一类.另外还有单片机的汇编,单片机的指令和PC上CPU的指令是有出入的,所以另作一类按操作系统不同的话可以分为windows下汇编,DOS汇编等,虽然可能在相同的CPU上运行不同的操作系统(比如windows下的dos窗口),但不同的操作系统的程序设计是不一样的,比如在DOS下你不可能去调用windows的API,在windows下也不可能去调用DOS的int 21H中断.另外某些单片机也有操作系统大多数情况下 Linux 程序员不需要使用汇编语言,因为即便是硬件驱动这样的底层程序在 Linux 操作系统中也可以用完全用 C 语言来实现,再加上 G

9、CC 这一优秀的编译器目前已经能够对最终生成的代码进行很好的优化,的确有足够的理由让我们可以暂时将汇编语言抛在一边了。但实现情况是 Linux 程序员有时还是需要使用汇编,或者不得不使用汇编,理由很简单:精简、高效和 libc 无关性。假设要移植 Linux 到某一特定的嵌入式硬件环境下,首先必然面临如何减少系统大小、提高执行效率等问题,此时或许只有汇编语言能帮上忙了。 汇编语言直接同计算机的底层软件甚至硬件进行交互,它具有如下一些优点: 能够直接访问与硬件相关的存储器或 I/O 端口; 能够不受编译器的限制,对生成的二进制代码进行完全的控制; 能够对关键代码进行更准确的控制,避免因线程共同访

10、问或者硬件设备共享引起的死锁; 能够根据特定的应用对代码做最佳的优化,提高运行速度; 能够最大限度地发挥硬件的功能。 同时还应该认识到,汇编语言是一种层次非常低的语言,它仅仅高于直接手工编写二进制的机器指令码,因此不可避免地存在一些缺点: 编写的代码非常难懂,不好维护; 很容易产生 bug,难于调试; 只能针对特定的体系结构和处理器进行优化; 开发效率很低,时间长且单调。 汇编当然可以写网络程序啦,高级语言可以做的汇编可以做,高级语言不可以做的汇编也可以做。IP探测的软件一般都不用汇编,毕竟高级语言可以解决,但是汇编写出来的没有高级语言自身的一些限制,如安全性,可能对权限有限制。 汇编可以应用

11、于单片机,因为他们简单种类繁多,没有操作系统(开发代价大,而且不划算)故用汇编,不过其他的涉及电子的基本上都可以用汇编一方面,汇编语言指令是用一些具有相应含义的助忆符来表达的,所以,它要比机器语言容易掌握和运用,但另一方面,它要直接使用CPU的资源,相对高级程序设计语言来说,它又显得难掌握。汇编语言程序归纳起来大概有以下几个主要特性。1、与机器相关性汇编语言指令是机器指令的一种符号表示,而不同类型的CPU有不同的机器指令系统,也就有不同的汇编语言,所以,汇编语言程序与机器有着密切的关系。由于汇编语言程序与机器的相关性,所以,除了同系列、不同型号CPU之间的汇编语言程序有一定程度的可移植性之外,

12、其它不同类型(如:小型机和微机等)CPU之间的汇编语言程序是无法移植的,也就是说,汇编语言程序的通用性和可移植性要比高级语言程序低。2、执行的高效率正因为汇编语言有“与机器相关性”的特性,程序员用汇编语言编写程序时,可充分发挥自己的聪明才智,对机器内部的各种资源进行合理的安排,让它们始终处于最佳的使用状态,这样做的最终效果就是:程序的执行代码短,执行速度快。现在,高级语言的编译程序在进行寄存器分配和目标代码生成时,也都有一定程度的优化(在后续课程编译原理的有关章节会有详细介绍),但由于所使用的“优化策略”要适应各种不同的情况,所以,这些优化策略只能在宏观上,不可能在微观上、细节上进行优化。而用

13、汇编语言编写程序几乎是程序员直接在写执行代码,程序员可以在程序的每个具体细节上进行优化,这也是汇编语言程序执行高效率的原因之一。3、编写程序的复杂性汇编语言是一种面向机器的语言,其汇编指令与机器指令基本上一一对应,所以,汇编指令也同机器指令一样具有功能单一、具体的特点。要想完成某件工作(如计算:A+B+C等),就必须安排CPU的每步工作(如:先计算A+B,再把C加到前者的结果上)。另外,在编写汇编语言程序时,还要考虑机器资源的限制、汇编指令的细节和限制等等。由于汇编语言程序要安排运算的每一个细节,这就使得编写汇编语言程序比较繁琐、复杂。一个简单的计算公式或计算方法,也要用一系列汇编指令一步一步

14、来实现。4、调试的复杂性在通常情况下,调试汇编语言程序要比调试高级语言程序困难,其主要原因有四: 汇编语言指令涉及到机器资源的细节,在调试过程中,要清楚每个资源的变化情况; 程序员在编写汇编语言程序时,为了提高资源的利用率,可以使用各种实现技巧,而这些技巧完全有可能破坏程序的可读性。这样,在调试过程中,除了要知道每条指令的执行功能,还要清楚它在整个解题过程中的作用; 高级语言程序几乎不显式地使用“转移语句”,但汇编语言程序要用到大量的、各类转移指令,这些跳转指令大大地增加了调试程序的难度。如果在汇编语言程序中也强调不使用“转移指令”,那么,汇编语言程序就会变成功能单调的顺序程序,这显然是不现实

15、的; 调试工具落后,高级语言程序可以在源程序级进行符号跟踪,而汇编语言程序只能跟踪机器指令。不过,现在这方面也有所改善,CV(CodeView)、TD(Turbo Debug)等软件也可在源程序级进行符号跟踪了。 综上所说,汇编语言的特点明显,其诱人的优点直接导致其严重的缺点,其“与机器相关”和“执行的高效率”导致其可移植性差和调试难。所以,我们在选用汇编语言时要根据实际的应用环境,尽可能避免其缺点对整个应用系统的影响。 下面简单列举几个领域以示说明,但不要把它们绝对化。 1、适用的领域 要求执行效率高、反应快的领域,如:操作系统内核,工业控制,实时系统等; 系统性能的瓶颈,或频繁被使用子程序

16、或程序段; 与硬件资源密切相关的软件开发,如:设备驱动程序等; 受存储容量限制的应用领域,如:家用电器的计算机控制功能等; 没有适当的高级语言开发环境。 2、不宜使用的领域 大型软件的整体开发; 没有特殊要求的一般应用系统的开发等。Paper Title in EnglishNAME Name-name(Student-No, College)Email:?Abstract:As one of the most basic programming language, assembly language, although the scope of application is not very

17、 wide, but the importance is undoubtedly, because it can do many other language can complete the function of. Take the Linux kernel, although the vast majority of the code is written using C language, but still inevitably in certain key areas use assembly code, which is mainly in the Linux portion o

18、f the boot. Due to this part of the code and the hardware of the relationship is very close, even if is the C language also will be there too, and assembly language can be very good foster strengths and circumvent weaknesses, to maximize the performance of hardware.Key words: Compilation Application

19、 Development Assembly language machine language easy to read and write, is easy to debug and modify, while also having a machine language is fast, occupy the memory space is little wait for an advantage, but in the complicated programming has obvious limitations, assembly language is dependent on th

20、e specific models, not general, not in different models of transplantation. Is to complete a certain task machine instruction set. Assembly language is often said, is the low-level language, is not to say that the assembly language to be abandoned, in contrast, assembly language is still the program

21、mer must be aware of the language, and in some industries and fields, the compilation is essential, for it is not applicable. Just, now the largest field of computer for the IT software, and we often say the Windows programming, in skilled programmer s hands, the use of assembly language programming

22、, operation efficiency and performance than other languages are multiplied by the elite, but the price is take longer to optimize, if the computer principle and programming based on it is not solid, the loss outweighs the gain., compared with the current software development, is the market of the so

23、ftware industry, coupled with advanced language best cross platform, a company may not make a team using assembly language to write all the things, spend several times or even several times, as the use of other languages complete, as long as the end result than assembly language too much, will the f

24、irst step, this is the inevitable result of market economy.Assembly language ( 6 ) but, so far, no programmer bet assembly language is to learn, do not know a assembly language programmers, just three stream programmers, this is the most common, at the same time, technology of assembly language ( As

25、sembly Language ) is a machine oriented language skills assembly language programmers, has been separated from the software development, among the industrial electronic programming, an electronics engineer, mainly the development of language is the C language compilation, using only a small percent

26、of, while the electronic development engineer is priceless, in some industries, a core electronic engineers than any other staff treatment is high, in contrast General Electronic Engineer, programmer treatment is more than ten times. This is because the present study the compilation of although many

27、, but really can learn good not much however, it is difficult, difficult to use, suitable scope is little, although simple, but too much flexibility, learning advanced language to learn assembly than started the compilation of rare, but learned assembler people learn languages very easily, Jane from

28、 complexity, simplifying difficult. In short, the assembly language is a compulsory language programmer. Currently the best compilation of site is AoGo assembly station. The head of aogo, is an industrial achievement of engineer, those interested can refer to. Next is Luo Yunbin assembly site: This

29、is probably the home station for the longest time assembly site, its write Windows assembly language program design in a book. The station is more than 10 years of experience in the collection, may have a look. Familiar with the instruction, can try to crack, to strengthen the interest, reference to

30、 see Snow College, the best domestic cracking group, which see the snow and the master to create crack book encryption and decryption program completely is very famous. Assembly language is a low-level programming language can directly control the hardware. Assembly language is a computer at the bot

31、tom of the language, now generally used in the hardware layer, to direct hardware control, others use the advanced language, because the program is easy to make a mistake, but it is too complicated and long, although introduced other similar senior language of some pseudo instruction but compared wi

32、th the advanced language it can solve the problem without compilation. Now it seems that computer has been added to the C + + or what language ( it is a high-level language ) support, is set to guide the process has no assembly. ( if only for the apple apple system making machine with Microsoft, don

33、t know why he hasnt, but is not a technical problem, is said to have other purposes ).As one of the most basic programming language, assembly language, although the scope of application is not very wide, but the importance is undoubtedly, because it can do many other language can complete the functi

34、on of. Take the Linux kernel, although the vast majority of the code is written using C language, but still inevitably in certain key areas use assembly code, which is mainly in the Linux portion of the boot. Due to this part of the code and the hardware of the relationship is very close, even if is

35、 the C language also will be there too, and assembly language can be very good foster strengths and circumvent weaknesses, to maximize the performance of hardware.According to CPU different essential each kind of CPU corresponds to an assembly, such as the Intel CPU can be counted as a series, the C

36、PU in launching a new version of CPU will basically maintain downward compatibility, is the original grade CPU instruction in senior CPU is the same, so can be considered as a class. Another compilation, MCU instructions and PC CPU instruction is different, so a classAccording to the operating syste

37、m to different words can be divided into windows compilation, DOS compilation, although possible in the same CPU running on different operating system ( such as the windows DOS window ), but a different operating system program design is not the same as, for example, in DOS you wont be able to call

38、the windows API, in the windows also impossible to call DOS int 21H interrupt. Moreover some chip also has operating systemMost cases of Linux programmers do not need to use assembly language, because even the hardware drivers that the underlying program in the Linux operating system can also be use

39、d entirely in C language to achieve, plus GCC this excellent compiler has been able to ultimately generate the code of good optimization, there is sufficient reason for we can put aside the assembly language. But the implementation of Linux programmer is sometimes still need to use a compilation, or

40、 to use the compilation, the reason is very simple: streamlined, efficient and libc independence. Suppose you want to transplant Linux to a given hardware environment, first of all must face how to reduce the system size, improve execution efficiency and other issues, this is probably the only assem

41、bly language can help.Assembly language directly with the bottom layer of the computer software and hardware to interact, it has the following advantages:To be able to directly access the hardware related memory or I / O port;Without being affected by the compiler, to generate the binary code comple

42、te control;The key code to be more precise control, to avoid the common threads to access or hardware device shared by a deadlock;According to specific application code to do the best optimization, improve the operating speed;To maximize the function of hardware.At the same time also should be aware

43、 of, the assembler language is a kind of very low levels of the language, it is higher than that of direct writing binary machine code instruction, it inevitably has some shortcomings:Code is very difficult to understand, not maintenance;It is easy to produce bug, difficult to debug;Only specific ar

44、chitecture and processor optimization;The development of efficiency is very low, long and boring.Assembly can certainly write network programs, high-level language can do assembly can be done, the high-level language can not do assembly can also do. IP detection software is generally not high-level

45、language compilation, after all, can be solved, but a compilation of written language itself without advanced some restrictions, such as security, may have on the authority restriction.Assembly can be applied to SCM, because of their simple variety, no operating system ( the price of development of

46、large, but not worthwhile ) the assembly, but the other relates to electron basically can be compiled on one hand, assembly language instruction is used with some corresponding meaning mnemonic symbols to express, therefore, it should be easy to master and use than machine language, but on the other

47、 hand, it is to directly use the CPU resources, relatively advanced programming language, it is difficult to master.Assembly language program is summed up about the following main characteristics.In 1, and machine correlationAssembly language instruction is a kind of symbolic machine instruction, an

48、d different types of CPU have different machine instruction system, also have different assembly language assembly language program, therefore, is closely related with the machine.As the assembly language program and machine correlation, so, in addition to the series, various models of CPU between assembly language procedures have a certain degree of portability, other different types ( such as: minicomputer and microcomputer etc ) between the CPU assembly language program can not be transplanted, that is to say, th

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

当前位置:首页 > 建筑/施工/环境 > 项目建议


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号