/* toggle parallel port bit wait for cr */ #include FIO stdout; main() { int a; out(0x4f,0); /* select group 0 */ out(0x4a,0xc0); /* enable printer */ for( ; ; ) /* endless loop */ { a=quest(); /* question operator */ if(a < 17) /* is a less than 17 */ outit(a); /* output to right port */ else break; } } outit(a) int a; { int b; if(a < 9) /* is it in the first port */ { b = 1; /* set up b for output */ b <<= (a - 1); for( ; ; ) /* endless loop */ { out(0x48,b); /* output to second port */ out(0x48,0); /* output 0 to port */ if(cpm(11) != 0) /* cp/m status */ { cpm(1); /* get useless char */ break; } } } else /* is it in the second port */ { b = 1; /* set up b for output */ b <<= (a - 9); for( ; ; ) /* endless loop */ { out(0x49,b); /* output to second port */ out(0x49,0); /* output 0 to port */ if(cpm(11) != 0) /* cp/m status */ { cpm(1); /* get useless char */ break; } } } } quest() /* question operator */ { int a; putfmt("\ntype in a number for the bit you want on.\n"); putfmt("type any key to end that bit loop\n"); putfmt("type in any number over 16 to end test\n"); getfmt("%i",&a); return(a); }