Contents of the DC.DOC file
DC - Directory Control
by Peter Esherick
1105 Sagebrush TR SE
Albuquerque, NM 87123
Albuquerque RBBS 296-7672, John Maio, sysop
Purpose: To allow selective copying, moving, deleting and browsing
of files displayed in a directory listing.
Format: DC [d:][source-path] [d:][dest-path] [/O,N,E,D,or S][/F][/V]
This program is closely based on the CO and DR programs, both written
by Michael J. Mefford and published in PC Magazine, vol.6, #17 and #21,
1987. I have combined features from these two programs and also added a
number of new features of my own. This program is released into the
public domain, as is, with no warranties of any kind. I will be happy to
supply source code to any interested party, with the request that if you
make any significant changes, modifications, or improvements that you
please share these changes, preferably in source code form, with me and
the rest of the PC user community.
The source and destination directory pathnames are both optional.
Options, specified by a "/" followed by a letter, may appear either before
or after the pathnames. The options are as follows:
/N Sort directory by filename
/E Sort directory by extension
/D Sort directory by date and time
/S Sort directory by file size
/O Use original order, i.e. do not sort directory at all.
/V Turn on DOS Verify switch for disk file writes
/F Fast display on IBM Color display adapters (no snow check)
DC comes up displaying the "source" or "working" directory. A brief
menu of optional commands is displayed to the right of the directory
dispaly. You may move up and down the directory list with the up and down
arrow keys on the cursor keypad. Files may be individually copied,
deleted, moved or renamed by pressing the function keys F1 through F4,
respectively. Alternatively, a number of files may be selected, or
"marked" using the grey + and - keys on the right side of the keypad.
After marking, pressing the appropriated function key will apply the
chosen operation to the entire group of files.
Different directories can be displayed in two ways. One is to press
the F9 function key and enter a new drive and path name. Alternatively,
if you want to move to different sub-directories on the same drive, you
can simply press the "Enter" key after using the up or down arrow keys to
high-light the desired subdirectory. Note that as always within DOS, ".."
denotes the parent of a given subdirectory, i.e. the level above the
currently displayed directory.
Just as pressing Enter lets you view a new directory, pressing Enter
when a filename is highlighted lets you view the contents of the file. In
the default mode the display is wrapped at the edge of the screen if a
line is more than 80 characters wide. This option can be toggled by
pressing W. Display of non-ascii characters can be toggled with the Ascii
and Blank options by pressing A or B. In Ascii mode only strings of 5 or
more normal ascii characters (including tab or space) are displayed. This
is useful for viewing the messages conatained in an .EXE or .COM file.
With the Blank option, non-ascii characters are replaced with a blank or
space. A final option, "*", masks the high-order bit of non-ascii
characters to make wordstar files readable.
Key by key summary of commands:
Esc Exit program and return to original directory.
Alt-Q Exit program leaving the currently displayed dir as the
current default drive and directory for DOS.
Grey + Mark current file entry, if not a subdirectory or hidden
or Ins file, and advance cursor to next line.
Grey - Remove mark on current file, and advance cursor to next line.
The following functions operate on the marked files, if any, otherwise
they operate on the currently highlighted file, provided it is not a
sub-directory entry. If the operation is successful the mark is
replaced with an asterix (*), if unsuccessful the file is passed over,
leaving the mark, and the program proceeds on to the next marked file.
F1 Copy file(s) via a read/write sequence to requested target
F2 Delete file(s) after asking for confirmation.
Remove directory if currently pointing to a subdirectory
that is empty.
F3 Move file(s), ie Copy to requested target, delete source.
Where possible this function is performed using an across
directory rename instead of a file read/write sequence.
F4 Rename file(s) or within the currently displayed directory.
F5 Clear all marks
F6 Mark all remaining files, ie those not marked with an "*".
F7 Swap marked and unmarked files.
The following three functions change the active source and dest
F8 Swap the Working Directory (source) and the Default
F9 Prompt for a new Working (source) Directory
F10 Prompt for a new Default Destination Directory
The directory can be re-sorted by typing:
Alt-N Sort by filename
Alt-E Sort by file extension (eg .COM vs .DOC)
Alt-D Sort by date and time
Alt-S Sort by file size
Alt-O Re-read and display dir in original, unsorted order
Additional commands not appearing in the menu:
Alt F1 Protected copy - bypass filenamess that already exist on target
Alt F2 DOS Shell: Exit temporarily to DOS. You can then run whatever
programs you need to run, and then return to the DC program by
typing "exit" at the DOS prompt.
Alt F3 MakeDir: Create a new subdirectory in the default destination
Alt F4 RMDIR: Remove the currently highlighted directory, if empty.
Alt R Re-read working directory. Required after changing diskettes
in a floppy-disk drive.
Alt C Copy (Duplicates F1)
Alt M Move (Duplicates F3)
Alt V View (Duplicates Return)
View Mode commands:
Alt W Toggle word wrap/horizontal scroll
Alt A Toggle Ascii string display
Alt B Toggle blanking of non-Ascii characters
* Toggle wordstar bit mask (shift non-ascii high-order
characters (from 128 to 255) down into the displayable
ascii range of 1 to 127.
Version 1.06 of DC can be customized to display the menu and dir text
in the colors of your choice. Rather than building into DC.COM an
automatic color setting function, I have fallen back on the hacker's
choice of letting you patch DC.COM with debug. If this scares you,
learn how to use debug, ask a friend, or learn to love the ridiculous
choice of colors that is built in to this version. I use a monochrome
screen, so it just hasn't been a big thing to me before.
Besides understanding DEGUG you need to know two other things: how the
PC video display cards translates hex numbers into colors, and what
locations to patch (change) in DC.COM. The table below lists the
correspondance between hex numbers and foreground and background colors
on the PC. To get the correct number for a combined foreground color
plus background number, you add the hex digits for the two. For
example, brown on a blue background is given by 16h, where as brown on a
green background is given by 26h. Note that in a hexidecimal
representation, which is what debug uses, the first digit is the
background color, while the second (least significant) digit gives the
Foreground (normal) Foreground (intense) Background
0 black 8 dark gray 0 black
1 blue 9 light blue 10h blue
2 green 0Ah light green 20h green
3 cyan 0Bh light cyan 30h cyan
4 red 0Ch light red 40h red
5 magenta 0Dh light mag. 50h magenta
6 brown 0Eh yellow 60h brown
7 gray 0Fh intense white 70h gray
OK, now you now how to define a color. If you are a veteran hacker,
than the next table tells you all you need to know. If your not,
hold on, we'll get you there.
Location Name Default Where used
103h NORMAL 02 Directory display
104h INTENSE 0Bh Pathname display
105h MENU 16H Menu display
106h BORDER 1EH Menu border
107h INVERSE 74H Highlighted dir entry
Now, to use DEBUG to change the default colors, first
(1) Find DEBUG.COM from your DOS disk if you haven't already got it
(2) Use COPY to make a copy of DC.COM on a working disk so you don't
mess up your one and only copy.
(3) Assuming DEBUG is in the default directory or accessible via the
path command, and that DC.COM is present in the default directory of the
currently logged disk, type the following (at the DOS prompt):
DEBUG DC.COM (Debug will respond with a hyphen -)
d103l5 (Debug will display the current values of the colors)
e103 (Debug will display the first color, followed by a '.',
for example 02. At this point type in the one or two
digit number that you want to use for the NORMAL color.
If you don't want to change it, press the space bar.
After entering the number or a space, debug will go on to
the next color, and you repeat the last step until you
have entered something for all five colors. If you want
to quit and go back, press the Enter (return) key, and re-
enter the e103 command at the '-' prompt. When your done
here you only two more steps to go:
W (This command writes the modified file back on to the disk.
(Debug responds with "Writing 17F3 bytes", or something close)
Q (And the Q command quits DEBUG and returns you to DOS.
Other Patch Locations:
Switch character (108h): '/' or '-'
For the UNIX hackers, there's one more byte that you can change at your
pleasure, and that is one I have labeled SWITCH at location 108h in the
DC.COM file. The character/byte at location 108h is used to identify an
option entered on the DOS command line when you first call up DC.
Normally this is '/', so that options would be specified by /d or /o. By
changing the byte at location 108 to '-', options can be entered as -d
or -o. This lets you use '/' in your path names, so that instead of
entering command lines like:
DC C:\COMM\DOWN D:\UTIL /D
You can now enter:
DC C:/COMM/DOWN D:/UTIL -D or
DC C:\COMM\DOWN -d D:\UTIL or
DC -d C:/COMM\DOWN D:/UTIL -D
But not: DC C:\COMM\DOWN D:/UTIL /D (This will clearly confuse DC)
(Note that since the problem is with the option switch, and since there
are no options entered with pathnames once the programming is running,
you can use either / or \ as a path delimiter when entering a
destination or changing the path with F9 or F10 keys.)
Snow Checking (109H): 0h enables, 0FFh disables
When DC starts up it checks BIOS data area (Segment 40) to see if the
current display adapter is a monochrome or color card. If it isn't mono,
then DC will query the display adapter, before writing a character to the
display memory, to see if it is ok to do so. This procedure is necessary
to avoid spurious dots or "snow" on old IBM Color Graphics Adapters (CGA's).
Unfortunately, this also slows things down quite a bit. If you prefer speed
over a clean display update on a CGA, then put 0h in the byte at 109h.
A zero at this location will enables snow checking on CGA displays.
Monochrome, EGA and VGA display adapters automatically disbale snow checking
since they never need it. If you want to temporarily try out what this patch
does, use the /F option switch when you start up DC.
Minimum memory for directory functions (10Ch):
In its default mode DC will look for at least 32 k for itself and the
directory information, reserving all remaining full 64k segments for the
file copy and view buffer. This can be changed by modifying the byte at
10Ch from 08h to a new value between 08h (32k) and 10h (64k).
Since this value corresponds to the memory allocated for both the program
and the directory info, smaller values than 8 can cause disaster.
Initial directory sorting order:
The directory sorting options are decoded from the command line and
stored in a word at 130h (SORT_OFFSET) and a byte at 132h (SORT_LEN).
The following table describes values used for the different cases:
loc type name ext size date nosort
130h DW 0 9 0Dh 1Dh 0FFFFh
132h DB 0Ch 3 8 0 0
My thanks to Steve Grandi of U. Arizona for adding the DOS shell
function to DC. Steve has also implemented a UNIX style -switch version
uses "/" instead of "\" as the path delimiter. Additional thanks to Russ
Nelson for the alternate menu code and EGA checking and to Gordon Haff
who has provided numerous ideas through his extensive modification of DC
into an even better program, DF, also availble through your local BBS.
DC version 1.06 - September 2, 1989
Fix View bug in number of lines displayed
New patch location for default sort
Reverse logic of snow check patch point
Fixed get_mem bug when less than 64k to grab
complements Russell Nelson:
Sensing the EGA and disengaging snow control if one is present,
Changing the menu if they hold down the Alt or Ctrl key.
RMDIR and MKDIR
DC version 1.05(b) - October 24, 1988
Alt F2 for DOS Shell
DC version 1.04(f) - June 8, 1988
Add Ins/Del as duplicates to Grey +/- keys
Work on display speed/ cursor overrun problem
Minor(?) change in memory management
DC version 1.01-1.03 - March 7 to April 6, 1988
Add customizable colors and switch-char
Add Rename for directories
Automatically re-read dir with Alt-O original order sort
Added Alt-F1 "Protected Copy" function.
Now highlights last sub-dir viewed when returning to parent dir
Modified method of handling directory changes
F9 (change work dir) now relative to displayed work dir
Allow specifying both source and dest paths on entry
Earlier versions COD1 through COD9: Dec '87 to Mar. '88
Combined DR and CO,
Added ability to change directories
Added "spedometer" display of marked files, bytes
Added "View" options to toggle word wrap, horizontal scroll,
blanking or full suppression of non-ASCII
Features that could be added:
Functions to toggle file attributes (hidden, system, etc.).
Extended DOS shell functions as found in DF by Gordon Haff.
Improved error messages on disk not ready, etc
List options: hex dump a la Buerg's LIST.COM
search/scan for text
display current horizontal scroll position