- Mastering Assembly Programming
- Alexey Lyashko
- 205字
- 2021-08-20 10:23:32
Linux
If you are on Linux, the source code will be even shorter. Open your favorite source editor, whether it is nano, emacs, or vi, or whatever, and enter the following code:
format ELF executable 3
entry _start
segment readable executable
_start:
mov eax, 4
mov ebx, 1
mov ecx, message
mov edx, len
int 0x80
xor ebx, ebx
mov eax, ebx
inc eax
int 0x80
segment readable writeable
message db 'Hello from FASM on Linux!', 0x0a
len = $ - message
The code is much more compact than that on Windows, as we are not using any high-level API functions; we'd rather use Linux system calls directly (this could turn into a nightmare on Windows). Save the file as fasm1lin.asm (this is not GAS or GCC, so we are free to give the Assembly source file its usual extension) and go to the terminal emulator. Issue the following command (assuming the fasm executable is in the place mentioned in the PATH environment variable) in order to build the executable out of this code:
fasm fasm1lin.asm fasm1lin
Then, try to run the file with the following:
./fasm1lin
You should see something like this:

As simple as that.
- Java入門很輕松(微課超值版)
- 從0到1:HTML+CSS快速上手
- Linux網絡程序設計:基于龍芯平臺
- C語言程序設計案例式教程
- SharePoint Development with the SharePoint Framework
- Scratch趣味編程:陪孩子像搭積木一樣學編程
- Kubernetes源碼剖析
- Android應用開發深入學習實錄
- 算法精解:C語言描述
- 輕松學Scratch 3.0 少兒編程(全彩)
- ASP.NET Core 2 High Performance(Second Edition)
- Mastering Vim
- Elasticsearch實戰(第2版)
- 亮劍C#項目開發案例導航
- Hands-On Game Development Patterns with Unity 2019