User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Assembly section within the Software Development category of DaniWeb, a massive community of 375,273 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,194 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Assembly advertiser:
Apr 26th, 2006
Views: 3,603
Some languages are hard to get started in. FASM appears to be one of these languages because the documentation is not detailed enough for a beginner. That's a shame because FASM is (in my opinion) one of the better assemblers. The following snippet is a simple Hello, world! program which FASM will directly output an executable on Windows.

The C run-time library is used by accessing the msvcrt DLL, so a linker isn't necessary.
fasm Syntax
  1. format PE console
  2. entry start
  3.  
  4. include 'C:\fasm\include\win32a.inc'
  5.  
  6. ;======================================
  7. section '.data' data readable writeable
  8. ;======================================
  9.  
  10. hello_msg db 'Hello, world!',0
  11.  
  12. ;=======================================
  13. section '.code' code readable executable
  14. ;=======================================
  15.  
  16. start:
  17. ccall [printf],hello_msg
  18. ccall [getchar]
  19. stdcall [ExitProcess],0
  20.  
  21. ;====================================
  22. section '.idata' import data readable
  23. ;====================================
  24.  
  25. library kernel,'kernel32.dll',\
  26. msvcrt,'msvcrt.dll'
  27.  
  28. import kernel,\
  29. ExitProcess,'ExitProcess'
  30.  
  31. import msvcrt,\
  32. printf,'printf',\
  33. getchar,'_fgetchar'
Post Comment

Only community members can submit or comment on code snippets. You must register or log in to contribute.

DaniWeb Marketplace (Sponsored Links)
All times are GMT -4. The time now is 6:03 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC