The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: ragdog on September 12, 2009, 10:20:49 PM

Title: Problems with a dword ptr
Post by: ragdog on September 12, 2009, 10:20:49 PM
Hi

I have a problem with store a 3 signs to a dword pointer and gives this to a subroutine



AddItem PROTO :DWORD,:DWORD,:DWORD

             .if eax==0
                     mov DWORD PTR [eax],    "(-;"
                     push eax
              .else
                   push offset hBuffer

             .endif
   
                  push offset hName2
          push offset hName1
          call AddItem


Thanks for your help
Title: Re: Problems with a dword ptr
Post by: qWord on September 12, 2009, 10:30:53 PM
you are accessing an invalid address:

.if eax==0
mov DWORD PTR [eax],"(-;" ; DWORD located at 0 ???
...


regards, qWord
Title: Re: Problems with a dword ptr
Post by: ragdog on September 12, 2009, 10:37:04 PM
Thanks

Must i set a buffer variable in the data section

can i this not make with register?
Title: Re: Problems with a dword ptr
Post by: qWord on September 12, 2009, 10:44:24 PM
not sure what you want to make, but what is about using an local string buffer:


xyz proc .....
LOCAL szBuffer[4]:BYTE

mov DWORD ptr szBuffer,";-("
...
.if eax == 0
lea eax,szBuffer
push eax
...

xyz endp
Title: Re: Problems with a dword ptr
Post by: ragdog on September 12, 2009, 10:49:16 PM
Ok

Yes this works



My Question is can i make this without use a szString in the data section or buffer variable in the data? section  ????

Title: Re: Problems with a dword ptr
Post by: qWord on September 12, 2009, 10:57:07 PM
if you want to pass a string pointer, you have to use an buffer containing your string.
Title: Re: Problems with a dword ptr
Post by: ragdog on September 12, 2009, 11:04:42 PM
Ahh ok thanks

this was my question

greets,
ragdog