flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
catafest 01 Mar 2015, 08:29
According with this http://left404.com/2011/01/04/moving-x86-assembly-to-64-bit-x86-64/ I try to fix my source code.
My application try to create one interface for imput data. Also, can you come with explication details? This is the source code , can you tell me where I make mistakes? Thank you very much . Regards. Code: format PE64 GUI 5.0 entry start include 'WIN64A.inc' section '.code' code readable executable WinMain: invoke GetModuleHandle,NULL mov [wndclass.hInstance],rax invoke LoadIcon,0,IDI_APPLICATION mov [wndclass.hIcon],rax invoke LoadCursor,NULL,IDC_ARROW mov [wndclass.hCursor],rax invoke RegisterClassEx,wndclass invoke CreateWindowEx,WS_EX_OVERLAPPEDWINDOW,szAppName,szAppName,\ WS_OVERLAPPEDWINDOW+WS_VISIBLE,CW_USEDEFAULT,CW_USEDEFAULT,\ CW_USEDEFAULT,CW_USEDEFAULT,NULL,NULL,[wndclass.hInstance],NULL .mainloop: ;mainloop function invoke GetMessage,msg,NULL,0,0 cmp eax,0 jle .finished invoke TranslateMessage,msg invoke DispatchMessage,msg jmp .mainloop .finished: ;exit function invoke ExitProcess,[msg.wParam] ;draw graphic proc DrawPixelArray hdc ;pushad ;preserve all general purpose registers mov ebx,0 ;index base into each array mov ecx,4 ; number of elements in each array .RepeatMe: ;push ecx ;windows ABI trashes ECX so we must preserve it push cdq invoke SetPixel,[hdc],[xarray+ebx],[yarray+ebx],0x00000000 ; paint black pixel at [x,y] pop ecx ; now we restore it.. add ebx,4 ;next index is 4 bytes into the array loop .RepeatMe popad ;restore all general purpose registers ret ;return to caller (proc macro cleans up params for us) endp ;WindowProc function proc WindowProc hwnd,umsg,wparam,lparam local ps:PAINTSTRUCT mov rax,[umsg] cmp eax,WM_PAINT je .wmpaint cmp eax,WM_DESTROY je .wmdestroy .defwndproc: invoke DefWindowProc,[hwnd],[umsg],[wparam],[lparam] jmp .finish .wmpaint: lea eax,[ps] invoke BeginPaint,[hwnd],eax ;invoke SetPixel,[ps.hdc],10,10,0x00000000 ; paint black pixel at [x,y] stdcall DrawPixelArray,[ps.hdc] lea eax,[ps] invoke EndPaint,[hwnd],eax jmp .zfinish .wmdestroy: invoke PostQuitMessage,0 .zfinish: xor eax,eax .finish: ret endp section '.data' data readable writeable szAppName db 'Graphic input data from device',0 wndclass WNDCLASSEX sizeof.WNDCLASSEX,CS_OWNDC,WindowProc,\ 0,0,NULL,NULL,NULL,(COLOR_WINDOW+1),NULL,szAppName,NULL msg MSG section '.data' data readable writeable xarray dd 0,1,2,3 ;x coordinates for 4 pixels yarray dd 0,1,2,3 ;y coordinates for 4 pixels section '.idata' import data readable library kernel32,'KERNEL32.DLL',\ user32,'USER32.DLL',\ gdi32,'GDI32.DLL' include 'API\KERNEL32.INC' include 'API\USER32.INC' include 'API\GDI32.INC' |
|||
![]() |
|
catafest 01 Mar 2015, 09:22
revolution wrote: With 64-bit fastcall procedure entry you have to be aware of RCX, RDX, R8 and R9 upon procedure entry. You have to either spill them to the stack or use them directly. this can be one good issue , indeed! Some infos or example about how to do that . ... can you help me ? |
|||
![]() |
|
typedef 01 Mar 2015, 12:49
I know this isn't the right time, but I have to do this:
https://msdn.microsoft.com/en-us/library/7kcdt6fy.aspx?f=255&MSPPError=-2147217396 |
|||
![]() |
|
revolution 01 Mar 2015, 13:34
catafest wrote: Some infos or example about how to do that . http://board.flatassembler.net/topic.php?p=169261#169261 |
|||
![]() |
|
catafest 01 Mar 2015, 15:00
Thank you for help.
I will read all. Also If somebody want make better this project , just send me a mail. This project I make will follow : - create a gui for data; - connect with usb to read data , data files, audio input or streams of data; - parse data with specific functions; The idea is to improuve day by day with users issue. I know is many software and API to do this , but most of all need to learn something new. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.