flat assembler
Message board for the users of flat assembler.
Index
> Windows > moving x86 to 64 |
Author |
|
typedef 17 Feb 2014, 16:38
1. This already looks like 64 bit code.
2. ?? 3. A good Assembly* debugger is always OllyDbg (32 bit only, 64-bit is in development). There's Visual DuxDebugger (64 bit) but it's buggy as hell. The best free debugger for both 32 and 64 is WinDbg. If you want to invest there's IDAPro. |
|||
17 Feb 2014, 16:38 |
|
catafest 17 Feb 2014, 16:53
... maybe is something with addressing regs !?
maybe if I running under debugger will see where is the error . typedef wrote: 1. This already looks like 64 bit code. |
|||
17 Feb 2014, 16:53 |
|
typedef 17 Feb 2014, 17:52
Lol. Pass the parameters in this order on windows
rcx : 1st parameter rdx : 2nd parameter r8 : 3rd r9 : 4th Any more parameters are passed on stack. Also make note of the Red Zone http://msdn.microsoft.com/en-us/library/zthk2dkh.aspx |
|||
17 Feb 2014, 17:52 |
|
catafest 17 Feb 2014, 19:05
I don't understand not is apply the stack rules ?
first - in , first - out , where is the error ? also this mean: 64-bit code you must align the stack to 0 mod 16 !? typedef wrote: Lol. Pass the parameters in this order on windows |
|||
17 Feb 2014, 19:05 |
|
catafest 17 Feb 2014, 20:05
OK . I understend from where came the error .
See my source code ... I think is working well under 64 bit . If somebody has any idea then let me know Code: format PE64 GUI 5.0 entry start include 'win64a.inc' section '.text' code readable executable start: sub rsp,8 ; Make stack dqword aligned invoke GetModuleHandle,0 mov [wc.hInstance],rax invoke LoadIcon,0,IDI_APPLICATION mov [wc.hIcon],rax mov [wc.hIconSm],rax invoke LoadCursor,0,IDC_ARROW mov [wc.hCursor],rax invoke RegisterClassEx,wc test rax,rax jz error invoke CreateWindowEx,0,_class,_title,WS_VISIBLE+WS_DLGFRAME+WS_SYSMENU,128,128,256,192,NULL,NULL,[wc.hInstance],NULL test eax,eax jz error msg_loop: invoke GetMessage,msg,NULL,0,0 cmp rax,1 jb end_loop jne msg_loop invoke TranslateMessage,msg invoke DispatchMessage,msg jmp msg_loop error: invoke MessageBox,NULL,_error,NULL,MB_ICONERROR+MB_OK end_loop: invoke ExitProcess,[msg.wParam] proc WindowProc uses rbx rsi rdi, hwnd,wmsg,wparam,lparam mov [hwnd],rcx mov [wmsg],rdx mov [wparam],r8 mov [lparam],r9 mov rax,[wmsg] align 16 local ps:PAINTSTRUCT cmp rax ,WM_PAINT je .wmpaint cmp rax ,WM_DESTROY je .wmdestroy .defwndproc: invoke DefWindowProc,[hwnd],[wmsg],[wparam],[lparam] jmp .finish .wmpaint: lea rax ,[ps] invoke BeginPaint,[hwnd],rax invoke SetPixel,[ps.hdc],10,10,0x00000000 ; paint black pixel at [x,y] lea rax,[ps] invoke EndPaint,[hwnd],rax jmp .zfinish .wmdestroy: invoke PostQuitMessage,0 .zfinish: xor eax,eax .finish: ret endp section '.data' data readable writeable _title TCHAR 'Graphics 64',0 _class TCHAR 'FASMWIN64',0 _error TCHAR 'Startup failed.',0 wc WNDCLASSEX sizeof.WNDCLASSEX,0,WindowProc,0,0,NULL,NULL,NULL,COLOR_BTNFACE+1,NULL,_class,NULL msg MSG section '.idata' import data readable writeable library kernel32,'KERNEL32.DLL',\ user32,'USER32.DLL',\ gdi32,'GDI32.DLL' include 'API\KERNEL32.INC' include 'API\USER32.INC' include 'API\GDI32.INC' |
|||
17 Feb 2014, 20:05 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.