home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Media Share 9
/
MEDIASHARE_09.ISO
/
comm
/
ykh121.zip
/
YKHSRC.ZIP
/
CTERM.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-03-27
|
2KB
|
105 lines
#pragma inline
#include <stdlib.h>
#include "cterm.h"
#define CTERM 0x69
#define FC_INSTALL_CHECK 0x100
#define FC_SEND_DATA 0x101
#define FC_READ_DATA 0x102
#define FC_STATUS 0x103
#define FC_DECNET_STATUS 0x104
#define FC_OPEN_SESSION 0x105
#define FC_CLOSE_SESSION 0x106
#define FC_CTERM_SCB_SIZE 0x10a
#define FC_SOCKET 0x10b
#define FC_DEINSTALL 0x10f
static int cterm_handle;
static unsigned int ch;
static char *cterm_scb;
unsigned cterm_presence(void)
{
unsigned check;
asm mov ax,FC_INSTALL_CHECK;
asm int CTERM;
asm mov check,ax;
if (check==FC_INSTALL_CHECK) return -1;
return 0;
}
unsigned cterm_open (unsigned char *service)
{
unsigned size;
asm mov ax,FC_CTERM_SCB_SIZE;
asm int CTERM;
asm mov size,ax;
if ((cterm_scb=(char *)malloc(size))==NULL)
return -1;
asm push es;
asm push ds;
asm pop es;
asm mov ax,FC_OPEN_SESSION;
asm mov bx,service;
asm mov dx,cterm_scb;
asm int CTERM;
asm mov cterm_handle,ax;
asm pop es;
if (cterm_handle<0)
{
cterm_close();
return -1;
}
return 0;
}
void cterm_close (void)
{
asm mov ax,FC_CLOSE_SESSION;
asm mov dx,cterm_handle;
asm int CTERM;
free(cterm_scb);
}
unsigned cterm_send (char c)
{
asm mov ax,FC_SEND_DATA;
asm mov bl,c;
asm mov dx,cterm_handle;
asm int CTERM;
asm mov al,ah;
asm xor ah,ah;
}
unsigned cterm_ready(void)
{
if (cterm_status()&1)
return 1;
return 0;
}
char cterm_get(void)
{
asm mov ax,FC_READ_DATA;
asm mov dx,cterm_handle;
asm int CTERM;
}
char cterm_status(void)
{
asm mov ax,FC_STATUS;
asm mov dx,cterm_handle;
asm int CTERM;
asm mov al,ah;
asm xor ah,ah;
}