I am designing a program to work with a circuit I created. I'm just using a 16-bit base DOS compiler because I don't understand the CreateFile() function yet...here's the code:
Code:
#include <stdio.h>
#include <dos.h>
void main(void)
{
int a;
char LPT[]="6F28767C395D5F687F7D";
printf("\n\n\tDisplay Number (0 to 9): ");
scanf("%i",&a);
if ((a>9) || (a<0))
{
printf("\n\tInvalid Number! (0 to 9 Only)");
}
a*=2;
outportb(0x378,0xLPT[a],LPT[a+1]);
}
When the outportb() function is run, what will it send to the 0x378 location? Say a=0....Would it send 0x6F to the x378 location? I know the code works with printf...it prints out the right array values...I just don't know if I can use a combination of letters, then a variable like that...?
Last question...would using an array like that work faster than just using a switch statement and making a case for each number?