Hi all!
Translating from 32 bits to 64 bits a big problem is that ecx and/or edx can be arguments in other order than x64 ABI allow. And that complicate everything.
Fortunatelly this little macro remove all the problem:@reg32_64 macro reg_32, reg_64
if @WordSize eq 4
@CatStr(<_>,®_32) textequ <reg_32>
@CatStr(<__>,®_32) textequ <reg_32>
else
@CatStr(<_>,®_32) textequ <reg_64>
@CatStr(<__>,®_32) textequ <@CatStr(®_64,<d>)>
endif
endm
And in your code:@reg32_64 ecx, r10
@reg32_64 edx, r11
This generate wildcard registers _ecx and _edx that became DWORD ecx and edx in 32 bits, and QWORD r10 an r11 in 64 bits.
Because some x64 graphical API still requiere DWORD, also are generated wildcard registers __ecx and __edx that always became DWORD, ecx and edx in 32 bits, and r10d an r11d in 64 bits.
Then you don't need to create solutions for dual code:Method ComboBox.Init, uses xbx xsi, pOwner:POINTER, hParent:HWND, pDefStruc:PDEF_COMBOBOX
SetObject xsi
mov xbx, pDefStruc
assume xbx:PDEF_COMBOBOX
mov eax, [xbx].dStyle
or eax, WS_CHILD or WS_VISIBLE
invoke CreateWindowEx, [xbx].dExStyle, $OfsCStr("ComboBox"), [xbx].pTitle, eax, \
[xbx].sdPosX, [xbx].sdPosY, [xbx].dWidth, [xbx].dHeight, \
hParent, [xbx].xCtlID, hInstance, 0
assume xbx:NOTHING
ACall xsi.Init, pOwner, xax
Subclass ComboBox ;Uses xsi
MethodEnd
Instead you just use almost the pure 32 bits code:Method ComboBox.Init, uses xsi, pOwner:POINTER, hParent:HWND, pDefStruc:PDEF_COMBOBOX
SetObject xsi
mov _ecx, pDefStruc
assume _ecx:PDEF_COMBOBOX
mov eax, [_ecx].dStyle
or eax, WS_CHILD or WS_VISIBLE
invoke CreateWindowEx, [_ecx].dExStyle, $OfsCStr("ComboBox"), [_ecx].pTitle, eax, \
[_ecx].sdPosX, [_ecx].sdPosY, [_ecx].dWidth, [_ecx].dHeight, \
hParent, [_ecx].xCtlID, hInstance, 0
assume _ecx:NOTHING
ACall xsi.Init, pOwner, xax
Subclass ComboBox ;Uses xsi
MethodEnd
Indeed, in 32 bits, is exactly the original code.
Naturally this is not limited to OOP, this work in plain assembly.
Regards, HSE