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

  • 相关阅读:
    html页面3秒后自动跳转的方法有哪些
    web前端教程之javascript创建对象的方法
    想学好web前端,需要看哪些书籍
    码农只能干到30岁的说法可信吗?
    不管你以后写不写JS,都应该学会这种思考方式
    Python基础知识之排序法
    input和textarea修改placeholder颜色和字号
    关于IE和Firefox兼容性问题及解决办法
    vue-cli构建vue项目
    js 小数取整的函数
  • 原文地址:https://www.cnblogs.com/viplanyue/p/12700598.html
Copyright © 2011-2022 走看看