🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Insight on registering SoftWire with AS

Started by
-1 comments, last by Rain Dog 19 years, 2 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