Advertisement

Insight on registering SoftWire with AS

Started by April 10, 2005 12:05 PM
-1 comments, last by Rain Dog 19 years, 7 months ago
I've come across a need for the abilitiy to offer JIT assembly of assembly code to users of my app. I've easily registered softwires File assembler, as it has only a few methods, but the scriptwriter has to either declare the asm in a source file, or wrap the asm in a string like so:

string asm="";
asm+="	Factorial:									"+"\n";
asm+="		push	esi                             "+"\n";
asm+="	                                            "+"\n";
asm+="		mov		esi, [esp+8]                    "+"\n";
asm+="		cmp		esi, 1                          "+"\n";
asm+="		jne		Iteration                       "+"\n";

asm+="		mov		eax, esi                        "+"\n";
asm+="		pop		esi                             "+"\n";
asm+="	                                            "+"\n";
asm+="		ret                                     "+"\n";

asm+="	Iteration:                                  "+"\n";
asm+="		lea		eax, DWORD PTR [esi-1]          "+"\n";
asm+="		push	eax                             "+"\n";
asm+="		call	Factorial                       "+"\n";
asm+="		imul	eax, esi                        "+"\n";
asm+="		add		esp, 4                          "+"\n";
asm+="		pop		esi                             "+"\n";

asm+="		ret                                     "+"\n";
I was wondering if anyone here has attempted to register the full SoftWire library?

This topic is closed to new replies.

Advertisement