home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / os / msdos / programm / 10559 < prev    next >
Encoding:
Internet Message Format  |  1992-11-12  |  1.7 KB

  1. Path: sparky!uunet!ukma!asuvax!ncar!vexcel!copper!slate!iarit
  2. From: iarit@slate.mines.colorado.edu (ARIT ISMAIL)
  3. Newsgroups: comp.os.msdos.programmer
  4. Subject: putting chars back to keyboard buf.. Round 2..
  5. Message-ID: <1992Nov12.180037.62744@slate.mines.colorado.edu>
  6. Date: 12 Nov 92 18:00:37 GMT
  7. Organization: Colorado School of Mines
  8. Lines: 52
  9.  
  10. Hi,
  11.  
  12. First, thanks to those who replied to my last buffer question.!!
  13. Now, here is my code..
  14.  
  15. void
  16. PushBackChar(char aChar)
  17. {
  18.     unsigned int       temp2;
  19.     unsigned int far  *tail = (unsigned int far *)(0x0040L << 16 |
  20.                                                    0x001CL);
  21.     unsigned int far  *head = (unsigned int far *)(0x0040L << 16 |
  22.                                                    0x001AL);
  23.  
  24.     temp2 = *tail;
  25. /* let's go to next box, see where we are.!*/
  26.     temp2 += 2;
  27.  
  28.     if (temp2 <= 0x3E)
  29.         goto still_got_space;
  30.     else
  31.     {   /* go back to start*/
  32.         temp2 = 0x1E;
  33.         temp2 += 2;
  34.     }
  35.  
  36. still_got_space:
  37.     if ((*head) == temp2)
  38.         goto cant_push;
  39.     else                        /* don't care about ext. keys */
  40.     *((int far *)(0x0040L << 16 | (long)(temp2 - 2))) =
  41.                                               (unsigned)aChar;
  42.  
  43.                                 /* update tail */
  44.     *((unsigned far *)(0x0040L << 16 | 0x001CL)) = temp2;
  45.  
  46. cant_push:;
  47.  /* trash */
  48.  
  49. };
  50.  
  51.  
  52.  
  53. this code works just fine(Well.! not always!!..), but there is a
  54. problem. Sometimes, DOS shell reads whatever I pushed recursively
  55. 'till I do Ctrl-C (I am using this to push some strings back to DOS
  56. shell from a tsr). Does anybody know/see what the problem is?
  57.  Thanks in advance.
  58.  
  59. iarit@slate.mines.colorado.edu
  60.  
  61.  
  62.