Design of assembler in Linux

Source: Internet
Author: User
Linux assembly program design-Linux general technology-Linux programming and kernel information. The following is a detailed description. Abstract: This article describes the advantages and disadvantages of using assembly in Linux, as well as the usage and syntax features of Common Assembly tools. Focuses on NASM.

Introduction: assembly language is a low-level language that is closely related to hardware and operating systems. My PC used DOS before, and now it has developed into WINDOWS 98, while another operating system Linux is also on the rise. The following compares the three operating systems:

DOS is relatively stable, and the speed is fast. Therefore, the computer performance cannot be fully realized without a graphical interface.

WINDOWS 98 is easy to operate, has a lot of application software, and has good hardware compatibility. It is unstable, Often crashes, and the speed is slow and high.

Linux has excellent performance, stability, beautiful interface, and easy operation. It lacks support from software vendors and is less free of charge.

From the comparison above, we can see that the Linux operating system has a great advantage, and its popularity should be just a matter of time, therefore, how to develop software in Linux is a subject that students in the computer department must learn and study.

The main programming language in Linux is C. At the same time, Linux also supports many other programming languages. assembly language is also included as one of the most important programming languages. It can complete functions that cannot be completed by many other languages. To learn Linux programming, you must learn assembly programming in Linux. Next I will introduce the assembly program design in Linux.

Introduction to Linux assembly

I. Advantages and Disadvantages of Assembly Language


Since Linux is written in C, C naturally becomes the standard programming language of Linux. Most people ignore the compilation, and it is very difficult to find information on the Internet. Many problems need to be tried by yourself. In my opinion, it is unfair to treat assembly languages like this. We cannot only see its shortcomings, but also its advantages. The following compares its advantages and disadvantages:

Advantage: assembly languages can express very underlying things.

Registers and I/O can be directly accessed;

The code can be executed very accurately;

You can compile code that is more efficient than the general compiling system;

It can be used as an interface of different languages or standards.

Disadvantage: assembly language is a very low-level language.

It is very lengthy and monotonous, and can be realized during programming in DOS;

It is prone to bugs and debugging is difficult;

Code is not easy to maintain;

Poor compatibility, very close to hardware.

In general, the assembly language should be used wherever necessary, as far as possible to write large programs with less compilation, and the inline mode should be adopted.

Ii. assembly language tools

Commonly used tools under DOS, such as MASM and TASM, cannot be used in Linux. Linux has its own assembly tools and many types of tools. Among them, Gas can be regarded as a standard configuration. Each type of Linux includes Gas, but GAS does not use the Assembly syntax we usually use in DOS. It uses the AT&T syntax format, the syntax format is quite different from that of intel.

To use a syntax similar to DOS, you must use another compilation tool, NASM, which is basically the same as MASM, but there are also many differences, especially when it comes to operating system principles, it is totally different from DOS.

Linux Assembler Program Design

1. Hello, world!


Almost all languages are started with "Hello, world !" For example, I also use Hello, world! As an example.
QUOTE:
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.