News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

JWasm new version v1.96

Started by japheth, July 26, 2009, 02:33:03 PM

Previous topic - Next topic

japheth


Hello friends,

There's a new JWasm version available:

http://www.japheth.de/JWasm.html

There were bugfixes and a few new features. Internally it has been prepared for 64bit, to be "officially" supported in the next version  - which will be v2.00 then.

For those who are not familiar with makefiles but want to create the binary for themselves: with MS VC 2003 toolkit just a few lines are needed:

set INCLUDE=\msvc8\Include
set LIB=\msvc8\Lib
\msvc8\bin\cl.exe -D__NT__ -IH -FeJWasm.exe -Oty2 -Gs *.c

\msvc8 is supposed to be the root directory of VC.

jj2007

Both 1.96 and 2.00 assembled my library full of odd macros without any problems. Compliments :U

japheth


> Both 1.96 and 2.00 assembled my library full of odd macros without any problems. Compliments

Thanks for feedback!

Immortal_One


Ficko

Thanks Japheth!                                                                         

Nice work! :U

Just couple of observation:

If you use "syscall" like:

MyProc proc near syscall public num:DWORD,max:DWORD
ret 8
Myproc endp

The "MOV ESP, EBP" is missing at the end.
- MASM does actually "LEAVE" at the end.-

The construct:

.if (cl == 0) && (eax == 0)
.endif

Produces

"OR CL,CL"
"OR EAX,EAX"

by MASM

"CMP CL,0"
"CMP EAX,0"

by JWASM which is 1 byte longer each.

Regards,
Ficko

japheth

Quote from: Ficko on July 29, 2009, 10:18:28 PM
If you use "syscall" like:

MyProc proc near syscall public num:DWORD,max:DWORD
ret 8
Myproc endp

The "MOV ESP, EBP" is missing at the end.
- MASM does actually "LEAVE" at the end.-

I just tested and AFAICS JWasm v1.96 also adds a "leave". What cpu was set in the source?

Quote
The construct:

.if (cl == 0) && (eax == 0)
.endif

Produces

"OR CL,CL"
"OR EAX,EAX"

by MASM

"CMP CL,0"
"CMP EAX,0"

by JWASM which is 1 byte longer each.

This is true, but it's intentionally. With option -Zg the generated code should look more Masm-like.


Ficko

Using


.686p
.model flat
; ------------------------------------------------------------------
.code
; =============== S U B R O U T I N E ===============================
MyProc proc near syscall public num:DWORD,max:DWORD
    ret 8
MyProc endp
end

no language type specified.

Produces:

public MyProc
MyProc proc near
push    ebp
mov     ebp, esp
pop     ebp
retn    8
MyProc endp


JWASM V1.96 JUL 26 2009

Quote
With option -Zg the generated code should look more Masm-like.

My bad!
Should study the options before nattering :red :bg

Ficko

Actually with -Zg switch is fine:


public MyProc
MyProc proc near
push    ebp
mov     ebp, esp
leave
retn    8
MyProc endp


This:
Quote
/c /coff /Cp /nologo

Dosn't do the job.

japheth

Quote from: Ficko on July 30, 2009, 10:06:00 AM
This:
/c /coff /Cp /nologo

Dosn't do the job.

You mean: without the -Zg switch? Under certain conditions it avoids the leave then and will create this code


public MyProc
MyProc proc near
push   ebp
mov   ebp, esp
pop    ebp
retn    8
MyProc endp


However, this isn't an error. When no local variables are defined, one doesn't need to restore ESP, a POP EBP is enough. One may probably argue whether this is a good strategy. LEAVE may work even if the the stack has been messed, while the simple POP EBP will almost certainly crash then. IMO, this "improved  robustness" is an illusion and a honest crash is the better thing to do in such situations.

Ficko

I am agree with you programming nice and legible pays off on the long run but
I do slack sometimes and get lazy especialy by writing small subs particularly with a C function call in it don't bother to ballance the stuck with "add esp, n"
or "pops" because "leave" takes care of it. :naughty:

This particular case it was crashing on me because I had too much pushes not pared with pops.
I don't remember it was intentional on my part the time I wrote it but at least I fixed it now. :lol

A thoroughly disrelated question:

I use RAD IDE and I am kind of used to it that by compiling a big project in case of an error the offending source get loaded with highlighted error spots.

Now it is too "liveless".

I even miss unsuccessful builds and wondering where my exe is?! :lol

Is there a way to get this two things to work better together?

BlackVortex

1) Every time you leave the stack misaligned a kid in Africa dies, so don't do it !

2) I use a batch file to compile and I have a pause in the end, so I can  see what happened   :toothy
Also I always delete the existing file to avoid confusion and I also check to make sure it really got deleted to avoid files being used (hanged process or when I leave it open in Olly)

dedndave

QuoteEvery time you leave the stack misaligned a kid in Africa dies, so don't do it !
i thought that's why intel gave us LEAVE

japheth

Quote from: Ficko on July 30, 2009, 04:32:38 PM
I am agree with you programming nice and legible pays off on the long run but
I do slack sometimes and get lazy especialy by writing small subs particularly with a C function call in it don't bother to ballance the stuck with "add esp, n"
or "pops" because "leave" takes care of it. :naughty:

Slightly dangerous habit because then you'll loose the contents of registers declared in the USES reglist - both with Masm and JWasm.

Quote
I use RAD IDE and I am kind of used to it that by compiling a big project in case of an error the offending source get loaded with highlighted error spots.

Now it is too "liveless".

I even miss unsuccessful builds and wondering where my exe is?! :lol

Is there a way to get this two things to work better together?

Probably. However, what is RAD IDE? Do you mean RadAsm? I'm not familiar with such IDEs ( using FAR manager, Makefiles and console mode text editors for development ), so please provide further details.

Ficko

Sorry Japheth I was using a unconventional nomenclature :wink

Yes I meant "RadAsm".

I don't know how "KetilO" doing his tricks maybe he is reading out the output window content and analysing it for the offending line and file so the parsing dosn't match with JWASM
output or maybe there are some hooks I have no idea but it's very cool. :U


...you'll loose the contents of registers declared in the USES reglist


Of course, I meant simple subs without "uses". :wink
And such case there could be a discussion about "technical correctness" since "LEAVE" means "restoring the stuck" and any "add esp," or "pops" would mean the same
so why to do twice the same thing other than clinging into a apparent symmetry -which isn't because you are doing cleanup twice- :wink

But I leave that to the MIT boys. :lol

Quote
..use a batch file to compile ..
Thanks "BlackVortex" that is a workaround not that cool like the full integration but works. :bg

japheth

Quote from: Ficko on July 31, 2009, 08:17:56 AM
I don't know how "KetilO" doing his tricks maybe he is reading out the output window content and analysing it for the offending line and file so the parsing dosn't match with JWASM
output or maybe there are some hooks I have no idea but it's very cool. :U

I tweaked the format of JWasm's error messages a bit: added "severity" to the error number, so 1xxx are fatal errors, 2xxx are errors and 4xxx are warnings, and also replaced the prefix 'E' or 'W' by 'A'. If RadASM still isn't satisfied, I probably can't help.