From: garycrowley AT musician DOT org Newsgroups: comp.os.msdos.djgpp Subject: BIOS serial port int 14h Date: Mon, 07 Aug 2000 14:17:34 +0100 Organization: http://extra.newsguy.com Lines: 70 Message-ID: NNTP-Posting-Host: p-430.newsdawg.com Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Newsreader: Forte Agent 1.8/32.548 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com I'm having trouble with the BIOS serial port routines provided by int 14h. I'm trying to write a really elementary BBS type program which takes characters from the keyboard, and throws them at a serial port; and vice versa, takes input from the serial port and displays them. In an MSDOS box under Win2000, a version of this program just about works, although it echoed characters seem to lag behind transmitted characters. In MSDOS under Win98, it gives the following results; C:\a-mterm>mterm 6030 41,54,44,54,34,30,37,32,34,35,31,32,39,39,d,(8000, )(8000, )(8000, )>>13<[d]>>13 <[d]>>13<[d](8000, )(8000, )>>13<[d]>>13<[d]>>13<[d]>>13<[d](8000, )^C It just prints out a load of 0x8000 which means it can't read anything. 'sport' is set appropriately for the COM port, COM3 for Win2k and COM2 for Win98 (for some reason the COM ports are different under the different OS's with identical hardware). I'm really asking for some help here. I've seen other terminal emulators which directly muck around with OUTP and INP but I'd prefer to use int 14h. What is going wrong? My experience of programming this sort of thing is very small. Is there a fault with the way I'm doing this, or is there a problem in my Win98 configuration? A simple INP/OUTP BBS program works in win98. Alternatively, can someone point me towards a small BBS program based on int 14h which I can adapt to my purposes? Help, please! #include #include #include // int _bios_serialcom(unsigned service, unsigned port, unsigned data); void sendkeys(unsigned sport, char *keys); main() { unsigned int i, k=0, sport=2; // com3 == '2' printf("%x\n",_bios_serialcom(0,sport,0xe2)); sendkeys(sport,"ATDT2370400\r"); while(1) { if(k>0) { printf("[%x]",_bios_serialcom(1,sport,k)); k=0; } if(kbhit()) { printf(">"); k=getch(); printf(">%d<",k); continue; } // i=_bios_serialcom(3,sport,'\0'); if(i!=0x6030) printf(";%x;",i); i=_bios_serialcom(2,sport,'\0'); { printf("(%x,%c)",i,i&0xff); } } printf("\nend\n"); } void sendkeys(unsigned sport, char *keys) { char *p=keys; while(*p) printf("%x,",_bios_serialcom(1,sport,*p++)); }