flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
Tomasz Grysztar 19 Sep 2003, 10:58
What do you mean by "custom pattern"?
There's a small example of displaying bitmap from resource in the attachment.
|
|||||||||||
![]() |
|
80286 05 May 2015, 13:59
Tomasz Grysztar wrote: There's a small example of displaying bitmap from resource in the attachment. Should this example work with actual FASM 1.71.39 ? I get errors and can't yet solve them by myself. edit: Same error in another older script ( http://board.flatassembler.net/topic.php?t=180 ) Error says: missing end directive and points to proc32.inc Line 53 Last edited by 80286 on 05 May 2015, 14:12; edited 1 time in total |
|||
![]() |
|
revolution 05 May 2015, 14:09
Here is a modified version for the current macro set.
Code: ; template for program using standard Win32 headers format PE GUI 4.0 entry start include 'win32a.inc' section '.data' data readable writeable _title db 'BitBlt demonstation',0 _class db 'FASMWIN32',0 mainhwnd dd ? hinstance dd ? hbitmap dd ? msg MSG wc WNDCLASS section '.code' code readable executable start: invoke GetModuleHandle,0 mov [hinstance],eax invoke LoadIcon,0,IDI_APPLICATION mov [wc.hIcon],eax invoke LoadCursor,0,IDC_ARROW mov [wc.hCursor],eax mov [wc.style],0 mov [wc.lpfnWndProc],WindowProc mov [wc.cbClsExtra],0 mov [wc.cbWndExtra],0 mov eax,[hinstance] mov [wc.hInstance],eax mov [wc.hbrBackground],COLOR_BTNFACE+1 mov [wc.lpszMenuName],0 mov [wc.lpszClassName],_class invoke RegisterClass,wc invoke CreateWindowEx,0,_class,_title,WS_VISIBLE+WS_DLGFRAME+WS_SYSMENU,128,128,192,192,NULL,NULL,[hinstance],NULL mov [mainhwnd],eax invoke LoadBitmap,[hinstance],IDR_LOGO mov [hbitmap],eax msg_loop: invoke GetMessage,msg,NULL,0,0 or eax,eax jz end_loop invoke TranslateMessage,msg invoke DispatchMessage,msg jmp msg_loop end_loop: invoke ExitProcess,[msg.wParam] proc WindowProc, hwnd,wmsg,wparam,lparam locals paintstruct PAINTSTRUCT endl push ebx esi edi cmp [wmsg],WM_DESTROY je wmdestroy cmp [wmsg],WM_PAINT je wmpaint defwndproc: invoke DefWindowProc,[hwnd],[wmsg],[wparam],[lparam] jmp finish wmpaint: lea ebx,[paintstruct] invoke BeginPaint,[hwnd],ebx mov edi,eax invoke CreateCompatibleDC,edi mov esi,eax invoke SelectObject,esi,[hbitmap] invoke BitBlt,edi,0,0,150,150,\ esi,0,0,SRCCOPY invoke DeleteDC,esi invoke EndPaint,[hwnd],ebx jmp finish wmdestroy: invoke PostQuitMessage,0 xor eax,eax finish: pop edi esi ebx ret endp section '.idata' import data readable writeable library kernel,'KERNEL32.DLL',\ user,'USER32.DLL',\ gdi,'GDI32.DLL' import kernel,\ GetModuleHandle,'GetModuleHandleA',\ ExitProcess,'ExitProcess' import user,\ RegisterClass,'RegisterClassA',\ CreateWindowEx,'CreateWindowExA',\ DefWindowProc,'DefWindowProcA',\ GetMessage,'GetMessageA',\ TranslateMessage,'TranslateMessage',\ DispatchMessage,'DispatchMessageA',\ LoadCursor,'LoadCursorA',\ LoadIcon,'LoadIconA',\ LoadBitmap,'LoadBitmapA',\ BeginPaint,'BeginPaint',\ EndPaint,'EndPaint',\ PostQuitMessage,'PostQuitMessage' import gdi,\ CreateCompatibleDC,'CreateCompatibleDC',\ SelectObject,'SelectObject',\ BitBlt,'BitBlt',\ DeleteDC,'DeleteDC' section '.rsrc' resource data readable IDR_LOGO = 1 directory RT_BITMAP,bitmaps resource bitmaps,\ IDR_LOGO,LANG_ENGLISH+SUBLANG_DEFAULT,logo bitmap logo,'logo.bmp' |
|||
![]() |
|
80286 05 May 2015, 14:14
Thanks, revolution, your source works fine
![]() |
|||
![]() |
|
revolution 05 May 2015, 14:23
The main differences are that "enter" is eliminated, "return" is replaced by "ret", proc needs a closing "endp", and local variables are wrapped in "locals" and "endl".
|
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.