Skip to content

Instantly share code, notes, and snippets.

@asantos2000
Created June 26, 2019 14:52
Show Gist options
  • Save asantos2000/f4fe6a80f1e1d2f6d8d42ffa277a01f7 to your computer and use it in GitHub Desktop.
Save asantos2000/f4fe6a80f1e1d2f6d8d42ffa277a01f7 to your computer and use it in GitHub Desktop.

Revisions

  1. asantos2000 created this gist Jun 26, 2019.
    23 changes: 23 additions & 0 deletions hello.s
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    ; /usr/local/bin/nasm -f macho64 64.asm && ld -macosx_version_min 10.7.0 -lSystem -o 64 64.o && ./64

    global start


    section .text

    start:
    mov rax, 0x2000004 ; write
    mov rdi, 1 ; stdout
    mov rsi, msg
    mov rdx, msg.len
    syscall

    mov rax, 0x2000001 ; exit
    mov rdi, 0
    syscall


    section .data

    msg: db "Hello, world!", 10
    .len: equ $ - msg