Question:
Does anyone know of good book or pdf to start learning assembly language for mac?
Sean
2018-02-14 05:23:02 UTC
My Mac runs macOS High Sierra, and for a while know I have tried to learn assembly. There is very little documentation I can find for mac (for beginners at least) and I don't understand what documentation I have found. Does anyone know of a good book or pdf I can find that will teach me assembly that works on my mac and is for beginners?
Three answers:
Robert J
2018-02-14 13:34:20 UTC
You should be looking for different things; it's not really an all-in-one problem.



The actual assembly language relates to the CPU, not the computer it is in.

You need to look for "Intel x86" assembly for 32 bit code or "AMD64" for 64 bit code (even though it's an Intel CPU)..

eg. https://software.intel.com/en-us/articles/introduction-to-x64-assembly





Then you need information on setting up a template for an assembly program in xcode or whatever system you will be building with, plus info on the OSX API or user-program system calls for doing i/o etc.



http://peter.michaux.ca/articles/assembly-hello-world-for-os-x



http://dustin.schultz.io/mac-os-x-64-bit-assembly-system-calls.html
amania_r
2018-02-14 12:55:21 UTC
The MacOS kernel is written in C not assembler. Also, running assembler as a program will mean you only have access to a limited subset of the CPU's instruction set as many instructions will be privileged (i.e. only executable by the kernel). So you'll only have access to a limited virtual address space and not be able to do any I/O (unless you make system calls)
Laurence I
2018-02-14 09:54:32 UTC
use a mac c compiler(or Fortran or any high level language really), tell it to give you a source code listing and see what it looks like. go to amazon and type in "MAC OS X programming" and then go to abesbooks or similar trade in site to find a back issue at about 5 or 10 bucks.


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...