flat assembler
Message board for the users of flat assembler.
Index
> Windows > GetVersion-Could be shorter? |
Author |
|
HarryTuttle 11 Feb 2005, 10:58
of course in byte size shorter:
Code: include '%fasminc%/win32ax.inc' ; Get the system version .code start: invoke GetVersion and eax,0ffffh push eax and eax,0ff00h shr eax,8 mov ebx,eax pop eax and eax,00ffh mov ecx,eax pop ebp mov ebp,esp sub esp,20 mov esi,esp cinvoke wsprintf,esi,"System version: %d.%d",ecx,ebx invoke MessageBox,0,esi,"info",0 mov esp,ebp pop ebp xor eax,eax ret .end start _________________ Microsoft: brings power of yesterday to computers of today. |
|||
11 Feb 2005, 10:58 |
|
decard 11 Feb 2005, 12:20
why do you have to complicate the code so much?
Code: include '%fasminc%/win32ax.inc' ; Get the system version .data wersja dd ? bufor rb 20 .code start: invoke GetVersion mov ecx,eax and ecx,0xff shr eax,8 and eax,0xff cinvoke wsprintf,bufor,"System version: %d.%d",ecx,eax invoke MessageBox,0,bufor,"info",0 xor eax,eax ret .end start works well too |
|||
11 Feb 2005, 12:20 |
|
HarryTuttle 11 Feb 2005, 13:23
yeah! always could be better!
Code: include '%fasminc%/win32ax.inc' ; Get the system version .data napis: db "system version:" wersja dd ? .code start: invoke GetVersion add eax,3030h mov word [wersja],ax invoke MessageBox,0,napis,0,0 xor eax,eax ret .end start and how to add the dot between digits? may be MMX or another staff (I do not know) will helps? _________________ Microsoft: brings power of yesterday to computers of today. |
|||
11 Feb 2005, 13:23 |
|
Tomasz Grysztar 11 Feb 2005, 13:41
Why not:
Code: include '%fasminc%/win32ax.inc' ; Get the system version .data napis: db "system version: " mj db ?,'.' mn db ?,0 .code start: invoke GetVersion add eax,3030h mov [mj],al mov [mn],ah invoke MessageBox,0,napis,0,0 xor eax,eax ret .end start |
|||
11 Feb 2005, 13:41 |
|
HarryTuttle 11 Feb 2005, 14:06
that's it! THX!
_________________ Microsoft: brings power of yesterday to computers of today. |
|||
11 Feb 2005, 14:06 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.