delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/05/18/14:37:29

Message-ID: <392413C7.1B971BC7@mtu-net.ru>
Date: Thu, 18 May 2000 20:01:11 +0400
From: "Alexei A. Frounze" <alex DOT fru AT mtu-net DOT ru>
X-Mailer: Mozilla 4.72 [en] (Win95; I)
X-Accept-Language: ru,en
MIME-Version: 1.0
To: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
Cc: djgpp AT delorie DOT com
Subject: Re: com1 programming .... a lot of question
References: <Pine DOT SUN DOT 3 DOT 91 DOT 1000518184115 DOT 15189S-100000 AT is>
X-Recipient: eliz AT is DOT elta DOT co DOT il
Reply-To: djgpp AT delorie DOT com

This is a multi-part message in MIME format.
--------------AFCD16933B4F5845AC6F9E0F
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Eli Zaretskii wrote:
> 
> On Thu, 18 May 2000, Alexei A. Frounze wrote:
> 
> > Btw, I usually connect 2nd and 3rd pins of the serial cable/connector in
> > order to test I/O on a single computer. Could this situation be problematic
> > for BIOS?
> 
> I don't think so, but I'm not really a hardware person.  Anybody?

Here go two sources from BC++. They don't work here on a single computer
(not tested with 2 computers), although my program works okay in either
case.

-- 
Alexei A. Frounze
-----------------------------------------
Homepage: http://alexfru.chat.ru
Mirror:   http://members.xoom.com/alexfru
--------------AFCD16933B4F5845AC6F9E0F
Content-Type: text/plain; charset=us-ascii;
 name="BIOSCOM.TXT"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="BIOSCOM.TXT"

----------------------------------8<------------------------------------
//////////////////////////////////////////////////////////
// bioscom example from Borland C/C++ 3.1 built-in help //
//////////////////////////////////////////////////////////
#include <bios.h>
#include <conio.h>

#define COM1       0
#define DATA_READY 0x100
#define TRUE       1
#define FALSE      0

#define SETTINGS ( 0x80 | 0x02 | 0x00 | 0x00)

int main(void)
{
   int in, out, status, DONE = FALSE;

   bioscom(0, SETTINGS, COM1);
   cprintf("... BIOSCOM [ESC] to exit ...\n");
   while (!DONE)
   {
      status = bioscom(3, 0, COM1);
      if (status & DATA_READY)
         if ((out = bioscom(2, 0, COM1) & 0x7F) != 0)
            putch(out);
         if (kbhit())
         {
            if ((in = getch()) == '\x1B')
               DONE = TRUE;
            bioscom(1, in, COM1);
         }
   }
   return 0;
}
----------------------------------8<------------------------------------

----------------------------------8<------------------------------------
//////////////////////////////////////////////////////////////////
// _bios_serialcom example from Borland C/C++ 3.1 built-in help //
//////////////////////////////////////////////////////////////////
#include <bios.h>
#include <conio.h>

#define COM1       0
#define DATA_READY 0x100
#define TRUE       1
#define FALSE      0
#define SETTINGS (_COM_1200 | _COM_CHR7 | _COM_STOP1 | _COM_NOPARITY)

int main(void)
{
  unsigned in, out, status;

  _bios_serialcom(_COM_INIT, COM1, SETTINGS);
  cprintf("... _BIOS_SERIALCOM [ESC] to exit ...\r\n");
  for (;;)
  {
    status = _bios_serialcom(_COM_STATUS, COM1, 0);
    if (status & DATA_READY)
      if ((out = _bios_serialcom(_COM_RECEIVE, COM1, 0) & 0x7F) != 0)
        putch(out);
    if (kbhit())
    {
      if ((in = getch()) == '\x1B')
        break;
      _bios_serialcom(_COM_SEND, COM1, in);
    }
  }
  return 0;
}
----------------------------------8<------------------------------------

--------------AFCD16933B4F5845AC6F9E0F--


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019