Nasm compiling binary

Thread Starter

Samantha Groves

Joined Nov 25, 2023
161
Hello!I am trying to complile a .asm file to a .o file(binary)

I have downloaded nasm:

I open the NASM shell:

Code:
...\AppData\Local\bin\NASM>nasm -f elf32 kernel.asm -o kasm.o
kernel.asm:5: error: parser: instruction expected

...\AppData\Local\bin\NASM>nasm -f elf32 kernel.asm
kernel.asm:5: error: parser: instruction expected

...\AppData\Local\bin\NASM>nasm kernel.asm
kernel.asm:5: error: parser: instruction expected
I have copied out my file into the bin directory.

But it prints out the above message.I typed in "help" to see the available instructions and nasm isnt anywhere to be found.
 

Ya’akov

Joined Jan 27, 2019
10,235
Hello!I am trying to complile a .asm file to a .o file(binary)

I have downloaded nasm:

I open the NASM shell:

Code:
...\AppData\Local\bin\NASM>nasm -f elf32 kernel.asm -o kasm.o
kernel.asm:5: error: parser: instruction expected

...\AppData\Local\bin\NASM>nasm -f elf32 kernel.asm
kernel.asm:5: error: parser: instruction expected

...\AppData\Local\bin\NASM>nasm kernel.asm
kernel.asm:5: error: parser: instruction expected
I have copied out my file into the bin directory.

But it prints out the above message.I typed in "help" to see the available instructions and nasm isnt anywhere to be found.
Welcome to AAC.

The error message is telling you that at line 5 of your file (kernel.asm) nasm’s parser encountered an error: instruction expected.

The first step to troubleshoot is to open kernel.asm in your editor, turn on line numbers if not already the case, and look at line 5. What is it? Why doesn’t it conform to nasm’s expectations?

If your code is written for MASM, it will not work directly, you will need to modify it. This might help.

If you are using Code segment word public 'CODE' in your source, you are writing for masm and nasm will not happily digest that code. You will need to change the structure to make it work.
 
Top