Hello guys,
I am a complete newbie who is trying to learn assembly. I am using
NASM and working on Linux.
I have written a (very) simple program that calculates ah+al.
Here it is the code:
-----------------------------------------------
; this file is called ass.s
segment .data
number1 db 5
number2 db 7
segment .text
global prog
prog:
push ebp
mov ebp,esp
xor eax,eax
mov al,[number1]
mov ah,[number2]
add al,ah
xor ah,ah
pop ebp
ret
-------------------------------------------------
So I type in the terminal: nasm -f elf ass.s -o ass.o
and then I type: gcc ass.o -o assexe
An error message appears:
/usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../lib/crt1.o: In function
`_start':
(.text+0x18): undefined reference to `main'
collect2: ld returned 1 exit status
If the label (in the program) is called main (and not prog), there's
no error message.
If the label is called start, the error message appears again.
My question is: can I choose whatever label names in my program,
without having all these error messages? Or am I forced to always
insert a label called "main" in my code?
Thank you and sorry for my english!


|