home *** CD-ROM | disk | FTP | other *** search
-
- *****************************************************
- * TPATCH: Turbo File Patching Utility, Version 2.00 *
- *****************************************************
-
- (C) Copyright 1987 Brian Foley, TurboPower Software
- CompuServe 76317,3247
-
- This program is released into the public domain for personal,
- non-commercial use only. It may be freely copied and distributed so
- long as no fee is charged, either for the program itself or the
- distribution of it.
-
- What TPATCH does
- ================
- TPATCH.COM is a utility for programs compiled with Turbo Pascal (PC-DOS,
- versions 3.00B-3.02A). It allows you to examine the status of certain
- settings--colors, mIn and mAx heap, display mode, etc.--and, if requested,
- to change them without recompiling. It also allows you to make a few
- simple patches to Turbo compilers. Here is the output that would be
- generated by entering
-
- TPATCH tpatch
-
- at the command line (I've added the numbers to the left, in parentheses):
-
- TPATCH, Turbo File Patching Utility, Version 2.00
- (C) Copyright 1986 by Brian Foley
- Examining TPATCH.COM
- (1) Compiled with Turbo Pascal version 3.01A (plain vanilla)
- (2) Monochrome
- (3) NormVideo $0F (White on Black)
- (4) LowVideo $07 (Light Gray on Black)
- Black & white
- NormVideo $0F (White on Black)
- LowVideo $07 (Light Gray on Black)
- Color
- NormVideo $0E (Yellow on Black)
- LowVideo $07 (Light Gray on Black)
- (5) Display mode $FF "Default display mode"
- (6) Device checking {$D+}
- (7) ^Break checking {$C+}
- (8) ^C checking {$U-}
- (9) Code size $0564 paragraphs
- (10) Data size $003D paragraphs
- (11) mIn stack $0400 paragraphs
- (12) mAx stack $2000 paragraphs
- (13) Input buffer (N/A)
- (14) Output buffer (N/A)
-
- -P and -O options
- =================
- If you want to change some of these items, use the "-P" (Patch Mode) option and
- you will be prompted for new settings. By default, any changes you request
- will be made directly to the COM file itself. If you want to play it safe,
- you can have TPATCH write a new version of the program that incorporates
- the changes by using the "-O" (Output file) option and specifying a
- filename. If the "-O" option is specified, Patch Mode is selected
- automatically.
-
- Items displayed, Making changes
- ===============================
- (1) Version: The version of the Turbo compiler that was used to
- generate the executable file. TPATCH recognizes the runtime
- library for most DOS versions of the Turbo compiler, from 1.00A up
- to 3.02A. However, it will only report the default settings for,
- and permit changes to, programs compiled with PC-DOS Turbo 3.00B
- and higher (including BCD and 8087 versions).
- (2) Monochrome (Black & white, Color): The runtime library keeps three
- sets of video attributes--one for monochrome adapters, one for
- composite black and white monitors attached to color cards, and
- one for color monitor-adapter combinations.
- (3) NormVideo: The video attribute used for NormVideo (aka HighVideo),
- the default. If you aren't familiar with video attributes, but
- want to change them, here's a simple Pascal function that takes
- foreground and background colors as parameters, and returns a
- video attribute (with the blink bit masked out):
-
- function Attribute(Foreground, Background : Byte) : Byte;
- {-Translates foreground and background colors into video attributes.
- "And 127" masks out the blink bit. Add 128 to the result to set it.}
- begin
- Attribute := ((Background shl 4)+Foreground) and 127;
- end;
-
- You may change NormVideo for any or all of the three sets of
- attributes. Number must be in the range 0-$FF (enter in decimal or
- hex, either one).
- (4) LowVideo: The video attribute used for LowVideo. You may change
- LowVideo for any or all of the three sets of attributes. Number
- must be in the range 0-$FF (enter in decimal or hex, either one).
- (5) Display mode: A Turbo compiler fresh out of the package will have
- $FF (= default display mode) here, which is what it should be.
- If you need to change this, the valid entries are:
-
- 0 : b/w display 40x25
- 1 : Color display 40x25
- 2 : b/w display 80x25
- 3 : Color display 80x25
- 7 : Monochrome display
- $FF : Default display mode
-
- The string that goes with this byte is shown in quotation marks.
- If you alter the mode, TPATCH supplies the corresponding string.
- Enter the appropriate number in decimal or hex, either one.
- (6) Device checking: Default is D+. You may change this by entering
- '-' (just the minus) for $D- or '+' (just the plus) for $D+. This
- option does nothing unless the program uses DOS standard I/O. If
- $D- is used, all I/O is buffered, no matter what.
- (7) ^Break checking: Default is $C+. You may change this by entering
- '-' (just the minus) for $C- or '+' (just the plus) for $C+.
- Affects only the *initial* setting for CBreak (the well-known
- global variable), which determines whether break checking is on.
- (8) ^C checking: Default is $U-. You may change this by entering '-'
- (just the minus) for $U- or '+' (just the plus) for $U+. When you
- set $U+ (anywhere in your program, but normally at the top), the
- compiler fills your program with breakpoint instructions (INT
- 3's), and sets a flag telling the runtime library to install an
- interrupt handler to trap INT 3 and check for a ^C at *every*
- breakpoint. TPATCH lets you determine whether that interrupt
- handler gets installed or not by setting the flag on or off. You
- can thus speed up the execution of a program compiled with $U+ (a
- bit), since the default INT 3 handler will *usually* point to a
- simple IRET. Or you can simulate a selective $U+ by inserting
- "Inline($CC);" statements into your code at strategic locations
- (as opposed to everywhere) and use TPATCH to see that the
- interrupt handler gets installed.
- (9) cOde size: There is no reason for changing this unless you are
- using chain files. If you are, you'll know what this is good for;
- if not, don't worry. You may enter *any* integer value here (the
- number of 16-byte paragraphs), either in decimal or in hex, so be
- careful.
- (10) Data size: Ditto.
- (11) mIn heap: mIn will usually be $400 paragraphs (16K bytes). You
- may enter any integer value in the range $40-$B000 (paragraphs)
- here, either in decimal or in hex.
- (12) mAx heap: mAx will usually be set to $A000 paragraphs (640K
- bytes), insuring that all available memory gets allocated for your
- program. You may enter any integer value in the range $40-$B000
- (paragraphs) here, either in decimal or in hex.
- (13) Input buffer: The size of the buffer created with the $G (Get)
- compiler directive, used to permit redirected input. "(N/A)" is
- displayed if the buffer size is 0, indicating that redirection is
- not enabled. This value cannot be changed. (At least not in this
- version--I'm not sure it's safe.)
- (14) Output buffer: The size of the buffer created with the $P (Put)
- compiler directive, used to permit redirected output. "(N/A)" is
- displayed if the buffer size is 0, indicating that redirection is
- not enabled. This value cannot be changed. (Again, not sure it's
- safe.)
-
- -I and -A options
- =================
- New in TPATCH 2.00 are the -I and -A options, which give you an easy way
- to do nothing except reset mIn (-I) and mAx (-A) heap settings. If you use
- CED, you may want to define a synonym such as
-
- minmax syn 'tpatch %1 -i $%2 -a $%3'
-
- If you're one of the six people who don't, you could also construct a
- batch file to accomplish the same thing. These options can also be used to
- reset the default mIn/mAx on Turbo compilers. (See the discussion of the
- -S option, below.)
-
- -C option
- =========
- Those are the settings that are shown ordinarily. If you select the "-C"
- option, however, things look a little different. This option activates
- "Colors Only Mode". It is selected automatically if the .COM file being
- examined is a Turbo compiler. If Colors Only Mode is activated, items (6)
- through (14) are not shown. Instead, two more attribute settings are
- displayed for each of the three sets: "Marked blocks" (the attribute used
- to display marked blocks inside the Turbo editor) and "Error messages" (the
- attribute used to display error messages both in the editor and in the
- compiler--the kind that require you to press the Escape key to continue).
- These are displayed and changed in the same manner as NormVideo and
- LowVideo. In addition, the status of the "Snow checking" flag is shown
- (TINST asks if your display "flickers when it scrolls"--not quite
- accurate). (All of the extra items are in the runtime libraries of programs
- compiled with Turbo, but they aren't used.) Entering [Y] turns Snow
- Checking on, [N] turns it off.
-
- If you use plain vanilla Turbo 3.01A and you enter
-
- TPATCH turbo
-
- at the command line, this is what the display will look like:
-
- TPATCH, Turbo File Patching Utility, Version 2.00
- (C) Copyright 1987 by Brian Foley
- Examining TURBO.COM
- This is Turbo Pascal version 3.01A (plain vanilla)
- Monochrome
- NormVideo $0F (White on Black)
- LowVideo $07 (Light Gray on Black)
- Marked blocks $07 (Light Gray on Black)
- Error messages $70 (Black on Light Gray)
- Black & white
- NormVideo $0F (White on Black)
- LowVideo $07 (Light Gray on Black)
- Marked blocks $07 (Light Gray on Black)
- Error messages $70 (Black on Light Gray)
- Color
- NormVideo $0E (Yellow on Black)
- LowVideo $07 (Light Gray on Black)
- Marked blocks $07 (Light Gray on Black)
- Error messages $4F (White on Red)
- Snow checking ON
- Display mode $FF "Default display mode"
-
- Although the "-C" option is intended mainly for Turbo compilers, it is
- perfectly acceptable to use it with your own programs. (See the
- discussion of the -F option, below.)
-
- -S option
- =========
- Also new in TPATCH 2.00 is the -S option, to Show all compiler options
- (well, all that TPATCH knows about). This allows you to examine the
- default settings for mIn and mAx heap, as well as the more common compiler
- directives. After displaying the usual compiler information discussed
- above, TPATCH will ask you to press a key to continue, then display the
- following:
-
- mIn stack $0400 paragraphs
- mAx stack $A000 paragraphs
- I/O checking {$I+}
- Range checking {$R-}
- Break checking {$C+}
- ^C checking {$U-}
- Stack checking {$K+}
- Type checking {$V+}
- Device checking {$D+}
-
- As with compiled programs, these settings can be changed if Patch Mode
- (-P) is in effect. Before changing any of these, be sure to consider
- carefully the consequences, especially if you are in the habit of
- distributing the source code for your programs.
-
- -F option
- =========
- Selects the Fast screen update option, which installs the alternate ConOut
- driver from my CONOUT.PAS. By default, this option must be selected each
- time you run the program. However, if you wish, you can patch TPATCH to
- install the driver automatically. To do so, run TPATCH on itself in Colors
- Only Mode by entering
-
- TPATCH tpatch -C -P [-O newfile]
-
- Press [Enter] at all the prompts except the "Snow checking" one--for it,
- answer [N]. The alternate driver will then always be installed, and the -F
- option ignored. Try the -F option first before making the patch. (Please
- don't distribute altered versions of TPATCH.)
-
- Default extension
- =================
- TPATCH always assumes that the extension for a filename passed to it as a
- parameter is .COM -- you can include it or omit it, doesn't matter.
-
- Feedback
- ========
- That's it. Let me know if you have any comments, complaints, bug reports,
- etc. As noted above, I can be reached via CompuServe [76317,3247].