Mac under compilation Hello World

Source: Internet
Author: User

From: http://snipplr.com/view/29150

; Hello World on Assembly for Mac; Nasm-f Macho hello.asm; Ld-e _start-o Hello hello.o;section. Text global _start; must be declared for Linker (LD) _SYSC     All:int 0x80; system call Ret_start:; Tell linker entry point  push DWORD Len; message length push DWORD msg; message to write push DWORD 1; file                             Descriptor (STDOUT) MOV eax,0x4; system call number (Sys_write), call _syscall;                             ; The alternate-to-call kernel:;p ush eax     Call 7:0 add esp,12, clean stack (3 arguments * 4) push DWORD 0; Exit code                             MOV eax,0x1; system call NUMBER (Sys_exit) call _syscall; call kernel ; We do not return from sys_exit,; there ' s no need to CLEAN stacksection. Datamsg db "Hello, world!", 0xa; our dear Stringlen equ $-msg; len Gth of our dear string

  

Mac under compilation Hello World

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.