home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 13
/
CD_ASCQ_13_0494.iso
/
maj
/
2233
/
testmodc.c
< prev
next >
Wrap
Text File
|
1993-05-29
|
3KB
|
105 lines
/*
╔═════════════════════════════════════════════════════════════════════════════╗
║ NOM : TESTMODC.C ║
║ FONCTION : Démonstration simple de l'utilisation de MODEM.C... ║
║ COPYRIGHT : HETRU Fabrice 1991-1993. ║
╚═════════════════════════════════════════════════════════════════════════════╝
*/
#include "modem.c"
#include <stdio.h>
#include <ctype.h>
#include <process.h>
#define Int1B 0x1B /* N° d'int. BIOS gérant le "Ctrl-Break". */
void interrupt (*OldIBreak) ();
void interrupt CtrlBreak()
{
}
int kb_hit()
{
inregs.h.ah = 1;
int86(0x16,&inregs,&outregs);
return( !(outregs.x.flags & 64) );
}
int get_clav()
{
int h,l;
if (kb_hit())
{
inregs.h.ah = 0;
int86(0x16,&inregs,&outregs);
l = outregs.h.al;
h = outregs.h.ah;
if (l==0) l = h+0x100;
return(l);
}
else return(0);
}
main()
{
unsigned char num_com;
int fmt;
int InBuffSz,OutBuffSz;
int car = ' ';
unsigned char cs,n;
unsigned char modsc;
int Curs_OFF = 0x0720;
printf("Test du modem HAYES grâce à l'interface en C.\n");
if (Check_COMM_Present()==0)
{
printf("Chargez SLOWCOMM ou FASTCOMM S.V.P.\n");
exit(1);
}
else printf("<I>nitialise <C>onnecte <R>accroche F==>FIN\n");
Open_COMM();
Init_status();
num_com = Voie_active - 0x30;
Init_COMM('7','1','N',2400,&InBuffSz,&OutBuffSz);
OldIBreak = getvect(Int1B);
setvect(Int1B,CtrlBreak);
Show_CorF = TRUE;
install_Clock(num_com);
while(car!='F')
{
if (kb_hit())
{
car=toupper(get_clav());
switch(car)
{
case 'I': { CmdeToModem(InitMod,''); break; }
case 'C': { CmdeToModem(Connect,''); break; }
case 'R': { CmdeToModem(Raccroch,''); break; }
case 59: printf("<I>nitialise <C>onnecte <R>accroche F==>FIN\n");
}
}
if (CheckBufferIn(&n))
{
if (ReadSerie(&cs,1,&n)==0) printf("%c",cs);
}
}
Close_COMM();
un_install_Clock();
modsc = peekb(0x40,0x49);
if ( (modsc==2) | (modsc==3) | (modsc==7) )
movedata(FP_SEG(&Curs_OFF),FP_OFF(&Curs_OFF),seg_ecran,158,2);
else movedata(FP_SEG(&Curs_OFF),FP_OFF(&Curs_OFF),seg_ecran,76,2);
Reset_Init_status(Voie_active,Format);
printf("Test terminé.\n");
setvect(Int1B,OldIBreak);
}