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?

12 of 156 comments (clear)

  1. Emulation or new hardware... by Paladin128 · · Score: 4, Insightful

    Your two choices are emulation (like VirtualPC) or new hardware.

    My advice is go to a computer show, buy an old, fully-functional 386, 486, or Pentium based machine, and install either DOS or Linux or *BSD. You could probably get one for less than $50.

    --
    Lex orandi, lex credendi.
    1. Re:Emulation or new hardware... by tverbeek · · Score: 4, Insightful
      For the love of Turing, get yourself an IA32 box.

      Going to school is supposed to broaden your horizons (or in more mercenary terms: build up your resume), and that's not going to happen if you cling to your PowerBook like a life preserver. In my college years in the neolithic period I got exposed to TRS-80s (Z80 assembly), IBM PCs, DEC VAXen, a *nix box of some kind, and the C64 in my dorm room, and that diversity of experience made me a better geek... the kind who today is comfortable with OS X, MacOS, Windows, Linux, BSD, BeOS, EPOC, PalmOS, and just about anything else I might find in front of me.

      Look, eventually your architecture of choice is going to die off or fade into irrelevancy. (And I'm not saying that because it's an Apple; they'll probably be around in 20 years, but they won't still be using OS X on PPC). You'll have to adapt. So you might as well start making yourself cross-platform now, before you end up as just a one-trick pony.

      --
      http://alternatives.rzero.com/
  2. Choice... by Sparr0 · · Score: 4, Insightful

    #3: get a shell account on an x86 machine.

  3. Don't by kalidasa · · Score: 5, Insightful

    I would think that if you want to take an assembly class for a particular architecture, you'd want to know how that architecture REALLY responds: no kind of emulation is going to guarantee you that knowledge. You're being too stubborn; get (or borrow) a cheap beige box to do the assembly work on and just rdc or vnc into it. Then turn around and sell it when you no longer need to do assembly.

  4. It Isn't Worth It by American+AC+in+Paris · · Score: 3, Insightful
    Use the appropriate tool for the task at hand. Either suffer through the course on lab computers or get your hands on an old x86 box for cheep/free/loansies. I'd bet my left shoe that trying to code ASM via emulated x86 on OS X will be ten times more painful than the ignominy of biting the bullet and working on something other than your architecture of choice.

    I hate using anything other than my PowerBook these days, but I honestly can't see any good arguments for not just sucking it up and working with the most appropriate hardware for the task.

    --

    Obliteracy: Words with explosions

  5. QEMU by Nagus · · Score: 2, Insightful

    Get the experimental OS X installer for QEMU. This will emulate an x86 processor plenty fast enough to do some assembly coding. Then you can install some GNU/Linux distribution with the tools you need. Or if you want to keep this lightweight, install FreeDOS and the NASM assembler.

    --
    Wenn ist das Nunstruck git und Slotermeyer? Ja!... Beiherhund das Oder die Flipperwaldt gersput!
  6. Emulation and ASM by Lycestra · · Score: 2, Insightful

    Back in my day, we had to learn MIPS assembly, and this was long after the era of MIPS processors being available on campus. Instead, we had to use the SPIM emulator to test our MAL code. It seemed to fit the professors needs, but I think the professor may have had a hand in writing it. (wisc.edu)

    I'd say ask the professor what he/she thinks of using Bochs first. If they aren't totally against it, it should be fine. Freshman year, it felt like I was the only one in my CS course with linux at home, but my professor had no problem with it as long as my stuff worked on the sanctioned C compiler (in a *nix) we used in the labs. As long as it tested good on the machine it was tested on, it was fine. Heck, what if the professor is just going to use Bochs anyway?

    --
    Lycestra
    1. Re:Emulation and ASM by sakusha · · Score: 2, Insightful

      Jeez, back in my day, we had to learn IBM 360 Assembler, CPU time was so scarce, and punching cards was so tedious, we wrote it all on paper and stepped through all the code manually, writing down the contents of each register as it changed each time an instruction was executed. This is known as a "paper computer" and is not really so difficult, although it requires you to really KNOW the structure of the registers, and have detailed knowledge of what each operation does. And isn't that the POINT of studying assembler?

  7. Re:You don't understand the problem by confused+one · · Score: 4, Insightful
    That's funny... we test ALL of our low level code on an emulator BEFORE we try to run it on real hardware. The development platform is Win2k on x86. The emulation is run on the SAME platform. The target is Z80, AVR, PIC, 68040 or PowerPC, depending upon the product in question.

    I'm a professional developers working for a manufacturer of precision instrumentation. I don't see any problems with what he's trying to do. Although, he'd be wise to test it on real hardware before giving it to the prof...

  8. Re: "I am stubbornly a Mac user" by Anonymous Coward · · Score: 2, Insightful

    You'll always be a user, and never an engineer, if you marry a platform.

    I know quite a few engineers who used to work at Apple, and decided OS X wasn't a "Macintosh." Apple had other ideas. They're now writing Windows code.

    I think the native platform for x86 is the best choice for x86 development. If you can't figure out how to use it, you have no reason to be studying software.

  9. remote connection by wasabifan · · Score: 1, Insightful

    Somebody had already mentioned SSH into a remote PC, but since the original post mentioned MASM (Microsoft ASM), what about the free version of Remote Desktop from Microsoft to log into a Windows Server that has MASM loaded on it? This takes care of testing on the actual hardware, and the user still doesn't have to touch a non-Apple keyboard.

  10. Re:I'm not sure I understand the question by hey! · · Score: 2, Insightful

    Oh, I see, thanks.

    I feel sorry for the guy, even if he is a Mac bigot. I got to do my assembly programming class on a Vax, which is practically as easy as writing in C.

    --
    Post may contain irony: discontinue use if experiencing mood swings, nausea or elevated blood pressure.