I'm making a DLL for Windows, how do I make the proc return 48, 64, and 128 bit numbers like dq's, dp's, df's, and dt's ? What would be the default return register for these (like how eax is for 32-bit numbers and strings)
Posted on 2003-02-02 11:33:31 by CyberGuy
let eax contain the header of the result, not the result itself
Posted on 2003-02-02 12:55:23 by longer
Longer is right (though I assume he means pointer to data, not header). However there are some special cases for different calling conventions.

In c call for example you return all floats in st0. And I think 64bit are returned in edx:eax.
Posted on 2003-02-02 13:24:01 by Eóin
yes, E?in, I meant pointer
Posted on 2003-02-02 13:53:10 by longer
Ok, thanks but I'm having problems setting the arguments as 64-bit (dq's)
Posted on 2003-02-02 18:54:05 by CyberGuy
what kind of problems?
to my mind you can push the high dword first, and then the low one.
or you can push only pointers to 64-bit arguments.
Posted on 2003-02-03 02:02:18 by longer
When I say that the argument is a DQ, then the exported function isn't recongnized. Does anyone have example code for adding 2 64-bit numbers in a proc?
Posted on 2003-02-03 13:58:21 by CyberGuy
do not say that your argument is dq: split it into 2 dwords
Posted on 2003-02-04 00:22:07 by longer

Filetime is a 64 bit number represented as a structure of 2 32-bit numbers

dwLowDateTime DWORD ?
dwHighDateTime DWORD ?

alarm_time FILETIME <> ;used to keep next alarm time
time_now FILETIME <> ;used to gather current time
tseconds FILETIME <> ;used to store seconds left till alarm

;Subtract Time_Now from Alarm_time to calculate the number of seconds to time
mov eax, alarm_time.dwLowDateTime
sub eax, time_now.dwLowDateTime
mov tseconds.dwLowDateTime, eax
mov eax, alarm_time.dwHighDateTime
sbb eax, time_now.dwHighDateTime
jb @f
mov tseconds.dwHighDateTime, eax ;tseconds now contains # of 100 nanoseconds remaining

;Add multiplication result in EDX:EAX to 64 bit number
mov ebx, time_now.dwLowDateTime
add ebx, eax ;add time_now low WORD to timer low WORD
mov alarm_time.dwLowDateTime, ebx ;save in alarm time
mov ebx, time_now.dwHighDateTime
adc ebx, edx ;add with carry, time now high WORD to timer high WORD
mov alarm_time.dwHighDateTime, ebx ;save in alarm time


Posted on 2003-02-04 01:15:40 by farrier
You do not understand, say someone uses VB to call the DLL, and puts double for the arguments, how do I make both arguments doubles (dqs) without having them supply 4 32-bit integers? That's what I'm struggling to find out...
Posted on 2003-02-07 06:55:03 by CyberGuy
I partially figured it out, look at this code

proc addasm, arg1,arg2
fld qword
fadd qword
fadd qword

This works but it only adds arg1, ans is already declared. Why does it only add arg1 and not arg2?
Posted on 2003-02-07 10:45:42 by CyberGuy
Does anyone know why fadd doesn't work for the second argument?
Posted on 2003-02-11 14:19:54 by CyberGuy