flat assembler
Message board for the users of flat assembler.
![]() Goto page Previous 1, 2, 3 Next |
Author |
|
keenin 08 Sep 2003, 20:48
Hi,
Daemon, you forgot to add 'code' in that section, didn't you? Presently I optimized my code not to use large op codes and large memory addresses (data and calls : ) and I saved a lot of bytes. The main problem is the Windows programming itself: To initialize the window and OpenGL many data has to be moved and many procedures have to be called (sort of calling overhead). I got the initialization to 2k including some features like configuration data, which is ok. But I am really glad of Privalov, because he really helped. |
|||
![]() |
|
boysoledad 14 Sep 2003, 07:58
i see in assembler files
format PE GUI 4.0 DLL I can complier assembler files to Obj files or Lib files none? Please help me... When use invoke GetModuleHandle,0 |
|||
![]() |
|
boysoledad 05 Oct 2003, 07:54
hey do you know about XBM format in assembler .......?
|
||||||||||
![]() |
|
scientica 05 Oct 2003, 09:56
XBM in asm? Something like this?
(compile with the line below to produce the xbm file) fasm x.asm x.xbm
_________________ ... a professor saying: "use this proprietary software to learn computer science" is the same as English professor handing you a copy of Shakespeare and saying: "use this book to learn Shakespeare without opening the book itself. - Bradley Kuhn |
||||||||||||||||||||
![]() |
|
boysoledad 06 Oct 2003, 04:00
If i want add color in it then how do i do?
|
||||||||||
![]() |
|
scientica 06 Oct 2003, 04:25
xbm (x bitmap) is black and white (correction, monocrome, you can use any two colors if you write your own reader).
I'd try xpm (x pixmap) for colors, don't remember how to hand code them (they have the same C/C++ format as xbm just iwht some more info), try google for xpm. _________________ ... a professor saying: "use this proprietary software to learn computer science" is the same as English professor handing you a copy of Shakespeare and saying: "use this book to learn Shakespeare without opening the book itself. - Bradley Kuhn |
|||
![]() |
|
hamoz 13 Feb 2007, 22:39
Hello ,
How to handle the xbm file after compiling with fasm thanks a lot newbie |
|||
![]() |
|
hamoz 18 Feb 2007, 01:43
hello,
why does the compiler give an error at that line ( proc WindowProc, hwnd,wmsg,wparam,lparam ) Code: format PE GUI 4.0 entry start include '%include%\win32a.inc' start: mov esi,user mov edi,wc macro invoke proc,[arg] {common invoke esi+proc-user,arg} virtual at edi ediwc WNDCLASS end virtual invoke GetModuleHandle,ebx mov [ediwc.hInstance],eax invoke LoadIcon,0,IDI_EXCLAMATION mov [ediwc.hIcon],eax invoke LoadCursor,0,IDC_ARROW mov [ediwc.hCursor],eax xor eax,eax mov [ediwc.style],eax mov [ediwc.lpfnWndProc],WindowProc mov [ediwc.cbClsExtra],eax mov [ediwc.cbWndExtra],eax mov [ediwc.lpszMenuName],eax mov [ediwc.hbrBackground],COLOR_BTNFACE+1 mov ebx,_title mov [ediwc.lpszClassName],ebx invoke RegisterClass,edi invoke CreateWindowEx,0,ebx,ebx,WS_VISIBLE+WS_DLGFRAME+WS_SYSMENU,64,64,127,127,NULL,NULL,[ediwc.hInstance],NULL mov ebx,msg msg_loop: invoke GetMessage,ebx,NULL,0,0 or eax,eax jz end_loop invoke TranslateMessage,ebx invoke DispatchMessage,ebx jmp msg_loop end_loop: invoke ExitProcess,0 proc WindowProc, hwnd,wmsg,wparam,lparam enter push esi mov esi,user cmp [wmsg],WM_DESTROY je wmdestroy invoke DefWindowProc,[hwnd],[wmsg],[wparam],[lparam] jmp finish wmdestroy: invoke PostQuitMessage,0 xor eax,eax finish: pop esi return data import library kernel,'KERNEL32.DLL',\ user,'USER32.DLL' import kernel,\ GetModuleHandle,'GetModuleHandleA',\ ExitProcess,'ExitProcess' import user,\ RegisterClass,'RegisterClassA',\ LoadIcon,'LoadIconA',\ LoadCursor,'LoadCursorA',\ CreateWindowEx,'CreateWindowExA',\ DefWindowProc,'DefWindowProcA',\ GetMessage,'GetMessageA',\ TranslateMessage,'TranslateMessage',\ DispatchMessage,'DispatchMessageA',\ PostQuitMessage,'PostQuitMessage' end data _title db '1024',0 msg MSG wc WNDCLASS |
|||
![]() |
|
LocoDelAssembly 18 Feb 2007, 02:13
because you forgot to put "endp" below return.
BTW, if you are not using a really old fasm release then replace "return" with "ret" and remove "enter" otherwise you will get error for those too. |
|||
![]() |
|
hamoz 18 Feb 2007, 03:06
locodelassembly , I have tried it with different possibilities but I still get error
please help me ![]() |
|||
![]() |
|
LocoDelAssembly 18 Feb 2007, 03:51
Code: format PE GUI 4.0 entry start include '%include%\win32a.inc' start: user equ DefWindowProc ; Since the imports related macros doesn't define such label I randomly pick a function of USER32.DLL instead ; Note that choosing the function that produces proc-user = -128..127 most of the time is preferable since it produces shorter encodings mov esi,user mov edi,wc macro invoke proc,[arg] {common invoke esi+proc-user,arg} virtual at edi ediwc WNDCLASS end virtual invoke GetModuleHandle,ebx mov [ediwc.hInstance],eax invoke LoadIcon,0,IDI_EXCLAMATION mov [ediwc.hIcon],eax invoke LoadCursor,0,IDC_ARROW mov [ediwc.hCursor],eax xor eax,eax mov [ediwc.style],eax mov [ediwc.lpfnWndProc],WindowProc mov [ediwc.cbClsExtra],eax mov [ediwc.cbWndExtra],eax mov [ediwc.lpszMenuName],eax mov [ediwc.hbrBackground],COLOR_BTNFACE+1 mov ebx,_title mov [ediwc.lpszClassName],ebx invoke RegisterClass,edi invoke CreateWindowEx,0,ebx,ebx,WS_VISIBLE+WS_DLGFRAME+WS_SYSMENU,64,64,127,127,NULL,NULL,[ediwc.hInstance],NULL mov ebx,msg msg_loop: invoke GetMessage,ebx,NULL,0,0 or eax,eax jz end_loop invoke TranslateMessage,ebx invoke DispatchMessage,ebx jmp msg_loop end_loop: invoke ExitProcess,0 proc WindowProc, hwnd,wmsg,wparam,lparam push esi mov esi,user cmp [wmsg],WM_DESTROY je wmdestroy invoke DefWindowProc,[hwnd],[wmsg],[wparam],[lparam] jmp finish wmdestroy: invoke PostQuitMessage,0 xor eax,eax finish: pop esi ret endp data import library kernel,'KERNEL32.DLL',\ user,'USER32.DLL' import kernel,\ GetModuleHandle,'GetModuleHandleA',\ ExitProcess,'ExitProcess' import user,\ RegisterClass,'RegisterClassA',\ LoadIcon,'LoadIconA',\ LoadCursor,'LoadCursorA',\ CreateWindowEx,'CreateWindowExA',\ DefWindowProc,'DefWindowProcA',\ GetMessage,'GetMessageA',\ TranslateMessage,'TranslateMessage',\ DispatchMessage,'DispatchMessageA',\ PostQuitMessage,'PostQuitMessage' end data _title db '1024',0 msg MSG wc WNDCLASS That works with FASM 1.67.20 |
|||
![]() |
|
hamoz 18 Feb 2007, 14:25
LocoDelAssembly, thanks alot alot
![]() newbie |
|||
![]() |
|
ACP 18 Feb 2007, 22:49
keenin wrote: Yeah, I already did everything into one section. You can use the header to store data. Process Image starts with MZ header in memory - use OllyDBG for inspection - however keep in mind that overwriting header in memory or supplying it with wrong data can break something. Fortunately Windows process loader is quite flexible and does not care about most of settings. You can even have parts of PE/COFF header invalid and process will be loaded anyway. |
|||
![]() |
|
yumka 19 Feb 2007, 17:45
But 1024 is really 1,536 bytes, that is 50% bigger!
"Fixed" with FSG to 1005 bytes ![]() |
|||
![]() |
|
yumka 19 Feb 2007, 19:33
Also i have seen that Pelles Linker is able to reduce de size of the executable by making some optimisations at linking.
If your demo is size critical, try that option, and compare the size of both files. |
|||
![]() |
|
Reverend 19 Feb 2007, 21:30
1) Be aware of the fact that FSG puts some code in the header. It is a neat solution, but recent processors have DEP (Data Execution Protection or sth similar) that won't run FSG-packed files.
2) Pelles Linker just merges sections, which in fasm is a trivial task, so Pelles won't help much here ![]() |
|||
![]() |
|
pierre 20 Feb 2007, 13:06
You should try this : http://crinkler.net/
|
|||
![]() |
|
yumka 20 Feb 2007, 21:06
|
|||
![]() |
|
f0dder 21 Feb 2007, 11:30
Crinkler is a pretty interesting piece of code, by some pretty interesting people. You should look at some of the loonies productions - iirc Aske (Blueberry) made a VM for one of the amiga intros to get it small enough.
|
|||
![]() |
|
Goto page Previous 1, 2, 3 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.