Sha256: a6eeebba3576b4aeef6bb8a4f164db6308d9da6960a1d84e582710343ea0641a

Contents?: true

Size: 804 Bytes

Versions: 10

Compression:

Stored size: 804 Bytes

Contents

{{works with|nasm|2.05.01}}

This is known to work on Linux, it may or may not work on other Unix-like systems

Prints "Hello world!" to stdout (and there is probably an even simpler version):
section .data
msg     db      'Hello world!', 0AH
len     equ     $-msg

section .text
global  _start
_start: mov     edx, len
        mov     ecx, msg
        mov     ebx, 1
        mov     eax, 4
        int     80h

        mov     ebx, 0
        mov     eax, 1
        int     80h

'''AT&T syntax:''' works with gcc (version 4.9.2) and gas (version 2.5):

.section .text

.globl main

main:
	movl $4,%eax	#syscall number 4
	movl $1,%ebx	#number 1 for stdout
	movl $str,%ecx	#string pointer
	movl $16,%edx	#number of bytes
	int $0x80	#syscall interrupt
	ret

.section .data
str: .ascii "Hello world!\12"

Version data entries

10 entries across 7 versions & 1 rubygems

Version Path
zettacode-0.1.7 files.zettacode/hello_world.text/x86_assembly.txt
zettacode-0.1.6 files.zettacode/hello_world.text/x86_assembly.txt
zettacode-0.1.6 files.zettacode2/hello_world.text/x86_assembly.txt
zettacode-0.1.5 files.zettacode/hello_world.text/x86_assembly.txt
zettacode-0.1.5 files.zettacode2/hello_world.text/x86_assembly.txt
zettacode-0.1.4 files.zettacode/hello_world.text/x86_assembly.txt
zettacode-0.1.4 files.zettacode2/hello_world.text/x86_assembly.txt
zettacode-0.1.3 files.zettacode/hello_world.text/x86_assembly.txt
zettacode-0.1.2 files.zettacode/hello_world.text/x86_assembly.txt
zettacode-0.1.1 zettacode.files/hello_world.text/x86_assembly.txt