News:

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

How do you store an address in a register? [Solved]

Started by lonewolff, March 08, 2009, 01:47:25 AM

Previous topic - Next topic

lonewolff

Hi there,

I am wondering how I can load a register with a pointer to some text. I want to display certain text given certain conditions.
Here is what I have. I think I am close, but it wont compile.


.data
TextCondition1 db "Condition 1",0
MsgBoxCaption db "Information",0

.code
start:

mov [ebx],TextCondition1

invoke MessageBox,NULL,ebx,addr MsgBoxCaption,MB_ICONINFORMATION
invoke ExitProcess,NULL

end start


The problem is at the mov [ebx],TextCondition1 line.

Any guidance would be much appreciated.  :bg

sinsi

  mov ebx,OFFSET TextCondition1
Less common:
  lea ebx,[TextCondition1]
Light travels faster than sound, that's why some people seem bright until you hear them.

lonewolff

Excellent. That is exactly what I was after.  :8)

I'll have to look up my opcodes to see what LEA does.

Thanks for your help.