Hello, world! in FASM UserPageVisits:708 active 80 80 DaniWeb 561 60 2006-04-27T06:54:49+00:00 https://www.daniweb.com/programming/software-development/code/216722/hello-world-in-fasm

Hello, world! in FASM

Narue

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.

708 Views
About the Author
code snippet
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'
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.