home *** CD-ROM | disk | FTP | other *** search
/ RBBS in a Box Volume 1 #2 / RBBS_vol1_no2.iso / 050z / dial.pas < prev    next >
Pascal/Delphi Source File  |  1986-04-05  |  3KB  |  121 lines

  1. program dial;
  2.  
  3. {This program is written using Turbo Pascal.  It accepts user input to
  4. dial the Hayes SmartModem 1200.  MS-DOS interrupts are used for RS232
  5. communications, so even though this was written on a Tandy 2k, it shoul
  6. work in the IBM and the host of compatables.  If you have trouble
  7. communicating with the serial port, check and change as needed the
  8. value assigned to DL in talk.  It selects the COM port which runs the modem}
  9.  
  10. {initialize for MS DOS interrupt call}
  11. type
  12.      regipak = record ax,bx,cx,dx,bp,di,ds,es,flags:integer;
  13.      end;
  14.  
  15. var
  16.     dm:byte;
  17.     mypak: regipak;
  18.     ah,al,bh,bl,ch,cl,dh,dl,bph,bpl,dih,dil,dsh,dsl: byte;
  19.     cx,len,ct:integer;
  20.     ir:byte;
  21.     dialit,LAST,NUMBER,personal,prefix:string[40];
  22.     dummy,digit:char;
  23.  
  24. procedure talk;
  25. {Send characters to the modem}
  26. begin
  27.   textcolor(14); textbackground(1);
  28.      with mypak do
  29.      begin
  30.      ax := ah shl 8 + al;
  31.      dx := dh shl 8 + dl;
  32.      intr($14,mypak);
  33.      end;
  34. end;
  35.  
  36. procedure send_line;
  37. {Break the number apart and TALK to the modem}
  38. begin
  39.     NUMBER:=CONCAT(prefix,DIALIt,chr(13));
  40.     len:=length(number);
  41.     ct:=1;
  42.       while ct<=len do
  43.           begin
  44.           digit:=copy(number,ct,1);
  45.           al:=ord(digit);
  46.           ah:=1;
  47.           dl:=0;
  48.           talk;
  49.           ct:=ct+1;
  50.        end;
  51. end;
  52.  
  53. procedure setup;
  54. {set communications parameters}
  55. begin
  56.      ah:=0;
  57.      dl:=0;
  58.      al:=131;
  59.      talk;
  60.      ah:=4;
  61.      dl:=0;
  62.      talk;
  63. end;
  64.  
  65. procedure hangup;
  66. {What else, but hang up the modem}
  67. begin
  68.     textbackground(7); textcolor(1);
  69.     gotoxy(26,20);
  70.     writeln(' Hit [ENTER] to hang up modem ');
  71.     read(dummy);
  72.     dialit:='h0';
  73.     send_line;
  74. end;
  75.  
  76.  
  77. PROCEDURE MAIN;
  78. {Get the number to dial or special commands}
  79. begin
  80.   textcolor(14); textbackground(1);
  81.      setup;
  82.            writeln(''); gotoxy(10,05);
  83.            write('Number to Dial ( . = quit  [ENTER] = last number): ');
  84.            readln(dialit);
  85.               if dialit='' then
  86.               begin
  87.               dialit:=last;
  88.               end;
  89.            LAST:=DIALIT;
  90.      if last<>'.' then
  91.      begin
  92. gotoxy(37,12);
  93. write ('Dialing ');
  94. gotoxy(37,14); textbackground(4); textcolor(15);
  95. writeln(dialit);
  96.      send_line;
  97.      hangup;
  98.      clrscr
  99.      end;
  100. clrscr
  101. end;
  102.  
  103. BEGIN
  104. textcolor(14); textbackground(1);
  105.  {Get and store the prefix code and get down to business}
  106.  clrscr;
  107.  gotoxy(07,08);
  108.  writeln(' Enter personal dialing code  (MCI access etc) or [enter] for none ');
  109.  gotoxy(11,10);
  110.  writeln(' This code remains active for the complete dialing session ');
  111.  gotoxy(30,12);
  112.  readln(personal);
  113.  prefix:=concat('ATDT',personal);
  114.  clrscr;
  115.      WHILE LAST<>'.' do
  116.      begin
  117.      main;
  118.      end;
  119. last:='ddd';
  120. end.
  121.