Download Article
Download Article
Learning assembly language can be difficult, but it might also be a requirement for certain curricula. To start learning, you can use CodeBlocks, a free C compiler, paired with nasm (netwide assembler).
Steps
-
Advertisement
-
Install the codeblocks by running the setup. exe file you downloaded.
-
Extract and install nasm into the codeblocks folder, e.g. , C:\Program Files\CodeBlocks\MinGW\bin.
-
Check whether the installation is working or not by the source code below for a test run. This is a Win32 console program that writes "Hello, World" on one line and; then exits. It needs to be linked with a C library.
-
Save the source code above as helloworld. asm in the location: C:\Program Files\CodeBlocks\MinGW\bin.
-
Run nasmpath. bat. Enter this command: nasm -f win32 helloworld.asm. It should produce a helloworld.obj file in the same directory.
-
Execute the object file by typing: gcc helloworld.obj. It should build a file named a.exe.
-
9Type a.exe to run the test program and get your result. The words "Hello, World" should display on the screen.
Advertisement
global
_main
extern
_printf
section
.text
_main:
push
message
call
_printf
add
esp
,
4
ret
message:
db
'
Hello
,
World
'
,
10
,
0
Expert Q&A
Ask a Question
200 characters left
Include your email address to get a message when this question is answered.
Submit
Advertisement
Tips
- Check nasm developer site for documentation.Thanks
Submit a Tip
All tip submissions are carefully reviewed before being published
Name
Please provide your name and last initial
Thanks for submitting a tip for review!
Advertisement
About This Article
Thanks to all authors for creating a page that has been read 69,617 times.
Advertisement