I released the first version of my dynamic code generator.

Download it here:
http://euler.free.fr/dynasm/DynAsm1.zip

It's very different from SoftWire by C0D1F1ED
http://sourceforge.net/projects/softwire

I wrote this program with the following goals in mind:
- get the smallest and simplest possible generator (the final EXE takes 40 kbytes, which is much smaller than Softwire's)

- generate exactly the opcodes I need (this explains why it currently doesn't include floating point, SSE or MMX opcodes).

- have a very similar syntax to the Intel format
ex:
mov(edi, offset(eax));
gives:
mov edi,

('offset' means memory access, so I should have used 'memory' instead of 'offset')

What is its purpose ?
In my case, I need to execute a computation loop that will be executed several hundreds of times (for a distributed project of crossword grids filling).
Since the code has to be the fastest possible and the problem can be very efficiently programmed in ASM, I needed to generate ASM code.
But since the computation depends on the type of grid you have to fill, I cannot generate STATIC assembly (except for blank grids).
Thus, I decided to generate directly opcodes.


Next version will include a VirtualAlloc to create a code segment (as explained by fodder).

I'll be happy to hear your feedback.
Posted on 2005-01-15 12:20:10 by MCoder
Sounds pretty nifty, I'll definitely have a look at it!
Posted on 2005-01-15 12:56:43 by f0dder
I was looking for such thing and I found nothing that satisfies my style - e.g. written in asm. Does anybody knows for such an implementation of a dynamic code generator in pure asm?



/siddhartha
Posted on 2005-01-19 07:11:28 by siddhartha
Why does it have to be written in assembly if it isn't big and bloated?
Posted on 2005-01-19 08:26:07 by f0dder
I was looking for such thing and I found nothing that satisfies my style - e.g. written in asm. Does anybody knows for such an implementation of a dynamic code generator in pure asm?


I found several code generators (Softwire, ORP, ValGrind, CCG, GoldRec, Schueler's ASM, Lightning, and some small compilers/assemblers like GEMA, GASM, SASM, DebugA86, OllyDisasm or TCC), but none in ASM.

BTW, I don't see too much the interest for such a generator in ASM, since you can simply copy the opcodes.
Posted on 2005-01-19 08:30:09 by MCoder
Why can't you use Macro's in your code instead?
Posted on 2005-01-19 10:42:48 by mark_larson
Why can't you use Macro's in your code instead?


Beacause I'm not too familiar with this things... What a pitty!



I found several code generators (Softwire, ORP, ValGrind, CCG, GoldRec, Schueler's ASM, Lightning, and some small compilers/assemblers like GEMA, GASM, SASM, DebugA86, OllyDisasm or TCC), but none in ASM.

BTW, I don't see too much the interest for such a generator in ASM, since you can simply copy the opcodes.



I don't think it is this easy when I want to do very complex things!



/siddhartha
Posted on 2005-01-19 10:49:37 by siddhartha