From jt@fuw.edu.pl Wed Apr 8 15:20:19 1998 In-reply-to: "Jim_KEwl"'s message of 7 Apr 1998 19:01:57 GMT Newsgroups: alt.lang.asm Subject: Re: Keyboard handler using port 60h Reply-to: jt@zfja-gate.fuw.edu.pl= (Jerzy Tarasiuk; remove the '=') References: <01bd6042$62d55ca0$0c3e43cf@pavilion> <6g6rbs$re9$1@charm.magnus.acs.ohio-state.edu> <3529E4F5.2AA5@hotmail.com> <01bd6268$6e887780$4e3e43cf@pavilion> From: jt@fuw.edu.pl (Jerzy Tarasiuk) Date: 08 Apr 1998 15:20:18 +0200 Message-ID: Organization: Warsaw University, Physics Department Lines: 25 X-Newsreader: (ding) Gnus v0.82 >>>>> Jim KEwl writes: > Also I'd rather have someone explain the port 60h than > show me how they used it. I learn much better from > making my own code than cutting and pasting someone It depends on computer type. On old PC, PC/XT, the port was 8-bit shift register which received data from keyboard and signalled IRQ1 when became full. From AT, it is output buffer of 8742 (or 8042, in older AT-s) microcontroller, which is connected also to port 64h. Bit 0 of status read from the port 64h is output-buffer-full signal, bit 1 is input-buffer-full, usually both are 0. When a scan code is received by the 8742, the bit 0 is set, IRQ1 is signalled, and the code can be read >from port 60h. Reading the code clears the OBF (unlike PC/XT where it required setting and clearing of bit 7 in port 61h). You can send data to keyboard by writing it to port 60h (the data is interpreted by keyboard and can, e.g. set typematic rate, turn on/off lights, test keyboard internal controller), and command to 8742 by writing it to port 64h. In both cases you should check the IBF signal and wait if it is set. Also remember the action is done by slow microprocessor and it is delayed (e.g. if you enable address line A20 this way). For details on commands, bits, etc. look into "Ports" section of Ralf Brown interrupt list (on Simtel in msdos/info).