After installing any version of Intel-based Xcode, you should be able to write assembly code. Xcode is a toolkit, only one of which is an IDE, so you don’t need to use it if you don’t want it. (However, if there are certain things that you find awkward, write an error to Apple's error reporter - every error goes into engineering.) In addition, the Xcode installation will install both Netwide Assembler (NASM) and GNU Assembler (GAS) ; which will allow you to use any assembly syntax with which you are most comfortable.
You will also want to take a look at the Compiler and Debugging Guides , as these documents are conventions that are used for various architectures that run Mac OS X, and how the binary format and bootloader work. IA-32 (x86-32) conventions, in particular, may differ slightly from what you are used to.
Another thing to keep in mind is that the system call interface on Mac OS X is different from what you could use for DOS / Windows, Linux, or other BSD accessories. System calls are not considered a stable API on Mac OS X; instead, you always go through libSystem. This ensures that you write code that is portable from one OS release to another.
Lastly, keep in mind that Mac OS X goes through a fairly wide range of hardware - everything from the 32-bit Core Single to the high-end quad-core Xeon processor. When coding in an assembly, you may not optimize as much as you think; what is optimal on one machine may be pessimal on another. Apple regularly measures its compilers and adjusts its products with the “-O” optimization flag to be worthy throughout its line, and there are extensive vector / matrix processing libraries that you can use to get high performance with processor-specific settings, with manual setting.
The assembly for fun is excellent. Switching to assembly for speed is not for the faint of heart these days.
Chris Hanson Aug 08 '08 at 7:07 2008-08-08 07:07
source share