News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

64-bit Assemblers

Started by shankle, July 31, 2012, 02:03:09 AM

Previous topic - Next topic

japheth

QuoteThat automatically generated variable is just a bonus to the flexible constant system fasm offer. There is no rule that says you should use % primarily.  ;)

Nou schitt.

QuoteConstants in fasm offer unlimited flexibility...

This is a marketing speech bubble. FASM has deserved better.  :icon13:

QuoteWhat do you think ...?

Well, you asked so don't complain!  :P : You've gathered a good deal of half-knowledge about FASM already. Continue with your efforts and eventually you' ll be able to code a working program in that language! And then, try again to  teach FASM here! Currently you can't play this role persuasively.
 

CodeDog

#31
Well, you used the word "superior", it was not a light word to use considering that you were absolutely wrong. It is like a guy with a russian lada claiming to be able to drive faster than a ferrari enzo. You have to admit that it was my right to make the obvious, OBVIOUS. Whatever reason you chose to believe that % was the main and only thing you could use remains to be known.  ;)

the i variable in your for loop is just like my x,y variables. Perhaps you need to reconsider your own perception of reality  :lol: why do you want to compare a fish with a bicycle. % is in this case a bicycle (just a tool) and the fact that % is constant is not a weakness, it makes your code strong and reliable because you have a source of input that stays constant which can't be changed by accident and in addition you have constants that you CAN change. I would say that is flexibility combined with safety. Oh now I sound like marketing man again, it is not on purpose honestly.  :bgrin:

And "superior" do sound a little bit more like marketing skills than "flexible" does  :redface:

japheth

Quote from: sinsi on September 14, 2012, 06:15:35 PM
Not sure. Does masm or the linker associate a .rsrc section with the resource entry in the PE header?

I tried. Masm has no problems, but the MS linker crashes as soon as it finds a .rsrc section in the COFF object module.

Vortex

Quote from: japheth on September 22, 2012, 07:02:21 PM
Quote from: sinsi on September 14, 2012, 06:15:35 PM
Not sure. Does masm or the linker associate a .rsrc section with the resource entry in the PE header?

I tried. Masm has no problems, but the MS linker crashes as soon as it finds a .rsrc section in the COFF object module.

Hi japheth,

What's the result with Polink?

japheth

Quote from: Vortex on September 22, 2012, 07:06:45 PM
What's the result with Polink?

Hi Vortex,

polink works pretty good - but it's no cigar. The link step finishes without error, and polink did even set the resource directory values in the PE header automatically. However, it has problems with section-relative fixups ( created by Masm operator SECTIONREL ) if there's an addend. Here's an excerpt:


;--- root level: enum the resource types
      IMAGE_RESOURCE_DIRECTORY <0,0,0,0,0,2>
      IMAGE_RESOURCE_DIRECTORY_ENTRY < RT_BITMAP, SECTIONREL bms   + 80000000h >
      IMAGE_RESOURCE_DIRECTORY_ENTRY < RT_MENU,   SECTIONREL menus + 80000000h >

;--- second level: enum the IDs of resource type X
bms   IMAGE_RESOURCE_DIRECTORY <0,0,0,0,0,1>
      IMAGE_RESOURCE_DIRECTORY_ENTRY < IDR_BITMAP1, SECTIONREL bm1   + 80000000h >
menus IMAGE_RESOURCE_DIRECTORY <0,0,0,0,0,1>
      IMAGE_RESOURCE_DIRECTORY_ENTRY < IDR_MENU1,   SECTIONREL menu1 + 80000000h >


polink ignores the "+ 80000000h" addend and hence bit 31 isn't set in the field. However, if I set the bit manually with a hex editor after polink is done, the binary works just as expected.

Now, as far as the sample is concerned, one can probably make it work without using SECTIONREL at all, but as soon as more than one object module with a .rsrc section is involved, you'll get into problems.

I attached source and binary of my test case.

Vortex

Hi japheth,

Thanks for the info and example. I was able to build the project with JWasm and Polink.

japheth

Quote from: Vortex on September 23, 2012, 04:35:31 AM
Thanks for the info and example. I was able to build the project with JWasm and Polink.

Yes it works with the current polink version 7. In my attempts yesterday I used an outdated version of this tool.

CodeDog

This is not exclusive to fasm but its useful

.label:
    irps reg, eax ecx ebx esi edi
    { xor reg,reg }

BYTECOUNT = $-.label

IF BYTECOUNT<128
  DISPLAY 'More unrolling needed...',13,10
ELSE
  DISPLAY 'No more unrolling needed',13,10
END IF




You could also extend it to show only when DEBUG is defined, like this:

.label:
    irps reg, eax ecx ebx esi edi
    { xor reg,reg }

IF DEFINED DEBUG
  BYTECOUNT = $-.label

  IF BYTECOUNT<128
    DISPLAY 'More unrolling needed...',13,10
  ELSE
    DISPLAY 'No more unrolling needed',13,10
  END IF
END IF


:P