Back to home page

DOS ain't dead

Forum index page

Log in | Register

Back to index page
Thread view  Board view
Rugxulo

Homepage

Usono,
27.03.2012, 00:39
 

NASM 2.10 (Announce)

On 12 March 2012, the NASM developers finally released NASM 2.10.

Home page: http://www.nasm.us/
Download: http://www.nasm.us/pub/nasm/releasebuilds/2.10/
Changelog: http://www.nasm.us/doc/nasmdocc.html

Changes in 2.10:
* When optimization is enabled, "mov r64,imm" now optimizes to the shortest form possible
* Add support for the Intel AVX2 instruction set.
* Add support for Bit Manipulation Instructions 1 and 2.
* Add support for Intel Transactional Synchronization Extensions (TSX).
* Add support for x32 ELF (32-bit ELF with the CPU in 64-bit mode.) See section 7.9.
* Add support for bigendian UTF-16 and UTF-32. See section 3.4.5.

Rugxulo

Homepage

Usono,
27.03.2012, 00:42

@ Rugxulo
 

NASM 2.10

cm, I bring this up for your benefit (though I'd be surprised if you didn't already know).

In particular, they seem to have "reverted" to the 2.09 preprocessor (eh?) at the last minute and will have to work on the "newer" (?) one for later. Also, I have no idea why this release took so long to happen or why it went through so many release candidates, but at least it's finally out. And BTW, I don't see the point of supporting an instruction set for a cpu that is over a year away from being popularly sold, but I guess some emulators exist? (Meh.) I mean, AVX is barely out and supported, so why the rush to add AVX2?

marcov

27.03.2012, 13:07

@ Rugxulo
 

NASM 2.10

> (Meh.) I mean, AVX is barely out and supported, so why the rush to
> add AVX2?

More time to get bugs detected, and Intel partners might even have simulators available that emulate the new instruction sets.

E.g. the core of the (x86) 64-bit support of FPC was implemented with a simulator for testing.

ecm

Homepage E-mail

Düsseldorf, Germany,
20.04.2012, 04:26

@ Rugxulo
 

NASM 2.10 - revised preprocessor

> cm, I bring this up for your benefit (though I'd be surprised if you
> didn't already know).

Oh hey. Actually I didn't, I've not kept up with the net for the last few weeks. Randomly checked the forum for something else. So thanks!

> In particular, they seem to have "reverted" to the 2.09 preprocessor (eh?)
> at the last minute and will have to work on the "newer" (?) one for later.

Good to hear, I suppose. The revised preprocessor (introduced in 2.10rc3 or so) broke basically all my sources at first, and primarily due to bugs (not incompatible new features). Prepared some patches way back (early 2011?), and while I got it to work well I never got around to suggest them to the NASM team. Alas, their work on the revised preprocessor in later RCs did address some or all of the problems as far as I remember.

> Also, I have no idea why this release took so long to happen or why it went
> through so many release candidates, but at least it's finally out.

I guess it had to do with wanting to push the revised preprocessor.

---
l

RayeR

Homepage

CZ,
02.05.2012, 22:06

@ ecm
 

NASM 2.10 - revised preprocessor

> Good to hear, I suppose. The revised preprocessor (introduced in 2.10rc3 or
> so) broke basically all my sources at first, and primarily due to bugs (not
> incompatible new features). Prepared some patches way back (early 2011?),
> and while I got it to work well I never got around to suggest them to the
> NASM team. Alas, their work on the revised preprocessor in later RCs did
> address some or all of the problems as far as I remember.

Hm I was noticed by some chinese student that my ROMOS sources compiled in old NASM doesn't longer works with new NASM 2.10. I checked the compilation process and no errors/warnings was displayed but the code is different. I'm going to analyze whats messed up. But this doesn't make me very happy I think that established standard should be kept...

---
DOS gives me freedom to unlimited HW access.

ecm

Homepage E-mail

Düsseldorf, Germany,
02.05.2012, 22:16

@ RayeR
 

NASM 2.10 - revised preprocessor

> Hm I was noticed by some chinese student that my ROMOS sources compiled in
> old NASM doesn't longer works with new NASM 2.10.

Are you referring to the finalised 2.10 using the older preprocessor, or to one of the newer preprocessor revisions in the 2.10 RCs?

> I checked the compilation
> process and no errors/warnings was displayed but the code is different. I'm
> going to analyze whats messed up.

Have you tested that anything is actually messed up, ie that it doesn't work? Newer NASMs optimise better, for example, unconditional jumps are shortened even without explicit "short" keyword, and fitting values will select sign-extending instructions even without explicit "byte" keyword. (I think the latter is new even if you previously already specified -Ox on the command line, which is the default now!) For these reasons, byte-incompatible output might still be correct.

> But this doesn't make me very happy I think that established standard should be kept...

There never was a de jure "established standard", just de facto. And the NASM developer team does seem to attempt to keep that supported. However, primarily with grey areas that weren't communicated in the manual very well, sometimes things are broken.

---
l

RayeR

Homepage

CZ,
02.05.2012, 22:43

@ ecm
 

NASM 2.10 - revised preprocessor

> Have you tested that anything is actually messed up, ie that it doesn't
> work? Newer NASMs optimise better, for example, unconditional jumps are
> shortened even without explicit "short" keyword, and fitting values will
> select sign-extending instructions even without explicit "byte" keyword. (I
> think the latter is new even if you previously already specified -Ox on the
> command line, which is the default now!) For these reasons,
> byte-incompatible output might still be correct.

Yes you got it. All the differences of binary made by 2.10 seems to be jmp -> jmps that saved some bytes and shifted the entire code. I chcecked the binary in BOSH and it WORKS. I wrote in a mistake the version that chinese guy used - 2.09.07 compiled on Mar 14 2011. I suggested him to upgrade on 2.10. Hope it will solve the problem.

---
DOS gives me freedom to unlimited HW access.

ecm

Homepage E-mail

Düsseldorf, Germany,
02.05.2012, 22:48

@ RayeR
 

NASM 2.10 - revised preprocessor

> Yes you got it. All the differences of binary made by 2.10 seems to be jmp
> -> jmps that saved some bytes and shifted the entire code. I chcecked the
> binary in BOSH and it WORKS. I wrote in a mistake the version that chinese
> guy used - 2.09.07 compiled on Mar 14 2011. I suggested him to upgrade on
> 2.10. Hope it will solve the problem.

You should try assembling with one of -O0 (capital letter O followed by digit zero) and -O1 (cap. letter O followed by digit 1) explicitly on the NASM command line; one of those was the default in the older NASM versions (like 0.98.x) - not sure which. Just look whether either produces a byte-compatible result.

---
l

RayeR

Homepage

CZ,
03.05.2012, 00:04

@ ecm
 

NASM 2.10 - revised preprocessor

> You should try assembling with one of -O0 (capital letter O followed by
> digit zero) and -O1 (cap. letter O followed by digit 1) explicitly on the
> NASM command line; one of those was the default in the older NASM versions
> (like 0.98.x) - not sure which. Just look whether either produces a
> byte-compatible result.

Yes -O0 produces the same result :)

---
DOS gives me freedom to unlimited HW access.

Rugxulo

Homepage

Usono,
03.05.2012, 02:25

@ RayeR
 

NASM 2.10 uses "- Ox" by default

> Yes -O0 produces the same result :)

I believe the rationale for this was that approx. 99% of people don't want "unoptimized" (bigger) code by default. Esp. if you compare FASM and YASM have already forced such size optimization for years without any huge complaints. I think the recommended workaround (if you are the hardcore users that needs specific opcode sizes) is to use the keyword "strict" selectively.

ecm

Homepage E-mail

Düsseldorf, Germany,
03.05.2012, 02:37

@ Rugxulo
 

NASM 2.10 uses "-Ox" by default

> > Yes -O0 produces the same result :)
>
> I believe the rationale for this was that approx. 99% of people don't want
> "unoptimized" (bigger) code by default.

Basically, yeah. I think so, at least. Additionally, I think that -Ox requires more passes than, say, -O0 - so historically, the build process took less time. This is less relevant today, so the trade-off between optimising the build process and the actual run time performance has here been changed to prioritise the latter.

> Esp. if you compare FASM and YASM
> have already forced such size optimization for years without any huge
> complaints. I think the recommended workaround (if you are the hardcore
> users that needs specific opcode sizes) is to use the keyword "strict"
> selectively.

No, "strict" is for specific instructions only. Like in a specific loader where I have a header pointing to some words to make them patchable, I want those to actually be words. So in some cases it says simple:

mov cx, blahblah_size
..@patchblahblahsize: equ $-2


But in other cases (as I use the -Ox setting) it must effectively* say this:

add cx, strict word bloobloo_size
..@patchbloobloosize: equ $-2


(* I say "effectively" here because I have macros to abstract away this "strict word" keyword phrase specifically for some reason.)

This is because mov does not have an optimised sign-extending form which changes the immediate operand's opcode word into an opcode byte, while add does - and that optimised add form will be selected when possible by the optimising assembler unless I specify "strict word".

If, however, you want to have the not-optimising behaviour everywhere, you only have to select -O1 or -O0 (the last one again being digit zero). That should in general be limited to special usages though (like Rayer testing whether the output is byte-compatible here).

Do FASM and YASM have equivalents to -O0 and strict?

---
l

Rugxulo

Homepage

Usono,
03.05.2012, 08:18

@ ecm
 

NASM 2.10 uses "-Ox" by default

> I think that -Ox requires more passes than, say, -O0 - so
> historically, the build process took less time. This is less
> relevant today, so the trade-off between optimising the build
> process and the actual run time performance has here been
> changed to prioritise the latter.

Yeah, NASM -O0 was faster, more noticeable to me on my old P166 than newer stuff. However, I think YASM by default was always faster than NASM, and of course FASM blew them both out of the water.

> No, "strict" is for specific instructions only.

I don't know the details, just know that the very few who needed such things often seemed happy to use "strict".

> If, however, you want to have the not-optimising behaviour everywhere, you
> only have to select -O1 or -O0 (the last one again being digit zero).

Not as painful as it sounds (though it is a change from years past), esp. if you use Makefiles or set the NASMENV (or whatever) environment variable.

> That should in general be limited to special usages though (like Rayer testing
> whether the output is byte-compatible here).

Any kind of assembly code depending on specific opcodes or sizes is likely to bite you later and should (probably?) be avoided (or else hardcoded in "db 0x9, 0x10" directly). IMHO, YMMV. ;-)

> Do FASM and YASM have equivalents to -O0 and strict?

I'm fairly certain you can override sizes in the source, yes, but no, I don't think you can disable size optimizations at runtime at all (though perhaps limiting FASM passes would somewhat work). No reason to do so, honestly, though I may be short-sighted in believing that. (I hate such generalizations when people say, "Nobody needs xyz.")

ecm

Homepage E-mail

Düsseldorf, Germany,
03.05.2012, 23:00

@ Rugxulo
 

NASM 2.10 uses "-Ox" by default

> I don't know the details, just know that the very few who needed such
> things often seemed happy to use "strict".

I definitely belong to that group. Very good thing to have.

> Not as painful as it sounds (though it is a change from years past), esp.
> if you use Makefiles or set the NASMENV (or whatever) environment
> variable.

Command line options eventually become necessary, even without full-blown makefile-ish build environment. I found that ultimately, they recently again became (even more?) necessary to me because I collected several versions of a common macro file, committed all of them into their own repo in order, and then looked into how to replace the actual usages in the repos I gathered the files from. Ultimately, I went with a model where the macro file's repo (usually shared by multiple other repos) lives at the same directory level as the repos, with the NASM command line hence specifying an include path using the dotdot ".." specifier, ie to back up a directory level, to get into the sister directory where the macro file is located. This is necessary to conveniently allow rebuilding with the macro file elsewhere (just needs an additional include path on the NASM command line, no changes to source files) and so that the source files and the macro files referring to each other do not have to specify any pathes. That is, any given source or macro file will only use lines like:

        %include "xxxxxx.mac"

This does not include any path modifiers in the specified name. Finding the directories is managed entirely by the specified include pathes.

> Any kind of assembly code depending on specific opcodes or sizes is likely
> to bite you later and should (probably?) be avoided (or else hardcoded in
> "db 0x9, 0x10" directly). IMHO, YMMV. ;-)

Well, byte-comparison of output is a very specific one, but if you're referring to my example on patchable code nahhhhh my code is full of that =P

What I find especially important here is that the language itself, apart from (sometimes) possible optimisations which the assembler did not previously use, doesn't actually change any longer. I'm targeting 8086-, 186-, or 386-compatible Real 86 Mode. These instruction sets are fixed.

For regular usage in code, instruction encoding using DB gets impractical for anything longer than a single byte, which is why my code seldom if at all uses it, and even single-byte instruction encoding usually not with the raw number but via a macro named in an obvious way to simplify reading and writing the code.

> I'm fairly certain you can override sizes in the source, yes, but no, I
> don't think you can disable size optimizations at runtime at all (though
> perhaps limiting FASM passes would somewhat work). No reason to do so,
> honestly, though I may be short-sighted in believing that.

Easier to create (nearly) byte-compatible output for comparison with another (less/unoptimising) assembler's output, sometimes a viable tool to check that porting succeeded.

> (I hate such generalizations when people say, "Nobody needs xyz.")

Hmm, the point I see here is that the only resources it takes to add that feature is a few allowances in the design, as well as slightly larger on-disk executable size (of the assembler itself). Seeing as the latter is largely meaningless now (can't even fill 40 GiB with just the programming things that I work with/on myself, let alone 400 GiB!), it's essentially just the design trade-off to allow the other mode - which other than that will not hurt users that do not require it.

Sooooo~ basically, "Nobody needs xyz." can be more or less agreeable. It depends on the context a lot!

---
l

Rugxulo

Homepage

Usono,
16.06.2012, 00:24

@ ecm
 

NASM 2.10.01

BTW, not sure this is even worth mentioning, but NASM 2.10.01 is out. Not much changed, though (and perhaps only one added instruction that was missing, heh).

> http://www.nasm.us/xdoc/2.10.01/html/nasmdocc.html#section-C.1.1
>
> Add missing VPMOVMSKB instruction with reg32, ymmreg operands.

ecm

Homepage E-mail

Düsseldorf, Germany,
03.05.2012, 02:26

@ RayeR
 

NASM 2.10 - revised preprocessor

> Yes -O0 produces the same result :)

Cool =)

---
l

Back to index page
Thread view  Board view
22632 Postings in 2109 Threads, 402 registered users, 371 users online (0 registered, 371 guests)
DOS ain't dead | Admin contact
RSS Feed
powered by my little forum