Memory Plus Card Programs
-------------------------

These programs are for use with a Tandy 1000EX or HX, with Memory Plus 
Expansion card 25-1062.  I have found that they also work with a third- 
party memory card I have.  They may work with other models such as the 
original 1000 and 1000A or other memory cards with onboard DMA chips, but 
I don't really know.  The source code is included in case you have an 
assembler and want to make it work.


TESTLOAD/TESTMEM

I was having problems with my 1000HX, in that it would lock up after a time 
if I wasn't using it continuously.  I suspected that one or more of the 
chips on the memory card were bad, but I couldn't find a memory test 
program that would run correctly on the HX - the 16k shared video/system 
RAM always messed them up.  In any case, it wasn't the motherboard RAM I 
wanted to check, but the RAM on the card.  I wrote TESTLOAD/TESTMEM 
specifically to test the memory on the Memory Plus Expansion card.

To use the program, boot your system to the DOS prompt without TSR's or 
device drivers, or with as few as possible.  Change to the drive and 
directory where TESTLOAD.COM and TESTMEM.BIN reside, and type TESTLOAD at 
the DOS prompt.  Testload will run and load Testmem, and then Testmem will 
start testing your card's memory.  Note, Testload must find TESTMEM.BIN in 
the current directory or it will halt with an error message.

This program is written in two parts for a reason.  The objective is to 
test the memory on the expansion card, the assumption being that the memory 
on the *motherboard* is good (if you suspect it isn't, take the card out of 
the machine and see if your problems go away).  We want to load the memory 
testing routines into "safe" memory before we start testing, otherwise the 
test program might lock up without telling us anything useful.

When you install the Memory Plus card, the motherboard memory on the HX is 
moved up, and the memory on the card occupies the low segment, as shown 
below.

    Original HX (no cards) --------------------------------------------

                     segment       location
                       0000 -------   0 k     start of system RAM
                         |            |         (motherboard RAM)
                         |            |
                       3C00 ------- 240 k     start of video RAM
                         |            |
                       4000 ------- 256 k     end of motherboard RAM

    HX and Memory Plus card with 128k installed -----------------------

                     segment       location
                       0000 -------   0 k     start of system RAM
                         |            |         (4 64k x 4 chips on card)
                         |            |
                       2000 ------- 128 k     start of motherboard RAM
                         |            |
                         |            |
                       5C00 ------- 368 k     start of video RAM
                         |            |
                       6000 ------- 384 k     end of motherboard RAM

    HX and Memory Plus card with 384k installed -----------------------

                     segment       location
                       0000 -------   0 k     start of system RAM
                         |            |         (4 64k x 4 chips on card)
                         |            |
                       2000 ------- 128 k       (8 256k x 1 chips on card)
                         |            |
                         |            |
                       6000 ------- 384 k     start of motherboard RAM
                         |            |
                         |            |
                       9C00 ------- 624 k     start of video RAM
                         |            |
                       A000 ------- 640 k     end of motherboard RAM

DOS doesn't care what kind of RAM it is; it loads programs at the lowest 
available location.  We want the test routine to be in motherboard RAM, 
though.  Hence, I have TESTLOAD.COM, which DOS loads low, then Testload 
loads TESTMEM.BIN into motherboard RAM at either 2000h or 6000h.

Once TESTMEM.BIN is loaded, it will run 3 tests on the memory card.  The 
first is the pattern test.  Testmem will write 4 test patterns plus 2 
"inversions" to every byte on the memory card.  This is done 16 bytes at a 
time with interrupts disabled, so critical areas such as the interrupt 
vector table can be tested.  In the pattern test, data is being written to 
the RAM chips then read back immediately, so it is just testing whether the 
chips are good, independent of whether the DMA controller is providing RAM 
refresh.  If there is any error, Testmem will stop and display what memory 
location it was testing, what was written, and what was read back.  If the 
pattern test fails, you have a bad RAM chip on your memory card; you can 
use the diagrams above to try to narrow down which one it might be.

Note that socketed memory chips are notoriously prone to "chip creep" 
(coming loose over time).  Before you start replacing chips, just try 
unplugging them all and plugging them back in.

Assuming the card passes the pattern test, Testmem will do a basic test of 
the DMA controller.  It is a little more elaborate than what the BIOS does, 
but not much; all Testmem does is check that every bit in the read/write 
registers on the DMA controller can actually be written and read back.  If 
this test fails, your RAM chips are good, but your DMA controller is fried.  
Most likely you will be able to boot your system but it will lock up after 
a while when the memory goes stale.  I have written a TSR to help you with 
this situation; see below.

As an aside, most PC's will just beep at you and refuse to boot if the DMA 
chip is bad, but not the EX and HX - if the DMA chip is bad, they just 
assume you don't have one.  After all, on these systems, it's optional 
equipment.

The third and last test is the retention test - in other words, if I write 
something to the memory, will it be retained?  What I do here is fill all 
of memory with a bit pattern, wait a while, then read it all back.  Some 
parts of memory can't be tested in this way (DOS, BIOS, interrupt vectors). 
If your card passes the two previous tests but fails this one, you might 
have a problem with either a RAM chip or the DMA controller.  Make sure 
your memory chips are matched for speed (i.e., don't mix 80ns with 150ns in 
the same bank), as that might cause intermittent errors.

If your memory card passes all three tests, then the card is fine, and you 
should look elsewhere for whatever problem you're having.


REFRESH1.COM

This is a little program to set up the DMA controller and the programmable 
interval timer (PIT) for RAM refresh.  This code is basically copied from 
the BIOS ROM on the 1000EX.  This program is really pretty useless, since 
the BIOS ought to do this anyway if your DMA controller is working.  I've 
included the code for reference purposes.


REFRESH2.COM

This is a TSR to provide RAM refresh for a Memory Plus card whose DMA 
controller is fried.  It hooks the timer tick interrupt to read 256 bytes 
from each bank of RAM, 18.2 times per second.  The proper use of it is in 
AUTOEXEC.BAT.  This TSR doesn't take up much RAM, but it might slow your 
system down some, not that I've noticed.

Some programs won't work with REFRESH2.COM - anything that interferes with 
the timer tick interrupt.  DeskMate Music is an example, as are most games 
and communications programs.  MSD requires the /i switch and locks up if 
you check the mouse.  Also, you can't run software that comes on bootable 
diskette.

You can, of course, always take out the card and live with 256k :-).

Really, in an ideal world you would buy a new DMA chip if yours was burned 
out, but good luck getting one from Radio Shack these days.  And it's not 
like you can go into one of their stores and get a new Memory Plus card 
either.


SCANROM

This is a little program to check for option ROM's and display their 
addresses.  I wrote it because I wanted to see if my memory card had a BIOS 
on it.  It doesn't.  If your (third party) card does, this will show its 
address.


GETCLOCK

This is a program I wrote to see what speed the timer tick was set to.  It 
should say FFFEh (65534) normally.  If you are still getting lockups with 
Refresh2, there are programs out there to speed up the timer tick and 
refresh the RAM on your card more often.  My system works fine at the 
default.
