flat assembler
Message board for the users of flat assembler.
Index
> Windows > Surely this should compile? (Solved!) |
Author |
|
vbVeryBeginner 16 Jan 2006, 03:23
hi bodger,
maybe you need to set up fasm dev environment first before proceeding to start coding :p 1. download fasm zipped file from flatassembler.net 2. extract the file into a directory, (eg. c:\fasm) 3. right click my computer > properties > advance [tab] > environment variable. 4. click new button under "system variables" and type variable name = "fasminc", variable value = "c:\fasm\include" then OK 5. double click path and add ";c:\fasm" (";" is separator) 6. now. click start > run and type cmd 7. type "fasm" and enter you would see something like below Code: flat assembler version 1.65.8 usage: fasm source [output] 8. if you need to include eg. include "win32ax.inc", change it to Code:
include "%fasminc%\win32ax.inc"
9. cmd to the directory where your file located. 10. fasm yourfile.asm and you would have your "yourfile.exe" assembled (assume u r doing win32 app). if you want more easy, set the fasminc variable and use the fasmw editor. |
|||
16 Jan 2006, 03:23 |
|
Bodger 16 Jan 2006, 04:41
Hi vbVeryBeginner, and thank you for your reply.
I have set up fasm already, and am using the fasminc environmental variable. Fasm is definately finding the includes, as I tried to put in a 'display' command into the macro and it didn't like it. I originally had a more complex program that was doing a lot more, but it wouldn't assemble. I created this super-short one to test the win32ax.inc. So Fasm is now reporting an error in the win32ax.inc with the import macro; specifically the line: { common macro import_#lib \{ import lib,functions \} } (which I don't understand what it does). This error is in turn derrived from import32.inc in it's import macro. Here are the first lines of this macro: macro import name,[label,string] { common name#.lookup: forward if used label The line in bold is generating the error. So I'm guessing that it's been called with garbage from the win32ax.inc? Thanks again, I hope you can help me out. _________________ -- quidquid latine dictum sit altum viditur -- |
|||
16 Jan 2006, 04:41 |
|
vbVeryBeginner 16 Jan 2006, 06:14
hi bodger,
i use the latest fasm and assembly the following without any problem? ?? how bout you try re-download the fasm and see if you could assemble your code Code: ;------------------------ format PE GUI 4.0 include "%fasminc%\win32ax.inc" .code start: invoke ExitProcess,0 .end start ;------------------------ |
|||
16 Jan 2006, 06:14 |
|
FrozenKnight 16 Jan 2006, 09:08
i think he just needs to set the include path.
|
|||
16 Jan 2006, 09:08 |
|
Bodger 16 Jan 2006, 22:54
Hi again,
I downloaded the latest fasm (1.65., mine was 1.65.7. And the code does indeed assemble now. The includes were being included as fasm was reporting errors *in* them, but other than that I haven't got a clue why it wasn't working. Still on-topic I think; I've noticed that GetDeviceCaps in gdi32 is unrecognized at assemble time, other function from gdi32 seem to work fine. Also RegisterClassEx in user32. Now, I've checked the includes and the deffinitions are there along with others that do assemble. Any Ideas? _________________ -- quidquid latine dictum sit altum viditur -- |
|||
16 Jan 2006, 22:54 |
|
Tomasz Grysztar 16 Jan 2006, 23:00
They are recognized when I try them. Can you post the source that doesn't work?
|
|||
16 Jan 2006, 23:00 |
|
Bodger 16 Jan 2006, 23:45
As advised, here is some code that I can't assemble. Several api functions (in bold) appear not to be recognized. Interestingly these differ from my other, larger, project. Strangely GetDeviceCaps works in this code...
---------------------------------- format PE GUI 4.0 include "win32ax.inc" start: invoke GetModuleHandle, NULL mov [hInstance],eax stdcall WinMain, [hInstance],NULL,NULL, SW_SHOWDEFAULT invoke ExitProcess, eax proc WinMain hInst,hPrevInst,CmdLine,CmdShow local wc:WNDCLASSEX local msg:MSG invoke GetDC,0 mov [DeskDC],eax push eax invoke GetDeviceCaps,eax,HORZSIZE mov [ScreenW],eax invoke GetDeviceCaps,[DeskDC],VERTSIZE mov [ScreenH],eax pop eax invoke ReleaseDC,0,eax mov [wc.cbSize],sizeof.WNDCLASSEX mov [wc.style], CS_HREDRAW or CS_VREDRAW mov [wc.lpfnWndProc], WndProc mov [wc.cbClsExtra],NULL mov [wc.cbWndExtra],NULL push [hInstance] pop [wc.hInstance] mov [wc.hbrBackground],COLOR_BTNFACE+1 mov [wc.lpszMenuName],NULL mov [wc.lpszClassName],ClassName invoke [b]LoadIcon[\b], [hInst],IDR_ICON ;not working mov [hIcon],eax mov [wc.hIcon],eax mov [wc.hIconSm],eax invoke LoadCursor,NULL,IDC_ARROW mov [wc.hCursor],eax invoke [b]RegisterClassEx[\b], addr.wc ;not working mov ecx,[ScreenW] mov edx,[ScreenH] sub ecx,265 sub edx,203 shr ecx,1 shr edx,1 ;not working invoke [b]CreateWindowEx[\b],WS_EX_TOPMOST,\ ClassName,\ magCaption,\ WS_OVERLAPPEDWINDOW,\ ecx,edx,265,203,\ NULL,\ eax,\ [hInst],\ NULL mov [hMain],eax invoke ShowWindow, eax,[CmdShow] invoke UpdateWindow, [hMain] wmMessageLoop: invoke [b]GetMessage[\b], addr.msg,NULL,0,0 ;not working or eax,eax jz wmDone invoke [b]TranslateMessage[\b], addr.msg ;not working invoke [b]DispatchMessage[\b], addr.msg ;not working jmp wmMessageLoop wmDone: mov eax,[msg.wParam] ret endp proc WndProc hWnd, uMsg, wParam, lParam mov eax,[uMsg] cmp eax,WM_DESTROY jne wpDefault invoke PostQuitMessage,NULL jmp wpDone wpDefault: invoke DefWindowProc,[hWnd],[uMsg],[wParam],[lParam] ret wpDone: xor eax,eax ret endp .data ClassName db 'MyClassName',0 section '.bss' readable writeable hInstance dd ? hIcon dd ? ScreenW dd ? ScreenH dd ? hMain dd ? .end start ------------------------------------ EDIT: Well they were supposed to be in bold I've added comments instead. _________________ -- quidquid latine dictum sit altum viditur -- |
|||
16 Jan 2006, 23:45 |
|
Tomasz Grysztar 17 Jan 2006, 00:08
LoadIcon is not working because IDR_ICON is not defined (fasmw shows you that the error is on "push IDR_ICON" instruction.
RegisterClassEx has the "addr.wc" as argument - it should be "addr wc" to work correctly, as "addr.wc" is just treated as a one long name, and again it's undefined symbol. The next ones for the similar reasons. |
|||
17 Jan 2006, 00:08 |
|
Bodger 17 Jan 2006, 00:31
DOH!
I thought I'd read that addr.var somewhere in the fasm docs, but now I'm not so sure (maybe my mind is going). Thanks a lot Tomasz. I've now tracked down all my bads in my first propper fasm project. I was really fighting to get fasm to work, I was hoping it was something I was doing wrong. Generally I don't give software much of a chance, but this seemed worth it. Thanks again, Bodger. _________________ -- quidquid latine dictum sit altum viditur -- |
|||
17 Jan 2006, 00:31 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.