#include <stdio.h>
#include <alloc.h>
#include <conio.h>
#include <ctype.h>
#include <dos.h>

#define  EPROMSize    0x00000001
#define  ProgramType  FastProgram
#define  TitleMessage "27C128 Fast. Make sure VPP switch in up posistion"


void DataDirection(char InOut);
char ProgramPulse(char Time);
void BlankCheck(void);
void WriteEprom(void);
void ReadEprom(void);
void VerifyEprom(void);

#include <c:\epinc.c>

void main(void)
{
int  KeyPressed;
int  DummyCount1;
int  DummyCount2;
int  Address;
int  Overflow;

Init();

clrscr();

puts("Testing counter");

for (DummyCount1 = 0; DummyCount1 < 10; DummyCount1++)
    {
     DataDirection(IN);
     for (Address = 0; Address <= MaxCount; Address++)
	 {
	  Overflow = AddressClock();
	  if ((Address == MaxCount) && !Overflow)
	      {
	       puts("Error counter fail");
	       Exit(4);
	      }
	 }
     putch('.');
    }
puts("\nPASS\n");

printf("Testing Data IO\n");

for(DummyCount1 = 0; DummyCount1 < 10; DummyCount1++)
    {
     for(DummyCount2 = 0; DummyCount2 < 255; DummyCount2++)
	 {
	  SetData(DummyCount2);
	 }
     putch('.');
    }
puts("\nPASS\n");


VCC(0);
puts("Test VCC Is 0v And Press A Key\n");
while (!kbhit());
getch();

VCC(5);
puts("Test VCC Is 5v And Press A Key\n");
while (!kbhit());
getch();

VCC(6);
puts("Test VCC Is 6v And Press A Key\n");
while (!kbhit());
getch();

VPP(0);
puts("Test VPP Is 0v And Press A Key\n");
while (!kbhit());
getch();

VPP(5);
puts("Test VPP Is 5v And Press A Key\n");
while (!kbhit());
getch();

VPP(12);
puts("Test VPP Is 12.5v And Press A Key\n");
while (!kbhit());
getch();

VCC(0);
VPP(0);

puts("ALL PASS OK\n");

Exit(0);
}


void DataDirection(char InOut)
/*
Sets either Data IN to EPROM or OUT of EPROM
*/
{
if(InOut)
    {
     VPP(5);
     OEData(LO);
    }
else
    {
     OEData(HI);
     VPP(0);
    }
}

char ProgramPulse(char Time)
{
puts("Not Used");
return(Time);
}

void BlankCheck(void)
{
puts("Not Used");
}

void WriteEprom(void)
{
puts("Not Used");
}

void ReadEprom(void)
{
puts("Not Used");
}

void VerifyEprom(void)
{
puts("Not Used");
}
