Skip to content

Instantly share code, notes, and snippets.

@Sasha-hk
Last active June 14, 2022 18:57
Show Gist options
  • Save Sasha-hk/1dd471df55307ea8ab40822ff9045acc to your computer and use it in GitHub Desktop.
Save Sasha-hk/1dd471df55307ea8ab40822ff9045acc to your computer and use it in GitHub Desktop.
Hello world on assembler

Assembler on Linux

Hello world:

section     .text
global      _start 
_start: 
    mov     edx,len   
    mov     ecx,msg   
    mov     ebx,1   
    mov     eax,4   
    int     0x80   
    mov     eax,1  
    int     0x80   
section     .data
msg     db  'Hello world',0xa  
len     equ $ - msg   

filename > hello.asm

Compile:

nasm -f elf64 hello.asm

Link:

ld -s -o hello hello.o
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment