From: "ergün koray" <ergky@tnn.net>
To: linux-assembly@vger.kernel.org
Subject: programming bug
Date: Fri, 16 Jan 2004 15:21:15 +0200 [thread overview]
Message-ID: <4007E54B.7080306@tnn.net> (raw)
hi there,
i am new to assembly and i have written just this tiny code that turns
lowercase characters to uppercase.
but unfortunately after the first characters have been converted the
program exits, and i can't find why ?
can anybody help me ? thanks
.data
chr: .byte
.text
.global _start
_start:
read:
movl $3, %eax /* read */
movl $1, %ebx /* from stdin */
movl $chr, %ecx /* to chr */
movl $1, %edx /* 1 char */
int $0x80 /* using int 0x80 */
xorl %eax, %eax /*eax = 0 */
xorl %ebx, %ebx /*eax = 0 */
xorl %edx, %edx
xorl %ecx, %ecx
check:
movb chr, %al
cmpb $'a', %al
jl endprog
cmpb $'z', %al
jg endprog
xorl %eax,%eax
convert:
movb chr, %al /* al <- chr */
subb $'a' , %al /* Convert small letter */
addb $'A', %al /* to capital */
movb %al, chr /* write converted char to memory */
write:
movl $4, %eax /* write */
movl $1, %ebx /* to screen */
movl $chr, %ecx /* from chr */
movl $1, %edx /* 1 char */
int $0x80 /* using int 0x80 */
xorl %eax, %eax
xorl %ebx, %ebx
xorl %ecx, %ecx
jmp read
endprog:
movl $1, %eax /* exit sys call */
movl $0, %ebx /* exit value */
int $0x80 /* call int */
next reply other threads:[~2004-01-16 13:21 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-16 13:21 ergün koray [this message]
2004-01-16 14:44 ` programming bug John Rodriguez
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4007E54B.7080306@tnn.net \
--to=ergky@tnn.net \
--cc=linux-assembly@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox