flat assembler
Message board for the users of flat assembler.

Index > Windows > [solved]MessageBox() making some troubles

Goto page Previous  1, 2
Author
Thread Post new topic Reply to topic
ProMiNick



Joined: 24 Mar 2012
Posts: 802
Location: Russian Federation, Sochi
ProMiNick 28 Aug 2020, 21:46
Good programming style when proggrammer itself passes parameters to rcx,rdx,r8,r9 (make movsx rcx,param, movzx rdx,param, mov r8b,param or whatever thou like) and after that makes call with rcx->rcx,rdx->rdx,r8->r8,r9->r9.
proc for 64 bit is already heaviest macro set in whole fasm history, futher increasing complexity of this macroset will move its usability to zero.

Code:
        invoke                  GetDlgItem,[hWnd],r14w    

as
Code:
        mov                     rcx,[hWnd]
        movzx                   rdx,r14w
        invoke                  GetDlgItem,rcx,rdx    

when thou assume something it is good to show it directly (but not hide in macros) - that will increase code readability gracefully.
Post 28 Aug 2020, 21:46
View user's profile Send private message Send e-mail Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4060
Location: vpcmpistri
bitRAKE 28 Aug 2020, 21:50
⇧ ⇧ ⇧ ⇧ ⇧

_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
Post 28 Aug 2020, 21:50
View user's profile Send private message Visit poster's website Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 669
Location: Ukraine
Overclick 28 Aug 2020, 22:55
ProMiNick wrote:
that will increase code readability gracefully.
That is good for "hello world", never for big projects. It's no secret winapi needs first four parameters in known registers. Nothing is wrong when you hide known functionality. That why people developed "macros" years ago. The rest is up to you, you can write in machine code to be sure that no mnemonics are lost from your attention )) As I actually did for Spectrum many years ago and that is not funny, that is pain I never want again.
Post 28 Aug 2020, 22:55
View user's profile Send private message Visit poster's website Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 669
Location: Ukraine
Overclick 28 Aug 2020, 23:04
movzx not good for AH,BH,CH,DH. Need to redesign again Shocked ))
Code:
...
if size@param  < 4
   if param eq ah |param eq bh |param eq ch |param eq dh
     mov cl,param
     movsx  rcx,cl
   else
     movsx  rcx,param
   end if
else if size@param = 4
   movsxd  rcx,param
else
   if ~param eq rcx
      mov   rcx,param  
   end if
end if
...       


Last edited by Overclick on 28 Aug 2020, 23:24; edited 1 time in total
Post 28 Aug 2020, 23:04
View user's profile Send private message Visit poster's website Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4060
Location: vpcmpistri
bitRAKE 28 Aug 2020, 23:10
...because 16 byte registers are not enough. Laughing

I had one algorithm that really benefited from byte registers:
https://github.com/bitRAKE/fasmg_playground/blob/master/win64/random/ca_prng.inc

_________________
¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup
Post 28 Aug 2020, 23:10
View user's profile Send private message Visit poster's website Reply with quote
Overclick



Joined: 11 Jul 2020
Posts: 669
Location: Ukraine
Overclick 28 Aug 2020, 23:36
Quote:

Tomasz wanted to leave something for others' to work on?

Yeah, especially "macro proc" ))

movsx solution will not working as param can be used with DWORD prefix etc.
I'm tired to add new exceptions, xor is easiest way...


Last edited by Overclick on 29 Aug 2020, 00:18; edited 1 time in total
Post 28 Aug 2020, 23:36
View user's profile Send private message Visit poster's website Reply with quote
ProMiNick



Joined: 24 Mar 2012
Posts: 802
Location: Russian Federation, Sochi
ProMiNick 29 Aug 2020, 00:09
Overclick, I advising not to increase complexity of proc 64.
It is bit unhoniest (I self adapt 32 proc to support esp frame, and reoffset all esp based stuff according to instructions that affect esp - but before that I learned how to do that manualy, so was no needance in macro adaptation; I extend struct macro set for top level unions & reserve structs, I never used top level unions, I never used rstructs, I extend structs such way that I could define 32bit & 64bit variant by same set of struct members and specific sizers but I split struct includes for bitnesses; I extend interface to support inheritance - I used it, but it is not problem to display all interface methods without showing from which interface it was inherited).

So, if something is applicable for thou. Go.
But readers of thour code will suffer if thou will go far from official stntax.

movzx(sx) - is undocumented behavior to cover it in proc.THAT IS NOT KNOWN FUNCTIONALITY!!!
Post 29 Aug 2020, 00:09
View user's profile Send private message Send e-mail Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page Previous  1, 2

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.