Skip to content

Instantly share code, notes, and snippets.

@dekay
Created July 21, 2013 18:55
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dekay/6049538 to your computer and use it in GitHub Desktop.
Save dekay/6049538 to your computer and use it in GitHub Desktop.
Listing 1 from http://www.ibm.com/developerworks/library/l-gas-nasm/ translated to GNU as and written using intel syntax.
# Example adapted from http://www.ibm.com/developerworks/library/l-gas-nasm/
# Assemble with: as --gstabs+ -o nasm2gas1.o nasm2gas1.s
# Link with: ld -o nasm2gas1 nasm2gas1.o
# Check program return status with "echo $?"
#
# Support intel syntal vs. ATT and don't use % before register names
.intel_syntax noprefix
.section .text
# Program entry point
.globl _start
_start:
# Put the code number for system call
mov eax, 1
# Return value. Check returned value with "echo $?" on command line
mov ebx, 2
# Call the OS
int 0x80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment