Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Cromulent

macrumors 604
Original poster
Oct 2, 2006
6,812
1,100
The Land of Hope and Glory

Thank you. Right now I know what the correct syntax is for Mac OS X assembly I can move forward. I've read so many tutorials and because I didn't know I didn't know if they were in the correct style or not.

That was incredibly useful.

Interestingly though the program you posted above only worked on my machine if I swapped the write() function and the file descriptor functions around. It said bad system call otherwise.

Also assembly does not seem to interpret '\n' as C does. I guess I'll need to use the raw code for a new line character and the append it on the end of every string?

Edit : It seems you don't need a newline character at all. Hmm that's odd, I would have thought you would have had to explicitly state that you wanted to have a newline?
 

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
I'm not sure about the argument order. That was the order in the ex. I found. In the example I posted the newline is explicitly included. It is the 0xa after the string. That's the ASCII newline. Grab an ASCII chart, as the C escape sequences will not work. If you used C bindings then called libc's printf, you obviously could, but you'd need to take care in null terminating then.

-Lee

I apologize for typos in this. Posted from my phone.
 

Cromulent

macrumors 604
Original poster
Oct 2, 2006
6,812
1,100
The Land of Hope and Glory
I'm not sure about the argument order. That was the order in the ex. I found. In the example I posted the newline is explicitly included. It is the 0xa after the string. That's the ASCII newline. Grab an ASCII chart, as the C escape sequences will not work. If you used C bindings then called libc's printf, you obviously could, but you'd need to take care in null terminating then.

-Lee

I apologize for typos in this. Posted from my phone.

Ah, I see. It is all starting to make sense now :). Excellent, onwards and upwards as they say.
 

Cromulent

macrumors 604
Original poster
Oct 2, 2006
6,812
1,100
The Land of Hope and Glory
I know this is an old thread but I thought I would bump it as I found some interesting information. For those (like me) who are interested in ASM but feel a little lost at the start the High Level Assembly language seems like a great way to get into it. Think of it as mid way between ASM and C.

The book is available free here.

The Mac OS X version of the library / compiler is here.

If anyone needs a hand getting it setup let me know, the instructions in the book are just for Linux / Windows but it is pretty straight forward on Mac OS X too.
 

Muncher

macrumors 65816
Apr 19, 2007
1,465
0
California
I know this is an old thread but I thought I would bump it as I found some interesting information. For those (like me) who are interested in ASM but feel a little lost at the start the High Level Assembly language seems like a great way to get into it. Think of it as mid way between ASM and C.

The book is available free here.

The Mac OS X version of the library / compiler is here.

If anyone needs a hand getting it setup let me know, the instructions in the book are just for Linux / Windows but it is pretty straight forward on Mac OS X too.

Back from the dead! :p I've heard of that, but I didn't know it had an os x variant. Cool :D.
 

brian6504

macrumors newbie
Dec 16, 2006
29
0
Terre Haute, IN
I learned MIPS assembly, which is similar to PowerPC, but used the SPIM emulator to develop. I would recommend using some sort of emulation tool so you can see the registers and stack all the time and not have worry about working your way through a debugger.

After that it was pretty easy to pick up PowerPC and x86.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.