Dec 072017
Run Diags For your System.
File DIAG.ZIP from The Programmer’s Corner in
Category System Diagnostics
Run Diags For your System.
File Name File Size Zip Size Zip Type
DIAGS.DOC 18992 6259 deflated
DIAGS.EXE 66930 29588 deflated

Download File DIAG.ZIP Here

Contents of the DIAGS.DOC file


Special Serial, Parallel, Video diagnostics for the PC
Special Serial, Parallel, Video diagnostics for the PC

Written by Joan Riff for:

Computerwise Consulting Services
P.O. Box 813, McLean, VA 22101
(703) 280-2809


DIAGS is a tool for the advanced PC user, period. It is NOT for the
general public. This manual will not explain things in elementary terms.
If you know what a 6845 is, and what an 8250 is, and what parallel
handshaking lines are, then DIAGS will be extremely useful to you. If
not, then you may have better things to do with your time than try to
figure out this program.

DIAGS started out as a testbed for our new interrupt-driven RS232
libraries. The Serial Port Diagnostics were the first written, to test
the Microsoft version 3.0 'C' interface to these routines.

It has since grown. As we have added more assembler routines to our
library, we have added corresponding DIAGS functions to test them.

Additionally, DIAGS has been expanded as we experienced the need for new
diagnostics capabilities. So the Parallel Port diagnostics were added
when we had to debug yet another unknown printer's handshaking. And the
6845 diagnostics were added when we needed to test various video tricks
like displaying 30 lines of text, smooth scrolling, etc.

As it now stands, DIAGS is a very powerful facility for:

1) Testing all sorts of asynch communications lines

2) Testing printer handshaking and cable wiring

3) Examining an unknown system's DOS environment, including:

a) Interrupt vectors
b) Resident device handlers

4) Directly manipulating the 6845.

Main Menu

The main DIAGS menu displays information about the machine and about
DOS, and presents a list of the various diagnostics that are available.
When you exit a particular diagnostic, you are returned to this main

(D)isk Info

Let's describe the weakest and least important diagnostic first.

The DISK INFO selection from the main menu displays just about every-
thing that can be determined about a disk. Make sure that you have a
diskette in the indicated drive before selecting this option.

Since there are other utilities which do just about everything that you
may want to do with a disk, we haven't done much with this diagnostic.
We just display disk information as reported by DOS as well as by the
disk's Boot Record.

Once in the Disk Info screen, the following keypresses are available to

ESC - return to the main DIAGS menu

ALT-V - verify a diskette by reading every sector via DOS INT
025h. This is SLOW!!!! Think of this as a demo of just how
slow INT 025h can be.

ALT-R - reset drive. Doesn't do much, huh? That's what we
wanted to see.

A thru Z - select new drive for which statistics are to be
displayed. Again, be sure that you have a disk in whatever
drive you select.

That's it. Not much to it. If you need to do more, then use:

The Norton Utilities
Quaid's Disk Explorer
Central Point Software's Option Board

(I)nterrupt Vector Display

This selection from the main menu displays the system's Interrupt
Vectors. For each interrupt, the following information is displayed:

The interrupt number
The interrupt vector's address within segment zero
The Segment:Offset of its handler
The interrupt's name and/or use

If an interrupt points to an IRET, then that fact is reported by a
highlighted "[IRET]" displayed after the name.

Once in the Interrupt screen, the following keypresses are available to

ESC - exit back to main menu
Home - scroll display back to Interrupt 0
End - scroll display to the end of the interrupts (F0 thru FF)
PgDn - scroll to the next page of vectors
PgUp - scroll up to the previous page of vectors
Up Arrow - scroll up 1 line
Up Arrow
Down Arrow - scroll down 1 line
Down Arrow

(P)arallel Diagnostics

This is a more complicated set of diagnostics. It allows you to do all
sorts of useful things with the parallel ports. We use these routines
when we're trying to figure out whether or not some new printer is
working properly with the system.

At the top of the screen is displayed:

The number of parallel ports on the system (1 thru 4)
The number of the currently-selected printer (0 thru 3)
The base I/O address of the currently-selected printer
The trip character that is currently set (see below)
Whether interrupts are allowed or disallowed during sampling

The Parallel Port Diagnostics menu gives you the following choices:

(I)nit printer - does a ROM BIOS "init printer" call.
(I)nit printer

(E)nable Interrupts during sampling - toggles the indicator on
(E)nable Interrupts during sampling
the top line, which indicates whether INTs are to be dis-
allowed during sampling.

(N)ew Trip character - allows you to specify a new character
(N)ew Trip character
to be sent to the printer to 'trip' it. This is initially a

(P)rinter switch - selects next printer (in sequence) as the
(P)rinter switch
current printer.

(T)rip printer - sends the current Trip character to the
(T)rip printer
printer, and then captures the printer Status port lines using
a special high-speed capture routine. These lines are dis-
played in oscilloscope format, allowing you to see at a glance
the operation of the BUSY line, ACK line, etc. Interrupts will
be inhibited during the sampling if the top line of the
display shows "No Ints". Press ESC to exit from the display of
the status lines.

(U)nique Printer setup - sends custom codes to set various
(U)nique Printer setup
specific printers into various modes. The printers currently
supported are:

Data Products 8070 (and perhaps IDS Color Prism)
IBM Graphics Printer (and certain Epsons)
Fujitsu DL-2600 (and perhaps Epson JX color series)
Okidata Microline 93
Diable 630 (and C.ITOH Starwriter, F-10, etc)
C.ITOH Prowriter

Follow the prompts that are displayed when you make this

(Q)uit parallel diagnostics - to return to main menu
(Q)uit parallel diagnostics

The following three selections are invaluable for checking
proper printer cabling and handshaking:

(D)ata lines - displays the parallel port Data I/O port lines
(D)ata lines
in oscilloscope-like format. Press ESC to exit the oscillo-
scope display.

(S)tatus lines - as above, but lines displayed are from
(S)tatus lines
the parallel Status I/O port.

(C)ontrol lines - as above, but lines displayed are from
(C)ontrol lines
parallel Control I/O port.

The following selections send various strings to the printer:

(F)ox message - sends a continuous FOX message to the printer
(F)ox message
via direct I/O (bypassing the ROM BIOS). Press ESC to stop it.

(A)scii character set - sends the complete ASCII character set
(A)scii character set
to the printer via direct I/O (bypassing the ROM BIOS). No
carriage returns are sent. Press ESC to stop it.

(H)oriz and vert alignment tests - send various Formfeed, Tab,
(H)oriz and vert alignment tests
line spacing and Backspacing sequences to printer. This is
useful for testing the results of (U)nique printer setups, and

to see if the printer supports true backspacing. This selec-
tion has its own submenu, which is exited via ESC.

(S)erial Port Diagnostics

If you do PC communications as much as we do, then this part of DIAGS is
for you! It provides a very powerful look at the comm line. Its most
intriguing feature is the ability to serve as a line monitor between two
serial devices.

When you select "Serial Diagnostics" from the main menu, your screen
becomes a terminal screen. At the top of the screen is displayed various
port information as follows:

Whether the port is open ("OP") or closed ("CL")
The current serial port number
The current baud rate
The number of data bits being used
The type of parity being used
The number of stop bits being used
Whether the existing 8250 parameters are being re-used (this
feature is only used by us, for internal testing)
What port is being wrapped to (more on this later)
Whether keypresses are echoed to the screen
Whether DEBUG mode (HEX display) is set

To the right of this information are various stats, displayed only if
the port is open and stats have been enabled. These stats include:

The size of the RS232 output queue (in HEX)
The size of the RS232 input queue (in HEX)
The status of Carrier Detect and DSR
The number of times (in HEX) that the following have occurred:

Framing Error
Parity Error
Overrun Error

Once the port has been opened, any "normal" keys that you press are sent
over the comm line by being queued into the output queue. Incoming data
appears on the screen. Incoming and outgoing characters are displayed in
different colors, so that you can tell what's what.

The RS232 routines are entirely interrupt-driven. The output queue will
be serviced only if the 8250 is properly interrupting the 8088. This in
itself is a valuable test of proper system operation. If the output or
input queue sizes stay "stuck" at a non-zero value, then something is
wrong with your system.

Besides the "normal" keys, you may use the following keypresses:

ALT-S - switch display between port 0 and port 1 (COM1: and

ALT-M - bring up a menu of miscellaneous features:

HANGUP the phone by dropping DTR
PICKUP the phone by raising DTR
RESET the Hayes 1200b by OUT1 toggle
FLUSH input and output queues
CRLF control (how to display incoming CR and LF)
STATS control - turning the stats off can speed up the
terminal display considerable
TRAP - control what happens when you press ALT-T to trap
some 8250 register

ALT-X - initiate an XMODEM transfer. This we use to test the
accuracy of XMODEM as implemented in other software packages.

ALT-P - control port parameters. This includes:

port OPEN and CLOSE
DATA bit selection
PARITY setting
STOP bit selection
REUSE of the 8250 params (for our internal use)
ECHO (of local keypresses) on/off
WRAP of incoming data to another comm port
DEBUG display toggle

ALT-T - to trap the data lines from a previously-defined 8250

ALT-R - display various 8250 registers

ALT-B - to send a BREAK

ALT-W - wait (do nothing) till next keypress. This is useful
for pausing a fast-miving display.

ALT-Q - quit back to main menu

ALT-F - send a single FOX message over comm line

Most of these functions contain their own prompts, and require no
further explanation. Some, however, need to be explained in detail.

The continuous updating of the stats on the top line can slow down the
terminal display. Turning stats off (ALT-M S) can speed things up

The baudrate is continuously variable, from 2 to 38400. You are not
limited to "standard" PC baud rates.

If you want to clear the screen and reset the stats, try switching ports
twice (ALT-S ALT-S).

To trap and display an 8250 register in the middle of communication, you
must first define the register to be trapped (ALT-M T) and whether INTs
are to be allowed during the sampling that follows.

Having done that, you cause the trap by pressing ALT-T. At that instant,
a special high-speed assembler routine is executed which samples the
designated register once every 50 machine cycles or so until 420 samples
have been taken. These sample bytes are then displayed as a screenful of
HEX bytes. You may highlight a particular byte via the arrow keys. The
highlighted byte's interpretation is displayed on the message line
toward the top of the screen. Press ESC to exit this trap display.

The "wrap" feature is very useful. It may be used to allow DIAGS to
serve as a line monitor located between two serial devices, among other
things. Every incoming character is "wrapped" as an output to whatever
port you have specified as the "wrap" port. If you select as the "wrap"
port the same port that you're using, then you have in effect become a
full-duplex system. The serial device connected to that port will see
its "keypresses" echoed back to itself.

Assuming that you have two serial ports, you may use DIAGS as a line
monitor by wrapping each port's input to the other port. You can then
switch between ports (ALT-S) and generally watch everything that goes in
either direction. You can turn on the DEBUG display (ALT-P G) to see
things in more detail.

(R)esident device handler display

This main menu selection allows you to see a list of all resident device
handlers. As you highlight each handler's name (via the left and right
arrow keys), the device's attributes are expanded on the screen. Press
ESC to exit this display.

Block devices are indicated by device names of the form "BLOCKnnn",
where nnn is the number of devices supported by this block device

(V)ideo Manipulation

If you want to do some fancy 6845 programming, then the Video diagnostic
will be of great interest to you. It allows you to examine and alter the
6845 registers in a most graphic fashion.

Toward the top of the screen is a two-column list of all 6845 registers,
and one or two of the special IBM PC video registers (the MODE and/or
COLOR registers). There is a ">" pointer, showing you which register is
being worked with.

For each 6845 register, two values are shown:

1) The original value, as set by the ROM BIOS
2) The current value as set by you

You move the ">" pointer to various 6845 registers via the up and down
arrow keys. As you select each 6845 register, that register's bit
pattern is expanded on the bottom half of the screen.

You can change the currently-selected 6845 register's value by using the
"+" or "-" keypad keys to increment or decrement its value.
+ -

You can also use the left and right arrow keys to move the "bit pointer"
across the various bits of the expanded byte on the bottom half of the
screen. Pressing "1" or "0" sets or clears the bit currently pointed
1 0
to. This is an alternate way to change the current value of a 6845

The updated 6845 registers are loaded into the 6845 ONLY WHEN YOU PRESS
RETURN. This allows you to make extensive changes to registers without
having intermediate states foul up the display.

If you hose things up and get an unreadable screen, just press ESC to
exit the Video Diagnostics, then enter it again. The 6845 is reset on
exit from the Video Diagnostics.

If you are using a Color/Graphics Adapter, then you may press "S" to
toggle Snow on or off. The upper-right corner of the display shows the
current status of snow as follows:

"Snow: YES" means that no effort is being made to eliminate
Snow: YES
snow, and that snow is present (although you won't see it if
you have a good Color/Graphics board)

"Snow: NO" means that snow is being eliminated by our video
Snow: NO

 December 7, 2017  Add comments

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>