Ejemplo 1

Ejemplo»Hello World» básico para crear un ejecutable en linux con assembler.

Helloworld.asm

;Copyright (c) 1999 Konstantin Boldyshev <konst@linuxassembly.org>
;
;"hello, world" in assembly language for Linux
;
;to build an executable:
;       nasm -f elf hello.asm
;       ld -s -o hello hello.o

section .text
; Export the entry point to the ELF linker or loader.  The conventional
; entry point is "_start". Use "ld -e foo" to override the default.
    global _start

section .data
msg db  'Hello, world!',0xa ;our dear string
len equ $ - msg         ;length of our dear string

section .text

; linker puts the entry point here:
_start:

; Write the string to stdout:

    mov edx,len ;message length
    mov ecx,msg ;message to write
    mov ebx,1   ;file descriptor (stdout)
    mov eax,4   ;system call number (sys_write)
    int 0x80    ;call kernel

; Exit via the kernel:

    mov ebx,0   ;process' exit code
    mov eax,1   ;system call number (sys_exit)
    int 0x80    ;call kernel - this interrupt won't return

Compilar

Compilar el ejecutable:

nasm -f elf hello.asm
ld -s -o hello hello.o

compilar como 32 bits:

ld -m elf_i386 -s -o file file.o

Debugger

Depurador de código asm.

sudo apt install sasm

https://github.com/Dman95/SASM

Por sduro