The MASM Forum Archive 2004 to 2012

Specialised Projects => Assembler/Compiler Technology => Topic started by: japheth on July 26, 2009, 02:33:03 PM

Title: JWasm new version v1.96
Post by: japheth on July 26, 2009, 02:33:03 PM

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.
Title: Re: JWasm new version v1.96
Post by: jj2007 on July 26, 2009, 03:12:56 PM
Both 1.96 and 2.00 assembled my library full of odd macros without any problems. Compliments :U
Title: Re: JWasm new version v1.96
Post by: japheth on July 29, 2009, 04:43:23 AM

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

Thanks for feedback!
Title: Re: JWasm new version v1.96
Post by: Immortal_One on July 29, 2009, 09:46:02 AM
Nice work, thanks.
Title: Re: JWasm new version v1.96
Post by: Ficko on July 29, 2009, 10:18:28 PM
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
Title: Re: JWasm new version v1.96
Post by: japheth on July 30, 2009, 09:26:38 AM
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.

Title: Re: JWasm new version v1.96
Post by: Ficko on July 30, 2009, 09:52:42 AM
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
Title: Re: JWasm new version v1.96
Post by: Ficko on July 30, 2009, 10:06:00 AM
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.
Title: Re: JWasm new version v1.96
Post by: japheth on July 30, 2009, 02:57:47 PM
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.
Title: Re: JWasm new version v1.96
Post by: 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:

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?
Title: Re: JWasm new version v1.96
Post by: BlackVortex on July 31, 2009, 12:52:52 AM
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)
Title: Re: JWasm new version v1.96
Post by: dedndave on July 31, 2009, 12:59:37 AM
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
Title: Re: JWasm new version v1.96
Post by: japheth on July 31, 2009, 06:10:07 AM
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.
Title: Re: JWasm new version v1.96
Post by: Ficko on July 31, 2009, 08:17:56 AM
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
Title: Re: JWasm new version v1.96
Post by: japheth on August 01, 2009, 09:16:48 AM
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.
Title: Re: JWasm new version v1.96
Post by: BogdanOntanu on August 01, 2009, 11:21:39 AM
Quote from: japheth on August 01, 2009, 09:16:48 AM

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.


One simple solution would be to mimic exactly the MASM's error messages line layout. This way RadASM will parse them just like it does for MASM now.

Alternatively you can use your own layout but keep in mind that  RadASM will parse the assembler's output seeking for:
1) An error marker token probably "**Error" or something
2) The source file name where the error is located
3) The line number where the error is located

It is pretty easy to change the error printf format to match RADASM's requirements and in exchange you obtain a huge advantage: the IDE will automatically open the source file and highlight the error line for the user.

The error number and it's hexadecimal subfields are not parsed by RADASM.

I did this for Sol_ASM and IMHO it is easy to be done for any assembler.

The times when you used makefiles and manually seek for errors after the compile's console output are long gone. Today the ASM IDE's  highlight error lines, help code browse, collapse code, type for you, suggest parameters, show EQU's by mouse hover,  etc. Using an assembler without the help of an advanced IDE is an unnecessary torture.

Title: Re: JWasm new version v1.96
Post by: Ficko on August 01, 2009, 02:13:26 PM
Hi Bogdan!

Quote
I did this for Sol_ASM...

Do this means that you may have a "Sol.ini" sandbagged - not published in the "RadASM programming pack" - for highlighting and parsing too ? :toothy

Or I just reading too much out of your lines?
Title: Re: JWasm new version v1.96
Post by: BogdanOntanu on August 01, 2009, 04:18:24 PM
Quote from: Ficko on August 01, 2009, 02:13:26 PM
Hi Bogdan!
...
Do this means that you may have a "Sol.ini" sandbagged - not published in the "RadASM programming pack" - for highlighting and parsing too ? :toothy

Or I just reading too much out of your lines?

Hi Ficko,

Yes that is correct. I do use RadASM with Sol_Asm and yes "sol_asm.ini" and additional API files do exist but are not yet published in RadAsm programming pack. I did handcrafted them by reading the RadASM manuals comparing with other .ini files (MASM/TASM) and by asking Ketilo some dumb questions :D  ... Maybe I should release them...

Although initially HE RTS was written in "plain" text editors today I would not dare to handle big ASM projects without an advanced ASM IDE like RadASM. Code browsing is a lot of fun.

Hence I think that JWASM should also benefit from those "pleasures" of using an advanced ASM IDE.
Title: Re: JWasm new version v1.96
Post by: Ficko on August 01, 2009, 05:02:46 PM
Quote
... Maybe I should release them...

Are you joking? :dazzled:

Yes, you should!! :clap:

The main reason I am not doing too much with Sol_asm because I went B/W-blind from RadASM. :bg
Title: Re: JWasm new version v1.96
Post by: Farabi on August 03, 2009, 01:03:59 PM
 :U
Hi japhet, nice to see you still here.
Im a big fans of RadAsm. It would be great if you follow bogdan sugestion. Or maybe, I will try another IDE.
JWASM is my ultimate weapon in case Im move to linux. Ubuntu getting very popular among my other community.
Title: Re: JWasm new version v1.96
Post by: japheth on August 03, 2009, 07:20:17 PM
Hi Farabi,

Quote from: Farabi on August 03, 2009, 01:03:59 PM
Im a big fans of RadAsm. It would be great if you follow bogdan sugestion. Or maybe, I will try another IDE.
JWASM is my ultimate weapon in case Im move to linux. Ubuntu getting very popular among my other community.

But there is almost certainly nothing to do from my side anymore. Some days ago I posted:

Quote
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.

So please test JWasm v2.0 if it does this "highlighting thing" now! JWasm v1.96 is final and won't be changed anymore.
Title: Re: JWasm new version v1.96
Post by: Ficko on August 03, 2009, 07:53:45 PM
Thanks Japheth!

It does work now !! :U
Title: Re: JWasm new version v1.96
Post by: Ficko on August 03, 2009, 08:08:07 PM
But there is an other problem. :(

I am getting

Quote
Error A2054: Invalid instruction operands

by

movq mm0, qword ptr [l1]

JWASM200B
but

movq mm0, dword ptr [l1]


seems to be ok.

JWASM196B
Takes it just fine.

Using

.686p
.model flat
.mmx


flags

Quote
/Zg -zlf /c /coff /Cp /nologo
Title: Re: JWasm new version v1.96
Post by: japheth on August 04, 2009, 02:09:16 PM
Quote from: Ficko on August 03, 2009, 08:08:07 PM
But there is an other problem. :(

I am getting


Error A2054: Invalid instruction operands



Well, I guess that's why it's called unstable. This error might be fixed now, but please don't use the current development version for anything serious!