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

  1. 1
    Download codeblocks from Code Blocks Downloads.
  2. 2
    Download nasm from netwide assembler.
    Advertisement
  3. 3
    Install the codeblocks by running the setup.exe file you downloaded.
  4. 4
    Extract and install nasm into the codeblocks folder, e.g., C:\Program Files\CodeBlocks\MinGW\bin.
  5. 5
    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.
  6. 6
    Save the source code above as helloworld.asm in the location: C:\Program Files\CodeBlocks\MinGW\bin.
  7. 7
    Run nasmpath.bat. Enter this command: nasm -f win32 helloworld.asm. It should produce a helloworld.obj file in the same directory.
  8. 8
    Execute the object file by typing: gcc helloworld.obj. It should build a file named a.exe.
  9. 9
    Type a.exe to run the test program and get your result. The words "Hello, World" should display on the screen.
  10. Advertisement
Method 1
Method 1 of 1:

Code

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

About This Article

wikiHow is a “wiki,” similar to Wikipedia, which means that many of our articles are co-written by multiple authors. To create this article, 16 people, some anonymous, worked to edit and improve it over time. This article has been viewed 58,138 times.
How helpful is this?
Co-authors: 16
Updated: November 3, 2020
Views: 58,138
Categories: Programming
Advertisement