Is there an assembler (ml.exe) or linker (link.exe) option to do the following:

If I have the following PROC

TestFunction PROC Var1 :DWORD
mov LocalVar, eax
FullFunc ENDP

it will generate something like 'mov , eax' for the 'mov LocalVar, eax' line.

Is there a way to tell the assembler not to assume there is a stack frame?


A way to "override" the Prologue Macro to replace the 'LocalVar EQU ' code with something like 'LocalVar EQU ' instead?
(Of course after a call to 'sub esp, 4' to reserve space on the stack for LocalVar!)

Also, because LocalVar is assumed to , is there a way to change calls to 'Var1", which become

Posted on 2004-05-04 06:45:22 by SubEvil
I have tried without success.

Use FASM. :)
Posted on 2004-05-04 08:23:21 by bitRAKE
Is it not possible to write your own prologue and epilogue macros? I never tried but thought it could be done...
Posted on 2004-05-04 12:17:26 by QvasiModo
you can do

option epilogue:none
option prologue:none
[b]... insert proc code ...[/b]
option epilogue:default
option prologue:default

But then you can't use symbolic names to refer to your variables, and will have to do it manually.

I think I saw some fasm macros to do this, though? Or was it just one of those weird dreams? :)
Posted on 2004-05-04 12:46:42 by f0dder
Here's one set of macros for fasm that can do that:

proc FooBar, Param1
type noframe
var .Dummy
mov [.Dummy], eax
push ecx
mov [Param1], eax
pop ecx


00403000 . 83EC 04 SUB ESP,4
00403003 . 890424 MOV DWORD PTR SS:[ESP],EAX
00403006 . 51 PUSH ECX
00403007 . 894424 0C MOV DWORD PTR SS:[ESP+C],EAX
0040300B . 59 POP ECX
0040300C . 83C4 04 ADD ESP,4
0040300F . C2 0400 RETN 4
Posted on 2004-05-04 13:23:38 by Aaro
I attach some of my last examples, because I was near to lost them, then I attach them here, they are for nasm, they can switch between ebp and esp, they can use stdcall, or ccall, they can have varargs, also is enforced the use of ammmm.. how are they called?? mmmm..... mmmmmmm protos of functions, also can export and import names (for example for link with the C librarys in lin).

Maybe like I put in a far post time a go, you can try to use the logic that I follow for the nasm processor, and translate t0 the processor of your assembler.

Also I lost a anterior version (I guess, because I cant find it) that dont need the use of protos, but this version with a little work can do that.

Also you will find some examples that I can assemble link and run in linux.....

the proto, like is explained in the examples is like this:
; proto [ callConvention ][ LocalsControl ][ import/export ][, vararg]
name1/name2, are the first name, is the name that you whant to use in your code, the second, is with what name is suposed to export it, also I dont remember if this feature was tested ok, but i think it was. ;)

Also I start that macro and terminate the first working version for nasm in 3-4 days, after understand the problem, I stop for a year or so, and I start this other aproach, based on the first version, and intermediate ones, also If I remember ok, that version (or a little after version) have a problem in the count of the args passed at the return, for example, it put ret 16 when it was ret 20, this latter version dont have that little problem ;).

I redirect you to that question

Also in that way is very easy to add the feature of goasm of the locals in a easy way, also if you use the esp, it will need be tacked in a diferent way, only esp based, instead of ebp... :D, it is easy.

Have a nice day or night.
Posted on 2004-05-12 11:41:45 by rea
Also I need add, that the only problem that I find with this macro, using ESP is because nasm not track the size of the symbols, then, watching at the instructions that mainly modify the esp, I take the decision that all will add or substract 4 bytes to the esp.

Passing to other assembler that can track the sizes, will be very well, also if you have the code of an assembler that already suport procs, should be easy add the suport for esp, also will be more fast, that leting the work to the preprocessor, sure, preprocessors are powerfull, but not all the problems need be solved in that stage.

Have a nice day or night.
Posted on 2004-05-13 02:26:36 by rea