zoukankan      html  css  js  c++  java
  • 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

  • 相关阅读:
    抓取猫眼电影top100的正则、bs4、pyquery、xpath实现方法
    Win实用好用软件清单推荐
    Manjaro安装配置美化字体模糊发虚解决记录
    爬取杭电oj所有题目
    Python爬取微博热搜以及链接
    20191225_Python构造函数知识以及相关注意事项
    java_细节_windows7下记事本保存为utf-8格式的问题
    基础_划分子网
    爬虫_爬取有道每日一句
    算法_基础_伪代码定义以及遵循的规则
  • 原文地址:https://www.cnblogs.com/viplanyue/p/12700598.html
Copyright © 2011-2022 走看看