flat assembler
Message board for the users of flat assembler.
Index
> Windows > locals |
Author |
|
revolution 19 Feb 2012, 20:33
The problem is you are trying to make the assembler do this:
Code: mov [ebp+offset1],ebp+offset2 Code: windowClass WNDCLASSEX sizeof.WNDCLASSEX, 0, DummyWindowProc, 0, 0, 0, 0, 0, 0, 0, 'OPENGL64DUMMY', 0 |
|||
19 Feb 2012, 20:33 |
|
SFeLi 19 Feb 2012, 21:39
shadowomf wrote: windowClassName TCHAR 'OPENGL64DUMMY', 0 Do you really need this? Maybe: Code: proc foo ; Note that all local labels start with a dot. locals .pt POINT .buffer rb 32 endl .get: stdcall [GetCursorPos], addr .pt ccall [wsprintf], addr .buffer, .fmt, [.pt.x], [.pt.y] .show: stdcall [MessageBox], 0, addr .buffer, .title, MB_ICONINFORMATION .exit: ret .fmt db 'Cursor at %u:%u',0 .title db 'CursorPos',0 endp ; This way you can "keep things seperated" without initializing locals with the bunch of MOVs. Last edited by SFeLi on 19 Feb 2012, 21:52; edited 2 times in total |
|||
19 Feb 2012, 21:39 |
|
revolution 19 Feb 2012, 21:49
SFeLi wrote: every name/label in foo should start with a dot. |
|||
19 Feb 2012, 21:49 |
|
SFeLi 19 Feb 2012, 21:55
revolution, thank you for the correction. I don't use proc macros, but several years ago I had some problems with locals and I just remembered to use the dot for everything
|
|||
19 Feb 2012, 21:55 |
|
shadowomf 19 Feb 2012, 22:52
Thank you for your fast reply.
Quote:
Maybe I'm a bit slow but why doesn't the following work? (I also tried it without brackets.) Code: mov rax, [windowClassName] mov [windowClass.lpszClassName], rax Quote:
Sadly this doesn't work. Quote: Do you really need this? Maybe: Even thouggh it looks a bit strange, it does work, thank you. Using the TCHAR thingy results in an error, but "du" doesn't, is there anything that TCHAR does that "du" doesn't? Thanks. -Christoph |
|||
19 Feb 2012, 22:52 |
|
yoshimitsu 20 Feb 2012, 00:44
windowClassName is a byte array, means with your code you get 8 bytes out of it which would be 'OPENGL64' and move it into windowClass.lpszClassName which should actually contain an address of string.
To be more precise, windowClassName is a symbolic equation for ebp+8, so it's not an actual address and therefore to calculate its real address you have to use lea: Code: lea rax,[windowClassName] ;it gets substituted for lea rax,[ebp+xx] mov [windowClass.lpszClassName],rax PS: brackets are always needed when accessing memory. |
|||
20 Feb 2012, 00:44 |
|
shadowomf 20 Feb 2012, 10:12
Now I think I've got it.
Thank you all. |
|||
20 Feb 2012, 10:12 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.