I'm not sure exactly what I'm looking for or whether it exists, but I was hoping to get any ideas from the assembly experts here. I do know basic x86 and ARM assembly from classes but have not used them much in "real life."

Ideally, what I would like is an open source C/C++ library that takes in an x86 or ARM assembly program as a text string, interprets the commands, and outputs the final values of variables representing the registers as the result of running the assembly program.

There doesn't seem to be any such thing as an open source assembly "interpreter." On the other hand, a complete open source emulator of a generic ARM processor would be radical overkill, and I wouldn't even know where to begin to modify the source code of such an emulator to achieve my very modest goal.

Does anyone here have an idea for how I might go about doing what I want to do? Any help is appreciated!

I seriously doubt that what you are looking for exists. Your goal is achieved by a combination of an assembler, a simulator, and a debugger (the latter two are usually bundled together).
You don't need to modify the simulator code. The process is to assemble your program, load it into a simulator, and run under debugger control. The debugger lets you execute a program line by line, view memory and registers, and even modify them. That's as I understand is what you want.

I seriously doubt that what you are looking for exists. Your goal is achieved by a combination of an assembler, a simulator, and a debugger (the latter two are usually bundled together).
You don't need to modify the simulator code. The process is to assemble your program, load it into a simulator, and run under debugger control. The debugger lets you execute a program line by line, view memory and registers, and even modify them. That's as I understand is what you want.

The thing is that I really just want to analyze the logic of an assembly program automatically using a separate C/C++ program. Going through the heavyweight processes of assembling the code into an executable and then starting a huge virtual machine emulator is something I want to avoid. I guess there may be no way to avoid it though.

Going through the heavyweight processes of assembling the code into an executable and then starting a huge virtual machine emulator is something I want to avoid.

Why?

The thing is that I really just want to analyze the logic of an assembly program automatically using a separate C/C++ program.

A separate C/C++ program, capable of analyzing the logic of an assembly program, especially in an automatic manner, is no lighter than an eimulator.

To answer my own question, spim [http://pages.cs.wisc.edu/~larus/spim.html] is a lightweight simulator with source code that can be modified fairly easily to make it act like an interpreter. It's for MIPS, and not x86 or ARM like I originally wanted, but I think MIPS might be better for my purposes anyway.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.