Start New Discussion within our Software Development Community

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.

format PE console
entry start

include 'C:\fasm\include\win32a.inc'

;======================================
section '.data' data readable writeable
;======================================

hello_msg db 'Hello, world!',0

;=======================================
section '.code' code readable executable
;=======================================

start:
	ccall	[printf],hello_msg
	ccall	[getchar]
	stdcall	[ExitProcess],0

;====================================
section '.idata' import data readable
;====================================

library kernel,'kernel32.dll',\
        msvcrt,'msvcrt.dll'

import kernel,\
       ExitProcess,'ExitProcess'

import msvcrt,\
       printf,'printf',\
       getchar,'_fgetchar'
The article starter has earned a lot of community kudos, and such articles offer a bounty for quality replies.