Recent

Author Topic: Passing QWord in 32-bit program  (Read 415 times)

LemonParty

  • Full Member
  • ***
  • Posts: 142
Passing QWord in 32-bit program
« on: February 18, 2025, 12:49:51 pm »
Let's say I have a function:
Code: Pascal  [Select][+][-]
  1. function F1(A, B: Integer; C: QWord): Integer
  2. begin
  3.  
  4. end;
  5.  
In what registers passing C in 32-bit mode?

Thaddy

  • Hero Member
  • *****
  • Posts: 16653
  • Kallstadt seems a good place to evict Trump to.
Re: Passing QWord in 32-bit program
« Reply #1 on: February 18, 2025, 03:38:49 pm »
A EAX
B EDX
C ECX
This is explicitly 32 bit Intel only and only for what you describe.

If you did not know that, you should not use it! You will crash your computer.
Usually the compiler is better.
But feel free to wander into the useless world of assembler "optimizations" which was only relevant 25 years ago. ::) :o ;D Great fun and guaranteed to crash....
Unless highly specialized work is required, stay away from assembler on modern compilers. It is fun but very seldomly faster..
(marcov has some cases where it is faster)

If you did not know the first, you are likely to write slower code when attempting to use assembler.
That is not what you want, is it?
« Last Edit: February 18, 2025, 03:53:55 pm by Thaddy »
But I am sure they don't want the Trumps back...

Nimbus

  • New Member
  • *
  • Posts: 20
Re: Passing QWord in 32-bit program
« Reply #2 on: February 18, 2025, 04:40:59 pm »
Obviously a 64-bit QWord won't fit in a 32-bit register. It will be put on stack instead.

LemonParty

  • Full Member
  • ***
  • Posts: 142
Re: Passing QWord in 32-bit program
« Reply #3 on: February 18, 2025, 06:06:45 pm »
Yes. C is passing over stack and located at [ebp+8].

d2010

  • Full Member
  • ***
  • Posts: 122
Re: Passing QWord in 32-bit program
« Reply #4 on: February 20, 2025, 04:41:28 pm »
Code: [Select]
Type myQ32word=array[0..16] of integer;end;
Type myQ16word=array[0..32] of word;end;

inside BPW.exe you define function F1(A, B: Integer; C: Q16Word): Integer
inside Lazarus32x  function F1(A, B: Integer; C: Q32Word): Integer
The range 0..16 is corecty? or 16-is too big?
 ::)
Let's say I have a function:
Code: Pascal  [Select][+][-]
  1. function F1(A, B: Integer; C: QWord): Integer
  2. begin
  3.  
  4. end;
  5.  
In what registers passing C in 32-bit mode?

Inside 

 

TinyPortal © 2005-2018