/* testref.c Stewart, March 26, 1982 1:35 PM */
extern char I9513, I8259, I8255;
extern int clklo, clkhi;
int dots;
/* set up 8259 to use two channels, the
audio interrupt channel, and the prog. timer
channel. The audio interrupt will be set up
(in the 9513) to produce an interrupt every 3 or
4 seconds. the programmable timer will be set up
to produce an interrupt every millisecond.
The audio interrupts will print different characters by
printing them directly from the service routine */
main()
{
char c;
intoff();
putstring("\rRefresh test, ? for help.\r");
portstr(&I8255);
audclk(0);
portstr(&I9513);
audclk(1);
portstr(&I8259);
intinit();
dots = 0;
for (;;) {
c = getchar() & 0177;
switch (c) {
case 'q': {
putstring("\rQuit!\r");
return;
};
case '?': {
help();
break;
};
case 'i': {
putstring("\rinterrupts on");
inton();
break;
};
case 'o': {
putstring("\rinterrupts off");
intoff();
break;
};
case 'a': {
putstring("\raudio int: ");
doaudi();
break;
};
case 'r': {
putstring("\rrefresh int: ");
dorefi();
break;
};
case 'c': {
ptime();
break;
};
default: putstring("\r unknown command");
};
putchar('\r');
}; /* end of forever loop */
};
help()
{
putstring("\rq: quit, ?: help\r");
putstring("i: int on, o: int off, a: audio int\r");
putstring("c: time, r: refresh int\r");
};
ptime()
{
putstring("\rclk = ");
putnum(clkhi, 16);
putchar(' ');
putnum(clklo, 16);
putstring("\r");
};
audclk(on)
int on;
{
if (on) on = 002;
else on = 000;
outbyte(0x00D1, on);
};
audini()
{
int i;
i = 2;
};