GuidePedia

0

How to Run Nasm on Windows: 10 Steps



I know learning assembly language is hard to learn. But it may be a requirement you need to fulfill. This is an easy beginning and you can get the parts for free. Requirement:1 codeblocks - it's a free C compiler. 2: nasm - the netwide assembler.



Steps


1. Download codeblocks from Code::Blocks Downloads.

2. Download nasm from netwide assembler.

3. install the codeblocks by running the setup.exe file you downloaded.

4. Extract / install nasm into the codeblocks folder, as in: C:\Program Files\CodeBlocks\MinGW\bin

5. Check whether the installation is working or not by the source code below for a test run.



helloworld.asm
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.
----------------------------------------------------------------------------
global _main extern _printf

section .text _main: push message call _printf add esp, 4 ret message: db 'Hello, World', 10, 0


1. Save the source code above as helloworld.asm in the location: C:\Program Files\CodeBlocks\MinGW\bin

2. Run nasmpath.bat. Enter this command: nasm -f win32 helloworld.asm. It should produce a helloworld.obj file in the same directory.

3. Execute the object file by typing: gcc helloworld.obj. It should build a file named a.exe.

4. Type a.exe to run the test program and get your result, the words "Hello, World" on the screen.



Tips



Post a Comment Blogger

 
Top