Hello,
I have the following problem:
I want to split the address of any function in the upper two bytes and the lower two bytes, while creating a structure in sourcecode:
struc Structure
Structure.FunctionAddressLow: resw 1
Structure.AnyValue: resd 1
Structure.FunctionAddressHigh: resw 1
endstruc
StructureImage:
istruc Structure
at Structure.FunctionAddressLow, dw (function & 0xffff)
at Structure.AnyValue, dd 'axyz' ;doesnt matter
at Structure.FunctionAddressHigh, dw ((function >> 16) & 0xffff)
iend
function:
;do something
ret
After assembling it:
"nasm -f bin -o example.bin example.asm",
NASM complains:
"& operator may only be applied for scalar values"
and
">> operator may only be applied for scalar value"
=>So my question is how to solve this problem without using code like this
mov eax, function
mov ebx, StructureImage
mov [ebx + Structure.FunctionAddressLow], ax
shr eax, 16
mov [ebx + Structure.FunctionAddressHigh], ax
But initialize the structure correct
Thanks in advance