The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: debugee on April 21, 2011, 06:57:50 AM

Title: an error in masm6.14
Post by: debugee on April 21, 2011, 06:57:50 AM
;;;;can somebody tell me why?


.386
.model flat,stdcall
option casemap:none

CTEXT MACRO y:VARARG
LOCAL sym

_DATA segment
IFIDNI <y>,<>
sym db 0
ELSE
sym db y,0
ENDIF
_DATA ends

EXITM <OFFSET sym>
ENDM


.code
main proc uses ebx esi edx

mov eax,CTEXT("this is a test!")

ret
main endp

start:
jmp main

end start




00401000   > /53            PUSH EBX
00401001   . |56            PUSH ESI
00401002   . |52            PUSH EDX
00401003   . |B8 00204000   MOV EAX,bug.00402000                    ;  ASCII "this is a test!"
00401008   . |5A            POP EDX
00401009 > $^\EB F5         JMP SHORT bug.00401000
0040100B   .  C3            RETN
0040100C      00            DB 00
0040100D      00            DB 00
0040100E      00            DB 00


Added code tags.
Title: Re: an error in masm6.14
Post by: jj2007 on April 21, 2011, 07:56:53 AM
Interesting. ML 9.0 does the same, only JWasm pops the "uses".
Title: Re: an error in masm6.14
Post by: qWord on April 21, 2011, 09:15:32 AM
This problem is well knowen to me: masm simply cooks sometimes when using SEGMENT/ENDS inside procs. The only solution is to use .data/.code to switch the segments - as long as not using your own defined code segments it should be no problem.
Title: Re: an error in masm6.14
Post by: debugee on April 21, 2011, 01:42:04 PM
Hi qWord
Thanks for reply,I also find that what you say about,it is really strange.

debugee
Title: Re: an error in masm6.14
Post by: hutch-- on April 21, 2011, 01:45:41 PM
debugee,

Try this.


.data

IFIDNI <y>,<>
sym db 0
ELSE
sym db y,0
ENDIF

.code
Title: Re: an error in masm6.14
Post by: debugee on April 21, 2011, 02:46:28 PM
hi hutch--

thanks for your reply :U :U

debugee