Slashdot Mirror


x86 Assembly on Mac OS X

Quicksilver31337 asks: "I am currently taking an Assembly course which requires that I be able to compile ASM for the intel x86; however, I am stubbornly a Mac user. Having no desire to switch from my Powerbook, what can I do to work with, compile, and run x86 ASM short of running VirtualPC?" While Mac OS X does use gcc and its associated tool-chain, an old Slashdot discussion seems to imply that cross-compiling is better under OpenDarwin than Mac OS X. Has anyone tried cross-compiling under both operating systems? If so, what suggestions on setting up a working tool-chain do you have?

8 of 156 comments (clear)

  1. bochs by Erik+Greenwald · · Score: 2, Interesting

    I've had good luck usings bochs http://bochs.sourceforge.net/ for x86 on my powerbook. It's a little work getting the bochsrc set up just right, and installing an os on the disk image if you need one to support the code... (I've been dorking with os-less stuff...)

    -Erik

  2. Re:Well... by marmoset · · Score: 2, Interesting

    I've actually had better luck with QEMU than with Bochs. It seems a little easier to set up, at least.

  3. Some sound advice has already been given.. by ciroknight · · Score: 3, Interesting

    You've got the option of either Emulation or new hardware, as quoted by everyone on here. But there is probably a better way than both. Ask your teacher at your school if there's a box available in the IT department that's the correct archetecture. Like, for example, I am also a vehement mac user, and I had a project that required me to use assembly (mainly SSE-related things). Since I didn't know assembly for the PPC yet, I asked my professor and he said to get an account with the school's super computer. So I did, I wrote the software, and got an A on the project. Simple as that. VNC is your friend.

    --
    "Victory means exit strategy, and it's important for the President to explain to us what the exit strategy is." G.W.Bush
  4. Qemu. by drdink · · Score: 4, Interesting
    First, a note to Cliff. Assembly has nothing to do with cross-compiling. When you write assembly for the PowerPC 970, it stays on the PowerPC 970. You can't cross-compile assembly because it is designed for the target platform from the start.

    Now, what I would suggest you do is get a copy of QEMU. I assume you are familiar enough with Terminal and the shell prompt to get it working since you're stepping into the world of assembly, but if all else fails you can get QemuX or some other QEMU GUI off of VersionTracker.

    Depending on what mode you're writing your assembly in, you'll need to install some sort of OS into QEMU. Some candidates are FreeDOS, MS-DOS, or even Linux. Use whatever your class is using. Emulators are very handy for writing assembly because you can debug the program at the "CPU" level, so when your program pukes you can get a better glimpse at what is going on. This is why many developers design inside of VMWare.

    I hope this helps!

    --
    Beware, Nugget is watching... See?
  5. ummm yeah .. by torpor · · Score: 2, Interesting

    coz assembly on a shell account, for a student, is going to be stable as hell.

    not the best suggestion so far, i think. you know how easy it is to crash x86 with assembly?

    what i do: use VirtualPC. like the article submitter, i am 100% devoted to my powerbook .. but there are definitely times when i need to run PC software. i have a WinXP image i regularly boot into to do compiles, and it works fine .. it may not be the fastest system around, but it sure gets the job done, and leaves me to my powerbook in peace .. in fact, i've never been such a happy windows user as i am, now able to freeze a machine and restore it to its 'last known working state' .. running winXP in a VM seems to be the only way to maintain sanity, anyway ...

    --
    ; -- the corruption of government starts with its secrets. a truly free people keep no secrets. --
  6. Re:Don't by ratboy666 · · Score: 2, Interesting

    Oh boy,

    "Half of learning assembly is testing it out on a *live* machine. You're not learning assembly if you're just using cross-assembling, and you're not *really* learning it if you're emulating."

    In a word: wrong. In many ways.

    First, emulation is *more* useful because more data can be (potentially) gathered during runs.

    Second, being forced to cycle a power switch is "educational"?

    Third, the student will *not* be required to know the COMPLETE ins-and-outs of the hardware (eg, register level access to an NVidia card) -- indeed, most programmers /even at the assembler level/ don't have this information.

    Fourth, the information gained in an assembly class is /mostly/ of interest to people debugging. It is useful (while learning) to be able to access the "meta level" available in a good simulator.

    Unless you can debug on a cycle level on your "AMD sempron" without adding an external ICE. If you /do/ use the hardware to learn machine level programming, I recommend the (more expensive than the machine) aquisition of a product known a "WinICE" (currently produced by CA... along with Windows -- and, no, a product like this does /not/ exist on Linspire).

    Nope, this person would be best served by BOCHS with the built-in debug facility enabled. QEMU is a close second (except it isn't as "inspectable", but is faster). VMWARE pulls in around last, about the same as getting a "beige box PC".

    Even /on/ the hardware itself, programmers were deploying simulators to illustrate machine level programming.

    And, if you do run QEMU or BOCHS, you can run the tool-chain for x86 there as well (QEMU would be preferred, because the tools will simply integrate into the command-line and `make' correctly).

    Ratboy

    --
    Just another "Cubible(sic) Joe" 2 17 3061
  7. Re:Do what Mac Zealots have always done... by Rich_Morin · · Score: 2, Interesting

    Or, more usefully, code each assignment up both ways and hand in both versions. You'll learn more about both architectures than you would from doing either one alone. And, if the professor is even a bit open-minded, you'll get extra credit for the work.

    --
    Technical editing and writing, programming, and web development
  8. My assembly course by generationxyu · · Score: 4, Interesting

    ...was in MIPS. I don't own a MIPS box, nor would it be easy for me to find one. It wasn't expected that we had one. We were expected to use spim/xspim/PCSpim. I ran xspim on my Mac and it was fine. The programs probably ran like a snail crawling through molasses in January in comparison to a real box, but I never noticed -- none of my programs took long enough to execute anyway.

    --
    I mod down pyramid schemes in sigs.