Jump to content

How do I program for Macintosh?

- - - - -

  • Please log in to reply
13 replies to this topic

#1
RhetoricalRuvim

RhetoricalRuvim

    JavaScript Programmer

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,252 posts
  • Location:C:\Countries\US
I am not new to Intel assembly language. I have made programs for Windows using the MASM32 and NASM assemblers. What assemblers/linkers would work for Macintosh? And also, how do I use system calls, there?

#2
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,118 posts
  • Location:Vancouver, Eh! Cleverness: 200
You are free to compile NASM from the source, i.e. with the GCC toolchain or whichever toolchain you use. Xcode is another popular option on the Mac systems.

For system calls, I have once read it was not well defined and unstable between releases of OSX, I would research this yourself to see the appropriate methods (I've no Macintosh experience.)
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#3
RhetoricalRuvim

RhetoricalRuvim

    JavaScript Programmer

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,252 posts
  • Location:C:\Countries\US
If I wanted to make an application for Windows, I would write the assembly source code, and then assemble and link it.

But what do I do to write an application for Macintosh?

I think maybe I could use NASM? Maybe write a program and assemble it using?:
\nasm\nasm -fobj %1.asm

Or does the output format need to be different? What linker do I use?

#4
Gunner

Gunner

    Learning Programmer

  • Members
  • PipPipPip
  • 45 posts
What happened to macs? They are intel CISC based now? No more RISC?

#5
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,118 posts
  • Location:Vancouver, Eh! Cleverness: 200

Gunner said:

What happened to macs? They are intel CISC based now? No more RISC?
It was announced seven years ago. There were low yields of 3GHz G5's and Apple was not happy with IBM's game plan with PowerPC development so they had switched.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#6
RhetoricalRuvim

RhetoricalRuvim

    JavaScript Programmer

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,252 posts
  • Location:C:\Countries\US
Are Macintosh programs assembled to .obj files first? Or do they use some other format?

#7
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,118 posts
  • Location:Vancouver, Eh! Cleverness: 200
You'd need to use the mach o object type:
nasm -f macho foo.asm

And I believe specify a start point as well:
ld -e _start -o foo foo.o

Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#8
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,118 posts
  • Location:Vancouver, Eh! Cleverness: 200
I apologize, I have replied to your message. My device screen is small.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#9
RhetoricalRuvim

RhetoricalRuvim

    JavaScript Programmer

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,252 posts
  • Location:C:\Countries\US
Are Macintosh programs extension-less, like Linux/UNIX programs?

#10
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,118 posts
  • Location:Vancouver, Eh! Cleverness: 200

RhetoricalRuvim said:

Are Macintosh programs extension-less, like Linux/UNIX programs?
It utilizes the xnu kernel which has roots in NeXT(step) and BSD so it would follow their styles as Linux had from Unix.

You could read about it here:
XNU - Wikipedia, the free encyclopedia
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#11
RhetoricalRuvim

RhetoricalRuvim

    JavaScript Programmer

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,252 posts
  • Location:C:\Countries\US
I think I could probably make functions, that I'd be able to call from the main code, that do the system call stuff.

What should I do about the system calls?

#12
RhetoricalRuvim

RhetoricalRuvim

    JavaScript Programmer

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,252 posts
  • Location:C:\Countries\US
Okay, from reading that page, as far as I understood, Macintosh can take UNIX system calls. Is that right? The page: Mac OS X 64 bit Assembly Hello World | TheXploit | Security Blog

But I'll also need GUI functionality. I'll try Google-searching for mach system calls, and see what I come up with.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users