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
.section __DATA,__data # OSX specific form of ".section data" | |
SOURCE: # .incbin copies files into applications byte-for-byte | |
.incbin "g" # so this is loading the source's bytes into a var called SOURCE | |
SIZE = . - SOURCE # . here points to the byte after SOURCE in memory | |
# so . - SOURCE returns the length of SOURCE in mem | |
.section __TEXT,__text | |
.globl _main # entry point. also OSX needs _ before the function | |
_main: | |
movl $0x2000004, %eax # x64 needs to pad syscalls w 0x2000000 so 4 is sys_write | |
movl $1, %edi # with sys_write in eax, moving 1 into edi says write to console |