#include #include "bioskeye.h" int bioskeye(function) int function; { static union REGS rg; /* define registers */ int rc; /* define return code */ switch (function) { /* check which function asking for */ /* --------------------------------function 0: return key value */ case 0: rg.h.ah = 0x10; /* interrupt function 10h */ int86(0x16, &rg, &rg); /* call interrupt 16h */ rc = rg.x.ax; /* 'AH'=Scan Code, 'AL'=ASCII code */ break; /* get outta here */ /* ------------------function 1: report key stroke availability */ case 1: rg.h.ah = 0x11; /* interrupt function 11h */ int86(0x16, &rg, &rg); /* call interrupt 16h */ if (rg.x.flags & 0x40) /* check status bit */ rc = 0; /* bit set, report no key available */ else rc = rg.x.ax; /* bit clear, report key available */ break; /* get outta here */ /* -----------------------------function 1: report shift status */ case 2: rg.h.ah = 0x12; /* interrupt function 12h */ int86(0x16, &rg, &rg); /* call interrupt 16h */ rc = rg.x.ax; /* 'AX'=Shift Status */ break; /* get outta here */ /* --------------------------what function ???, return 0 anyway */ default: rc = 0; break; /* get outta here */ } return rc; /* all done, bye bye */ }