Article View: comp.os.msdos.programmer
Article #1482Re: How does INT 16 know that INT 9 has executed?
From: Yossi Gil
Date: Sun, 13 Sep 1992 14:52
Date: Sun, 13 Sep 1992 14:52
52 lines
2078 bytes
2078 bytes
yogi@cs.ubc.ca (Yossi Gil) writes:
>Suppose you call int 16 with ah=0 and that there are no
>keys in the keyboard queue. Int 16 codes then waits for
>a keystroke to occur and return it.
>Q: What is the communication mechanism? How does int 9 signal
>to int 16 that a keystroke occured.
>I did few experiments and as far as I can tell, int 16 doesn't loop
>until head != tail for the keyboard queue.
Checked again, disassembling the BIOS (AMI) and discovered that I
was wrong in my first conjecture.
Basically, int 16, ah=0 waits for keystroke by doing the following:
1. Disable interrupts.
2. Compare Head to Tail
3. Enable interrupts
4. If not equal goto 7.
5. Call INT 15, AX=9002
6. Goto 1.
7. Read key.
8. If keyboard status changed, set the leds.
9. If enhanced key goto 1.
10. Return key.
I used this to patch INT 9 to add a new keystroke for ScrollLock. My
code is:
1. Record Scroll Lock shift status.
2. Call original int 9.
3. If key pending add it to the queue tail.
4. If scroll lock status has not changed return.
5. If keyboard buffer is not full, push "Scroll Lock" keystroke in
6. If full, toggle key pending status.
7. Return
Using this patch, I can detect change in status of scroll lock without
polling the keyboard status word.
--
Joseph (Yossi) Gil {alberta,uw-beaver,uunet}!ubc-cs!yogi
Dept. of Computer Science yogi@cs.ubc.ca (cs.ubc.ca=137.82.8.5)
6356 Agricultural Road., Univ. of B.C., Tel: +1-604-822-8175
Vancouver, British Columbia, V6T 1Z2, Canada. Fax: +1-604-822-5485
Technical Details
Message-ID:
<1992Sep13.145200.19279@cs.ubc.ca>Path:
arc1-ca.pugleaf.net!sparky!uunet!caen!destroyer!ubc-cs!yogiReferences:
<1992Sep13.053140.12086@cs.ubc.ca>Show Full Headers
Complete Article Headers
Newsgroups: comp.os.msdos.programmer Path: arc1-ca.pugleaf.net!sparky!uunet!caen!destroyer!ubc-cs!yogi From: yogi@cs.ubc.ca (Yossi Gil) Subject: Re: How does INT 16 know that INT 9 has executed? Message-ID: <1992Sep13.145200.19279@cs.ubc.ca> Sender: usenet@cs.ubc.ca (Usenet News) Organization: Computer Science, University of B.C., Vancouver, B.C., Canada References: <1992Sep13.053140.12086@cs.ubc.ca> Date: Sun, 13 Sep 92 14:52:00 GMT Lines: 52