1. 安装

sudo apt-get install nasm

这样nasm就安装好了,终端输入命令:

nasm -version

输出版本信息就说明安装成功

2. 使用

创建"hello.asm"文件:

touch hello.asm
gedit hello.asm

在文件中输入下面的汇编代码

section .data
hello: db 'Hello world!',10 ; 'Hello world!' plus a linefeed character
helloLen: equ $-hello ; Length of the 'Hello world!' string
; (I'll explain soon) section .text
global _start _start:
mov eax,4 ; The system call for write (sys_write)
mov ebx,1 ; File descriptor 1 - standard output
mov ecx,hello ; Put the offset of hello in ecx
mov edx,helloLen ; helloLen is a constant, so we don't need to say
; mov edx,[helloLen] to get it's actual value
int 80h ; Call the kernel mov eax,1 ; The system call for exit (sys_exit)
mov ebx,0 ; Exit with return code of 0 (no error)
int 80h

保存后退出。

编译

nasm -f elf64 hello.asm

如果是32位系统就把elf64改为elf32

链接

ld -s -o hello hello.o

运行

./hello

终端输出“Hello,world!”就没问题了

Ubuntu安装NASM和简单的使用教程的更多相关文章

  1. asp.Net Core免费开源分布式异常日志收集框架Exceptionless安装配置以及简单使用图文教程

    最近在学习张善友老师的NanoFabric 框架的时了解到Exceptionless : https://exceptionless.com/ !因此学习了一下这个开源框架!下面对Exceptionl ...

  2. C#实现多级子目录Zip压缩解压实例 NET4.6下的UTC时间转换 [译]ASP.NET Core Web API 中使用Oracle数据库和Dapper看这篇就够了 asp.Net Core免费开源分布式异常日志收集框架Exceptionless安装配置以及简单使用图文教程 asp.net core异步进行新增操作并且需要判断某些字段是否重复的三种解决方案 .NET Core开发日志

    C#实现多级子目录Zip压缩解压实例 参考 https://blog.csdn.net/lki_suidongdong/article/details/20942977 重点: 实现多级子目录的压缩, ...

  3. 【转】asp.Net Core免费开源分布式异常日志收集框架Exceptionless安装配置以及简单使用图文教程

    最近在学习张善友老师的NanoFabric 框架的时了解到Exceptionless : https://exceptionless.com/ !因此学习了一下这个开源框架!下面对Exceptionl ...

  4. 使用UltraISO制作ubuntu安装u盘启动盘图文教程

    使用UltraISO制作ubuntu安装u盘启动盘图文教程 胖先森关注 0.9572017.09.07 11:06:15字数 770阅读 27,901   制作U盘启动1.gif 1.首先打开Ultr ...

  5. Ubuntu 安装mysql和简单操作

    http://www.cnblogs.com/zhuyp1015/p/3561470.html ubuntu上安装mysql非常简单只需要几条命令就可以完成. 1. sudo apt-get inst ...

  6. Ubuntu 安装mysql和 简单命令操作

    ubuntu上安装mysql非常简单只需要几条命令就可以完成. 1. sudo apt-get install mysql-server   2. apt-get isntall mysql-clie ...

  7. centos 安装 crontab 和 简单的使用教程

    crontab是一个非常好用的定时执行任务的程序.以下是操作方式 1. 安装 cron 的 主程序 : yum -y install vixie-cron 2. 安装 cron 守护进程的表格的程序  ...

  8. Ubuntu安装mysql和简单使用

    一.安装mysql sudo apt-get install mysql-server sudo apt-get isntall mysql-client sudo apt-get install l ...

  9. Ubuntu安装最新的SlickEdit软件--破解教程

    最近主要工作系统转到LInux上面来了,Slickedit的安装破解也费了些事,今天将过程整理一下做个记录. 说明:SlickEdit pro V21.03 Linux 64位实测可用,MAC实测可用 ...

随机推荐

  1. 松软科技课堂:SQLUNION和UNIONALL操作符

    SQL UNION 操作符 UNION 操作符用于合并两个或多个 SELECT 语句的结果集. 请注意,UNION 内部的 SELECT 语句必须拥有相同数量的列.列也必须拥有相似的数据类型.同时,每 ...

  2. TestNG(一) TestNG实战在idea中创建module

    1.在ider里创建一个Module 2.直接点击下一步 3.输入Groupld h和Artifactid名称,点击下一步 4.点击Finish 创建完成

  3. 微信图片解决方法-windows版的dat文件

    public string decodeImg(string filepath) { Dictionary<string, byte[]> headers = new Dictionary ...

  4. Driect3D初始化演示

    初始化Direct3D演示 初始化Driect3D类: #include "Common\d3dApp.h" #include <DirectXColors.h> us ...

  5. Day 6 文件属性与命令执行流程

    1. 第一列第一个字符 表示文件类型 rw-r--r--     权限(下周) 4 这个文件被链接次数 root 文件的拥有者(用户) root 文件的拥有组(用户组 ==>家族) 2018 文 ...

  6. 数据结构慕课PTA 05-树9 Huffman Codes

    题目内容 In 1953, David A. Huffman published his paper "A Method for the Construction of Minimum-Re ...

  7. 想研究BERT模型?先看看这篇文章吧!

    最近,笔者想研究BERT模型,然而发现想弄懂BERT模型,还得先了解Transformer. 本文尽量贴合Transformer的原论文,但考虑到要易于理解,所以并非逐句翻译,而是根据笔者的个人理解进 ...

  8. airflow的安装

    1.环境准备1.1 安装环境1.2 创建用户2.安装airflow2.1 安装python2.2 安装pip2.3 安装数据库2.4 安装airflow2.4.1 安装主模块2.4.2 安装数据库模块 ...

  9. Anaconda、TensorFlow安装和Pycharm配置详细教程,亲测有效!

    目录 1.Anaconda下载与安装 2.Anaconda安装成功与否测试 3.安装python 4.检查TensorFlow环境添加成功与否 5.TensorFlow安装 6.测试TensorFlo ...

  10. Flutter学习笔记(27)--数据共享(InheritedWidget)

    如需转载,请注明出处:Flutter学习笔记(27)--数据共享(InheritedWidget) InheritedWidget是Flutter中非常重要的一个功能型组件,它提供了一种数据在widg ...