views:

471

answers:

5

Any assembly interpreters out there?

What I'm looking for:

  • I have some assembly firmware code I want to run, but not on the actual hardware.
  • I would like to run the code and see what it is doing.

So, is there some sort of free and easy to use assembly simulator out there?

Any other pointers you can think of?

+1  A: 

Short answer: Yes.

Longer answer: Depends on the CPU you have assembly for and what kind of peripherals you are interfacing with. There are literally 1000s of different CPU packagings in the world.

Paul Nathan
+1  A: 

For x86 assembly, you could use an x86 PC emulator like Bochs.

Mehrdad Afshari
+3  A: 

You should look into some processor emulator only that way you can "interpret" assembly, for example: Qemu or Bochs

Paulo Lopes
A: 

Probably, but please note that it's one thing to emulate the core instruction set, and quite another to handle the peripherals.

If you're just emulating an algorithm that operates on data, you can probably get away with just emulating the CPU core.

If you need to emulate an analog-to-digital converter or UART or PWM driver, that's a whole different ball game. The CPU core instruction set is (usually) well-specified to the point where you could imitate its behavior pretty well. The peripherals are only specified to show their functional requirements, and not to guarantee their behavior precisely enough to make an emulator without having to know how they implemented the peripheral in question.

Jason S
+2  A: 

In order to run assembly code that is designed for a particular device, you will need to run it with an emulator that specifically emulates that device. An x86 emulator like Qemu will be utterly incapable of running assembly code written for an ARM CPU core. This is not a case of "almost works", but it won't even be able to run the first instruction.

As mentioned by Jason S, emulating peripherals or anything outside the CPU core is very specific to the device you've got. Details can even differ between PCB revisions.

If you're just curious about what the assembly code is doing, you might be better off sitting down with the CPU reference manual, and examining each instruction in turn. If you're going to be doing any serious work with this device, you'll have to have that knowledge eventually anyway.

Greg Hewgill
Nit: QEMU is not limited to x86 ;-)
Luca Tettamanti