Unit Debmono |
************************************************* DESCRIPTION =========== This component allows a system with a Monochrome display attached as an alternate monitor to be used as a 25x70 event display and a 25x10 status area display. The event messages are upto 70 byte text messages that are written to the screen and then followed by the upo-arrow line to mark the most current line. So that multiple pgms can write to the screen the up-arrow line is searched for to locate the most current line. If the up-arrow line is not found the screen is cleared (it is assumed to be first time). The status messages begin with a 3 byte prefix. !nn where nn is a value between 0 and 24 (always 2 digits). It specifies the row number where the max 10 byte msg is written in cols 71 thru 80. INSTALLATION ============ To install the control, copy the debmono.* files to a directory on your Delphi library path and select the Options | Install Component menu item. USAGE ===== See (3) first as it is the most convenient method. (1) As a component. ------------------- The component is added to a form. I suggest renaming it to something short like DM so that the keystrokes are reduced. Then statements such as: DM.Text := Format('I=%d N=%.4x',[I,n]); will write a message to the mono screen without disturbing at all the windows environment (like changing window focus). The statement DM.Text := Format('!01I=%d',[I]); will replace the status line entry at line 1 of the status area with a display of the current value of I. Setting the property NoDisplay to non-zero will cause the message writing to be completely bypassed. It can be used to deactivate debug messages in production mode. Note that the overhead of creating the message still exists - only the displaying of it is bypassed. I have not found a convenient way in Pascal to turn off code like in C. Thats the price for 300,000 lines of code compiled per miniute. (Jan96 bulletin: See xDZ below). (2) As a function. ------------------ Sometimes it is not convenient to create other objects (such as inside a component) so the MonoText function can be called directly. It will have the same effect as setting a value to DM.Text (except that the test for NoDisplay) is bypassed. eg. MonoText('This will display'); MonoText(Format('!05Ctr:%.4d',[ctr])); (3) Recommended Approach (Nov95) -------------------------------- Use the DZ function and forget about components. It uses the format function internally so be familiar with how to format items. Eg. DZ('My msg <%s>',[s]); As of Jan96, this can easily be flipped to xDZ to kill the message. ASIDE ===== I discovered the Format function which is barely mentioned in the many Delphi books I have purchased and which does not exist in Turbo Pascal. The Format function is a concise way to create messages to send to the screen. It is similar to printf, so with my strong backgound in C I felt right at home. HARDWARE ======== A monochrome display can be attached to a system for around $50 ($15 card, $35 used display). It becomes a non-obtrusive debugging tool that can be used to report code paths with variables (event messages) or to monitor variable values (status messages). Note that under some memory manager systems it is necessary to use the switch DualDisplay=True in the [386enh] section of the SYSTEM.INI file. COPYRIGHTS ========== (c) S.Pritchard at Rexcel Systems Inc. 1995. This small piece of code is a contribution to the growing collection of free but useful Delphi components. It may be freely used in whatever way you choose provided the original source is acknowledged. For suggestions, improvements, comments please email to: spritchard@rexcel.com (preferred) or Compuserve 71221,1607 (Steve Pritchard.)
Classes |
TDebMono -
Functions |
DZ - -- Nov/06/95 -- Improvement --} { Realized did not need to be a component to allow
a nice interface.
MonoAddr - x86 NOP
MonoText - ************************************
Whenever called we copy Text to
the mono display.
Register -
xDZ - -- Jan/22/96 -- Improvement --} { Quick way to kill DZ statement by inserting an x in front.
Types |
Constants |
Variables |
Functions |
Types |
Constants |
Variables |