1: /***************************************************************************
   2:  * This program is Copyright (C) 1986, 1987, 1988 by Jonathan Payne.  JOVE *
   3:  * is provided to you without charge, and with no warranty.  You may give  *
   4:  * away copies of JOVE, including sources, provided that this notice is    *
   5:  * included in all the files.                                              *
   6:  ***************************************************************************/
   7: 
   8: #include "tune.h"
   9: 
  10: #ifdef MSDOS
  11: 
  12: #include <bios.h>
  13: #include <dos.h>
  14: 
  15: #include "jove.h"
  16: 
  17: #ifdef LINT_ARGS
  18: private void waitfun(void);
  19: #else
  20: private void waitfun();
  21: #endif
  22: 
  23: extern int UpdModLine;
  24: #ifdef IBMPC
  25: static char last = 0;
  26: extern int specialkey;
  27: #endif
  28: 
  29: getrawinchar()
  30: {
  31: #ifdef RAINBOW
  32:     union REGS regs;
  33: #endif /* RAINBOW */
  34: #ifdef IBMPC
  35:     unsigned scan;
  36: 
  37:     if (specialkey = last) {
  38:         scan = last;
  39:         last = 0;
  40:         return scan;
  41:     }
  42: #endif /* IBMPC */
  43: 
  44:     while (!rawkey_ready())
  45:         waitfun();
  46: 
  47: #ifdef IBMPC
  48:     scan = _bios_keybrd(_KEYBRD_READ);
  49:     if ((scan&0xff) == 0) {
  50:         last = (char) (scan >> 8);
  51:         return 0xff;
  52:     }
  53:     return scan&0xff;
  54: #else /* IBMPC */
  55: #ifdef RAINBOW
  56: waitloop:
  57:     regs.x.di = 2;
  58:     int86(0x18, &regs, &regs);
  59:     if (regs.h.al != 0) /* should never happen, but who knows */
  60:         return regs.h.al;
  61:     else
  62:         goto waitloop;
  63: #else /* RAINBOW */
  64:     return bdos(0x06, 0x00ff, 0xff) & 0xff;
  65: #endif /* RAINBOW */
  66: #endif /* IBMPC */
  67: }
  68: 
  69: static int waiting = 0;
  70: 
  71: rawkey_ready()
  72: {
  73: #ifndef IBMPC
  74:     union REGS regs;
  75: #endif
  76: 
  77:     if (waiting)
  78:         return 0;
  79: #ifdef IBMPC
  80:     if (last)
  81:         return 1;
  82: 
  83:     return _bios_keybrd(_KEYBRD_READY);
  84: #else /* IBMPC */
  85: #ifdef RAINBOW
  86:     regs.x.di = 4;
  87:     int86(0x18, &regs, &regs);
  88:     return regs.h.cl != 0;
  89: #else /* RAINBOW */
  90:     regs.h.ah = 0x44;       /* ioctl call */
  91:     regs.x.bx = 0;          /* stdin file handle */
  92:     regs.h.al = 0x06;       /* get input status */
  93:     intdos(&regs, &regs);
  94:     return regs.h.al & 1;
  95: #endif /* RAINBOW */
  96: #endif /* IBMPC */
  97: }
  98: 
  99: #ifdef IBMPC
 100: static long timecount, lastcount = 0;
 101: #else
 102: static char lastmin = 0;
 103: #endif
 104: 
 105: 
 106: private void
 107: waitfun()
 108: {
 109: #ifndef IBMPC
 110:     struct dostime_t tc;
 111: #endif
 112: 
 113:     if (UpdModLine) {
 114:         waiting = 1;
 115:         redisplay();
 116:         waiting = 0;
 117:         return;
 118:     }
 119: #ifdef IBMPC
 120:     if (_bios_timeofday(_TIME_GETCLOCK, &timecount) ||  /* after midnight */
 121:             (timecount > lastcount + 0x444) ) {
 122:         lastcount = timecount;
 123:         UpdModLine = 1;
 124:     }
 125: #else
 126:     _dos_gettime(&tc);
 127:     if (tc.minute != lastmin) {
 128:         UpdModLine = 1;
 129:         lastmin = tc.minute;
 130:     }
 131: #endif
 132: }
 133: 
 134: #endif /* MSDOS */

Defined functions

getrawinchar defined in line 29; used 4 times
rawkey_ready defined in line 71; used 4 times
waitfun defined in line 106; used 3 times

Defined variables

last defined in line 25; used 5 times
lastcount defined in line 100; used 2 times
lastmin defined in line 102; used 2 times
timecount defined in line 100; used 3 times
waiting defined in line 69; used 3 times
Last modified: 1988-03-15
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 770
Valid CSS Valid XHTML 1.0 Strict