home *** CD-ROM | disk | FTP | other *** search
- program dial;
- uses crt,dos,zeustuf2;
- {This program is written using Turbo Pascal. It accepts user input to
- dial Hayes compatable modems. MS-DOS interrupts are used for RS232
- communications, it should work in the IBM and the host of compatables.
- If you have trouble communicating with the serial port, check and change
- as needed the value assigned to DL in talk. It selects the COM port
- which runs the modem}
-
- type str80 =string[80];
-
-
- {initialize for MS DOS interrupt call
- type
- regipak = record ax,bx,cx,dx,bp,di,ds,es,flags:integer;
- end;
- }
-
- var
- dm:byte;
- mypak: registers; {regipak; }
-
-
- { Bah,Bal,bh,bl,ch,cl,Bdh,Bdl,bph,bpl,dih,dil,dsh,dsl: byte;}
-
- Bah,Bal,Bdh,Bdl: byte;
- cx,len,ct:integer;
- ir:byte;
- dialit,LAST,NUMBER,personal,prefix:string[40];
- dummy,digit:char;
-
- procedure Send_Char;
- {Send characters to the modem}
- begin
- with mypak do
- begin
- ax := Bah shl 8 + Bal;
- dx := Bdh shl 8 + Bdl;
- intr($14,mypak);
- end;
- end;
-
- procedure send_Num(Num:str80);
- {Break the number apart and TALK to the modem}
- begin
- NUMBER:='ATDT'+Num+chr(13);
- len:=length(number);
- ct:=1;
- while ct<=len do
- begin
- digit:=number[ct];
- Bal:=ord(digit);
- Bah:=1;
- Bdl:=0;
- Send_Char;
- ct:=ct+1;
- end;
- end;
-
- procedure send_Code(InStr:str80);
- begin
- len:=length(InStr);
- ct:=1;
- while ct<=len do
- begin
- digit:=InStr[ct];
- Bal:=ord(digit);
- Bah:=1;
- Bdl:=0;
- Send_Char;
- ct:=ct+1;
- end;
- end;
-
- procedure setup;
- {set communications parameters}
- begin
- Bdh:=0;
- Bah:=0;
- Bdl:=0;
- Bal:=131;
- Send_Char;
- Bah:=4;
- Bdl:=0;
- Send_Char;
- end;
- procedure pickphone;
- begin
- Clrscr;
- Gotoxy(5,5);
- Write('Pick Up yo phone and press a key to talk');
- repeat until keypressed;
- Send_Code('h0');
- end;
-
-
- PROCEDURE MAIN;
- {Get the number to dial or special commands}
- begin
- setup;
- if paramstr(1) = '' then
- begin
- writeln('');
- write('Number to Dial ( . = quit [enter] = last number): ');
- readln(dialit);
- end else dialit := paramstr(1);
- If DialIt<>'' then
- begin
- send_Num(DialIt);
- pickphone;
- end;
- end;
-
- BEGIN
- last:='';
- DialIt:='';
- clrscr;
- main;
- Send_Code('ATH0');
- end.
-