From owner-freebsd-questions Wed Dec 1 9:45: 6 1999 Delivered-To: freebsd-questions@freebsd.org Received: from mail.bezeqint.net (mail-a.bezeqint.net [192.115.106.23]) by hub.freebsd.org (Postfix) with ESMTP id C82F615214 for ; Wed, 1 Dec 1999 09:45:04 -0800 (PST) (envelope-from sarig@bezeqint.net) Received: from asmodean (pri-pt-8051.isdn.net.il) by mail.bezeqint.net (Sun Internet Mail Server sims.3.5.1999.07.30.00.05.p8) with SMTP id <0FM200DBWPAW6C@mail.bezeqint.net> for freebsd-questions@freebsd.org; Wed, 1 Dec 1999 19:44:57 +0200 (IST) Date: Wed, 01 Dec 1999 19:44:09 +0200 From: Oren Sarig Subject: Re: Hello World in Assembler To: Carlos Antonio Ruggiero , freebsd-questions@freebsd.org Message-id: <00d501bf3c23$ac7601c0$335719d4@asmodean> MIME-version: 1.0 X-Mailer: Microsoft Outlook Express 5.00.2314.1300 Content-type: text/plain; charset="windows-1255" Content-transfer-encoding: 7bit X-MSMail-Priority: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 References: <199911301416.MAA21566@ultra3000.if.sc.usp.br> X-Priority: 3 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > 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