Hi,

I have had the idea for several months, that I would like to write an x86 assembler in c. I know nasm is a good example, but does anyone have a simpler assembler for me to take a look?

I have read up the opcode book and IA-32 developer manuals. Where shall I get to start development?

Many thanks.

Regards,
Charles
Posted on 2005-01-14 15:31:21 by gentlelover
Also you can check yasm is also writed in C, a comment from the author say that is more OO oriented, altought it is writed in plain C.

My first "attack" in compilers/assemblers was with nasm, I havent much knowledge, but was fun :) read the source code and modificate it a little ;).
Posted on 2005-01-14 23:13:15 by rea
Hi

fasm sources are very clear, though asm.
See Ollydbg too.

Please make a 64-bit asm for AMD64 : it is the (near) future.

The problem with yasm (nasm) is it is NOT x86 optimized.
The great thing with yasm is you can compare your bin output with it :)
I'll go on building my own asm too if time and courage enough.
For now I build some C routines emulating 64-bit asm under AMD64.

Regards
Posted on 2005-01-17 05:56:37 by valy
gentlelover,

Randall Hyde's website offers a lot of materials to build your own assembler :alright:
Posted on 2005-01-17 12:37:32 by Vortex
it is not that difficult to write an assembler:

the most tricky part are to detect symbols (needs sort algorithm to compute address/jump distances)
you need an understanding of the addressing modes, and how the opcodes are made up.
well you wrote you have the intel manuals, i have read them a while ago.
then you may decide if you include FPU/MMX support, though not required for a skeleton version.
if an assembler can translate itself, that's really cool!
probably it is more difficult to code the thing in c than in assembler itself.
but take FPU/MMX issues into consideration before you start coding, it is difficult to modify/rewrite assembly sources.

i am going to write an assembler myself, but the instruction set is not that large as of the intel cpu's.
Posted on 2005-04-02 07:57:51 by akidd86