osx/hello.asm
author Markus Bröker<broeker.markus@googlemail.com>
Fri, 20 Oct 2017 06:41:27 +0200
changeset 168 dfb60716880c
child 171 c6e0af68825a
permissions -rw-r--r--
Broken OSX Demo added
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
168
dfb60716880c Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff changeset
     1
section .data
dfb60716880c Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff changeset
     2
    msg db "Hello World!", 0x0a ; Die Nachricht
dfb60716880c Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff changeset
     3
    len equ $-msg
dfb60716880c Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff changeset
     4
dfb60716880c Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff changeset
     5
section .text
dfb60716880c Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff changeset
     6
global entryPoint
dfb60716880c Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff changeset
     7
dfb60716880c Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff changeset
     8
call entryPoint
dfb60716880c Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff changeset
     9
jmp asm_exit
dfb60716880c Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff changeset
    10
dfb60716880c Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff changeset
    11
entryPoint:
dfb60716880c Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff changeset
    12
    push dword len      ;; Länge des Texts
dfb60716880c Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff changeset
    13
    push dword msg      ;; Der Text
dfb60716880c Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff changeset
    14
    push dword 1        ;; stdout
dfb60716880c Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff changeset
    15
dfb60716880c Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff changeset
    16
	;; call write
dfb60716880c Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff changeset
    17
    mov eax, 0x4
dfb60716880c Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff changeset
    18
    sub esp, 4
dfb60716880c Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff changeset
    19
    int 0x80
dfb60716880c Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff changeset
    20
dfb60716880c Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff changeset
    21
    ;; clean up 3 pushes
dfb60716880c Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff changeset
    22
    add esp, 16
dfb60716880c Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff changeset
    23
dfb60716880c Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff changeset
    24
	ret
dfb60716880c Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff changeset
    25
	
dfb60716880c Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff changeset
    26
asm_exit:	
dfb60716880c Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff changeset
    27
    mov eax, 0x1
dfb60716880c Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff changeset
    28
	sub esp, 4
dfb60716880c Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff changeset
    29
    int 0x80
dfb60716880c Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff changeset
    30
dfb60716880c Broken OSX Demo added
Markus Bröker<broeker.markus@googlemail.com>
parents:
diff changeset
    31
	add esp, 4