News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

ASM for Mac (OSX)

Started by johnsa, February 28, 2013, 01:20:01 AM

Previous topic - Next topic

johnsa

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

dedndave

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

johnsa

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).

anta40

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.

Gunther

Hi johnsa,

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

Gunther
You have to know the facts before you can distort them.

habran

hey johnsa,
QuoteYasm 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:
Cod-Father

japheth

Quote from: Gunther on February 28, 2013, 05:32:50 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, ...

johnsa

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...

dedndave

Quote...showers, health care, music, newspapers...

not very convincing
i fail to see the charm in any of that stuff   :lol:

Gunther

Andreas,

Quote from: japheth on March 01, 2013, 12:02:16 AM
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     
You have to know the facts before you can distort them.

Vortex

Hi John,

Solar Assembler supports Mac OS X :

QuoteMultiplatform, 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

japheth

Quote from: Gunther on March 01, 2013, 06:19: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.


johnsa

Quote from: Vortex on March 01, 2013, 06:30:38 AM
Hi John,

Solar Assembler supports Mac OS X :

QuoteMultiplatform, 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?


Vortex

Hi John,

Reading the information from Solar Assembler's website :

QuoteCan output OMF32, COFF32/64, ELF32/64 and MachO32 OBJ

You should contact the author for more details.