try compile the following code and diassemble it,what's the result?
the code is not correctly generated,and the entrypoint is also not correct.
I think it's a bug,but I need more test....

.Model Flat,StdCall
Option Casemap :None

include \masm32\include\
include \masm32\include\
includeLib \masm32\lib\kernel32.lib


Dprint PROC errMsg:DWORD
CONST segment
mes0 db "a",0
CONST ends
;mov eax,offset mes0
Dprint ENDP

;;Prog Entry Point

_StArT PROC uses eax ecx

invoke ExitProcess,0
invoke Dprint,ebx
jmp @ep

Posted on 2003-10-20 22:14:31 by Hume
As fas as I remeber its the CONST segment definition at the beginning of a proc which may cause problems.
Can be avoided by using simplified segment directives (.const).
Posted on 2003-10-21 11:50:29 by japheth
Try putting the following code into the .DATA section

;CONST segment
;mes0 db "a",0
;CONST ends

mes0 db "a",0

Your current code is trying to use "Dprint" as the code entry point where what you need is a label after the ".code" directive that is matched at the end of the file with "end yourlabel".

Like this,

; put your data here.
mes0 db "a",0
;put your code here
startlabel: ; <<<<< entry point

; write your application code here

end startlabel

Posted on 2003-10-21 21:22:53 by hutch--

the question is _StArT is a procedure name,also is a label,in my code,I also used

end _StArT

to define entrypoint explicitly,but masm did the wrong thing,I can't understand this behaviour of MASM,the solution is very simple,but I think it's a BUG of MASM.
Posted on 2003-10-22 20:32:38 by Hume
What do you want to tell us? You've found a bug, or you want to know how to get the workaround to avoid such bug?
If your purpose is the first one, you'd better send a mail to M$ rather than post it to a messageboard. If it's the latter one, as you've said, "the solution is very simple", you have got it.

btw, it's not strange for such a bug. No software is bug free.
Posted on 2003-10-22 23:58:00 by KomsBomb

Your problem apart from the suggestion that does work is that your first label is the proc name


Yet you close the program with


Same rule applies, make sure the label AT the entry point is matched by the END label at the end of the code.

MASM does have the odd bug here and there but this problem is a mistake in your code, not a bug in MASM.

Posted on 2003-10-23 11:33:09 by hutch--

I think it's not caused by the

Dprint procwww

if you remove the const segment definition,then all is OK.
if you place the const segment definition anywhere else,then it's OK.
I think there may be a bug in CONST segmentation parsing.
Posted on 2003-10-24 03:03:10 by Hume

MASM syntax is set by MASM, not by opinion, the code entry point is at the start of the .code section and in an ordinary MASM executable in 32 bit, this is 1000h. It can vary depending on the structure of the EXE file.

Now when you mess up the entry point with a procedure that cannot get parameters passed to it, you need to fix the file first, not pass the buck to MASM. To go over it again, match the label at the entry point with the end statement at the end of your code.

Remember that NOTHING is passed at the entry point so having stack based parameters is a mistake. When you fix the mistakes in the file, THEN you can play with a .CONST segment if you can get it to work.


hutch at movsd dot com
Posted on 2003-10-24 06:08:07 by hutch--