Author Topic: 64-bit Assemblers  (Read 24825 times)

japheth

  • Guest
Re: 64-bit Assemblers
« Reply #30 on: September 20, 2012, 05:33:47 AM »
Quote
That 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.

Quote
Constants in fasm offer unlimited flexibility...

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

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

  • Guest
Re: 64-bit Assemblers
« Reply #31 on: September 20, 2012, 05:40:24 AM »
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:
« Last Edit: September 20, 2012, 07:01:03 AM by CodeDog »

japheth

  • Guest
Re: 64-bit Assemblers
« Reply #32 on: September 22, 2012, 07:02:21 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

  • Member
  • *****
  • Posts: 2271
Re: 64-bit Assemblers
« Reply #33 on: September 22, 2012, 07:06:45 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

  • Guest
Re: 64-bit Assemblers
« Reply #34 on: September 22, 2012, 08:19:54 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:

Code: [Select]
;--- 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

  • Member
  • *****
  • Posts: 2271
Re: 64-bit Assemblers
« Reply #35 on: September 23, 2012, 04:35:31 AM »
Hi japheth,

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

japheth

  • Guest
Re: 64-bit Assemblers
« Reply #36 on: September 23, 2012, 07:00:50 PM »
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

  • Guest
Re: 64-bit Assemblers
« Reply #37 on: September 25, 2012, 07:59:06 AM »
This is not exclusive to fasm but its useful

Code: [Select]
.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:

Code: [Select]
.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