.data inChar: .fill 1 outChar: .fill 1 .text .global _start _start: readOneLine: # read a character from stdin movl $3, %eax # sys service 3 for reading movl $0, %ebx # stdin is file handle 0 movl $inChar, %ecx # address of where to read to movl $1, %edx # number of bytes to read int $0x80 # request the OS to perform the operation # check if we are at eof cmpl $0, %eax jz allDone # it is not eof, something was read into inChar cmpb $'\n',inChar # compare to end of line jz gotEOLN # not end of line # do some processing here jmp readOneLine gotEOLN: # process the number read here movb $'?',outChar movl $4, %eax movl $1, %ebx movl $outChar, %ecx movl $1, %edx int $0x80 jmp readOneLine allDone: movl $1, %eax movl $0, %ebx int $0x80