Console ASCII interpretation

Dan Nelson dnelson at
Mon May 16 17:30:38 GMT 2005

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 at

More information about the freebsd-hackers mailing list