Hello guys, am an assembly rookie.

Wrote this code in notepad++
section .text
global_start ;must be declared for linker (ld)

_start: ;tells linker entry point
mov edx,len ;message length
mov ecx,msg ;message to write
mov ebx,1 ;file descriptor (stdout)
mov eax,4 ;system call number (sys_write)
int 0x80 ;call kernel

mov eax,1 ;system call number (sys_exit)
int 0x80 ;call kernel

section .data
msg db 'Hello, world!', 0xa ;our dear string
len equ $ - msg ;length of our dear string

After trying to assemble it with these commands:
nasm -f elf32 ass.asm
nasm -o ass ass.o

Throws an error:
ass.o.:1: error: label or instruction expected at start of line

How can I solve it please?
Am using NASM on a 32bit windows 7 machine.
Thanks.

Recommended Answers

All 2 Replies

Be a part of the DaniWeb community

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