Skip to content

Instantly share code, notes, and snippets.

@dekay
dekay / nasm2gas5.s
Created July 21, 2013 19:03
Listing 5 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 nasm2gas5.o nasm2gas5.s
# Link with: ld --dynamic-linker /lib/ld-linux.so.2 -lc -o nasm2gas5 nasm2gas5.o
#
# Support intel syntal vs. ATT and don't use % before register names
.intel_syntax noprefix
.section .data
# Command table to store at most 10 command line arguments
@dekay
dekay / nasm2gas4.s
Created July 21, 2013 19:02
Listing 4 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 nasm2gas4.o nasm2gas4.s
# Link with: ld --dynamic-linker /lib/ld-linux.so.2 -lc -o nasm2gas4 nasm2gas4.o
#
# Support intel syntal vs. ATT and don't use % before register names
.intel_syntax noprefix
.section .data
array: .byte 89, 10, 67, 1, 4, 27, 12, 34, 86, 3
@dekay
dekay / nasm2gas3.s
Last active August 26, 2023 16:11
Listing 3 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 nasm2gas3.o nasm2gas3.s
# Link with: ld -o nasm2gas3 nasm2gas3.o
#
# Support intel syntal vs. ATT and don't use % before register names
.intel_syntax noprefix
.section .rodata
prompt_str: .ascii "Enter Your Name: \n"
@dekay
dekay / nasm2gas2.s
Created July 21, 2013 18:56
Listing 2 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 nasm2gas2.o nasm2gas2.s
# Link with ld -o nasm2gas2 nasm2gas2.o
# Check program return status with "echo $?"
#
# Support intel syntal vs. ATT and don't use % before register names
.intel_syntax noprefix
.section .data
@dekay
dekay / nasm2gas1.s
Created July 21, 2013 18:55
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