Skip to content

Instantly share code, notes, and snippets.

@thewh1teagle
Created June 26, 2020 21:39
Show Gist options
  • Save thewh1teagle/760d84f9a8c6ee4afb784998ef323501 to your computer and use it in GitHub Desktop.
Save thewh1teagle/760d84f9a8c6ee4afb784998ef323501 to your computer and use it in GitHub Desktop.
very easy hello world assembly code for x86 architecture
# Useful variables
STDIN equ 0
STDOUT equ 1
STDERR equ 2
SYS_READ equ 0
SYS_WRITE equ 4
SYS_EXIT equ 1
KERNEL equ 0x80 ; interrupt number
%macro syscall 0
int KERNEL ;call kernel [interrupt]
%endmacro
%macro exit_success 0
mov eax, SYS_EXIT
syscall
%endmacro
section .data
msg db "Hello world!", 0x0a ; 0x0a in decimel is new line ascii
len equ $ - msg ; $ indicates the 'current location' of the assembler
section .text
global _start
_start:
mov ecx, msg
mov edx, len
mov ebx, STDOUT
mov eax, SYS_WRITE
syscall
exit_success
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment