News:

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

Main Menu

MASM64 problem with if macro

Started by C3, October 22, 2022, 07:37:37 AM

Previous topic - Next topic

hutch--

There is yet another advantage in 64 bit architecture, with so many registers, the only time you need LOCAL values is if a function needs to have a memory address to put data into on its return. You save on the stack overhead by working directly with registers.

From long ago when I still wrote MS-DOS code, I could generally get faster algorithms than 16 bit Windows but you still had the same limitations in DOS, small memory, less instructions and the limitations of memory models.

jj2007

Quote from: hutch-- on October 24, 2022, 08:31:06 AMI could generally get faster algorithms than 16 bit Windows but you still had the same limitations in DOS, small memory, less instructions and the limitations of memory models.

That's true: 32-bit code is about a factor 5-10 faster than 16-bit code; and it can address over 3,000 times more memory than 16-bit with its 640k limitation. Going from 16- to 32-bit code was really a good idea :thumbsup:

NoCforMe

Quote from: HSE on October 24, 2022, 07:56:27 AM
:biggrin: Perhaps Wow64 optimize your 32 bit code!

I know you were somewhat joking, but let me be serious just for a few seconds here:  What 64-bit parts of the OS (functions) would it be beneficial for a 32-bit program to call? that would actually make a difference in execution speed? (I assume that's the only possible benefit here, not smaller code size or reduced complexity).
Assembly language programming should be fun. That's why I do it.

jj2007

Quote from: NoCforMe on October 24, 2022, 10:51:19 AMWhat 64-bit parts of the OS (functions) would it be beneficial for a 32-bit program to call? that would actually make a difference in execution speed?

That's actually a good question. Theory says that Wow64 takes your 32-bit file handle, sign-extends it to a 64-bit handle and then asks The Real 64-bit ThingTM to do the WriteFile for you, in 64-bit land.

In practice, I see that rarely happen in my debugger, and that is strange. But I know it does happen, because occasionally I've seen it.

Speed is not the reason (64-bit code is roughly as fast as 32-bit code. But it makes sense that Windows keeps running only one 64-bit kernel, instead of having two parallel systems.

Any gurus around who can explain that better than me?

HSE

Quote from: NoCforMe on October 24, 2022, 10:51:19 AM
I know you were somewhat joking,

Not exactly, but I don't remember article author.

Any code non optimal can be optimized. It's bitness independent. But Wow64 must modify your 32 bits
code, and nothing it's going to modify your 64 bit code.
Equations in Assembly: SmplMath

jj2007


HSE

Yes, that it's the explanation for users.
Equations in Assembly: SmplMath

NoCforMe

Quote from: jj2007 on October 24, 2022, 11:14:52 AM
On the x64 processor, x86 instructions are executed natively by the processor.

Yes, which is why I'm completely comfortable writing "only" 32-bit code, no matter how old-school or out-of-date it may seem to others. I really don't feel like I'm missing anything because of this.
Assembly language programming should be fun. That's why I do it.

jj2007

Quote from: HSE on October 24, 2022, 11:52:59 AM
Yes, that it's the explanation for users.

So you mean I am too dumb to understand it? Please, my guru, explain to a mere mortal how exactly Wow64 does "modify your code". I will make a huge effort to understand it.

HSE

Quote from: jj2007 on October 24, 2022, 08:13:35 PM
So you mean I am too dumb to understand it?

:biggrin: I think the better definition is that"WoW64 is partially documented".

Details are complex, boring, and probably against forum rules
  :thumbsup:
Equations in Assembly: SmplMath

jj2007

Come on, don't be shy: we are all waiting for your expertise, Hector :thumbsup:

I am also sure that Hutch wants to know how Wow64 modifies his Masm32 SDK code. This is fascinating, Hector, but we are too dumb to understand it. Pleaaaaaaaaze explain it to us :thup: :thup: :thup:

HSE

 :biggrin: You are the "search" expert. I'm pretty sure sure you will find the way.

And you can learn more about HyperVisors, and explain a little. (Because look like a waste of time).
Equations in Assembly: SmplMath

jj2007

Quote from: HSE on October 24, 2022, 11:12:15 AMWow64 must modify your 32 bits code

What a pity, Hector, that you don't want to share your wisdom with us. I have always been fascinated by self-modifying code (it's so much fun to watch in the debugger), but now there is Wow64 that does the modification for you. Absolutely Wow :thumbsup:

HSE

 :biggrin:  :biggrin: :biggrin: No self modification. Debugger is useless. Just search and read.   :thumbsup:
Equations in Assembly: SmplMath

jj2007