/* testdaud.c 21 Dec. 1981 11:54 am PST (Monday) */ extern char IRESET, I9513, I8237, I8259, EAII; extern int encrypt(), decrypt(), encend(), chav(); extern char getchar(); extern int clklo; extern char *aiadr(), *aoadr(); char key[8], buf[160]; struct ecb { char *kp, *srcp, *dstp; int count; }; struct ecb cbea, cbeb, cbd; char *ina, *inb, *lasto; int lastic; /* Test DMA encryption */ main() { initworld(); for (;;) { if (clklo != lastic) { lastic = clklo; if (lastic & 1) encrypt(&cbea); else encrypt(&cbeb); if (lasto == 0) lasto = aoadr() + 0x0700; cbd.dstp = lasto; encw(); decrypt(&cbd); lasto += 160; if (lasto >= (char *) 0x9000) lasto -= 0x1000; encw(); }; }; /* end of forever loop */ }; encw() { while(!encend()) { if (clklo != lastic) { initworld(); break; }; }; }; initworld() { int i; intoff(); intinit(); putstring("\rDMA Audio test\r"); portstr(&IRESET); audoff(); portstr(&I9513); portstr(&I8259); audon(); lasto = 0; for (i=0; i<8; i++) key[i] = 0x01; inton(); portstr(&I8237); portstr(&EAII); ina = 0x3e00; inb = 0x3ea0; cbea.kp = key; cbea.srcp = ina; cbea.dstp = buf; cbea.count = 160; cbeb.kp = key; cbeb.srcp = inb; cbeb.dstp = buf; cbeb.count = 160; cbd.kp = key; cbd.srcp = buf; /* cbd.dstp = res; */ cbd.count = 160; while (aiadr() > (char *) 0x3e10) ; clklo = 0; lastic = clklo; }; audini() { int i; i = i; }; ptimi() { int i; i = i; };