30>>linux compilation

Source: Internet
Author: User
The editor is an ordinary editor, vim,emacs,gedit,kate
Plain text with source file type ASCII code

compile with GCC or NASM, the former compiles the T-T assembly, the latter compiles the Intel assembly
8086 of the textbooks are generally used in Intel, but the difference is not small, can be converted to each other

The link is LD, which belongs to the GCC toolset



Example:

Hello.asm source code is as follows:

*************************************************************
Section. Text
Global Main
Main
MOV eax,4; Call number 4th
MOV ebx,1; EBX send 1 for output
MOV ecx,msge; The first address of the string is fed into ECX
MOV edx,14; The length of the string is fed into edx
int 80h; Output string
MOV eax,1; Call number 1th
int 80h; End
Msge:
DB "Hello world!", 0AH,0DH
*************************************************************

Save the above code as HELLO.ASM, and put the file in the extracted nasm directory, and enter the directory to execute the following command:

Nasm-f elf64 (ELF32) hello.asm (note whether ELF64 is used here or elf32 depends on the number of bits of the operating system)

Gcc-o Hello hello.o

./hello

If you output the Hello Wrod, the installation is successful.

30>>linux compilation

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.