;
                                   BCOMP.COM                                  

             Size (recs) CRC   Version    Author/Latest Issue      Disk
BCOMP.COM      8k (61)   4C77  2.10       Rob Friefeld 5/90        Z3COM1
BCINST.COM     5k (37)   93C4  2.10       Rob Friefeld 5/90        Z3COM1

   1- Syntax  2- Commands  3- Notes  4- Patching  5- Help File  6- BCOMP.HLP  

   BCOMP  compares  two  binary files visually.   It  allows  you  to  compare 
selected sections of each file,  or of a file and memory.   The files are read 
into memory and both shown on screen,  a sector at a time.   You can then move 
about  freely through them.   While BCOMP is good for showing file patches  or 
corruptions,  it  doesn't  work if the files aren't in sync.   Ambiguous  file 
specs are accepted.  See BCOMP.HLP for details on usage.

   Requires ZCPR 3.0+ or Z3PLUS,  79 x 24 CRT (minimum) with  TCAP support for 
EREOL, CLS, GOTOXY.  Use the NZTCAP4D to benefit from cursor on/off control.
:1
   Syntax   BCOMP [du:|dir:]file1 [du:|dir:][file2] [/]

   File1 is shown on a split screen with File2.   BCOMP enables  the  user  to 
compare the two files with  any relative offset.   With the  built-in patcher,
code may be moved from one file to the other.
   
   If no FILE2, then FILE1 name is used again.  

   If no DU:FILE2, then second window is memory.  

   For convenience, file names are wild-carded if the "/" option is used.

   If FILE1 does not require all the buffer space  allocated to it,  the extra 
space is released to FILE2.   Therefore,  FILE1 should  be the  smaller of the 
two files.

   BCOMP is intended  for  executable  binary  files.   Files  larger than 64k
(.LBRs, .OVR) can be compared with BCOMP,  but as the addrs  wrap  past FFFFh,
their  display  becomes  meaningless.   (The  record  number  display  remains
correct.)
 Usage - 1/2 

1) Compare two similar files.

If you just want to know -- Are two files the same or not? -- run an automatic
comparison program such as COMP.   BCOMP is interactive.  It gives each file a
window in which you  can examine  any part  of the file  and compare it to the
other one visually or automatically.

        Example: BCOMP vers1.com vers2.com 

        VERS1 is the original version of a program which you have
        laboriously installed as VERS2.  You can see the differences
        as well as make further changes.
 Usage - 2/2  

2) Compare disk file to memory image.

If only one file name is  specified  on  the  command line,  the second window 
looks at RAM.   You may want  to  use this  to compare  ENV or TCAP files with 
those  currently loaded.   You can  also  usually  compare  disk  with  memory 
images of type3 or type4 programs after they run.

	Example:  BCOMP sys.env
                

3) Patch a file or cross-patch file/file or file/RAM.

The patcher is roughly similar to  ZPATCH,  except that two  files are open at
once.   Use the second file  for reference,  update  a file from changes poked 
into high memory (e.g. TCAP or ENV segments), or manually move in overlays.
:2
 Program Commands:  COMPARING FILES 

   The display shows  128 bytes of the  first  file  on the  upper half of the 
screen and 128 bytes of the second file on the lower half.  The alternate file
displays a "**" in the HEX field where the two files are identical, a la COMP.


AUTO-COMPARE:
   Find the next byte in which  the files differ.   Display both files at that 
byte.   If the display did  not start with the files in sync, then the command 
will only move a single byte ahead.  If no difference is found, an EOF message
shows on the status line.  If the entire file did not fit into memory, read in
more and continue the comparison.


VIDEO TOGGLE:
   Toggle highlighting of bytes in active window that are different from those
in the alternate window.   When only a few bytes differ,  it is much easier to 
see them this way.  Default is OFF.  
 Program Commands:  MOVING IN A FILE 


   The display move forward by screen, line, byte, or to end of file.   It can 
move back by screen,  line,  byte or the start of file.   It can  also move by 
record number or address.
 Program Commands:  MOVING BETWEEN FILES 


SWITCH FILES:  Toggle
	Cursor moves from one file to the other.


ECHO MODE:  Toggle
   Echo mode repeats  a command for both files so you can move through them in
tandem.  The right upper screen shows a reminder when in echo mode.
 Program Commands:  READING FILES 

   If BCOMP printed a "memory full" message,  more of the file may be read in.
The new read replaces data currently in memory.   If there is no more to read,
you may start again at the beginning of the file.
   If the MEMORY window is used instead of  a second file,  twice  the  buffer
space is available.
 Program Commands:  ADDRESS AND OFFSET - 1/2 


SET ADDRESS:
   A hex (or decimal preceded by #) address is entered.  The display then goes
to that address relative  to the  current offset.   An  address beyond what is 
currently in memory will go to either the start or end of the buffer.
   Address may also be set  relative to the  current location with  +/-nn.  To 
advance 19H, use +19.
   If the offset is 100h,  address 100 is  the  beginning of  the  file.   The
address disply is  OK until  64k of file is  read in, then it wraps to 0.  The
24 bit math needed to go beyond address FFFFh has not been implemented.

     
SET OFFSET:
   Input a new hex offset.  For files, the address display will change but the
record number will not.   If an appropriate offset is chosen, the address will 
correspond to the location of the  file  memory image  when running.   Default 
offset for files is  taken from the file type (e.g. COM,  RCP,  ENV) after the 
manner of  ZPATCH.   Type 3 environment files will  be displayed at their load 
address offsets.
 Program Commands:  ADDRESS AND OFFSET - 2/2 

   For the memory window,  the address display is always absolute.   An offset 
is used to calculate a number for the record display.  For example, if you run
a Type3 program, then run BCOMP to look at the file,  the memory offset can be 
set to the program's load address (8000h).   The  file and memory windows will 
then show the same addresses and record numbers as you compare the file to its
memory image.


GO TO RECORD:
   Input a decimal (or hex with # trigger) record number to jump to.  It is up
to you to pick a record currently in memory.   BCOMP does not  random read the 
file looking for your record.  Record count display is OK to 8 meg file max.


CALCULATE:
   The hex calculator from MU3 is included.   It does addition and subtraction 
as well as decimal-hex conversion.
 Program Commands:  FIND STRING 


FIND:
     Find the series of hex bytes entered.  
Syntax (taken from POKE):   val1 val2 .. valn "text string...  No  further hex 
bytes may follow the string trigger.  Note there is NO terminating ".  The hex
input routine (from MU3) will accept decimal bytes with the # preface.


REPEAT FIND:
   Look for the same series again.  The string is maintained when switching to
the alternate file.
:3
 BCOMP Notes - 1/4 

   a. Installation:

      BCINST.COM is  a screen-oriented  control  key installation  program for 
      BCOMP.   In  addition to  getting  any  changes  you want to make in the 
      control key bindings, it updates the internal help screen.  Get the help
      screen with "?" or "/" while running BCOMP.  [You could also patch BCOMP
      using BCOMP itself:  do the patching in the memory window,  try out your 
      changes, move them to the file window and save it.]
 BCOMP Notes - 2/4  

   b. Version 2.1 updates (5/3/90):
      - Changed handling of FCB's to avoid resetting any control bytes.  BCOMP
        now works with Z3PLUS.
      - Added option to  Address command.   Use  +nn  or  -nn  to move display
        address relative to current address.
      - New command (Duplicate) copies alternate file block into current file.
        This is done without entering editing  mode,  saves many keystrokes if
        you only want to overlay  128  byte blocks of one file onto the other.
      - Uses cursor ON/OFF from VLIB4D for neater screen update.
      - Patching "Save Changes?" default answer is now YES.
      - In EDIT mode, switching to the alternate file goes  to  the first byte
        in its window.  If the block marker has been set, however, the display
        goes directly to the same position in the alternate file.
      - On invocation, name the smaller file first.   If it fits entirely into
        its buffer, any extra space is released to the second file.
      - Highlighting (ALT VID) is turned off in EDIT mode.
 BCOMP Notes - 3/4 

   c. Version 2.0b updates:
      - Bug fixed where a  patched  disk  file would  not  actually be updated 
      because BCOMP lost track of where it was.
      - When resetting the block marker while editing the ASCII field, the old
      marker is now properly erased on screen.
      - Bug fixed where  display showed  wrong  address and record number when
      additional segments of a large file were read in.
      - BDOS console i/o used now rather than BIOS.
      - When patching hex,  the corresponding byte in the ASCII field is high-
      lighted in  stand-out mode (and vice-versa).   The ending  prompt states
      which field you are currently in.
      - When patching hex, the cursor left and right commands move to the next
      nibble as  appropriate  rather than  the next byte.   If arrow  keys are
      installed they move to the next byte. 
      - BCINSTAL includes default settings for ECHO flag and alt video flag.
 BCOMP Notes - 4/4 

   d. Version 2.0 updates:
      - File date stamps are displayed with DSLIB and ZSLIB10.
      - in EDIT mode,  access to HEX CALC,  EXIT,  and  SWITCH is  implemented 
      without exiting first to VIEW mode.
      - Memory window display makes more sense.   Address shown is  always  an
      absolute  memory address.   If  a user offset is entered,  the displayed  
      record count is computed from that offset.  

   e. Version 1.3a udpates:
      - Checks the CP/M version number to select  a console input routine, and 
      should work with Z3PLUS.
      - Adds address display to ASCII field
      - Fixes behavior of OFFSET command  on large files.   In patching  mode, 
      <SP> switches directly to the alternate file as it does in viewing mode.
:4
 Patching - 1/2 

                                     EDIT:

   The patcher is screen oriented and fairly powerful.   There is no reason it
cannot be used to patch a single file.

                                  DUPE BLOCK:

   Overlay the 128 byte  window  of the alternate file  onto the current file.
This command accomplishes with  a single  key what it takes  a  fair amount of 
work to do with the edit commands (described next).  

   Control keys for  editing are installed  separately from  VIEW mode.   They 
should be control characters, or they will be  ignored  when editing the ASCII 
field.  The EXIT and HEX CALC commands from VIEW mode work on the same keys in
EDIT mode,  however.   The  SWITCH command also works,  but  can  be installed 
separately for editing.   If  <sp>  is not used, it will move the cursor right 
one byte.
 Patching - 2/3                         

   Cursor movement:
      Use the WordStar(tm) diamond or the arrow keys.

            ^E
             ^
        ^S < $ > ^D     Horizontal movement is to next niblle.
             v          <BS> and <SP> are alternates in HEX field.
            ^X

   Patching:
     In the HEX field, enter hex bytes directly (0..9,A..F).
     In the ASCII field, enter text directly.

   Saving:
     On exit, if any editing has been done, you get a prompt to "Save Changes?
(y/N)"  On a "Y" response, the disk file (or memory) is updated.  [There is no
need to edit on a CP/M record boundary.]
 Patching - 3/3                         

                               BLOCK COMMANDS:

Mark:   Set the block marker.   The marker is ONE end of the block,  shown  on
        screen as ">".   The other end is  at  the cursor position when one of
        the functions below is executed.

Yank:   Save the  data between  the block marker and the cursor into a buffer.
        The cursor can be before, after, or on the marker.

 Error - Set Marker First:  Can't  Yank until  the Mark  has  been  set in the 
         current screen.  Hence, no more than 128 bytes can be Yanked.

Copy:   Replace the  data starting at the cursor with whatever is in the block
        buffer.   'Copy' enables you to move data from one file to the other.

 Error - Ovfl: The copy operation  cannot overflow  the current  screen.   All
         of the data in the block buffer must fit, or the copy is aborted.

Fill:   Fill from the block marker to the cursor with a byte value.   
:5
                                  BCOMP.HLP 

             Size (recs) CRC   Version    Author/Latest Issue      Disk
               7k (58)   60A1  2.0        Bill Tishey 6/89         Z3HLP3
==============================================================================
   
   BCOMP.HLP is a Z-System help file for BCOMP.COM.
:6 :bcomp