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?

156 comments

  1. DOSBox + NASM by Anonymous Coward · · Score: 5, Informative

    Get NASM (Netwide Assembler) and DOSBox or Bochs (x86 emulators).

    1. Re:DOSBox + NASM by fm6 · · Score: 4, Informative
      The Mac version of DOSBox is available here. Also handy for running old DOS games under 32-bit Windows, Linux, and of course Mac.

    2. Re:DOSBox + NASM by Anonymous Coward · · Score: 2, Informative

      Are you kidding? Check out Qemu at http://www.freeoszoo.org/download.php. It's like 700% faster than Bochs. I successfully installed WinXP on my mac with qemu--something I'm not sure is possible with Bochs. I also find qemu easier to configure and use.

  2. 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 Anonymous Coward · · Score: 0
    2. Re:Emulation or new hardware... by k96822 · · Score: 1

      Aw heck, you can probably find more than a few /.'s that will give you a PC for this. There's certainly enough of them floating around!

    3. Re:Emulation or new hardware... by dasunt · · Score: 1

      Since he is learning ASM, would a 486 or early pentium be "fast enough"?

      If so, why not try hitting a local thrift store and looking what they have -- keep the receipt as well for your taxes.

      When you are done with it, throw on a lightweight linux distro and donate it back to them. :)

    4. Re:Emulation or new hardware... by lachlan76 · · Score: 1

      You kidding? Most slashdotters are trying to GET PCs :P

    5. Re:Emulation or new hardware... by KingOfBLASH · · Score: 1

      Ask around...I used to have 7 or 8 old 486s and PIs that I got from people who were throwing them away. They were worthless to those people, but I could install *nix on one and SSH in fast enough. They weren't even fast enough to run X Windows...but for compiling (particularly a comp sci course and not commercial production) they should be fast enough...

      And if like me you were a poor student whose landlord would not turn the heat above 50, you can set up a beowolf cluster of old 386s and 486s to make compiling faster, heat your cubicle (erm...apartment) and screw your landlord out of electricity!

    6. 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/
    7. Re:Emulation or new hardware... by Anonymous Coward · · Score: 0

      Definitely true, except that you could probably get as much -- or more -- insight in the inner workings of an x86 architecture by getting your stuff to run in a vm on a different platform. Soon enough you'll have more insight in big-endian vs little endian issues, memory management, booting strategies, etc. than you'd ever have by running an x86 box on its own. The UI is only skin-deep.

      Just my 2 cents.

    8. Re:Emulation or new hardware... by tverbeek · · Score: 1

      But the OS and BIOS are only so deep themselves. The architecture goes all the way down to actual hardware, where cables are plugged in, jumpers are set, etc. A "computer guy" who doesn't know which socket a PS/2 keyboard plugs into (i.e. not the mouse port) is one with too narrow a background.

      --
      http://alternatives.rzero.com/
    9. Re:Emulation or new hardware... by Anonymous Coward · · Score: 0

      This thread is over. You win.

    10. Re:Emulation or new hardware... by nickmdf · · Score: 1

      If you want to save on space, you can find a cheap-ass 486 laptop for anwhere from free to $20.

      Think of it as just another "book" that you will use for your eductation

    11. Re:Emulation or new hardware... by Paladin128 · · Score: 1

      Wow -- way to necropost, and give exactly the same advice I did.

      --
      Lex orandi, lex credendi.
  3. Well... by and+by · · Score: 2, Informative

    Why not use bochs? It's open, free, and if you're using assembly, you won't need to worry about speed issues.

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

  4. Choice... by Sparr0 · · Score: 4, Insightful

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

    1. Re:Choice... by Atzanteol · · Score: 4, Informative

      Like these people:

      http://www.testdrive.hp.com/

      --
      "Ignorance more frequently begets confidence than does knowledge"

      - Charles Darwin
    2. Re:Choice... by fm6 · · Score: 1
      Good suggestion. And although you can find plenty of shell account providers, it might make sense to open a web hosting account on a geek-friendly provider. Such a provider would almost certainly be using Linux servers and offer shell access. Probably cost not much more than a simple shell account, and give you a web presence in the bargain.

      Sourceforge sort of falls into this last category -- and their toolset is unsurpassed. Unfortunately, you can't just pay a fee and an account. You have to come up with an open source project for them to host for you.

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

    1. Re:Don't by Atzanteol · · Score: 1

      He's probably taking a required asm course, and they chose x86 (not the poster). And WTF; RDC or VNC? Is ssh broken or something?

      --
      "Ignorance more frequently begets confidence than does knowledge"

      - Charles Darwin
    2. Re:Don't by Anonymous Coward · · Score: 0

      I second the parent's sentiment about not emulating if you're taking an assembly course. 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.

      Go to Fry's and buy a $200 Linspire box (128 megs, AMD sempron 1.5Ghz aka 2200+, 40 gig hd, 16 meg video). Use apt-get to install gcc and sshd, disconnect the keyboard/mouse/monitor. Stick it in a closet with a power source and a LAN connection.

      Also, please don't claim you can't afford it. Anyone who can afford to go to college can afford a $200 pc.

    3. Re:Don't by Anonymous Coward · · Score: 1, Funny
      Anyone who can afford to go to college can afford a $200 pc.
      You seem to be missing the obvious: Anyone who can afford a Mac can afford a $200 pc.
    4. 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
    5. Re:Don't by Unknown+Lamer · · Score: 1

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

      You could share the disk image between QEMU and bochs too; build and test with QEMU and then restart the image with Bochs if you need the debugging features that Bochs offers.

      --

      HAL 7000, fewer features than the HAL 9000, but just as homicidal!
    6. Re:Don't by jtshaw · · Score: 1

      That is absolutely rediculous.

      I know of at least 5 major Universities that do MIPS for the majority of there assembly situations and they certainly don't have there students find MIPS machines. I know of others that use processors that don't even really exist in real hardware but have instruction sets similar to MIPS.

      Whether you run the assembly on the target architecture or in an emulator means absolutely nothing. All that matters is you understand how to use the instructions availible to you in an efficent and useful manner.

      I'd even argue that using an emulator can be better. With an emulator you can have a finer grain of control over what is in the pipeline and you can better see how things flow. You don't have to worry about any thing else using any resources to cloud up the picture of what is actually going on.

    7. Re:Don't by Anonymous Coward · · Score: 0
      I know of at least 5 dictionaries in English, and for the majority of the people, it's spelled 'r*I*diculous', and there is a difference between "there" and "their".

      I'd even argue that learning to spell before going to university can be better. With proper spelling, you have a finer grain of control over what is conveyed in the sentence and can see how other people will read things. You don't have to worry about spelling freaks clouding up the picture of what is actually going on.

    8. Re:Don't by Anonymous Coward · · Score: 0

      Is he talking about MIPS? No, about x86. Taking the arguments that apply with MIPS and moving them over to apply to x86, which is ubiquitous, seems a bit much.

    9. Re:Don't by dasunt · · Score: 1

      Depending one what he's supposed to do, there is always free shell accounts under unix/linux which may work.

    10. Re:Don't by Anonymous Coward · · Score: 0

      He's taking the Assembly class to learn about assembly and machine level programming, and all of the trials and tribulations that lie within.

      The actual architecture is generally meaningless, since they'll all do the most basic things that folks tend to do in assembly language classes. (add numbers, shift registers, double precision adds, branch, whatever).

      Now certainly I'd rather learn assmebly language on a PDP-11 or even a 68000 than something like, say, an old RCA 1802, but a class teaching on any of the architectures teach the same thing.

    11. Re:Don't by John+Pliskin · · Score: 1

      Don't you know that if you flash the Hal 7000, with the 9000 firmware, you can upgrade free!

      Of course....not too sure if Hal will just up and let you do that; DRM and all....

    12. Re:Don't by Unknown+Lamer · · Score: 1

      Heh, no one has ever commented on my .sig before. It's actually a reference to Dilbert the cartoon (I've had that sig since when it was on the air, I think it comes from the first episode even).

      Dilbert was asking Dogbert what he should name some product (a treadmill or something). It was POS and Dogbert suggested giving it the catchphrase 'The Whatever 7000: Fewer features than the 9000 but just as fun' (or something like that).

      I'm tired from having to code PHP for three weeks straight (with MySQL too...ugh, this sucks when I'm using to Scheme + PostgreSQL) and probably not making any sense. Time for sleep.

      --

      HAL 7000, fewer features than the HAL 9000, but just as homicidal!
    13. Re:Don't by Anonymous Coward · · Score: 1, Funny

      You seem to be missing the obvious: Anyone who can afford a Mac can afford a $200 pc.

      Yes. But someone who has bought a Mac is unlikely to be able to afford one any more... ;)

    14. Re:Don't by Anonymous Coward · · Score: 0

      Also, please don't claim you can't afford it. Anyone who can afford to go to college can afford a $200 pc.

      Nonsense. That's like saying that anyone who can afford a Ferrari can afford a BMW. It's absolutely true. But it doesn't mean they can afford both.

    15. Re:Don't by Anonymous Coward · · Score: 0
      Even /on/ the hardware itself...
      "/on/"?? Hey, Nitz, it's called HTML. <i>?? Look, look, I can make honest to goodness italics! Not wankery like /this/.

      Oh, and it's <b>foo</b>, not *foo*. See?

      Fucking Nitz.
  6. Try this by BoomerSooner · · Score: 0
    1. Re:Try this by noselasd · · Score: 2, Informative

      Nope.
      Wine - Wine Is Not an Emulator.
      (it doesn't interpret the x86 instructions , i.e. it works on x86 only)

      --
      My stuff

    2. Re:Try this by FictionPimp · · Score: 1

      2.5. When will Wine integrate an x86 CPU emulator so we can run Windows applications on non-x86 machines?

      The short answer is 'probably never'. Remember, Wine Is Not a (CPU) Emulator. The long answer is that we probably don't want or need to integrate one in the traditional sense.

      Integrating a CPU emulator in Wine would be extremely hard, due to the large number of Windows APIs and the complex data types they exchange. It is not uncommon for a Windows API to take three or more pointers to structures composed of many fields, including pointers to other complex structures. For each of these we would need a conversion routine to deal with the byte order and alignment issues. Furthermore, Windows also contains many callback mechanisms that constitute as many extra places where we would have to handle these conversion issues. Wine already has to deal with 16 vs. 32 bit APIs and Ansi vs. Unicode APIs which both introduce significant complexity. Adding support for a CPU emulator inside Wine would introduce at least double that complexity and only serve to slow down the development of Wine.

      Fortunately another solution exists to run Windows applications on non-x86 platforms: run both Wine and the application inside the CPU emulator. As long as the emulator provides a standard Unix environment, Wine should only need minimal modifications. What performance you lose due to Wine running inside the emulator rather than natively, you gain in complexity inside of Wine. Furthermore, if the emulator is fast enough to run Windows applications, Photoshop for instance, then it should be fast enough to run that same Windows application plus Wine.

      Two projects have started along those lines: QEMU, an open-source project, and Dynamite, a commercial CPU emulator environment from Transitives Technologies.

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

  8. x86 by turtled · · Score: 0, Troll

    If you have no desire to change from your Powerbook, why program at all? Would it not be best to compile ASM for x86 other than on, an x86 platform? Maybe I don't understand?

    --
    "I cannot think of any need in childhood as strong as the need for a father's protection." -- Sigmund Freud
  9. Your only option by wolf31o2 · · Score: 2, Informative

    Your only real option is to get access to real x86 hardware, either by purchasing a junker Pentium box for $50 on eBay, or by getting a shell on a non-Mac-loving friend's machine. You will probably do better off having your own box, however, as it will give you direct access to video and other such things.

  10. I'm not sure I understand the question by hey! · · Score: 1

    You're planning on testing your assembly programs in Virtual PC right? Why not simply run the assembler and debugger in Virtual PC? Am I missing something?

    --
    Post may contain irony: discontinue use if experiencing mood swings, nausea or elevated blood pressure.
    1. Re:I'm not sure I understand the question by DA-MAN · · Score: 1

      You're planning on testing your assembly programs in Virtual PC right? Why not simply run the assembler and debugger in Virtual PC? Am I missing something?

      No, he doesn't want to cave in and spend the $ on Virtual PC license. Let me paraphrase what he is saying.

      I love Mac's!! I ain't gonna spend $$$ on Virtual PC, and I sure as hell ain't letting a standard beige box invade my kingdom. What are my options for compiling and testing my assembly code for the x86?

      --
      Can I get an eye poke?
      Dog House Forum
    2. 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.
    3. Re:I'm not sure I understand the question by TheRaven64 · · Score: 1

      Practically as easy? Does the C standard library come with a factorise polynomial function now?

      --
      I am TheRaven on Soylent News
    4. Re:I'm not sure I understand the question by dramaley · · Score: 1

      I remember VAX assembly with fondness as well, though it has been several years since i took that class.

      My favorite instruction was AOBLEQ. Add One and Branch on Less than or EQual to. It made simple for-style loops just as easy as they were in C. Plus it is a fun name to try to pronounce. I didn't get around to playing with the vector commands, but if i recall correctly it was possible with a single instruction to order the machine to manipulate an arbitrary amount of data.

      --
      ----- "I'm still sane on three planets and two moons."
  11. Re:You don't understand the problem by Leknor · · Score: 0, Troll

    Amen.

  12. Re:You don't understand the problem by anti-trojan · · Score: 1

    Cross-compiling comment is added by the editor, not the poster. Poster seems to know what he/she is talking about.

  13. Re:You don't understand the problem by Atzanteol · · Score: 1, Informative

    You're right. You are flamebait. Should've followed your instincts.

    Your response:

    * ignores the posters question.
    * offers no insight
    * offers no work-arounds or solutions
    * doesn't explain anything at all
    * serves only to put the poster beneath you.


    Sounds like flamebait to me...

    An emulator is perfectly fine for a class. He could also get a shell account (http://www.testdrive.hp.com/). He could pick up a cheap x86 box. Etc.

    But you fail to mention any of these and prefer instead to insult the poor guy.

    --
    "Ignorance more frequently begets confidence than does knowledge"

    - Charles Darwin
  14. 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

    1. Re:It Isn't Worth It by BigFlirt · · Score: 1

      I Completely Agree!! You're going to spend more time dealing with emulation issues than actually doing your work. It's all well and good to want to try code x86 ASM on a PPC. Dealing with the cross-platform and architecture issues is quite noble, but when it's crunch time and they want you to turn in work on a short timeframe... Your prof won't care if you wrote it on a PPC or an alpha or did the whole damn thing on punchcards. What he will care about is can you produce what he asked you to produce, and if you're caught up in the semantics of testing iterations, then your going about things the wrong way... Like everyone else is saying... suck it up and go to a lab or buy the hardware and throw it out your window when (and if) you pass the class.

  15. Talk to your professor by DavidYaw · · Score: 1

    ...taking an Assembly course...

    Talk to your professor, that's what they're there for! I'm sure they've had other students who either didn't have computers or had Macs like yourself.

  16. Hmm... by Anonymous Coward · · Score: 0

    I am stubbornly a Mac user

    OK

    I am currently taking an Assembly course which requires that I be able to compile ASM for the intel x86

    Shouldn't you currently be taking a ballet course that requires you to go en pointe?

  17. 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
    1. Re:Some sound advice has already been given.. by Anonymous Coward · · Score: 0

      its people like you that i hate dealing with. we have to go and build a custom computer, find rackspace for it and then lock it down so you and two other nonstandard users can use it. fuck you. that felt better

  18. A little more info by Anonymous Coward · · Score: 0
    Do the executable itself have to be produced under x86?

    Does the class specify any particular assembly language and macro set? Will nasm work or do you have to assemble masm code?

    Will the class be OS specific. will you be using protected mode at all?

    Which x86 features will you be using - 8086/8088, 286, 386, beyond?

    How important will low level interaction with the system be? Will you be using the support chips, data bus, and timing memory operations at all?

    I'd really say your best bet if you will be doing any work in how actual systems operate then you should accept a little x86 dirtiness in your life and buy an old clunker for $50 or so.

  19. Re:You don't understand the problem by WyerByter · · Score: 3, Informative

    What my esteemed colleague is trying to say is, ASM is a language in which you give the chip specific commands. You tell the registers what to hold, what to do with what they hold, etc. For every ASM line of code there is only one machine language command created, unlike the potential hundreds created for a line of C. Taking a program that is written at that level and then allowing some emulator to guess at what you mean and how that is done on a completely different architecture makes no sense. You create a series of commands for the computer to run and then give it to an application that changes the commands to something else, in effect running a completely different program. It is just wasted time.

    Of course one option you have is to just use the school's computer lab.

    --

    This signiture copied from somewhere.
  20. 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!
    1. Re:QEMU by penguinboy · · Score: 1

      Or you could just fink it.

  21. It's one lousy class.... by Anonymous Coward · · Score: 0

    So get off your soapbox of not wanting to give up your MAC or get out of the class. This doesn't mean you have to give up an MAC. Use it 'til you're blue (or is it Aqua) in the face for everything else but for this class use an x86. Why make more problems for yourself?

    1. Re:It's one lousy class.... by Anonymous Coward · · Score: 0

      Am I the only one who is bothered by people spelling it MAC. MAC is that credit union thing. Mac is an apple computer. Thats a difference, 'A' != 'a' :)

    2. Re:It's one lousy class.... by AntiGenX · · Score: 1
      Actually when I see MAC, I think Media Access Control

      Hooray for the OSI data link layer!

    3. Re:It's one lousy class.... by Anonymous Coward · · Score: 0

      Why make more problems for yourself?

      Because he'd rather do anything than use the platform that YOU do, moron.

  22. The complete solution by n1ywb · · Score: 0

    If you want to save yourself a lot of effort, do it on x86 hardware. You don't have to own it, just connect to somebody elses box. BUT if you absolutely have to do it the hard way, then there are two things you need to address. 1. Assembling the code. Assemblers are much more lightweight than compilers. And there are probably hundreds of x86 assemblers of various qualities out there. You probably don't have to mess around with building a GCC toolchain. You can probably find the source code for an x86 assembler and compile it on OS X. If not, then just run the assembler under your x86 emulator. 2. Running the code. I think by defintion, any hardware or software that executes x86 machine code is technically an x86 CPU or emulator. Bochs, or Wine ought to work well and are both free. But there really is no getting around having either x86 hardware or emulation capabilities.

    --
    -73, de n1ywb
    www.n1ywb.com
    1. Re:The complete solution by jnik · · Score: 1
      Bochs, or Wine ought to work well and are both free.

      Wine Is Not an Emulator.

    2. Re:The complete solution by n1ywb · · Score: 1

      Good point.

      --
      -73, de n1ywb
      www.n1ywb.com
  23. 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?
    1. Re:Qemu. by torpor · · Score: 3, Informative

      You can't cross-compile assembly because it is designed for the target platform from the start.

      what? of course you can cross-compile assembly. assembly is just another language - you can teach any computer that language.

      as86/bin86 can be compiled under OSX. write your code on your powerbook, compile, send it to a real PC for testing/running ..

      --
      ; -- the corruption of government starts with its secrets. a truly free people keep no secrets. --
    2. Re:Qemu. by mthiel · · Score: 1

      You're right in that using tools designed purely for x86 output, you could generate x86 code on a Mac. However, one can not write PPC assembly and expect to just use a cross-compiler to generate x86 machine code. Assembly itself is definitely not-portable across platforms.

    3. Re:Qemu. by drdink · · Score: 1

      Though, in some cases, you can dynamically translate the binaries with tools such as this or the Linux ABI support in FreeBSD.

      --
      Beware, Nugget is watching... See?
    4. Re:Qemu. by bsartist · · Score: 1

      You can't cross-compile assembly because it is designed for the target platform from the start.

      Nonsense. Cross-compiling is when the host machine - i.e. the one running the compiler - is of a different architecture than the target. That's all. Whether or not the source language is portable to a different target is completely irrelevant.

      --
      Lost: Sig, white with black letters. No collar. Reward if found!
    5. Re:Qemu. by ameoba · · Score: 1

      Cross-compilation is completely separate from portability. Cross compilation is about taking sources for system A and producing binaries for system A using system B. The goal of portability is to have sources that compile to a binary for system A, using a system A compiler, to properly compile for system B, using system B's compiler.

      --
      my sig's at the bottom of the page.
    6. Re:Qemu. by Anonymous Coward · · Score: 0

      As long as you are not using self modifying code assembly and even executable code is portable. The process is known as static recompilation. It is rarely used nowadays but there used to be assembly/binary converters for various old mainframe systems.

  24. Re:You don't understand the problem by Anonymous Coward · · Score: 0

    Most assemblers are not 1 statement to 1 instruction anymore, but the basic point holds.

  25. Use Virtual PC by douthat · · Score: 2, Informative

    I took a required X86 ASM course, and I used Mac OS X to do it. I wouldn't, however, run XP while coding ASM... it's just too slow on my G4 powerbook. Try DOS instead. Running MASM (ASM linker/compiler) under DOS is pretty speedy. Since Microsoft bought Virtual PC, it's hard to find a copy of VPC that doesn't include Windows (for way more money than Connectix sold it for), but you can get it at academicsuperstore.com for $119 without an OS. It worked well for me, and I didn't have any inconsistencies between running it on my Mac and running it on native x86 hardware.

    --
    She loves me: 09F911029D74E35BD84156C5635688C0 She loves me not: 09F911029D74E35BD84156C5635688BF ...
    1. Re:Use Virtual PC by Anonymous Coward · · Score: 0

      indeed, I did my assembly homework on a Performa PowerMac using Insignia's emulator. DOS only, MASM, worked like a charm. That was in 1997 or so. You don't need an ugly beige box polluting your room just for this.

  26. I've tried Virtual PC by Revolution+9 · · Score: 1

    I tried to use virtual PC with a86 and d86 (an 8086 assembler and debbuger) and the program crashed. I'm not sure the emulation runs quite that deep. Whatever the reason, it didn't work.

  27. You want QEMU! by Per+Wigren · · Score: 4, Informative

    First, install QEmu. (I prefer to install it through DarwinPorts)

    Then download a x86 Linux Live CD ISO, for example Knoppix.

    Then:
    $ qemu -cdrom knoppix.iso -boot d

    Simple as that. Networking will work out of the box.

    You can also install Debian on a virtual harddrive using:
    $ dd if=/dev/zero of=sarge.hdimage bs=1000000 count=2000
    $ qemu -hda sarge.hdimage -cdrom debian-netinst.iso -boot d

    When installed, start QEmu with:
    $ qemu -hda sarge.hdimage

    Even better, after installation, copy the kernel and the initrd to your Mac (using sftp) and start qemu with:

    $ qemu -hda sarge.hdimage -kernel kernel-file -initrd initrd-file -append "root=/dev/hda1 console=ttyS0,38600" -nographics

    Then you will get the console on a virtual serial port (which is your current terminal window) and it doesn't have to emulate any graphics at all.

    --
    My other account has a 3-digit UID.
    1. Re:You want QEMU! by mrseigen · · Score: 1

      Agreed. QEMU is a fantastic piece of software.

    2. Re:You want QEMU! by Per+Wigren · · Score: 1

      One more thing, you'll also need to edit /etc/inittab and add a getty on ttyS0 or you won't get a login prompt. Debian has it there by default, but commented so you'll need to uncomment it.
      If you install another dist you'll have to copy the line that says 1:blabla/bin/gettyblabla and replace the 1: by S0:
      Also verify that /dev/ttyS0 is in your /etc/securetty file or you won't be able to login as root.

      --
      My other account has a 3-digit UID.
  28. Cross compiling to what? by fm6 · · Score: 1
    Has anyone tried cross-compiling under both operating systems?
    OK, this has me scratching my head. Presumably you need to run your code after you've compiled it. (I'll resist the temptation to nitpick "compile" in connection with assembly language.) A cross-compiler can give you object code for a machine you don't have, but if you don't have the machine, where do you run it?
  29. 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?

    2. Re:Emulation and ASM by |<amikaze · · Score: 1


      I'm so sorry. XSPIM / PCSPIM are really crappy to work with. Friends of mine are currently in our MIPS course, and I hear non-stop bitching about it. There's been discussions about potentially writing a replacement for it, but I don't know how fruitful they will be.

    3. Re:Emulation and ASM by Sheriff+Fatman · · Score: 1

      Assembler? Luxury! Back in my day, we had to write everything using ones and zeros! And as if that wasn't bad enough, we once ran out of zeros and I had to write an entire database using the letter 'O'!

      --
      -- Open Source: It's mad, but you don't have to work here to help.
  30. QEMU does well... by Anonymous Coward · · Score: 1, Informative

    ...and performs a bit better than Bochs. Install a smallish distro like Crux. QEMU also is supposed to support Windows 95/98/ME/2K but Bochs will probably prove to be more compatible. Don't expect speed demon performance and you'll be OK.

    AC

  31. Re:You don't understand the problem by An+Onerous+Coward · · Score: 1

    Even if the guy didn't understand that "assembly is not cross-platform," that's hardly call to judge him unfit for the profession. I'm betting there was some point in your life where you didn't know what assembly was either, or why you couldn't compile a program on an Intel and run it on a Sun. Shocking thought: Maybe he's taking the class so he'll understand what assembly is.

    In being so dismissive of his capabilities and potential to improve those capabilities, you've not simply sounded like a troll; you've been a troll.

    I also think the question is open-ended enough that you simply cannot make the judgments you have. It could be interpreted as simply asking what other x86 emulators are out there besides VirtualPC.

    If computer science is really the haven for jerks who would rather insult peoples' intelligence to compensate for their own insecurities (an impression you convey rather strongly) then I agree: This kid should find something else to do with his life.

    --

    You want the truthiness? You can't handle the truthiness!

  32. Here's my advice, you may hear lots similar by biglig2 · · Score: 5, Funny

    Sweet Baby Jesus and the Orphans, if you don't want to use anything except a Mac, then go on a PowerPC assembler course!

    Dear Auntie Slashdot,

    I'm going on a course to learn how to stab people. But I don't like knives, nasty sharp things, I much prefer my sock full of spagetti. Can you suggest a way I can stab people with a sock full of pasta?

    Also, I don't want to ride a bicycle, any way I can learn how to ride one while on a train?

    etc. etc.

    --
    ~~~~~ BigLig2? You mean there's another one of me?
    1. Re:Here's my advice, you may hear lots similar by Anonymous Coward · · Score: 0

      Wow. There are TWO sane people that read Slashdot. Me and You!

    2. Re:Here's my advice, you may hear lots similar by turgid · · Score: 1

      Make that three. Brian Potter fans too?

  33. 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. --
    1. Re:ummm yeah .. by boneshintai · · Score: 2, Informative

      Exactly as easy as it is to crash an x86 with C. A real operating system (implied in "shell account", I think) prevents user programs from crashing the whole computer, regardless of the language the program was written in -- in fact, it doesn't care about languages, because all it sees is the resulting executables and libraries anyways, which might as well be assembler.

      It's true enough that it's easy to write a program that crashes in assembler, but that's true of any other language, too.

      If the OP is writing boot loaders, kernels, or any other "raw machine" code, then a shell account is certainly inappropriate and he should get real hardware to run his code on. If, as seems more likely, it's just "how to write some simple programs in assembler", a shell account with appropriate tools will work just fine.

    2. Re:ummm yeah .. by Nexum · · Score: 1

      As part of my CS degree we also have some introductory asm programming, and under winXP these things could certainly freeze and entire box in very strange ways.

      --

      This sig has been deprecated.
    3. Re:ummm yeah .. by iamacat · · Score: 1

      Exactly as easy as it is to crash an x86 with C

      So basically, trivial. Fork bombs used to capture as much imagination as beowulf clusters today and only faded with dominance of Windows, which is too easily crashed to be a challenge. They may yet bring down Linux/*BSD if maximum allowed processes really work on consuming system resources, such as disk bandwidth.

      Anyway, assembly will come in handy in selecting uninterruptible instructions that take the most clock cycles or generate faults which take a while to process by the OS. I am sure your newly created forks have a burning need for some heavy MMX processing and inter-CPU cache synchronization. These things may be never generated by a C compiler. You can always set a function pointer to a byte array with machine code, but an x86 assembler lets you hack in style.

      Actually, I won't be surprised if you manage to get an OOPS or even find a security flaw by programming in raw assembly on Linux. Software is tested for most likely exploits first, and there are still too many holes in network services and setuid executables to worry about someone with assembly skills and permission to run his own programs.

    4. Re:ummm yeah .. by fnord_uk · · Score: 1

      Especially well you call cli on a breakpoint in MS Dev Studio on your windows 95 box, while testing some code for an x86 embedded project, and the machine ignores you until reboot!

      --
      In theory, theory and practice are the same. In practice, they're not.
  34. bochs by alan_dershowitz · · Score: 1

    You might consider bochs (http://bochs.sourceforge.net) if you can figure out how to set it up. It's slow as crap, but how complicated are your apps going to be in an intro asm course. Install a basic Linux or freebsd distro on it and go to town.

    I've personally done ARM cross compiling with GCC on an x86, and I found the experience to be torture. cross compiling sucks when you have to set up the compiler and environment yourself. Maybe it works the first time, but as soon as you have a problem, it's just hell finding and fixing it.

  35. qemu by caseih · · Score: 3, Informative

    qemu now compiles and runs under OS X and you can install MS operating systems (DOS, Windows) inside it. This is certainly cheaper than virtual PC, and the speed is not too bad. For small programs that you are writing, emulated slowdown should not pose a significant problem.

  36. virtualPC, bochs, qemu, all fine by snorklewacker · · Score: 4, Informative

    This is almost certainly an intro course. He's not writing device drivers, he's going to be writing an implementation of dijkstra's algorithm or binsort or matrix arithmetic or something. I doubt he's going to have to analyze pipeline and branch prediction behavior either. So just throw it into an emulator, it'll be fine.

    Your prof sincerely will NOT CARE that you used virtualPC or whatever, as long as you did the assignment. He WILL care if you're some whiny fanboy who can't stop moaning about how kludgy and crocky the x86 architecture is and how you sing love songs to your powerpc mac every night and how you had to condescend to use an emulator only IF this dinosaur of a professor who stoops so low to use this architecture might deign to look up to your lofty height and permit you to use an emulator blah blah. Just use the damn emulator and hand in the assignment. Chances are he won't notice, and if he does, then go buy a cheap old PC and get on with life.

    --
    I am no longer wasting my time with slashdot
  37. GCC? by prockcore · · Score: 1, Informative

    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.

    And what does that have to do with the price of tea in china?

    We're talking about Assembly here...you wouldn't use gcc.. you'd use GAS (which is awful).

    NASM will compile on OSX, but it uses AT&T syntax, rather than intel syntax.

    Odds are good that you're going to be learning Intel syntax.

    AT&T syntax: movl %eax, %ebx
    Intel syntax: mov ebx, eax

    1. Re:GCC? by Anonymous Coward · · Score: 0

      NASM will compile on OSX, but it uses AT&T syntax, rather than intel syntax.

      You got it backwards. NASM is Intel syntax. GAS is AT&T by default, though IIRC it can now do Intel syntax as well.

  38. Maybe I'm being too simple ... by chris462 · · Score: 2, Informative

    ... but my university has a collection of Linux machines that you can SSH into for various uses, including development tasks. Any "decent" university (no offense intended), I think, would have a similar configuration.

    1. Re:Maybe I'm being too simple ... by Anonymous Coward · · Score: 0

      Well my university has a collection of machines that you can SSH into for various uses including deveopment tasks. The happen to be UltraSPARC running solaris, so any x86 assembly isn't going to work on them. The computer science department does run have a linux cluster, but those machines are only for profs and grad students and aren't for running computing jobs, but are for email and file storage. Those folks are expected to have there own sets of machines for research.

  39. If this is for school by xenocide2 · · Score: 1

    Then you almost certainly have access to an x86 server of some sort. Put in X11 for OSX, and just SSH in to whatever you've got access to. If you don't know, ask the instructor. The benefit here is that you have the tools to build and run on the same machine the instructor. I'm not sure if Emacs has a x86 ASM highlight mode, though the feature is hardly nessecary.

    --
    I Browse at +4 Flamebait

    Open Source Sysadmin

    1. Re:If this is for school by ChristTrekker · · Score: 1

      That's what I was going to say. I've never heard of a comp sci class where the school didn't supply the hardware/software resources to get assignments done. It might have been more convenient if the students had their own resources, but it certainly wasn't required.

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

  41. Do what Mac Zealots have always done... by Lead+Butthead · · Score: 4, Funny

    Code the assignment in PPC assembly and hand that in. And insist PPC is a superior architecture to code for...

    --
    ELOI, ELOI, LAMA SABACHTHANI!?
    1. 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
    2. Re:Do what Mac Zealots have always done... by lachlan76 · · Score: 1

      To be honest, I'd prefer not to do my assignments twice ;)

    3. Re:Do what Mac Zealots have always done... by Mocenigo · · Score: 1
      To be honest, I'd prefer not to do my assignments twice ;)

      I have developed arithmetic libraries for x86, ARM and PowerPC architectures. It's been a GREAT exercise. Of course I could have implemented it only on a single architecture, but I learned a lot. It was kind of fuzzy to watch my programmes that used to be x86 only run at full speed on my PB. If your professor is intelligent, he/she will give you extra credits, and you have extra experience, which will pay off in the future.

    4. Re:Do what Mac Zealots have always done... by TheRaven64 · · Score: 1

      I believe the point of these courses is to encourage students never to touch, or even look at, assembly again. Using x86 assembly is far more likely to do this than PPC assembly...

      --
      I am TheRaven on Soylent News
    5. Re:Do what Mac Zealots have always done... by |<amikaze · · Score: 1


      Or even if it doesn't net any extra credit, there's still the purely academic reasons for doing so. That is why people go to university right? To learn? In the last year, I've done assignments for courses I couldn't take because of scheduling, purely for the enjoyment of doing it.

    6. Re:Do what Mac Zealots have always done... by smithmc · · Score: 1

      Code the assignment in PPC assembly and hand that in. And insist PPC is a superior architecture to code for...

      [sigh] Surely I'm not the only one who remembers back when Macs ran on 68K CPUs?

      --
      Downmodding is the refuge of the weak. Don't downmod, make a better argument!
  42. Cross compiling won't help by ArbitraryConstant · · Score: 1

    Cross compiling won't help unless you can run it too, and you're not going to be able to run it without hardware or emulation.

    I'd be shocked if your uni didn't have an x86 machine that you can SSH to. Easiest to just use that.

    --
    I rarely criticize things I don't care about.
  43. Re:You don't understand the problem by Anonymous Coward · · Score: 0

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


    In which case he might as well work on an x86 machine.

  44. Or QEMU by Anonymous Coward · · Score: 0

    There's another emulator which can just run programs instead of a whole operating system called qemu. It's free software based on GCC. Just use Google to find it.

  45. Re:You don't understand the problem by confused+one · · Score: 1
    Still you miss the point. He could easily do his development work & 90% or more of his testing on the Mac. He could then borrow an x86 machine for the final test, at least at first. Once he's confident his emulator is 100% reliable and identically matches x86 hardware characteristics, he can do 100% of the work on the Mac.

    There's no need for him to buy or work on an x86. I don't work on a PIC or AVR; but I write and test PIC and AVR code. I may not have real hardware to test against for months when working on a project.

  46. Re:You don't understand the problem by Anonymous Coward · · Score: 0
    What my esteemed colleague is trying to say is, ASM is a language in which you give the chip specific commands. You tell the registers what to hold, what to do with what they hold, etc. For every ASM line of code there is only one machine language command created, unlike the potential hundreds created for a line of C. Taking a program that is written at that level and then allowing some emulator to guess at what you mean and how that is done on a completely different architecture makes no sense.

    This is the most retarded thing I have ever heard. How would an emulator know a program is written in C, assembler, Ada, or even in Perl and emulating the Perl interpreter written in C.

    An emulator simply performs the tasks the real hardware would, only in software. There isn't much difference between the two.

    Anybody who has ever designed their own hardware probably has also used an emulator to bring up those "difficult to debug" portions of code. You know, the kind that initialize the most basic machine state. I mean, how on earth could I develop my Motorola 68k code (assembly and C) and then run it on an emulator. How could I set breakpoints and analyze hardware registers without having to break out a logic analyzer? My goodness, I should go to the hardware lab right now because I guess I'm doing something that is impossible.

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

  48. Horse nuggets. by kma · · Score: 5, Informative

    What do you mean, "how that architecture REALLY" responds?" The whole point of an "architecture" is that there can be more than one implementation of said architecture. AMD and Intel provide hardware implementations of the x86; VirtualPC, bochs, et al. provide software implementations of it. Differences amongst those different implementations come down to either unspecified parts of the architecture, or bugs, be those bugs in hardware or software.

    Bochs is every bit as real an implementation of the x86 as a Pentium 4. In the outrageously unlikely event that bochs doesn't run this guy's assembly code correctly, he should report a bug, just as he would do in the even more outrageously unlikely event that an Intel processor runs his code wrong.

    1. Re:Horse nuggets. by Anonymous Coward · · Score: 1, Informative

      I've actually been in a similar fix; let met tell you this: Emulation isn't perfect. If the x86 assembly class is probably not just x86 assembly, but with DOS (good for teaching, as it frequently requires you to program to the hardware directly. It also forces you to learn segmented memory schemes, which is something many other architectures mercifully don't do).

      In my course, I used VMWare on a x86-Linux box.

      I then ran an old copy of DOS 6.22 in VMWare.

      Suprisingly enough, there are some behaviors that don't work as advertised in a VMWare DOS-box that work fine when you actually boot to DOS.

      And that's on the relatively thin and (theoretically more bug-free) VMWare emulation -- not full-blown emulation like VirtualPC.

    2. Re:Horse nuggets. by Anonymous Coward · · Score: 0

      stfu, cunt.

    3. Re:Horse nuggets. by exp(pi*sqrt(163)) · · Score: 1
      there are some behaviors that don't work as advertised in a VMWare
      Like what? There can't be many things that don't work seeing as I can run many hardware abusing DOS games in VMWare and Virtual PC. I can imagine timings might be off, but not much else. Certainly core CPU behavior must be pretty well identical.
      --
      Doesn't it make you feel good to know that our freedoms are protected by politicans, lawyers and journalists.
  49. Re:You don't understand the problem by jrockway · · Score: 2, Informative

    I would assume that if the emulator can load an entire operating system then simple, first-year ASM isn't going to a problem here. He's writing "Hello, world.", not a SMP VM system!

    --
    My other car is first.
  50. 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.

  51. Linux/x86 or even Darwin/x86 by JeffTL · · Score: 1

    As has been said, get a junky PC. IA32 PC does not mean Windows; get an old one and run Unix on it, or some flavor of DOS. If you're using Linux and it's a recent computer at all, use VNC and some sort of filesharing to make it feel like part of your Mac.

    1. Re:Linux/x86 or even Darwin/x86 by Bert64 · · Score: 1

      VNC? Eugh!
      Don't use vnc, use ssh and X11, both of which are supported by default by OSX and will integrate much better with the local os. An ssh session to a remote unix box will behave just like a local session with the OSX console app, and X11 apps will get managed by the OSX window manager, but diehard mac users may find it strange that the menu is at the top of the window.. Other than that, it works well. VNC on the other hand will give you one large monolithic window containing a whole window manager and emulated screen, and the apps within it wont interact well with your local apps.. Also, VNC is incredibly slow, even over a lan.
      As for filesharing, NFS or SMB will work, NFS should work better actually..

      --
      http://spamdecoy.net - free throwaway anonymous email - avoid spam!
  52. UFS partition, NetBSD pkgsrc, cross-build chain by AReilly · · Score: 1

    Using an emulator (bochs, VirtualPC, etc) is a fine plan, but you wouldn't want to have to use it for editing and compilation: too slow and clunky. Get the gnu toolchain up in a cross-development way, either through debian GNU-darwin or (my preference) the NetBSD pkgsrc tree.

    --
    -- Andrew
  53. Re:Silly boy by wasabifan · · Score: 0

    I don't think wanting to do most of his work on his PowerBook will cause him to fail. I remember going through the same thing in my assembly class. That being said, in addition to VPC on my PowerBook (which was probably much slower than his), I did end up setting up a junker PC to do MASM work on while at home (the PowerBook was while I was mobile). I think what is key to being a good programmer coming from a Mac perspective, is to learn multiple platforms, and knowing the strong points of each. There are many Windows users/programmers that never come to terms with that. I have found Mac/Linux programmers (not most Mac users though) are more open to experimenting with other platforms and OSs. Also, when it came to MIPS assembly (in my assembly class), I had a better time with SSH than most Windows programmers did. The PowerBook ended up being quite flexible for tasks at hand.

  54. VPC is fine by Monx · · Score: 2, Informative

    As a Mac user who has contributed to a popular assembly language text book, I can say with some authority that VirtualPC will get you by pretty well. Some of the advanced terminal functions will fail if you're not it DOS, but they'll work better under VPC w/ DOS than a real PC and XP.

    1. Re:VPC is fine by kalidasa · · Score: 1

      Somebody mod this up as informative, please; this fellow has far more experience than I do and should be rated at least as highly as I am.

  55. Forum for Mac developers by Anonymous Coward · · Score: 0

    I would suggest you visit iDevGames (http://www.idevgames.com) and ask in their forum. Over 500 Mac developers (and PC) game developers hang out there. Even though the site is geared towards game development, many members will be able to help you.

  56. Reminds me of a letter I once read... by NewOrleansNed · · Score: 3, Funny

    Deer Mason's Guild,

    I need to build a brick fireplace but I am a fervent hammer user. I realize that a hammer might not be the right tool to lay down the mortar, but I believe very strongly in the hammer and believe that ultimately, the trowel is an inferior tool designed only for trogladytes and people who actually know the definition of "trogladytes." What is the best way to use my hammer to accomplish my goal?

    Signed,

    Go Hammer, Go Hammer Go

    1. Re:Reminds me of a letter I once read... by bizard · · Score: 1
      The tool is his text editor and an assembler. So modifying the story, he wants to build a brick fireplace with a Stanley trowel and QuickCrete mortar. He will still have to use bricks, that is the goal, but what brand of tool he uses to do it doesn't matter.

      Several people have parroted your argument and it is completely bogus in this case. yes, he will have to have some sort of x86 cpu to test on but he has a perfectly good toolset to do the coding already.

  57. Qemu or BOCHS by nurb432 · · Score: 1

    That would be an inexpensive start..

    --
    ---- Booth was a patriot ----
  58. Have gcc 3.3.2 win32 cross compiler by ezavada · · Score: 3, Informative

    I do C/C++ cross compilation from Mac OS X to Win32 all the time, but haven't done it with assembly code.

    I use both gcc and CodeWarrior, and generally haven't had any problems with either.

    I have OS X binaries for Win32 gcc 3.3.2 compilation (using mingw32) available here as a torrent

  59. Re:You don't understand the problem by i+wanted+another+nam · · Score: 1

    I sincerely doubt that architecture emulation involves any "guessing."

    Of course, I'll openly admit that I know nothing about how it works. If you don't know what you're talking about, please keep it to yourself.

    --
    The image is a dream, the beauty is real. Can you see the difference?
  60. X86 Emulator by ivanjs · · Score: 1
    Once you make your choice (I'm a mac guy too, but I opted to build a cheap PC for game level design), get the Emu8086 simulation software that lets you test out x86 assemly code within a protected graphical environment.

    Awesome piece of code to learn and experiment with:

    Emu8086 Home

    If you need help with binary, check out my Binary Tutorial. It also features a hex tutorial and a binary finger counting tutorial.

    John
    Admin
    The Lyzrd's Stomp
    (Photoshop tutorials and more)

  61. 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.
  62. Re:You don't understand the problem by WyerByter · · Score: 1

    If emulators required no "guessing" then why can't you just run any program out there on an emulator, both out of the box? Fact is, as can be seen from any number of articles here on Slashdot, emulators often need "tweaking" to get certain programs to run properly on them. I do realize that this is often the case of programs that interact directly with the hardware, but what is more direct than telling a chip what to do with it's registers, actual, physical structures on the chip. Besides, how much sense does it make to program for one platform when you don't have that platform to test on. If a bug crops up, you have to ask, is it the program or the emulator or an interaction between the two. There is no feeling in the world like spending a week on a program, getting it to work perfectly and then receiving a failing grade because the program would not run on the professor's machine, or because the program had fundamental flaws that the professor saw as a misunderstanding of the material, but was an accomadation neccessary to get it to run under the emulator.

    --

    This signiture copied from somewhere.
  63. Free shell account by SiMac · · Score: 1

    This website seems to have a list of places that will give you a free shell account, which you can use to compile your code using gcc or the like.

  64. Computer lab by raider_red · · Score: 1

    Do you have access to a computer lab on campus? Could you do the work there?

    --
    It's good to use your head, but not as a battering ram.
  65. Compiling ASM. by Anonymous Coward · · Score: 0

    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.

    There is no compiling of ASM, much less cross-compiling. ASM is assembled into machine code.

    ASM is so close to the hardware, that it does not lend itself to be "cross" anything. If you did make a program to take x86 ASM and make it PPC machine code, you would have one very slow buggy program.

    1. Re:Compiling ASM. by 91degrees · · Score: 1

      I'll nitpick and point out that it is possible to write an application that will take code in one assembly language and translate it to another. Or in fact convert from any turing complete language to another as long as you don't need human readability or efficiency. I've written such an application myself.

      I don't know whether this counts as a compiler since I'm not 100% sure of the definition, but it's possible, and it's even possible to be fairly efficient and bug free. And it's not like you're going to need speed for an intro to x86. Most of the examples will only run for a few hundred cycles.

  66. Emulators/Simulators by turgid · · Score: 1
    Emulators are not a bad choice. I'd much rather install an emulator for the target platform in a light-weight laptop than lug around a huge beige box all day...

    An interesting piece of information for all the raving zealots on both sides of the argument to note: the first AMD64 (Opteron/Athlon 64) port of Linux was done on a software simulator, before any hardware was available.

    Software isn't a bad choice, especially nowadays with good free emulators such as bochs. The kind of things you'll be doing for a class assignment will not require cutting-edge performance, merely the ability to execute the code correctly. All the extra debugging facilities that come with emulators can be very useful. Especially if you're very used to one instruction set and then have to code for a completely different one, it's all very well reading the manuals, but when you actually try it, you'll be surprised. The difference between x86 and RISC (e.g. PowerPC, MIPS, ARM, SPARC) is enormous.

  67. I did this in 1995 by turborat · · Score: 1

    ...using Universal SoftPC I was able to assemble and run all my x86 ASM programs for a freshman class on my Performa running MacOS 7.

  68. Re: "I am stubbornly a Mac user" by Anonymous Coward · · Score: 0

    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.

    No you don't, liar.

  69. I'm intrigued as to why. by Anonymous Coward · · Score: 0

    Yeah, this has little to do with the question, but I'm asking anyway.

    x86 is a popular choice for the simple reason that it's the only architecture that runs most Windows apps. A modern x86 CPU is very fast. The assembly language is rather difficult, there's very little need for that sort of performance on any x86, and no need to use x86 for any embedded applications.

    It just seems to make more sense to use a simpler processor to teach the concepts of assembler, and most people who already know assembler for a couple of machines aren't going to need a course for a new architecture.

  70. obvious by Myopic · · Score: 1

    to me the obvious answer is to ssh into a CS department computer. i have to assume there are some; my CS dept had several dozen and you could ssh into any of them, or go and sit in front of them yourself.

    what am i missing? the answer is so obvious.

  71. Cross-compiling and qemu by Sonic+McTails · · Score: 0

    Qemu has been ported to Mac OS X, and it is possiable with crosstool (http://www.kegel.com/crosstool/) to build a cross-compiler fairly easily. Failing cross-tool, it's just a task of building everything in the correct order and applying any recent patchs from the GCC bugzilla. I don't know if crosstool has support for building a i{3/4/5/6} compiler, but you can easily add new targets by modifying a few of the dat files.

    --
    This signature was left intentionally blank.
  72. Who screens these things? by Anonymous Coward · · Score: 0

    Slashdot ought to get some editors who are not clueless. This is a total non-story. Anyone who knows anything about the topic would just say, "use nasm, kid," and that would be the end of it.

    But Cliff's interjection is even stupider than the mere fact that this article even exists (which is in itself ridiculous). Cliff, do you write code? Do you know the difference between a compiler and an assembler? No? Then don't try and contribute.

  73. When I went back to college... by FredFnord · · Score: 1

    I went back to college about ten years ago and got myself a somewhat belated CS degree. I used a Mac (Quadra 800) at the time, and three of my classes (in the first two semesters) required PC software. (After a while they all ended up requiring a Sun workstation, a MIPS workstation, or the IBM System 3/70 (yuch!).

    I used SoftPC (remember that?) and it all went just fine. Using emulation software to complete these sorts of courses was often better than doing it natively: I could run the DOS applications in one window and still be able to check my email and run a 'talk' session in the background at the same time.

    I'm sure Virtual PC would work fine these days, even if it is a Microsoft product now.

    -fred

    --
    Sign #11 of Slashdot overdose: You see the phrase 'moderate Republican' and you wonder if that would be a +1 or a -1.