Created
July 21, 2013 18:55
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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