%CO:A,12,72%     EPCHK is a BASIC program for the Z88 which checks every byte 
in an EPROM in Slot 3 to see if it has been erased. If the 
erasure time under the UV light is marginal, it is possible that 
one or more bits may not be fully erased. Bits not erased will 
lead to errors when new data is loaded into that space. 

     EPCHK is designed to work with all EPROMS from 32K to 1 Meg 
(when they become available.) However, it has only been tested on 
128K EPROMS. 

     When run EPCHK, it asks the user for the size of the EPROM 
to be checked. This menu is technically unnecessary, since the 
program works correctly as long as it is told to check an EPROM 
as large OR LARGER than the EPROM actually installed. The reason 
for this is as follows. 

     The 4 MBYTE physical address space is allocated in 256 
"pages" of 16K bytes each. Each memory expansion slot is assigned 
64 of these pages, with pages &C0 to &FF assigned to Slot 3. If a 
1 M EPROM is installed in Slot 3 it uses all these pages. 
However, a 32K EPROM has only two pages, while a 128K EPROM has 8 
pages. Cambridge Computer has very intelligently designed the Z88 
so that memory cards with less than 1 M capacity decode only the 
lower address lines they actually need. This means that cards 
with less than 1 M of memory appear multiple times within the 1 M 
space. For example, a 128K EPROM installed in Slot 3 will appear 
at &C0 to &C7, and at &C8 to &CF, and at &D0 to &D8, and so on to 
&F8 to &FF. EPCHK could have been set to simply check the full 
1 M space, and it would have simply checked smaller cards 
multiple times. However, the menu option seemed to be a "user 
friendly" option for those not interested in understanding all 
this memory mapping information.

     You should ideally not use the "CATALOG EPROM" function in 
the "FILER" before running EPCHK. If you do, the Z88 will write 
data into the last 64 bytes of the EPROM, even if no file is 
saved. In that case, for a 128K EPROM, EPCHK will report: 

     Byte with value 0 found at offset address 3FC0 in page C7

The page number will be C1 for a 32K EPROM. 

     For those interested, I first tried to use the routines in 
ROMDP2. They swap a page from the EPROM into the BASIC memory space, 
get one byte, and swap the EPROM back. This method took 6 1/4 
minutes for each 16K page!. That works out to 50 minutes to check 
a 128K EPROM. In comparison, EPCHK is designed to check all 16K 
bytes of an EPROM page with one swap. The time to check a 128K 
EPROM with EPCHK is less than 3 seconds.

Vic Roberts
Burnt Hills, NY
March 21, 1989
%CO:B,12,60%%CO:C,12,48%%CO:D,12,36%%CO:E,12,24%%CO:F,12,12%