home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / alt / msdos / programm / 2286 < prev    next >
Encoding:
Text File  |  1992-08-30  |  1.8 KB  |  65 lines

  1. Path: sparky!uunet!dove!enh.nist.gov!tjb
  2. From: tjb@enh.nist.gov
  3. Newsgroups: alt.msdos.programmer
  4. Subject: com port problem
  5. Message-ID: <29AUG92.20284166@enh.nist.gov>
  6. Date: 30 Aug 92 00:28:41 GMT
  7. Sender: news@dove.nist.gov
  8. Organization: NIST
  9. Lines: 54
  10.  
  11. Hi,
  12. I have an Xt and a 386,
  13. the XT is connected to a printer and a modem
  14. the 386's COM2 is connected to the XT's COM1 through a null-modem
  15. cable.
  16. i want to be able to use the printer&modem from the 386
  17. i can use the printer using a network program, but it's not compatible
  18. with a lot of stuff, and takes up LOTS of memory.
  19. i wanted to use the modem by writing a small C program that
  20. makes the XT transfer COM1 to COM2 and COM2 to COM1
  21. so that COM2(direct link to XT) on the 386 will function as a modem
  22.   386               XT
  23.  ---------      --------------
  24.     COM2  ->   COM1  ->  COM2  ->  modem
  25.     COM2  <-   COM1  <-  COM2  <-  modem
  26.  
  27. my program so far is:
  28. ---------------------------------------------------------
  29. #include <conio.h>
  30. #include <dos.h>
  31. #undef inportb
  32. #undef outportb
  33. #define COM1 0x3f8
  34. #define COM2 0x2f8
  35. #define COM1S 0x3fd
  36. #define COM2S 0x2fd
  37. main()
  38. {
  39.     int com1,com1s,com2,com2s;
  40.     while( !kbhit() )
  41.     {
  42.         com1s = inport( COM1S );
  43.         if( com1s & 2)
  44.         {
  45.             com1 = inport( COM1 );
  46.             outport( COM2, com1 );
  47.             printf("got %d from com1\n",com1);
  48.         }
  49.         com2s = inport( COM2S );
  50.         if( com2s & 2 )
  51.         {
  52.             com2 = inport( COM2 );
  53.             outport( COM1, com2 );
  54.             printf("got %d from com2\n",com2);
  55.         }
  56.     }
  57. }
  58. -----------------------------------------------------------
  59. the program works if i type each letter twice slowly.
  60. does anyone know how to make it work??
  61. Thanks,
  62. Omri Barak
  63. Internet: barak@bguee.bgu.ac.il
  64. Bitner  : barak@bguee
  65.