Skip to content

Instantly share code, notes, and snippets.

@maxdeliso
Created October 14, 2012 04:40
Show Gist options
  • Save maxdeliso/3887364 to your computer and use it in GitHub Desktop.
Save maxdeliso/3887364 to your computer and use it in GitHub Desktop.
linux console mode hello, world in assembly
probe: probe.o makefile.linux
ld -o probe -e probe probe.o
probe.o: probe.asm makefile.linux
nasm -o probe.o -felf32 probe.asm
clean:
rm -f probe.o probe
global probe
section .text
probe:
push ebp
mov ebp, esp
sub esp, 4
mov eax, 4
mov ebx, 1
mov ecx, msg
mov edx, msgLen
int 0x80 ; write
mov eax, 3
xor ebx, ebx
mov ecx, esp
mov edx, 4
int 0x80 ; read
mov eax, 1
xor ebx, ebx
int 0x80 ; exit
section .rodata
msg: db 'hello, world', 10, 0
msgLen: equ $-msg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment