All of lore.kernel.org
 help / color / mirror / Atom feed
* programming bug
@ 2004-01-16 13:21 ergün koray
  2004-01-16 14:44 ` John Rodriguez
  0 siblings, 1 reply; 2+ messages in thread
From: ergün koray @ 2004-01-16 13:21 UTC (permalink / raw)
  To: linux-assembly

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 */


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-01-16 14:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-16 13:21 programming bug ergün koray
2004-01-16 14:44 ` John Rodriguez

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.