我是靠谱客的博主 留胡子刺猬,这篇文章主要介绍linux 8086下编译,Linux(Fedora)系统下配制8086汇编环境,现在分享给大家,希望可以做个参考。

1.到www,nasm.us下载nasm

2.解压并安装nasm

#tar -xzvf nasm-2.11.08.tar.gz

#cd nasm-2.11.08

#./configure

#make

#make install

3.编写第一个汇编程序

新建hello.asm文件夹并编写如下代码

section .data

msg     db      "Hello, world!",0xA

len     equ     $ - msg

section .text

global _start

_start:

mov     eax,4

mov     ebx,1

mov     ecx,msg

mov     edx,len

int     0x80

mov     eax,1

xor     ebx,ebx

int     0x80

section .data

msg     db      "Hello, world!",0xA

len     equ     $ - msg

section .text

global _start

_start:

mov     eax,4

mov     ebx,1

mov     ecx,msg

mov     edx,len

int     0x80

mov     eax,1

xor     ebx,ebx

int     0x80

section .data

msg     db      "Hello, world!",0xA

len     equ     $ - msg

section .text

global _start

_start:

mov     eax,4

mov     ebx,1

mov     ecx,msg

mov     edx,len

int     0x80

mov     eax,1

xor     ebx,ebx

int     0x80

section .data

msg     db      "Hello, world!",0xA

len     equ     $ - msg

section .text

global _start

_start:

mov     eax,4

mov     ebx,1

mov     ecx,msg

mov     edx,len

int     0x80

mov     eax,1

xor     ebx,ebx

int     0x80

section .data

msg     db      "Hello, world!",0xA

len     equ     $ - msg

section .text

global _start

_start:

mov     eax,4

mov     ebx,1

mov     ecx,msg

mov     edx,len

int     0x80

mov     eax,1

xor     ebx,ebx

int     0x80

section .data

msg     db      "Hello, world!",0xA

len     equ     $ - msg

section .text

global _start

_start:

mov     eax,4

mov     ebx,1

mov     ecx,msg

mov     edx,len

int     0x80

mov     eax,1

xor     ebx,ebx

int     0x80

section .data

msg     db      "Hello, world!",0xA

len     equ     $ - msg

section .text

global _start

_start:

mov     eax,4

mov     ebx,1

mov     ecx,msg

mov     edx,len

int     0x80

mov     eax,1

xor     ebx,ebx

int     0x80

section .data

msg     db      "Hello, world!",0xA

len     equ     $ - msg

section .text

global _start

_start:

mov     eax,4

mov     ebx,1

mov     ecx,msg

mov     edx,len

int     0x80

mov     eax,1

xor     ebx,ebx

int     0x80

section .data

msg     db      "Hello, world!",0xA

len     equ     $ - msg

section .text

global _start

_start:

mov     eax,4

mov     ebx,1

mov     ecx,msg

mov     edx,len

int     0x80

mov     eax,1

xor     ebx,ebx

int     0x80

section .data

msg     db      "Hello, world!",0xA

len     equ     $ - msg

section .text

global _start

_start:

mov     eax,4

mov     ebx,1

mov     ecx,msg

mov     edx,len

int     0x80

mov     eax,1

xor     ebx,ebx

int     0x80

4.编译并链接

#nasm -f elf64 hello.asm (linux是64位的,如果是32,请使用elf32)

#ld -s -o hello hello.o

#ls hello

5.运行程序

#./hello

最后

以上就是留胡子刺猬最近收集整理的关于linux 8086下编译,Linux(Fedora)系统下配制8086汇编环境的全部内容,更多相关linux内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(51)

评论列表共有 0 条评论

立即
投稿
返回
顶部