home *** CD-ROM | disk | FTP | other *** search
-
- {$R+}
- {$V-}
- Program Instx; { CIS Version 2.10 }
- {----------------------------------------------------------------------}
- { Install the Turbo User Options }
- {----------------------------------------------------------------------}
- { Purpose: Install Patches/Zaps to Load Modules }
- { (specifically the Turbo compiler) }
- { }
- { Methods: Zaps are identified within a file by the concatenation of }
- { a set of keywords consisting of: }
- { }
- { "TITLE VERSION" }
- { }
- { where "TITLE" is choosen by the user and "VERSION" }
- { is a string derived from the first instruction in }
- { the binary file to receive the zap. The default Zap file }
- { is INSTX.ZAP which may be overridden by Menu item 1 }
- { }
- { Input: A zap text (patch) file consisting of Version identifiers,}
- { Zap title + Version, zap offset, zap length, zap bytes, }
- { followed by a zero. }
- { }
- { A source copy of the binary file to receive the zap. }
- { This file will be copied; not modified. }
- { }
- { Output: A copy of the source input file modified by the specified }
- { zap(s). }
- { }
- {----------------------------------------------------------------------}
- { Maintenance Version }
- { 9.08.85 2.10 Correct Comspec/Path parm error for eXecution }
- { Add Blinking attribute to Zap Color Window }
- { }
- {----------------------------------------------------------------------}
- { Install the PcDos Turbo eXecute Command }
- {----------------------------------------------------------------------}
- Type
- Option_Choices = (None, Zap_Data, Com_Names, Edit_Intensity,
- Edit_Colors, X_command, User_Zap, Exit_Pgm);
-
- ZapTypes = (No_Zap,Zap_Edit_Intensity, { Zaps in Data File}
- Zap_Edit_Colors, Zap_X_Command,
- User_Zap_type);
-
-
- ParmString = String[255] ; { Dummy definition for parms }
-
- Const
- Max_Versions = 8 ; { Number of Turbo Versions }
- Actual_Versions :integer = Max_Versions;{ Versions acutally found}
- Max_string = 60; { Max Menu Title length }
- Max_Items = 7; { Maximum menu items below }
- { Menu items }
- Menu_Items: array[1..Max_Items] of string[Max_String] =
- (' Specify Input Zap Data File ',
- ' Specify Input/Output .COM File Names ',
- ' Reverse Edit Intensity Attributes ',
- ' Specify Edit Screen Colors ',
- ' Install the eXecute Command ',
- ' User Specified Zap ',
- ' Exit this program ' );
-
-
- Zap_Headers: array[Zap_Edit_Intensity..User_Zap_Type] { Define Zap }
- of string[10] = { Headers }
- ('INTENSITY', 'COLORS', 'XCOMMAND', 'USER');
-
- ComIN_Filename : string[64] = 'TURBO.COM'; { Input command file }
- ComOUT_Filename : string[64] = 'TURBX.COM'; { Output command file}
- Zap_Filename : string[64] = 'INSTX.ZAP'; { Default input data }
-
- Ok :boolean = false; { Boolean trash collector }
-
- Var
- Zap_File :text; { Zap input data file }
- ComIN_File : File of Byte; { Input Command File }
- ComOUT_File : File of Byte; { Output Command File }
- ComStartAddr:integer; { Compiler Code start addr }
- Option :integer;
- Choice :Option_Choices; { Set of User choices }
- i,j,
- x,y :integer;
- Return_Code :integer;
- A,B :byte;
-
- Zap_Type : Zaptypes; { Parameter Strings passed to }
- Version_Key :array[0..Max_Versions] of
- record { Version 0 is no version }
- Verify : integer; { Unique Versify address }
- UniqueWord : integer; { contents at versify addr }
- Name : string[8]; { 'PC300B','PC301A' etc. }
- end;
- Version : integer; { Set to current Version index }
-
- {$I Nwindo.200} { Window Procedures }
- {$I Menu.210} { Menu Display Function }
- {$I CopyFile.200} { Duplicate a File }
- {$I MakeZap.200} { Make Zaps to Output File }
- {$I TPVers.200} { Open and find Compiler Version }
- {$I Scolor.200} { Select Compiler Color Option }
- {$I Zcolor.210} { Zaps Colors into Compiler }
- {-----------------------------------------------------------------------}
- { G e t U s e r F i l e n a m e }
- {-----------------------------------------------------------------------}
- Procedure Get_User_Filename (Var FileName :ParmString;
- var Return_Code :integer);
- Var
- TempString : string[64] ;
- TempFile : File ;
- Begin
- Readln(TempString); { user want new zap file }
- If (TempString = '') then TempString := FileName; { Assign Default }
- For I := 1 to length(TempString) do
- TempString[I] := UpCase(TempString[I]);
- Assign(TempFile,TempString); { filename if Cr }
- {$I-} Reset(TempFile); {I+}
- Return_Code := IOresult ;
-
- Close(Tempfile); { Close file for now..used later}
- FileName := TempString; { Assign the final File name }
- End; { Get_User_Filename }
- {----------------------------------------------------------------------}
- { G e t Z a p I n p u t D a t a F i l e }
- {----------------------------------------------------------------------}
- Procedure Get_Zapdata_file ; { Open user Specified Zap data }
- Begin
-
- Get_Abs_Cursor(x,y); { Get current cursor position }
- MkWin(x,y+1,x+40,y+6,Green); { Make an input window }
- Textcolor(Green);TextBackground(Black);GotoXy(1,1);
-
- Repeat
- Write(' Patch (Zap) Data File ');
- NormVideo;
- Writeln(chr(16),' ',Zap_Filename,' ',chr(17));
- LowVideo;
-
- Writeln(' Enter New File or <Return> to Accept ');
- Get_User_Filename(Zap_Filename,Return_Code);
-
- If (Return_Code <> 0 ) then Writeln(' ', Zap_Filename, ' not found');
- Until (Return_Code = 0 );
- RmWin; { Remove the Window }
- End; { Get_Zapdata_file }
- {----------------------------------------------------------------------}
- { C o m _ N a m e s : G e t .C o m F i l e N a m e s }
- {----------------------------------------------------------------------}
- Procedure Get_Com_Names ; { Open user Specified Command Files }
- Begin
-
- Get_Abs_Cursor(x,y); { Get current cursor position }
- MkWin(x,y+1,x+48,y+8,Blue); { Make an input window }
- Textcolor(Yellow); TextBackground(Blue); Clrscr;
-
- Repeat { until ComIN_filename <> ComOUT_Filename }
-
- Repeat { Get Input .COM File }
- Write(' Default ');
- NormVideo; Write('Input'); LowVideo;
- Write(' .COM File '); { Ask user for input }
- NormVideo; { or take the default }
- Writeln(chr(16),' ',ComIN_Filename,' ',chr(17));
- LowVideo;
- Writeln(' Enter New File or <Return> to Accept ');
- Get_User_Filename(ComIN_Filename,Return_Code);
- If (Return_Code <> 0) then Writeln(' ', ComIN_Filename, ' not found');
- Until (Return_Code = 0 );
-
- Write(' Default '); { Get OUTput filename }
- NormVideo; Write('Output'); LowVideo;
- Write(' .COM File '); { Ask user for input }
- NormVideo; { or take the default }
- Writeln(chr(16),' ',ComOUT_Filename,' ',chr(17));
- LowVideo;
- Writeln(' Enter New File or <Return> to Accept ');
- Get_User_Filename(ComOUT_Filename,Return_Code);
-
- If (ComIN_Filename = ComOUT_Filename) then
- Begin
- NormVideo;
- Writeln('Specify Separate Files for Input/Output Please');
- LowVideo;
- End;
-
- Until (ComIN_Filename <> ComOUT_Filename);
- { Copy Compiler to Work File }
- CopyFile(ComIN_Filename,ComOUT_Filename,Return_Code);
-
- RmWin; { Remove the Window }
- End; { Get_Com_Names }
- {----------------------------------------------------------------------}
- { Z a p I n t e n s i t y : Transpose Compiler Edit Intensity }
- {----------------------------------------------------------------------}
- Procedure Zap_Intensity; { Reverse Compiler Intensity }
- Begin
-
- Get_Abs_Cursor(x,y); { Get current cursor position }
- MkWin(x,y+1,x+48,y+8,White); { Make an input window }
- Textcolor(Green); TextBackground(Black); Clrscr;
-
- Open_Compiler; { Open Compiler/Get Version }
- If (Return_Code = 0) then
- Begin
-
- Zap_Type := Zap_Edit_Intensity; { Pass parm to cause }
- Make_Zap(Zap_Type,Return_Code); { Compiler Intensity zaps }
-
- If (Return_Code <> 0) then
- Begin { Write Error msg and pause }
- Pause(' Error Processing Intensity Zap ');
- end;
- If (Return_Code = 0) then
- Begin
- Pause(' Compiler Intensity Zaps Completed ');
- end;
- end;
- Close(Zap_file);Close(ComOut_File);
- RmWin;
- End; { Zap_Intensity }
- {----------------------------------------------------------------------}
- { Z a p X c m d : Install the PCDos eXecute Command }
- {----------------------------------------------------------------------}
- Procedure Zap_Xcmd; { Install the PCDos Turbo eXecute command }
- Begin
-
- Get_Abs_Cursor(x,y); { Get current cursor position }
- MkWin(4,y+1,76,y+9,Magenta); { Make an input window }
- Textcolor(White); TextBackground(Red); Clrscr;
-
- Open_Compiler; { Open Compiler/Get Version }
- If (Return_Code = 0) then
- Begin
-
- Zap_Type := Zap_X_Command; { Pass parm to cause }
- Make_Zap(Zap_Type,Return_Code); { Compiler eXecute zaps }
-
- If (Return_Code <> 0) then
- Begin { Write Error msg and pause }
- Pause(' Error Processing eXecute Zap ');
- end;
- If (Return_Code = 0) then
- Begin
- Pause(' Compiler eXecute Zap Completed ');
- end;
- end;
- Close(Zap_file);Close(ComOut_File);
- RmWin;
- End; { Zap_Intensity }
- {----------------------------------------------------------------------}
- { U s e r Z a p : Execute a user specified zap from file }
- {----------------------------------------------------------------------}
- Procedure User_Specified_Zap; { Install a User Specified zap }
- Var { whose key we will obtain from}
- TempStr :string[80]; { the console, then match up }
-
- Procedure Exit_Out; { Provide Cleanup and Exit Rtn }
- Begin
- Close(Zap_file);Close(ComOut_File);
- RmWin;
- End;
-
- Begin { with a Zap title in the file }
- Get_Abs_Cursor(x,y); { Get current cursor position }
- MkWin(4,y+1,76,y+9,Cyan+Bright); { Make an input window }
- Textcolor(White); TextBackground(Blue); Clrscr;
-
- Open_Compiler; { Open Compiler/Get Version }
- If (Return_Code = 0) then
- Begin
- Zap_Type := User_Zap_Type; { Index is User Zap type }
- Writeln(' Enter the search Keyword for this ZAP:');
- Readln(TempStr); { Ask user for the zap Key }
-
- If (Ord(TempStr[0]) < 1) or (TempStr[1] <= ' ')
- then Begin Exit_Out; Exit; End;
-
- Zap_Headers[User_Zap_Type] := TempStr;
- Make_Zap(Zap_Type,Return_Code); { Find and Make the Zap }
-
- If (Return_Code <> 0) then
- Begin { Write Error msg and pause }
- Pause(' Error Processing User Zap ');
- end;
- If (Return_Code = 0) then
- Begin
- Pause(' User Specified Zap Completed ');
- end;
- end;
- Exit_Out;
- End; { User_Specified_Zap }
- {----------------------------------------------------------------------}
- { S a y B y e B y e : Terminate Program }
- {----------------------------------------------------------------------}
- Procedure Say_ByeBye;
- Begin
- Writeln (' Bye Bye');
- End ;
- {----------------------------------------------------------------------}
- { M a i n P r o c e d u r e }
- {----------------------------------------------------------------------}
- Begin {Main}
-
- {----------------------------------------------------------------------}
- { S h o w M e n u O p t i o n s }
- {----------------------------------------------------------------------}
- MkWin(1,1,Max_String,Max_Items+8,Yellow); { Make an Options Window }
-
- Repeat {until Choice = Exit_Pgm}
- Textcolor(Bright+Cyan); TextBackground(Green);
- Option := Menu(Max_Items,Menu_Items); { Fetch User Choice }
- Choice := Option_Choices(Option); { Translate to Case }
-
- Case Choice of { Execute Sub-Menu Options }
- Zap_data : Get_Zapdata_file;
- Com_names : Get_Com_names;
- Edit_Intensity : Zap_Intensity;
- Edit_Colors : Zap_Colors;
- X_command : Zap_Xcmd;
- User_Zap : User_Specified_Zap;
- None,Exit_Pgm : Say_ByeBye
-
- else
- Begin
- Beep(600);
- Clrscr;
- Pause ('...Undefined program funtion.');
- end;
- end; { Case Choice }
- Until (Choice = Exit_Pgm) or (Choice = None);
- RmWin;
-
- (**)
- End. { Main }
- {......................................................................}