From owner-freebsd-hackers@FreeBSD.ORG Wed Sep 28 22:13:12 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 03B7C106564A for ; Wed, 28 Sep 2011 22:13:12 +0000 (UTC) (envelope-from misconfiguration@gmail.com) Received: from mail-ww0-f50.google.com (mail-ww0-f50.google.com [74.125.82.50]) by mx1.freebsd.org (Postfix) with ESMTP id 8E0288FC12 for ; Wed, 28 Sep 2011 22:13:11 +0000 (UTC) Received: by wwe3 with SMTP id 3so82674wwe.31 for ; Wed, 28 Sep 2011 15:13:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=l4rr587CtoJLyzPi7cwFaRJuDt/gVqZrLrfyBdZFWYg=; b=D/AUE01opWZoH9Oamin3O1xRFnsREPgNk64zWac63XEp+CCh2s3EYY8zVsy4V38Ihv OkOnERSIya0hghxUxJSVpc0FQhSiRUMDZe8gefljyhdG2U11V/U4+vef47Xr3eynX/Hm WbSJVPo1MzO6OW+LN+4o7N6OIdeHEYrbxdY2I= MIME-Version: 1.0 Received: by 10.227.38.66 with SMTP id a2mr9951917wbe.81.1317246194889; Wed, 28 Sep 2011 14:43:14 -0700 (PDT) Received: by 10.180.82.97 with HTTP; Wed, 28 Sep 2011 14:43:14 -0700 (PDT) In-Reply-To: <20110928202647.GA8284@hs1.VERBENA> References: <20110928202647.GA8284@hs1.VERBENA> Date: Wed, 28 Sep 2011 17:43:14 -0400 Message-ID: From: Nate Dobbs To: Colin Barnabas Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Cc: freebsd-hackers@freebsd.org Subject: Re: Hello World assembly language X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 Sep 2011 22:13:12 -0000 Alter the stuff in red, the message will print irrespective of your `message' length. Change 13 to 14. section .data message: db 'hello, world!', 0x0a message_len equ $-message section .text global _start _start: mov rax, 4 mov rdi, 1 mov rsi, message mov rdx, *message_len* syscall mov rax, 1 xor rdi, rdi syscall On Wed, Sep 28, 2011 at 4:26 PM, Colin Barnabas wrote: > I found a hello world program written in assembly language which > runs on my amd64 8.2 stable box. However, I can not seem to get > it to print a new line. Any suggestions on how to print a line > feed in assembly? > > Here is the code- > > section .data > > message: > db 'hello, world!', 0x0a > > section .text > > global _start > _start: > mov rax, 4 > mov rdi, 1 > mov rsi, message > mov rdx, 13 > syscall > > mov rax, 1 > xor rdi, rdi > syscall > > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" > -- Cheers, Nate Dobbs RHCE