Sco*_*rch 24 compiling assembler 18.04
所以最近想学汇编,所以学了一点。我把它放到nano 中并保存为playground.asm。现在我想知道,我如何编译和运行它?我已经到处搜索了,仍然找不到。我真的很好奇,如果你甚至不会使用语言,那么学习它是没有意义的。
kar*_*rel 30
在所有当前支持的 Ubuntu 版本中,打开终端并输入:
sudo apt install as31 nasm
Run Code Online (Sandbox Code Playgroud)
as31 : Intel 8031/8051 assembler
这是一个快速、简单、易于使用的 Intel 8031/8051 汇编程序。
nasm:通用 x86 汇编
器网络汇编器。NASM 目前将输出平面形式的二进制文件、a.out、COFF 和 ELF Unix 目标文件,以及 Microsoft 16 位 DOS 和 Win32 目标文件。
这是打印 Hello world 的汇编语言程序的代码。
sudo apt install as31 nasm
Run Code Online (Sandbox Code Playgroud)
如果您在 Ubuntu 18.04 中使用 NASM,则编译和运行名为 hello.asm 的 .asm 文件的命令是:
nasm -f elf64 hello.asm # assemble the program
ld -s -o hello hello.o # link the object file nasm produced into an executable file
./hello # hello is an executable file
Run Code Online (Sandbox Code Playgroud)
Ubuntu 附带as(便携式 GNU 汇编器)
as file.s -o file.out
ld file.out -e main -o file
./file
Run Code Online (Sandbox Code Playgroud)
-o
: 告诉将输出发送到哪里
-e
: 告诉 ld 开始符号
归档时间: |
|
查看次数: |
51535 次 |
最近记录: |