home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!ukma!asuvax!ncar!vexcel!copper!slate!iarit
- From: iarit@slate.mines.colorado.edu (ARIT ISMAIL)
- Newsgroups: comp.os.msdos.programmer
- Subject: putting chars back to keyboard buf.. Round 2..
- Message-ID: <1992Nov12.180037.62744@slate.mines.colorado.edu>
- Date: 12 Nov 92 18:00:37 GMT
- Organization: Colorado School of Mines
- Lines: 52
-
- Hi,
-
- First, thanks to those who replied to my last buffer question.!!
- Now, here is my code..
-
- void
- PushBackChar(char aChar)
- {
- unsigned int temp2;
- unsigned int far *tail = (unsigned int far *)(0x0040L << 16 |
- 0x001CL);
- unsigned int far *head = (unsigned int far *)(0x0040L << 16 |
- 0x001AL);
-
- temp2 = *tail;
- /* let's go to next box, see where we are.!*/
- temp2 += 2;
-
- if (temp2 <= 0x3E)
- goto still_got_space;
- else
- { /* go back to start*/
- temp2 = 0x1E;
- temp2 += 2;
- }
-
- still_got_space:
- if ((*head) == temp2)
- goto cant_push;
- else /* don't care about ext. keys */
- *((int far *)(0x0040L << 16 | (long)(temp2 - 2))) =
- (unsigned)aChar;
-
- /* update tail */
- *((unsigned far *)(0x0040L << 16 | 0x001CL)) = temp2;
-
- cant_push:;
- /* trash */
-
- };
-
-
-
- this code works just fine(Well.! not always!!..), but there is a
- problem. Sometimes, DOS shell reads whatever I pushed recursively
- 'till I do Ctrl-C (I am using this to push some strings back to DOS
- shell from a tsr). Does anybody know/see what the problem is?
- Thanks in advance.
-
- iarit@slate.mines.colorado.edu
-
-
-