From owner-freebsd-hackers@FreeBSD.ORG Mon May 16 17:30:38 2005 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 1AACB16A4CE for ; Mon, 16 May 2005 17:30:38 +0000 (GMT) Received: from dan.emsphone.com (dan.emsphone.com [199.67.51.101]) by mx1.FreeBSD.org (Postfix) with ESMTP id A24AE43D99 for ; Mon, 16 May 2005 17:30:37 +0000 (GMT) (envelope-from dan@dan.emsphone.com) Received: (from dan@localhost) by dan.emsphone.com (8.13.1/8.13.3) id j4GHUYiS093121; Mon, 16 May 2005 12:30:34 -0500 (CDT) (envelope-from dan) Date: Mon, 16 May 2005 12:30:34 -0500 From: Dan Nelson To: alexander Message-ID: <20050516173034.GB85914@dan.emsphone.com> References: <20050516171143.GA19979@skatecity> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20050516171143.GA19979@skatecity> X-OS: FreeBSD 5.4-STABLE X-message-flag: Outlook Error User-Agent: Mutt/1.5.9i cc: freebsd-hackers@freebsd.org Subject: Re: Console ASCII interpretation X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 May 2005 17:30:38 -0000 In the last episode (May 16), alexander said: > I'm using syscall number 4 write() to output data to stdout using x86 > assembly. When I try to output the following DWORD: 0x00003532 I get > the following output under Eterm and xterm: "25". Which is exactly > what I want. > > However when I do the very same under the console (using bash or sh. > It doesn't matter) I get this output: "25 ". > > I looked up the ASCII value for 00h and it says NUL. Doesn't that > mean that there shouldn't be any output at all? Did you maybe forget to push the 3rd argument to write onto the stack before making the syscall? That's the number of bytes to write. If there happened to be a 4 on the stack, then write() would write 4 bytes starting at whatever buffer your 2nd argument points to. -- Dan Nelson dnelson@allantgroup.com