Thread: x86 assembly emulator

  1. #1
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318

    x86 assembly emulator

    I want an x86 assembly emulator where I can type in the assembly instruction, then press RUN, and see the resulting memory/register values. It needs to run in Protected mode and be able to simulate memory addresses.

    I downloaded Bochs, but is some kind of BIOS/ring0/kernel/whatever emulator, not Windows Protected mode emulator.

    Currently the most convenient way is to write code into an empty app in OllyDbg.
    Last edited by maxorator; 10-10-2008 at 05:57 AM.
    "The Internet treats censorship as damage and routes around it." - John Gilmore

  2. #2
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    If you want to see what happens with a set of instructions in Windows, then some sort of Windows debugger is probably your best choice. WinDBG actually has an "assembler" option - although I'm not sure how good it is - so you can type in new instructions into an existing (say a load of NOP's) piece of application code.

    If you want to emulate the system from boot onwards, then Bochs or QEMU would be choices.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  3. #3
    Reverse Engineer maxorator's Avatar
    Join Date
    Aug 2005
    Location
    Estonia
    Posts
    2,318
    The problem with OllyDbg is that I need to count with the space - I can't just add an instruction between two other instructions.

    WinDbg allows assembling without specified addresses for each instruction?
    "The Internet treats censorship as damage and routes around it." - John Gilmore

  4. #4
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by maxorator View Post
    The problem with OllyDbg is that I need to count with the space - I can't just add an instruction between two other instructions.

    WinDbg allows assembling without specified addresses for each instruction?
    Not sure, I haven't used WinDBG for about 4 years now.

    Generally when I write assembler code it's inside a inline assembler chunk in C (or C++).

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #5
    Registered User
    Join Date
    Nov 2008
    Posts
    5

    x86 emulator

    Jasmin and Ketman are not the stuff you asked for - they can't
    do protected mode stuff - but they are related and someone might find
    them useful.

    Jasmin
    http://www.lrr.in.tum.de/~jasmin/

    Jasmin is an opensource x86 ASM interpreter written in Java.

    It implements NASM syntax and quite a few ASM commands.
    However it doesn't assemble the code (since it is an interpreter).
    You won't be able to write self-modifying code.

    Jasmin has 2 types of labels. The first type is for JMPs.
    The second type is the so called pseudo labels used for
    accessing data in memory defined by DB or RESW and the like.

    It also comes with good documentation. Its quite neat for a learning
    tool: you can test standalone ASM functions using Jasmin. What
    you can't do is accessing hardware or the OS.

    Ketman
    http://www.btinternet.com/~btketman/tutpage.html

    Ketman's tutorial is actually a small 16-bit ASM interpreter.

    The real way
    In case you want to play with ASM the real way, get some IDE where
    you can set breakpoints and quickly launch your code into a debugger.
    Compiling, running, debugging in one step.
    Last edited by kalevi; 11-30-2008 at 04:51 PM.

  6. #6
    Registered User
    Join Date
    Aug 2008
    Location
    Belgrade, Serbia
    Posts
    163
    Quote Originally Posted by kalevi View Post
    Jasmin is an opensource x86 ASM interpreter written in Java.
    Interpreter written in an interpreter? What a waste..
    Vanity of vanities, saith the Preacher, vanity of vanities; all is vanity.
    What profit hath a man of all his labour which he taketh under the sun?
    All the rivers run into the sea; yet the sea is not full; unto the place from whence the rivers come, thither they return again.
    For in much wisdom is much grief: and he that increaseth knowledge increaseth sorrow.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. x86 assembly, mov vs lea
    By cyberfish in forum Tech Board
    Replies: 5
    Last Post: 07-15-2009, 03:12 AM
  2. A good tutorial for x86 assembly?
    By cyberfish in forum Tech Board
    Replies: 3
    Last Post: 05-10-2009, 11:56 AM
  3. Networking in x86 Assembly (try not to laugh at me)
    By sean in forum Networking/Device Communication
    Replies: 6
    Last Post: 12-23-2004, 04:54 AM
  4. Arrays In Inline x86 Assembly
    By saxman in forum C Programming
    Replies: 17
    Last Post: 07-07-2004, 02:38 PM
  5. C,C++,Perl,Java
    By brusli in forum C Programming
    Replies: 9
    Last Post: 12-31-2001, 03:35 AM