From mboxrd@z Thu Jan 1 00:00:00 1970 From: Rudolf Marek Subject: Re: entering char from keyboard Date: Mon, 29 Apr 2002 12:04:28 +0200 Sender: linux-assembly-owner@vger.kernel.org Message-ID: References: Mime-Version: 1.0 Return-path: In-Reply-To: List-Id: Content-Type: TEXT/PLAIN; charset="us-ascii" Content-Transfer-Encoding: 7bit To: ssams Cc: linux-assembly@vger.kernel.org Hello, (its more neutral I guess) Any program in unix while running has open the file descriptor (handle) for STDIN STDOUT and STDERR (0,1,2). If you want to read from keyboard you just read(stdin) via a syscall. But may happen that the syscall returns after pressing ENTER. If you want just read one ahar without (ENTER) confirming it, you should change terminal IOCTL. look in sh.asm in asmutils mov edx,termattrs sys_ioctl STDIN,TCGETS mov eax,[termattrs.c_lflag] push eax and eax,~(ICANON|ECHO) ; this turns OFF echo also mov [termattrs.c_lflag],eax sys_ioctl STDIN, TCSETS this should work under linux, this under *NIX (maybe) sys_fcntl STDIN,F_GETFL and eax,~(O_NONBLOCK) sys_fcntl STDIN,F_SETFL,eax and the rest is smth like read 1 byte from STDIN Regards Rudolf