Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 Sep 2011 17:18:00 -0400
From:      Ryan Stone <rysto32@gmail.com>
To:        Colin Barnabas <axel@ucs.com>
Cc:        freebsd-hackers@freebsd.org
Subject:   Re: Hello World assembly language
Message-ID:  <CAFMmRNwyoGEqu4D6k7o1axFk0WKEavai6dzuARvZCGbesZu3Mw@mail.gmail.com>
In-Reply-To: <20110928202647.GA8284@hs1.VERBENA>
References:  <20110928202647.GA8284@hs1.VERBENA>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Sep 28, 2011 at 4:26 PM, Colin Barnabas <axel@ucs.com> 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 =A0 =A0 =A0'hello, world!', 0x0a
>
> section .text
>
> global _start
> _start:
> mov =A0 =A0 rax, 4
> mov =A0 =A0 rdi, 1
> mov =A0 =A0 rsi, message
> mov =A0 =A0 rdx, 13
> syscall
>
> mov =A0 =A0 rax, 1
> xor =A0 =A0 rdi, rdi
> syscall

Try printing 14 bytes. :)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAFMmRNwyoGEqu4D6k7o1axFk0WKEavai6dzuARvZCGbesZu3Mw>