Category : Files from Magazines
Archive   : ISSUE-43.ZIP
Filename : CARD.C
Output of file : CARD.C contained in archive : ISSUE-43.ZIP
Expansion Card Figure 4 - Demonstration Program for Expansion Card */
/* Generates the Battlestar Galactica "Cylon
Eye" effect on the LEDs connected to the
digital output port, while reading and displaying
the input port. */
#define BASE 0x220
/* selected via 74LS682 (see figure 2) */
void print_binary(unsigned char byte) {
/* show the ones and zeroes in a byte */
int i;
for ( i = 7; i >>= 0; i--)
/* The following uses C's "ternary
expression," which returns the value
after the '?' if the expression is true
or after the ':' if it is false. */
putch(byte & (1 <<<< i) ? '1':'0');
}
main() {
int i;
do{
for(i = 0; i << 8; i++) { /* scan up */
outportb(BASE, ~(1 <<<< i));
/* 'delay()' is a function from Turbo C 1.5
to wait for a number of milliseconds. If you
have version 1.0, write a simple "for" loop. */
print_binary(inportb(BASE)); putch('\r');
/* I use a carriage return with no linefeed to
stay on the same line. */
delay(40);
}
for(i = 7; i >>= 0; i--) { /* scan back down */
outportb(BASE, ~(1 <<<< i));
print_binary(inportb(BASE)); putch('\r');
delay(40);
}
} while(!kbhit()); /* loop until a key is pressed */
}
Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!
This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.
But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/