🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: alt.msdos.programmer
2 messages
2 total messages Started by FREE1178 Thu, 01 Oct 1992 01:50
How to get keys from keyboard without removing them
#670
Author: FREE1178
Date: Thu, 01 Oct 1992 01:50
10 lines
866 bytes
Hi all--
 
  I need to check the keyboard buffer and store keypresses in a buffer
to be stored in a file.  I want to do this as an ISR.  I was planning
on writing it in C and then porting it to Assembler.  The question
is how to check the keys in the keyboard buffer without removing them.
I want whatever program that is running to be able to execute those
keystrokes.
 
  Any help would be greatly appreciated.
Re: How to get keys from keyboard without removing them
#690
Author: Jerzy Tarasiuk
Date: Mon, 05 Oct 1992 17:35
22 lines
2012 bytes
>>>>> On Thu, 1 Oct 1992 01:50:23 GMT, FREE1178@vmd.cso.uiuc.edu said:
F>   I need to check the keyboard buffer and store keypresses in a buffer
F> to be stored in a file.  I want to do this as an ISR.  I was planning
F> on writing it in C and then porting it to Assembler.  The question
F> is how to check the keys in the keyboard buffer without removing them.

If you mean the keyboard buffer where BIOS puts keystrokes (on AT computer
there is also keyboard buffer in keyboard itself) it is easy: if you want
be sure to catch all keystrokes write ISR for int 9 which calls previous
ISR and then examines keyboard buffer input pointer, if it was changed
then data pointed by it before servicing interrupt is the keystroke,
otherwise no new data was entered (shift key or key was released or key
which is ignored was pressed). Exception is break (Ctrl-ScrollLock) which
clears all from keyboard buffer. If it is enough to catch keypresses read
by int 16, write ISR connected to this int. Example ISR for int 9:
mov cs:ds_save,ds / mov cs:bx_save,bx / mov bx,cs / mov ds,bx
pop ds:ip_save / pop ds:cs_save / pop ds:f_save / mov bx,40h / mov ds,bx
mov bx,ds:[1Ch] / pushf / call previous_ISR / cmp bx,ds:[1Ch]
jz nothing_new / push ax / mov ax,ds:[bx] / ... / pop ax
nothing_new: mov bx,cs / mov ds,bx / push ds:f_save / push ds:cs_save
push ds:ip_save / mov bx,ds:bx_save / mov ds,ds:ds_save / iret
(it doesn't include check for the break - need write ISR for int 1B).
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads