att asm stdin
.text
        .global _start
_start:
        # read(STDIN_FILENO, buf, 1)
        movl    $1, %edx    # size_t nbyte
        movl    $buf, %ecx  # void *buf
        movl    $0, %ebx    # int filedes
        movl    $3, %eax    # sys_read
        int     $0x80
        cmp     $1, %eax    
        jne     bye         # EOF or read() error
        cmp     $'A', (%ecx)
        jl      output      # *buf < 'A'
        cmp     $'Z', (%ecx)
        jg      output      # *buf > 'Z'
        je      z           # *buf == 'Z'
        incl    (%ecx)      # *buf >= 'A' && *buf < 'Z'
        jmp     output
z:
        movl    $'A', (%ecx)
output:
        # write(STDOUT_FILENO, buf, 1)
        movl    $1, %ebx    # int filedes
        movl    $4, %eax    # sys_write
        int     $0x80
        jmp     _start
bye:
        # exit(0)
        movl    $0, %ebx    # int status
        movl    $1, %eax    # sys_exit
        int     $0x80
.data
buf:
        .byte 0
