fbpx
维基百科

Netwide Assembler

Netwide Assembler (简称 NASM)是一款基于英特尔 x86 架构的汇编与反汇编工具。它可以用来编写 16位32位IA-32)和 64位x86-64)的程序。 NASM 被认为是 Linux 平台上最受欢迎的汇编工具之一。[113]

Netwide Assembler
原作者Simon Tatham, Julian Hall
開發者H. Peter Anvin, et al.
当前版本
  • 2.11.08 (2015年2月21日)[1]
  • 2.13 (2017年4月29日)[2][3]
  • 2.13.02 (2017年11月30日)[4][5]
  • 2.13.03 (2018年2月8日)[6][7]
  • 2.14.02 (2018年12月26日)[8][9]
  • 2.15 (2020年6月27日)[10][11][12][13]
  • 2.15.01 (2020年6月27日)[10][14][15]
  • 2.15.02 (2020年7月2日)[10][16][17]
  • 0.91 (2002年4月30日)[18]
  • 0.93 (2002年4月30日)[19]
  • 0.94 (2002年4月30日)[20]
  • 0.95 (2002年4月30日)[21]
  • 0.96 (2002年4月30日)[22]
  • 0.97 (2002年4月30日)[23]
  • 0.98e (2002年4月30日)[24]
  • 0.98 (2002年4月30日)[25]
  • 0.98.03 (2002年4月30日)[26]
  • 0.98.08 (2002年4月30日)[27]
  • 0.98.09 (2002年4月30日)[28]
  • 0.98.11 (2002年4月30日)[29]
  • 0.98.12 (2002年4月30日)[30]
  • 0.98.14 (2002年4月30日)[31]
  • 0.98.15 (2002年4月30日)[32]
  • 0.98.16 (2002年4月30日)[33]
  • 0.98.17 (2002年4月30日)[34]
  • 0.98.18 (2002年4月30日)[35]
  • 0.98.19 (2002年4月30日)[36]
  • 0.98.20 (2002年4月30日)[37]
  • 0.98.21 (2002年4月30日)[38]
  • 0.98.22 (2002年4月30日)[39]
  • 0.98.23 (2002年4月30日)[40]
  • 0.98.24 (2002年4月30日)[41]
  • 0.98.25 (2002年4月30日)[42]
  • 0.98.26 (2002年4月30日)[43]
  • 0.98.30 (2002年4月30日)[44]
  • 0.98.31 (2002年5月10日)[45]
  • 0.98.32 (2002年5月19日)[46]
  • 0.98.33 (2002年5月27日)[47]
  • 0.98.34 (2002年6月8日)[48]
  • 0.98.35 (2002年9月13日)[49]
  • 0.98.36 (2003年3月12日)[50]
  • 0.98.37 (2003年8月29日)[51]
  • 0.98.38 (2003年9月12日)[52]
  • 0.98.39 (2005年1月15日)[53]
  • 0.99.01 (2007年5月30日)[54]
  • 0.99.02 (2007年9月4日)[55]
  • 0.99.03 (2007年9月20日)[56]
  • 0.99.04 (2007年9月26日)[57]
  • 0.99.05 (2007年10月17日)[58]
  • 0.99.06 (2007年11月1日)[59]
  • 2.00 (2007年11月28日)[60]
  • 2.01 (2008年1月17日)[61]
  • 2.02 (2008年2月19日)[62]
  • 2.03 (2008年6月9日)[63]
  • 2.03.01 (2008年6月17日)[64]
  • 2.04 (2008年9月26日)[65]
  • 2.05 (2008年10月24日)[66]
  • 2.05.01 (2008年10月29日)[67]
  • 2.06 (2009年6月30日)[68]
  • 2.07 (2009年7月20日)[69]
  • 2.08 (2010年3月10日)[70]
  • 2.08.01 (2010年3月10日)[71]
  • 2.08.02 (2010年7月9日)[72]
  • 2.09 (2010年8月24日)[73]
  • 2.09.01 (2010年9月7日)[74]
  • 2.09.02 (2010年9月17日)[75]
  • 2.09.03 (2010年10月27日)[76]
  • 2.09.04 (2010年11月21日)[77]
  • 2.09.05 (2011年2月20日)[78]
  • 2.09.06 (2011年2月28日)[79]
  • 2.09.07 (2011年3月12日)[80]
  • 2.09.08 (2011年4月6日)[81]
  • 2.09.09 (2011年7月3日)[82]
  • 2.09.10 (2011年7月15日)[83]
  • 2.10 (2012年3月12日)[84]
  • 2.10.01 (2012年5月24日)[85]
  • 2.10.02 (2012年7月21日)[86]
  • 2.10.03 (2012年7月23日)[87]
  • 2.10.04 (2012年8月18日)[88]
  • 2.10.05 (2012年9月9日)[89]
  • 2.10.06 (2012年12月4日)[90]
  • 2.10.07 (2013年1月2日)[91]
  • 2.10.08 (2013年7月21日)[92]
  • 2.10.09 (2013年7月23日)[93]
  • 2.11 (2013年12月31日)[94]
  • 2.11.01 (2014年2月18日)[95]
  • 2.11.02 (2014年2月19日)[96]
  • 2.11.03 (2014年5月5日)[97]
  • 2.11.04 (2014年5月9日)[98]
  • 2.11.05 (2014年5月21日)[99]
  • 2.11.06 (2014年10月17日)[100]
  • 2.11.07 (2014年12月9日)[101]
  • 2.12 (2016年2月27日)[102]
  • 2.12.01 (2016年3月18日)[103]
  • 2.12.02 (2016年7月6日)[104]
  • 2.13.01 (2017年5月2日)[105]
  • 2.14 (2018年11月7日)[106]
  • 2.14.01 (2018年12月23日)[107]
  • 2.15.03 (2020年7月18日)[108]
  • 2.15.04 (2020年8月20日)[109]
  • 2.15.05 (2020年8月28日)[110]
  • 2.16.01 (2022年12月21日)[111]
  • 2.16 (2022年12月21日)[112]
源代码库
  • github.com/netwide-assembler/nasm
操作系统Windows, Unix-like, OS/2, MS-DOS
语言English
类型x86 assembler
许可协议BSD 2-clause
网站www.nasm.us

NASM 最初是在朱利安·霍尔的协助下由西蒙·泰瑟姆开发的。 截至2016年 (2016-Missing required parameter 1=month!),它被一个由 H.Peter Anvin 领导的小团队所维护。[114] 它是一款基于简化版(二句版)BSD许可证开放源代码软件[115]

功能 编辑

NASM 可以输出包括 COFF、OMF、a.out、可执行与可链接格式(ELF)、Mach-O 和二进制文件(.bin,二进制磁盘映像,用于编译操作系统)等多种二进制格式,而地址无关代码仅支持 ELF 对象文件。 NASM 也有自己的二進位格式,稱為 RDOFF。[116]

输出格式的广泛性允许将程序重定向到任何 x86 操作系统(OS)。 此外,NASM 可以创建浮动二进制文件,它可用于写入引导加载程序、只读存储器(ROM)映像以及操作系统开发的各个方面。 NASM 可以作为交叉汇编程序(如 PowerPC 和 SPARC)在非 x86 平台上运行,尽管它不能生成这些机器可用的程序。

NASM 使用英特尔汇编语法的变体而不是 AT&T 语法(GNU 汇编器采用的语法)。 [117]它还避免了 MASM 和兼容汇编器使用的自动生成區段覆盖(以及相关的 ASSUME 指令)等功能。

用于各种操作系统的示例程序 编辑

这是一个 DOS 操作系统下的 "Hello world!" 程序

section .text org 0x100  mov ah, 0x9  mov dx, hello  int 0x21  mov ax, 0x4c00  int 0x21 section .data hello: db 'Hello, world!', 13, 10, '$' 

一个类似程序在 Microsoft Windows 下的示例:

global _main extern _MessageBoxA@16 extern _ExitProcess@4 section code use32 class=code _main:  push dword 0 ; UINT uType = MB_OK  push dword title ; LPCSTR lpCaption  push dword banner ; LPCSTR lpText  push dword 0 ; HWND hWnd = NULL  call _MessageBoxA@16  push dword 0 ; UINT uExitCode  call _ExitProcess@4 section data use32 class=data  banner: db 'Hello, world!', 0  title: db 'Hello', 0 

一段 Linux 下的等价程序:

global _start section .text _start:  mov eax, 4 ; write  mov ebx, 1 ; stdout  mov ecx, msg  mov edx, msg.len  int 0x80 ; write(stdout, msg, strlen(msg));  mov eax, 1 ; exit  mov ebx, 0  int 0x80 ; exit(0) section .data msg: db "Hello, world!", 10 .len: equ $ - msg 

下面是一个用于苹果 macOS(原為 OS X)的 64 位元程序,用于输入按键并将其显示在屏幕上:

global _start section .data  query_string: db "Enter a character: "  query_string_len: equ $ - query_string  out_string: db "You have input: "  out_string_len: equ $ - out_string section .bss  in_char: resw 4 section .text _start:  mov rax, 0x2000004 ; put the write-system-call-code into register rax  mov rdi, 1 ; tell kernel to use stdout  mov rsi, query_string ; rsi is where the kernel expects to find the address of the message  mov rdx, query_string_len ; and rdx is where the kernel expects to find the length of the message   syscall  ; read in the character  mov rax, 0x2000003 ; read system call  mov rdi, 0 ; stdin  mov rsi, in_char ; address for storage, declared in section .bss  mov rdx, 2 ; get 2 bytes from the kernel's buffer (one for the carriage return)  syscall  ; show user the output  mov rax, 0x2000004 ; write system call  mov rdi, 1 ; stdout  mov rsi, out_string  mov rdx, out_string_len  syscall  mov rax, 0x2000004 ; write system call  mov rdi, 1 ; stdout  mov rsi, in_char  mov rdx, 2 ; the second byte is to apply the carriage return expected in the string  syscall  ; exit system call  mov rax, 0x2000001 ; exit system call  xor rdi, rdi  syscall 

链接 编辑

NASM 主要输出目标文件(扩展名一般为 .obj),这些目标文件通常不能自行执行。唯一的例外是浮动二进制文件(例如 .COM) ,它们在现代使用中固有地受到限制。 要将目标文件转换为可执行程序,必须使用适当的链接程序,例如用于 Windows 的 Visual Studio“LINK”实用程序或用于类 Unix 系统的 ld。

发展 编辑

第一版(版本号0.90)发布于1996年10月。[118]

2007年11月28日,2.00版本发布,增加对 x86-64 扩展的支持。 开发版本不再上传到 SourceForge.net;相反,它们会被检入到项目自己的 Git 存储库中,而其二进制程序的快照可在项目官网上找到。

一个用于 NASM 文档的搜索引擎也已可用。[119]

截至 2.07 版本,NASM 在简化 BSD 许可证(二句版)下发布。

RDOFF 编辑

RDOFF
开发者Julian Hall
格式类型Object file format
作为容器Object code

开发人员使用可重定位的动态对象文件格式(RDOFF)来测试 NASM 的目标文件输出能力的完整性。它很大程度上基于 NASM 的内部结构,[120]主要由一个头部组成,头部包含输出驱动程序函数调用的序列化,后跟包含可执行代码或数据的部分数组。 NASM 发行版中包含了使用该格式的工具,包括链接程序 (linker) 和加载程序 (loader)。

直到1996年10月发布 0.90 版,NASM 才支持只输出浮动格式的可执行文件(例如 DOS 的 COM 文件)。在版本 0.90 中,Simon Tatham 增加了对一个目标文件输出接口的支持,并且只支持用于 16 位元代码的 DOS 的 .OBJ 文件。[121]

NASM 因此缺少一个 32 位元的对象格式。 为了解决这个问题,作为学习对象文件接口的练习,开发人员朱利安·霍尔将第一版 RDOFF 发布于 NASM 0.91 版本。

自从这个初始版本以来,对 RDOFF 格式进行了一次重大更新,它在每个标题记录上增加了一个记录长度指示器,[122] 允许程序跳过它们无法识别格式的记录,并支持多个區段;RDOFF1 仅支持三個區段:文本,数据和 bss(包含未初始化的数据)。

另请参见 编辑

参考文献 编辑

  1. ^ Release 2.11.08. 2015年2月21日 [2020年7月8日]. 
  2. ^ Index of /pub/nasm/releasebuilds/2.13. [2018年1月2日]. 
  3. ^ Release 2.13. 2017年4月29日 [2020年7月8日]. 
  4. ^ http://repo.or.cz/nasm.git/commit/fe2f6de2ee85959747a4e4a99ea43a38509cc3b2; 检索日期: 2018年1月17日.
  5. ^ Release 2.13.02. 2017年11月29日 [2020年7月8日]. 
  6. ^ http://repo.or.cz/nasm.git/tag/refs/tags/nasm-2.13.03; 检索日期: 2018年2月11日.
  7. ^ Release 2.13.03. 2018年2月7日 [2020年7月8日]. 
  8. ^ https://repo.or.cz/nasm.git/tag/a73b8be6f0f9e307e3c6131011a30f2fd5b00877; 检索日期: 2020年7月7日.
  9. ^ https://github.com/netwide-assembler/nasm/releases/tag/nasm-2.14.02; 检索日期: 2020年7月7日.
  10. ^ 10.0 10.1 10.2 https://www.nasm.us/pub/nasm/releasebuilds/?C=M;O=D; 检索日期: 2020年7月7日.
  11. ^ Announcing NASM 2.15. 2020年6月27日 [2020年7月7日] (英語). 
  12. ^ https://repo.or.cz/nasm.git/tag/03231c40a59533ec28f593f5a549688239a3c637; 检索日期: 2020年7月7日.
  13. ^ https://github.com/netwide-assembler/nasm/releases/tag/nasm-2.15; 检索日期: 2020年7月7日.
  14. ^ https://repo.or.cz/nasm.git/tag/6d78c07e6b0d1602ab096eec29628bfa7afb639c; 检索日期: 2020年7月7日.
  15. ^ https://github.com/netwide-assembler/nasm/releases/tag/nasm-2.15.01; 检索日期: 2020年7月7日.
  16. ^ https://nasm.us/doc/nasmdocc.html; 检索日期: 2020年7月7日.
  17. ^ https://github.com/netwide-assembler/nasm/releases/tag/nasm-2.15.02; 检索日期: 2020年7月7日.
  18. ^ Release 0.91. 2002年4月30日 [2020年7月8日]. 
  19. ^ Release 0.93. 2002年4月30日 [2020年7月8日]. 
  20. ^ Release 0.94. 2002年4月30日 [2020年7月8日]. 
  21. ^ Release 0.95. 2002年4月30日 [2020年7月8日]. 
  22. ^ Release 0.96. 2002年4月30日 [2020年7月8日]. 
  23. ^ Release 0.97. 2002年4月30日 [2020年7月8日]. 
  24. ^ Release 0.98e. 2002年4月30日 [2020年7月8日]. 
  25. ^ Release 0.98. 2002年4月30日 [2020年7月8日]. 
  26. ^ Release 0.98.03. 2002年4月30日 [2020年7月8日]. 
  27. ^ Release 0.98.08. 2002年4月30日 [2020年7月8日]. 
  28. ^ Release 0.98.09. 2002年4月30日 [2020年7月8日]. 
  29. ^ Release 0.98.11. 2002年4月30日 [2020年7月8日]. 
  30. ^ Release 0.98.12. 2002年4月30日 [2020年7月8日]. 
  31. ^ Release 0.98.14. 2002年4月30日 [2020年7月8日]. 
  32. ^ Release 0.98.15. 2002年4月30日 [2020年7月8日]. 
  33. ^ Release 0.98.16. 2002年4月30日 [2020年7月8日]. 
  34. ^ Release 0.98.17. 2002年4月30日 [2020年7月8日]. 
  35. ^ Release 0.98.18. 2002年4月30日 [2020年7月8日]. 
  36. ^ Release 0.98.19. 2002年4月30日 [2020年7月8日]. 
  37. ^ Release 0.98.20. 2002年4月30日 [2020年7月8日]. 
  38. ^ Release 0.98.21. 2002年4月30日 [2020年7月8日]. 
  39. ^ Release 0.98.22. 2002年4月30日 [2020年7月8日]. 
  40. ^ Release 0.98.23. 2002年4月30日 [2020年7月8日]. 
  41. ^ Release 0.98.24. 2002年4月30日 [2020年7月8日]. 
  42. ^ Release 0.98.25. 2002年4月30日 [2020年7月8日]. 
  43. ^ Release 0.98.26. 2002年4月30日 [2020年7月8日]. 
  44. ^ Release 0.98.30. 2002年4月30日 [2020年7月8日]. 
  45. ^ Release 0.98.31. 2002年5月10日 [2020年7月8日]. 
  46. ^ Release 0.98.32. 2002年5月19日 [2020年7月8日]. 
  47. ^ Release 0.98.33. 2002年5月27日 [2020年7月8日]. 
  48. ^ Release 0.98.34. 2002年6月8日 [2020年7月8日]. 
  49. ^ Release 0.98.35. 2002年9月13日 [2020年7月8日]. 
  50. ^ Release 0.98.36. 2003年3月12日 [2020年7月8日]. 
  51. ^ Release 0.98.37. 2003年8月29日 [2020年7月8日]. 
  52. ^ Release 0.98.38. 2003年9月12日 [2020年7月8日]. 
  53. ^ Release 0.98.39. 2005年1月15日 [2020年7月8日]. 
  54. ^ Release 0.99.01. 2007年5月30日 [2020年7月8日]. 
  55. ^ Release 0.99.02. 2007年9月4日 [2020年7月8日]. 
  56. ^ Release 0.99.03. 2007年9月20日 [2020年7月8日]. 
  57. ^ Release 0.99.04. 2007年9月26日 [2020年7月8日]. 
  58. ^ Release 0.99.05. 2007年10月17日 [2020年7月8日]. 
  59. ^ Release 0.99.06. 2007年11月1日 [2020年7月8日]. 
  60. ^ Release 2.00. 2007年11月28日 [2020年7月8日]. 
  61. ^ Release 2.01. 2008年1月17日 [2020年7月8日]. 
  62. ^ Release 2.02. 2008年2月19日 [2020年7月8日]. 
  63. ^ Release 2.03. 2008年6月9日 [2020年7月8日]. 
  64. ^ Release 2.03.01. 2008年6月17日 [2020年7月8日]. 
  65. ^ Release 2.04. 2008年9月26日 [2020年7月8日]. 
  66. ^ Release 2.05. 2008年10月24日 [2020年7月8日]. 
  67. ^ Release 2.05.01. 2008年10月29日 [2020年7月8日]. 
  68. ^ Release 2.06. 2009年6月30日 [2020年7月8日]. 
  69. ^ Release 2.07. 2009年7月20日 [2020年7月8日]. 
  70. ^ Release 2.08. 2010年3月10日 [2020年7月8日]. 
  71. ^ Release 2.08.01. 2010年3月10日 [2020年7月8日]. 
  72. ^ Release 2.08.02. 2010年7月9日 [2020年7月8日]. 
  73. ^ Release 2.09. 2010年8月24日 [2020年7月8日]. 
  74. ^ Release 2.09.01. 2010年9月7日 [2020年7月8日]. 
  75. ^ Release 2.09.02. 2010年9月17日 [2020年7月8日]. 
  76. ^ Release 2.09.03. 2010年10月27日 [2020年7月8日]. 
  77. ^ Release 2.09.04. 2010年11月21日 [2020年7月8日]. 
  78. ^ Release 2.09.05. 2011年2月20日 [2020年7月8日]. 
  79. ^ Release 2.09.06. 2011年2月28日 [2020年7月8日]. 
  80. ^ Release 2.09.07. 2011年3月12日 [2020年7月8日]. 
  81. ^ Release 2.09.08. 2011年4月6日 [2020年7月8日]. 
  82. ^ Release 2.09.09. 2011年7月3日 [2020年7月8日]. 
  83. ^ Release 2.09.10. 2011年7月15日 [2020年7月8日]. 
  84. ^ Release 2.10. 2012年3月12日 [2020年7月8日]. 
  85. ^ Release 2.10.01. 2012年5月24日 [2020年7月8日]. 
  86. ^ Release 2.10.02. 2012年7月21日 [2020年7月8日]. 
  87. ^ Release 2.10.03. 2012年7月23日 [2020年7月8日]. 
  88. ^ Release 2.10.04. 2012年8月18日 [2020年7月8日]. 
  89. ^ Release 2.10.05. 2012年9月9日 [2020年7月8日]. 
  90. ^ Release 2.10.06. 2012年12月4日 [2020年7月8日]. 
  91. ^ Release 2.10.07. 2013年1月2日 [2020年7月8日]. 
  92. ^ Release 2.10.08. 2013年7月21日 [2020年7月8日]. 
  93. ^ Release 2.10.09. 2013年7月23日 [2020年7月8日]. 
  94. ^ Release 2.11. 2013年12月31日 [2020年7月8日]. 
  95. ^ Release 2.11.01. 2014年2月18日 [2020年7月8日]. 
  96. ^ Release 2.11.02. 2014年2月19日 [2020年7月8日]. 
  97. ^ Release 2.11.03. 2014年5月5日 [2020年7月8日]. 
  98. ^ Release 2.11.04. 2014年5月9日 [2020年7月8日]. 
  99. ^ Release 2.11.05. 2014年5月21日 [2020年7月8日]. 
  100. ^ Release 2.11.06. 2014年10月17日 [2020年7月8日]. 
  101. ^ Release 2.11.07. 2014年12月9日 [2020年7月8日]. 
  102. ^ Release 2.12. 2016年2月27日 [2020年7月8日]. 
  103. ^ Release 2.12.01. 2016年3月18日 [2020年7月8日]. 
  104. ^ Release 2.12.02. 2016年7月6日 [2020年7月8日]. 
  105. ^ Release 2.13.01. 2017年5月2日 [2020年7月8日]. 
  106. ^ Release 2.14. 2018年11月7日 [2020年7月8日]. 
  107. ^ Release 2.14.01. 2018年12月23日 [2020年7月8日]. 
  108. ^ Release 2.15.03. 2020年7月18日 [2020年7月18日]. 
  109. ^ Release 2.15.04. 2020年8月20日 [2020年9月6日]. 
  110. ^ Release 2.15.05. 2020年8月28日 [2020年9月6日]. 
  111. ^ https://www.nasm.us/pub/nasm/releasebuilds/2.16.01/.
  112. ^ Release 2.16. 2022年12月21日 [2023年1月12日]. 
  113. ^ Ram Narayan. Linux assemblers: A comparison of GAS and NASM. [2018-03-29]. (原始内容于2013-10-03). two of the most popular assemblers for Linux, GNU Assembler (GAS) and Netwide Assembler (NASM) 
  114. ^ . [2008-06-27]. (原始内容存档于2008-07-24). 
  115. ^ . [2009-07-19]. (原始内容存档于2009-07-04). 
  116. ^ NASM Manual. [2009-08-15]. (原始内容于2009-02-23). 
  117. ^ Randall Hyde. NASM: The Netwide Assembler. [2008-06-27]. (原始内容于2010-09-12). 
  118. ^ . [2017-04-23]. (原始内容存档于2017-05-01). 
  119. ^ . [2009-09-14]. (原始内容存档于2010-01-23). 
  120. ^ . [2008-06-27]. (原始内容存档于2008-07-24). 
  121. ^ . 2008-06-08 [2008-06-27]. (原始内容存档于2022-04-07). 
  122. ^ . 2002-12-04 [2008-06-27]. (原始内容存档于2022-04-07). 

进一步阅读 编辑

外部链接 编辑

  • A comparison of GAS and NASM(页面存档备份,存于互联网档案馆) at IBM
  • Freecode英语Freecode上的Netwide Assembler: a converter between the source format of the assemblers NASM and GAS

netwide, assembler, 简称, nasm, 是一款基于英特尔, 架构的汇编与反汇编工具, 它可以用来编写, 16位, 32位, 64位, 的程序, nasm, 被认为是, linux, 平台上最受欢迎的汇编工具之一, 原作者simon, tatham, julian, hall開發者h, peter, anvin, 当前版本2, 2015年2月21日, 2017年4月29日, 2017年11月30日, 2018年2月8日, 2018年12月26日, 2020年6月27日, 2020年6月27日, 2. Netwide Assembler 简称 NASM 是一款基于英特尔 x86 架构的汇编与反汇编工具 它可以用来编写 16位 32位 IA 32 和 64位 x86 64 的程序 NASM 被认为是 Linux 平台上最受欢迎的汇编工具之一 113 Netwide Assembler原作者Simon Tatham Julian Hall開發者H Peter Anvin et al 当前版本2 11 08 2015年2月21日 1 2 13 2017年4月29日 2 3 2 13 02 2017年11月30日 4 5 2 13 03 2018年2月8日 6 7 2 14 02 2018年12月26日 8 9 2 15 2020年6月27日 10 11 12 13 2 15 01 2020年6月27日 10 14 15 2 15 02 2020年7月2日 10 16 17 0 91 2002年4月30日 18 0 93 2002年4月30日 19 0 94 2002年4月30日 20 0 95 2002年4月30日 21 0 96 2002年4月30日 22 0 97 2002年4月30日 23 0 98e 2002年4月30日 24 0 98 2002年4月30日 25 0 98 03 2002年4月30日 26 0 98 08 2002年4月30日 27 0 98 09 2002年4月30日 28 0 98 11 2002年4月30日 29 0 98 12 2002年4月30日 30 0 98 14 2002年4月30日 31 0 98 15 2002年4月30日 32 0 98 16 2002年4月30日 33 0 98 17 2002年4月30日 34 0 98 18 2002年4月30日 35 0 98 19 2002年4月30日 36 0 98 20 2002年4月30日 37 0 98 21 2002年4月30日 38 0 98 22 2002年4月30日 39 0 98 23 2002年4月30日 40 0 98 24 2002年4月30日 41 0 98 25 2002年4月30日 42 0 98 26 2002年4月30日 43 0 98 30 2002年4月30日 44 0 98 31 2002年5月10日 45 0 98 32 2002年5月19日 46 0 98 33 2002年5月27日 47 0 98 34 2002年6月8日 48 0 98 35 2002年9月13日 49 0 98 36 2003年3月12日 50 0 98 37 2003年8月29日 51 0 98 38 2003年9月12日 52 0 98 39 2005年1月15日 53 0 99 01 2007年5月30日 54 0 99 02 2007年9月4日 55 0 99 03 2007年9月20日 56 0 99 04 2007年9月26日 57 0 99 05 2007年10月17日 58 0 99 06 2007年11月1日 59 2 00 2007年11月28日 60 2 01 2008年1月17日 61 2 02 2008年2月19日 62 2 03 2008年6月9日 63 2 03 01 2008年6月17日 64 2 04 2008年9月26日 65 2 05 2008年10月24日 66 2 05 01 2008年10月29日 67 2 06 2009年6月30日 68 2 07 2009年7月20日 69 2 08 2010年3月10日 70 2 08 01 2010年3月10日 71 2 08 02 2010年7月9日 72 2 09 2010年8月24日 73 2 09 01 2010年9月7日 74 2 09 02 2010年9月17日 75 2 09 03 2010年10月27日 76 2 09 04 2010年11月21日 77 2 09 05 2011年2月20日 78 2 09 06 2011年2月28日 79 2 09 07 2011年3月12日 80 2 09 08 2011年4月6日 81 2 09 09 2011年7月3日 82 2 09 10 2011年7月15日 83 2 10 2012年3月12日 84 2 10 01 2012年5月24日 85 2 10 02 2012年7月21日 86 2 10 03 2012年7月23日 87 2 10 04 2012年8月18日 88 2 10 05 2012年9月9日 89 2 10 06 2012年12月4日 90 2 10 07 2013年1月2日 91 2 10 08 2013年7月21日 92 2 10 09 2013年7月23日 93 2 11 2013年12月31日 94 2 11 01 2014年2月18日 95 2 11 02 2014年2月19日 96 2 11 03 2014年5月5日 97 2 11 04 2014年5月9日 98 2 11 05 2014年5月21日 99 2 11 06 2014年10月17日 100 2 11 07 2014年12月9日 101 2 12 2016年2月27日 102 2 12 01 2016年3月18日 103 2 12 02 2016年7月6日 104 2 13 01 2017年5月2日 105 2 14 2018年11月7日 106 2 14 01 2018年12月23日 107 2 15 03 2020年7月18日 108 2 15 04 2020年8月20日 109 2 15 05 2020年8月28日 110 2 16 01 2022年12月21日 111 2 16 2022年12月21日 112 源代码库github wbr com wbr netwide assembler wbr nasm操作系统Windows Unix like OS 2 MS DOS语言English类型x86 assembler许可协议BSD 2 clause网站www wbr nasm wbr usNASM 最初是在朱利安 霍尔的协助下由西蒙 泰瑟姆开发的 截至2016年 2016 Missing required parameter 1 month update 它被一个由 H Peter Anvin 领导的小团队所维护 114 它是一款基于简化版 二句版 BSD许可证的开放源代码软件 115 目录 1 功能 2 用于各种操作系统的示例程序 3 链接 4 发展 5 RDOFF 6 另请参见 7 参考文献 8 进一步阅读 9 外部链接功能 编辑NASM 可以输出包括 COFF OMF a out 可执行与可链接格式 ELF Mach O 和二进制文件 bin 二进制磁盘映像 用于编译操作系统 等多种二进制格式 而地址无关代码仅支持 ELF 对象文件 NASM 也有自己的二進位格式 稱為 RDOFF 116 输出格式的广泛性允许将程序重定向到任何 x86 操作系统 OS 此外 NASM 可以创建浮动二进制文件 它可用于写入引导加载程序 只读存储器 ROM 映像以及操作系统开发的各个方面 NASM 可以作为交叉汇编程序 如 PowerPC 和 SPARC 在非 x86 平台上运行 尽管它不能生成这些机器可用的程序 NASM 使用英特尔汇编语法的变体而不是 AT amp T 语法 GNU 汇编器采用的语法 117 它还避免了 MASM 和兼容汇编器使用的自动生成區段覆盖 以及相关的 ASSUME 指令 等功能 用于各种操作系统的示例程序 编辑这是一个 DOS 操作系统下的 Hello world 程序 section text org 0x100 mov ah 0x9 mov dx hello int 0x21 mov ax 0x4c00 int 0x21 section data hello db Hello world 13 10 一个类似程序在 Microsoft Windows 下的示例 global main extern MessageBoxA 16 extern ExitProcess 4 section code use32 class code main push dword 0 UINT uType MB OK push dword title LPCSTR lpCaption push dword banner LPCSTR lpText push dword 0 HWND hWnd NULL call MessageBoxA 16 push dword 0 UINT uExitCode call ExitProcess 4 section data use32 class data banner db Hello world 0 title db Hello 0一段 Linux 下的等价程序 global start section text start mov eax 4 write mov ebx 1 stdout mov ecx msg mov edx msg len int 0x80 write stdout msg strlen msg mov eax 1 exit mov ebx 0 int 0x80 exit 0 section data msg db Hello world 10 len equ msg下面是一个用于苹果 macOS 原為 OS X 的 64 位元程序 用于输入按键并将其显示在屏幕上 global start section data query string db Enter a character query string len equ query string out string db You have input out string len equ out string section bss in char resw 4 section text start mov rax 0x2000004 put the write system call code into register rax mov rdi 1 tell kernel to use stdout mov rsi query string rsi is where the kernel expects to find the address of the message mov rdx query string len and rdx is where the kernel expects to find the length of the message syscall read in the character mov rax 0x2000003 read system call mov rdi 0 stdin mov rsi in char address for storage declared in section bss mov rdx 2 get 2 bytes from the kernel s buffer one for the carriage return syscall show user the output mov rax 0x2000004 write system call mov rdi 1 stdout mov rsi out string mov rdx out string len syscall mov rax 0x2000004 write system call mov rdi 1 stdout mov rsi in char mov rdx 2 the second byte is to apply the carriage return expected in the string syscall exit system call mov rax 0x2000001 exit system call xor rdi rdi syscall链接 编辑NASM 主要输出目标文件 扩展名一般为 obj 这些目标文件通常不能自行执行 唯一的例外是浮动二进制文件 例如 COM 它们在现代使用中固有地受到限制 要将目标文件转换为可执行程序 必须使用适当的链接程序 例如用于 Windows 的 Visual Studio LINK 实用程序或用于类 Unix 系统的 ld 发展 编辑第一版 版本号0 90 发布于1996年10月 118 2007年11月28日 2 00版本发布 增加对 x86 64 扩展的支持 开发版本不再上传到 SourceForge net 相反 它们会被检入到项目自己的 Git 存储库中 而其二进制程序的快照可在项目官网上找到 一个用于 NASM 文档的搜索引擎也已可用 119 截至 2 07 版本 NASM 在简化 BSD 许可证 二句版 下发布 RDOFF 编辑RDOFF开发者Julian Hall格式类型Object file format作为容器Object code开发人员使用可重定位的动态对象文件格式 RDOFF 来测试 NASM 的目标文件输出能力的完整性 它很大程度上基于 NASM 的内部结构 120 主要由一个头部组成 头部包含输出驱动程序函数调用的序列化 后跟包含可执行代码或数据的部分数组 NASM 发行版中包含了使用该格式的工具 包括链接程序 linker 和加载程序 loader 直到1996年10月发布 0 90 版 NASM 才支持只输出浮动格式的可执行文件 例如 DOS 的 COM 文件 在版本 0 90 中 Simon Tatham 增加了对一个目标文件输出接口的支持 并且只支持用于 16 位元代码的 DOS 的 OBJ 文件 121 NASM 因此缺少一个 32 位元的对象格式 为了解决这个问题 作为学习对象文件接口的练习 开发人员朱利安 霍尔将第一版 RDOFF 发布于 NASM 0 91 版本 自从这个初始版本以来 对 RDOFF 格式进行了一次重大更新 它在每个标题记录上增加了一个记录长度指示器 122 允许程序跳过它们无法识别格式的记录 并支持多个區段 RDOFF1 仅支持三個區段 文本 数据和 bss 包含未初始化的数据 另请参见 编辑汇编语言 汇编器列表 Yasm参考文献 编辑 Release 2 11 08 2015年2月21日 2020年7月8日 Index of pub nasm releasebuilds 2 13 2018年1月2日 Release 2 13 2017年4月29日 2020年7月8日 http repo or cz nasm git commit fe2f6de2ee85959747a4e4a99ea43a38509cc3b2 检索日期 2018年1月17日 Release 2 13 02 2017年11月29日 2020年7月8日 http repo or cz nasm git tag refs tags nasm 2 13 03 检索日期 2018年2月11日 Release 2 13 03 2018年2月7日 2020年7月8日 https repo or cz nasm git tag a73b8be6f0f9e307e3c6131011a30f2fd5b00877 检索日期 2020年7月7日 https github com netwide assembler nasm releases tag nasm 2 14 02 检索日期 2020年7月7日 10 0 10 1 10 2 https www nasm us pub nasm releasebuilds C M O D 检索日期 2020年7月7日 Announcing NASM 2 15 2020年6月27日 2020年7月7日 英語 引文格式1维护 未识别语文类型 link https repo or cz nasm git tag 03231c40a59533ec28f593f5a549688239a3c637 检索日期 2020年7月7日 https github com netwide assembler nasm releases tag nasm 2 15 检索日期 2020年7月7日 https repo or cz nasm git tag 6d78c07e6b0d1602ab096eec29628bfa7afb639c 检索日期 2020年7月7日 https github com netwide assembler nasm releases tag nasm 2 15 01 检索日期 2020年7月7日 https nasm us doc nasmdocc html 检索日期 2020年7月7日 https github com netwide assembler nasm releases tag nasm 2 15 02 检索日期 2020年7月7日 Release 0 91 2002年4月30日 2020年7月8日 Release 0 93 2002年4月30日 2020年7月8日 Release 0 94 2002年4月30日 2020年7月8日 Release 0 95 2002年4月30日 2020年7月8日 Release 0 96 2002年4月30日 2020年7月8日 Release 0 97 2002年4月30日 2020年7月8日 Release 0 98e 2002年4月30日 2020年7月8日 Release 0 98 2002年4月30日 2020年7月8日 Release 0 98 03 2002年4月30日 2020年7月8日 Release 0 98 08 2002年4月30日 2020年7月8日 Release 0 98 09 2002年4月30日 2020年7月8日 Release 0 98 11 2002年4月30日 2020年7月8日 Release 0 98 12 2002年4月30日 2020年7月8日 Release 0 98 14 2002年4月30日 2020年7月8日 Release 0 98 15 2002年4月30日 2020年7月8日 Release 0 98 16 2002年4月30日 2020年7月8日 Release 0 98 17 2002年4月30日 2020年7月8日 Release 0 98 18 2002年4月30日 2020年7月8日 Release 0 98 19 2002年4月30日 2020年7月8日 Release 0 98 20 2002年4月30日 2020年7月8日 Release 0 98 21 2002年4月30日 2020年7月8日 Release 0 98 22 2002年4月30日 2020年7月8日 Release 0 98 23 2002年4月30日 2020年7月8日 Release 0 98 24 2002年4月30日 2020年7月8日 Release 0 98 25 2002年4月30日 2020年7月8日 Release 0 98 26 2002年4月30日 2020年7月8日 Release 0 98 30 2002年4月30日 2020年7月8日 Release 0 98 31 2002年5月10日 2020年7月8日 Release 0 98 32 2002年5月19日 2020年7月8日 Release 0 98 33 2002年5月27日 2020年7月8日 Release 0 98 34 2002年6月8日 2020年7月8日 Release 0 98 35 2002年9月13日 2020年7月8日 Release 0 98 36 2003年3月12日 2020年7月8日 Release 0 98 37 2003年8月29日 2020年7月8日 Release 0 98 38 2003年9月12日 2020年7月8日 Release 0 98 39 2005年1月15日 2020年7月8日 Release 0 99 01 2007年5月30日 2020年7月8日 Release 0 99 02 2007年9月4日 2020年7月8日 Release 0 99 03 2007年9月20日 2020年7月8日 Release 0 99 04 2007年9月26日 2020年7月8日 Release 0 99 05 2007年10月17日 2020年7月8日 Release 0 99 06 2007年11月1日 2020年7月8日 Release 2 00 2007年11月28日 2020年7月8日 Release 2 01 2008年1月17日 2020年7月8日 Release 2 02 2008年2月19日 2020年7月8日 Release 2 03 2008年6月9日 2020年7月8日 Release 2 03 01 2008年6月17日 2020年7月8日 Release 2 04 2008年9月26日 2020年7月8日 Release 2 05 2008年10月24日 2020年7月8日 Release 2 05 01 2008年10月29日 2020年7月8日 Release 2 06 2009年6月30日 2020年7月8日 Release 2 07 2009年7月20日 2020年7月8日 Release 2 08 2010年3月10日 2020年7月8日 Release 2 08 01 2010年3月10日 2020年7月8日 Release 2 08 02 2010年7月9日 2020年7月8日 Release 2 09 2010年8月24日 2020年7月8日 Release 2 09 01 2010年9月7日 2020年7月8日 Release 2 09 02 2010年9月17日 2020年7月8日 Release 2 09 03 2010年10月27日 2020年7月8日 Release 2 09 04 2010年11月21日 2020年7月8日 Release 2 09 05 2011年2月20日 2020年7月8日 Release 2 09 06 2011年2月28日 2020年7月8日 Release 2 09 07 2011年3月12日 2020年7月8日 Release 2 09 08 2011年4月6日 2020年7月8日 Release 2 09 09 2011年7月3日 2020年7月8日 Release 2 09 10 2011年7月15日 2020年7月8日 Release 2 10 2012年3月12日 2020年7月8日 Release 2 10 01 2012年5月24日 2020年7月8日 Release 2 10 02 2012年7月21日 2020年7月8日 Release 2 10 03 2012年7月23日 2020年7月8日 Release 2 10 04 2012年8月18日 2020年7月8日 Release 2 10 05 2012年9月9日 2020年7月8日 Release 2 10 06 2012年12月4日 2020年7月8日 Release 2 10 07 2013年1月2日 2020年7月8日 Release 2 10 08 2013年7月21日 2020年7月8日 Release 2 10 09 2013年7月23日 2020年7月8日 Release 2 11 2013年12月31日 2020年7月8日 Release 2 11 01 2014年2月18日 2020年7月8日 Release 2 11 02 2014年2月19日 2020年7月8日 Release 2 11 03 2014年5月5日 2020年7月8日 Release 2 11 04 2014年5月9日 2020年7月8日 Release 2 11 05 2014年5月21日 2020年7月8日 Release 2 11 06 2014年10月17日 2020年7月8日 Release 2 11 07 2014年12月9日 2020年7月8日 Release 2 12 2016年2月27日 2020年7月8日 Release 2 12 01 2016年3月18日 2020年7月8日 Release 2 12 02 2016年7月6日 2020年7月8日 Release 2 13 01 2017年5月2日 2020年7月8日 Release 2 14 2018年11月7日 2020年7月8日 Release 2 14 01 2018年12月23日 2020年7月8日 Release 2 15 03 2020年7月18日 2020年7月18日 Release 2 15 04 2020年8月20日 2020年9月6日 Release 2 15 05 2020年8月28日 2020年9月6日 https www nasm us pub nasm releasebuilds 2 16 01 Release 2 16 2022年12月21日 2023年1月12日 Ram Narayan Linux assemblers A comparison of GAS and NASM 2018 03 29 原始内容存档于2013 10 03 two of the most popular assemblers for Linux GNU Assembler GAS and Netwide Assembler NASM The Netwide Assembler 2008 06 27 原始内容存档于2008 07 24 NASM Version History 2009 07 19 原始内容存档于2009 07 04 NASM Manual 2009 08 15 原始内容存档于2009 02 23 Randall Hyde NASM The Netwide Assembler 2008 06 27 原始内容存档于2010 09 12 NASM Version History 2017 04 23 原始内容存档于2017 05 01 NASM Doc Search Engine 2009 09 14 原始内容存档于2010 01 23 NASM Manual Ch 6 2008 06 27 原始内容存档于2008 07 24 NASM CVS 2008 06 08 2008 06 27 原始内容存档于2022 04 07 V1 V2 txt 2002 12 04 2008 06 27 原始内容存档于2022 04 07 进一步阅读 编辑Jeff Duntemann Assembly Language Step by Step J Wiley and Sons 2000 ISBN 0 471 37523 3 外部链接 编辑官方网站 SourceForge net上的Netwide AssemblerSpecial edition for Win32 and BeOS A comparison of GAS and NASM 页面存档备份 存于互联网档案馆 at IBM Freecode 英语 Freecode 上的Netwide Assembler a converter between the source format of the assemblers NASM and GASFreshmeat1intel2gas 取自 https zh wikipedia org w index php title Netwide Assembler amp oldid 78373863, 维基百科,wiki,书籍,书籍,图书馆,

文章

,阅读,下载,免费,免费下载,mp3,视频,mp4,3gp, jpg,jpeg,gif,png,图片,音乐,歌曲,电影,书籍,游戏,游戏。