News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

problem with this code

Started by Rainstorm, October 28, 2006, 01:07:41 AM

Previous topic - Next topic

Rainstorm

hi,..
am just fiddling with the code I wrote to understand what's going on better..& the following code fails
for this line - mov edx, offset data - i get the error
error A2098: invalid operand for OFFSET
testrun PROTO :DWORD,:DWORD,:DWORD,:DWORD,:DWORD,:DWORD

      .data
      linne1 db 50

      .data?
        hInstance dd ?

      .code
; ---------------------------------------------------------------------
LibMain proc instance:DWORD,reason:DWORD,unused:DWORD

    .if reason == DLL_PROCESS_ATTACH
      push instance
      pop hInstance
      mov eax, TRUE

    .elseif reason == DLL_PROCESS_DETACH
    .elseif reason == DLL_THREAD_ATTACH
    .elseif reason == DLL_THREAD_DETACH

    .endif

    ret

LibMain endp

testrun proc mWnd:DWORD,aWnd:DWORD,data:DWORD,parms:DWORD,show:BOOL,nopause:BOOL

mov ecx, dword PTR linne1
mov edx, offset data
mov [edx], ecx
mov eax, 3

ret
testrun endp
end LibMain

EduardoS

You can't use OFFSET with local variables or parameters, use lea instead:

lea edx, data

Rainstorm

#2
thanks for the info!
it assembled right now :)

Rainstorm.