The MASM Forum

Specialised Projects => Assembler/Compiler Technology => Topic started by: TouEnMasm on October 11, 2014, 01:17:40 AM

Title: Jwasm 2.12pre CreateDialogParam ebx,st(-1) (f48.9c0): Illegal instruction
Post by: TouEnMasm on October 11, 2014, 01:17:40 AM
Hello,
I have allready posted this one using other includes.
Try the edit menu --> "trouve" or "remplace" and you get
Quote
         ;mov     ebx,st(-1) (f48.9c0): Illegal instruction windbg      
         INVOKE     CreateDialogParam, Hmodule,addr strTrouve,hwnd, addr DlgFindReplace, 0
There is two CreateDialogParam in the edition.inc lines 292,312
Ml do not do that
Title: Re: Jwasm 2.12pre CreateDialogParam ebx,st(-1) (f48.9c0): Illegal instruction
Post by: qWord on October 11, 2014, 02:04:29 AM
MASM does use LEAVE in the epilogue, which does hide your actual problem. jWasm does pop EBP and thus requires ESP to be valid.
Title: Re: Jwasm 2.12pre CreateDialogParam ebx,st(-1) (f48.9c0): Illegal instruction
Post by: TouEnMasm on October 11, 2014, 03:10:46 AM

Did you see something to do ?.
Title: Re: Jwasm 2.12pre CreateDialogParam ebx,st(-1) (f48.9c0): Illegal instruction
Post by: qWord on October 11, 2014, 03:22:50 AM
remove the line:
Code ("DlgFindReplace") Select
push     eax                      ; Save handle of edit1
Title: Re: Jwasm 2.12pre CreateDialogParam ebx,st(-1) (f48.9c0): Illegal instruction
Post by: jj2007 on October 11, 2014, 03:27:38 AM
Yep, line 88 in include.inc

These bugs are difficult to chase in ML.exe, in particular because your preserved regs look very different after the leave :badgrin:

@qWord: With the LOCAL, Jwasm behaves like ML. Without, it chokes. In any case, esi is trashed, of course.

include \masm32\include\masm32rt.inc

.code
MyTest proc uses esi arg1
LOCAL v1
  push arg1
  xor esi, esi ; preserved with uses
  mov v1, esi
  ret
MyTest endp

start:
mov esi, 123
invoke MyTest, 456
inkey str$(esi), " - should be 123"
exit

end start
Title: Re: Jwasm 2.12pre CreateDialogParam ebx,st(-1) (f48.9c0): Illegal instruction
Post by: TouEnMasm on October 11, 2014, 03:54:48 AM
Found

I have just modify the return values

DlgFindReplace PROC HdialBox:DWORD, wmsg, wparam, lparam
Local retour:DWORD
mov retour,TRUE
.if wmsg == WM_INITDIALOG              ; If message is INITDIALOG then
.elseif == ..
.else
        mov retour,FALSE
.endif

mov eax,retour
ret                             ; Return
DlgFindReplace  ENDP
;###################################################################