The MASM Forum

General => The Workshop => Topic started by: felipe on January 14, 2019, 12:57:01 PM

Title: 64 bits window
Post by: felipe on January 14, 2019, 12:57:01 PM
Here it's my first window in windows 64 bits. nothing special i suppose, but can serve as a reference for anyone learning this (maybe). .exe and .asm in .zip file attached.  :icon14:
Title: Re: 64 bits window
Post by: hutch-- on January 14, 2019, 03:13:56 PM
Seems to work OK and it is done the right way. You could probably do it a lot easier but it works fine.
Title: Re: 64 bits window
Post by: jj2007 on January 14, 2019, 06:32:52 PM
Slick :t

But I wonder why M$ introduced structures in MASM some years ago ::)
.data?
wndclasex   dword   20 dup(?)
msg         dword   10 dup(?)


.code
start       proc

            sub     rsp,68h
           
            xor     rcx,rcx
            call    GetModuleHandle
           
            mov     r15,rax                                           ; hinstance.

            mov     dword ptr wndclasex[0],80
            mov     dword ptr wndclasex[4],CS_HREDRAW or CS_VREDRAW
...
            mov     rcx,qword ptr msg[20]                             ; wparam.
            call    ExitProcess
Title: Re: 64 bits window
Post by: Mikl__ on January 15, 2019, 12:39:02 AM
Hi, felipe!
http://masm32.com/board/index.php?topic=4190.msg44523#msg44523 (https://wasm.in/styles/smiles_s/good3.gif)
Title: Re: 64 bits window
Post by: TimoVJL on January 15, 2019, 01:49:17 AM
If you xor one register and use it instead of zero or NULL you save some bytes.

Also think of this C code: WNDCLASSEX wcx;
wcx.cbSize = sizeof(WNDCLASSEX);
GetClassInfoEx(hInstance, MAKEINTRESOURCE(32769), &wcx);
wcx.lpfnWndProc = (WNDPROC)WndProc;
wcx.hbrBackground = (HBRUSH)COLOR_3DSHADOW;
wcx.lpszClassName = szFrameClass;
if (!RegisterClassEx(&wcx))
return 0;
EDIT: wndclasex was global, so it is initially zeroed, so don't have to zero those fields.
Title: Re: 64 bits window
Post by: felipe on January 15, 2019, 02:56:51 AM
mikl__ you have great stuff there i will continuing learning from there. I found especially good there what is related to the win api. Good material to learning about that. :icon14:

Structures are useful no doubt. Especially the ones defined in the masm sdk.  :bgrin:

timovjl i like xoring. as regard with the global structure i prefer to initialize all the structure members. but this is useful knowledge, specially if you want to save a few bytes here and there or (maybe) a few cycles.  :icon14:
Title: Re: 64 bits window
Post by: zedd151 on January 15, 2019, 03:59:44 AM
Hi felipe, looks ok.


heres my first 64 bit conversions...

http://masm32.com/board/index.php?topic=7450.msg81456#msg81456