home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / DIALER2.ZIP / DIALER.PAS < prev   
Encoding:
Pascal/Delphi Source File  |  1989-10-19  |  2.5 KB  |  122 lines

  1. program dial;
  2. uses crt,dos,zeustuf2;
  3. {This program is written using Turbo Pascal.  It accepts user input to
  4. dial Hayes compatable modems.  MS-DOS interrupts are used for RS232
  5. communications, it should work in the IBM and the host of compatables.
  6. If you have trouble communicating with the serial port, check and change
  7. as needed the value assigned to DL in talk.  It selects the COM port
  8. which runs the modem}
  9.  
  10. type str80 =string[80];
  11.  
  12.  
  13. {initialize for MS DOS interrupt call
  14. type
  15.      regipak = record ax,bx,cx,dx,bp,di,ds,es,flags:integer;
  16.      end;
  17. }
  18.  
  19. var
  20.     dm:byte;
  21.     mypak: registers;      {regipak; }
  22.  
  23.  
  24. {    Bah,Bal,bh,bl,ch,cl,Bdh,Bdl,bph,bpl,dih,dil,dsh,dsl: byte;}
  25.  
  26.     Bah,Bal,Bdh,Bdl: byte;
  27.     cx,len,ct:integer;
  28.     ir:byte;
  29.     dialit,LAST,NUMBER,personal,prefix:string[40];
  30.     dummy,digit:char;
  31.  
  32. procedure Send_Char;
  33. {Send characters to the modem}
  34. begin
  35.      with mypak do
  36.      begin
  37.      ax := Bah shl 8 + Bal;
  38.      dx := Bdh shl 8 + Bdl;
  39.      intr($14,mypak);
  40.      end;
  41. end;
  42.  
  43. procedure send_Num(Num:str80);
  44. {Break the number apart and TALK to the modem}
  45. begin
  46.     NUMBER:='ATDT'+Num+chr(13);
  47.     len:=length(number);
  48.     ct:=1;
  49.       while ct<=len do
  50.           begin
  51.           digit:=number[ct];
  52.           Bal:=ord(digit);
  53.           Bah:=1;
  54.           Bdl:=0;
  55.           Send_Char;
  56.           ct:=ct+1;
  57.        end;
  58. end;
  59.  
  60. procedure send_Code(InStr:str80);
  61. begin
  62.     len:=length(InStr);
  63.     ct:=1;
  64.       while ct<=len do
  65.           begin
  66.           digit:=InStr[ct];
  67.           Bal:=ord(digit);
  68.           Bah:=1;
  69.           Bdl:=0;
  70.           Send_Char;
  71.           ct:=ct+1;
  72.        end;
  73. end;
  74.  
  75. procedure setup;
  76. {set communications parameters}
  77. begin
  78.      Bdh:=0;
  79.      Bah:=0;
  80.      Bdl:=0;
  81.      Bal:=131;
  82.      Send_Char;
  83.      Bah:=4;
  84.      Bdl:=0;
  85.      Send_Char;
  86. end;
  87. procedure pickphone;
  88. begin
  89.    Clrscr;
  90.    Gotoxy(5,5);
  91.    Write('Pick Up yo phone and press a key to talk');
  92.    repeat until keypressed;
  93.    Send_Code('h0');
  94. end;
  95.  
  96.  
  97. PROCEDURE MAIN;
  98. {Get the number to dial or special commands}
  99. begin
  100.      setup;
  101.       if paramstr(1) = '' then
  102.       begin
  103.            writeln('');
  104.            write('Number to Dial ( . = quit  [enter] = last number): ');
  105.            readln(dialit);
  106.       end else dialit := paramstr(1);
  107.       If DialIt<>'' then
  108.       begin
  109.        send_Num(DialIt);
  110.        pickphone;
  111.       end;
  112. end;
  113.  
  114. BEGIN
  115. last:='';
  116. DialIt:='';
  117. clrscr;
  118.       main;
  119. Send_Code('ATH0');
  120. end.
  121. 
  122.