The MASM Forum

General => The Laboratory => Topic started by: johnsa on February 28, 2013, 01:20:01 AM

Title: ASM for Mac (OSX)
Post by: johnsa on February 28, 2013, 01:20:01 AM
Hey,

Has anyone tried using any of the normal assemblers available that we'd use for pc dev to do any mac coding?
I was curious as given the chip is the same it's only really a question of having a decent editor that's mac based and the file format.
I would imagine JWASM can be re-compiled to run on mac based on the linux ver?
It doesn't natively support mach-o format, but i see objconv can convert elf64 to mach-o.

Any thoughts would be appreciated.
Thanks!
John
Title: Re: ASM for Mac (OSX)
Post by: dedndave on February 28, 2013, 01:29:31 AM
last time i played with anything "mac" was a mac address   :lol:

for coding, it was 68K, C, Unix - that was mid-80's
mac seemed to want a piece of your pocket to get any tools, back then

so - it sounds like a nice avenue
i imagine you'd need a set of include files and import libraries - and away you go
(actually, you may not need the lib's, because you are not linking)
oh - and you have to know something about os/x   :biggrin:

i have heard of guys going the other way - writing pc code on a mac
Title: Re: ASM for Mac (OSX)
Post by: johnsa on February 28, 2013, 01:37:35 AM
Well thats the tricky part.. firstly the newer UI libs are designed to ONLY work with objective c (cocoa). The old carbon stuff is accessible from C/procedural.
I would imagine there are loads of .h files stashed away as part of xcode/gcc already. One would need to look at hand moving these across into inc files / or at least start building up a library of sys calls. I believe it's all BSD based and
runs via int 80h.

I'm not sure if this is even really a possibility, but it would be great to be able to use something like jwasm to write my pc code and mac code (albeit different code base - but same tools).
Title: Re: ASM for Mac (OSX)
Post by: anta40 on February 28, 2013, 01:45:41 AM
The FreePascal compiler is able to use Cocoa
http://wiki.freepascal.org/FPC_PasCocoa

Maybe that will give you some ideas on how to access cocoa via assembly.
Title: Re: ASM for Mac (OSX)
Post by: Gunther on February 28, 2013, 05:32:50 AM
Hi johnsa,

nasm is available for the Mac. You should give a try.

Gunther
Title: Re: ASM for Mac (OSX)
Post by: habran on February 28, 2013, 05:51:25 AM
hey johnsa,
Quote
Yasm currently supports the x86 and AMD64 instruction sets, accepts NASM and GAS assembler syntaxes, outputs binary, ELF32, ELF64, 32 and 64-bit Mach-O, RDOFF2, COFF, Win32, and Win64 object formats, and generates source debugging information in STABS, DWARF 2, and CodeView 8 formats.
:biggrin:
Title: Re: ASM for Mac (OSX)
Post by: japheth on March 01, 2013, 12:02:16 AM
nasm is available for the Mac. You should give a try.

Yes, I guess switching from masm/jwasm to nasm/yasm has a certain charm.  It's like moving from civilization to a barbarian village - everthing is new and "authentic", and probably the thought comes to your mind that this is the right and only way to live. However, after a week or so you might start to miss this and that conveniences -  showers, health care, music, newspapers, ...
Title: Re: ASM for Mac (OSX)
Post by: johnsa on March 01, 2013, 12:12:27 AM
Lol.. nice response. I would far rather use JWASM!
If possible I'd look at wrapping system calls for my projects so that it should essentially be possible to compile the same app using two different libraries for win / osx. The issues in order would be:
1) IDE for Mac OSX Asm coding
2) JWASM compilation on MAC OSX
3) Generating Mach-O output with debugging info .. or objconv
4) Decent debugger for mac.. GDB is awful...
Title: Re: ASM for Mac (OSX)
Post by: dedndave on March 01, 2013, 12:27:06 AM
Quote
...showers, health care, music, newspapers...

not very convincing
i fail to see the charm in any of that stuff   :lol:
Title: Re: ASM for Mac (OSX)
Post by: Gunther on March 01, 2013, 06:19:15 AM
Andreas,

Yes, I guess switching from masm/jwasm to nasm/yasm has a certain charm.  It's like moving from civilization to a barbarian village - everthing is new and "authentic", and probably the thought comes to your mind that this is the right and only way to live. However, after a week or so you might start to miss this and that conveniences -  showers, health care, music, newspapers, ...

I think that everyone has the right and the freedom to use his prefered programming tool, let me say nasm, yasm, fasm or whatever. I know that jWasm is a well maintained assembler, which performs good. But if you would have a look at nasmx, you would see that it has: invoke, .if, .elseif, .endif, proc, endproc and all the other funny stuff, that you like so much. In other words: Here you can have your showers, health care, music, newspapers, ... .

There's no need to be disparaging about other tools.

Gunther     
Title: Re: ASM for Mac (OSX)
Post by: Vortex on March 01, 2013, 06:30:38 AM
Hi John,

Solar Assembler supports Mac OS X :

Quote
Multiplatform, runs on:
WIn95, Win98, Windows XP, VISTA, Windows 7 32 and 64 bits
Mac OS X (10.5 leopard),
Unix / Linux and other unix like OSes that can link with an ELF libc
Solar OS

http://oby.ro/sol_asm/index.html
Title: Re: ASM for Mac (OSX)
Post by: japheth on March 01, 2013, 07:21:15 AM
But if you would have a look at nasmx, you would see that it has: invoke, .if, .elseif, .endif, proc, endproc and all the other funny stuff, that you like so much.

I already had a look at this extension ( funnily, on the jwasm SourceForge site, there's a link to it under "Recommended Projects"  :icon_mrgreen: ) - it looked interesting.

However, I hadn't .if, .endif and similar gimmicks in mind when I classified nasm/yasm as "barbarian", but the decision of the authors to make the assembler "forget" the type of variables.

Title: Re: ASM for Mac (OSX)
Post by: johnsa on March 01, 2013, 08:21:33 AM
Hi John,

Solar Assembler supports Mac OS X :

Quote
Multiplatform, runs on:
WIn95, Win98, Windows XP, VISTA, Windows 7 32 and 64 bits
Mac OS X (10.5 leopard),
Unix / Linux and other unix like OSes that can link with an ELF libc
Solar OS

http://oby.ro/sol_asm/index.html

Nice to know! Can it output 64bit mach-o files? IE: os 10.6 + compatible?

Title: Re: ASM for Mac (OSX)
Post by: Vortex on March 01, 2013, 08:53:32 AM
Hi John,

Reading the information from Solar Assembler's website :

Quote
Can output OMF32, COFF32/64, ELF32/64 and MachO32 OBJ

You should contact the author for more details.