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)
let eax contain the header of the result, not the result itself
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.
In c call for example you return all floats in st0. And I think 64bit are returned in edx:eax.
yes, E?in, I meant pointer
Ok, thanks but I'm having problems setting the arguments as 64-bit (dq's)
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.
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.
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?
do not say that your argument is dq: split it into 2 dwords
CyberGuy,
Filetime is a 64 bit number represented as a structure of 2 32-bit numbers
FILETIME STRUCT
dwLowDateTime DWORD ?
dwHighDateTime DWORD ?
FILETIME ENDS
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
HTH,
farrier
Filetime is a 64 bit number represented as a structure of 2 32-bit numbers
FILETIME STRUCT
dwLowDateTime DWORD ?
dwHighDateTime DWORD ?
FILETIME ENDS
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
HTH,
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...
I partially figured it out, look at this code
proc addasm, arg1,arg2
enter
fld qword
fadd qword
fadd qword
return
This works but it only adds arg1, ans is already declared. Why does it only add arg1 and not arg2?
proc addasm, arg1,arg2
enter
fld qword
fadd qword
fadd qword
return
This works but it only adds arg1, ans is already declared. Why does it only add arg1 and not arg2?
Does anyone know why fadd doesn't work for the second argument?