Dec 172017
Debug disk files.
File DBUG.ZIP from The Programmer’s Corner in
Category System Diagnostics
Debug disk files.
File Name File Size Zip Size Zip Type
DBUG.DOC 16565 6189 deflated
DBUG.EXE 15232 5486 deflated

Download File DBUG.ZIP Here

Contents of the DBUG.DOC file

DBUG - The Display and Modifyeditor


DBUG allows direct access to a disk file for display and editing purposes.
It is ascreen-orientedFile Editor to be used with an IBM PC or PC compatible
machineand an MS-DOS Version 2.00 compatible operatingsystem.DBUG's main
features are:

1) Fulleditingcapabilities are available. Theuser can easilyposition to
any byte in anygiven record. There areboth Hexadecimal and ASCII
modification modes. Direct diskpatching becomes a simple task with DBUG.
Small changes in files can be made veryquickly.

2) DBUGallows record advance, backspace, and absolute positioning. Paging
back and forth through the fileis accomplishedat a keystroke.The user does
not need to know any diskette information (suchas number of sides, number of
sectors, etc.).

3) ASCII, Hex or case independent string searches are easily performed.There
is a repeat command to positionto subsequent occurrences of the same string.
DBUG searches the entire file, not justthe current record. It searchesfor
text orASCII strings up to 16 characters in length. Hex searchstringscan be
up to 8bytes in length.

4) The Print and List commands allow sending anindividual record or any
number of records to a printer.

5) A Disk Mode is also available to work with an entiredisk (at the sector

Throughout thismanual,a character or word between vertical bars is used to
represent a keyboard key. Thus the symbol, |RETURN|, refers to the keyboard
key marked RETURN and not a sixletter word. |P| means the "P" key etc.


DBUG may be entered simply by typing DBUG and pressing |RETURN|(assuming
DBUG.EXE is on the default drive). Optionally, a drive and/or filename may
be entered on the command line in the followingformat:

DBUG [d:][path\filename][.ext]

If no drive or filenamewas used when entering DBUG, a prompt will appear
for it.Answer this prompt by giving the filespec or drive you wish to
examine/modify.The filename may consist of up to 79 characters, and may
containpath names. To exit DBUG at this point rather than entering a
filespec, pressthe |RETURN| key, and control will return to the DOS level. If
an illegal or improper filespecis given, the appropriate errormessagewill
appear,and thefilespec promptwill re-display.

Hexadecimal notation inthe form (X'nn') will be used to represent the current
record number and relative bytenumber.After avalid filespec has beengiven,
record X'0000' will appear on the screen, and be resident in the "edit
buffer". The term "editbuffer" will refer to the portion of the file
currently in the computer's memory which is simultaneously being displayed.

The edit buffer(also referred to as current record) will contain one DBUG
record (256 bytes) at any giventime. There will be twocursorsflashing
within the record (one cursor will be in the "ASCII" portion ofthe screen,
the other cursor will be in the"Hex" display portion).Upon initially
accessing a file, thesecursorswill bepositioned overrelative byte X'00' of
record X'0000'.Throughout thisdocumentation, the term"relative byte"will
be used, and will indicate the byte number (X'00'-X'FF') relative to the
beginning of the current record.

There will be an input cursor located on the lower portion of the screen
following the message "Command". This will be referred to as the "command
buffer", and will be used to pass commands to DBUG.

Additional information shown onthe screen willbe the current record number,
filespec, relative bytewithin the sector, etc.The following sample display
shows where this information will be presented.

0123456789ABCDEF BYTE 0001 02 03 04 05 06 07 0809 0A 0B 0C 0D 0E 0F

| ......(.......KI | <00> | 00FE 14 01 00 00 28 10 05C3 08 00 00 00 4B 49 |
| ......DO.<....PR | <10> | 07D0 0B 00 00 00 44 4F 063C 0E 00 00 00 50 52 |
| ......SI......SO | <20> | 1508 02 0D 00 00 53 49 1710 02 0F 00 00 53 4F |
| ......JL.g.=..X | <30> | 0A00 00 0A 00 00 4A 4C CD67 02 3D 20 0C CD 58 |
| ..g.w#....=(..g. | <40> | 02CD 67 02 77 23 10 F9 18EE 3D 28 0B CD 67 02 |
| G.g......g.G.g.o | <50> | 47CD 67 02 10 FB 18 E0 CD67 02 47 CD 67 02 6F |
| ..g.g..., ...tC. | <60> | 05CD 67 02 67 05 C9 D9 2C20 0D E5 CD 74 43 E1 |
| .{............!. | <70> | 1C7B D6 12 20 02 5F 14 7ED9 C9 01 88 0F 21 9B |
| ...A..+.....cPV. | <80> | 027E ED 41 D3 89 2B 05 F281 02 C9 63 50 56 08 |
| ......e......... | <90> | 1800 18 18 00 09 65 09 0000 00 00 00 00 00 00 |
| ................ | | 0000 00 00 00 00 00 00 0000 00 00 00 00 00 00 |
| ................ | | 0000 00 00 00 00 00 00 0000 00 00 00 00 00 00 |
| ................ | | 0000 00 00 00 00 00 00 0000 00 00 00 00 00 00 |
| ................ | | 0000 00 00 00 00 00 00 0000 00 00 00 00 00 00 |
| ................ | | 0000 00 00 00 00 00 00 0000 00 00 00 00 00 00 |
| ................ | | 0000 00 00 00 00 00 00 0000 00 00 00 00 00 00 |
Record X'0000' Byte X'84'=> X'D3' = 11010011 = 211

|A|Enter ASCII modification mode
|B|Position to theBeginning of the file
|C||RETURN|Clear record with zeroes
|E|Position to theEnd of the file
|F|Enter Find modeand:
|A| find ASCII string
|H| find Hexadecimal string
|T| find Text string
|G| Go to the next occurrence of last search
|H| Enter Hex modifymode
|L||RETURN| List disk file to printer
|N||RETURN| Enter a New file
|P||RETURN| Print current record in edit buffer
|R| Positionto Record
|S||RETURN| Save current record in edit buffer
|ESCAPE| Cancel current DBUG command
|RETURN| Display DBUG instructionset (Menu)
|+| |=| Advance one record in the file
|-| Backup one record in thefile

Cursor MovementCommands

|@ nn| Positioncursor to relative byteX'nn'
|Lt arrow| Move cursor leftone byte
|Rt arrow| Move cursor right one byte
|Up arrow| Move cursor up one line
|Dn arrow| Move cursor downone line
|HOME| Positioncursor to relative byteX'00' of the current record

The @ positioning command requires a hex byte consisting of up to two hex
digits.This may be anynumber X'0' through X'FF'. However, if a singledigit
is used(no leading zero), the |RETURN|key must be pressed in order to
executethe command. This is because the |@| command expects two digits. If
two digits are used, the command will execute immediately afterthe second one
is typed.

This arrangement is used throughout DBUG whenever information must be
supplied in addition tothe command key. Merelyremember to press |RETURN| if
nothingoccurs after typing in a command. This is especially true for the
stringsused inall of the FINDsubcommands.

The arrows may be used from within either the ASCII or Hex modificationmodes
to position within the buffer. The "@" command will notbe accepted during
either modify mode.

The cursor movement commands will not wrap intoeither a prior or a subsequent
record.To switch records, use the record manipulation commands. No cursor
movement will occur if an attempt is made to violate buffer boundaries.


|+| Advance one record sequentially in the file. Forexample, if the
currentrecord is X'000C', after pressing |+|, record X'000D' would be
displayed (provided that it exists). Issuing the |+| command will not change
the position ofthe relative byte cursors.

|-|Back upone record sequentiallyin the file. Ifthe current record is
X'0087', after pressing|-|, record X'0086' would be displayed.Issuingthe
|-| command does not change theposition of therelative byte cursors. The |-|
commandwill beignoredif it is issuedwhen record X'0000' is being

|B|Position to thebeginning of the file (record X'0000') and position
cursorsto relative byte X'00'.

|E|Position to theend of the file. Although 256 bytes areshown, the
true end of file may not be at relativebyte X'FF'. Anymodifications made to
bytes beyond the true EOF offset byte are usually superfluous.

|R|nnnnPosition to Record X'nnnn', provided record X'nnnn' exists in the
file. If the record does not exist the request will be ignored.After entering
|R|, the promptRecord X' ' will appear in the command buffer. The input
for therecord number will be taken within the single quotes. Hex digits (0-F)
must beentered. Any other characters will be ignored. |ESCAPE|will cancel
this command. The user may enter the record number without using the standard
four digit (X'nnnn') format. Simply type in therecord number and press
|RETURN|. For example, if the desired record number is X'0021',type |R||2||1|
and press |RETURN|. Theposition of therelative byte cursors will remain
unchanged afterpositioning to the new record.


|A| Enters the ASCII Modification Mode.In thismode, modifications canbe
made directly in ASCII.Any character that can be generated from the keyboard
(with the exceptions ofthe |ESCAPE| key and the cursormotion keys) can be
directly entered into the edit buffer. Modifications can be made by
positioning thecursor over thebytes to be changed. After the |A| command is
issued the command buffer will display "ASCII Modify". From this point on, any
characters entered willbe taken as modifications to the bytes in the edit
buffer.After acharacter is entered, the cursors will positionto the next
character in the edit buffer. If the cursors are positioned at the last
character in the edit buffer, no advance will occur. The arrow keys maybe
used toposition the cursor without altering the buffercontents. Any changes
made tothe buffer WILLNOT automatically be written tothe file. In order to
save changes tothe file, see the |S|ave command. To exit the ASCII modify
mode, press the|ESCAPE| key.

|H| Enters the Hexadecimal ModificationMode. In this mode, modifications to
bytes in the edit buffer are accomplished by typing hexadecimaldigits.After
the |H|commandis issued, the command buffer will display "Hex Modify". From
this point on, hexadecimal digits (0-F)must beenteredto modify bytesin the
buffer.Note that sincea single byte is represented bytwo hexdigits,hex
modify edits one nibble(half abyte) at a time. The arrow keysmay also be
used toposition the cursors for additional editing. Toexit the Hex modify
mode, press the|ESCAPE| key. Like the ASCII Modification Mode,no changes are
automatically made to the file.To makethe modifications to the file, see the
|S|ave command.

|C||RETURN| Clears the buffer contents from thecursor positionto the end of
the buffer by filling it with X'00'. Some fileshave erroneous or random
information past the end-of-file offsetbyte inthe last record. The clear
commandcan be used to overwrite the remainder of the buffer with zeroes to
facilitate viewing. Again, since none of the edits perform an automaticwrite
to disk, |S| isnecessary to save the buffer contents.

|S||RETURN| Save the contents of the current edit buffer to disk. The current
record will overwrite the contents of the disk record.

DBUG Control Commands

|N||RETURN| Causes a prompt for a new filespec. DBUG will clear the screen,
print its sign-on message, and prompt the user for a new filespec.

|X||RETURN| Exit to operating system.

|RETURN| The |RETURN| key is used as a confirmation to completemost commands
that result in significant alteration of the current record. |RETURN| alone
will display a menu containing most of the DBUGcommands, and abrief
description of their use. Pressing |RETURN| at the menupage will return to
the display mode.

|ESCAPE| The |ESCAPE| key is used to abort a DBUG command in progress.


|P||RETURN| Print the current buffer contents,to a printer. If the printer
is not on line,the error message "Printer Not Ready" will be displayed.
Pressing |RETURN| at the error will attempt to print again. Pressing |ESCAPE|
will abort the operation. Note:if a printer isnot physically connected,
DBUG may not display anerror message. PressingESCAPE will exit the print
mode, however, and return to the command mode.

|L||RETURN| List the file to a line printer starting with the current buffer.
The listing will terminate whenthe endof the file is encountered, or when
|ESCAPE| is pressed. Error handling works exactly as with the |P| command.


|F| Enters the FIND mode. A "FIND" prompt will appear in the command line. A
subcommand declaring the type of searchmust beentered. After enteringthe
subcommand, an appropriate prompt will display followedby a data entryspace
in quote marks.The following are the three FIND sub-commands:

|A| FindASCII "string".This isa literal search for the exact ASCII
characters entered. "string" isa groupof fromone to sixteen ASCII
characters. If less than 16 characters are typed, the |RETURN| key mustbe
pressedto initiate thesearch.

|H| FindHexadecimal "string". This is aliteralsearch for the exact
hexadecimal bytes entered. "string" is a group of up to16 hex digits (8
bytes).Only the valid hex characters (0-F) will be accepted.

|T| FindText "string". This is a searchfor ASCII characters ignoring
differences in case. The same restrictions which apply to |A| apply to |T|.

|G| Go to the next occurrence of the last searched string. It simply looks for
the last "find"item specified again. It also "remembers" the last search
criterion as long as DBUG is active. This meansthat searches through
different filesfor thesame string arepossible without the re-entry of the

Pressing |ESCAPE| at any time during the input sequenceor search will cause
DBUG todisplaythe record which was current before thesearch started.
During a search, only the current record numberbeing searched will appear on
the screen. If the search string is notfound, or if a disk error occurs, the
appropriate error message will be displayed andthe file will be positioned to
the record current before the search began.


Occasionally itis desirable towork with an entire disk as opposed to a
single file. For this purpose, the DBUGdisk mode makesit possible to treat
the entire diskas a file. DBUGcommands will work as describedfor thefile
mode except as described below.To enter the disk mode,simply give the
drivespec (drive letterfollowed by a colon) atthe "Filespec:"prompt.

The standard format of an MS-DOS 2.00 disk uses512 byte sectors. Sinceonly
256 bytes can be displayed at atime with DBUG,a backslash character "\"
will appear after the record number to indicatethe second 256 bytes ofa

|R| nnnn Position to Record X'nnnn' ondisk. The Record numberconsists of
the absolute sector number. Forexample, typing|R||0||0||1||5|would position
to sector X'15', the twenty first sector of thedisk. Pressing |RETURN|
following the record number is requiredonly for requests consisting ofless
than four digits. For example, positionto sector 4 could be accomplished by
typing |R||4||RETURN|. The |R| command always positionsto the first 256 bytes
of a sector.

|B| Position toBeginning of Disk (Cylinder 0, Sector 0). Afterissuinga |B|,
the current Record number wouldbe X'0000', andthe first 256 bytes would be

|E| Position toEnd of Disk. The actualsector number would depend on the type
of disk. The second half of thesector will be displayed in thebuffer.

|+| Position tonext sector or the second half of the current sector.

|-| Position toprevious sectoror the first half of the current sector.

DISK I/O Errors

As withany hardware, there is always that chance of something going wrong.
This could happen when reading from or writing to a disk. For some reason,
some component failed to do itsjob. The problem could be in the disk media,
the disk drive,the disk controller, orthe computer. Whenever an I/O error
occurs,DBUG reports the error and waits for operator input. When the
currentbuffer is displayed, the information init may not be valid, depending
on the disk error.

 December 17, 2017  Add comments

Leave a Reply