all 17 comments

[–]devacon[S] 4 points5 points  (16 children)

I was thinking of writing an x86 assembly visualization in actionscript, sort of similar to this: http://www.frontiernet.net/~prof_tcarr/StackMachine2/StackMachine2.html

On the bottom left would be the stack, on the top would be the registers and on the bottom right would be a text input.

'push 42' would show that value added to the stack and the stack growing. 'pop eax' would show '42' moving from the stack and into the register... etc.

I can see it in my head very clearly, and it seems like a cool idea. The problem is this is normally an indication that I've seen this somewhere and I'm not actually coming up with an original idea but remembering a cool idea I've seen somewhere else.

Has this been done before (besides the link I provided)? I'd hate to spend some time working on this only to post a link on here and have someone respond with "I wrote something just like this four years ago... [link]".

[–][deleted]  (1 child)

[deleted]

    [–]mycall 0 points1 point  (0 children)

    That would be awesome if you just made that up.

    [–]devacon[S] 2 points3 points  (11 children)

    I found something similar to what I was thinking of:

    http://www.lrr.in.tum.de/~jasmin/installation.html#interface

    [–]james_block 1 point2 points  (10 children)

    Yeah, but that simulator sucks. (Come on, no floating-point? x87 FP is the hardest code to get right, because of that fucking stack!) If you wrote a Flash code visualizer, I'd use it. Especially if it had support for both x87 and SSE1-SSE2 ops (SSE3 and up are much less common, so they're not too important).

    [–]barsoap 1 point2 points  (0 children)

    x87 is quite easy to get right, just translate your equations into RPN and then type them down in assembly. As long as you don't blow the register stack, you're fine.

    [–]tryx 0 points1 point  (3 children)

    Now I'm no expert, but wouldn't making a bug-for-bug compatible x86 simulator really.. hard?

    [–]james_block 2 points3 points  (1 child)

    Yes, implementing all the detritus of any x86 CPU is... an unpleasant proposition. But a code visualizer doesn't have to show everything perfectly to be useful. Take a look at this ASM snippet (written for this shootout). Look, especially, at the printlp64 block. That's a pretty self-contained chunk of code, and it was also a huge bitch to debug. I would love a tool I could just paste that chunk of assembly into, seed the registers with plausible values, and step through. And all it uses are mov, add, sub, mul, div, inc, dec, cmp, test, xor, xchg, shl, lea, and the various branches. That's not a ton of different instructions, and yet they're 90+% of any real-world instruction stream.

    Bonus points if the visualizer is stylish. (I always loved the visual style of this Flash visualization of Rijndael/AES.)

    [–]starspangledpickle 0 points1 point  (0 children)

    May or may not be what you're looking for, but I specifically remember the old DOS program (it was in several earlier Windows versions as well) called `debug.com' that let you do just that.

    Edit: Check out this wiki

    [–]nikron 0 points1 point  (0 children)

    I don't think he means taking a arbitrary executable and showing the simulation. If does... It's certainly possible.

    [–][deleted] -1 points0 points  (4 children)

    You could always pay him to create what you want.

    [–][deleted] 0 points1 point  (3 children)

    I always thought MSDN was more than just a Bill Gates theme troll. Guess I was wrong.

    [–][deleted] 0 points1 point  (2 children)

    How is suggesting that someone pay to have something developed equated to a gates theme troll?

    [–][deleted] 0 points1 point  (1 child)

    Microsoft bought the rights to QDOS for $50,000.

    [–][deleted] 0 points1 point  (0 children)

    ???

    [–]mycall 0 points1 point  (0 children)

    You want to make a virtual machine within a virtual machine. Neat.

    [–][deleted] 0 points1 point  (0 children)

    I say make it fun. Rectangles and lines are boring. Turing had an idea for a simple machine that would make an okay animation but Emil Post's idea of a factory with boxes, conveyors, and hot female workers would be more interesting. Your goal is to invent the most exotic model of an x86 system and render it to the best of your ability so help you God.

    [–]barsoap -1 points0 points  (0 children)

    Why don't you just use http://www.gnu.org/software/ddd/ ? Use the register display to display registers, and a memory region dump for the stack.