/* MS-DOS SHELL - Show Scan codes * * MS-DOS SHELL - Copyright (c) 1990,1,2 Data Logic Limited. * * This code is subject to the following copyright restrictions: * * 1. Redistribution and use in source and binary forms are permitted * provided that the above copyright notice is duplicated in the * source form and the copyright notice in file sh6.c is displayed * on entry to the program. * * 2. The sources (or parts thereof) or objects generated from the sources * (or parts of sources) cannot be sold under any circumstances. * * $Header: /usr/users/istewart/src/shell/sh2.1/RCS/showkey.c,v 2.0 1992/07/16 14:35:08 istewart Exp istewart $ * * $Log: showkey.c,v $ * Revision 2.0 1992/07/16 14:35:08 istewart * Release 2.0 * * */ #include #include #include #include void main (void) { union REGS Key; union REGS Shift; puts ("Control C to terminate"); while (TRUE) { Key.x.ax = 0; int86 (0x16, &Key, &Key); Shift.x.ax = 0x0200; int86 (0x16, &Shift, &Shift); printf ("Scan = 0x%.4x ", Key.h.ah); printf ("ASCII = 0x%.4x (%c) ", Key.h.al, isprint (Key.h.al) ? Key.h.al : '.'); printf ("Shift = 0x%.4x ( ", Shift.h.al); if (Shift.h.al & 0x01) printf ("Right Shift "); if (Shift.h.al & 0x02) printf ("Left Shift "); if (Shift.h.al & 0x04) printf ("Control "); if (Shift.h.al & 0x08) printf ("Alt "); puts (")"); if (Key.h.al == 0x03) exit (0); } }