home *** CD-ROM | disk | FTP | other *** search
/ ftp.update.uu.se / ftp.update.uu.se.2014.03.zip / ftp.update.uu.se / pub / rainbow / msdos / decus / RB139 / mwc-rb.lzh / KBD16.C next >
Text File  |  1986-03-27  |  1KB  |  39 lines

  1. /* Fast Video Access Service */
  2.  
  3. #include <dos.h>                      /* Msdos definitions */
  4. #include <rbrom.h>              /* Rainbow firmware service codes */
  5. #include <rbfkeys.h>
  6.  
  7. #define lo_byte(x)  (x & 0xff)
  8. #define hi_byte(x)  ((x>>8) & 0xff)
  9.  
  10. static char translate[] =
  11.  {15,16,99,02,99,04,99,06,99,07,99,08,99,09,99,10,
  12.   99,14,99,17,99,18,99,19,99,20,99,21,99,22,99,23,
  13.   99,24,99,25,99,26,99,27,99,29,99,30,99,28,99,31,
  14.   99,99,32,99,99,33,99,99,34,99,99,35,99,99,36,99,
  15.   99,37,99,99,38,99,99,39,99,99,40,99,99,42,99,99,
  16.   41,99,99,43,99,99,48,99,99,44,99,99,45,99,99,46,
  17.   99,99,47,99,99,05};
  18.  
  19. static struct reg r;
  20.  
  21. int kbd16(keycode)
  22.   int *keycode;
  23.  
  24. {
  25.   r.r_di = ROM_ConsoleLev1In;
  26.   intcall(&r,&r,24);
  27.   if (lo_byte(r.r_cx) == 0)
  28.     return(0);
  29.   else if (lo_byte(r.r_cx) == 1)
  30.     return(1);
  31.   else
  32.     {
  33.       if ((r.r_ax & fv_fkey) != 0) 
  34.         r.r_ax = (r.r_ax & 0xff00) | translate[lo_byte(r.r_ax)];
  35.       *keycode = r.r_ax;
  36.       return(-1);
  37.     }
  38. }
  39.