question of the usage
Peter Johnson
peter at tortall.net
Mon Dec 17 23:22:19 PST 2007
On Sun, 16 Dec 2007, Yan Huang wrote:
> I am new to Yasm. I am wondering if yasm provides a library interface of
> assembling human-readable assembly instructions into binary code and
> disassembling binary code to human-readable assembly instructions
> (assuming all the tags used in the instructions have already been
> translated to numbers). I am expecting a well-defined APIs to use in my
> own program.
Yan,
Yasm provides half that solution; currently there's no disassembly
support, but it does have a pretty complete API for assembly (see
http://www.tortall.net/projects/yasm/wiki/ProgrammerReferences). This
documentation is for libyasm, the core library used by the "yasm"
frontend. If you want to parse a certain syntax (such as NASM syntax),
it's probably easiest to look at the yasm.c frontend code
(http://www.tortall.net/projects/yasm/browser/trunk/yasm/frontends/yasm/yasm.c)
and trim it down to your needs.
For disassembly, I can direct you to a disassembler library called
diStorm64 (http://www.ragestorm.net/distorm/).
Disassembly has a significantly simpler API compared to assembly; the
reason assembly is much more complex is due to the need to handle user
expressions, symbol tables, etc. We're gradually working on trying to
simplify the assembler API, but it's an evolutionary process.
Feel free to post here if you have any yasm API questions.
Peter
More information about the yasm-devel
mailing list