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

Are you sure your example is for Windows? https://www.google.com/search?q=int+0x80+%3Bcall+kernel&ie=utf-8&oe=utf-8#q=int+0x80+%3Bcall+kernel+hello+world seems to tell me you are using Linux examples.

Jump to Post

All 2 Replies

Be a part of the DaniWeb community

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