Hardware Diagnostics Program

I have written two complementary programs for troubleshooting 
hardware problems.  One runs on the PC as a sub-menu of SIO2PC, 
and the other is DIAGS.OBJ, which runs on the Atari.

The program allows setting and detecting of individual I/O line states, 
sending and receiving serial data in a simple intercom mode form, and 
sending and receiving simulated disk sectors.  There are similar menus 
on the Atari on PC ends, used as described below:

On the PC, you get to the DIAGS menu by selecting menu choice A, 
then G from the SIO2PC main menu.

LINE STATUS TROUBLESHOOTING:

In this function, each computer can control the state of its output line(s) 
and see the current state of its input and output line(s).  SIO2PC uses 
three lines.  A data line from the Atari to the PC, a data line from the 
PC to the Atari, and a Command line from the Atari to the PC.  From 
the Atari, you can toggle the state of the Data Out and Command lines 
and watch the status change on the PC.  From the PC, you can toggle 
the status of Data Out line and watch the status change on the Atari.  
These observations confirm that the three lines are working correctly 
through the SIO2PC hardware.   Note that Data Out on the Atari is 
referred to as Data In on the PC, and vice versa.

Theres one slight hitch in this function:  The PCs serial chip can detect 
that its Data In line has gone to the low state (a BREAK signal), but it 
cant detect the return to the high state.  Therefore, the PCs menu 
includes a command to manually set the Data In status to High.  To test 
this line, set the Data Out line to High on the Atari and the Data In 
status to High on the PC.  Then change the Data Out line to Low on the 
Atari and you will see the Data In status change to Low on the PC.

Should you be having trouble in this area, this menu can be useful in 
following signal levels through the circuit with a voltmeter.  You can use 
the two programs to set signals to known levels and change them as you 
watch your meter.  You can get circuit diagram and troubleshooting 
information from the BUILD_IT directory of your distribution disk.  
Run VIEW-CKT.BAT to see the schematics and read BUILD_IT.TXT 
for more info on voltages.  Speaking of voltages, heres how they 
correlate to High and Low:  At the Atari end, High is near +5 volts and 
Low is near 0 Volts.  At the PC end, High is from -5 to -15 volts 
(generally -9) and Low is +5 to +15 volts (generally +9).

INTERCOM MODE:

This mode allows testing the sending and receiving of bytes over the 
serial lines in a rudimentary manner, free of command frames and 
operating system complexities.  It works like a Chat Mode in a 
communications program. You type on one keyboard and text appears 
on the other.  A few details are given below:

I found that the serial chip on the Atari (POKEY) wont work reliably 
in full duplex mode, so its necessary on the Atari end to toggle between 
Sending and Receiving modes.  Control-A does this.  Escape quits the 
function.  Note that I built in some minimal translation, such as for 
carriage return / linefeed, but not much more.  So characters other than 
alphanumeric and common punctuation on one computer probably 
wont look the same on the other.  I dont think backspace and delete 
translate.

GET SECTORS / SEND SECTORS:

This function fully tests the ability of the Atari and PC to exchange disk 
sectors.  The data sent is a tongue twister of various bit patterns.  On the 
Atari end you choose whether to send or receive sectors, and how 
many.  On the PC end, you just select Sector I/O.  Set up the PC first.  
I made up a field for status to be printed to the PCs screen.  It consists 
of a disk number field and 11 asterisks for status characters.  I ended up 
using only a couple of the character fields as explained below:

All disk sector I/O consists of a command frame from the Atari to the 
PC, then a data frame in the appropriate direction.  The first asterisk is 
for status of the command frame.  

T means timed out with no data.  (The command line went low, but no 
data came thru.)
K means bad checksum (Received checksum didnt agree with 
calculated.)
H means command line went high before command frame completed
L means command line didnt return high after frame completed.

The second asterisk is for errors observed when sectors were being sent 
from the Atari to the PC.

T means timed out waiting for data from the serial bus.
K means bad checksum for sector data received.

Before the asterisks is a three digit number field for the sector number.  
The sector numbers start at 101.  So if you chose 50 sectors, expect 
sector numbers 101 thru 150, etc.

No status field is printed after the command frame unless it had an 
error.  Generally, such a field would have no sector number (nnn) 
because the sector number is included in the command frame.  A status 
field is always printed after completion of the sector data transfer.  A 
sector number and all asterisks should mean no error.  However, if you 
observe the same sector number twice in a row, it means there was a 
retry, so an error did occur.  Press any key to leave the sector I/O mode 
on the PC.

On the Atari, the screen just indicates OK or BAD for each sector, as 
reported by SIO.  I didnt want to do extensive calculating and screen 
printing because this might bias the process with the amount of time 
delay inserted between sectors.  This isnt a problem on the PCs end 
due to its speed and the fact that Im using direct screen writes.

Some technical notes.  For sector I/O, the Atari program sets up the 
DCB and calls SIO via DISKINV at $E453.  So its independent of 
which Atari DOS is being used.  On the PC end, I rewrote separate Get 
Sector and Put Sector routines to get rid of all the complexities such as 
write protection, bad sector, physical disk, etc.  This makes it easier to 
tell if a problem is caused by a bug in my software.  If a problem exists 
in both normal use and using DIAGS, its probably hardware.  But if 
DIAGS handles I/O OK, then maybe theres a problem in my SECTOR 
I/O routines.  Note that you can run DIAGS on the Atari and keep the 
PC in the normal SIO2PC mode with a disk image in D1 and test sector 
I/O that way as well.

I hope this addition to the SIO2PC system proves useful.  Ive already 
found some interesting things about my various serial ports which 
wouldnt work with SIO2PC.  One passed the Intercom test, but had a 
dead command line (RI on the PC) input.  Another was completely 
dead.  

Obviously, if you just built SIO2PC and its not working, and you have 
DIAGS.OBJ on the ATARI.ATR disk image, you have no way of 
loading the diagnostics onto your Atari.  Just drop me a line and Ill 
send you a copy on an Atari formatted disk for the price of the disk and 
mailer.

When I started this project, I knew of three guys having problems with 
SIO2PC.  One had recently changed his video and possibly his serial 
card to high speed VESA bus versions and then SIO2PC quit working.  
Another just changed his serial card to a 16550 type on his 100 MHz 
486 and it doesnt work.  The third found that SIO2PC would run 
(haltingly) only in a DOS shell out of Windows.  The last guy finally 
discovered that, despite Gateways assurances, he had a conflict 
between his internal modem and his serial port.  So Ive got two known 
problems left, and the high speed 16550 chip is the strong suspect.

NRK 12/3/95
