/*
Undebugged algorithm to test independence of address lines.
Note that it only damages locations with at most two bits in their address.
Hence if this code is loaded starting at say location 0x600 it will not be hit.

A similar algorithm is needed to test independence of data lines.
*/

testadr(n) /* test first n address lines for independence */
{int i,j,k,l;
 short *a[4];
	for (i=1; i<n; i++)
		for (j=0; j<i; j++) {
			a[0] = (short*)0;
			a[1] = (short*)(1<<j);
			a[2] = (short*)(1<<i);
			a[3] = (short*)(1<<i + 1<<j);
			for (k=0; k<4; k++) {
				for (l=0; l<4; l++)
					*a[l] = 0;
				*a[k] = -1;
				for (l=0; l<4; l++)
					switch ((int)*a[l]) {
						case 0: if (l==k) error();
							break;
						case -1:if (l!=k) error();
							break;
						default:error();
							break;
					}
			}
		}
}
