Mail Archives: djgpp/2000/05/18/14:37:29
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 -