Date: Wed, 01 Dec 1999 19:44:09 +0200 From: Oren Sarig <sarig@bezeqint.net> To: Carlos Antonio Ruggiero <toto@if.sc.usp.br>, freebsd-questions@freebsd.org Subject: Re: Hello World in Assembler Message-ID: <00d501bf3c23$ac7601c0$335719d4@asmodean> References: <199911301416.MAA21566@ultra3000.if.sc.usp.br>
next in thread | previous in thread | raw e-mail | index | archive | help
> I am trying to write a "hello world" program in assembler, but can't get > it right. The code is (based on The Assembly HOW-TO) > > section .data > > msg db "Hello World!" > len equ $ - msg > > section .text > > global _start > > _start: > > mov eax,4 > mov ebx,1 > mov ecx,msg > mov edx,len > int 0x80 > > mov eax,1 > xor ebx,ebx > int 0x80 Ahem, wouldn't this be simpler? section .data msg db "Hello, World!" section .text global _start _start: push word msg call printf and build with: nasm -f elf -o hello.o hello.asm ld -lc -o hello hello.o (I didn't try this, but I think it should work) -- Oren Sarig sarig@bezeqint.net To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?00d501bf3c23$ac7601c0$335719d4>