home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-386-Vol-2of3.iso / c / caty16.zip / CATY161.PAS < prev    next >
Pascal/Delphi Source File  |  1991-10-25  |  7KB  |  132 lines

  1. {$R-,V-,S-} (*Range, Var-String, Stack checking all off *)
  2. (*═══════════════════════════════════════════════════════════════════════*)
  3. (* Program:     CATYXXX.PAS (see CATY.GLO for full program information)  *)
  4. (* Author:      Donald J. Wilke, N3HGQ                                   *)
  5. (* Purpose:     Control program for Yaesu FT-767GX Transceiver.          *)
  6. (* Last update: CATYMVFO.PAS - 10/25/91                                  *)
  7. (* Usage:       Compile to .EXE file using Turbo Pascal V. 5.0 or later. *)
  8. (*              Requires RS-232 interface between computer & FT-767GX.   *)
  9. (*═══════════════════════════════════════════════════════════════════════*)
  10.  
  11. PROGRAM CATY;
  12.  
  13. USES
  14.    CRT, DOS,                                 (* Unit files general *)
  15.    CATYGLO, CATYUTIL, CATYDISP,              (* Specific to this pgm *)
  16.    CATYINST, CATYCOMM, CATYRTC;
  17.  
  18. (*═══════════════════════════════════════════════════════════════════════*)
  19. PROCEDURE DoQuit; (* Shut down communications and exit *)
  20.  
  21. BEGIN (* DoQuit *)
  22.    WINDOW(2,6,79,23);
  23.    CLRSCR;
  24.    TEXTCOLOR(DFG); TEXTBACKGROUND(DBG);      (* Default screen colors *)
  25.    PrMessage('Restoring the normal timer interrupt.',7);
  26.    RestoreOldTimer;                          (* Restore timer int vector *)
  27.    IF NOT Test THEN BEGIN
  28.       TurnCatOff;                            (* CAT's last life *)
  29.       Peep(1500);
  30.       CommExitProc;                          (* Close up shop *)
  31.       GOTOXY(30,9);
  32.       WRITE('Port COM1: closed OK.');
  33.       CommExitProc;                          (* Close up shop *)
  34.       GOTOXY(30,10);
  35.       WRITE('Port COM2: closed OK.');
  36.       DELAY(1000);                           (* Allow time to read *)
  37.       CLRSCR;
  38.       GOTOXY(34,9);
  39.       WRITE('Outta here.');
  40.       DELAY(1200);                           (* Allow time to read *)
  41.    END; (* IF NOT *)
  42.    WINDOW(1,1,80,25);
  43.    CLRSCR;                                   (* Clear screen on exit *)
  44. END; (* DoQuit *)
  45.  
  46. (*═══════════════════════════════════════════════════════════════════════*)
  47. PROCEDURE SetupFT767; (* Set up basic program functions & radio port *)
  48.  
  49. VAR
  50.    ClString2   : STRING;
  51.  
  52. BEGIN (* SetupFT767 *)
  53.    TimeZone    := 5;                         (* EST is default *)
  54.    TZ          := ' EST ';                   (* Set up default prompt *)
  55.    DirectVideo := TRUE;                      (* Don't use BIOS for video *)
  56.    Repeater    := FALSE;                     (* Default is simplex *)
  57.    CLRSCR;
  58.    IF PARAMCOUNT > 0 THEN                    (* Command line parameters *)
  59.       IF (PARAMSTR(1) = '/2') THEN BEGIN     (* Values for Radio on COM2: *)
  60.          RadioPort := 2;                     (* Radio on COM2: *)
  61.          RComVec   := $0B;                   (* Interrupt # for UART *)
  62.          RIRQM     := $08;                   (* IRQ mask for COM2: *)
  63.          RComBase  := $2F8;                  (* Port addr for COM2: *)
  64.       END (* IF PARAMSTR(1) *)
  65.       ELSE BEGIN                             (* Default values *)
  66.          RadioPort := 1;                     (* For Radio on COM1: *)
  67.          RComVec   := $0C;                   (* Interrupt # for UART *)
  68.          RIRQM     := $10;                   (* IRQ mask for COM1: *)
  69.          RComBase  := $3F8;                  (* Port addr for COM1: *)
  70.       END; (* ELSE *)
  71.       ClString2 := COPY(PARAMSTR(2),2,3);    (* Strip off '/' *)
  72.       FOR Index := 1 TO LENGTH(ClString2) DO (* Make upper case *)
  73.          ClString2[Index] := UPCASE(ClString2[Index]);
  74.       IF ClString2 = 'EDT' THEN TimeZone := 4;
  75.       IF ClString2 = 'EST' THEN TimeZone := 5;
  76.       IF ClString2 = 'CDT' THEN TimeZone := 5;
  77.       IF ClString2 = 'CST' THEN TimeZone := 6;
  78.       IF ClString2 = 'MDT' THEN TimeZone := 6;
  79.       IF ClString2 = 'MST' THEN TimeZone := 7;
  80.       IF ClString2 = 'PDT' THEN TimeZone := 7;
  81.       IF ClString2 = 'PST' THEN TimeZone := 8;
  82.       TZ := ' '+ClString2+' ';               (* Set up prompt *)
  83.    IF mem[$0040:$0049] = 7 THEN              (* Get video parameters *)
  84.       ScreenSeg   := $B000                   (* Monochrome display addr *)
  85.    ELSE ScreenSeg := $B800;                  (* CGA, EGA display addr *)
  86.    InitClock;                                (* Initialize clock int *)
  87.    MainFrame;                                (* Build screens framework *)
  88.    IF NOT Test THEN BEGIN                    (* This is for real *)
  89.       SetupSerialPort(RadioRate,RadioPort,RComVec,RComBase,RIRQM,'R');
  90.       TurnCatOn;                             (* To get initial UPDATE *)
  91.       CatSend(AClr,26);                      (* Turn off Split,Clar,Offs *)
  92.       TurnCatOff;                            (* Allow manual operation *)
  93.    END (* IF NOT *)
  94.    ELSE TestFile;                            (* Testing, read in sim Upd *)
  95. END; (* SetupFT767 *)
  96.  
  97. (*═══════════════════════════════════════════════════════════════════════*)
  98. PROCEDURE SetupTNC; (* Set up TNC port *)
  99.  
  100. BEGIN (* SetupTNC *)
  101.    IF PARAMCOUNT > 0 THEN                    (* Command line parameters *)
  102.       IF (PARAMSTR(1) = '/2') THEN BEGIN     (* Radio on 2/TNC on 1 *)
  103.          TermPort  := 1;                     (* Term on COM1: *)
  104.          TComVec   := $0C;                   (* Interrupt # for UART *)
  105.          TIRQM     := $10;                   (* IRQ mask for COM1: *)
  106.          TComBase  := $3F8;                  (* Port addr for COM1: *)
  107.       END (* IF PARAMSTR(1) *)
  108.       ELSE BEGIN                             (* Default values *)
  109.          TermPort  := 2;                     (* For Term on COM2: *)
  110.          TComVec   := $0B;                   (* Interrupt # for UART *)
  111.          TIRQM     := $08;                   (* IRQ mask for COM2: *)
  112.          TComBase  := $2F8;                  (* Port addr for COM2: *)
  113.       END; (* ELSE *)
  114.    SetupSerialPort(TermRate,TermPort,TComVec,TComBase,TIRQM,'T');
  115. END; (* SetupTNC *)
  116.  
  117. BEGIN (*================= MAINLINE CONTROL ROUTINE ======================*)
  118.    CLRSCR;
  119.    PrMessage(Title,2);                       (* Put up header *)
  120.    PrMessage(Version + Rig + Credit,3);
  121.    ZeroVariables;                            (* Initialize all globals *)
  122.    Echo     := 'UUUUU';                      (* Can't use nulls for this *)
  123.    FILLCHAR(MemArray,SIZEOF(MemArray),' ');  (* Initialize text array *)
  124.    QuitFlag := FALSE;                        (* Set Quit flag *)
  125.    SetupFT767;                               (* Set up Radio port *)
  126.    SetupTNC;                                 (* Set up TNC port *)
  127.    REPEAT MainMenu; UNTIL QuitFlag;          (* Loop `til EXIT key (F10) *)
  128.    Quit := TRUE;                             (* It must be true *)
  129.    DoQuit;                                   (* Do an orderly shutdown *)
  130. END. (* MAINLINE CONTROL ROUTINE and CATY.PAS *)
  131.  
  132.